@sanity/insert-menu
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -15,3 +15,3 @@ /// <reference types="react" /> | ||
*/ | ||
filter?: 'auto' | 'on' | 'off' | ||
filter?: 'auto' | boolean | ||
groups?: Array<{ | ||
@@ -31,3 +31,3 @@ name: string | ||
name: 'grid' | ||
previewImageUrl: (schemaTypeName: string) => string | undefined | ||
previewImageUrl?: (schemaTypeName: string) => string | undefined | ||
} | ||
@@ -34,0 +34,0 @@ > |
import { jsx, jsxs } from "react/jsx-runtime"; | ||
import { SearchIcon, ThLargeIcon, UlistIcon } from "@sanity/icons"; | ||
import { Menu, Flex, Box, TextInput, TabList, Tab, Text, Grid, Stack, MenuItem, Tooltip, Button } from "@sanity/ui"; | ||
import startCase from "lodash.startcase"; | ||
import { useReducer, useState, createElement } from "react"; | ||
@@ -29,3 +30,3 @@ import { isValidElementType } from "react-is"; | ||
var _a; | ||
const showIcons = props.showIcons === void 0 ? !0 : props.showIcons, showFilter = props.filter === "on" ? !0 : props.filter === "off" ? !1 : props.schemaTypes.length > 5, [state, send] = useReducer(fullInsertMenuReducer, { | ||
const showIcons = props.showIcons === void 0 ? !0 : props.showIcons, showFilter = props.filter === void 0 || props.filter === "auto" ? props.schemaTypes.length > 5 : props.filter, [state, send] = useReducer(fullInsertMenuReducer, { | ||
query: "", | ||
@@ -87,3 +88,3 @@ groups: props.groups ? [ | ||
"aria-controls": `${group.name}-panel`, | ||
label: (_a2 = group.title) != null ? _a2 : group.name, | ||
label: (_a2 = group.title) != null ? _a2 : startCase(group.name), | ||
selected: group.selected, | ||
@@ -100,14 +101,17 @@ onClick: () => { | ||
), | ||
/* @__PURE__ */ jsx(Box, { padding: 1, children: filteredSchemaTypes.length === 0 ? /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: props.labels["insert-menu.search.no-results"] }) }) : selectedView ? selectedView.name === "grid" ? /* @__PURE__ */ jsx(Grid, { autoRows: "auto", flex: 1, gap: 1, style: gridStyle, children: filteredSchemaTypes.map((schemaType) => /* @__PURE__ */ jsx( | ||
GridMenuItem, | ||
{ | ||
icon: showIcons ? getSchemaTypeIcon(schemaType) : void 0, | ||
onClick: () => { | ||
props.onSelect(schemaType); | ||
/* @__PURE__ */ jsx(Box, { padding: 1, children: filteredSchemaTypes.length === 0 ? /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: props.labels["insert-menu.search.no-results"] }) }) : selectedView ? selectedView.name === "grid" ? /* @__PURE__ */ jsx(Grid, { autoRows: "auto", flex: 1, gap: 1, style: gridStyle, children: filteredSchemaTypes.map((schemaType) => { | ||
var _a2; | ||
return /* @__PURE__ */ jsx( | ||
GridMenuItem, | ||
{ | ||
icon: showIcons ? getSchemaTypeIcon(schemaType) : void 0, | ||
onClick: () => { | ||
props.onSelect(schemaType); | ||
}, | ||
previewImageUrl: (_a2 = selectedView.previewImageUrl) == null ? void 0 : _a2.call(selectedView, schemaType.name), | ||
schemaType | ||
}, | ||
previewImageUrl: selectedView.previewImageUrl(schemaType.name), | ||
schemaType | ||
}, | ||
schemaType.name | ||
)) }) : /* @__PURE__ */ jsx(Stack, { flex: 1, space: 1, children: filteredSchemaTypes.map((schemaType) => { | ||
schemaType.name | ||
); | ||
}) }) : /* @__PURE__ */ jsx(Stack, { flex: 1, space: 1, children: filteredSchemaTypes.map((schemaType) => { | ||
var _a2; | ||
@@ -121,3 +125,3 @@ return /* @__PURE__ */ jsx( | ||
}, | ||
text: (_a2 = schemaType.title) != null ? _a2 : schemaType.name | ||
text: (_a2 = schemaType.title) != null ? _a2 : startCase(schemaType.name) | ||
}, | ||
@@ -124,0 +128,0 @@ schemaType.name |
{ | ||
"name": "@sanity/insert-menu", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -37,3 +37,4 @@ "keywords": [], | ||
"@sanity/icons": "^3.2.0", | ||
"@sanity/ui": "^2.3.3" | ||
"@sanity/ui": "^2.3.3", | ||
"lodash.startcase": "^4.4.0" | ||
}, | ||
@@ -44,2 +45,3 @@ "devDependencies": { | ||
"@sanity/ui-workshop": "^2.0.15", | ||
"@types/lodash.startcase": "^4.4.9", | ||
"@typescript-eslint/eslint-plugin": "^7.13.0", | ||
@@ -46,0 +48,0 @@ "@typescript-eslint/parser": "^7.13.0", |
@@ -8,3 +8,3 @@ /** @alpha This API may change */ | ||
*/ | ||
filter?: 'auto' | 'on' | 'off' | ||
filter?: 'auto' | boolean | ||
groups?: Array<{name: string; title?: string; of?: Array<string>}> | ||
@@ -15,4 +15,5 @@ /** defaultValue `true` */ | ||
views?: Array< | ||
{name: 'list'} | {name: 'grid'; previewImageUrl: (schemaTypeName: string) => string | undefined} | ||
| {name: 'list'} | ||
| {name: 'grid'; previewImageUrl?: (schemaTypeName: string) => string | undefined} | ||
> | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78206
1010
7
14
+ Addedlodash.startcase@^4.4.0
+ Addedlodash.startcase@4.4.0(transitive)