@verbb/plugin-kit-react 1.0.4 → 1.0.6
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/CHANGELOG.md +14 -0
- package/dist/components/Combobox.js +1 -1
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/SelectInput.d.ts +1 -0
- package/dist/components/SelectInput.d.ts.map +1 -1
- package/dist/components/SelectInput.js +3 -1
- package/dist/components/SelectInput.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +5 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/documentScrollStability.d.ts +7 -0
- package/dist/utils/documentScrollStability.d.ts.map +1 -0
- package/dist/utils/documentScrollStability.js +19 -0
- package/dist/utils/documentScrollStability.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 1.0.6 - 2026-06-14
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added `ensureDocumentScrollStability()` and wire it into `configurePluginKitReact()` for Shadow DOM apps, reserving document scrollbar space so Base UI modal scroll lock does not shift Craft CP layouts.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Changed `SelectInput` to default to `modal={true}` for outside pointer isolation while keeping `alignItemWithTrigger={false}` to avoid the extra scroll-lock path that caused layout jumps in embedded CP panes.
|
|
12
|
+
- Added an `alignItemWithTrigger` prop to `SelectInput` for cases that need the expand-to-trigger animation.
|
|
13
|
+
|
|
14
|
+
## 1.0.5 - 2026-06-12
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- Fix Combobox overflow-x handling.
|
|
18
|
+
|
|
5
19
|
## 1.0.4 - 2026-06-10
|
|
6
20
|
|
|
7
21
|
### Added
|
|
@@ -258,7 +258,7 @@ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "
|
|
|
258
258
|
function ComboboxList({ className, ...props }) {
|
|
259
259
|
return /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
260
260
|
"data-slot": "combobox-list",
|
|
261
|
-
className: cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))]", "overflow-y-auto overscroll-contain", "no-scrollbar", "data-empty:p-0", className),
|
|
261
|
+
className: cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))]", "overflow-x-clip overflow-y-auto overscroll-contain", "no-scrollbar", "data-empty:p-0", className),
|
|
262
262
|
...props
|
|
263
263
|
});
|
|
264
264
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","names":[],"sources":["../../src/components/Combobox.tsx"],"sourcesContent":["import {\n type ComponentProps, ComponentPropsWithRef, createContext, useContext, useRef,\n} from 'react';\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react';\nimport { type VariantProps } from 'class-variance-authority';\n\nimport { cn, getPortalClassName, getPortalContainer } from '@verbb/plugin-kit-react/utils';\nimport { Button } from '@verbb/plugin-kit-react/components';\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from '@verbb/plugin-kit-react/components';\n\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faChevronDown, faXmark, faCheck,\n} from '@fortawesome/pro-solid-svg-icons';\nimport { cva } from 'class-variance-authority';\n\nconst comboboxItemVariants = cva([\n // Reset\n 'relative flex w-full cursor-default items-center outline-hidden select-none',\n\n // Layout\n 'gap-1.5',\n\n // Focus\n 'focus:bg-slate-100 data-[highlighted]:bg-slate-100',\n\n // Disabled\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n\n // SVG\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n], {\n variants: {\n size: {\n xs: 'px-2 py-1 pr-7 text-[11px] [&_svg:not([class*=\"size-\"])]:size-3',\n sm: 'px-2.5 py-1.5 pr-7 text-[12px] [&_svg:not([class*=\"size-\"])]:size-3',\n default: 'px-[10px] py-[6px] pr-8 text-[14px] [&_svg:not([class*=\"size-\"])]:size-3',\n lg: 'px-3 py-2 pr-8 text-sm [&_svg:not([class*=\"size-\"])]:size-3',\n xl: 'px-3.5 py-2.5 pr-9 text-sm [&_svg:not([class*=\"size-\"])]:size-3',\n },\n variant: {\n default: '',\n destructive: 'text-error',\n },\n },\n defaultVariants: {\n size: 'default',\n variant: 'default',\n },\n});\n\nconst comboboxItemIndicatorVariants = cva('', {\n variants: {\n size: {\n xs: 'right-2 size-3',\n sm: 'right-2.5 size-3',\n default: 'right-2 size-3',\n lg: 'right-3 size-3',\n xl: 'right-3.5 size-3',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxItemIndicatorIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-3',\n sm: 'size-3',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxLabelVariants = cva([\n // Theme\n 'text-slate-700',\n], {\n variants: {\n size: {\n xs: 'px-2 pt-1 text-[11px]',\n sm: 'px-2.5 pt-1 text-[12px]',\n default: 'px-2.5 pt-1 text-xs',\n lg: 'px-3 pt-1 text-sm',\n xl: 'px-3.5 pt-1 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxInputGroupVariants = cva('', {\n variants: {\n size: {\n xs: 'h-7 text-[11px]',\n sm: 'h-8 text-[12px]',\n default: 'h-9 text-[13px]',\n lg: 'h-10 text-sm',\n xl: 'h-11 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxSelectInputGroupVariants = cva('', {\n variants: {\n size: {\n xs: 'h-auto rounded-sm text-[11px]',\n sm: 'h-auto rounded-md text-[12px]',\n default: 'h-auto rounded-lg text-[14px]',\n lg: 'h-auto rounded-lg text-sm',\n xl: 'h-auto rounded-lg text-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxInputControlVariants = cva('', {\n variants: {\n size: {\n xs: 'px-1.5 py-1 text-[11px]',\n sm: 'px-2 py-1 text-[12px]',\n default: 'px-2 py-1.5 text-sm',\n lg: 'px-3 py-2 text-sm',\n xl: 'px-4 py-2.5 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxSelectInputControlVariants = cva('', {\n variants: {\n size: {\n xs: 'px-2 py-1 text-[11px]',\n sm: 'px-2.5 py-1.5 text-[12px]',\n default: 'px-[10px] py-[6px] text-[14px]',\n lg: 'px-3 py-2 text-sm',\n xl: 'px-3.5 py-2.5 text-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxTriggerIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-[10px]',\n sm: 'size-[11px]',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxTriggerButtonIconVariants = cva('', {\n variants: {\n size: {\n xs: '[&>svg]:size-[10px]',\n sm: '[&>svg]:size-[11px]',\n default: '[&>svg]:size-3',\n lg: '[&>svg]:size-3',\n xl: '[&>svg]:size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxClearIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-[10px]',\n sm: 'size-[11px]',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxClearButtonIconVariants = cva('', {\n variants: {\n size: {\n xs: '[&>svg]:size-[10px]',\n sm: '[&>svg]:size-[11px]',\n default: '[&>svg]:size-3',\n lg: '[&>svg]:size-3',\n xl: '[&>svg]:size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\ntype ComboboxSize = NonNullable<VariantProps<typeof comboboxItemVariants>['size']>;\ntype ComboboxHighlightedTextProps = {\n text?: string | number | null;\n search?: string | number | null;\n className?: string;\n matchClassName?: string;\n};\n\nconst ComboboxContext = createContext<{ size: ComboboxSize }>({ size: 'default' });\n\nfunction Combobox({\n size = 'default',\n children,\n ...props\n}: ComponentProps<typeof ComboboxPrimitive.Root> & { size?: ComboboxSize }) {\n return (\n <ComboboxContext.Provider value={{ size }}>\n <ComboboxPrimitive.Root data-slot=\"combobox\" data-size={size} {...props}>\n {children}\n </ComboboxPrimitive.Root>\n </ComboboxContext.Provider>\n );\n}\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Trigger.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\n // Icons\n \"[&_svg:not([class*='size-'])]:size-4\",\n\n className,\n )}\n {...props}\n >\n {children}\n <FontAwesomeIcon\n icon={faChevronDown}\n className={cn(\n 'pointer-events-none',\n comboboxTriggerIconVariants({ size }),\n )}\n />\n </ComboboxPrimitive.Trigger>\n );\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Clear data-slot=\"combobox-clear\" className={cn(className)} {...props} render={\n <InputGroupButton\n variant=\"none\"\n size=\"icon-xs\"\n className={comboboxClearButtonIconVariants({ size })}\n >\n <FontAwesomeIcon\n icon={faXmark}\n className={cn(\n 'pointer-events-none',\n comboboxClearIconVariants({ size }),\n )}\n />\n </InputGroupButton>\n } />\n );\n}\n\nfunction ComboboxPrimitiveInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean\n showClear?: boolean\n}) {\n const { size } = useContext(ComboboxContext);\n const useSelectTriggerStyle = showTrigger;\n\n return (\n <InputGroup className={cn(\n 'w-fit mb-1!',\n\n comboboxInputGroupVariants({ size }),\n useSelectTriggerStyle && [\n // Keep single comboboxes visually aligned with SelectTrigger,\n // while search-only combobox inputs retain normal input styling.\n 'border-transparent bg-slate-250',\n 'hover:bg-slate-300',\n 'has-[[data-slot=input-group-control]:focus]:bg-white',\n 'has-[[data-popup-open]]:bg-white',\n comboboxSelectInputGroupVariants({ size }),\n ],\n\n className,\n )}>\n <ComboboxPrimitive.Input\n render={\n <InputGroupInput\n disabled={disabled}\n className={cn(\n comboboxInputControlVariants({ size }),\n useSelectTriggerStyle && [\n 'placeholder:text-inherit',\n 'focus:placeholder:text-gray-300',\n comboboxSelectInputControlVariants({ size }),\n ],\n )}\n />\n }\n {...props}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"none\"\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className={cn(\n // Toggle visibility when clear button is shown\n 'group-has-data-[slot=combobox-clear]/input-group:hidden',\n\n // Pressed state\n 'data-pressed:bg-transparent',\n\n comboboxTriggerButtonIconVariants({ size }),\n )}\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'\n >) {\n const { size } = useContext(ComboboxContext);\n const resolvedPortalClassName = getPortalClassName();\n const resolvedPortalContainer = getPortalContainer();\n\n return (\n <ComboboxPrimitive.Portal className={resolvedPortalClassName} container={resolvedPortalContainer}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-250\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n data-size={size}\n className={cn(\n // Layout\n 'group/combobox-content relative',\n 'max-h-(--available-height) w-[calc(var(--anchor-width)_+_2.25rem)] max-w-(--available-width)',\n 'min-w-[calc(var(--anchor-width)_+_2.25rem)]',\n 'overflow-hidden',\n 'origin-(--transform-origin)',\n\n // Theme\n 'rounded-md bg-white',\n 'shadow-[0_0_0_1px_rgba(31,41,51,0.1),0_5px_20px_rgba(31,41,51,0.25)]',\n\n // Motion\n 'duration-100',\n 'data-open:animate-in data-closed:animate-out',\n 'data-open:fade-in-0 data-closed:fade-out-0',\n 'data-open:zoom-in-95 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'data-[side=inline-start]:slide-in-from-right-2',\n 'data-[side=inline-end]:slide-in-from-left-2',\n\n // Chips mode\n 'data-[chips=true]:min-w-(--anchor-width)',\n\n // Nested input group styling\n '*:data-[slot=input-group]:m-1',\n '*:data-[slot=input-group]:w-[calc(100%_-_0.5rem)]',\n '*:data-[slot=input-group]:mb-0',\n 'data-[size=xs]:*:data-[slot=input-group]:h-7',\n 'data-[size=sm]:*:data-[slot=input-group]:h-8',\n 'data-[size=default]:*:data-[slot=input-group]:h-9',\n 'data-[size=lg]:*:data-[slot=input-group]:h-10',\n 'data-[size=xl]:*:data-[slot=input-group]:h-11',\n '*:data-[slot=input-group]:bg-input/30',\n '*:data-[slot=input-group]:border-input/30',\n '*:data-[slot=input-group]:shadow-none',\n\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n // Layout\n 'max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))]',\n 'overflow-y-auto overscroll-contain',\n\n // Utilities\n 'no-scrollbar',\n\n // State\n 'data-empty:p-0',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxItem({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Item.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n comboboxItemVariants({ size }),\n\n className,\n )}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap\">\n {children}\n </span>\n <ComboboxPrimitive.ItemIndicator render={\n <span className={cn(\n 'pointer-events-none absolute flex items-center justify-center',\n comboboxItemIndicatorVariants({ size }),\n )}>\n <FontAwesomeIcon\n icon={faCheck}\n className={cn(\n 'pointer-events-none',\n comboboxItemIndicatorIconVariants({ size }),\n )}\n />\n </span>\n } />\n </ComboboxPrimitive.Item>\n );\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn([\n // 'py-1',\n\n className\n ])}\n {...props}\n />\n );\n}\n\nfunction ComboboxLabel({\n className,\n ...props\n}: ComboboxPrimitive.GroupLabel.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\n // Theme\n 'text-slate-700',\n\n // Size\n comboboxLabelVariants({ size }),\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return (\n <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n );\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n // Layout\n 'hidden w-full justify-center py-2 text-center text-sm',\n\n // Theme\n 'text-gray-500',\n\n // State\n 'group-data-empty/combobox-content:flex',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\n // Layout\n '-mx-1 my-1 h-px',\n\n // Theme\n 'bg-slate-200',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n // Layout\n 'flex-wrap gap-1',\n 'px-2 py-1.5 text-sm',\n\n className,\n )}\n render={<InputGroup />}\n {...props}\n />\n );\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n // Layout\n 'flex w-fit items-center justify-center gap-1',\n 'rounded-sm px-1.5 py-[2px]',\n 'text-xs font-medium whitespace-nowrap',\n\n // Theme\n 'bg-slate-200',\n\n // State\n 'has-data-[slot=combobox-chip-remove]:pr-0',\n 'has-disabled:pointer-events-none',\n 'has-disabled:cursor-not-allowed',\n 'has-disabled:opacity-50',\n\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n render={\n <Button variant=\"none\" size=\"xs\">\n <FontAwesomeIcon icon={faXmark} className=\"pointer-events-none size-2.5\" />\n </Button>\n } />\n )}\n </ComboboxPrimitive.Chip>\n );\n}\n\nfunction ComboboxChipsInput({\n className,\n ...props\n}: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n render={\n <InputGroupInput\n className={cn(\n 'min-w-16 px-0 py-0',\n className,\n )}\n />\n }\n {...props}\n />\n );\n}\n\nfunction useComboboxAnchor() {\n return useRef<HTMLDivElement | null>(null);\n}\n\nfunction ComboboxHighlightedText({\n text = '',\n search = '',\n className,\n matchClassName,\n}: ComboboxHighlightedTextProps) {\n const label = String(text || '');\n const query = String(search || '').trim();\n\n if (!query) {\n return label;\n }\n\n const lowerLabel = label.toLowerCase();\n const lowerQuery = query.toLowerCase();\n const parts: Array<{ text: string; match: boolean }> = [];\n let cursor = 0;\n let matchIndex = lowerLabel.indexOf(lowerQuery);\n\n while (matchIndex !== -1) {\n if (matchIndex > cursor) {\n parts.push({\n text: label.slice(cursor, matchIndex),\n match: false,\n });\n }\n\n parts.push({\n text: label.slice(matchIndex, matchIndex + query.length),\n match: true,\n });\n\n cursor = matchIndex + query.length;\n matchIndex = lowerLabel.indexOf(lowerQuery, cursor);\n }\n\n if (cursor < label.length) {\n parts.push({\n text: label.slice(cursor),\n match: false,\n });\n }\n\n return (\n <span className={cn('min-w-0 truncate', className)}>\n {parts.map((part, index) => {\n if (!part.match) {\n return <span key={index}>{part.text}</span>;\n }\n\n return (\n <span key={index} className={cn('rounded-[2px] bg-blue-100', matchClassName)}>\n {part.text}\n </span>\n );\n })}\n </span>\n );\n}\n\nexport {\n Combobox,\n ComboboxPrimitiveInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n ComboboxHighlightedText,\n useComboboxAnchor,\n};\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,uBAAuB,IAAI;CAE7B;CAGA;CAGA;CAGA;CAGA;CACH,EAAE;CACC,UAAU;EACN,MA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AoB,UAAU;YAC7C,MAAM,KAAK,MAAM,UAAU;AACxB,OAAI,CAAC,KAAK,MACN,QAAO,oBAAC,QAAD,EAAA,UAAmB,KAAK,MAAY,EAAzB,MAAyB;AAG/C,UACI,oBAAC,QAAD;IAAkB,WAAW,GAAG,6BAA6B,eAAe;cACvE,KAAK;IACH,EAFI,MAEJ;IAEb;EACC,CAAA"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","names":[],"sources":["../../src/components/Combobox.tsx"],"sourcesContent":["import {\n type ComponentProps, ComponentPropsWithRef, createContext, useContext, useRef,\n} from 'react';\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react';\nimport { type VariantProps } from 'class-variance-authority';\n\nimport { cn, getPortalClassName, getPortalContainer } from '@verbb/plugin-kit-react/utils';\nimport { Button } from '@verbb/plugin-kit-react/components';\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from '@verbb/plugin-kit-react/components';\n\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faChevronDown, faXmark, faCheck,\n} from '@fortawesome/pro-solid-svg-icons';\nimport { cva } from 'class-variance-authority';\n\nconst comboboxItemVariants = cva([\n // Reset\n 'relative flex w-full cursor-default items-center outline-hidden select-none',\n\n // Layout\n 'gap-1.5',\n\n // Focus\n 'focus:bg-slate-100 data-[highlighted]:bg-slate-100',\n\n // Disabled\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n\n // SVG\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n], {\n variants: {\n size: {\n xs: 'px-2 py-1 pr-7 text-[11px] [&_svg:not([class*=\"size-\"])]:size-3',\n sm: 'px-2.5 py-1.5 pr-7 text-[12px] [&_svg:not([class*=\"size-\"])]:size-3',\n default: 'px-[10px] py-[6px] pr-8 text-[14px] [&_svg:not([class*=\"size-\"])]:size-3',\n lg: 'px-3 py-2 pr-8 text-sm [&_svg:not([class*=\"size-\"])]:size-3',\n xl: 'px-3.5 py-2.5 pr-9 text-sm [&_svg:not([class*=\"size-\"])]:size-3',\n },\n variant: {\n default: '',\n destructive: 'text-error',\n },\n },\n defaultVariants: {\n size: 'default',\n variant: 'default',\n },\n});\n\nconst comboboxItemIndicatorVariants = cva('', {\n variants: {\n size: {\n xs: 'right-2 size-3',\n sm: 'right-2.5 size-3',\n default: 'right-2 size-3',\n lg: 'right-3 size-3',\n xl: 'right-3.5 size-3',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxItemIndicatorIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-3',\n sm: 'size-3',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxLabelVariants = cva([\n // Theme\n 'text-slate-700',\n], {\n variants: {\n size: {\n xs: 'px-2 pt-1 text-[11px]',\n sm: 'px-2.5 pt-1 text-[12px]',\n default: 'px-2.5 pt-1 text-xs',\n lg: 'px-3 pt-1 text-sm',\n xl: 'px-3.5 pt-1 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxInputGroupVariants = cva('', {\n variants: {\n size: {\n xs: 'h-7 text-[11px]',\n sm: 'h-8 text-[12px]',\n default: 'h-9 text-[13px]',\n lg: 'h-10 text-sm',\n xl: 'h-11 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxSelectInputGroupVariants = cva('', {\n variants: {\n size: {\n xs: 'h-auto rounded-sm text-[11px]',\n sm: 'h-auto rounded-md text-[12px]',\n default: 'h-auto rounded-lg text-[14px]',\n lg: 'h-auto rounded-lg text-sm',\n xl: 'h-auto rounded-lg text-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxInputControlVariants = cva('', {\n variants: {\n size: {\n xs: 'px-1.5 py-1 text-[11px]',\n sm: 'px-2 py-1 text-[12px]',\n default: 'px-2 py-1.5 text-sm',\n lg: 'px-3 py-2 text-sm',\n xl: 'px-4 py-2.5 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxSelectInputControlVariants = cva('', {\n variants: {\n size: {\n xs: 'px-2 py-1 text-[11px]',\n sm: 'px-2.5 py-1.5 text-[12px]',\n default: 'px-[10px] py-[6px] text-[14px]',\n lg: 'px-3 py-2 text-sm',\n xl: 'px-3.5 py-2.5 text-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxTriggerIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-[10px]',\n sm: 'size-[11px]',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxTriggerButtonIconVariants = cva('', {\n variants: {\n size: {\n xs: '[&>svg]:size-[10px]',\n sm: '[&>svg]:size-[11px]',\n default: '[&>svg]:size-3',\n lg: '[&>svg]:size-3',\n xl: '[&>svg]:size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxClearIconVariants = cva('', {\n variants: {\n size: {\n xs: 'size-[10px]',\n sm: 'size-[11px]',\n default: 'size-3',\n lg: 'size-3',\n xl: 'size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\nconst comboboxClearButtonIconVariants = cva('', {\n variants: {\n size: {\n xs: '[&>svg]:size-[10px]',\n sm: '[&>svg]:size-[11px]',\n default: '[&>svg]:size-3',\n lg: '[&>svg]:size-3',\n xl: '[&>svg]:size-3.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n});\n\ntype ComboboxSize = NonNullable<VariantProps<typeof comboboxItemVariants>['size']>;\ntype ComboboxHighlightedTextProps = {\n text?: string | number | null;\n search?: string | number | null;\n className?: string;\n matchClassName?: string;\n};\n\nconst ComboboxContext = createContext<{ size: ComboboxSize }>({ size: 'default' });\n\nfunction Combobox({\n size = 'default',\n children,\n ...props\n}: ComponentProps<typeof ComboboxPrimitive.Root> & { size?: ComboboxSize }) {\n return (\n <ComboboxContext.Provider value={{ size }}>\n <ComboboxPrimitive.Root data-slot=\"combobox\" data-size={size} {...props}>\n {children}\n </ComboboxPrimitive.Root>\n </ComboboxContext.Provider>\n );\n}\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Trigger.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\n // Icons\n \"[&_svg:not([class*='size-'])]:size-4\",\n\n className,\n )}\n {...props}\n >\n {children}\n <FontAwesomeIcon\n icon={faChevronDown}\n className={cn(\n 'pointer-events-none',\n comboboxTriggerIconVariants({ size }),\n )}\n />\n </ComboboxPrimitive.Trigger>\n );\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Clear data-slot=\"combobox-clear\" className={cn(className)} {...props} render={\n <InputGroupButton\n variant=\"none\"\n size=\"icon-xs\"\n className={comboboxClearButtonIconVariants({ size })}\n >\n <FontAwesomeIcon\n icon={faXmark}\n className={cn(\n 'pointer-events-none',\n comboboxClearIconVariants({ size }),\n )}\n />\n </InputGroupButton>\n } />\n );\n}\n\nfunction ComboboxPrimitiveInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean\n showClear?: boolean\n}) {\n const { size } = useContext(ComboboxContext);\n const useSelectTriggerStyle = showTrigger;\n\n return (\n <InputGroup className={cn(\n 'w-fit mb-1!',\n\n comboboxInputGroupVariants({ size }),\n useSelectTriggerStyle && [\n // Keep single comboboxes visually aligned with SelectTrigger,\n // while search-only combobox inputs retain normal input styling.\n 'border-transparent bg-slate-250',\n 'hover:bg-slate-300',\n 'has-[[data-slot=input-group-control]:focus]:bg-white',\n 'has-[[data-popup-open]]:bg-white',\n comboboxSelectInputGroupVariants({ size }),\n ],\n\n className,\n )}>\n <ComboboxPrimitive.Input\n render={\n <InputGroupInput\n disabled={disabled}\n className={cn(\n comboboxInputControlVariants({ size }),\n useSelectTriggerStyle && [\n 'placeholder:text-inherit',\n 'focus:placeholder:text-gray-300',\n comboboxSelectInputControlVariants({ size }),\n ],\n )}\n />\n }\n {...props}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"none\"\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className={cn(\n // Toggle visibility when clear button is shown\n 'group-has-data-[slot=combobox-clear]/input-group:hidden',\n\n // Pressed state\n 'data-pressed:bg-transparent',\n\n comboboxTriggerButtonIconVariants({ size }),\n )}\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'\n >) {\n const { size } = useContext(ComboboxContext);\n const resolvedPortalClassName = getPortalClassName();\n const resolvedPortalContainer = getPortalContainer();\n\n return (\n <ComboboxPrimitive.Portal className={resolvedPortalClassName} container={resolvedPortalContainer}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-250\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n data-size={size}\n className={cn(\n // Layout\n 'group/combobox-content relative',\n 'max-h-(--available-height) w-[calc(var(--anchor-width)_+_2.25rem)] max-w-(--available-width)',\n 'min-w-[calc(var(--anchor-width)_+_2.25rem)]',\n 'overflow-hidden',\n 'origin-(--transform-origin)',\n\n // Theme\n 'rounded-md bg-white',\n 'shadow-[0_0_0_1px_rgba(31,41,51,0.1),0_5px_20px_rgba(31,41,51,0.25)]',\n\n // Motion\n 'duration-100',\n 'data-open:animate-in data-closed:animate-out',\n 'data-open:fade-in-0 data-closed:fade-out-0',\n 'data-open:zoom-in-95 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'data-[side=inline-start]:slide-in-from-right-2',\n 'data-[side=inline-end]:slide-in-from-left-2',\n\n // Chips mode\n 'data-[chips=true]:min-w-(--anchor-width)',\n\n // Nested input group styling\n '*:data-[slot=input-group]:m-1',\n '*:data-[slot=input-group]:w-[calc(100%_-_0.5rem)]',\n '*:data-[slot=input-group]:mb-0',\n 'data-[size=xs]:*:data-[slot=input-group]:h-7',\n 'data-[size=sm]:*:data-[slot=input-group]:h-8',\n 'data-[size=default]:*:data-[slot=input-group]:h-9',\n 'data-[size=lg]:*:data-[slot=input-group]:h-10',\n 'data-[size=xl]:*:data-[slot=input-group]:h-11',\n '*:data-[slot=input-group]:bg-input/30',\n '*:data-[slot=input-group]:border-input/30',\n '*:data-[slot=input-group]:shadow-none',\n\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n // Layout\n 'max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))]',\n 'overflow-x-clip overflow-y-auto overscroll-contain',\n\n // Utilities\n 'no-scrollbar',\n\n // State\n 'data-empty:p-0',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxItem({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Item.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n comboboxItemVariants({ size }),\n\n className,\n )}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap\">\n {children}\n </span>\n <ComboboxPrimitive.ItemIndicator render={\n <span className={cn(\n 'pointer-events-none absolute flex items-center justify-center',\n comboboxItemIndicatorVariants({ size }),\n )}>\n <FontAwesomeIcon\n icon={faCheck}\n className={cn(\n 'pointer-events-none',\n comboboxItemIndicatorIconVariants({ size }),\n )}\n />\n </span>\n } />\n </ComboboxPrimitive.Item>\n );\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn([\n // 'py-1',\n\n className\n ])}\n {...props}\n />\n );\n}\n\nfunction ComboboxLabel({\n className,\n ...props\n}: ComboboxPrimitive.GroupLabel.Props) {\n const { size } = useContext(ComboboxContext);\n\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\n // Theme\n 'text-slate-700',\n\n // Size\n comboboxLabelVariants({ size }),\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return (\n <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n );\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n // Layout\n 'hidden w-full justify-center py-2 text-center text-sm',\n\n // Theme\n 'text-gray-500',\n\n // State\n 'group-data-empty/combobox-content:flex',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\n // Layout\n '-mx-1 my-1 h-px',\n\n // Theme\n 'bg-slate-200',\n\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n // Layout\n 'flex-wrap gap-1',\n 'px-2 py-1.5 text-sm',\n\n className,\n )}\n render={<InputGroup />}\n {...props}\n />\n );\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n // Layout\n 'flex w-fit items-center justify-center gap-1',\n 'rounded-sm px-1.5 py-[2px]',\n 'text-xs font-medium whitespace-nowrap',\n\n // Theme\n 'bg-slate-200',\n\n // State\n 'has-data-[slot=combobox-chip-remove]:pr-0',\n 'has-disabled:pointer-events-none',\n 'has-disabled:cursor-not-allowed',\n 'has-disabled:opacity-50',\n\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n render={\n <Button variant=\"none\" size=\"xs\">\n <FontAwesomeIcon icon={faXmark} className=\"pointer-events-none size-2.5\" />\n </Button>\n } />\n )}\n </ComboboxPrimitive.Chip>\n );\n}\n\nfunction ComboboxChipsInput({\n className,\n ...props\n}: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n render={\n <InputGroupInput\n className={cn(\n 'min-w-16 px-0 py-0',\n className,\n )}\n />\n }\n {...props}\n />\n );\n}\n\nfunction useComboboxAnchor() {\n return useRef<HTMLDivElement | null>(null);\n}\n\nfunction ComboboxHighlightedText({\n text = '',\n search = '',\n className,\n matchClassName,\n}: ComboboxHighlightedTextProps) {\n const label = String(text || '');\n const query = String(search || '').trim();\n\n if (!query) {\n return label;\n }\n\n const lowerLabel = label.toLowerCase();\n const lowerQuery = query.toLowerCase();\n const parts: Array<{ text: string; match: boolean }> = [];\n let cursor = 0;\n let matchIndex = lowerLabel.indexOf(lowerQuery);\n\n while (matchIndex !== -1) {\n if (matchIndex > cursor) {\n parts.push({\n text: label.slice(cursor, matchIndex),\n match: false,\n });\n }\n\n parts.push({\n text: label.slice(matchIndex, matchIndex + query.length),\n match: true,\n });\n\n cursor = matchIndex + query.length;\n matchIndex = lowerLabel.indexOf(lowerQuery, cursor);\n }\n\n if (cursor < label.length) {\n parts.push({\n text: label.slice(cursor),\n match: false,\n });\n }\n\n return (\n <span className={cn('min-w-0 truncate', className)}>\n {parts.map((part, index) => {\n if (!part.match) {\n return <span key={index}>{part.text}</span>;\n }\n\n return (\n <span key={index} className={cn('rounded-[2px] bg-blue-100', matchClassName)}>\n {part.text}\n </span>\n );\n })}\n </span>\n );\n}\n\nexport {\n Combobox,\n ComboboxPrimitiveInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n ComboboxHighlightedText,\n useComboboxAnchor,\n};\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,uBAAuB,IAAI;CAE7B;CAGA;CAGA;CAGA;CAGA;CACH,EAAE;CACC,UAAU;EACN,MAAM;GACF,IAAI;GACJ,IAAI;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACP;EACD,SAAS;GACL,SAAS;GACT,aAAa;GAChB;EACJ;CACD,iBAAiB;EACb,MAAM;EACN,SAAS;EACZ;CACJ,CAAC;AAEF,IAAM,gCAAgC,IAAI,IAAI;CAC1C,UAAU,EACN,MAAM;EACF,IAAI;EACJ,IAAI;EACJ,SAAS;EACT,IAAI;EACJ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<T = unknown> extends Omit<SelectBaseProps, 'children' | 'v
|
|
|
20
20
|
onBlur?: React.FocusEventHandler<HTMLButtonElement>;
|
|
21
21
|
triggerClassName?: string;
|
|
22
22
|
contentClassName?: string;
|
|
23
|
+
alignItemWithTrigger?: boolean;
|
|
23
24
|
id?: string;
|
|
24
25
|
'aria-invalid'?: boolean | 'true' | 'false';
|
|
25
26
|
'aria-describedby'?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../src/components/SelectInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EAOT,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAKnD,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,OAAO;IAC/B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;CACxB,CAAC;AAoCF,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAErD,UAAU,WAAW,CAAC,CAAC,GAAG,OAAO,CAC7B,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,eAAe,CAAC;IACtF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC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,GAAG,eAAe,CAAC;IACtF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,gGAkJtB,CAAC;AAEH,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import "./index.js";
|
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/SelectInput.tsx
|
|
9
|
-
var SelectInput = forwardRef(({ options, placeholder, size, onChange, value, triggerClassName, contentClassName, isInvalid, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...selectProps }, ref) => {
|
|
9
|
+
var SelectInput = forwardRef(({ options, placeholder, size, onChange, value, triggerClassName, contentClassName, alignItemWithTrigger = false, isInvalid, id, modal = true, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...selectProps }, ref) => {
|
|
10
10
|
const handleValueChange = (nextValue) => {
|
|
11
11
|
if (onChange) onChange(nextValue);
|
|
12
12
|
};
|
|
@@ -35,6 +35,7 @@ var SelectInput = forwardRef(({ options, placeholder, size, onChange, value, tri
|
|
|
35
35
|
onValueChange: handleValueChange,
|
|
36
36
|
size,
|
|
37
37
|
items: flatOptions,
|
|
38
|
+
modal,
|
|
38
39
|
...selectProps,
|
|
39
40
|
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
40
41
|
ref,
|
|
@@ -62,6 +63,7 @@ var SelectInput = forwardRef(({ options, placeholder, size, onChange, value, tri
|
|
|
62
63
|
})]
|
|
63
64
|
}), options?.length > 0 && /* @__PURE__ */ jsx(SelectContent, {
|
|
64
65
|
className: contentClassName,
|
|
66
|
+
alignItemWithTrigger,
|
|
65
67
|
children: groupedOptions.map((group) => {
|
|
66
68
|
return /* @__PURE__ */ jsxs(SelectGroup, { children: [group.group && /* @__PURE__ */ jsx(SelectLabel, { children: group.group }), group.options?.map((option) => {
|
|
67
69
|
return /* @__PURE__ */ jsxs(SelectItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.js","names":[],"sources":["../../src/components/SelectInput.tsx"],"sourcesContent":["import {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectTrigger,\n SelectValue,\n SelectLabel,\n} from '@verbb/plugin-kit-react/components';\n\nimport type React from 'react';\nimport { ComponentProps, forwardRef } from 'react';\nimport { Status } from '@verbb/plugin-kit-react/components/Status';\nimport { cn } from '@verbb/plugin-kit-react/utils';\n\n\nexport interface Option<T = unknown> {\n value: T;\n label: string;\n disabled?: boolean;\n status?: string;\n}\n\ntype OptionGroup<T = unknown> = {\n group: string;\n options: Option<T>[];\n};\n\n// const valueToString = (val: Option['value']) => {\n// if (val === null) { return '__null__'; }\n// if (val === undefined) {\n// console.error('option value cannot be undefined');\n// return '__undefined__';\n// }\n// if (val === Infinity) { return '__Infinity__'; }\n// if (val === -Infinity) { return '__-Infinity__'; }\n// if (Number.isNaN(val)) { return '__NaN__'; }\n// if (typeof val === 'symbol') { return `__symbol__${val.description}`; }\n// // console.log(JSON.stringify(val));\n// return JSON.stringify(val);\n// };\n\n// const stringToValue = (str: string) => {\n// switch (str) {\n// case '__null__':\n// return null;\n// case '__undefined__':\n// return undefined;\n// case '__Infinity__':\n// return Infinity;\n// case '__-Infinity__':\n// return -Infinity;\n// case '__NaN__':\n// return NaN;\n// default:\n// if (str.startsWith('__symbol__')) {\n// return Symbol(str.slice(10));\n// }\n// return JSON.parse(str);\n// }\n// };\n\ntype SelectBaseProps = ComponentProps<typeof Select>;\n\ninterface SelectProps<T = unknown>\n extends Omit<SelectBaseProps, 'children' | 'value' | 'defaultValue' | 'onValueChange'> {\n options: Array<Option<T> | OptionGroup<T>>;\n placeholder?: string;\n onChange?: (value: T) => void;\n value?: T;\n isInvalid?: boolean;\n onBlur?: React.FocusEventHandler<HTMLButtonElement>;\n triggerClassName?: string;\n contentClassName?: string;\n id?: string;\n 'aria-invalid'?: boolean | 'true' | 'false';\n 'aria-describedby'?: string;\n 'aria-errormessage'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport const SelectInput = forwardRef<HTMLButtonElement, SelectProps>(({\n options,\n placeholder,\n size,\n onChange,\n value,\n triggerClassName,\n contentClassName,\n isInvalid,\n id,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...selectProps\n}, ref) => {\n const handleValueChange = (nextValue: SelectProps['value']) => {\n if (onChange) {\n onChange(nextValue);\n }\n };\n\n // const hasEmptyOption = options?.find((option) => { return option.value === ''; });\n\n // let defaultValue = undefined;\n\n // // Only show placeholder when value is initially undefined,\n // // or when the value is an empty string and there's an empty option\n // if (value === undefined || value === '') {\n // if (hasEmptyOption) {\n // defaultValue = valueToString('');\n // } else {\n // defaultValue = undefined;\n // }\n // } else {\n // defaultValue = valueToString(value);\n // }\n\n const hasGroup = (option: Option<unknown> | OptionGroup<unknown>): option is OptionGroup<unknown> => {\n return typeof option === 'object' && option !== null && 'group' in option;\n };\n\n const groupedOptions = options.map((option, index) => {\n if (hasGroup(option)) {\n return option;\n }\n\n return {\n group: null,\n options: [option],\n _key: `ungrouped-${index}`,\n };\n });\n\n const flatOptions = options.flatMap((option) => {\n if (hasGroup(option)) {\n return option.options;\n }\n\n return [option];\n });\n\n const selectedOption = flatOptions.find((option) => {\n return String(option.value) === String(value);\n });\n const resolvedPlaceholder = placeholder || '';\n const resolvedIsInvalid = Boolean(isInvalid || ariaInvalid === true || ariaInvalid === 'true');\n\n return (\n <Select\n value={value}\n onValueChange={handleValueChange}\n size={size}\n items={flatOptions as ComponentProps<typeof Select>['items']}\n {...selectProps}\n >\n <SelectTrigger\n ref={ref}\n id={id}\n aria-invalid={resolvedIsInvalid}\n aria-describedby={ariaDescribedBy}\n aria-errormessage={ariaErrorMessage}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n selectedOption?.status && 'relative [&_[data-slot=select-value]]:pl-5',\n '[&_[data-slot=select-value]]:overflow-hidden [&_[data-slot=select-value]>span]:block [&_[data-slot=select-value]>span]:min-w-0 [&_[data-slot=select-value]>span]:max-w-full [&_[data-slot=select-value]>span]:truncate',\n triggerClassName,\n )}\n >\n {selectedOption?.status && (\n <Status\n status={selectedOption.status}\n className=\"absolute left-2.5 top-1/2 -translate-y-1/2\"\n />\n )}\n <SelectValue placeholder={placeholder}>\n {selectedOption ? (\n <span className=\"block min-w-0 max-w-full truncate\" title={selectedOption.label}>\n {selectedOption.label}\n </span>\n ) : (\n <span className=\"block min-w-0 max-w-full truncate text-slate-500\" title={resolvedPlaceholder}>\n {resolvedPlaceholder}\n </span>\n )}\n </SelectValue>\n </SelectTrigger>\n\n {options?.length > 0 && (\n <SelectContent
|
|
1
|
+
{"version":3,"file":"SelectInput.js","names":[],"sources":["../../src/components/SelectInput.tsx"],"sourcesContent":["import {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectTrigger,\n SelectValue,\n SelectLabel,\n} from '@verbb/plugin-kit-react/components';\n\nimport type React from 'react';\nimport { ComponentProps, forwardRef } from 'react';\nimport { Status } from '@verbb/plugin-kit-react/components/Status';\nimport { cn } from '@verbb/plugin-kit-react/utils';\n\n\nexport interface Option<T = unknown> {\n value: T;\n label: string;\n disabled?: boolean;\n status?: string;\n}\n\ntype OptionGroup<T = unknown> = {\n group: string;\n options: Option<T>[];\n};\n\n// const valueToString = (val: Option['value']) => {\n// if (val === null) { return '__null__'; }\n// if (val === undefined) {\n// console.error('option value cannot be undefined');\n// return '__undefined__';\n// }\n// if (val === Infinity) { return '__Infinity__'; }\n// if (val === -Infinity) { return '__-Infinity__'; }\n// if (Number.isNaN(val)) { return '__NaN__'; }\n// if (typeof val === 'symbol') { return `__symbol__${val.description}`; }\n// // console.log(JSON.stringify(val));\n// return JSON.stringify(val);\n// };\n\n// const stringToValue = (str: string) => {\n// switch (str) {\n// case '__null__':\n// return null;\n// case '__undefined__':\n// return undefined;\n// case '__Infinity__':\n// return Infinity;\n// case '__-Infinity__':\n// return -Infinity;\n// case '__NaN__':\n// return NaN;\n// default:\n// if (str.startsWith('__symbol__')) {\n// return Symbol(str.slice(10));\n// }\n// return JSON.parse(str);\n// }\n// };\n\ntype SelectBaseProps = ComponentProps<typeof Select>;\n\ninterface SelectProps<T = unknown>\n extends Omit<SelectBaseProps, 'children' | 'value' | 'defaultValue' | 'onValueChange'> {\n options: Array<Option<T> | OptionGroup<T>>;\n placeholder?: string;\n onChange?: (value: T) => void;\n value?: T;\n isInvalid?: boolean;\n onBlur?: React.FocusEventHandler<HTMLButtonElement>;\n triggerClassName?: string;\n contentClassName?: string;\n alignItemWithTrigger?: boolean;\n id?: string;\n 'aria-invalid'?: boolean | 'true' | 'false';\n 'aria-describedby'?: string;\n 'aria-errormessage'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport const SelectInput = forwardRef<HTMLButtonElement, SelectProps>(({\n options,\n placeholder,\n size,\n onChange,\n value,\n triggerClassName,\n contentClassName,\n alignItemWithTrigger = false,\n isInvalid,\n id,\n modal = true,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...selectProps\n}, ref) => {\n const handleValueChange = (nextValue: SelectProps['value']) => {\n if (onChange) {\n onChange(nextValue);\n }\n };\n\n // const hasEmptyOption = options?.find((option) => { return option.value === ''; });\n\n // let defaultValue = undefined;\n\n // // Only show placeholder when value is initially undefined,\n // // or when the value is an empty string and there's an empty option\n // if (value === undefined || value === '') {\n // if (hasEmptyOption) {\n // defaultValue = valueToString('');\n // } else {\n // defaultValue = undefined;\n // }\n // } else {\n // defaultValue = valueToString(value);\n // }\n\n const hasGroup = (option: Option<unknown> | OptionGroup<unknown>): option is OptionGroup<unknown> => {\n return typeof option === 'object' && option !== null && 'group' in option;\n };\n\n const groupedOptions = options.map((option, index) => {\n if (hasGroup(option)) {\n return option;\n }\n\n return {\n group: null,\n options: [option],\n _key: `ungrouped-${index}`,\n };\n });\n\n const flatOptions = options.flatMap((option) => {\n if (hasGroup(option)) {\n return option.options;\n }\n\n return [option];\n });\n\n const selectedOption = flatOptions.find((option) => {\n return String(option.value) === String(value);\n });\n const resolvedPlaceholder = placeholder || '';\n const resolvedIsInvalid = Boolean(isInvalid || ariaInvalid === true || ariaInvalid === 'true');\n\n return (\n <Select\n value={value}\n onValueChange={handleValueChange}\n size={size}\n items={flatOptions as ComponentProps<typeof Select>['items']}\n modal={modal}\n {...selectProps}\n >\n <SelectTrigger\n ref={ref}\n id={id}\n aria-invalid={resolvedIsInvalid}\n aria-describedby={ariaDescribedBy}\n aria-errormessage={ariaErrorMessage}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n selectedOption?.status && 'relative [&_[data-slot=select-value]]:pl-5',\n '[&_[data-slot=select-value]]:overflow-hidden [&_[data-slot=select-value]>span]:block [&_[data-slot=select-value]>span]:min-w-0 [&_[data-slot=select-value]>span]:max-w-full [&_[data-slot=select-value]>span]:truncate',\n triggerClassName,\n )}\n >\n {selectedOption?.status && (\n <Status\n status={selectedOption.status}\n className=\"absolute left-2.5 top-1/2 -translate-y-1/2\"\n />\n )}\n <SelectValue placeholder={placeholder}>\n {selectedOption ? (\n <span className=\"block min-w-0 max-w-full truncate\" title={selectedOption.label}>\n {selectedOption.label}\n </span>\n ) : (\n <span className=\"block min-w-0 max-w-full truncate text-slate-500\" title={resolvedPlaceholder}>\n {resolvedPlaceholder}\n </span>\n )}\n </SelectValue>\n </SelectTrigger>\n\n {options?.length > 0 && (\n <SelectContent\n className={contentClassName}\n alignItemWithTrigger={alignItemWithTrigger}\n >\n {groupedOptions.map((group) => {\n return (\n <SelectGroup key={group.group ?? group._key}>\n {group.group && <SelectLabel>{group.group}</SelectLabel>}\n\n {group.options?.map((option) => {\n return (\n <SelectItem\n key={String(option.value)}\n value={option.value}\n disabled={option.disabled}\n >\n {option.status && (\n <Status status={option.status} />\n )}\n <span className=\"block min-w-0 flex-1 truncate\" title={option.label}>\n {option.label}\n </span>\n </SelectItem>\n );\n })}\n </SelectGroup>\n );\n })}\n </SelectContent>\n )}\n </Select>\n );\n});\n\nexport default Select;\nexport type { SelectProps };\n"],"mappings":";;;;;;;;AAmFA,IAAa,cAAc,YAA4C,EACnE,SACA,aACA,MACA,UACA,OACA,kBACA,kBACA,uBAAuB,OACvB,WACA,IACA,QAAQ,MACR,gBAAgB,aAChB,oBAAoB,iBACpB,qBAAqB,kBACrB,c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AAA,CACK,MAAM,SAAS,oBAAC,aAAD,EAAA,UAAc,MAAM,OAAoB,CAAA,EAEvD,MAAM,SAAS,KAAK,WAAW;AAC5B,YACI,qBAAC,YAAD;MAEI,OAAO,OAAO;MACd,UAAU,OAAO;gBAHrB,CAKK,OAAO,UACJ,oBAAC,QAAD,EAAQ,QAAQ,OAAO,QAAU,CAAA,EAErC,oBAAC,QAAD;OAAM,WAAU;OAAgC,OAAO,OAAO;iBACzD,OAAO;OACL,CAAA,CACE;QAVJ,OAAO,OAAO,MAAM,CAUhB;MAEnB,CACQ,EAAA,EAnBI,MAAM,SAAS,MAAM,KAmBzB;KAEpB;GACU,CAAA,CAEf;;EAEf;AAEF,IAAA,sBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAG5E,KAAK,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,KAAK,MAAM,CAAC;AAEjG,MAAM,MAAM,oBAAoB,GAAG;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAClD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,QAAQ,oBAAoB,KAAG,IA4BtE,CAAC"}
|
package/dist/utils/config.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { setPortalClassName, setPortalContainer, setShadowRootSelectors } from "./portal.js";
|
|
2
2
|
import { setTranslateFunction, setTranslationCategory } from "./translation.js";
|
|
3
3
|
import { setHostBridge } from "./hostBridge.js";
|
|
4
|
+
import { ensureDocumentScrollStability } from "./documentScrollStability.js";
|
|
4
5
|
//#region src/utils/config.ts
|
|
5
6
|
var configurePluginKitReact = (config) => {
|
|
6
7
|
if (config.portalClassName) setPortalClassName(config.portalClassName);
|
|
7
|
-
if (config.portalContainer)
|
|
8
|
+
if (config.portalContainer) {
|
|
9
|
+
setPortalContainer(config.portalContainer);
|
|
10
|
+
if (config.portalContainer instanceof ShadowRoot) ensureDocumentScrollStability();
|
|
11
|
+
}
|
|
8
12
|
if (config.shadowRootSelectors) setShadowRootSelectors(config.shadowRootSelectors);
|
|
9
13
|
if (config.translationCategory) setTranslationCategory(config.translationCategory);
|
|
10
14
|
if (config.translate) setTranslateFunction(config.translate);
|
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../src/utils/config.ts"],"sourcesContent":["import { setPortalClassName, setPortalContainer, setShadowRootSelectors } from './portal';\nimport { setTranslationCategory, setTranslateFunction, type TranslateParams } from './translation';\nimport { setHostBridge, type PluginKitReactHostBridge } from './hostBridge';\n\ntype TranslateFunction = (category: string, message: string, params?: TranslateParams) => string;\n\nexport type PluginKitReactConfig = {\n portalClassName?: string;\n portalContainer?: HTMLElement | ShadowRoot | null;\n shadowRootSelectors?: string[];\n translationCategory?: string;\n translate?: TranslateFunction;\n hostBridge?: Partial<PluginKitReactHostBridge>;\n};\n\nexport const configurePluginKitReact = (config: PluginKitReactConfig): void => {\n if (config.portalClassName) {\n setPortalClassName(config.portalClassName);\n }\n\n if (config.portalContainer) {\n setPortalContainer(config.portalContainer);\n }\n\n if (config.shadowRootSelectors) {\n setShadowRootSelectors(config.shadowRootSelectors);\n }\n\n if (config.translationCategory) {\n setTranslationCategory(config.translationCategory);\n }\n\n if (config.translate) {\n setTranslateFunction(config.translate);\n }\n\n if (config.hostBridge) {\n setHostBridge(config.hostBridge);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../src/utils/config.ts"],"sourcesContent":["import { setPortalClassName, setPortalContainer, setShadowRootSelectors } from './portal';\nimport { setTranslationCategory, setTranslateFunction, type TranslateParams } from './translation';\nimport { setHostBridge, type PluginKitReactHostBridge } from './hostBridge';\nimport { ensureDocumentScrollStability } from './documentScrollStability';\n\ntype TranslateFunction = (category: string, message: string, params?: TranslateParams) => string;\n\nexport type PluginKitReactConfig = {\n portalClassName?: string;\n portalContainer?: HTMLElement | ShadowRoot | null;\n shadowRootSelectors?: string[];\n translationCategory?: string;\n translate?: TranslateFunction;\n hostBridge?: Partial<PluginKitReactHostBridge>;\n};\n\nexport const configurePluginKitReact = (config: PluginKitReactConfig): void => {\n if (config.portalClassName) {\n setPortalClassName(config.portalClassName);\n }\n\n if (config.portalContainer) {\n setPortalContainer(config.portalContainer);\n\n if (config.portalContainer instanceof ShadowRoot) {\n ensureDocumentScrollStability();\n }\n }\n\n if (config.shadowRootSelectors) {\n setShadowRootSelectors(config.shadowRootSelectors);\n }\n\n if (config.translationCategory) {\n setTranslationCategory(config.translationCategory);\n }\n\n if (config.translate) {\n setTranslateFunction(config.translate);\n }\n\n if (config.hostBridge) {\n setHostBridge(config.hostBridge);\n }\n};\n"],"mappings":";;;;;AAgBA,IAAa,2BAA2B,WAAuC;AAC3E,KAAI,OAAO,gBACP,oBAAmB,OAAO,gBAAgB;AAG9C,KAAI,OAAO,iBAAiB;AACxB,qBAAmB,OAAO,gBAAgB;AAE1C,MAAI,OAAO,2BAA2B,WAClC,gCAA+B;;AAIvC,KAAI,OAAO,oBACP,wBAAuB,OAAO,oBAAoB;AAGtD,KAAI,OAAO,oBACP,wBAAuB,OAAO,oBAAoB;AAGtD,KAAI,OAAO,UACP,sBAAqB,OAAO,UAAU;AAG1C,KAAI,OAAO,WACP,eAAc,OAAO,WAAW"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reserve scrollbar space on the document root so Base UI modal scroll lock
|
|
3
|
+
* can use the stable gutter path instead of padding/body width compensation.
|
|
4
|
+
* Safe to call multiple times; only injects once.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ensureDocumentScrollStability: () => void;
|
|
7
|
+
//# sourceMappingURL=documentScrollStability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentScrollStability.d.ts","sourceRoot":"","sources":["../../src/utils/documentScrollStability.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QAAO,IAahD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/utils/documentScrollStability.ts
|
|
2
|
+
var DOCUMENT_SCROLL_STABILITY_STYLE_ID = "plugin-kit-document-scroll-stability";
|
|
3
|
+
/**
|
|
4
|
+
* Reserve scrollbar space on the document root so Base UI modal scroll lock
|
|
5
|
+
* can use the stable gutter path instead of padding/body width compensation.
|
|
6
|
+
* Safe to call multiple times; only injects once.
|
|
7
|
+
*/
|
|
8
|
+
var ensureDocumentScrollStability = () => {
|
|
9
|
+
if (typeof document === "undefined") return;
|
|
10
|
+
if (document.querySelector(`style[data-plugin-kit-style-id="${DOCUMENT_SCROLL_STABILITY_STYLE_ID}"]`)) return;
|
|
11
|
+
const style = document.createElement("style");
|
|
12
|
+
style.setAttribute("data-plugin-kit-style-id", DOCUMENT_SCROLL_STABILITY_STYLE_ID);
|
|
13
|
+
style.textContent = "html { scrollbar-gutter: stable; }";
|
|
14
|
+
document.head.appendChild(style);
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ensureDocumentScrollStability };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=documentScrollStability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentScrollStability.js","names":[],"sources":["../../src/utils/documentScrollStability.ts"],"sourcesContent":["const DOCUMENT_SCROLL_STABILITY_STYLE_ID = 'plugin-kit-document-scroll-stability';\n\n/**\n * Reserve scrollbar space on the document root so Base UI modal scroll lock\n * can use the stable gutter path instead of padding/body width compensation.\n * Safe to call multiple times; only injects once.\n */\nexport const ensureDocumentScrollStability = (): void => {\n if (typeof document === 'undefined') {\n return;\n }\n\n if (document.querySelector(`style[data-plugin-kit-style-id=\"${DOCUMENT_SCROLL_STABILITY_STYLE_ID}\"]`)) {\n return;\n }\n\n const style = document.createElement('style');\n style.setAttribute('data-plugin-kit-style-id', DOCUMENT_SCROLL_STABILITY_STYLE_ID);\n style.textContent = 'html { scrollbar-gutter: stable; }';\n document.head.appendChild(style);\n};\n"],"mappings":";AAAA,IAAM,qCAAqC;;;;;;AAO3C,IAAa,sCAA4C;AACrD,KAAI,OAAO,aAAa,YACpB;AAGJ,KAAI,SAAS,cAAc,mCAAmC,mCAAmC,IAAI,CACjG;CAGJ,MAAM,QAAQ,SAAS,cAAc,QAAQ;AAC7C,OAAM,aAAa,4BAA4B,mCAAmC;AAClF,OAAM,cAAc;AACpB,UAAS,KAAK,YAAY,MAAM"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAGlC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAGlC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { cn } from "./classes.js";
|
|
|
3
3
|
import { getPortalClassName, getPortalContainer, getPortalTargetForAppend, getShadowRootSelectors, setPortalClassName, setPortalContainer, setShadowRootSelectors } from "./portal.js";
|
|
4
4
|
import { setTranslateFunction, setTranslationCategory, translate } from "./translation.js";
|
|
5
5
|
import { getHostBridge, hostFormatDate, hostGetLocale, hostGetTimepickerOptions, hostOpenElementSelector, hostRequest, setHostBridge } from "./hostBridge.js";
|
|
6
|
+
import { ensureDocumentScrollStability } from "./documentScrollStability.js";
|
|
6
7
|
import { configurePluginKitReact } from "./config.js";
|
|
7
8
|
import { createCraftHostBridge } from "./craftHostBridge.js";
|
|
8
9
|
import { buildUniqueHandleFromSource, getDynamicReservedHandles } from "./handle.js";
|
|
@@ -24,6 +25,7 @@ var utils_exports = /* @__PURE__ */ __exportAll({
|
|
|
24
25
|
configurePluginKitReact: () => configurePluginKitReact,
|
|
25
26
|
createCraftHostBridge: () => createCraftHostBridge,
|
|
26
27
|
createSchemaFieldIndex: () => createSchemaFieldIndex,
|
|
28
|
+
ensureDocumentScrollStability: () => ensureDocumentScrollStability,
|
|
27
29
|
evaluateCondition: () => evaluateCondition,
|
|
28
30
|
extractFieldNames: () => extractFieldNames,
|
|
29
31
|
extractFields: () => extractFields,
|
|
@@ -61,6 +63,6 @@ var utils_exports = /* @__PURE__ */ __exportAll({
|
|
|
61
63
|
import * as import__verbb_plugin_kit from "@verbb/plugin-kit";
|
|
62
64
|
__reExport(utils_exports, import__verbb_plugin_kit);
|
|
63
65
|
//#endregion
|
|
64
|
-
export { buildUniqueHandleFromSource, clearTimeOptionsCache, cn, configurePluginKitReact, createCraftHostBridge, createSchemaFieldIndex, evaluateCondition, extractFieldNames, extractFields, generateTimeOptions, getDynamicReservedHandles, getHostBridge, getPortalClassName, getPortalContainer, getPortalTargetForAppend, getRichTextHtml, getRichTextText, getSchemaFieldIndex, getSchemaFieldNames, getShadowRootSelectors, hasSchemaErrors, hasSchemaErrorsCached, hostFormatDate, hostGetLocale, hostGetTimepickerOptions, hostOpenElementSelector, hostRequest, normalizeAttrs, normalizeSchemaNode, setHostBridge, setPortalClassName, setPortalContainer, setShadowRootSelectors, setTranslateFunction, setTranslationCategory, translate, traverseSchema, utils_exports, validateFormValues, zustandHmrFix };
|
|
66
|
+
export { buildUniqueHandleFromSource, clearTimeOptionsCache, cn, configurePluginKitReact, createCraftHostBridge, createSchemaFieldIndex, ensureDocumentScrollStability, evaluateCondition, extractFieldNames, extractFields, generateTimeOptions, getDynamicReservedHandles, getHostBridge, getPortalClassName, getPortalContainer, getPortalTargetForAppend, getRichTextHtml, getRichTextText, getSchemaFieldIndex, getSchemaFieldNames, getShadowRootSelectors, hasSchemaErrors, hasSchemaErrorsCached, hostFormatDate, hostGetLocale, hostGetTimepickerOptions, hostOpenElementSelector, hostRequest, normalizeAttrs, normalizeSchemaNode, setHostBridge, setPortalClassName, setPortalContainer, setShadowRootSelectors, setTranslateFunction, setTranslationCategory, translate, traverseSchema, utils_exports, validateFormValues, zustandHmrFix };
|
|
65
67
|
|
|
66
68
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["// Re-export all utilities from the base plugin-kit package\nexport * from '@verbb/plugin-kit';\n\n// Export local utilities\nexport * from './classes';\nexport * from './config';\nexport * from './craftHostBridge';\nexport * from './handle';\nexport * from './hostBridge';\nexport * from './portal';\nexport * from './schema';\nexport * from './schemaFieldNames';\nexport * from './schemaIndex';\nexport * from './schemaIndexCache';\nexport * from './schemaNormalize';\nexport * from './store';\nexport * from './timeOptions';\nexport * from './tiptap';\nexport * from './translation';\nexport * from './validation';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["// Re-export all utilities from the base plugin-kit package\nexport * from '@verbb/plugin-kit';\n\n// Export local utilities\nexport * from './classes';\nexport * from './config';\nexport * from './documentScrollStability';\nexport * from './craftHostBridge';\nexport * from './handle';\nexport * from './hostBridge';\nexport * from './portal';\nexport * from './schema';\nexport * from './schemaFieldNames';\nexport * from './schemaIndex';\nexport * from './schemaIndexCache';\nexport * from './schemaNormalize';\nexport * from './store';\nexport * from './timeOptions';\nexport * from './tiptap';\nexport * from './translation';\nexport * from './validation';\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbb/plugin-kit-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"@tiptap/react": "^3.22.4",
|
|
155
155
|
"@types/prismjs": "^1.26.6",
|
|
156
156
|
"@uiw/react-codemirror": "^4.25.10",
|
|
157
|
-
"@verbb/plugin-kit": "1.0.
|
|
157
|
+
"@verbb/plugin-kit": "1.0.6",
|
|
158
158
|
"class-variance-authority": "^0.7.1",
|
|
159
159
|
"clsx": "^2.1.1",
|
|
160
160
|
"cmdk": "^1.1.1",
|