@ngrok/mantle 0.69.0 → 0.69.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/accordion.d.ts +11 -0
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.d.ts +20 -4
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +11 -0
- package/dist/alert.js.map +1 -1
- package/dist/{button-BaNwe1ud.d.ts → button-CX98GGHD.d.ts} +4 -4
- package/dist/button.d.ts +1 -1
- package/dist/card.d.ts +10 -0
- package/dist/card.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/code-block.d.ts +220 -5
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/combobox.d.ts +13 -0
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.d.ts +302 -25
- package/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/data-table.d.ts +18 -2
- package/dist/data-table.js.map +1 -1
- package/dist/description-list.d.ts +9 -0
- package/dist/description-list.js.map +1 -1
- package/dist/dialog-DxkpMIzB.js.map +1 -1
- package/dist/dialog.d.ts +120 -65
- package/dist/{dropdown-menu-9nO7ch0t.js → dropdown-menu-CY_cVo4q.js} +2 -2
- package/dist/{dropdown-menu-9nO7ch0t.js.map → dropdown-menu-CY_cVo4q.js.map} +1 -1
- package/dist/{dropdown-menu-D6MiVSR-.d.ts → dropdown-menu-CeziL3JH.d.ts} +20 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +42 -8
- package/dist/empty.js.map +1 -1
- package/dist/hover-card.d.ts +8 -0
- package/dist/hover-card.js.map +1 -1
- package/dist/{index-DXuVn00J.d.ts → index-Bw97R9Kw.d.ts} +4 -4
- package/dist/input.d.ts +1 -1
- package/dist/media-object.d.ts +8 -0
- package/dist/media-object.js.map +1 -1
- package/dist/multi-select.d.ts +17 -0
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination.d.ts +10 -1
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts +15 -2
- package/dist/popover.js.map +1 -1
- package/dist/progress.d.ts +14 -0
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +25 -0
- package/dist/radio-group.js.map +1 -1
- package/dist/{resolve-pre-rendered-props--3gLTSwE.js → resolve-pre-rendered-props-BWARzIcY.js} +3 -2
- package/dist/{resolve-pre-rendered-props--3gLTSwE.js.map → resolve-pre-rendered-props-BWARzIcY.js.map} +1 -1
- package/dist/{resolve-pre-rendered-props-B3YDbOFZ.d.ts → resolve-pre-rendered-props-dtM7g5R-.d.ts} +2 -2
- package/dist/{select-DJmjfGjt.d.ts → select-CG6SzD3Q.d.ts} +76 -13
- package/dist/{select-Z13w6WBS.js → select-CGhC72YN.js} +2 -2
- package/dist/select-CGhC72YN.js.map +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/{separator-BuP5aENE.js → separator-Xq_e06s8.js} +2 -2
- package/dist/{separator-BuP5aENE.js.map → separator-Xq_e06s8.js.map} +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +305 -106
- package/dist/sheet.js.map +1 -1
- package/dist/split-button.d.ts +12 -2
- package/dist/split-button.js +1 -1
- package/dist/split-button.js.map +1 -1
- package/dist/{table-C7BejaFW.d.ts → table-BNq2CbgX.d.ts} +16 -1
- package/dist/table-CX43SNek.js.map +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/tabs.d.ts +10 -0
- package/dist/tabs.js.map +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/toast-BhAyUXKL.js.map +1 -1
- package/dist/toast.d.ts +9 -0
- package/dist/tooltip.d.ts +8 -0
- package/dist/tooltip.js.map +1 -1
- package/package.json +6 -6
- package/dist/select-Z13w6WBS.js.map +0 -1
package/dist/combobox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../src/components/combobox/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport * as Primitive from \"@ariakit/react\";\nimport { type ComponentPropsWithoutRef, type ComponentRef, createContext, forwardRef } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport type { WithValidation } from \"../input/types.js\";\nimport { Separator } from \"../separator/separator.js\";\nimport { Slot } from \"../slot/index.js\";\n\ntype ComboboxProps = Primitive.ComboboxProviderProps;\n\n/**\n * Root component for a combobox. Provides a combobox store that controls the state of Combobox components.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Root = ({ children, ...props }: ComboboxProps) => {\n\treturn <Primitive.ComboboxProvider {...props}>{children}</Primitive.ComboboxProvider>;\n};\nRoot.displayName = \"Combobox\";\n\ntype ComboboxInputProps = Omit<\n\tPrimitive.ComboboxProps,\n\t\"render\" // we don't support a render prop for the combobox input\n> &\n\tWithValidation;\n\n/**\n * Renders a combobox input element that can be used to filter a list of items.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Input = forwardRef<ComponentRef<\"input\">, ComboboxInputProps>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tautoComplete = \"list\",\n\t\t\tautoSelect = \"always\",\n\t\t\tclassName,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\t\tconst validation = isInvalid\n\t\t\t? \"error\"\n\t\t\t: typeof _validation === \"function\"\n\t\t\t\t? _validation()\n\t\t\t\t: _validation;\n\t\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\n\t\treturn (\n\t\t\t<Primitive.Combobox\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tautoComplete={autoComplete}\n\t\t\t\tautoSelect={autoSelect}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"pointer-coarse:text-base h-9 text-sm\",\n\t\t\t\t\t\"bg-form relative block w-full rounded-md border px-3 py-2 border-form text-strong font-sans\",\n\t\t\t\t\t\"placeholder:text-placeholder\",\n\t\t\t\t\t\"aria-disabled:opacity-50\",\n\t\t\t\t\t\"hover:border-neutral-400\",\n\t\t\t\t\t\"focus:outline-hidden focus:ring-4 aria-expanded:ring-4\",\n\t\t\t\t\t\"focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger\",\n\t\t\t\t\t\"autofill:shadow-(--color-blue-50) autofill:bg-blue-50 autofill:[-webkit-text-fill-color:var(--text-color-strong)]\", // Autofill styling on the input itself and any children with autofill styling\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInput.displayName = \"ComboboxInput\";\n\ntype ComboboxContentProps = Omit<Primitive.ComboboxPopoverProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Content = forwardRef<ComponentRef<typeof Primitive.ComboboxPopover>, ComboboxContentProps>(\n\t(\n\t\t{ asChild = false, children, className, sameWidth = true, unmountOnHide = true, ...props },\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<Primitive.ComboboxPopover\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden rounded-md border shadow-md p-1 my-2 space-y-px font-sans focus:outline-hidden\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\trender={\n\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t}\n\t\t\t\tsameWidth={sameWidth}\n\t\t\t\tunmountOnHide={unmountOnHide}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Primitive.ComboboxPopover>\n\t\t);\n\t},\n);\nContent.displayName = \"ComboboxContent\";\n\ntype ComboboxItemProps = Omit<Primitive.ComboboxItemProps, \"render\"> & WithAsChild;\n\nconst ComboboxItemValueContext = createContext<string | undefined>(undefined);\n\n/**\n * Renders a combobox item inside a Combobox.Content component.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * <Combobox.Item value=\"Orange\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Item = forwardRef<ComponentRef<typeof Primitive.ComboboxItem>, ComboboxItemProps>(\n\t({ asChild = false, children, className, focusOnHover = true, value, ...props }, ref) => {\n\t\treturn (\n\t\t\t<ComboboxItemValueContext.Provider value={value}>\n\t\t\t\t<Primitive.ComboboxItem\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"cursor-pointer rounded-md px-2 py-1.5 text-strong text-sm flex min-w-0 gap-2 items-center [&>svg]:size-5 [&_svg]:shrink-0\",\n\t\t\t\t\t\t\"data-active-item:bg-active-menu-item\",\n\t\t\t\t\t\t\"aria-disabled:opacity-50\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tfocusOnHover={focusOnHover}\n\t\t\t\t\tref={ref}\n\t\t\t\t\trender={\n\t\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</Primitive.ComboboxItem>\n\t\t\t</ComboboxItemValueContext.Provider>\n\t\t);\n\t},\n);\nItem.displayName = \"ComboboxItem\";\n\ntype ComboboxGroupProps = Omit<Primitive.ComboboxGroupProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a group for Combobox.Item elements.\n *\n * Optionally, a Combobox.GroupLabel can be rendered as a child to provide a label for the group.\n *\n * You should only reach for this component when it semantically makes sense to group items together, such as when a label is needed.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Group = forwardRef<ComponentRef<typeof Primitive.ComboboxGroup>, ComboboxGroupProps>(\n\t({ asChild = false, children, className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<Primitive.ComboboxGroup\n\t\t\t\tclassName={cx(\"space-y-px\", className)}\n\t\t\t\tref={ref}\n\t\t\t\trender={\n\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Primitive.ComboboxGroup>\n\t\t);\n\t},\n);\nGroup.displayName = \"ComboboxGroup\";\n\ntype ComboboxGroupLabelProps = Omit<Primitive.ComboboxGroupLabelProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a label in a combobox group.\n *\n * This component should be wrapped with Combobox.Group so the aria-labelledby is correctly set on the group element.\n *\n * You should only reach for this component when it semantically makes sense to group items together, such as when a label is needed.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst GroupLabel = forwardRef<\n\tComponentRef<typeof Primitive.ComboboxGroupLabel>,\n\tComboboxGroupLabelProps\n>(({ asChild = false, children, className, ...props }, ref) => {\n\treturn (\n\t\t<Primitive.ComboboxGroupLabel\n\t\t\tclassName={cx(\"text-muted px-2 py-1 text-xs font-medium\", className)}\n\t\t\tref={ref}\n\t\t\trender={asChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Primitive.ComboboxGroupLabel>\n\t);\n});\nGroupLabel.displayName = \"ComboboxGroupLabel\";\n\ntype ComboboxItemValueProps = Omit<Primitive.ComboboxItemValueProps<\"span\">, \"render\"> &\n\tWithAsChild;\n\n/**\n * Highlights the match between the current Combobox.Input value (userValue) and parent Combobox.Item value.\n *\n * Renders a span element with the combobox item value as children.\n * The value is split into span elements.\n * Portions of the value matching the user input will have a data-user-value attribute, while the rest will have a data-autocomplete-value attribute.\n *\n * Should only be used as a child of Combobox.Item.\n * The item value is automatically set to the value of the closest Combobox.Item component's value prop.\n * The user input value is automatically set to the combobox store's value state.\n * Both values can be overridden by providing the value and userValue props, respectively.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\">\n * 🍎\n * <Combobox.ItemValue />\n * </Combobox.Item>\n * <Combobox.Item value=\"Banana\">\n * 🍌\n * <Combobox.ItemValue />\n * </Combobox.Item>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst ItemValue = forwardRef<\n\tComponentRef<typeof Primitive.ComboboxItemValue>,\n\tComboboxItemValueProps\n>(({ asChild = false, className, ...props }, ref) => {\n\treturn (\n\t\t<Primitive.ComboboxItemValue\n\t\t\tclassName={cx(\n\t\t\t\t\"*:data-user-value:font-medium flex-1 shrink-0 text-strong font-normal\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\trender={asChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nItemValue.displayName = \"ComboboxItemValue\";\n\n/**\n * Renders a separator between Combobox.Items or Combobox.Groups.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * <Combobox.Separator />\n * <Combobox.Item>\n * Click me!\n * </Combobox.Item>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst ComboboxSeparatorComponent = forwardRef<\n\tComponentRef<typeof Separator>,\n\tComponentPropsWithoutRef<typeof Separator>\n>(({ className, ...props }, ref) => (\n\t<Separator ref={ref} className={cx(\"-mx-1.25 my-1 w-auto\", className)} {...props} />\n));\nComboboxSeparatorComponent.displayName = \"ComboboxSeparator\";\n\n/**\n * Fill in a React input field with autocomplete & autosuggest functionalities.\n * Choose from a list of suggested values with full keyboard support.\n * This component is based on the WAI-ARIA Combobox Pattern and is powered by the\n * ariakit Combobox.\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/\n * @see https://ariakit.org/components/combobox\n *\n * @see https://mantle.ngrok.com/components/combobox\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Combobox = {\n\t/**\n\t * Root component for a combobox. Provides a combobox store that controls the state of Combobox components.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxroot\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxcontent\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tContent,\n\t/**\n\t * Renders a group for Combobox.Item elements.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxgroup\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tGroup,\n\t/**\n\t * Renders a label in a combobox group.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxgrouplabel\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tGroupLabel,\n\t/**\n\t * Renders a combobox input element that can be used to filter a list of items.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxinput\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tInput,\n\t/**\n\t * Renders a combobox item inside a Combobox.Content component.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxitem\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * <Combobox.Item value=\"Orange\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tItem,\n\t/**\n\t * Highlights the match between the current Combobox.Input value and parent Combobox.Item value.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxitemvalue\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\">\n\t * 🍎\n\t * <Combobox.ItemValue />\n\t * </Combobox.Item>\n\t * <Combobox.Item value=\"Banana\">\n\t * 🍌\n\t * <Combobox.ItemValue />\n\t * </Combobox.Item>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tItemValue,\n\t/**\n\t * Renders a separator between Combobox.Items or Combobox.Groups.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxseparator\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * <Combobox.Separator />\n\t * <Combobox.Item>\n\t * Click me!\n\t * </Combobox.Item>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tSeparator: ComboboxSeparatorComponent,\n} as const;\n\nexport {\n\t//,\n\tCombobox,\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../src/components/combobox/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport * as Primitive from \"@ariakit/react\";\nimport { type ComponentPropsWithoutRef, type ComponentRef, createContext, forwardRef } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport type { WithValidation } from \"../input/types.js\";\nimport { Separator } from \"../separator/separator.js\";\nimport { Slot } from \"../slot/index.js\";\n\ntype ComboboxProps = Primitive.ComboboxProviderProps;\n\n/**\n * Root component for a combobox. Provides a combobox store that controls the state of Combobox components.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Root = ({ children, ...props }: ComboboxProps) => {\n\treturn <Primitive.ComboboxProvider {...props}>{children}</Primitive.ComboboxProvider>;\n};\nRoot.displayName = \"Combobox\";\n\ntype ComboboxInputProps = Omit<\n\tPrimitive.ComboboxProps,\n\t\"render\" // we don't support a render prop for the combobox input\n> &\n\tWithValidation;\n\n/**\n * Renders a combobox input element that can be used to filter a list of items.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Input = forwardRef<ComponentRef<\"input\">, ComboboxInputProps>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tautoComplete = \"list\",\n\t\t\tautoSelect = \"always\",\n\t\t\tclassName,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\t\tconst validation = isInvalid\n\t\t\t? \"error\"\n\t\t\t: typeof _validation === \"function\"\n\t\t\t\t? _validation()\n\t\t\t\t: _validation;\n\t\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\n\t\treturn (\n\t\t\t<Primitive.Combobox\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tautoComplete={autoComplete}\n\t\t\t\tautoSelect={autoSelect}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"pointer-coarse:text-base h-9 text-sm\",\n\t\t\t\t\t\"bg-form relative block w-full rounded-md border px-3 py-2 border-form text-strong font-sans\",\n\t\t\t\t\t\"placeholder:text-placeholder\",\n\t\t\t\t\t\"aria-disabled:opacity-50\",\n\t\t\t\t\t\"hover:border-neutral-400\",\n\t\t\t\t\t\"focus:outline-hidden focus:ring-4 aria-expanded:ring-4\",\n\t\t\t\t\t\"focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger\",\n\t\t\t\t\t\"autofill:shadow-(--color-blue-50) autofill:bg-blue-50 autofill:[-webkit-text-fill-color:var(--text-color-strong)]\", // Autofill styling on the input itself and any children with autofill styling\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInput.displayName = \"ComboboxInput\";\n\ntype ComboboxContentProps = Omit<Primitive.ComboboxPopoverProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Content = forwardRef<ComponentRef<typeof Primitive.ComboboxPopover>, ComboboxContentProps>(\n\t(\n\t\t{ asChild = false, children, className, sameWidth = true, unmountOnHide = true, ...props },\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<Primitive.ComboboxPopover\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden rounded-md border shadow-md p-1 my-2 space-y-px font-sans focus:outline-hidden\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\trender={\n\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t}\n\t\t\t\tsameWidth={sameWidth}\n\t\t\t\tunmountOnHide={unmountOnHide}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Primitive.ComboboxPopover>\n\t\t);\n\t},\n);\nContent.displayName = \"ComboboxContent\";\n\ntype ComboboxItemProps = Omit<Primitive.ComboboxItemProps, \"render\"> & WithAsChild;\n\nconst ComboboxItemValueContext = createContext<string | undefined>(undefined);\n\n/**\n * Renders a combobox item inside a Combobox.Content component.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * <Combobox.Item value=\"Orange\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Item = forwardRef<ComponentRef<typeof Primitive.ComboboxItem>, ComboboxItemProps>(\n\t({ asChild = false, children, className, focusOnHover = true, value, ...props }, ref) => {\n\t\treturn (\n\t\t\t<ComboboxItemValueContext.Provider value={value}>\n\t\t\t\t<Primitive.ComboboxItem\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"cursor-pointer rounded-md px-2 py-1.5 text-strong text-sm flex min-w-0 gap-2 items-center [&>svg]:size-5 [&_svg]:shrink-0\",\n\t\t\t\t\t\t\"data-active-item:bg-active-menu-item\",\n\t\t\t\t\t\t\"aria-disabled:opacity-50\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tfocusOnHover={focusOnHover}\n\t\t\t\t\tref={ref}\n\t\t\t\t\trender={\n\t\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</Primitive.ComboboxItem>\n\t\t\t</ComboboxItemValueContext.Provider>\n\t\t);\n\t},\n);\nItem.displayName = \"ComboboxItem\";\n\ntype ComboboxGroupProps = Omit<Primitive.ComboboxGroupProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a group for Combobox.Item elements.\n *\n * Optionally, a Combobox.GroupLabel can be rendered as a child to provide a label for the group.\n *\n * You should only reach for this component when it semantically makes sense to group items together, such as when a label is needed.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Group = forwardRef<ComponentRef<typeof Primitive.ComboboxGroup>, ComboboxGroupProps>(\n\t({ asChild = false, children, className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<Primitive.ComboboxGroup\n\t\t\t\tclassName={cx(\"space-y-px\", className)}\n\t\t\t\tref={ref}\n\t\t\t\trender={\n\t\t\t\t\tasChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined\n\t\t\t\t}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Primitive.ComboboxGroup>\n\t\t);\n\t},\n);\nGroup.displayName = \"ComboboxGroup\";\n\ntype ComboboxGroupLabelProps = Omit<Primitive.ComboboxGroupLabelProps, \"render\"> & WithAsChild;\n\n/**\n * Renders a label in a combobox group.\n *\n * This component should be wrapped with Combobox.Group so the aria-labelledby is correctly set on the group element.\n *\n * You should only reach for this component when it semantically makes sense to group items together, such as when a label is needed.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst GroupLabel = forwardRef<\n\tComponentRef<typeof Primitive.ComboboxGroupLabel>,\n\tComboboxGroupLabelProps\n>(({ asChild = false, children, className, ...props }, ref) => {\n\treturn (\n\t\t<Primitive.ComboboxGroupLabel\n\t\t\tclassName={cx(\"text-muted px-2 py-1 text-xs font-medium\", className)}\n\t\t\tref={ref}\n\t\t\trender={asChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Primitive.ComboboxGroupLabel>\n\t);\n});\nGroupLabel.displayName = \"ComboboxGroupLabel\";\n\ntype ComboboxItemValueProps = Omit<Primitive.ComboboxItemValueProps<\"span\">, \"render\"> &\n\tWithAsChild;\n\n/**\n * Highlights the match between the current Combobox.Input value (userValue) and parent Combobox.Item value.\n *\n * Renders a span element with the combobox item value as children.\n * The value is split into span elements.\n * Portions of the value matching the user input will have a data-user-value attribute, while the rest will have a data-autocomplete-value attribute.\n *\n * Should only be used as a child of Combobox.Item.\n * The item value is automatically set to the value of the closest Combobox.Item component's value prop.\n * The user input value is automatically set to the combobox store's value state.\n * Both values can be overridden by providing the value and userValue props, respectively.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\">\n * 🍎\n * <Combobox.ItemValue />\n * </Combobox.Item>\n * <Combobox.Item value=\"Banana\">\n * 🍌\n * <Combobox.ItemValue />\n * </Combobox.Item>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst ItemValue = forwardRef<\n\tComponentRef<typeof Primitive.ComboboxItemValue>,\n\tComboboxItemValueProps\n>(({ asChild = false, className, ...props }, ref) => {\n\treturn (\n\t\t<Primitive.ComboboxItemValue\n\t\t\tclassName={cx(\n\t\t\t\t\"*:data-user-value:font-medium flex-1 shrink-0 text-strong font-normal\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\trender={asChild ? ({ ref, ...childProps }) => <Slot ref={ref} {...childProps} /> : undefined}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nItemValue.displayName = \"ComboboxItemValue\";\n\n/**\n * Renders a separator between Combobox.Items or Combobox.Groups.\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Group>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Group>\n * <Combobox.Separator />\n * <Combobox.Item>\n * Click me!\n * </Combobox.Item>\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst ComboboxSeparatorComponent = forwardRef<\n\tComponentRef<typeof Separator>,\n\tComponentPropsWithoutRef<typeof Separator>\n>(({ className, ...props }, ref) => (\n\t<Separator ref={ref} className={cx(\"-mx-1.25 my-1 w-auto\", className)} {...props} />\n));\nComboboxSeparatorComponent.displayName = \"ComboboxSeparator\";\n\n/**\n * Fill in a React input field with autocomplete & autosuggest functionalities.\n * Choose from a list of suggested values with full keyboard support.\n * This component is based on the WAI-ARIA Combobox Pattern and is powered by the\n * ariakit Combobox.\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/\n * @see https://ariakit.org/components/combobox\n *\n * @see https://mantle.ngrok.com/components/combobox\n *\n * @example\n * Composition:\n * ```\n * Combobox.Root\n * ├── Combobox.Input\n * └── Combobox.Content\n * ├── Combobox.Group\n * │ ├── Combobox.GroupLabel\n * │ └── Combobox.Item\n * │ └── Combobox.ItemValue\n * └── Combobox.Separator\n * ```\n *\n * @example\n * <Combobox.Root>\n * <Combobox.Input />\n * <Combobox.Content>\n * <Combobox.Item value=\"Apple\" />\n * <Combobox.Item value=\"Banana\" />\n * </Combobox.Content>\n * </Combobox.Root>\n */\nconst Combobox = {\n\t/**\n\t * Root component for a combobox. Provides a combobox store that controls the state of Combobox components.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxroot\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxcontent\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tContent,\n\t/**\n\t * Renders a group for Combobox.Item elements.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxgroup\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tGroup,\n\t/**\n\t * Renders a label in a combobox group.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxgrouplabel\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.GroupLabel>Fruits</Combobox.GroupLabel>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tGroupLabel,\n\t/**\n\t * Renders a combobox input element that can be used to filter a list of items.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxinput\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tInput,\n\t/**\n\t * Renders a combobox item inside a Combobox.Content component.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxitem\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * <Combobox.Item value=\"Orange\" />\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tItem,\n\t/**\n\t * Highlights the match between the current Combobox.Input value and parent Combobox.Item value.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxitemvalue\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Item value=\"Apple\">\n\t * 🍎\n\t * <Combobox.ItemValue />\n\t * </Combobox.Item>\n\t * <Combobox.Item value=\"Banana\">\n\t * 🍌\n\t * <Combobox.ItemValue />\n\t * </Combobox.Item>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tItemValue,\n\t/**\n\t * Renders a separator between Combobox.Items or Combobox.Groups.\n\t *\n\t * @see https://mantle.ngrok.com/components/combobox#comboboxseparator\n\t *\n\t * @example\n\t * ```tsx\n\t * <Combobox.Root>\n\t * <Combobox.Input />\n\t * <Combobox.Content>\n\t * <Combobox.Group>\n\t * <Combobox.Item value=\"Apple\" />\n\t * <Combobox.Item value=\"Banana\" />\n\t * </Combobox.Group>\n\t * <Combobox.Separator />\n\t * <Combobox.Item>\n\t * Click me!\n\t * </Combobox.Item>\n\t * </Combobox.Content>\n\t * </Combobox.Root>\n\t * ```\n\t */\n\tSeparator: ComboboxSeparatorComponent,\n} as const;\n\nexport {\n\t//,\n\tCombobox,\n};\n"],"mappings":"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"}
|
package/dist/command.d.ts
CHANGED
|
@@ -58,8 +58,26 @@ type CommandDialogContentProps = {
|
|
|
58
58
|
* @see https://mantle.ngrok.com/components/command
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
|
+
* Composition:
|
|
62
|
+
* ```
|
|
63
|
+
* Command.Dialog.Root
|
|
64
|
+
* ├── Command.Dialog.Trigger
|
|
65
|
+
* └── Command.Dialog.Content
|
|
66
|
+
* ├── Command.Input
|
|
67
|
+
* └── Command.List
|
|
68
|
+
* ├── Command.Empty
|
|
69
|
+
* ├── Command.Group
|
|
70
|
+
* │ └── Command.Item
|
|
71
|
+
* │ └── Command.Shortcut
|
|
72
|
+
* └── Command.Separator
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
61
76
|
* ```tsx
|
|
62
77
|
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
78
|
+
* <Command.Dialog.Trigger asChild>
|
|
79
|
+
* <Button type="button">Open Command Palette</Button>
|
|
80
|
+
* </Command.Dialog.Trigger>
|
|
63
81
|
* <Command.Dialog.Content>
|
|
64
82
|
* <Command.Input placeholder="Type a command or search..." />
|
|
65
83
|
* <Command.List>
|
|
@@ -73,11 +91,13 @@ type CommandDialogContentProps = {
|
|
|
73
91
|
* <Command.Group heading="Settings">
|
|
74
92
|
* <Command.Item>
|
|
75
93
|
* <span>Profile</span>
|
|
94
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
76
95
|
* </Command.Item>
|
|
77
96
|
* </Command.Group>
|
|
78
97
|
* </Command.List>
|
|
79
98
|
* </Command.Dialog.Content>
|
|
80
99
|
* </Command.Dialog.Root>
|
|
100
|
+
* ```
|
|
81
101
|
*/
|
|
82
102
|
declare const Command: {
|
|
83
103
|
/**
|
|
@@ -87,12 +107,29 @@ declare const Command: {
|
|
|
87
107
|
*
|
|
88
108
|
* @example
|
|
89
109
|
* ```tsx
|
|
90
|
-
* <Command.Root>
|
|
91
|
-
* <Command.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
110
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
111
|
+
* <Command.Dialog.Trigger asChild>
|
|
112
|
+
* <Button type="button">Open Command Palette</Button>
|
|
113
|
+
* </Command.Dialog.Trigger>
|
|
114
|
+
* <Command.Dialog.Content>
|
|
115
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
116
|
+
* <Command.List>
|
|
117
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
118
|
+
* <Command.Group heading="Suggestions">
|
|
119
|
+
* <Command.Item>
|
|
120
|
+
* <span>Calendar</span>
|
|
121
|
+
* </Command.Item>
|
|
122
|
+
* </Command.Group>
|
|
123
|
+
* <Command.Separator />
|
|
124
|
+
* <Command.Group heading="Settings">
|
|
125
|
+
* <Command.Item>
|
|
126
|
+
* <span>Profile</span>
|
|
127
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
128
|
+
* </Command.Item>
|
|
129
|
+
* </Command.Group>
|
|
130
|
+
* </Command.List>
|
|
131
|
+
* </Command.Dialog.Content>
|
|
132
|
+
* </Command.Dialog.Root>
|
|
96
133
|
* ```
|
|
97
134
|
*/
|
|
98
135
|
readonly Root: _$react.ForwardRefExoticComponent<Omit<{
|
|
@@ -122,12 +159,24 @@ declare const Command: {
|
|
|
122
159
|
* ```tsx
|
|
123
160
|
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
124
161
|
* <Command.Dialog.Trigger asChild>
|
|
125
|
-
* <Button type="button">Open</Button>
|
|
162
|
+
* <Button type="button">Open Command Palette</Button>
|
|
126
163
|
* </Command.Dialog.Trigger>
|
|
127
164
|
* <Command.Dialog.Content>
|
|
128
165
|
* <Command.Input placeholder="Type a command or search..." />
|
|
129
166
|
* <Command.List>
|
|
130
167
|
* <Command.Empty>No results found.</Command.Empty>
|
|
168
|
+
* <Command.Group heading="Suggestions">
|
|
169
|
+
* <Command.Item>
|
|
170
|
+
* <span>Calendar</span>
|
|
171
|
+
* </Command.Item>
|
|
172
|
+
* </Command.Group>
|
|
173
|
+
* <Command.Separator />
|
|
174
|
+
* <Command.Group heading="Settings">
|
|
175
|
+
* <Command.Item>
|
|
176
|
+
* <span>Profile</span>
|
|
177
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
178
|
+
* </Command.Item>
|
|
179
|
+
* </Command.Group>
|
|
131
180
|
* </Command.List>
|
|
132
181
|
* </Command.Dialog.Content>
|
|
133
182
|
* </Command.Dialog.Root>
|
|
@@ -138,18 +187,99 @@ declare const Command: {
|
|
|
138
187
|
* The root stateful component for the CommandDialog. Manages open/closed state.
|
|
139
188
|
*
|
|
140
189
|
* @see https://mantle.ngrok.com/components/command#commanddialogroot
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
194
|
+
* <Command.Dialog.Trigger asChild>
|
|
195
|
+
* <Button type="button">Open Command Palette</Button>
|
|
196
|
+
* </Command.Dialog.Trigger>
|
|
197
|
+
* <Command.Dialog.Content>
|
|
198
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
199
|
+
* <Command.List>
|
|
200
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
201
|
+
* <Command.Group heading="Suggestions">
|
|
202
|
+
* <Command.Item>
|
|
203
|
+
* <span>Calendar</span>
|
|
204
|
+
* </Command.Item>
|
|
205
|
+
* </Command.Group>
|
|
206
|
+
* <Command.Separator />
|
|
207
|
+
* <Command.Group heading="Settings">
|
|
208
|
+
* <Command.Item>
|
|
209
|
+
* <span>Profile</span>
|
|
210
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
211
|
+
* </Command.Item>
|
|
212
|
+
* </Command.Group>
|
|
213
|
+
* </Command.List>
|
|
214
|
+
* </Command.Dialog.Content>
|
|
215
|
+
* </Command.Dialog.Root>
|
|
216
|
+
* ```
|
|
141
217
|
*/
|
|
142
218
|
readonly Root: typeof Root;
|
|
143
219
|
/**
|
|
144
220
|
* A button that opens the CommandDialog when clicked.
|
|
145
221
|
*
|
|
146
222
|
* @see https://mantle.ngrok.com/components/command#commanddialogtrigger
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
227
|
+
* <Command.Dialog.Trigger asChild>
|
|
228
|
+
* <Button type="button">Open Command Palette</Button>
|
|
229
|
+
* </Command.Dialog.Trigger>
|
|
230
|
+
* <Command.Dialog.Content>
|
|
231
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
232
|
+
* <Command.List>
|
|
233
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
234
|
+
* <Command.Group heading="Suggestions">
|
|
235
|
+
* <Command.Item>
|
|
236
|
+
* <span>Calendar</span>
|
|
237
|
+
* </Command.Item>
|
|
238
|
+
* </Command.Group>
|
|
239
|
+
* <Command.Separator />
|
|
240
|
+
* <Command.Group heading="Settings">
|
|
241
|
+
* <Command.Item>
|
|
242
|
+
* <span>Profile</span>
|
|
243
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
244
|
+
* </Command.Item>
|
|
245
|
+
* </Command.Group>
|
|
246
|
+
* </Command.List>
|
|
247
|
+
* </Command.Dialog.Content>
|
|
248
|
+
* </Command.Dialog.Root>
|
|
249
|
+
* ```
|
|
147
250
|
*/
|
|
148
251
|
readonly Trigger: _$react.ForwardRefExoticComponent<_$_radix_ui_react_dialog0.DialogTriggerProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
149
252
|
/**
|
|
150
253
|
* The visible content of the CommandDialog. Renders inside the dialog portal.
|
|
151
254
|
*
|
|
152
255
|
* @see https://mantle.ngrok.com/components/command#commanddialogcontent
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```tsx
|
|
259
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
260
|
+
* <Command.Dialog.Trigger asChild>
|
|
261
|
+
* <Button type="button">Open Command Palette</Button>
|
|
262
|
+
* </Command.Dialog.Trigger>
|
|
263
|
+
* <Command.Dialog.Content>
|
|
264
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
265
|
+
* <Command.List>
|
|
266
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
267
|
+
* <Command.Group heading="Suggestions">
|
|
268
|
+
* <Command.Item>
|
|
269
|
+
* <span>Calendar</span>
|
|
270
|
+
* </Command.Item>
|
|
271
|
+
* </Command.Group>
|
|
272
|
+
* <Command.Separator />
|
|
273
|
+
* <Command.Group heading="Settings">
|
|
274
|
+
* <Command.Item>
|
|
275
|
+
* <span>Profile</span>
|
|
276
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
277
|
+
* </Command.Item>
|
|
278
|
+
* </Command.Group>
|
|
279
|
+
* </Command.List>
|
|
280
|
+
* </Command.Dialog.Content>
|
|
281
|
+
* </Command.Dialog.Root>
|
|
282
|
+
* ```
|
|
153
283
|
*/
|
|
154
284
|
readonly Content: {
|
|
155
285
|
({
|
|
@@ -171,14 +301,36 @@ declare const Command: {
|
|
|
171
301
|
*
|
|
172
302
|
* @example
|
|
173
303
|
* ```tsx
|
|
174
|
-
* <Command.
|
|
304
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
305
|
+
* <Command.Dialog.Trigger asChild>
|
|
306
|
+
* <Button type="button">Open Command Palette</Button>
|
|
307
|
+
* </Command.Dialog.Trigger>
|
|
308
|
+
* <Command.Dialog.Content>
|
|
309
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
310
|
+
* <Command.List>
|
|
311
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
312
|
+
* <Command.Group heading="Suggestions">
|
|
313
|
+
* <Command.Item>
|
|
314
|
+
* <span>Calendar</span>
|
|
315
|
+
* </Command.Item>
|
|
316
|
+
* </Command.Group>
|
|
317
|
+
* <Command.Separator />
|
|
318
|
+
* <Command.Group heading="Settings">
|
|
319
|
+
* <Command.Item>
|
|
320
|
+
* <span>Profile</span>
|
|
321
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
322
|
+
* </Command.Item>
|
|
323
|
+
* </Command.Group>
|
|
324
|
+
* </Command.List>
|
|
325
|
+
* </Command.Dialog.Content>
|
|
326
|
+
* </Command.Dialog.Root>
|
|
175
327
|
* ```
|
|
176
328
|
*/
|
|
177
329
|
readonly Input: _$react.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<_$react.DetailedHTMLProps<_$react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof _$react.InputHTMLAttributes<HTMLInputElement>> & {
|
|
178
330
|
ref?: React.Ref<HTMLInputElement>;
|
|
179
331
|
} & {
|
|
180
332
|
asChild?: boolean;
|
|
181
|
-
}, "key" | keyof _$react.InputHTMLAttributes<HTMLInputElement> | "asChild">, "type" | "
|
|
333
|
+
}, "key" | keyof _$react.InputHTMLAttributes<HTMLInputElement> | "asChild">, "type" | "onChange" | "value"> & {
|
|
182
334
|
value?: string;
|
|
183
335
|
onValueChange?: (search: string) => void;
|
|
184
336
|
} & _$react.RefAttributes<HTMLInputElement>, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
@@ -189,9 +341,30 @@ declare const Command: {
|
|
|
189
341
|
*
|
|
190
342
|
* @example
|
|
191
343
|
* ```tsx
|
|
192
|
-
* <Command.
|
|
193
|
-
* <Command.
|
|
194
|
-
* </
|
|
344
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
345
|
+
* <Command.Dialog.Trigger asChild>
|
|
346
|
+
* <Button type="button">Open Command Palette</Button>
|
|
347
|
+
* </Command.Dialog.Trigger>
|
|
348
|
+
* <Command.Dialog.Content>
|
|
349
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
350
|
+
* <Command.List>
|
|
351
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
352
|
+
* <Command.Group heading="Suggestions">
|
|
353
|
+
* <Command.Item>
|
|
354
|
+
* <span>Calendar</span>
|
|
355
|
+
* </Command.Item>
|
|
356
|
+
* </Command.Group>
|
|
357
|
+
* <Command.Separator />
|
|
358
|
+
* <Command.Group heading="Settings">
|
|
359
|
+
* <Command.Item>
|
|
360
|
+
* <span>Profile</span>
|
|
361
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
362
|
+
* </Command.Item>
|
|
363
|
+
* </Command.Group>
|
|
364
|
+
* </Command.List>
|
|
365
|
+
* </Command.Dialog.Content>
|
|
366
|
+
* </Command.Dialog.Root>
|
|
367
|
+
* ```
|
|
195
368
|
*/
|
|
196
369
|
readonly List: _$react.ForwardRefExoticComponent<Omit<{
|
|
197
370
|
children?: React.ReactNode;
|
|
@@ -209,7 +382,29 @@ declare const Command: {
|
|
|
209
382
|
*
|
|
210
383
|
* @example
|
|
211
384
|
* ```tsx
|
|
212
|
-
* <Command.
|
|
385
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
386
|
+
* <Command.Dialog.Trigger asChild>
|
|
387
|
+
* <Button type="button">Open Command Palette</Button>
|
|
388
|
+
* </Command.Dialog.Trigger>
|
|
389
|
+
* <Command.Dialog.Content>
|
|
390
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
391
|
+
* <Command.List>
|
|
392
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
393
|
+
* <Command.Group heading="Suggestions">
|
|
394
|
+
* <Command.Item>
|
|
395
|
+
* <span>Calendar</span>
|
|
396
|
+
* </Command.Item>
|
|
397
|
+
* </Command.Group>
|
|
398
|
+
* <Command.Separator />
|
|
399
|
+
* <Command.Group heading="Settings">
|
|
400
|
+
* <Command.Item>
|
|
401
|
+
* <span>Profile</span>
|
|
402
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
403
|
+
* </Command.Item>
|
|
404
|
+
* </Command.Group>
|
|
405
|
+
* </Command.List>
|
|
406
|
+
* </Command.Dialog.Content>
|
|
407
|
+
* </Command.Dialog.Root>
|
|
213
408
|
* ```
|
|
214
409
|
*/
|
|
215
410
|
readonly Empty: _$react.ForwardRefExoticComponent<Omit<{
|
|
@@ -226,11 +421,29 @@ declare const Command: {
|
|
|
226
421
|
*
|
|
227
422
|
* @example
|
|
228
423
|
* ```tsx
|
|
229
|
-
* <Command.
|
|
230
|
-
* <Command.
|
|
231
|
-
*
|
|
232
|
-
* </Command.
|
|
233
|
-
*
|
|
424
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
425
|
+
* <Command.Dialog.Trigger asChild>
|
|
426
|
+
* <Button type="button">Open Command Palette</Button>
|
|
427
|
+
* </Command.Dialog.Trigger>
|
|
428
|
+
* <Command.Dialog.Content>
|
|
429
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
430
|
+
* <Command.List>
|
|
431
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
432
|
+
* <Command.Group heading="Suggestions">
|
|
433
|
+
* <Command.Item>
|
|
434
|
+
* <span>Calendar</span>
|
|
435
|
+
* </Command.Item>
|
|
436
|
+
* </Command.Group>
|
|
437
|
+
* <Command.Separator />
|
|
438
|
+
* <Command.Group heading="Settings">
|
|
439
|
+
* <Command.Item>
|
|
440
|
+
* <span>Profile</span>
|
|
441
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
442
|
+
* </Command.Item>
|
|
443
|
+
* </Command.Group>
|
|
444
|
+
* </Command.List>
|
|
445
|
+
* </Command.Dialog.Content>
|
|
446
|
+
* </Command.Dialog.Root>
|
|
234
447
|
* ```
|
|
235
448
|
*/
|
|
236
449
|
readonly Group: _$react.ForwardRefExoticComponent<Omit<{
|
|
@@ -239,7 +452,7 @@ declare const Command: {
|
|
|
239
452
|
ref?: React.Ref<HTMLDivElement>;
|
|
240
453
|
} & {
|
|
241
454
|
asChild?: boolean;
|
|
242
|
-
}, "key" | keyof _$react.HTMLAttributes<HTMLDivElement> | "asChild">, "
|
|
455
|
+
}, "key" | keyof _$react.HTMLAttributes<HTMLDivElement> | "asChild">, "heading" | "value"> & {
|
|
243
456
|
heading?: React.ReactNode;
|
|
244
457
|
value?: string;
|
|
245
458
|
forceMount?: boolean;
|
|
@@ -251,9 +464,29 @@ declare const Command: {
|
|
|
251
464
|
*
|
|
252
465
|
* @example
|
|
253
466
|
* ```tsx
|
|
254
|
-
* <Command.
|
|
255
|
-
*
|
|
256
|
-
* </
|
|
467
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
468
|
+
* <Command.Dialog.Trigger asChild>
|
|
469
|
+
* <Button type="button">Open Command Palette</Button>
|
|
470
|
+
* </Command.Dialog.Trigger>
|
|
471
|
+
* <Command.Dialog.Content>
|
|
472
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
473
|
+
* <Command.List>
|
|
474
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
475
|
+
* <Command.Group heading="Suggestions">
|
|
476
|
+
* <Command.Item>
|
|
477
|
+
* <span>Calendar</span>
|
|
478
|
+
* </Command.Item>
|
|
479
|
+
* </Command.Group>
|
|
480
|
+
* <Command.Separator />
|
|
481
|
+
* <Command.Group heading="Settings">
|
|
482
|
+
* <Command.Item>
|
|
483
|
+
* <span>Profile</span>
|
|
484
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
485
|
+
* </Command.Item>
|
|
486
|
+
* </Command.Group>
|
|
487
|
+
* </Command.List>
|
|
488
|
+
* </Command.Dialog.Content>
|
|
489
|
+
* </Command.Dialog.Root>
|
|
257
490
|
* ```
|
|
258
491
|
*/
|
|
259
492
|
readonly Item: _$react.ForwardRefExoticComponent<Omit<{
|
|
@@ -262,7 +495,7 @@ declare const Command: {
|
|
|
262
495
|
ref?: React.Ref<HTMLDivElement>;
|
|
263
496
|
} & {
|
|
264
497
|
asChild?: boolean;
|
|
265
|
-
}, "key" | keyof _$react.HTMLAttributes<HTMLDivElement> | "asChild">, "disabled" | "
|
|
498
|
+
}, "key" | keyof _$react.HTMLAttributes<HTMLDivElement> | "asChild">, "disabled" | "onSelect" | "value"> & {
|
|
266
499
|
disabled?: boolean;
|
|
267
500
|
onSelect?: (value: string) => void;
|
|
268
501
|
value?: string;
|
|
@@ -276,7 +509,29 @@ declare const Command: {
|
|
|
276
509
|
*
|
|
277
510
|
* @example
|
|
278
511
|
* ```tsx
|
|
279
|
-
* <Command.
|
|
512
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
513
|
+
* <Command.Dialog.Trigger asChild>
|
|
514
|
+
* <Button type="button">Open Command Palette</Button>
|
|
515
|
+
* </Command.Dialog.Trigger>
|
|
516
|
+
* <Command.Dialog.Content>
|
|
517
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
518
|
+
* <Command.List>
|
|
519
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
520
|
+
* <Command.Group heading="Suggestions">
|
|
521
|
+
* <Command.Item>
|
|
522
|
+
* <span>Calendar</span>
|
|
523
|
+
* </Command.Item>
|
|
524
|
+
* </Command.Group>
|
|
525
|
+
* <Command.Separator />
|
|
526
|
+
* <Command.Group heading="Settings">
|
|
527
|
+
* <Command.Item>
|
|
528
|
+
* <span>Profile</span>
|
|
529
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
530
|
+
* </Command.Item>
|
|
531
|
+
* </Command.Group>
|
|
532
|
+
* </Command.List>
|
|
533
|
+
* </Command.Dialog.Content>
|
|
534
|
+
* </Command.Dialog.Root>
|
|
280
535
|
* ```
|
|
281
536
|
*/
|
|
282
537
|
readonly Shortcut: _$react.ForwardRefExoticComponent<Omit<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & _$react.RefAttributes<HTMLSpanElement>>;
|
|
@@ -287,7 +542,29 @@ declare const Command: {
|
|
|
287
542
|
*
|
|
288
543
|
* @example
|
|
289
544
|
* ```tsx
|
|
290
|
-
* <Command.
|
|
545
|
+
* <Command.Dialog.Root open={open} onOpenChange={setOpen}>
|
|
546
|
+
* <Command.Dialog.Trigger asChild>
|
|
547
|
+
* <Button type="button">Open Command Palette</Button>
|
|
548
|
+
* </Command.Dialog.Trigger>
|
|
549
|
+
* <Command.Dialog.Content>
|
|
550
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
551
|
+
* <Command.List>
|
|
552
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
553
|
+
* <Command.Group heading="Suggestions">
|
|
554
|
+
* <Command.Item>
|
|
555
|
+
* <span>Calendar</span>
|
|
556
|
+
* </Command.Item>
|
|
557
|
+
* </Command.Group>
|
|
558
|
+
* <Command.Separator />
|
|
559
|
+
* <Command.Group heading="Settings">
|
|
560
|
+
* <Command.Item>
|
|
561
|
+
* <span>Profile</span>
|
|
562
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
563
|
+
* </Command.Item>
|
|
564
|
+
* </Command.Group>
|
|
565
|
+
* </Command.List>
|
|
566
|
+
* </Command.Dialog.Content>
|
|
567
|
+
* </Command.Dialog.Root>
|
|
291
568
|
* ```
|
|
292
569
|
*/
|
|
293
570
|
readonly Separator: _$react.ForwardRefExoticComponent<Omit<Pick<Pick<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof _$react.HTMLAttributes<HTMLDivElement>> & {
|
package/dist/command.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./cx-D1HYnpvA.js";import{n as t}from"./separator-
|
|
1
|
+
import{t as e}from"./cx-D1HYnpvA.js";import{n as t}from"./separator-Xq_e06s8.js";import{t as n}from"./dialog-DxkpMIzB.js";import{t as r}from"./kbd-wgm9K9D5.js";import{forwardRef as i,useEffect as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{MagnifyingGlassIcon as l}from"@phosphor-icons/react/MagnifyingGlass";import{Command as u,useCommandState as d}from"cmdk";const f=i(({className:t,...n},r)=>s(u,{ref:r,"data-slot":`command`,className:e(`bg-popover flex h-full w-full flex-col overflow-hidden rounded-md`,t),...n}));f.displayName=`Command`;const p=({children:t,className:r,description:i=`Search for a command to run...`,filter:a,shouldFilter:o,showCloseButton:l=!0,title:u=`Command Palette`})=>c(n.Content,{className:e(`overflow-hidden p-0 relative`,r),children:[c(n.Header,{className:`sr-only absolute`,children:[s(n.Title,{children:u}),s(n.Description,{children:i})]}),s(f,{className:`**:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-input]]:h-12 **:data-[slot=command-group]:px-2 **:data-[slot=command-list]:pb-1`,filter:a,shouldFilter:o,children:t}),l&&s(`div`,{className:`absolute top-1.5 right-1.5`,children:s(n.CloseIconButton,{})})]});p.displayName=`CommandDialogContent`;const m={Root:n.Root,Trigger:n.Trigger,Content:p},h=i(({className:t,...n},r)=>c(`div`,{ref:r,"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b border-popover px-3`,children:[s(l,{className:`size-5 shrink-0 opacity-50`}),s(u.Input,{"data-slot":`command-input`,className:e(`placeholder:text-muted flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,t),...n})]}));h.displayName=`CommandInput`;const g=i(({className:t,...n},r)=>s(u.List,{ref:r,"data-slot":`command-list`,className:e(`max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto scrollbar`,t),...n}));g.displayName=`CommandList`;const _=i(({className:t,...n},r)=>s(u.Empty,{ref:r,"data-slot":`command-empty`,className:e(`py-6 text-center text-sm`,t),...n}));_.displayName=`CommandEmpty`;const v=i(({className:t,...n},r)=>s(u.Group,{ref:r,"data-slot":`command-group`,className:e(`**:[[cmdk-group-heading]]:text-muted overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,t),...n}));v.displayName=`CommandGroup`;const y=i(({className:n,...r},i)=>s(u.Separator,{ref:i,"data-slot":`command-separator`,asChild:!0,...r,children:s(t,{className:e(`-mx-1 my-1 w-auto`,n)})}));y.displayName=`CommandSeparator`;const b=i(({className:t,...n},r)=>s(u.Item,{ref:r,"data-slot":`command-item`,className:e(`data-[selected=true]:bg-active-menu-item [&_svg:not([class*='text-'])]:text-muted relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5`,t),...n}));b.displayName=`CommandItem`;const x=i(({className:t,...n},r)=>s(`span`,{ref:r,"data-slot":`command-shortcut`,className:e(`text-muted ml-auto text-xs tracking-widest`,t),...n}));x.displayName=`CommandShortcut`;const S={Root:f,Dialog:m,Input:h,List:g,Empty:_,Group:v,Item:b,Shortcut:x,Separator:y};function C({className:t,...n}){let[i,l]=o(`⌃`);a(()=>{l(T())},[]);let u=i===`⌘`?`Command`:`Control`;return c(r,{...n,suppressHydrationWarning:!0,className:e(i===`⌃`&&`font-medium`,t),children:[s(`span`,{className:`sr-only`,children:u}),i]})}function w(e){return`userAgentData`in e}function T(){if(typeof navigator>`u`)return`⌃`;let e=``;return w(navigator)&&(e=navigator.userAgentData.platform??``),e||=navigator.platform||navigator.userAgent||``,/mac|iphone|ipad|ipod/i.test(e)?`⌘`:`⌃`}export{S as Command,C as MetaKey,d as useCommandState};
|
|
2
2
|
//# sourceMappingURL=command.js.map
|