@accelint/design-system 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/aria/index.js.map +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/collection/index.d.ts +1 -1
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/combo-box/index.js +9 -5
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.js +8 -4
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-input/index.js +15 -7
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/index.js +7 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.js +21 -8
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/element/index.d.ts +1 -1
- package/dist/components/element/index.js +7 -3
- package/dist/components/element/index.js.map +1 -1
- package/dist/components/element/types.d.ts +2 -0
- package/dist/components/group/index.js +6 -6
- package/dist/components/group/index.js.map +1 -1
- package/dist/components/icon/index.js +4 -4
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/index.d.ts +34 -34
- package/dist/components/input/index.js +17 -8
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/merge-provider/types.d.ts +2 -0
- package/dist/components/number-field/index.js +8 -4
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/popover/index.js +8 -4
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/dataset-sample.js.map +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +12 -8
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.js +9 -5
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.js +5 -5
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +48 -20
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.js +4 -4
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.js +32 -20
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-field/index.js +8 -4
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/textarea/index.js +16 -7
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/time-field/index.js +8 -4
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tooltip/index.js +17 -9
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/utils.js +3 -1
- package/dist/components/tree/utils.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/use-theme/index.d.ts +1 -1
- package/dist/hooks/use-theme/index.js.map +1 -1
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.d.ts +34 -34
- package/dist/ladle/actions.js.map +1 -1
- package/dist/test/setup.js +10 -10
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/css/index.js.map +1 -1
- package/dist/utils/props/index.js +1 -2
- package/dist/utils/props/index.js.map +1 -1
- package/dist/vanilla.d.ts +29 -29
- package/package.json +15 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/aria/index.tsx"],"names":["AriaMenuSection","AriaListBoxSection","AriaSection","AriaSelectValue","AriaText"],"mappings":";;;;;AA+CA,SAAS,KACP,SAAA,EACA;AACA,EAAA,MAAM,OAAA,GAAU,cAAkC,IAAI,CAAA;AAEtD,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,UAAA,C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AAa,KAAK,SAAA,EAAW,CAAA;AAChD,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 ReactNode,\n type RefAttributes,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/aria/index.tsx"],"names":["AriaMenuSection","AriaListBoxSection","AriaSection","AriaSelectValue","AriaText"],"mappings":";;;;;AA+CA,SAAS,KACP,SAAA,EACA;AACA,EAAA,MAAM,OAAA,GAAU,cAAkC,IAAI,CAAA;AAEtD,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,UAAA,CAAiB,SAAS,gBAAA,CAAiB,OAAO,GAAA,EAAK;AAChE,MAAA,MAAM,CAAC,WAAA,EAAa,SAAS,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,OAAO,CAAA;AAEpE,MAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,WAAA,EAAa,KAAK,SAAA,EAAW,CAAA;AAAA,IACrD,CAAC,CAAA;AAAA,IACD;AAAA,GACF;AACF;AAEO,IAAM,EAAE,SAAA,EAAW,cAAA,EAAgB,SAAS,qBAAA,EAAsB,GACvE,KAAK,UAAU;AAEV,IAAM,EAAE,SAAA,EAAW,SAAA,EAAW,SAAS,gBAAA,EAAiB,GAAI,KAAK,KAAK;AAEtE,IAAM,EAAE,SAAA,EAAW,UAAA,EAAY,SAAS,iBAAA,EAAkB,GAC/D,KAAK,MAAM;AAEN,IAAM,EAAE,SAAA,EAAW,WAAA,EAAa,SAAS,kBAAA,EAAmB,GACj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a,KAAK,SAAA,EAAW,CAAA;AACnD,CAAC;AAEM,IAAM,sBAAA,GACX,cAAuE,IAAI;AAEtE,IAAM,eAAA,GAAkB,UAAA,CAAW,SAASC,gBAAAA,CAEjD,OAA4B,GAAA,EAAoC;AAChE,EAAA,MAAM,CAAC,WAAA,EAAa,SAAS,CAAA,GAAI,eAAA;AAAA,IAC/B,KAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBAAO,GAAA,CAAC,WAAA,EAAA,EAAa,GAAG,WAAA,EAAa,KAAK,SAAA,EAAW,CAAA;AACvD,CAAC;AAEM,IAAM,eAAA,GACX,cAAoD,IAAI;AAEnD,IAAM,QAAA,GAAW,UAAA,CAAW,SAASC,SAAAA,CAC1C,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,WAAA,EAAa,SAAS,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,eAAe,CAAA;AAE5E,EAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAM,GAAG,WAAA,EAAa,KAAK,SAAA,EAAW,CAAA;AAChD,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 createContext,\n type ForwardedRef,\n forwardRef,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport {\n type ContextValue,\n FieldError,\n Group,\n Header,\n Heading,\n Keyboard,\n Label,\n ListBoxSection,\n type ListBoxSectionProps,\n MenuSection,\n type MenuSectionProps,\n Section,\n type SectionProps,\n SelectValue,\n type SelectValueProps,\n Separator,\n Text,\n type TextProps,\n useContextProps,\n} from 'react-aria-components';\n\n/**\n * To better align with the guidance from RAC about establishing a unique\n * context for components to avoid conflict of props being provided by RAC\n * and design system components, this wrapping utility accepts an RAC and returns\n * a wrapped version along with the new context for the design system to use\n */\nfunction wrap<P extends object, E extends HTMLElement>(\n Component: (props: P & RefAttributes<E>) => ReactNode,\n) {\n const Context = createContext<ContextValue<P, E>>(null);\n\n return {\n Component: forwardRef<E, P>(function WrappedComponent(props, ref) {\n const [mergedProps, mergedRef] = useContextProps(props, ref, Context);\n\n return <Component {...mergedProps} ref={mergedRef} />;\n }),\n Context,\n };\n}\n\nexport const { Component: AriaFieldError, Context: AriaFieldErrorContext } =\n wrap(FieldError);\n\nexport const { Component: AriaGroup, Context: AriaGroupContext } = wrap(Group);\n\nexport const { Component: AriaHeader, Context: AriaHeaderContext } =\n wrap(Header);\n\nexport const { Component: AriaHeading, Context: AriaHeadingContext } =\n wrap(Heading);\n\nexport const { Component: AriaKeyboard, Context: AriaKeyboardContext } =\n wrap(Keyboard);\n\nexport const { Component: AriaLabel, Context: AriaLabelContext } = wrap(Label);\n\nexport const { Component: AriaSeparator, Context: AriaSeparatorContext } =\n wrap(Separator);\n\n/**\n * Due to the complexity of types and technical constraints of TS, it's not\n * possible for the above wrapping utility to support components that accept\n * generic parameters. This means that these components must be manually wrapped\n */\n\nexport const AriaMenuSectionContext =\n createContext<ContextValue<MenuSectionProps<object>, HTMLElement>>(null);\n\nexport const AriaMenuSection = forwardRef(function AriaMenuSection<\n T extends object,\n>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>) {\n const [mergedProps, mergedRef] = useContextProps(\n props,\n ref,\n AriaMenuSectionContext,\n );\n\n return <MenuSection {...mergedProps} ref={mergedRef} />;\n});\n\nexport const AriaListBoxSectionContext =\n createContext<ContextValue<ListBoxSectionProps<object>, HTMLElement>>(null);\n\nexport const AriaListBoxSection = forwardRef(function AriaListBoxSection<\n T extends object,\n>(props: ListBoxSectionProps<T>, ref: ForwardedRef<HTMLElement>) {\n const [mergedProps, mergedRef] = useContextProps(\n props,\n ref,\n AriaListBoxSectionContext,\n );\n\n return <ListBoxSection {...mergedProps} ref={mergedRef} />;\n});\n\nexport const AriaSectionContext =\n createContext<ContextValue<SectionProps<object>, HTMLElement>>(null);\n\nexport const AriaSection = forwardRef(function AriaSection<T extends object>(\n props: SectionProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [mergedProps, mergedRef] = useContextProps(\n props,\n ref,\n AriaSectionContext,\n );\n\n return <Section {...mergedProps} ref={mergedRef} />;\n});\n\nexport const AriaSelectValueContext =\n createContext<ContextValue<SelectValueProps<object>, HTMLSpanElement>>(null);\n\nexport const AriaSelectValue = forwardRef(function AriaSelectValue<\n T extends object,\n>(props: SelectValueProps<T>, ref: ForwardedRef<HTMLSpanElement>) {\n const [mergedProps, mergedRef] = useContextProps(\n props,\n ref,\n AriaSelectValueContext,\n );\n\n return <SelectValue {...mergedProps} ref={mergedRef} />;\n});\n\nexport const AriaTextContext =\n createContext<ContextValue<TextProps, HTMLElement>>(null);\n\nexport const AriaText = forwardRef(function AriaText(\n props: TextProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [mergedProps, mergedRef] = useContextProps(props, ref, AriaTextContext);\n\n return <Text {...mergedProps} ref={mergedRef} />;\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/button/index.tsx"],"names":["Button","RACButton","LinkButton","ToggleButton","RACToggleButton"],"mappings":";;;;;;;;;;;;;;;;AAmDA,IAAM,eAAA,GAAkB;AAAA,EACtB,eAAA,EAAiB,KAAA;AAAA,EACjB,UAAA,EAAY,KAAA;AAAA,EACZ,WAAA,EAAa,IAAA;AAAA,EACb,MAAA,EAAQ;AACV,CAAA;AACA,IAAM,cAA6B,CAAC,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,MAAM,IAAI,CAAA;AAEhE,IAAM,cAAA,GAAgC;AAAA,EACpC,IAAA,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ACX,cAA4D,IAAI;AAE3D,IAAM,MAAA,GAAS,UAAA,CAAW,SAASA,OAAAA,CACxC,OACA,GAAA,EACA;AACA,EAAA,MAAM,WAAA,GAAc,SAAA,CAAU,KAAA,EAAO,GAAA,EAAK,eAAe,QAAQ,CAAA;AAEjE,EAAA,uBAAO,GAAA,CAACC,QAAA,EAAA,EAAW,GAAG,WAAA,EAAa,CAAA;AACrC,CAAC;AAEM,IAAM,iBAAA,GACX,cAAgE,IAAI;AAE/D,IAAM,UAAA,GAAa,UAAA,CAAW,SAASC,WAAAA,CAC5C,OACA,GAAA,EACA;AACA,EAAA,MAAM,WAAA,GAAc,SAAA,CAAU,KAAA,EAAO,GAAA,EAAK,mBAAmB,YAAY,CAAA;AAEzE,EAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAM,GAAG,WAAA,EAAa,CAAA;AAChC,CAAC;AAEM,IAAM,mBAAA,GACX,cAAkE,IAAI;AAEjE,IAAM,YAAA,GAAe,UAAA,CAAW,SAASC,aAAAA,CAC9C,OACA,GAAA,EACA;AACA,EAAA,MAAM,WAAA,GAAc,SAAA;AAAA,IAClB,KAAA;AAAA,IACA,GAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBAAO,GAAA,CAACC,cAAA,EAAA,EAAiB,GAAG,WAAA,EAAa,CAAA;AAC3C,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 { noop } from '@accelint/core';\nimport { clsx } from 'clsx';\nimport {\n type Context,\n type ForwardedRef,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/index.tsx"],"names":["Button","RACButton","LinkButton","ToggleButton","RACToggleButton"],"mappings":";;;;;;;;;;;;;;;;AAmDA,IAAM,eAAA,GAAkB;AAAA,EACtB,eAAA,EAAiB,KAAA;AAAA,EACjB,UAAA,EAAY,KAAA;AAAA,EACZ,WAAA,EAAa,IAAA;AAAA,EACb,MAAA,EAAQ;AACV,CAAA;AACA,IAAM,cAA6B,CAAC,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,MAAM,IAAI,CAAA;AAEhE,IAAM,cAAA,GAAgC;AAAA,EACpC,IAAA,EAAM,MAAA;AAAA,EACN,MAAM,WAAA,CAAY,MAAA;AAAA,IAChB,CAAC,KAAK,IAAA,KAAS;AACb,MAAA,GAAA,CAAI,IAAI,CAAA,GAAI,EAAE,IAAA,EAAK;AAEnB,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAC;AAEL,CAAA;AAEA,SAAS,SAAA,CAIP,KAAA,EACA,GAAA,EACA,OAAA,EACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,UAAU,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,OAAO,CAAA;AAEtE,EAAA,MAAM,cAAA,GAAiB,eAAA,CAAgB,YAAA,EAAc,GAAG,CAAA;AAExD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,KAAA,GAAQ,SAAA;AAAA,IACR,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,IAAA;AAAA,IACP,OAAA,GAAU,OAAA;AAAA,IACV,GAAG;AAAA,GACL,GAAI,cAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,OAAA,GAAU,OAAA;AAAA,IACd,OAAO;AAAA,MACL,GAAG,cAAA;AAAA,MACH,GAAG;AAAA,KACL,CAAA;AAAA,IACA,CAAC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C3C,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 { noop } from '@accelint/core';\nimport { clsx } from 'clsx';\nimport {\n type Context,\n createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ButtonRenderProps,\n type ContextValue,\n Link,\n type LinkRenderProps,\n Provider,\n Button as RACButton,\n ToggleButton as RACToggleButton,\n type ToggleButtonRenderProps,\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 { surfaces } from '../../styles/surfaces.css';\nimport { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { IconContext } from '../icon';\nimport { buttonClassNames, buttonStateVars } from './button.css';\nimport type { OmitProtectedProps } from '../../types/props';\nimport type { IconProps } from '../icon/types';\nimport type {\n ButtonMapping,\n ButtonProps,\n ButtonSizes,\n LinkButtonProps,\n ToggleButtonProps,\n} from './types';\n\nconst noopToggleState = {\n defaultSelected: false,\n isSelected: false,\n setSelected: noop,\n toggle: noop,\n};\nconst buttonSizes: ButtonSizes[] = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst defaultMapping: ButtonMapping = {\n font: bodies,\n icon: buttonSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<ButtonSizes, OmitProtectedProps<IconProps>>,\n ),\n};\n\nfunction useButton<\n P extends ButtonProps | LinkButtonProps | ToggleButtonProps,\n E extends HTMLElement,\n>(\n props: P,\n ref: ForwardedRef<E>,\n context: Context<ContextValue<P, E>>,\n key: 'Button' | 'LinkButton' | 'ToggleButton',\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, context);\n\n const defaultedProps = useDefaultProps(contextProps, key);\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n color = 'primary',\n mapping: mappingProp,\n size = 'md',\n variant = 'solid',\n ...rest\n } = defaultedProps;\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(buttonClassNames, theme.Button, classNamesProp, {\n button: clsx(\n mapping.font[size],\n variant === 'floating' && surfaces.default.proud,\n ),\n }),\n [theme.Button, classNamesProp, mapping.font, size, variant],\n );\n\n const style = useCallback(\n (\n renderProps:\n | ButtonRenderProps\n | LinkRenderProps\n | ToggleButtonRenderProps,\n ) =>\n inlineVars(buttonStateVars, {\n isCurrent: false,\n isSelected: false,\n ...renderProps,\n color,\n size,\n variant,\n }),\n [color, size, variant],\n );\n\n const values = useMemo<\n [[typeof IconContext, ContextValue<IconProps, HTMLDivElement>]]\n >(() => [[IconContext, mapping.icon[size]]], [mapping.icon, size]);\n\n const children = useCallback(\n (\n renderProps:\n | ButtonRenderProps\n | LinkRenderProps\n | ToggleButtonRenderProps,\n ) => (\n <Provider values={values}>\n <span className={classNames?.button}>\n {callRenderProps(childrenProp, {\n state: noopToggleState,\n isCurrent: false,\n isPending: false,\n isSelected: false,\n ...renderProps,\n })}\n </span>\n </Provider>\n ),\n [values, classNames?.button, childrenProp],\n );\n\n return useMemo(\n () => ({\n ...rest,\n ref: contextRef,\n children,\n className: classNames?.container,\n style,\n }),\n // TODO(ilk): This should be checked. \"rest changes on every re-render and should not be used as a hook dependency.\"\n // biome-ignore lint/correctness/useExhaustiveDependencies: This should be checked and verified.\n [rest, contextRef, children, classNames?.container, style],\n );\n}\n\nexport const ButtonContext =\n createContext<ContextValue<ButtonProps, HTMLButtonElement>>(null);\n\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const buttonProps = useButton(props, ref, ButtonContext, 'Button');\n\n return <RACButton {...buttonProps} />;\n});\n\nexport const LinkButtonContext =\n createContext<ContextValue<LinkButtonProps, HTMLAnchorElement>>(null);\n\nexport const LinkButton = forwardRef(function LinkButton(\n props: LinkButtonProps,\n ref: ForwardedRef<HTMLAnchorElement>,\n) {\n const buttonProps = useButton(props, ref, LinkButtonContext, 'LinkButton');\n\n return <Link {...buttonProps} />;\n});\n\nexport const ToggleButtonContext =\n createContext<ContextValue<ToggleButtonProps, HTMLButtonElement>>(null);\n\nexport const ToggleButton = forwardRef(function ToggleButton(\n props: ToggleButtonProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const buttonProps = useButton(\n props,\n ref,\n ToggleButtonContext,\n 'ToggleButton',\n );\n\n return <RACToggleButton {...buttonProps} />;\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/checkbox/index.tsx"],"names":["Checkbox","RACCheckbox","CheckboxGroup","RACCheckboxGroup"],"mappings":";;;;;;;;;;;;;;AAiDO,IAAM,eAAA,GACX,cAA6D,IAAI;AAE5D,IAAM,QAAA,GAAW,UAAA,CAAW,SAASA,SAAAA,CAC1C,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,aAAA,EAAe,WAAW,CAAA,GAAI,eAAA;AAAA,IACnC,KAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,aAAA,EAAe,UAAU,CAAA;AAE5D,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,UAAA,GAAa,KAAA;AAAA,IACb,GAAG;AAAA,GAC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AA,MACJ,CAAC,gBAAA,EAAkB,EAAE,WAAW,UAAA,EAAY,KAAA,EAAO,OAAO,CAAA;AAAA,MAC1D;AAAA,QACE,eAAA;AAAA,QACA;AAAA,UACE,UAAA;AAAA,UACA;AAAA;AACF;AACF,KACF;AAAA,IACA,CAAC,YAAY,UAAU;AAAA,GACzB;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,WAAA,qBACC,GAAA,CAAC,QAAA,EAAA,EAAS,MAAA,EACR,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,KAAA,EAChC,QAAA,EAAA,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAA,EAAiB;AAAA,KAClB,GACH,CAAA,EACF,CAAA;AAAA,IAEF,CAAC,YAAA,EAAc,UAAA,EAAY,KAAA,EAAO,MAAM;AAAA,GAC1C;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,eAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,WAAA;AAAA,MACL,SAAA,EAAW,YAAY,KAAA,EAAO,SAAA;AAAA,MAC9B,KAAA;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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/checkbox/index.tsx"],"names":["Checkbox","RACCheckbox","CheckboxG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B,KAAA;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 createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n type LabelProps,\n Provider,\n Checkbox as RACCheckbox,\n CheckboxGroup as RACCheckboxGroup,\n TextContext,\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 { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaLabelContext, AriaTextContext } from '../aria';\nimport { IconContext } from '../icon';\nimport {\n checkboxClassNames,\n checkboxGroupStateVars,\n checkboxStateVars,\n} from './checkbox.css';\nimport type { IconProps } from '../icon/types';\nimport type {\n CheckboxGroupProps,\n CheckboxGroupRenderProps,\n CheckboxProps,\n CheckboxRenderProps,\n} from './types';\n\nexport const CheckboxContext =\n createContext<ContextValue<CheckboxProps, HTMLLabelElement>>(null);\n\nexport const Checkbox = forwardRef(function Checkbox(\n props: CheckboxProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n CheckboxContext,\n );\n\n const finalProps = useDefaultProps(resolvedProps, 'Checkbox');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n ...rest\n } = finalProps;\n\n const [iconRef, hasIcon] = useSlot();\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(checkboxClassNames, theme.Checkbox, classNamesProp),\n [theme.Checkbox, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: CheckboxRenderProps) =>\n inlineVars(checkboxStateVars, {\n ...renderProps,\n alignInput,\n }),\n [alignInput],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [typeof TextContext, ContextValue<TextProps, HTMLElement>],\n ]\n >(\n () => [\n [AriaTextContext, { className: classNames?.checkbox?.label }],\n [\n IconContext,\n {\n ref: iconRef,\n classNames: classNames?.checkbox?.icon,\n },\n ],\n [TextContext, null],\n ],\n [classNames?.checkbox?.label, classNames?.checkbox?.icon, iconRef],\n );\n\n const children = useCallback(\n (renderProps: CheckboxRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.checkbox?.checkbox}>\n {!hasIcon && (\n <span className={classNames?.checkbox?.icon?.container} />\n )}\n {callRenderProps(childrenProp, renderProps)}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.checkbox, hasIcon, values],\n );\n\n return (\n <RACCheckbox\n {...rest}\n ref={resolvedRef}\n className={classNames?.checkbox?.container}\n style={style}\n >\n {children}\n </RACCheckbox>\n );\n});\n\nexport const CheckboxGroupContext =\n createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\n\nexport const CheckboxGroup = forwardRef(function CheckboxGroup(\n props: CheckboxGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedContextProps, resolvedRef] = useContextProps(\n props,\n ref,\n CheckboxGroupContext,\n );\n\n const resolvedProps = useDefaultProps(resolvedContextProps, 'CheckboxGroup');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n orientation = 'vertical',\n ...rest\n } = resolvedProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(checkboxClassNames, theme.Checkbox, classNamesProp),\n [classNamesProp, theme.Checkbox],\n );\n\n const style = useCallback(\n (renderProps: CheckboxGroupRenderProps) =>\n inlineVars(checkboxGroupStateVars, {\n ...renderProps,\n orientation,\n }),\n [orientation],\n );\n\n const values = useMemo<\n [\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof CheckboxContext, ContextValue<CheckboxProps, HTMLLabelElement>],\n ]\n >(\n () => [\n [AriaLabelContext, { className: classNames?.group?.label }],\n [\n CheckboxContext,\n {\n classNames,\n alignInput,\n },\n ],\n ],\n [alignInput, classNames],\n );\n\n const children = useCallback(\n (renderProps: CheckboxGroupRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.group?.group}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.group, values],\n );\n\n return (\n <RACCheckboxGroup\n {...rest}\n ref={resolvedRef}\n className={classNames?.group?.container}\n style={style}\n >\n {children}\n </RACCheckboxGroup>\n );\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chip/index.tsx"],"names":["ChipItem","RACTextContext","ChipGroup"],"mappings":";;;;;;;;;;;;;;AA+CA,IAAM,QAAA,GAAwD;AAAA,EAC5D,KAAA,EAAO,MAAA;AAAA,EACP,IAAA,EAAM;AACR,CAAA;AAEA,IAAM,cAAA,GAA8B;AAAA,EAClC,IAAA,EAAM;AAAA,IACJ,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAClC,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAAO;AAEtC,CAAA;AAEO,SAAS,KAAK,KAAA,EAAkB;AACrC,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AAC,CAAA;AAAA,IACjD,CAAC,UAAA,EAAY,KAAA,EAAO,IAAI;AAAA,GAC1B;AAEA,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,IAAA,EAAM,GAAA,EAAK,UAAA,EAAY,SAAA,EAAW,UAAA,EAAY,KAAA,EAC1D,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,MAAA,EAAiB,UAAS,CAAA,EACtC,CAAA;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 type ContextValue,\n Provider,\n TextContext as RACTextContext,\n Tag,\n TagGroup,\n TagList,\n type TagRenderProps,\n type TextProps,\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 { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaTextContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport type { ButtonProps } from '../button/types';\nimport { chipClassNames, chipStateVars } from './chip.css';\nimport type {\n ChipGroupProps,\n ChipItemProps,\n ChipListProps,\n ChipMapping,\n ChipProps,\n} from './types';\n\nconst defaults: Required<Pick<ChipProps, 'color' | 'size'>> = {\n color: 'info',\n size: 'sm',\n};\n\nconst defaultMapping: ChipMapping = {\n font: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n remove: {\n sm: { size: 'sm', variant: 'icon' },\n lg: { size: 'sm', variant: 'icon' },\n },\n};\n\nexport function Chip(props: ChipProps) {\n const chipProps = useDefaultProps(props, 'Chip');\n\n const {\n children,\n classNames: classNamesProp,\n color = defaults.color,\n mapping: mappingProp,\n size = defaults.size,\n } = chipProps;\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(chipClassNames, theme.Chip, classNamesProp, {\n chip: mapping.font[size],\n }),\n [theme.Chip, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [[typeof AriaTextContext, ContextValue<TextProps, HTMLElement>]]\n >(\n () => [[AriaTextContext, { className: classNames?.label }]],\n [classNames?.label],\n );\n\n const style = useMemo(\n () =>\n inlineVars(chipStateVars, {\n allowsRemoving: false,\n color,\n selectionBehavior: 'toggle',\n selectionMode: 'none',\n size,\n isDisabled: false,\n isFocused: false,\n isFocusVisible: false,\n isHovered: false,\n isPressed: false,\n isSelected: false,\n }),\n [color, size],\n );\n\n return (\n <Provider values={values}>\n <div className={classNames?.container} style={style}>\n <div className={classNames?.chip}>{children}</div>\n </div>\n </Provider>\n );\n}\n\nexport const ChipContext =\n createContext<ContextValue<ChipItemProps, HTMLDivElement>>(null);\n\n/**\n * Must be used in conjunction with ChipList & ChipGroup and\n * cannot be used outside of ChipList, else will throw error\n *\n * Color & Size props can be passed in from ChipGroup and overriden\n * on each instance of this components\n *\n * Order of precedence (from lowest to highest):\n * Design System Defaults of Chip\n * Global Defaults of ChipGroup\n * Instance of ChipGroup\n * Global Defaults of ChipItem\n * Instance of ChipItem\n */\nexport const ChipItem = forwardRef(function ChipItem(\n props: ChipItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, ChipContext);\n const finalProps = useDefaultProps(contextProps, 'Chip');\n\n const {\n children: childrenProp,\n id,\n classNames: classNamesProp,\n color = defaults.color,\n size = defaults.size,\n textValue,\n mapping: mappingProp,\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(chipClassNames, theme.Chip, classNamesProp, {\n chip: mapping.font[size],\n }),\n [theme.Chip, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof RACTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n ]\n >(\n () => [\n // Because ChipGroup (TagGroup) implements a TextContext, we need to block it inside of the Chip\n // so that there isn't a conflict of with our AriaTextContext. Otherwise there are slot errors\n [RACTextContext, null],\n [AriaTextContext, { className: classNames?.label }],\n [\n ButtonContext,\n {\n ...mapping.remove[size],\n classNames: { button: classNames?.remove },\n slot: 'remove',\n },\n ],\n ],\n [classNames?.label, classNames?.remove, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: TagRenderProps) =>\n inlineVars(chipStateVars, {\n ...renderProps,\n color,\n size,\n }),\n [color, size],\n );\n\n const children = useCallback(\n (renderProps: TagRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.chip}>\n {callRenderProps(childrenProp, renderProps)}\n </div>\n </Provider>\n ),\n [values, classNames?.chip, childrenProp],\n );\n\n return (\n <Tag\n {...rest}\n ref={contextRef}\n id={id ?? textValue}\n className={classNames?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </Tag>\n );\n});\n\n/**\n * Must be used in conjunction with ChipItem & ChipGroup and\n * cannot be used outside of ChipGroup, else will throw error\n */\nexport function ChipList<T extends object>({\n classNames: classNamesProp,\n ...rest\n}: ChipListProps<T>) {\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(chipClassNames, theme.Chip, classNamesProp),\n [theme.Chip, classNamesProp],\n );\n\n return <TagList<T> {...rest} className={classNames?.list} />;\n}\n\nexport const ChipGroupContext =\n createContext<ContextValue<ChipGroupProps, HTMLDivElement>>(null);\n\n/**\n * Color & Size props are passed down to ChipItem but can be overridden\n * on each component if desired\n */\nexport const ChipGroup = forwardRef(function ChipGroup(\n props: ChipGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n ChipGroupContext,\n );\n const finalProps = useDefaultProps(contextProps, 'ChipGroup');\n\n const {\n children,\n classNames: classNamesProp,\n color,\n size,\n ...rest\n } = finalProps;\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(chipClassNames, theme.Chip, classNamesProp),\n [theme.Chip, classNamesProp],\n );\n\n const values = useMemo<\n [[typeof ChipContext, ContextValue<ChipItemProps, HTMLDivElement>]]\n >(\n () => [[ChipContext, { classNames, color, size }]],\n [classNames, color, size],\n );\n\n return (\n <TagGroup {...rest} ref={contextRef} className={classNames?.group}>\n <Provider values={values}>{children}</Provider>\n </TagGroup>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chip/index.tsx"],"names":["ChipItem","RACTextContext","ChipGroup"],"mappings":";;;;;;;;;;;;;;AA+CA,IAAM,QAAA,GAAwD;AAAA,EAC5D,KAAA,EAAO,MAAA;AAAA,EACP,IAAA,EAAM;AACR,CAAA;AAEA,IAAM,cAAA,GAA8B;AAAA,EAClC,IAAA,EAAM;AAAA,IACJ,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAClC,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAAO;AAEtC,CAAA;AAEO,SAAS,KAAK,KAAA,EAAkB;AACrC,EAAA,MAAM,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AAA,IACjD,CAAC,UAAA,EAAY,KAAA,EAAO,IAAI;AAAA,GAC1B;AAEA,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,IAAA,EAAM,GAAA,EAAK,UAAA,EAAY,SAAA,EAAW,UAAA,EAAY,KAAA,EAC1D,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,MAAA,EAAiB,UAAS,CAAA,EACtC,CAAA;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 createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n Provider,\n TextContext as RACTextContext,\n Tag,\n TagGroup,\n TagList,\n type TagRenderProps,\n type TextProps,\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 { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaTextContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport { chipClassNames, chipStateVars } from './chip.css';\nimport type { ButtonProps } from '../button/types';\nimport type {\n ChipGroupProps,\n ChipItemProps,\n ChipListProps,\n ChipMapping,\n ChipProps,\n} from './types';\n\nconst defaults: Required<Pick<ChipProps, 'color' | 'size'>> = {\n color: 'info',\n size: 'sm',\n};\n\nconst defaultMapping: ChipMapping = {\n font: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n remove: {\n sm: { size: 'sm', variant: 'icon' },\n lg: { size: 'sm', variant: 'icon' },\n },\n};\n\nexport function Chip(props: ChipProps) {\n const chipProps = useDefaultProps(props, 'Chip');\n\n const {\n children,\n classNames: classNamesProp,\n color = defaults.color,\n mapping: mappingProp,\n size = defaults.size,\n } = chipProps;\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(chipClassNames, theme.Chip, classNamesProp, {\n chip: mapping.font[size],\n }),\n [theme.Chip, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [[typeof AriaTextContext, ContextValue<TextProps, HTMLElement>]]\n >(\n () => [[AriaTextContext, { className: classNames?.label }]],\n [classNames?.label],\n );\n\n const style = useMemo(\n () =>\n inlineVars(chipStateVars, {\n allowsRemoving: false,\n color,\n selectionBehavior: 'toggle',\n selectionMode: 'none',\n size,\n isDisabled: false,\n isFocused: false,\n isFocusVisible: false,\n isHovered: false,\n isPressed: false,\n isSelected: false,\n }),\n [color, size],\n );\n\n return (\n <Provider values={values}>\n <div className={classNames?.container} style={style}>\n <div className={classNames?.chip}>{children}</div>\n </div>\n </Provider>\n );\n}\n\nexport const ChipContext =\n createContext<ContextValue<ChipItemProps, HTMLDivElement>>(null);\n\n/**\n * Must be used in conjunction with ChipList & ChipGroup and\n * cannot be used outside of ChipList, else will throw error\n *\n * Color & Size props can be passed in from ChipGroup and overriden\n * on each instance of this components\n *\n * Order of precedence (from lowest to highest):\n * Design System Defaults of Chip\n * Global Defaults of ChipGroup\n * Instance of ChipGroup\n * Global Defaults of ChipItem\n * Instance of ChipItem\n */\nexport const ChipItem = forwardRef(function ChipItem(\n props: ChipItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, ChipContext);\n const finalProps = useDefaultProps(contextProps, 'Chip');\n\n const {\n children: childrenProp,\n id,\n classNames: classNamesProp,\n color = defaults.color,\n size = defaults.size,\n textValue,\n mapping: mappingProp,\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(chipClassNames, theme.Chip, classNamesProp, {\n chip: mapping.font[size],\n }),\n [theme.Chip, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof RACTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n ]\n >(\n () => [\n // Because ChipGroup (TagGroup) implements a TextContext, we need to block it inside of the Chip\n // so that there isn't a conflict of with our AriaTextContext. Otherwise there are slot errors\n [RACTextContext, null],\n [AriaTextContext, { className: classNames?.label }],\n [\n ButtonContext,\n {\n ...mapping.remove[size],\n classNames: { button: classNames?.remove },\n slot: 'remove',\n },\n ],\n ],\n [classNames?.label, classNames?.remove, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: TagRenderProps) =>\n inlineVars(chipStateVars, {\n ...renderProps,\n color,\n size,\n }),\n [color, size],\n );\n\n const children = useCallback(\n (renderProps: TagRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.chip}>\n {callRenderProps(childrenProp, renderProps)}\n </div>\n </Provider>\n ),\n [values, classNames?.chip, childrenProp],\n );\n\n return (\n <Tag\n {...rest}\n ref={contextRef}\n id={id ?? textValue}\n className={classNames?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </Tag>\n );\n});\n\n/**\n * Must be used in conjunction with ChipItem & ChipGroup and\n * cannot be used outside of ChipGroup, else will throw error\n */\nexport function ChipList<T extends object>({\n classNames: classNamesProp,\n ...rest\n}: ChipListProps<T>) {\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(chipClassNames, theme.Chip, classNamesProp),\n [theme.Chip, classNamesProp],\n );\n\n return <TagList<T> {...rest} className={classNames?.list} />;\n}\n\nexport const ChipGroupContext =\n createContext<ContextValue<ChipGroupProps, HTMLDivElement>>(null);\n\n/**\n * Color & Size props are passed down to ChipItem but can be overridden\n * on each component if desired\n */\nexport const ChipGroup = forwardRef(function ChipGroup(\n props: ChipGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n ChipGroupContext,\n );\n const finalProps = useDefaultProps(contextProps, 'ChipGroup');\n\n const {\n children,\n classNames: classNamesProp,\n color,\n size,\n ...rest\n } = finalProps;\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(chipClassNames, theme.Chip, classNamesProp),\n [theme.Chip, classNamesProp],\n );\n\n const values = useMemo<\n [[typeof ChipContext, ContextValue<ChipItemProps, HTMLDivElement>]]\n >(\n () => [[ChipContext, { classNames, color, size }]],\n [classNames, color, size],\n );\n\n return (\n <TagGroup {...rest} ref={contextRef} className={classNames?.group}>\n <Provider values={values}>{children}</Provider>\n </TagGroup>\n );\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collection, Node } from '@react-types/shared';
|
|
2
1
|
import { Context } from 'react';
|
|
2
|
+
import { Collection, Node } from '@react-types/shared';
|
|
3
3
|
import { CollectionRenderer } from 'react-aria-components';
|
|
4
4
|
import { MergeProviderProps } from '../merge-provider/types.js';
|
|
5
5
|
import '../../types/react-aria.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/collection/index.tsx"],"names":[],"mappings":";;;;;;AAyBO,SAAS,wBAAA,CAGd,SAAqB,MAAA,EAA+B;AACpD,EAAA,OAAO;AAAA,IACL,gBAAgB,CAAC,EAAE,qBAAoB,qBACrC,GAAA,CAAC,iBAAc,MAAA,EACZ,QAAA,EAAA,mBAAA;AAAA,MACC,UAAA,CAAW,OAAO,CAAA,EAAG,UAAA;AAAA,MACrB,IAAA;AAAA,MACA;AAAA,KACF,EACF,CAAA;AAAA,IAEF,gBAAA,EAAkB,CAAC,EAAE,UAAA,EAAY,QAAQ,mBAAA,EAAoB,qBAC3D,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EACZ,QAAA,EAAA,mBAAA,CAAoB,UAAA,EAAY,MAAA,EAAQ,mBAAmB,CAAA,EAC9D;AAAA,GAEJ;AACF","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 type
|
|
1
|
+
{"version":3,"sources":["../../../src/components/collection/index.tsx"],"names":[],"mappings":";;;;;;AAyBO,SAAS,wBAAA,CAGd,SAAqB,MAAA,EAA+B;AACpD,EAAA,OAAO;AAAA,IACL,gBAAgB,CAAC,EAAE,qBAAoB,qBACrC,GAAA,CAAC,iBAAc,MAAA,EACZ,QAAA,EAAA,mBAAA;AAAA,MACC,UAAA,CAAW,OAAO,CAAA,EAAG,UAAA;AAAA,MACrB,IAAA;AAAA,MACA;AAAA,KACF,EACF,CAAA;AAAA,IAEF,gBAAA,EAAkB,CAAC,EAAE,UAAA,EAAY,QAAQ,mBAAA,EAAoB,qBAC3D,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EACZ,QAAA,EAAA,mBAAA,CAAoB,UAAA,EAAY,MAAA,EAAQ,mBAAmB,CAAA,EAC9D;AAAA,GAEJ;AACF","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 { type Context, useContext } from 'react';\nimport { useCollectionRender } from '../../hooks/use-collection-render';\nimport { MergeProvider } from '../merge-provider';\nimport type { Collection, Node } from '@react-types/shared';\nimport type { CollectionRenderer } from 'react-aria-components';\nimport type { MergeProviderProps } from '../merge-provider/types';\n\n/**\n * Replace the default collection renderer to allow for injection of\n * context props for multiple composed components. Also enables use of\n * Section as wrapper of list items at the top level as a styleable\n * element within the RAC container\n */\nexport function createCollectionRenderer<\n C extends { readonly collection: Collection<Node<unknown>> },\n V extends MergeProviderProps['values'],\n>(context: Context<C>, values: V): CollectionRenderer {\n return {\n CollectionRoot: ({ renderDropIndicator }) => (\n <MergeProvider values={values}>\n {useCollectionRender(\n useContext(context)?.collection,\n null,\n renderDropIndicator,\n )}\n </MergeProvider>\n ),\n CollectionBranch: ({ collection, parent, renderDropIndicator }) => (\n <MergeProvider values={values}>\n {useCollectionRender(collection, parent, renderDropIndicator)}\n </MergeProvider>\n ),\n };\n}\n"]}
|
|
@@ -30,14 +30,18 @@ var defaultMapping = {
|
|
|
30
30
|
};
|
|
31
31
|
var ComboBoxContext = createContext(null);
|
|
32
32
|
var ComboBox = forwardRef(function ComboBox2(props, ref) {
|
|
33
|
-
[
|
|
34
|
-
|
|
33
|
+
const [contextProps, contextRef] = useContextProps(
|
|
34
|
+
props,
|
|
35
|
+
ref,
|
|
36
|
+
ComboBoxContext
|
|
37
|
+
);
|
|
38
|
+
const finalProps = useDefaultProps(contextProps, "ComboBox");
|
|
35
39
|
const {
|
|
36
40
|
children: childrenProp,
|
|
37
41
|
classNames: classNamesProp,
|
|
38
42
|
mapping: mappingProp,
|
|
39
43
|
size = "lg"
|
|
40
|
-
} =
|
|
44
|
+
} = finalProps;
|
|
41
45
|
const theme = useTheme();
|
|
42
46
|
const mapping = useMemo(
|
|
43
47
|
() => ({
|
|
@@ -105,8 +109,8 @@ var ComboBox = forwardRef(function ComboBox2(props, ref) {
|
|
|
105
109
|
return /* @__PURE__ */ jsx(
|
|
106
110
|
ComboBox$1,
|
|
107
111
|
{
|
|
108
|
-
...
|
|
109
|
-
ref,
|
|
112
|
+
...finalProps,
|
|
113
|
+
ref: contextRef,
|
|
110
114
|
className: classNames?.container,
|
|
111
115
|
style,
|
|
112
116
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/combo-box/index.tsx"],"names":["ComboBox","RACComboBox"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAkC;AAAA,EACtC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAClC,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAAO;AAEtC,CAAA;AAEO,IAAM,eAAA,GACX,cAAmE,IAAI;AAElE,IAAM,QAAA,GAAW,UAAA,CAAW,SAASA,SAAAA,CAC1C,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/combo-box/index.tsx"],"names":["ComboBox","RACComboBox"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAkC;AAAA,EACtC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAA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AAAA,KAClB,GACH,CAAA,EACF,CAAA;AAAA,IAEF,CAAC,UAAA,EAAY,QAAA,EAAU,MAAA,EAAQ,YAAY;AAAA,GAC7C;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,GAAA,EAAK,UAAA;AAAA,MACL,WAAW,UAAA,EAAY,SAAA;AAAA,MACvB,KAAA;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 createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ComboBoxRenderProps,\n type ContextValue,\n type FieldErrorProps,\n type LabelProps,\n Provider,\n ComboBox as RACComboBox,\n type GroupProps as RACGroupProps,\n type TextProps,\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 { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaFieldErrorContext,\n AriaGroupContext,\n AriaLabelContext,\n AriaTextContext,\n} from '../aria';\nimport { ButtonContext } from '../button';\nimport { InputContext } from '../input';\nimport { OptionsContext } from '../options';\nimport { comboBoxClassNames, comboBoxStateVars } from './combo-box.css';\nimport type { ButtonProps } from '../button/types';\nimport type { InputProps } from '../input/types';\nimport type { OptionsProps } from '../options/types';\nimport type { ComboBoxMapping, ComboBoxProps } from './types';\n\nconst defaultMapping: ComboBoxMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n error: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n toggle: {\n sm: { size: 'sm', variant: 'icon' },\n lg: { size: 'md', variant: 'icon' },\n },\n};\n\nexport const ComboBoxContext =\n createContext<ContextValue<ComboBoxProps<object>, HTMLDivElement>>(null);\n\nexport const ComboBox = forwardRef(function ComboBox<T extends object>(\n props: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n ComboBoxContext,\n );\n const finalProps = useDefaultProps(contextProps, 'ComboBox');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = 'lg',\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(comboBoxClassNames, theme.ComboBox, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [theme.ComboBox, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof AriaGroupContext, ContextValue<RACGroupProps, HTMLDivElement>],\n [typeof InputContext, ContextValue<InputProps, HTMLInputElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [\n typeof AriaFieldErrorContext,\n ContextValue<FieldErrorProps, HTMLElement>,\n ],\n [typeof OptionsContext, ContextValue<OptionsProps, HTMLElement>],\n ]\n >(\n () => [\n [\n AriaLabelContext,\n {\n className: classNames?.label,\n },\n ],\n [\n AriaGroupContext,\n {\n className: classNames?.group,\n },\n ],\n [InputContext, { classNames: classNames?.input, size }],\n [\n ButtonContext,\n {\n ...mapping.toggle[size],\n classNames: classNames?.toggle,\n },\n ],\n [\n AriaTextContext,\n {\n slots: {\n description: { className: classNames?.description },\n },\n },\n ],\n [AriaFieldErrorContext, { className: classNames?.error }],\n [OptionsContext, { classNames: classNames?.options, size }],\n ],\n [classNames, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: ComboBoxRenderProps) =>\n inlineVars(comboBoxStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: ComboBoxRenderProps) => (\n <div className={classNames?.comboBox}>\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n </div>\n ),\n [classNames?.comboBox, values, childrenProp],\n );\n\n return (\n <RACComboBox\n {...finalProps}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACComboBox>\n );\n});\n"]}
|
|
@@ -30,9 +30,13 @@ var defaultMapping = {
|
|
|
30
30
|
var defaultSize = "lg";
|
|
31
31
|
var DateFieldContext = createContext(null);
|
|
32
32
|
var DateField = forwardRef(function DateField2(props, ref) {
|
|
33
|
-
[
|
|
34
|
-
props = useDefaultProps(
|
|
33
|
+
const [contextProps, contextRef] = useContextProps(
|
|
35
34
|
props,
|
|
35
|
+
ref,
|
|
36
|
+
DateFieldContext
|
|
37
|
+
);
|
|
38
|
+
const finalProps = useDefaultProps(
|
|
39
|
+
contextProps,
|
|
36
40
|
"DateField"
|
|
37
41
|
);
|
|
38
42
|
const {
|
|
@@ -42,7 +46,7 @@ var DateField = forwardRef(function DateField2(props, ref) {
|
|
|
42
46
|
size = defaultSize,
|
|
43
47
|
value,
|
|
44
48
|
...rest
|
|
45
|
-
} =
|
|
49
|
+
} = finalProps;
|
|
46
50
|
const theme = useTheme();
|
|
47
51
|
const mapping = useMemo(
|
|
48
52
|
() => ({
|
|
@@ -95,7 +99,7 @@ var DateField = forwardRef(function DateField2(props, ref) {
|
|
|
95
99
|
DateField$1,
|
|
96
100
|
{
|
|
97
101
|
...rest,
|
|
98
|
-
ref,
|
|
102
|
+
ref: contextRef,
|
|
99
103
|
className: classNames?.container,
|
|
100
104
|
style,
|
|
101
105
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["DateField","RACDateField"],"mappings":";;;;;;;;;;;;;;;AAmDA,IAAM,cAAA,GAAmC;AAAA,EACvC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK;AAErB,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,gBAAA,GACX,cAAuE,IAAI;AAEtE,IAAM,SAAA,GAAY,UAAA,CAAW,SAASA,UAAAA,CAC3C,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["DateField","RACDateField"],"mappings":";;;;;;;;;;;;;;;AAmDA,IAAM,cAAA,GAAmC;AAAA,EACvC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK;AAErB,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb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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 createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n type DateValue,\n type FieldErrorProps,\n LabelContext,\n type LabelProps,\n Provider,\n DateField as RACDateField,\n type TextProps,\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 { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaFieldErrorContext,\n type AriaLabelContext,\n AriaTextContext,\n} from '../aria';\nimport { DateInputContext } from '../date-input';\nimport { IconContext } from '../icon';\nimport { dateFieldClassNames, dateFieldStateVars } from './date-field.css';\nimport type { DateInputProps } from '../date-input/types';\nimport type { IconProps } from '../icon/types';\nimport type {\n DateFieldMapping,\n DateFieldProps,\n DateFieldRenderProps,\n} from './types';\n\nconst defaultMapping: DateFieldMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n error: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateFieldContext =\n createContext<ContextValue<DateFieldProps<DateValue>, HTMLDivElement>>(null);\n\nexport const DateField = forwardRef(function DateField<T extends DateValue>(\n props: DateFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateFieldContext,\n );\n\n const finalProps = useDefaultProps(\n contextProps as DateFieldProps<DateValue>,\n 'DateField',\n ) as DateFieldProps<T>;\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n value,\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(dateFieldClassNames, theme.DateField, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [theme.DateField, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateFieldRenderProps) =>\n inlineVars(dateFieldStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const values = useMemo<\n [\n [typeof DateInputContext, ContextValue<DateInputProps, HTMLDivElement>],\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [\n typeof AriaFieldErrorContext,\n ContextValue<FieldErrorProps, HTMLElement>,\n ],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n ]\n >(\n () => [\n [DateInputContext, { classNames: classNames?.input, size }],\n [LabelContext, { className: classNames?.label }],\n [\n AriaTextContext,\n {\n slots: {\n description: { className: classNames?.description },\n },\n },\n ],\n [AriaFieldErrorContext, { className: classNames?.error }],\n [IconContext, { ...mapping.icon[size], classNames: classNames?.icon }],\n ],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: DateFieldRenderProps) => {\n return (\n <Provider values={values}>\n <div className={classNames?.dateField}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n );\n },\n [childrenProp, values, classNames?.dateField],\n );\n\n return (\n <RACDateField\n {...rest}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n value={value}\n >\n {children}\n </RACDateField>\n );\n});\n"]}
|
|
@@ -24,8 +24,12 @@ var defaultMapping = {
|
|
|
24
24
|
var defaultSize = "lg";
|
|
25
25
|
var DateInputContext = createContext(null);
|
|
26
26
|
var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
27
|
-
[
|
|
28
|
-
|
|
27
|
+
const [contextProps, contextRef] = useContextProps(
|
|
28
|
+
props,
|
|
29
|
+
ref,
|
|
30
|
+
DateInputContext
|
|
31
|
+
);
|
|
32
|
+
const finalProps = useDefaultProps(contextProps, "DateInput");
|
|
29
33
|
const {
|
|
30
34
|
children: childrenProp,
|
|
31
35
|
classNames: classNamesProp,
|
|
@@ -33,7 +37,7 @@ var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
33
37
|
size = defaultSize,
|
|
34
38
|
provider,
|
|
35
39
|
...rest
|
|
36
|
-
} =
|
|
40
|
+
} = finalProps;
|
|
37
41
|
const dateFieldState = useContext(DateFieldStateContext);
|
|
38
42
|
const timeFieldState = useContext(TimeFieldStateContext);
|
|
39
43
|
const state = dateFieldState ?? timeFieldState ?? null;
|
|
@@ -68,7 +72,7 @@ var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
68
72
|
/* @__PURE__ */ jsx(
|
|
69
73
|
Group,
|
|
70
74
|
{
|
|
71
|
-
ref,
|
|
75
|
+
ref: contextRef,
|
|
72
76
|
...rest,
|
|
73
77
|
className: classNames?.input?.container,
|
|
74
78
|
style,
|
|
@@ -100,12 +104,16 @@ var DateSegments = forwardRef(
|
|
|
100
104
|
var DateSegmentContext = createContext(null);
|
|
101
105
|
var DateSegment = forwardRef(
|
|
102
106
|
function DateSegment2(props, ref) {
|
|
103
|
-
[
|
|
107
|
+
const [contextProps, contextRef] = useContextProps(
|
|
108
|
+
props,
|
|
109
|
+
ref,
|
|
110
|
+
DateSegmentContext
|
|
111
|
+
);
|
|
104
112
|
const {
|
|
105
113
|
classNames: classNamesProp,
|
|
106
114
|
children: childrenProp,
|
|
107
115
|
...rest
|
|
108
|
-
} =
|
|
116
|
+
} = contextProps;
|
|
109
117
|
const classNames = useMemo(
|
|
110
118
|
() => mergeClassNames(dateInputClassNames, classNamesProp),
|
|
111
119
|
[classNamesProp]
|
|
@@ -132,7 +140,7 @@ var DateSegment = forwardRef(
|
|
|
132
140
|
return /* @__PURE__ */ jsx(
|
|
133
141
|
DateSegment$1,
|
|
134
142
|
{
|
|
135
|
-
ref,
|
|
143
|
+
ref: contextRef,
|
|
136
144
|
...rest,
|
|
137
145
|
style,
|
|
138
146
|
className: classNames?.segment?.container,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-input/index.tsx"],"names":["DateInput","Fragment","DateSegment","RACDateSegment"],"mappings":";;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAiB;AAAA,EACrB,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK,GACnB;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,gBAAA,GACX,cAA4D,IAAI;AAE3D,IAAM,SAAA,GAAY,UAAA,CAAW,SAASA,UAAAA,CAC3C,OACA,GAAA,EACA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,gBAAgB,CAAA;AAC3D,EAAA,KAAA,GAAQ,eAAA,CAAgB,OAAO,WAAW,CAAA;AAE1C,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,WAAA;AAAA,IACP,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,cAAA,GAAiB,WAAW,qBAAqB,CAAA;AACvD,EA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BAAS,IAAA,EAAK,CAAA;AAAA,MAEjE,CAAA;AAAA,MACA,CAAC,cAAc,UAAU;AAAA,KAC3B;AAEA,IAAA,uBACE,GAAA;AAAA,MAACC,aAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QACJ,KAAA;AAAA,QACA,SAAA,EAAW,YAAY,OAAA,EAAS,SAAA;AAAA,QAE/B;AAAA;AAAA,KACH;AAAA,EAEJ;AACF","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 FC,\n type ForwardedRef,\n Fragment,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n DateFieldStateContext,\n Group,\n DateSegment as RACDateSegment,\n type SlotProps,\n TimeFieldStateContext,\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 { inputs } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { Input } from '../input';\nimport {\n dateInputClassNames,\n dateInputStateVars,\n dateSegmentStateVars,\n} from './date-input.css';\nimport type {\n DateInputProps,\n DateInputRenderProps,\n DateSegmentProps,\n DateSegmentRenderProps,\n DateSegmentsProps,\n} from './types';\n\nconst defaultMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n input: {\n sm: inputs.sm,\n lg: inputs.lg,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateInputContext =\n createContext<ContextValue<DateInputProps, HTMLDivElement>>(null);\n\nexport const DateInput = forwardRef(function DateInput(\n props: DateInputProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DateInputContext);\n props = useDefaultProps(props, 'DateInput');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n provider,\n ...rest\n } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Input component must be used as a child of either DateField or TimeField.',\n );\n }\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(dateInputClassNames, theme.DateInput, classNamesProp, {\n input: { input: mapping.input[size] },\n }),\n [theme.DateInput, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateInputRenderProps) =>\n inlineVars(dateInputStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: DateInputRenderProps) => (\n <div className={classNames?.input?.input}>\n {childrenProp &&\n (provider ? (\n callRenderProps(childrenProp, { ...renderProps, ...state })\n ) : (\n <>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {childrenProp(segment)}\n </Fragment>\n ))}\n </>\n ))}\n </div>\n ),\n [childrenProp, state, provider, classNames?.input],\n );\n\n return (\n <>\n <Group\n ref={ref}\n {...rest}\n className={classNames?.input?.container}\n style={style}\n >\n {children}\n </Group>\n <Input />\n </>\n );\n});\n\nexport const DateSegments = forwardRef(\n (props: DateSegmentsProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { children, classNames: classNamesProp } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Segments component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp),\n [theme.DateInput, classNamesProp],\n );\n\n return (\n <div className={classNames?.input?.segments} ref={ref}>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {children(segment)}\n </Fragment>\n ))}\n </div>\n );\n },\n);\n\nexport const DateSegmentContext =\n createContext<ContextValue<SlotProps, HTMLDivElement>>(null);\n\nexport const DateSegment: FC<DateSegmentProps> = forwardRef(\n function DateSegment(\n props: DateSegmentProps,\n ref: ForwardedRef<HTMLDivElement>,\n ) {\n [props, ref] = useContextProps(props, ref, DateSegmentContext);\n\n const {\n classNames: classNamesProp,\n children: childrenProp,\n ...rest\n } = props;\n\n const classNames = useMemo(\n () => mergeClassNames(dateInputClassNames, classNamesProp),\n [classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: DateSegmentRenderProps) =>\n inlineVars(dateSegmentStateVars, {\n ...renderProps,\n }),\n [],\n );\n\n const children = useCallback(\n (renderProps: DateSegmentRenderProps) => {\n const { isPlaceholder, placeholder, text, value } = renderProps;\n if (typeof childrenProp === 'function') {\n return childrenProp({ ...renderProps, defaultChildren: null });\n }\n\n if (isPlaceholder) {\n return placeholder;\n }\n\n return (\n <div className={classNames?.segment?.segment}>{value ?? text}</div>\n );\n },\n [childrenProp, classNames],\n );\n\n return (\n <RACDateSegment\n ref={ref}\n {...rest}\n style={style}\n className={classNames?.segment?.container}\n >\n {children}\n </RACDateSegment>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-input/index.tsx"],"names":["DateInput","Fragment","DateSegment","RACDateSegment"],"mappings":";;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAiB;AAAA,EACrB,IAAA,EAAM;AAAA,IACJ,EAA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;AAEA,IAAA,MAAM;AAAA,MACJ,UAAA,EAAY,cAAA;AAAA,MACZ,QAAA,EAAU,YAAA;AAAA,MACV,GAAG;AAAA,KACL,GAAI,YAAA;AAEJ,IAAA,MAAM,UAAA,GAAa,OAAA;AAAA,MACjB,MAAM,eAAA,CAAgB,mBAAA,EAAqB,cAAc,CAAA;AAAA,MACzD,CAAC,cAAc;AAAA,KACjB;AAEA,IAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,MACZ,CAAC,WAAA,KACC,UAAA,CAAW,oBAAA,EAAsB;AAAA,QAC/B,GAAG;AAAA,OACJ,CAAA;AAAA,MACH;AAAC,KACH;AAEA,IAAA,MAAM,QAAA,GAAW,WAAA;AAAA,MACf,CAAC,WAAA,KAAwC;AACvC,QAAA,MAAM,EAAE,aAAA,EAAe,WAAA,EAAa,IAAA,EAAM,OAAM,GAAI,WAAA;AACpD,QAAA,IAAI,OAAO,iBAAiB,UAAA,EAAY;AACtC,UAAA,OAAO,aAAa,EAAE,GAAG,WAAA,EAAa,eAAA,EAAiB,MAAM,CAAA;AAAA,QAC/D;AAEA,QAAA,IAAI,aAAA,EAAe;AACjB,UAAA,OAAO,WAAA;AAAA,QACT;AAEA,QAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,OAAA,EAAS,OAAA,EAAU,mBAAS,IAAA,EAAK,CAAA;AAAA,MAEjE,CAAA;AAAA,MACA,CAAC,cAAc,UAAU;AAAA,KAC3B;AAEA,IAAA,uBACE,GAAA;AAAA,MAACC,aAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,UAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QACJ,KAAA;AAAA,QACA,SAAA,EAAW,YAAY,OAAA,EAAS,SAAA;AAAA,QAE/B;AAAA;AAAA,KACH;AAAA,EAEJ;AACF","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 createContext,\n type FC,\n type ForwardedRef,\n Fragment,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n DateFieldStateContext,\n Group,\n DateSegment as RACDateSegment,\n type SlotProps,\n TimeFieldStateContext,\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 { inputs } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { Input } from '../input';\nimport {\n dateInputClassNames,\n dateInputStateVars,\n dateSegmentStateVars,\n} from './date-input.css';\nimport type {\n DateInputProps,\n DateInputRenderProps,\n DateSegmentProps,\n DateSegmentRenderProps,\n DateSegmentsProps,\n} from './types';\n\nconst defaultMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n input: {\n sm: inputs.sm,\n lg: inputs.lg,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateInputContext =\n createContext<ContextValue<DateInputProps, HTMLDivElement>>(null);\n\nexport const DateInput = forwardRef(function DateInput(\n props: DateInputProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateInputContext,\n );\n const finalProps = useDefaultProps(contextProps, 'DateInput');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n provider,\n ...rest\n } = finalProps;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Input component must be used as a child of either DateField or TimeField.',\n );\n }\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(dateInputClassNames, theme.DateInput, classNamesProp, {\n input: { input: mapping.input[size] },\n }),\n [theme.DateInput, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateInputRenderProps) =>\n inlineVars(dateInputStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: DateInputRenderProps) => (\n <div className={classNames?.input?.input}>\n {childrenProp &&\n (provider ? (\n callRenderProps(childrenProp, { ...renderProps, ...state })\n ) : (\n <>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {childrenProp(segment)}\n </Fragment>\n ))}\n </>\n ))}\n </div>\n ),\n [childrenProp, state, provider, classNames?.input],\n );\n\n return (\n <>\n <Group\n ref={contextRef}\n {...rest}\n className={classNames?.input?.container}\n style={style}\n >\n {children}\n </Group>\n <Input />\n </>\n );\n});\n\nexport const DateSegments = forwardRef(\n (props: DateSegmentsProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { children, classNames: classNamesProp } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Segments component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp),\n [theme.DateInput, classNamesProp],\n );\n\n return (\n <div className={classNames?.input?.segments} ref={ref}>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {children(segment)}\n </Fragment>\n ))}\n </div>\n );\n },\n);\n\nexport const DateSegmentContext =\n createContext<ContextValue<SlotProps, HTMLDivElement>>(null);\n\nexport const DateSegment: FC<DateSegmentProps> = forwardRef(\n function DateSegment(\n props: DateSegmentProps,\n ref: ForwardedRef<HTMLDivElement>,\n ) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateSegmentContext,\n );\n\n const {\n classNames: classNamesProp,\n children: childrenProp,\n ...rest\n } = contextProps;\n\n const classNames = useMemo(\n () => mergeClassNames(dateInputClassNames, classNamesProp),\n [classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: DateSegmentRenderProps) =>\n inlineVars(dateSegmentStateVars, {\n ...renderProps,\n }),\n [],\n );\n\n const children = useCallback(\n (renderProps: DateSegmentRenderProps) => {\n const { isPlaceholder, placeholder, text, value } = renderProps;\n if (typeof childrenProp === 'function') {\n return childrenProp({ ...renderProps, defaultChildren: null });\n }\n\n if (isPlaceholder) {\n return placeholder;\n }\n\n return (\n <div className={classNames?.segment?.segment}>{value ?? text}</div>\n );\n },\n [childrenProp, classNames],\n );\n\n return (\n <RACDateSegment\n ref={contextRef}\n {...rest}\n style={style}\n className={classNames?.segment?.container}\n >\n {children}\n </RACDateSegment>\n );\n },\n);\n"]}
|
|
@@ -44,8 +44,8 @@ var defaultMapping = {
|
|
|
44
44
|
};
|
|
45
45
|
var DialogContext = createContext(null);
|
|
46
46
|
var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
47
|
-
[
|
|
48
|
-
|
|
47
|
+
const [contextProps, contextRef] = useContextProps(props, ref, DialogContext);
|
|
48
|
+
const finalProps = useDefaultProps(contextProps, "Dialog");
|
|
49
49
|
const {
|
|
50
50
|
children: childrenProp,
|
|
51
51
|
classNames: classNamesProp,
|
|
@@ -54,7 +54,7 @@ var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
54
54
|
role,
|
|
55
55
|
size = "lg",
|
|
56
56
|
...rest
|
|
57
|
-
} =
|
|
57
|
+
} = finalProps;
|
|
58
58
|
const theme = useTheme();
|
|
59
59
|
const isSSR = useIsSSR();
|
|
60
60
|
const [portal, setPortal] = useState(isSSR ? null : document.body);
|
|
@@ -171,12 +171,14 @@ var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
171
171
|
setPortal(isSSR ? null : document.body);
|
|
172
172
|
};
|
|
173
173
|
}, [isSSR, parentRef, classNames?.portal]);
|
|
174
|
-
if (!portal)
|
|
174
|
+
if (!portal) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
175
177
|
return /* @__PURE__ */ jsx(
|
|
176
178
|
ModalOverlay,
|
|
177
179
|
{
|
|
178
180
|
...rest,
|
|
179
|
-
ref,
|
|
181
|
+
ref: contextRef,
|
|
180
182
|
className: classNames?.container,
|
|
181
183
|
style,
|
|
182
184
|
UNSTABLE_portalContainer: portal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["Dialog","RACDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,IAAM,WAAA,GAA6B,CAAC,IAAA,EAAM,IAAI,CAAA;AAE9C,IAAM,cAAA,GAAgC;AAAA,EACpC,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA,EAAG;AAAA,IAC7B,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA;AAAG,GAC/B;AAAA,EACA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,aAAA;AAAA,IACT,WAAA,EAAa,YAAA;AAAA,IACb,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAS,WAAA,CAAY,MAAA;AAAA,IACnB,CAAC,KAAK,IAAA,KAAS;AACb,MAAA,GAAA,CAAI,IAAI,CAAA,GAAI,EAAE,IAAA,EAAK;AAEnB,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAC,GACH;AAAA,EACA,OAAO,WAAA,CAAY,MAAA;AAAA,IACjB,CAAC,KAAK,IAAA,KAAS;AACb,MAAA,GAAA,CAAI,IAA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AA,GAAQ,IAAA,GAAO,QAAA,CAAS,cAAc,KAAK,CAAA;AAExD,IAAA,IAAI,QAAQ,IAAA,EAAM;AAChB,MAAA,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,UAAA,EAAY,MAAA,IAAU,EAAE,CAAA;AAE3C,MAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAErB,MAAA,SAAA,CAAU,IAAI,CAAA;AAAA,IAChB;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,EAAM,MAAA,EAAO;AAEb,MAAA,SAAA,CAAU,KAAA,GAAQ,IAAA,GAAO,QAAA,CAAS,IAAI,CAAA;AAAA,IACxC,CAAA;AAAA,EACF,GAAG,CAAC,KAAA,EAAO,SAAA,EAAW,UAAA,EAAY,MAAM,CAAC,CAAA;AAEzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,uBACE,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,WAAW,UAAA,EAAY,SAAA;AAAA,MACvB,KAAA;AAAA,MACA,wBAAA,EAA0B,MAAA;AAAA,MAEzB;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 { useIsSSR } from '@react-aria/ssr';\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Modal,\n ModalOverlay,\n type ModalRenderProps,\n Provider,\n Dialog as RACDialog,\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 { headings } from '../../styles/typography.css';\nimport type { OmitProtectedProps } from '../../types/props';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport type { ButtonProps } from '../button/types';\nimport { ElementContext } from '../element';\nimport type { ElementProps } from '../element/types';\nimport { GroupContext } from '../group';\nimport type { GroupProps } from '../group/types';\nimport { dialogClassNames, dialogStateVars } from './dialog.css';\nimport type { DialogMapping, DialogProps, DialogSizes } from './types';\n\nconst dialogSizes: DialogSizes[] = ['sm', 'lg'];\n\nconst defaultMapping: DialogMapping = {\n heading: {\n sm: { className: headings.v4 },\n lg: { className: headings.v2 },\n },\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n close: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size, variant: 'bare' };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n};\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DialogContext);\n props = useDefaultProps(props, 'Dialog');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n parentRef,\n role,\n size = 'lg',\n ...rest\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n const isGlobal = useMemo(\n () => !isSSR && portal === document.body,\n [isSSR, portal],\n );\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {\n container: isGlobal ? theme.className : undefined,\n }),\n [theme.Dialog, classNamesProp, isGlobal, theme.className],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n ({ state, ...renderProps }: ModalRenderProps) => ({\n ...(isGlobal ? theme.style : {}),\n ...inlineVars(dialogStateVars, {\n hasHeader,\n size,\n ...renderProps,\n isGlobal,\n }),\n }),\n [size, theme.style, isGlobal, hasHeader],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>,\n ContextValue<\n GroupProps<ButtonProps, HTMLButtonElement>,\n HTMLDivElement\n >\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header,\n ref: headerRef,\n values: [\n [\n AriaHeadingContext,\n {\n ...mapping.heading[size],\n slot: 'title',\n },\n ],\n [GroupContext, null],\n ],\n },\n content: { className: classNames?.content },\n footer: {\n as: 'footer',\n className: classNames?.footer,\n values: [\n [AriaHeadingContext, null],\n [\n GroupContext,\n {\n values: {\n slots: {\n [DEFAULT_SLOT]: mapping.primary[size] ?? {},\n close: mapping.close[size] ?? {},\n },\n },\n ...mapping.actions,\n },\n ],\n ],\n },\n },\n },\n ],\n ],\n [\n classNames?.header,\n classNames?.content,\n classNames?.footer,\n headerRef,\n mapping.actions,\n mapping.heading,\n mapping.primary,\n mapping.close,\n size,\n ],\n );\n\n const children = useCallback(\n (renderProps: ModalRenderProps) => (\n <Provider values={values}>\n <Modal className={classNames?.modal}>\n <RACDialog className={classNames?.dialog} role={role}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n isGlobal,\n isOpen: renderProps.state.isOpen,\n })}\n </RACDialog>\n </Modal>\n </Provider>\n ),\n [\n values,\n classNames?.modal,\n classNames?.dialog,\n role,\n childrenProp,\n isGlobal,\n ],\n );\n\n useEffect(() => {\n const node = parentRef?.current;\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n port.classList.add(classNames?.portal ?? '');\n\n node.appendChild(port);\n\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef, classNames?.portal]);\n\n if (!portal) return null;\n\n return (\n <ModalOverlay\n {...rest}\n ref={ref}\n className={classNames?.container}\n style={style}\n UNSTABLE_portalContainer={portal}\n >\n {children}\n </ModalOverlay>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["Dialog","RACDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,IAAM,WAAA,GAA6B,CAAC,IAAA,EAAM,IAAI,CAAA;AAE9C,IAAM,cAAA,GAAgC;AAAA,EACpC,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA,EAAG;AAAA,IAC7B,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA;AAAG,GAC/B;AAAA,EACA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,aAAA;AAAA,IACT,WAAA,EAAa,YAAA;AAAA,IACb,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAS,WAAA,CAAY,MAAA;AAAA,IACnB,CAAC,KAAK,IAAA,KAAS;AACb,MAAA,GAAA,CAAI,IAAI,CAAA,GAAI,EAAE,IAAA,EAAK;AAEnB,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAC,GACH;AAAA,EACA,OAAO,WAAA,CAAY,MAAA;AAAA,IACjB,CAAC,KAAK,IAAA,KAAS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,EAAW,OAAA;AACxB,IAAA,MAAM,IAAA,GAAO,KAAA,GAAQ,IAAA,GAAO,QAAA,CAAS,cAAc,KAAK,CAAA;AAExD,IAAA,IAAI,QAAQ,IAAA,EAAM;AAChB,MAAA,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,UAAA,EAAY,MAAA,IAAU,EAAE,CAAA;AAE3C,MAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAErB,MAAA,SAAA,CAAU,IAAI,CAAA;AAAA,IAChB;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,EAAM,MAAA,EAAO;AAEb,MAAA,SAAA,CAAU,KAAA,GAAQ,IAAA,GAAO,QAAA,CAAS,IAAI,CAAA;AAAA,IACxC,CAAA;AAAA,EACF,GAAG,CAAC,KAAA,EAAO,SAAA,EAAW,UAAA,EAAY,MAAM,CAAC,CAAA;AAEzC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,UAAA;AAAA,MACL,WAAW,UAAA,EAAY,SAAA;AAAA,MACvB,KAAA;AAAA,MACA,wBAAA,EAA0B,MAAA;AAAA,MAEzB;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 { useIsSSR } from '@react-aria/ssr';\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Modal,\n ModalOverlay,\n type ModalRenderProps,\n Provider,\n Dialog as RACDialog,\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 { headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport { ElementContext } from '../element';\nimport { GroupContext } from '../group';\nimport { dialogClassNames, dialogStateVars } from './dialog.css';\nimport type { OmitProtectedProps } from '../../types/props';\nimport type { ButtonProps } from '../button/types';\nimport type { ElementProps } from '../element/types';\nimport type { GroupProps } from '../group/types';\nimport type { DialogMapping, DialogProps, DialogSizes } from './types';\n\nconst dialogSizes: DialogSizes[] = ['sm', 'lg'];\n\nconst defaultMapping: DialogMapping = {\n heading: {\n sm: { className: headings.v4 },\n lg: { className: headings.v2 },\n },\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n close: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size, variant: 'bare' };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n};\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, DialogContext);\n const finalProps = useDefaultProps(contextProps, 'Dialog');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n parentRef,\n role,\n size = 'lg',\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n const isGlobal = useMemo(\n () => !isSSR && portal === document.body,\n [isSSR, portal],\n );\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {\n container: isGlobal ? theme.className : undefined,\n }),\n [theme.Dialog, classNamesProp, isGlobal, theme.className],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n ({ state, ...renderProps }: ModalRenderProps) => ({\n ...(isGlobal ? theme.style : {}),\n ...inlineVars(dialogStateVars, {\n hasHeader,\n size,\n ...renderProps,\n isGlobal,\n }),\n }),\n [size, theme.style, isGlobal, hasHeader],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>,\n ContextValue<\n GroupProps<ButtonProps, HTMLButtonElement>,\n HTMLDivElement\n >\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header,\n ref: headerRef,\n values: [\n [\n AriaHeadingContext,\n {\n ...mapping.heading[size],\n slot: 'title',\n },\n ],\n [GroupContext, null],\n ],\n },\n content: { className: classNames?.content },\n footer: {\n as: 'footer',\n className: classNames?.footer,\n values: [\n [AriaHeadingContext, null],\n [\n GroupContext,\n {\n values: {\n slots: {\n [DEFAULT_SLOT]: mapping.primary[size] ?? {},\n close: mapping.close[size] ?? {},\n },\n },\n ...mapping.actions,\n },\n ],\n ],\n },\n },\n },\n ],\n ],\n [\n classNames?.header,\n classNames?.content,\n classNames?.footer,\n headerRef,\n mapping.actions,\n mapping.heading,\n mapping.primary,\n mapping.close,\n size,\n ],\n );\n\n const children = useCallback(\n (renderProps: ModalRenderProps) => (\n <Provider values={values}>\n <Modal className={classNames?.modal}>\n <RACDialog className={classNames?.dialog} role={role}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n isGlobal,\n isOpen: renderProps.state.isOpen,\n })}\n </RACDialog>\n </Modal>\n </Provider>\n ),\n [\n values,\n classNames?.modal,\n classNames?.dialog,\n role,\n childrenProp,\n isGlobal,\n ],\n );\n\n useEffect(() => {\n const node = parentRef?.current;\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n port.classList.add(classNames?.portal ?? '');\n\n node.appendChild(port);\n\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef, classNames?.portal]);\n\n if (!portal) {\n return null;\n }\n\n return (\n <ModalOverlay\n {...rest}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n UNSTABLE_portalContainer={portal}\n >\n {children}\n </ModalOverlay>\n );\n});\n"]}
|