@accelint/design-system 0.12.0 → 0.12.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/menu/index.tsx"],"names":["Menu","MenuList","RACMenu","MenuItem","RACMenuItem"],"mappings":";;;;;;;;;;;;;;;;AAgEA,IAAM,cAAA,GAA8B;AAAA,EAClC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAI,QAAA,CAAS,EAAA;AAAA,IACb,IAAI,QAAA,CAAS;AAAA,GACf;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,WAAA,GACX,cAAoD,IAAI;AAMnD,IAAM,IAAA,GAAO,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GAAA,EACA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,WAAW,CAAA;AACtD,EAAA,KAAA,GAAQ,eAAA,CAAgB,OAAO,MAAM,CAAA;AAErC,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,WAAA;AAAA,IACP,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MACE,eAAA,CAAgB,cAAA,EAAgB,cAA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W,WAAA;AAAA,IACf,CAAC,WAAA,KAAwC;AACvC,MAAA,MAAM,OAAA,GAAU,gBAAgB,YAAA,EAAc;AAAA,QAC5C,GAAG,WAAA;AAAA,QACH,IAAA;AAAA,QACA,eAAA,EAAiB;AAAA,OAClB,CAAA;AAED,MAAA,2BACG,QAAA,EAAA,EAAS,MAAA,EACR,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,IAAA,EAAM,IAAA,EAC/B,iBAAO,OAAA,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA;AAAA,MACA,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n DEFAULT_SLOT,\n MenuStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n type MenuItemRenderProps as RACMenuItemRenderProps,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaSection,\n AriaSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport type { IconProps } from '../icon/types';\nimport { menuClassNames, menuItemStateVars, menuStateVars } from './menu.css';\nimport type {\n MenuItemProps,\n MenuListProps,\n MenuMapping,\n MenuProps,\n} from './types';\n\nconst defaultMapping: MenuMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const MenuContext =\n createContext<ContextValue<MenuProps, HTMLElement>>(null);\n\n/**\n * Menu component that supports display and selection of menu items via a trigger (right-click or click)\n * Customization of React Aria's Menu and Menu Item components https://react-spectrum.adobe.com/react-aria/Menu.html\n */\nexport const Menu = forwardRef(function Menu(\n props: MenuProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n props = useDefaultProps(props, 'Menu');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, classNamesProp, theme.Menu, {\n menu: { container: theme.className }, // required to consume global theme within Popover\n }),\n [classNamesProp, theme.Menu, theme.className],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n (renderProps: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(menuStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof MenuListContext,\n ContextValue<MenuListProps<unknown>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[MenuListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.menu?.menu}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.menu?.menu, size, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={classNames?.menu?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const MenuListContext =\n createContext<ContextValue<MenuListProps<unknown>, HTMLDivElement>>(null);\n\ntype MenuListContexts = [\n [\n typeof MenuItemContext,\n ContextValue<MenuItemProps<unknown>, HTMLDivElement>,\n ],\n [typeof AriaSectionContext, ContextValue<SectionProps<object>, HTMLElement>],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const MenuList = forwardRef(function MenuList<T extends object>(\n props: MenuListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, MenuListContext);\n props = useDefaultProps(props, 'Menu');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, theme.Menu, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Menu, classNamesProp, mapping.header, size],\n );\n\n const values = useMemo<MenuListContexts>(\n () => [\n [MenuItemContext, { classNames, mapping, size }],\n [AriaSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, mapping, size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaSection>\n );\n }, [childrenProp, classNames?.list?.list, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error ts unnecessarily guarding against null state\n () => createCollectionRenderer(MenuStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <RACMenu<T>\n {...rest}\n ref={ref}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </RACMenu>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const MenuItemContext =\n createContext<ContextValue<MenuItemProps<unknown>, HTMLDivElement>>(null);\n\nexport const MenuItem = forwardRef(function MenuItem<T extends object>(\n props: MenuItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, MenuItemContext);\n props = useDefaultProps(props, 'MenuItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, classNamesProp, theme.Menu, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Menu, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: RACMenuItemRenderProps) =>\n inlineVars(menuItemStateVars, { ...renderProps, size, hasDescription }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [\n IconContext,\n {\n slots: {\n [DEFAULT_SLOT]: { classNames: classNames?.item?.icon },\n more: { classNames: classNames?.item?.more },\n },\n },\n ],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.more,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: RACMenuItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, size, values],\n );\n\n return (\n <RACMenuItem<T>\n {...rest}\n id={id ?? textValue}\n ref={ref}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </RACMenuItem>\n );\n});\n"]}
1
+ {"version":3,"sources":["../../../src/components/menu/index.tsx"],"names":["Menu","MenuList","RACMenu","MenuItem","RACMenuItem"],"mappings":";;;;;;;;;;;;;;;;AAiEA,IAAM,cAAA,GAA8B;AAAA,EAClC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAI,QAAA,CAAS,EAAA;AAAA,IACb,IAAI,QAAA,CAAS;AAAA,GACf;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,WAAA,GACX,cAAoD,IAAI;AAMnD,IAAM,IAAA,GAAO,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,WAAA,EAAa,SAAS,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,WAAW,CAAA;AACxE,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,WAAA,EAAa,MAAM,CAAA;AAEtD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,WAAA;AAAA,IACP,GAAG;AAAA,GACL,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MACE,eAAA,CAAgB,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;AAAA,MAClB,YAAY,IAAA,EAAM;AAAA;AACpB,GACF;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,WAAA,KAAwC;AACvC,MAAA,MAAM,OAAA,GAAU,gBAAgB,YAAA,EAAc;AAAA,QAC5C,GAAG,WAAA;AAAA,QACH,IAAA;AAAA,QACA,eAAA,EAAiB;AAAA,OAClB,CAAA;AAED,MAAA,2BACG,QAAA,EAAA,EAAS,MAAA,EACR,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,IAAA,EAAM,IAAA,EAC/B,iBAAO,OAAA,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA,EAAK,SAAA;AAAA,MACL,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n type Ref,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n DEFAULT_SLOT,\n MenuStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n type MenuItemRenderProps as RACMenuItemRenderProps,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaSection,\n AriaSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport type { IconProps } from '../icon/types';\nimport { menuClassNames, menuItemStateVars, menuStateVars } from './menu.css';\nimport type {\n MenuItemProps,\n MenuListProps,\n MenuMapping,\n MenuProps,\n} from './types';\n\nconst defaultMapping: MenuMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const MenuContext =\n createContext<ContextValue<MenuProps, HTMLElement>>(null);\n\n/**\n * Menu component that supports display and selection of menu items via a trigger (right-click or click)\n * Customization of React Aria's Menu and Menu Item components https://react-spectrum.adobe.com/react-aria/Menu.html\n */\nexport const Menu = forwardRef(function Menu(\n props: MenuProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [mergedProps, mergedRef] = useContextProps(props, ref, MenuContext);\n const finalProps = useDefaultProps(mergedProps, 'Menu');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, classNamesProp, theme.Menu, {\n menu: { container: theme.className }, // required to consume global theme within Popover\n }),\n [classNamesProp, theme.Menu, theme.className],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n (renderProps: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(menuStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof MenuListContext,\n ContextValue<MenuListProps<unknown>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[MenuListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.menu?.menu}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.menu?.menu, size, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={mergedRef}\n className={classNames?.menu?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const MenuListContext =\n createContext<ContextValue<MenuListProps<unknown>, HTMLDivElement>>(null);\n\ntype MenuListContexts = [\n [\n typeof MenuItemContext,\n ContextValue<MenuItemProps<unknown>, HTMLDivElement>,\n ],\n [typeof AriaSectionContext, ContextValue<SectionProps<object>, HTMLElement>],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const MenuList = forwardRef(function MenuList<T extends object>(\n props: MenuListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [mergedProps, mergedRef] = useContextProps(props, ref, MenuListContext);\n const finalProps = useDefaultProps(mergedProps, 'Menu');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, theme.Menu, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Menu, classNamesProp, mapping.header, size],\n );\n\n const values = useMemo<MenuListContexts>(\n () => [\n [MenuItemContext, { classNames, mapping, size }],\n [AriaSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, mapping, size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaSection>\n );\n }, [childrenProp, classNames?.list?.list, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error ts unnecessarily guarding against null state\n () => createCollectionRenderer(MenuStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <RACMenu<T>\n {...rest}\n ref={mergedRef}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </RACMenu>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const MenuItemContext =\n createContext<ContextValue<MenuItemProps<unknown>, HTMLDivElement>>(null);\n\nexport const MenuItem = forwardRef(function MenuItem<T extends object>(\n props: MenuItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [mergedProps, mergedRef] = useContextProps(props, ref, MenuItemContext);\n const finalProps = useDefaultProps(mergedProps, 'MenuItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(menuClassNames, classNamesProp, theme.Menu, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Menu, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: RACMenuItemRenderProps) =>\n inlineVars(menuItemStateVars, { ...renderProps, size, hasDescription }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [\n IconContext,\n {\n slots: {\n [DEFAULT_SLOT]: { classNames: classNames?.item?.icon },\n more: { classNames: classNames?.item?.more },\n },\n },\n ],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.more,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: RACMenuItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, size, values],\n );\n\n return (\n <RACMenuItem<T>\n {...rest}\n id={id ?? textValue}\n ref={mergedRef as unknown as Ref<T>}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </RACMenuItem>\n );\n});\n"]}
@@ -35,15 +35,19 @@ var defaultMapping = {
35
35
  var defaultSize = "lg";
36
36
  var OptionsContext = createContext(null);
37
37
  var Options = forwardRef(function Options2(props, ref) {
38
- [props, ref] = useContextProps(props, ref, OptionsContext);
39
- props = useDefaultProps(props, "Options");
38
+ const [resolvedProps, resolvedRef] = useContextProps(
39
+ props,
40
+ ref,
41
+ OptionsContext
42
+ );
43
+ const finalProps = useDefaultProps(resolvedProps, "Options");
40
44
  const {
41
45
  children: childrenProp,
42
46
  classNames: classNamesProp,
43
47
  mapping: mappingProp,
44
48
  size = defaultSize,
45
49
  ...rest
46
- } = props;
50
+ } = finalProps;
47
51
  const theme = useTheme();
48
52
  const classNames = useMemo(
49
53
  () => mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {
@@ -88,7 +92,7 @@ var Options = forwardRef(function Options2(props, ref) {
88
92
  Popover,
89
93
  {
90
94
  ...rest,
91
- ref,
95
+ ref: resolvedRef,
92
96
  className: classNames?.options?.container,
93
97
  style,
94
98
  children
@@ -97,8 +101,12 @@ var Options = forwardRef(function Options2(props, ref) {
97
101
  });
98
102
  var OptionsListContext = createContext(null);
99
103
  var OptionsList = forwardRef(function OptionList(props, ref) {
100
- [props, ref] = useContextProps(props, ref, OptionsListContext);
101
- props = useDefaultProps(props, "OptionsList");
104
+ const [resolvedProps, resolvedRef] = useContextProps(
105
+ props,
106
+ ref,
107
+ OptionsListContext
108
+ );
109
+ const finalProps = useDefaultProps(resolvedProps, "OptionsList");
102
110
  const {
103
111
  children: childrenProp,
104
112
  classNames: classNamesProp,
@@ -109,7 +117,7 @@ var OptionsList = forwardRef(function OptionList(props, ref) {
109
117
  "aria-label": ariaLabel,
110
118
  "aria-labelledby": ariaLabelledBy,
111
119
  ...rest
112
- } = props;
120
+ } = finalProps;
113
121
  const theme = useTheme();
114
122
  const mapping = useMemo(
115
123
  () => ({
@@ -152,7 +160,7 @@ var OptionsList = forwardRef(function OptionList(props, ref) {
152
160
  ListBox,
153
161
  {
154
162
  ...rest,
155
- ref,
163
+ ref: resolvedRef,
156
164
  className: classNames?.list?.container,
157
165
  items,
158
166
  selectionMode,
@@ -165,8 +173,12 @@ var OptionsList = forwardRef(function OptionList(props, ref) {
165
173
  });
166
174
  var OptionsItemContext = createContext(null);
167
175
  var OptionsItem = forwardRef(function OptionItem(props, ref) {
168
- [props, ref] = useContextProps(props, ref, OptionsItemContext);
169
- props = useDefaultProps(props, "OptionsItem");
176
+ const [resolvedProps, resolvedRef] = useContextProps(
177
+ props,
178
+ ref,
179
+ OptionsItemContext
180
+ );
181
+ const finalProps = useDefaultProps(resolvedProps, "OptionsItem");
170
182
  const {
171
183
  id,
172
184
  children: childrenProp,
@@ -175,7 +187,7 @@ var OptionsItem = forwardRef(function OptionItem(props, ref) {
175
187
  size = defaultSize,
176
188
  textValue = typeof childrenProp === "string" ? childrenProp : void 0,
177
189
  ...rest
178
- } = props;
190
+ } = finalProps;
179
191
  const theme = useTheme();
180
192
  const mapping = useMemo(
181
193
  () => ({
@@ -244,7 +256,7 @@ var OptionsItem = forwardRef(function OptionItem(props, ref) {
244
256
  {
245
257
  ...rest,
246
258
  id: id ?? textValue,
247
- ref,
259
+ ref: resolvedRef,
248
260
  className: classNames?.item?.container,
249
261
  style,
250
262
  textValue,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["Options"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,cAAA,GAAiC;AAAA,EACrC,WAAA,EAAa;AAA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,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA;AAAA,MACA,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n ListStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaSection,\n AriaSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport type { IconProps } from '../icon/types';\nimport {\n optionsClassNames,\n optionsItemStateVars,\n optionsStateVars,\n} from './options.css';\nimport type {\n OptionsItemProps,\n OptionsListProps,\n OptionsMapping,\n OptionsProps,\n} from './types';\n\nconst defaultMapping: OptionsMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const OptionsContext =\n createContext<ContextValue<OptionsProps, HTMLElement>>(null);\n\nexport const Options = forwardRef(function Options(\n props: OptionsProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n [props, ref] = useContextProps(props, ref, OptionsContext);\n props = useDefaultProps(props, 'Options');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n options: {\n container: theme.className, // required to consume global theme within Popover\n },\n }),\n [theme.className, theme.Options, classNamesProp],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n ({ ...renderProps }: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(optionsStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof OptionsListContext,\n ContextValue<OptionsListProps<object>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[OptionsListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.options?.options}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.options?.options, size, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={classNames?.options?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const OptionsListContext =\n createContext<ContextValue<OptionsListProps<object>, HTMLDivElement>>(null);\n\ntype OptionsListContexts = [\n [\n typeof OptionsItemContext,\n ContextValue<OptionsItemProps<object>, HTMLDivElement>,\n ],\n [typeof AriaSectionContext, ContextValue<SectionProps<object>, HTMLElement>],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const OptionsList = forwardRef(function OptionList<T extends object>(\n props: OptionsListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, OptionsListContext);\n props = useDefaultProps(props, 'OptionsList');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const values = useMemo<OptionsListContexts>(\n () => [\n [OptionsItemContext, { classNames, size, mapping }],\n [AriaSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, size, mapping],\n );\n\n const style = useCallback(\n (renderProps: ListBoxRenderProps) =>\n inlineVars(optionsItemStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaSection>\n );\n }, [classNames?.list?.list, childrenProp, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error ts unnecessarily guarding against null state\n () => createCollectionRenderer(ListStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={ref}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const OptionsItemContext =\n createContext<ContextValue<OptionsItemProps<object>, HTMLDivElement>>(null);\n\nexport const OptionsItem = forwardRef(function OptionItem<T extends object>(\n props: OptionsItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, OptionsItemContext);\n props = useDefaultProps(props, 'OptionsItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, classNamesProp, theme.Options, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(optionsItemStateVars, {\n ...renderProps,\n size,\n hasDescription,\n }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [IconContext, { classNames: classNames?.item?.icon }],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, size, values],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n id={id ?? textValue}\n ref={ref}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
1
+ {"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["Options"],"mappings":";;;;;;;;;;;;;;;;AAqEA,IAAM,cAAA,GAAiC;AAAA,EACrC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAI,QAAA,CAAS,EAAA;AAAA,IACb,IAAI,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,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA,EAAK,WAAA;AAAA,MACL,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n type Ref,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n ListStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaSection,\n AriaSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport type { IconProps } from '../icon/types';\nimport {\n optionsClassNames,\n optionsItemStateVars,\n optionsStateVars,\n} from './options.css';\nimport type {\n OptionsItemProps,\n OptionsListProps,\n OptionsMapping,\n OptionsProps,\n} from './types';\n\nconst defaultMapping: OptionsMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const OptionsContext =\n createContext<ContextValue<OptionsProps, HTMLElement>>(null);\n\nexport const Options = forwardRef(function Options(\n props: OptionsProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'Options');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n options: {\n container: theme.className, // required to consume global theme within Popover\n },\n }),\n [theme.className, theme.Options, classNamesProp],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n ({ ...renderProps }: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(optionsStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof OptionsListContext,\n ContextValue<OptionsListProps<object>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[OptionsListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.options?.options}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.options?.options, size, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={resolvedRef}\n className={classNames?.options?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const OptionsListContext =\n createContext<ContextValue<OptionsListProps<object>, HTMLDivElement>>(null);\n\ntype OptionsListContexts = [\n [\n typeof OptionsItemContext,\n ContextValue<OptionsItemProps<object>, HTMLDivElement>,\n ],\n [typeof AriaSectionContext, ContextValue<SectionProps<object>, HTMLElement>],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const OptionsList = forwardRef(function OptionList<T extends object>(\n props: OptionsListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsListContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'OptionsList');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const values = useMemo<OptionsListContexts>(\n () => [\n [OptionsItemContext, { classNames, size, mapping }],\n [AriaSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, size, mapping],\n );\n\n const style = useCallback(\n (renderProps: ListBoxRenderProps) =>\n inlineVars(optionsItemStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaSection>\n );\n }, [classNames?.list?.list, childrenProp, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error ts unnecessarily guarding against null state\n () => createCollectionRenderer(ListStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={resolvedRef}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const OptionsItemContext =\n createContext<ContextValue<OptionsItemProps<object>, HTMLDivElement>>(null);\n\nexport const OptionsItem = forwardRef(function OptionItem<T extends object>(\n props: OptionsItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsItemContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'OptionsItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, classNamesProp, theme.Options, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(optionsItemStateVars, {\n ...renderProps,\n size,\n hasDescription,\n }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [IconContext, { classNames: classNames?.item?.icon }],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, size, values],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n id={id ?? textValue}\n ref={resolvedRef as unknown as Ref<T>}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
@@ -12,8 +12,12 @@ import { jsx } from 'react/jsx-runtime';
12
12
  var PickerContext = createContext(null);
13
13
  var PickerItemContext = createContext(null);
14
14
  var Picker = forwardRef(function Picker2(props, ref) {
15
- [props, ref] = useContextProps(props, ref, PickerContext);
16
- props = useDefaultProps(props, "Picker");
15
+ const [resolvedProps, resolvedRef] = useContextProps(
16
+ props,
17
+ ref,
18
+ PickerContext
19
+ );
20
+ const finalProps = useDefaultProps(resolvedProps, "Picker");
17
21
  const {
18
22
  children: childrenProp,
19
23
  classNames: classNamesProp,
@@ -25,7 +29,7 @@ var Picker = forwardRef(function Picker2(props, ref) {
25
29
  "aria-label": ariaLabel,
26
30
  "aria-labelledby": ariaLabelledBy,
27
31
  ...rest
28
- } = props;
32
+ } = finalProps;
29
33
  const theme = useTheme();
30
34
  const classNames = useMemo(
31
35
  () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),
@@ -59,7 +63,7 @@ var Picker = forwardRef(function Picker2(props, ref) {
59
63
  ListBox,
60
64
  {
61
65
  ...rest,
62
- ref,
66
+ ref: resolvedRef,
63
67
  className: classNames?.list?.container,
64
68
  items,
65
69
  layout,
@@ -73,14 +77,18 @@ var Picker = forwardRef(function Picker2(props, ref) {
73
77
  ) });
74
78
  });
75
79
  var PickerItem = forwardRef(function PickerItem2(props, ref) {
76
- [props, ref] = useContextProps(props, ref, PickerItemContext);
80
+ const [resolvedProps, resolvedRef] = useContextProps(
81
+ props,
82
+ ref,
83
+ PickerItemContext
84
+ );
77
85
  const {
78
86
  children: childrenProp,
79
87
  id,
80
88
  classNames: classNamesProp,
81
89
  textValue = typeof childrenProp === "string" ? childrenProp : void 0,
82
90
  ...rest
83
- } = props;
91
+ } = resolvedProps;
84
92
  const theme = useTheme();
85
93
  const classNames = useMemo(
86
94
  () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),
@@ -101,7 +109,7 @@ var PickerItem = forwardRef(function PickerItem2(props, ref) {
101
109
  ListBoxItem,
102
110
  {
103
111
  ...rest,
104
- ref,
112
+ ref: resolvedRef,
105
113
  id: id ?? textValue,
106
114
  className: classNames?.item?.container,
107
115
  style,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../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AAA,KAAiB,QAAA,GAAW,YAAA,GAAe,MAAA;AAAA,IAC9D,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAA,EAAkB,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAA,CAAM,MAAA,EAAQ,cAAc;AAAA,GAC/B;AAEA,EAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,IACZ,CAAC,WAAA,KACC,UAAA,CAAW,mBAAA,EAAqB,WAAW,CAAA;AAAA,IAC7C;AAAC,GACH;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,gCACC,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,UAAA,EAAY,IAAA,EAAM,IAAA,EAC/B,QAAA,EAAA,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAA,EAAiB;AAAA,KAClB,CAAA,EACH,CAAA;AAAA,IAEF,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAI;AAAA,GACvC;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n Provider,\n Section,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n pickerClassNames,\n pickerItemStateVars,\n pickerStateVars,\n} from './picker.css';\nimport type { PickerItemProps, PickerProps } from './types';\n\nexport const PickerContext =\n createContext<ContextValue<PickerProps<unknown>, HTMLDivElement>>(null);\n\nexport const PickerItemContext =\n createContext<ContextValue<PickerItemProps<unknown>, HTMLDivElement>>(null);\n\n/**\n * Generic stylable picker that supports the functionality (sans drag and drop) of\n * React Aria's ListBox: https://react-spectrum.adobe.com/react-aria/ListBox.html\n *\n * NOTE: The picker items does not support sections or separators\n */\nexport const Picker = forwardRef(function Picker<T extends object>(\n props: PickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, PickerContext);\n\n props = useDefaultProps(props, 'Picker');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n columns,\n items,\n layout = 'stack',\n orientation = 'horizontal',\n selectionMode = 'single',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const values = useMemo<\n [\n [\n typeof PickerItemContext,\n ContextValue<PickerItemProps<unknown>, HTMLDivElement>,\n ],\n ]\n >(() => [[PickerItemContext, { classNames }]], [classNames]);\n\n const style = useCallback(\n ({ state, ...renderProps }: ListBoxRenderProps) =>\n inlineVars(pickerStateVars, {\n ...renderProps,\n columns,\n layout,\n orientation,\n }),\n [columns, layout, orientation],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <Section\n className={classNames?.list?.list}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </Section>\n );\n }, [childrenProp, items, classNames?.list?.list, ariaLabel, ariaLabelledBy]);\n\n return (\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={ref}\n className={classNames?.list?.container}\n items={items}\n layout={layout}\n orientation={orientation}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n );\n});\n\nexport const PickerItem = forwardRef(function PickerItem<T extends object>(\n props: PickerItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, PickerItemContext);\n\n const {\n children: childrenProp,\n id,\n classNames: classNamesProp,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(pickerItemStateVars, renderProps),\n [],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => (\n <div className={classNames?.item?.item}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n ),\n [childrenProp, classNames?.item?.item],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n ref={ref}\n id={id ?? textValue}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>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AAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,EAAA;AAAA,IACA,UAAA,EAAY,cAAA;AAAA,IACZ,SAAA,GAAY,OAAO,YAAA,KAAiB,QAAA,GAAW,YAAA,GAAe,MAAA;AAAA,IAC9D,GAAG;AAAA,GACL,GAAI,aAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAA,EAAkB,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAA,CAAM,MAAA,EAAQ,cAAc;AAAA,GAC/B;AAEA,EAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,IACZ,CAAC,WAAA,KACC,UAAA,CAAW,mBAAA,EAAqB,WAAW,CAAA;AAAA,IAC7C;AAAC,GACH;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,gCACC,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,UAAA,EAAY,IAAA,EAAM,IAAA,EAC/B,QAAA,EAAA,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAA,EAAiB;AAAA,KAClB,CAAA,EACH,CAAA;AAAA,IAEF,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAI;AAAA,GACvC;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,WAAA;AAAA,MACL,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type Ref,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n Provider,\n Section,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n pickerClassNames,\n pickerItemStateVars,\n pickerStateVars,\n} from './picker.css';\nimport type { PickerItemProps, PickerProps } from './types';\n\nexport const PickerContext =\n createContext<ContextValue<PickerProps<unknown>, HTMLDivElement>>(null);\n\nexport const PickerItemContext =\n createContext<ContextValue<PickerItemProps<unknown>, HTMLDivElement>>(null);\n\n/**\n * Generic stylable picker that supports the functionality (sans drag and drop) of\n * React Aria's ListBox: https://react-spectrum.adobe.com/react-aria/ListBox.html\n *\n * NOTE: The picker items does not support sections or separators\n */\nexport const Picker = forwardRef(function Picker<T extends object>(\n props: PickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n PickerContext,\n );\n\n const finalProps = useDefaultProps(resolvedProps, 'Picker');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n columns,\n items,\n layout = 'stack',\n orientation = 'horizontal',\n selectionMode = 'single',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const values = useMemo<\n [\n [\n typeof PickerItemContext,\n ContextValue<PickerItemProps<unknown>, HTMLDivElement>,\n ],\n ]\n >(() => [[PickerItemContext, { classNames }]], [classNames]);\n\n const style = useCallback(\n ({ state, ...renderProps }: ListBoxRenderProps) =>\n inlineVars(pickerStateVars, {\n ...renderProps,\n columns,\n layout,\n orientation,\n }),\n [columns, layout, orientation],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <Section\n className={classNames?.list?.list}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </Section>\n );\n }, [childrenProp, items, classNames?.list?.list, ariaLabel, ariaLabelledBy]);\n\n return (\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={resolvedRef}\n className={classNames?.list?.container}\n items={items}\n layout={layout}\n orientation={orientation}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n );\n});\n\nexport const PickerItem = forwardRef(function PickerItem<T extends object>(\n props: PickerItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n PickerItemContext,\n );\n\n const {\n children: childrenProp,\n id,\n classNames: classNamesProp,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = resolvedProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(pickerItemStateVars, renderProps),\n [],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => (\n <div className={classNames?.item?.item}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n ),\n [childrenProp, classNames?.item?.item],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n ref={resolvedRef as unknown as Ref<T>}\n id={id ?? textValue}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
@@ -6,7 +6,13 @@ declare const airportUseOptions: Option[];
6
6
  declare const airportTypeOptions: Option[];
7
7
  declare const fields: ({
8
8
  inputType?: "number" | "date" | "time" | "text" | "datetime-local" | undefined;
9
- operators?: Option<string>[] | undefined;
9
+ operators?: {
10
+ [x: string]: unknown;
11
+ value?: string | undefined;
12
+ label: string;
13
+ disabled?: boolean | undefined;
14
+ name: string;
15
+ }[] | undefined;
10
16
  validator?: ((rule: RuleType) => ValidationResult) | undefined;
11
17
  valueEditorType?: ValueEditorType | undefined;
12
18
  id: string;
@@ -17,7 +23,13 @@ declare const fields: ({
17
23
  defaultValue?: undefined;
18
24
  } | {
19
25
  inputType?: "number" | "date" | "time" | "text" | "datetime-local" | undefined;
20
- operators: Option<string>[] | {
26
+ operators: {
27
+ [x: string]: unknown;
28
+ value?: string | undefined;
29
+ label: string;
30
+ disabled?: boolean | undefined;
31
+ name: string;
32
+ }[] | {
21
33
  readonly name: "=";
22
34
  readonly value: "=";
23
35
  readonly label: "is";
@@ -36,7 +48,13 @@ declare const fields: ({
36
48
  label: string;
37
49
  type: string;
38
50
  valueEditorType: "multiselect";
39
- values: Option<string>[];
51
+ values: {
52
+ [x: string]: unknown;
53
+ value?: string | undefined;
54
+ label: string;
55
+ disabled?: boolean | undefined;
56
+ name: string;
57
+ }[];
40
58
  operators: {
41
59
  readonly name: "in";
42
60
  readonly value: "in";
@@ -87,7 +105,13 @@ declare const fields: ({
87
105
  label: string;
88
106
  type: string;
89
107
  valueEditorType: "radio";
90
- values: Option<string>[];
108
+ values: {
109
+ [x: string]: unknown;
110
+ value?: string | undefined;
111
+ label: string;
112
+ disabled?: boolean | undefined;
113
+ name: string;
114
+ }[];
91
115
  defaultValue: string;
92
116
  operators?: undefined;
93
117
  })[];
@@ -188,6 +188,7 @@ function RuleGroupHeaderComponents(ruleGroup) {
188
188
  className: ruleGroup.classNames.combinators,
189
189
  handleOnChange: ruleGroup.onCombinatorChange,
190
190
  rules: ruleGroup.ruleGroup.rules,
191
+ ruleGroup: ruleGroup.ruleGroup,
191
192
  level: ruleGroup.path.length,
192
193
  path: ruleGroup.path,
193
194
  disabled: ruleGroup.disabled,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/query-builder/group.tsx"],"names":["Fragment"],"mappings":";;;;;;;;AAqCA,IAAM,uBAAA,GAA0B,CAAA;AAEhC,IAAM,uBAAA,GAA0B,CAAA;AAEzB,SAAS,UAAU,KAAA,EAAuB;AAC/C,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,qBAAA,EAAuB,qBAAA;AAAA,MACvB,uBAAA,EAAyB,uBAAA;AAAA,MACzB,uBAAA,EAAyB;AAAA,KAC3B;AAAA,IACA;AAAA,GACF,GAAI,WAAW,mBAAmB,CAAA;AAElC,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ;AAAA,MACN,iBAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA;AACF,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,KAAA,GAAQ,OAAA;AAAA,IACZ,MACE,CAAC,gBAAA,EAAkB,eAAe,CAAA,CAAE,MAAA;AAAA,MAClC,CAAC,GAAA,EAAK,IAAA,KAAS,GAAA,IAAO,OAAO,CAAA,GAAI,CAAA,CAAA;AAAA,MACjC;AAAA,KACF;AAAA,IACF,CAAC,kBAAkB,eAAe;AAAA,GACpC;AAEA,EAAA,MAAM,MAAA,GAAS,OAAA;AAAA,IACb,MACE,CAAC,iBAAA,EAAmB,gBAAgB,CAAA,CAAE,MAAA;AAAA,MACpC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A;AAAA,QACvB,QAAQ,SAAA,CAAU;AAAA,OAAA;AAAA,MAbb,MAAA,CAAO;AAAA,KAcd,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"group.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Fragment, useContext, useMemo } from 'react';\nimport {\n type RuleGroupArray,\n type RuleGroupICArray,\n type RuleGroupProps,\n TestID,\n isRuleGroup,\n isRuleGroupType,\n pathsAreEqual,\n useRuleGroup,\n useStopEventPropagation,\n} from 'react-querybuilder';\nimport { inlineVars } from '../../utils/css';\nimport { QueryBuilderContext } from './constants';\nimport { queryBuilderGroupStateVars } from './query-builder.css';\nimport type { RuleGroupElementsProps } from './types';\n\n/**\n * Rules have 5 non-optional functional pieces:\n * - Field\n * - Operator (conditional)\n * - Value Source (conditional)\n * - Value (conditional)\n * - Remove\n */\nconst HORZ_CORE_COLUMNS_COUNT = 5;\n// When layout == column, Field, Operator, Value Source & Value are grouped into a single column\nconst VERT_CORE_COLUMNS_COUNT = 2;\n\nexport function RuleGroup(props: RuleGroupProps) {\n const {\n classNames,\n controlElements: {\n ruleGroupBodyElements: RuleGroupBodyElements,\n ruleGroupFooterElements: RuleGroupFooterElements,\n ruleGroupHeaderElements: RuleGroupHeaderElements,\n },\n orientation,\n } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n enableDragAndDrop,\n showCloneButtons,\n showLockButtons,\n showShiftActions,\n },\n } = props;\n\n const after = useMemo(\n () =>\n [showCloneButtons, showLockButtons].reduce(\n (acc, flag) => acc + (flag ? 1 : 0),\n 0,\n ),\n [showCloneButtons, showLockButtons],\n );\n\n const before = useMemo(\n () =>\n [enableDragAndDrop, showShiftActions].reduce(\n (acc, flag) => acc + (flag ? 1 : 0),\n 0,\n ),\n [enableDragAndDrop, showShiftActions],\n );\n\n const columns = useMemo(\n () =>\n (orientation === 'horizontal'\n ? HORZ_CORE_COLUMNS_COUNT\n : VERT_CORE_COLUMNS_COUNT) +\n before +\n after,\n [orientation, after, before],\n );\n\n const style = useMemo(\n () =>\n inlineVars(queryBuilderGroupStateVars, {\n after,\n before,\n columns,\n orientation,\n isDisabled: false,\n }),\n [after, before, columns, orientation],\n );\n\n const group = useRuleGroup(props);\n const addRule = useStopEventPropagation(group.addRule);\n const addGroup = useStopEventPropagation(group.addGroup);\n const cloneGroup = useStopEventPropagation(group.cloneGroup);\n const toggleLockGroup = useStopEventPropagation(group.toggleLockGroup);\n const removeGroup = useStopEventPropagation(group.removeGroup);\n const shiftGroupUp = useStopEventPropagation(group.shiftGroupUp);\n const shiftGroupDown = useStopEventPropagation(group.shiftGroupDown);\n\n const elementProps = useMemo(\n () => ({\n ...(group as RuleGroupElementsProps),\n addGroup,\n addRule,\n cloneGroup,\n removeGroup,\n shiftGroupDown,\n shiftGroupUp,\n toggleLockGroup,\n }),\n [\n addGroup,\n addRule,\n cloneGroup,\n group,\n removeGroup,\n shiftGroupDown,\n shiftGroupUp,\n toggleLockGroup,\n ],\n );\n\n return (\n <div className={classNames?.group?.container} style={style}>\n <div\n ref={group.previewRef}\n className={group.outerClassName}\n data-dragmonitorid={group.dragMonitorId}\n data-dropmonitorid={group.dropMonitorId}\n data-level={group.path.length}\n data-path={JSON.stringify(group.path)}\n data-rule-group-id={group.id}\n data-testid={TestID.ruleGroup}\n >\n <div ref={group.dropRef} className={group.classNames.header}>\n <RuleGroupHeaderElements {...elementProps} />\n </div>\n <div className={group.classNames.body}>\n <RuleGroupBodyElements {...elementProps} />\n </div>\n <div className={classNames?.group?.footer}>\n <RuleGroupFooterElements {...elementProps} />\n </div>\n </div>\n </div>\n );\n}\n\nexport function RuleGroupHeaderComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const { classNames } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n controls: {\n shiftActions: ShiftActionsControlElement,\n dragHandle: DragHandleControlElement,\n combinatorSelector: CombinatorSelectorControlElement,\n notToggle: NotToggleControlElement,\n cloneGroupAction: CloneGroupActionControlElement,\n lockGroupAction: LockGroupActionControlElement,\n removeGroupAction: RemoveGroupActionControlElement,\n },\n },\n } = ruleGroup;\n\n const titles = useMemo(\n () => ({\n shiftUp: ruleGroup.translations.shiftActionUp.title,\n shiftDown: ruleGroup.translations.shiftActionDown.title,\n }),\n [\n ruleGroup.translations.shiftActionDown.title,\n ruleGroup.translations.shiftActionUp.title,\n ],\n );\n\n const labels = useMemo(\n () => ({\n shiftUp: ruleGroup.translations.shiftActionUp.label,\n shiftDown: ruleGroup.translations.shiftActionDown.label,\n }),\n [\n ruleGroup.translations.shiftActionDown.label,\n ruleGroup.translations.shiftActionUp.label,\n ],\n );\n\n return (\n <>\n {ruleGroup.schema.showShiftActions && ruleGroup.path.length > 0 && (\n <div className={classNames?.group?.shift}>\n <ShiftActionsControlElement\n key={TestID.shiftActions}\n testID={TestID.shiftActions}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n titles={titles}\n labels={labels}\n className={ruleGroup.classNames.shiftActions}\n disabled={ruleGroup.disabled}\n shiftUp={ruleGroup.shiftGroupUp}\n shiftDown={ruleGroup.shiftGroupDown}\n shiftUpDisabled={ruleGroup.shiftUpDisabled}\n shiftDownDisabled={ruleGroup.shiftDownDisabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleOrGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {ruleGroup.path.length > 0 && ruleGroup.schema.enableDragAndDrop && (\n <div className={classNames?.group?.drag}>\n <DragHandleControlElement\n key={TestID.dragHandle}\n testID={TestID.dragHandle}\n ref={ruleGroup.dragRef}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n title={ruleGroup.translations.dragHandle.title}\n label={ruleGroup.translations.dragHandle.label}\n className={ruleGroup.classNames.dragHandle}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleOrGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {!(\n ruleGroup.schema.showCombinatorsBetweenRules ||\n ruleGroup.schema.independentCombinators\n ) && (\n <div className={classNames?.group?.combinator}>\n <CombinatorSelectorControlElement\n key={TestID.combinators}\n testID={TestID.combinators}\n options={ruleGroup.schema.combinators}\n value={ruleGroup.combinator}\n title={ruleGroup.translations.combinators.title}\n className={ruleGroup.classNames.combinators}\n handleOnChange={ruleGroup.onCombinatorChange}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.schema.showNotToggle && (\n <div className={classNames?.group?.toggle}>\n <NotToggleControlElement\n key={TestID.notToggle}\n testID={TestID.notToggle}\n className={ruleGroup.classNames.notToggle}\n title={ruleGroup.translations.notToggle.title}\n label={ruleGroup.translations.notToggle.label}\n checked={ruleGroup.ruleGroup.not}\n handleOnChange={ruleGroup.onNotToggleChange}\n level={ruleGroup.path.length}\n disabled={ruleGroup.disabled}\n path={ruleGroup.path}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {ruleGroup.schema.showCloneButtons && ruleGroup.path.length >= 1 && (\n <div className={classNames?.group?.clone}>\n <CloneGroupActionControlElement\n key={TestID.cloneGroup}\n testID={TestID.cloneGroup}\n label={ruleGroup.translations.cloneRuleGroup.label}\n title={ruleGroup.translations.cloneRuleGroup.title}\n className={ruleGroup.classNames.cloneGroup}\n handleOnClick={ruleGroup.cloneGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.schema.showLockButtons && (\n <div className={classNames?.group?.lock}>\n <LockGroupActionControlElement\n key={TestID.lockGroup}\n testID={TestID.lockGroup}\n label={ruleGroup.translations.lockGroup.label}\n title={ruleGroup.translations.lockGroup.title}\n className={ruleGroup.classNames.lockGroup}\n handleOnClick={ruleGroup.toggleLockGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n disabledTranslation={\n ruleGroup.parentDisabled\n ? undefined\n : ruleGroup.translations.lockGroupDisabled\n }\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.path.length > 0 && (\n <div className={classNames?.group?.remove}>\n <RemoveGroupActionControlElement\n key={TestID.removeGroup}\n testID={TestID.removeGroup}\n label={ruleGroup.translations.removeGroup.label}\n title={ruleGroup.translations.removeGroup.title}\n className={ruleGroup.classNames.removeGroup}\n handleOnClick={ruleGroup.removeGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n </>\n );\n}\n\nexport function RuleGroupBodyComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const {\n schema: {\n controls: {\n ruleGroup: RuleGroupControlElement,\n rule: RuleControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n {(ruleGroup.ruleGroup.rules as RuleGroupICArray | RuleGroupArray).map(\n (rule, idx, { length: ruleArrayLength }) => {\n const thisPathMemo = ruleGroup.pathsMemo[idx];\n const thisPath = thisPathMemo?.path ?? [];\n\n const thisPathDisabled =\n !thisPathMemo ||\n thisPathMemo.disabled ||\n (typeof rule !== 'string' && rule.disabled);\n\n const shiftUpDisabled = pathsAreEqual([0], thisPath);\n\n const shiftDownDisabled =\n ruleGroup.path.length === 0 && idx === ruleArrayLength - 1;\n\n const key =\n typeof rule === 'string' ? [...thisPath, rule].join('-') : rule.id;\n\n return (\n <Fragment key={key}>\n {isRuleGroup(rule) && (\n <RuleGroupControlElement\n key={TestID.ruleGroup}\n id={rule.id}\n schema={ruleGroup.schema}\n actions={ruleGroup.actions}\n path={thisPath}\n translations={ruleGroup.translations}\n ruleGroup={rule}\n rules={rule.rules}\n combinator={\n isRuleGroupType(rule) ? rule.combinator : undefined\n }\n not={!!rule.not}\n disabled={thisPathDisabled}\n parentDisabled={\n ruleGroup.parentDisabled || ruleGroup.disabled\n }\n shiftUpDisabled={shiftUpDisabled}\n shiftDownDisabled={shiftDownDisabled}\n context={ruleGroup.context}\n />\n )}\n {typeof rule !== 'string' && !isRuleGroup(rule) && (\n <RuleControlElement\n key={TestID.rule}\n // biome-ignore lint/style/noNonNullAssertion: intentional\n id={rule.id!}\n rule={rule}\n field={rule.field}\n operator={rule.operator}\n value={rule.value}\n valueSource={rule.valueSource}\n schema={ruleGroup.schema}\n actions={ruleGroup.actions}\n path={thisPath}\n disabled={thisPathDisabled}\n parentDisabled={\n ruleGroup.parentDisabled || ruleGroup.disabled\n }\n translations={ruleGroup.translations}\n shiftUpDisabled={shiftUpDisabled}\n shiftDownDisabled={shiftDownDisabled}\n context={ruleGroup.context}\n />\n )}\n </Fragment>\n );\n },\n )}\n </>\n );\n}\n\nexport function RuleGroupFooterComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const { classNames } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n controls: {\n addGroupAction: AddGroupActionControlElement,\n addRuleAction: AddRuleActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <div className={classNames?.rule?.add}>\n <AddRuleActionControlElement\n key={TestID.addRule}\n testID={TestID.addRule}\n label={ruleGroup.translations.addRule.label}\n title={ruleGroup.translations.addRule.title}\n className={ruleGroup.classNames.addRule}\n handleOnClick={ruleGroup.addRule}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n <div className={classNames?.group?.add}>\n <AddGroupActionControlElement\n key={TestID.addGroup}\n testID={TestID.addGroup}\n label={ruleGroup.translations.addGroup.label}\n title={ruleGroup.translations.addGroup.title}\n className={ruleGroup.classNames.addGroup}\n handleOnClick={ruleGroup.addGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n </>\n );\n}\n"]}
1
+ {"version":3,"sources":["../../../src/components/query-builder/group.tsx"],"names":["Fragment"],"mappings":";;;;;;;;AAqCA,IAAM,uBAAA,GAA0B,CAAA;AAEhC,IAAM,uBAAA,GAA0B,CAAA;AAEzB,SAAS,UAAU,KAAA,EAAuB;AAC/C,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,qBAAA,EAAuB,qBAAA;AAAA,MACvB,uBAAA,EAAyB,uBAAA;AAAA,MACzB,uBAAA,EAAyB;AAAA,KAC3B;AAAA,IACA;AAAA,GACF,GAAI,WAAW,mBAAmB,CAAA;AAElC,EAAA,MAAM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,MAAA,CAAO,QAAA;AAAA,QACf,KAAA,EAAO,SAAA,CAAU,YAAA,CAAa,QAAA,CAAS,KAAA;AAAA,QACvC,KAAA,EAAO,SAAA,CAAU,YAAA,CAAa,QAAA,CAAS,KAAA;AAAA,QACvC,SAAA,EAAW,UAAU,UAAA,CAAW,QAAA;AAAA,QAChC,eAAe,SAAA,CAAU,QAAA;AAAA,QACzB,KAAA,EAAO,UAAU,SAAA,CAAU,KAAA;AAAA,QAC3B,KAAA,EAAO,UAAU,IAAA,CAAK,MAAA;AAAA,QACtB,MAAM,SAAA,CAAU,IAAA;AAAA,QAChB,UAAU,SAAA,CAAU,QAAA;AAAA,QACpB,SAAS,SAAA,CAAU,OAAA;AAAA,QACnB,YAAY,SAAA,CAAU,gBAAA;AAAA,QACtB,aAAa,SAAA,CAAU,SAAA;AAAA,QACvB,QAAQ,SAAA,CAAU;AAAA,OAAA;AAAA,MAbb,MAAA,CAAO;AAAA,KAcd,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"group.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Fragment, useContext, useMemo } from 'react';\nimport {\n type RuleGroupArray,\n type RuleGroupICArray,\n type RuleGroupProps,\n TestID,\n isRuleGroup,\n isRuleGroupType,\n pathsAreEqual,\n useRuleGroup,\n useStopEventPropagation,\n} from 'react-querybuilder';\nimport { inlineVars } from '../../utils/css';\nimport { QueryBuilderContext } from './constants';\nimport { queryBuilderGroupStateVars } from './query-builder.css';\nimport type { RuleGroupElementsProps } from './types';\n\n/**\n * Rules have 5 non-optional functional pieces:\n * - Field\n * - Operator (conditional)\n * - Value Source (conditional)\n * - Value (conditional)\n * - Remove\n */\nconst HORZ_CORE_COLUMNS_COUNT = 5;\n// When layout == column, Field, Operator, Value Source & Value are grouped into a single column\nconst VERT_CORE_COLUMNS_COUNT = 2;\n\nexport function RuleGroup(props: RuleGroupProps) {\n const {\n classNames,\n controlElements: {\n ruleGroupBodyElements: RuleGroupBodyElements,\n ruleGroupFooterElements: RuleGroupFooterElements,\n ruleGroupHeaderElements: RuleGroupHeaderElements,\n },\n orientation,\n } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n enableDragAndDrop,\n showCloneButtons,\n showLockButtons,\n showShiftActions,\n },\n } = props;\n\n const after = useMemo(\n () =>\n [showCloneButtons, showLockButtons].reduce(\n (acc, flag) => acc + (flag ? 1 : 0),\n 0,\n ),\n [showCloneButtons, showLockButtons],\n );\n\n const before = useMemo(\n () =>\n [enableDragAndDrop, showShiftActions].reduce(\n (acc, flag) => acc + (flag ? 1 : 0),\n 0,\n ),\n [enableDragAndDrop, showShiftActions],\n );\n\n const columns = useMemo(\n () =>\n (orientation === 'horizontal'\n ? HORZ_CORE_COLUMNS_COUNT\n : VERT_CORE_COLUMNS_COUNT) +\n before +\n after,\n [orientation, after, before],\n );\n\n const style = useMemo(\n () =>\n inlineVars(queryBuilderGroupStateVars, {\n after,\n before,\n columns,\n orientation,\n isDisabled: false,\n }),\n [after, before, columns, orientation],\n );\n\n const group = useRuleGroup(props);\n const addRule = useStopEventPropagation(group.addRule);\n const addGroup = useStopEventPropagation(group.addGroup);\n const cloneGroup = useStopEventPropagation(group.cloneGroup);\n const toggleLockGroup = useStopEventPropagation(group.toggleLockGroup);\n const removeGroup = useStopEventPropagation(group.removeGroup);\n const shiftGroupUp = useStopEventPropagation(group.shiftGroupUp);\n const shiftGroupDown = useStopEventPropagation(group.shiftGroupDown);\n\n const elementProps = useMemo(\n () => ({\n ...(group as RuleGroupElementsProps),\n addGroup,\n addRule,\n cloneGroup,\n removeGroup,\n shiftGroupDown,\n shiftGroupUp,\n toggleLockGroup,\n }),\n [\n addGroup,\n addRule,\n cloneGroup,\n group,\n removeGroup,\n shiftGroupDown,\n shiftGroupUp,\n toggleLockGroup,\n ],\n );\n\n return (\n <div className={classNames?.group?.container} style={style}>\n <div\n ref={group.previewRef}\n className={group.outerClassName}\n data-dragmonitorid={group.dragMonitorId}\n data-dropmonitorid={group.dropMonitorId}\n data-level={group.path.length}\n data-path={JSON.stringify(group.path)}\n data-rule-group-id={group.id}\n data-testid={TestID.ruleGroup}\n >\n <div ref={group.dropRef} className={group.classNames.header}>\n <RuleGroupHeaderElements {...elementProps} />\n </div>\n <div className={group.classNames.body}>\n <RuleGroupBodyElements {...elementProps} />\n </div>\n <div className={classNames?.group?.footer}>\n <RuleGroupFooterElements {...elementProps} />\n </div>\n </div>\n </div>\n );\n}\n\nexport function RuleGroupHeaderComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const { classNames } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n controls: {\n shiftActions: ShiftActionsControlElement,\n dragHandle: DragHandleControlElement,\n combinatorSelector: CombinatorSelectorControlElement,\n notToggle: NotToggleControlElement,\n cloneGroupAction: CloneGroupActionControlElement,\n lockGroupAction: LockGroupActionControlElement,\n removeGroupAction: RemoveGroupActionControlElement,\n },\n },\n } = ruleGroup;\n\n const titles = useMemo(\n () => ({\n shiftUp: ruleGroup.translations.shiftActionUp.title,\n shiftDown: ruleGroup.translations.shiftActionDown.title,\n }),\n [\n ruleGroup.translations.shiftActionDown.title,\n ruleGroup.translations.shiftActionUp.title,\n ],\n );\n\n const labels = useMemo(\n () => ({\n shiftUp: ruleGroup.translations.shiftActionUp.label,\n shiftDown: ruleGroup.translations.shiftActionDown.label,\n }),\n [\n ruleGroup.translations.shiftActionDown.label,\n ruleGroup.translations.shiftActionUp.label,\n ],\n );\n\n return (\n <>\n {ruleGroup.schema.showShiftActions && ruleGroup.path.length > 0 && (\n <div className={classNames?.group?.shift}>\n <ShiftActionsControlElement\n key={TestID.shiftActions}\n testID={TestID.shiftActions}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n titles={titles}\n labels={labels}\n className={ruleGroup.classNames.shiftActions}\n disabled={ruleGroup.disabled}\n shiftUp={ruleGroup.shiftGroupUp}\n shiftDown={ruleGroup.shiftGroupDown}\n shiftUpDisabled={ruleGroup.shiftUpDisabled}\n shiftDownDisabled={ruleGroup.shiftDownDisabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleOrGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {ruleGroup.path.length > 0 && ruleGroup.schema.enableDragAndDrop && (\n <div className={classNames?.group?.drag}>\n <DragHandleControlElement\n key={TestID.dragHandle}\n testID={TestID.dragHandle}\n ref={ruleGroup.dragRef}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n title={ruleGroup.translations.dragHandle.title}\n label={ruleGroup.translations.dragHandle.label}\n className={ruleGroup.classNames.dragHandle}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleOrGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {!(\n ruleGroup.schema.showCombinatorsBetweenRules ||\n ruleGroup.schema.independentCombinators\n ) && (\n <div className={classNames?.group?.combinator}>\n <CombinatorSelectorControlElement\n key={TestID.combinators}\n testID={TestID.combinators}\n options={ruleGroup.schema.combinators}\n value={ruleGroup.combinator}\n title={ruleGroup.translations.combinators.title}\n className={ruleGroup.classNames.combinators}\n handleOnChange={ruleGroup.onCombinatorChange}\n rules={ruleGroup.ruleGroup.rules}\n ruleGroup={ruleGroup.ruleGroup}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.schema.showNotToggle && (\n <div className={classNames?.group?.toggle}>\n <NotToggleControlElement\n key={TestID.notToggle}\n testID={TestID.notToggle}\n className={ruleGroup.classNames.notToggle}\n title={ruleGroup.translations.notToggle.title}\n label={ruleGroup.translations.notToggle.label}\n checked={ruleGroup.ruleGroup.not}\n handleOnChange={ruleGroup.onNotToggleChange}\n level={ruleGroup.path.length}\n disabled={ruleGroup.disabled}\n path={ruleGroup.path}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n ruleGroup={ruleGroup.ruleGroup}\n />\n </div>\n )}\n {ruleGroup.schema.showCloneButtons && ruleGroup.path.length >= 1 && (\n <div className={classNames?.group?.clone}>\n <CloneGroupActionControlElement\n key={TestID.cloneGroup}\n testID={TestID.cloneGroup}\n label={ruleGroup.translations.cloneRuleGroup.label}\n title={ruleGroup.translations.cloneRuleGroup.title}\n className={ruleGroup.classNames.cloneGroup}\n handleOnClick={ruleGroup.cloneGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.schema.showLockButtons && (\n <div className={classNames?.group?.lock}>\n <LockGroupActionControlElement\n key={TestID.lockGroup}\n testID={TestID.lockGroup}\n label={ruleGroup.translations.lockGroup.label}\n title={ruleGroup.translations.lockGroup.title}\n className={ruleGroup.classNames.lockGroup}\n handleOnClick={ruleGroup.toggleLockGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n disabledTranslation={\n ruleGroup.parentDisabled\n ? undefined\n : ruleGroup.translations.lockGroupDisabled\n }\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {ruleGroup.path.length > 0 && (\n <div className={classNames?.group?.remove}>\n <RemoveGroupActionControlElement\n key={TestID.removeGroup}\n testID={TestID.removeGroup}\n label={ruleGroup.translations.removeGroup.label}\n title={ruleGroup.translations.removeGroup.title}\n className={ruleGroup.classNames.removeGroup}\n handleOnClick={ruleGroup.removeGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n </>\n );\n}\n\nexport function RuleGroupBodyComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const {\n schema: {\n controls: {\n ruleGroup: RuleGroupControlElement,\n rule: RuleControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n {(ruleGroup.ruleGroup.rules as RuleGroupICArray | RuleGroupArray).map(\n (rule, idx, { length: ruleArrayLength }) => {\n const thisPathMemo = ruleGroup.pathsMemo[idx];\n const thisPath = thisPathMemo?.path ?? [];\n\n const thisPathDisabled =\n !thisPathMemo ||\n thisPathMemo.disabled ||\n (typeof rule !== 'string' && rule.disabled);\n\n const shiftUpDisabled = pathsAreEqual([0], thisPath);\n\n const shiftDownDisabled =\n ruleGroup.path.length === 0 && idx === ruleArrayLength - 1;\n\n const key =\n typeof rule === 'string' ? [...thisPath, rule].join('-') : rule.id;\n\n return (\n <Fragment key={key}>\n {isRuleGroup(rule) && (\n <RuleGroupControlElement\n key={TestID.ruleGroup}\n id={rule.id}\n schema={ruleGroup.schema}\n actions={ruleGroup.actions}\n path={thisPath}\n translations={ruleGroup.translations}\n ruleGroup={rule}\n rules={rule.rules}\n combinator={\n isRuleGroupType(rule) ? rule.combinator : undefined\n }\n not={!!rule.not}\n disabled={thisPathDisabled}\n parentDisabled={\n ruleGroup.parentDisabled || ruleGroup.disabled\n }\n shiftUpDisabled={shiftUpDisabled}\n shiftDownDisabled={shiftDownDisabled}\n context={ruleGroup.context}\n />\n )}\n {typeof rule !== 'string' && !isRuleGroup(rule) && (\n <RuleControlElement\n key={TestID.rule}\n // biome-ignore lint/style/noNonNullAssertion: intentional\n id={rule.id!}\n rule={rule}\n field={rule.field}\n operator={rule.operator}\n value={rule.value}\n valueSource={rule.valueSource}\n schema={ruleGroup.schema}\n actions={ruleGroup.actions}\n path={thisPath}\n disabled={thisPathDisabled}\n parentDisabled={\n ruleGroup.parentDisabled || ruleGroup.disabled\n }\n translations={ruleGroup.translations}\n shiftUpDisabled={shiftUpDisabled}\n shiftDownDisabled={shiftDownDisabled}\n context={ruleGroup.context}\n />\n )}\n </Fragment>\n );\n },\n )}\n </>\n );\n}\n\nexport function RuleGroupFooterComponents(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const { classNames } = useContext(QueryBuilderContext);\n\n const {\n schema: {\n controls: {\n addGroupAction: AddGroupActionControlElement,\n addRuleAction: AddRuleActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <div className={classNames?.rule?.add}>\n <AddRuleActionControlElement\n key={TestID.addRule}\n testID={TestID.addRule}\n label={ruleGroup.translations.addRule.label}\n title={ruleGroup.translations.addRule.title}\n className={ruleGroup.classNames.addRule}\n handleOnClick={ruleGroup.addRule}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n <div className={classNames?.group?.add}>\n <AddGroupActionControlElement\n key={TestID.addGroup}\n testID={TestID.addGroup}\n label={ruleGroup.translations.addGroup.label}\n title={ruleGroup.translations.addGroup.title}\n className={ruleGroup.classNames.addGroup}\n handleOnClick={ruleGroup.addGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n </>\n );\n}\n"]}