@accelint/design-system 1.1.7 → 1.1.9
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.d.ts +4 -4
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js +7 -11
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js +2 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/combo-box/index.js +2 -6
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.js +2 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-input/index.js +4 -4
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.js +4 -4
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/element/index.js +3 -7
- package/dist/components/element/index.js.map +1 -1
- package/dist/components/element/types.d.ts +4 -2
- package/dist/components/group/index.js +4 -4
- package/dist/components/group/index.js.map +1 -1
- package/dist/components/icon/index.js +2 -2
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/input/index.js +10 -10
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -9
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/number-field/index.js +2 -2
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/options/index.js +11 -17
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js +6 -10
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/popover/index.js +2 -6
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio/index.js +4 -4
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.js +2 -2
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +10 -10
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.js +10 -18
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs/tabs.css.d.ts +2 -0
- package/dist/components/tabs/tabs.css.js +2 -2
- package/dist/components/tabs/tabs.css.js.map +1 -1
- package/dist/components/text-field/index.js +2 -2
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/textarea/index.js +8 -8
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/time-field/index.js +2 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tooltip/index.js +5 -9
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.js +2 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/index.css +30 -30
- package/dist/ladle/actions.js.map +1 -1
- package/dist/styles/layers.css.d.ts +3 -3
- package/dist/test/setup.js +4 -4
- package/dist/test/setup.js.map +1 -1
- package/package.json +43 -43
|
@@ -35,12 +35,8 @@ var defaultMapping = {
|
|
|
35
35
|
var defaultSize = "lg";
|
|
36
36
|
var OptionsContext = createContext(null);
|
|
37
37
|
var Options = forwardRef(function Options2(props, ref) {
|
|
38
|
-
const [
|
|
39
|
-
|
|
40
|
-
ref,
|
|
41
|
-
OptionsContext
|
|
42
|
-
);
|
|
43
|
-
const finalProps = useDefaultProps(resolvedProps, "Options");
|
|
38
|
+
const [contextProps, finalRef] = useContextProps(props, ref, OptionsContext);
|
|
39
|
+
const finalProps = useDefaultProps(contextProps, "Options");
|
|
44
40
|
const {
|
|
45
41
|
children: childrenProp,
|
|
46
42
|
classNames: classNamesProp,
|
|
@@ -83,16 +79,15 @@ var Options = forwardRef(function Options2(props, ref) {
|
|
|
83
79
|
const children = useCallback(
|
|
84
80
|
(renderProps) => /* @__PURE__ */ jsx(Provider, { values, children: /* @__PURE__ */ jsx("div", { className: classNames?.options?.options, children: callRenderProps(childrenProp, {
|
|
85
81
|
...renderProps,
|
|
86
|
-
size,
|
|
87
82
|
defaultChildren: null
|
|
88
83
|
}) }) }),
|
|
89
|
-
[childrenProp, classNames?.options?.options,
|
|
84
|
+
[childrenProp, classNames?.options?.options, values]
|
|
90
85
|
);
|
|
91
86
|
return /* @__PURE__ */ jsx(
|
|
92
87
|
Popover,
|
|
93
88
|
{
|
|
94
89
|
...rest,
|
|
95
|
-
ref:
|
|
90
|
+
ref: finalRef,
|
|
96
91
|
className: classNames?.options?.container,
|
|
97
92
|
style,
|
|
98
93
|
children
|
|
@@ -101,12 +96,12 @@ var Options = forwardRef(function Options2(props, ref) {
|
|
|
101
96
|
});
|
|
102
97
|
var OptionsListContext = createContext(null);
|
|
103
98
|
var OptionsList = forwardRef(function OptionList(props, ref) {
|
|
104
|
-
const [
|
|
99
|
+
const [contextProps, finalRef] = useContextProps(
|
|
105
100
|
props,
|
|
106
101
|
ref,
|
|
107
102
|
OptionsListContext
|
|
108
103
|
);
|
|
109
|
-
const finalProps = useDefaultProps(
|
|
104
|
+
const finalProps = useDefaultProps(contextProps, "OptionsList");
|
|
110
105
|
const {
|
|
111
106
|
children: childrenProp,
|
|
112
107
|
classNames: classNamesProp,
|
|
@@ -160,7 +155,7 @@ var OptionsList = forwardRef(function OptionList(props, ref) {
|
|
|
160
155
|
ListBox,
|
|
161
156
|
{
|
|
162
157
|
...rest,
|
|
163
|
-
ref:
|
|
158
|
+
ref: finalRef,
|
|
164
159
|
className: classNames?.list?.container,
|
|
165
160
|
items,
|
|
166
161
|
selectionMode,
|
|
@@ -173,12 +168,12 @@ var OptionsList = forwardRef(function OptionList(props, ref) {
|
|
|
173
168
|
});
|
|
174
169
|
var OptionsItemContext = createContext(null);
|
|
175
170
|
var OptionsItem = forwardRef(function OptionItem(props, ref) {
|
|
176
|
-
const [
|
|
171
|
+
const [contextProps, finalRef] = useContextProps(
|
|
177
172
|
props,
|
|
178
173
|
ref,
|
|
179
174
|
OptionsItemContext
|
|
180
175
|
);
|
|
181
|
-
const finalProps = useDefaultProps(
|
|
176
|
+
const finalProps = useDefaultProps(contextProps, "OptionsItem");
|
|
182
177
|
const {
|
|
183
178
|
id,
|
|
184
179
|
children: childrenProp,
|
|
@@ -244,19 +239,18 @@ var OptionsItem = forwardRef(function OptionItem(props, ref) {
|
|
|
244
239
|
(renderProps) => {
|
|
245
240
|
const content = callRenderProps(childrenProp, {
|
|
246
241
|
...renderProps,
|
|
247
|
-
size,
|
|
248
242
|
defaultChildren: null
|
|
249
243
|
});
|
|
250
244
|
return /* @__PURE__ */ jsx(Provider, { values, children: /* @__PURE__ */ jsx("div", { className: classNames?.item?.item, children: typeof content === "string" ? /* @__PURE__ */ jsx(AriaText, { slot: "label", children: content }) : content }) });
|
|
251
245
|
},
|
|
252
|
-
[childrenProp, classNames?.item?.item,
|
|
246
|
+
[childrenProp, classNames?.item?.item, values]
|
|
253
247
|
);
|
|
254
248
|
return /* @__PURE__ */ jsx(
|
|
255
249
|
ListBoxItem,
|
|
256
250
|
{
|
|
257
251
|
...rest,
|
|
258
252
|
id: id ?? textValue,
|
|
259
|
-
ref:
|
|
253
|
+
ref: finalRef,
|
|
260
254
|
className: classNames?.item?.container,
|
|
261
255
|
style,
|
|
262
256
|
textValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["Options"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,cAAA,GAAiC;AAAA,EACrC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAI,QAAA,CAAS,EAAA;AAAA,IACb,IAAI,QAAA,CAAS;AAAA,GACf;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,CAAO,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EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA,EAAK,WAAA;AAAA,MACL,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n ListStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaListBoxSection,\n AriaListBoxSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport {\n optionsClassNames,\n optionsItemStateVars,\n optionsStateVars,\n} from './options.css';\nimport type { IconProps } from '../icon/types';\nimport type {\n OptionsItemProps,\n OptionsListProps,\n OptionsMapping,\n OptionsProps,\n} from './types';\n\nconst defaultMapping: OptionsMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const OptionsContext =\n createContext<ContextValue<OptionsProps, HTMLElement>>(null);\n\nexport const Options = forwardRef(function Options(\n props: OptionsProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'Options');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n options: {\n container: theme.className, // required to consume global theme within Popover\n },\n }),\n [theme.className, theme.Options, classNamesProp],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n ({ ...renderProps }: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(optionsStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof OptionsListContext,\n ContextValue<OptionsListProps<object>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[OptionsListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.options?.options}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.options?.options, size, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={resolvedRef}\n className={classNames?.options?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const OptionsListContext =\n createContext<ContextValue<OptionsListProps<object>, HTMLDivElement>>(null);\n\ntype OptionsListContexts = [\n [\n typeof OptionsItemContext,\n ContextValue<OptionsItemProps<object>, HTMLDivElement>,\n ],\n [\n typeof AriaListBoxSectionContext,\n ContextValue<SectionProps<object>, HTMLElement>,\n ],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const OptionsList = forwardRef(function OptionList<T extends object>(\n props: OptionsListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsListContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'OptionsList');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const values = useMemo<OptionsListContexts>(\n () => [\n [OptionsItemContext, { classNames, size, mapping }],\n [AriaListBoxSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, size, mapping],\n );\n\n const style = useCallback(\n (renderProps: ListBoxRenderProps) =>\n inlineVars(optionsItemStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaListBoxSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaListBoxSection>\n );\n }, [classNames?.list?.list, childrenProp, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error Type '{ readonly collection: Collection<Node<object>>; }' is missing the following properties from type 'ListState<any>': disabledKeys, selectionManager\n () => createCollectionRenderer(ListStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={resolvedRef}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const OptionsItemContext =\n createContext<ContextValue<OptionsItemProps<object>, HTMLDivElement>>(null);\n\nexport const OptionsItem = forwardRef(function OptionItem<T extends object>(\n props: OptionsItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [resolvedProps, resolvedRef] = useContextProps(\n props,\n ref,\n OptionsItemContext,\n );\n const finalProps = useDefaultProps(resolvedProps, 'OptionsItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, classNamesProp, theme.Options, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(optionsItemStateVars, {\n ...renderProps,\n size,\n hasDescription,\n }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [IconContext, { classNames: classNames?.item?.icon }],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n size,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, size, values],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n id={id ?? textValue}\n ref={resolvedRef as unknown as React.Ref<T>}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["Options"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,cAAA,GAAiC;AAAA,EACrC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;A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AAO,OAAA,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,MAAM,MAAM;AAAA,GAC/C;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,IAAI,EAAA,IAAM,SAAA;AAAA,MACV,GAAA,EAAK,QAAA;AAAA,MACL,SAAA,EAAW,YAAY,IAAA,EAAM,SAAA;AAAA,MAC7B,KAAA;AAAA,MACA,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type CollectionRenderer,\n CollectionRendererContext,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n ListStateContext,\n Popover,\n type PopoverRenderProps,\n Provider,\n type SectionProps,\n type SeparatorProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies, headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaHeaderContext,\n AriaKeyboardContext,\n AriaListBoxSection,\n AriaListBoxSectionContext,\n AriaSeparatorContext,\n AriaText,\n AriaTextContext,\n} from '../aria';\nimport { createCollectionRenderer } from '../collection';\nimport { IconContext } from '../icon';\nimport {\n optionsClassNames,\n optionsItemStateVars,\n optionsStateVars,\n} from './options.css';\nimport type { IconProps } from '../icon/types';\nimport type {\n OptionsItemProps,\n OptionsListProps,\n OptionsMapping,\n OptionsProps,\n} from './types';\n\nconst defaultMapping: OptionsMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n header: {\n sm: headings.v4,\n lg: headings.v5,\n },\n label: {\n sm: bodies.sm,\n lg: bodies.sm,\n },\n shortcut: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const OptionsContext =\n createContext<ContextValue<OptionsProps, HTMLElement>>(null);\n\nexport const Options = forwardRef(function Options(\n props: OptionsProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [contextProps, finalRef] = useContextProps(props, ref, OptionsContext);\n const finalProps = useDefaultProps(contextProps, 'Options');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n options: {\n container: theme.className, // required to consume global theme within Popover\n },\n }),\n [theme.className, theme.Options, classNamesProp],\n );\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const style = useCallback(\n ({ ...renderProps }: PopoverRenderProps) => ({\n ...theme.style, // required to consume global styles within Popover\n ...inlineVars(optionsStateVars, {\n ...renderProps,\n size,\n }),\n }),\n [theme.style, size],\n );\n\n const values = useMemo<\n [\n [\n typeof OptionsListContext,\n ContextValue<OptionsListProps<object>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[OptionsListContext, { classNames, mapping, size }]],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: PopoverRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.options?.options}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.options?.options, values],\n );\n\n return (\n <Popover\n {...rest}\n ref={finalRef}\n className={classNames?.options?.container}\n style={style}\n >\n {children}\n </Popover>\n );\n});\n\nexport const OptionsListContext =\n createContext<ContextValue<OptionsListProps<object>, HTMLDivElement>>(null);\n\ntype OptionsListContexts = [\n [\n typeof OptionsItemContext,\n ContextValue<OptionsItemProps<object>, HTMLDivElement>,\n ],\n [\n typeof AriaListBoxSectionContext,\n ContextValue<SectionProps<object>, HTMLElement>,\n ],\n [\n typeof AriaHeaderContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n [typeof AriaSeparatorContext, ContextValue<SeparatorProps, HTMLElement>],\n];\n\nexport const OptionsList = forwardRef(function OptionList<T extends object>(\n props: OptionsListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(\n props,\n ref,\n OptionsListContext,\n );\n const finalProps = useDefaultProps(contextProps, 'OptionsList');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n items,\n mapping: mappingProp,\n selectionMode = 'single',\n size = defaultSize,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, theme.Options, classNamesProp, {\n list: { header: mapping.header[size] },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const values = useMemo<OptionsListContexts>(\n () => [\n [OptionsItemContext, { classNames, size, mapping }],\n [AriaListBoxSectionContext, { className: classNames?.list?.section }],\n [AriaHeaderContext, { className: classNames?.list?.header }],\n [AriaSeparatorContext, { className: classNames?.list?.separator }],\n ],\n [classNames, size, mapping],\n );\n\n const style = useCallback(\n (renderProps: ListBoxRenderProps) =>\n inlineVars(optionsItemStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <AriaListBoxSection className={classNames?.list?.list}>\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </AriaListBoxSection>\n );\n }, [classNames?.list?.list, childrenProp, items]);\n\n const renderer = useMemo<CollectionRenderer>(\n // @ts-expect-error Type '{ readonly collection: Collection<Node<object>>; }' is missing the following properties from type 'ListState<any>': disabledKeys, selectionManager\n () => createCollectionRenderer(ListStateContext, values),\n [values],\n );\n\n return (\n <CollectionRendererContext.Provider value={renderer}>\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={finalRef}\n className={classNames?.list?.container}\n items={items}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const OptionsItemContext =\n createContext<ContextValue<OptionsItemProps<object>, HTMLDivElement>>(null);\n\nexport const OptionsItem = forwardRef(function OptionItem<T extends object>(\n props: OptionsItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(\n props,\n ref,\n OptionsItemContext,\n );\n const finalProps = useDefaultProps(contextProps, 'OptionsItem');\n\n const {\n id,\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(optionsClassNames, classNamesProp, theme.Options, {\n item: {\n description: mapping.description[size],\n label: mapping.label[size],\n shortcut: mapping.shortcut[size],\n },\n }),\n [theme.Options, classNamesProp, mapping, size],\n );\n\n const [descriptionRef, hasDescription] = useSlot();\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(optionsItemStateVars, {\n ...renderProps,\n size,\n hasDescription,\n }),\n [hasDescription, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [\n typeof AriaKeyboardContext,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLElement>,\n ],\n ]\n >(\n () => [\n [\n AriaTextContext,\n {\n slots: {\n label: { className: classNames?.item?.label },\n description: {\n ref: descriptionRef,\n className: classNames?.item?.description,\n },\n },\n },\n ],\n [IconContext, { classNames: classNames?.item?.icon }],\n [AriaKeyboardContext, { className: classNames?.item?.shortcut }],\n ],\n [\n classNames?.item?.label,\n descriptionRef,\n classNames?.item?.description,\n classNames?.item?.icon,\n classNames?.item?.shortcut,\n ],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => {\n const content = callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n });\n\n return (\n <Provider values={values}>\n <div className={classNames?.item?.item}>\n {typeof content === 'string' ? (\n <AriaText slot='label'>{content}</AriaText>\n ) : (\n content\n )}\n </div>\n </Provider>\n );\n },\n [childrenProp, classNames?.item?.item, values],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n id={id ?? textValue}\n ref={finalRef as React.Ref<HTMLDivElement>}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
|
|
@@ -12,12 +12,8 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
12
12
|
var PickerContext = createContext(null);
|
|
13
13
|
var PickerItemContext = createContext(null);
|
|
14
14
|
var Picker = forwardRef(function Picker2(props, ref) {
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
ref,
|
|
18
|
-
PickerContext
|
|
19
|
-
);
|
|
20
|
-
const finalProps = useDefaultProps(resolvedProps, "Picker");
|
|
15
|
+
const [contextProps, finalRef] = useContextProps(props, ref, PickerContext);
|
|
16
|
+
const finalProps = useDefaultProps(contextProps, "Picker");
|
|
21
17
|
const {
|
|
22
18
|
children: childrenProp,
|
|
23
19
|
classNames: classNamesProp,
|
|
@@ -63,7 +59,7 @@ var Picker = forwardRef(function Picker2(props, ref) {
|
|
|
63
59
|
ListBox,
|
|
64
60
|
{
|
|
65
61
|
...rest,
|
|
66
|
-
ref:
|
|
62
|
+
ref: finalRef,
|
|
67
63
|
className: classNames?.list?.container,
|
|
68
64
|
items,
|
|
69
65
|
layout,
|
|
@@ -77,7 +73,7 @@ var Picker = forwardRef(function Picker2(props, ref) {
|
|
|
77
73
|
) });
|
|
78
74
|
});
|
|
79
75
|
var PickerItem = forwardRef(function PickerItem2(props, ref) {
|
|
80
|
-
const [
|
|
76
|
+
const [contextProps, finalRef] = useContextProps(
|
|
81
77
|
props,
|
|
82
78
|
ref,
|
|
83
79
|
PickerItemContext
|
|
@@ -88,7 +84,7 @@ var PickerItem = forwardRef(function PickerItem2(props, ref) {
|
|
|
88
84
|
classNames: classNamesProp,
|
|
89
85
|
textValue = typeof childrenProp === "string" ? childrenProp : void 0,
|
|
90
86
|
...rest
|
|
91
|
-
} =
|
|
87
|
+
} = contextProps;
|
|
92
88
|
const theme = useTheme();
|
|
93
89
|
const classNames = useMemo(
|
|
94
90
|
() => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),
|
|
@@ -109,7 +105,7 @@ var PickerItem = forwardRef(function PickerItem2(props, ref) {
|
|
|
109
105
|
ListBoxItem,
|
|
110
106
|
{
|
|
111
107
|
...rest,
|
|
112
|
-
ref:
|
|
108
|
+
ref: finalRef,
|
|
113
109
|
id: id ?? textValue,
|
|
114
110
|
className: classNames?.item?.container,
|
|
115
111
|
style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/picker/index.tsx"],"names":["Picker","PickerItem"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/picker/index.tsx"],"names":["Picker","PickerItem"],"mappings":";;;;;;;;;;;AA0CO,IAAM,aAAA,GACX,cAAkE,IAAI;AAEjE,IAAM,iBAAA,GACX,cAAsE,IAAI;AAQrE,IAAM,MAAA,GAAS,UAAA,CAAW,SAASA,OAAAA,CACxC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,QAAQ,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,aAAa,CAAA;AAE1E,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,YAAA,EAAc,QAAQ,CAAA;AAEzD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA,GAAS,OAAA;AAAA,IACT,WAAA,GAAc,YAAA;AAAA,IACd,aAAA,GAAgB,QAAA;AAAA,IAChB,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB,cAAA;AAAA,IACnB,GAAG;AAAA,GACL,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAA,EAAkB,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAA,CAAM,MAAA,EAAQ,cAAc;AAAA,GAC/B;AAEA,EAAA,MAAM,MAAA,GAAS,OAAA,CAOb,MAAM,CAAC,CAAC,iBAAA,EAAmB,EAAE,UAAA,EAAY,CAAC,CAAA,EAAG,CAAC,UAAU,CAAC,CAAA;AAE3D,EA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A,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type JSX,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n Collection,\n type ContextValue,\n ListBox,\n ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxRenderProps,\n ListBoxSection,\n Provider,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n pickerClassNames,\n pickerItemStateVars,\n pickerStateVars,\n} from './picker.css';\nimport type { PickerItemProps, PickerProps } from './types';\n\nexport const PickerContext =\n createContext<ContextValue<PickerProps<unknown>, HTMLDivElement>>(null);\n\nexport const PickerItemContext =\n createContext<ContextValue<PickerItemProps<unknown>, HTMLDivElement>>(null);\n\n/**\n * Generic stylable picker that supports the functionality (sans drag and drop) of\n * React Aria's ListBox: https://react-spectrum.adobe.com/react-aria/ListBox.html\n *\n * NOTE: The picker items does not support sections or separators\n */\nexport const Picker = forwardRef(function Picker<T extends object>(\n props: PickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(props, ref, PickerContext);\n\n const finalProps = useDefaultProps(contextProps, 'Picker');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n columns,\n items,\n layout = 'stack',\n orientation = 'horizontal',\n selectionMode = 'single',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const values = useMemo<\n [\n [\n typeof PickerItemContext,\n ContextValue<PickerItemProps<unknown>, HTMLDivElement>,\n ],\n ]\n >(() => [[PickerItemContext, { classNames }]], [classNames]);\n\n const style = useCallback(\n ({ state, ...renderProps }: ListBoxRenderProps) =>\n inlineVars(pickerStateVars, {\n ...renderProps,\n columns,\n layout,\n orientation,\n }),\n [columns, layout, orientation],\n );\n\n const children = useMemo(() => {\n if (!(childrenProp || items)) {\n return null;\n }\n\n return (\n <ListBoxSection\n className={classNames?.list?.list}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {typeof childrenProp === 'function' ? (\n <Collection items={items}>{childrenProp}</Collection>\n ) : (\n childrenProp\n )}\n </ListBoxSection>\n );\n }, [childrenProp, items, classNames?.list?.list, ariaLabel, ariaLabelledBy]);\n\n return (\n <Provider values={values}>\n <ListBox<T>\n {...rest}\n ref={finalRef}\n className={classNames?.list?.container}\n items={items}\n layout={layout}\n orientation={orientation}\n selectionMode={selectionMode}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </ListBox>\n </Provider>\n );\n});\n\nexport const PickerItem = forwardRef(function PickerItem<T extends object>(\n props: PickerItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n): JSX.Element {\n const [contextProps, finalRef] = useContextProps(\n props,\n ref,\n PickerItemContext,\n );\n\n const {\n children: childrenProp,\n id,\n classNames: classNamesProp,\n textValue = typeof childrenProp === 'string' ? childrenProp : undefined,\n ...rest\n } = contextProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(pickerClassNames, theme.Picker, classNamesProp),\n [theme.Picker, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: ListBoxItemRenderProps) =>\n inlineVars(pickerItemStateVars, renderProps),\n [],\n );\n\n const children = useCallback(\n (renderProps: ListBoxItemRenderProps) => (\n <div className={classNames?.item?.item}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n ),\n [childrenProp, classNames?.item?.item],\n );\n\n return (\n <ListBoxItem<T>\n {...rest}\n ref={finalRef as React.Ref<HTMLDivElement>}\n id={id ?? textValue}\n className={classNames?.item?.container}\n style={style}\n textValue={textValue}\n >\n {children}\n </ListBoxItem>\n );\n});\n"]}
|
|
@@ -29,11 +29,7 @@ var defaultMapping = {
|
|
|
29
29
|
};
|
|
30
30
|
var PopoverContext = createContext(null);
|
|
31
31
|
var Popover = forwardRef(function Popover2(props, ref) {
|
|
32
|
-
const [contextProps,
|
|
33
|
-
props,
|
|
34
|
-
ref,
|
|
35
|
-
PopoverContext
|
|
36
|
-
);
|
|
32
|
+
const [contextProps, finalRef] = useContextProps(props, ref, PopoverContext);
|
|
37
33
|
const finalProps = useDefaultProps(contextProps, "Popover");
|
|
38
34
|
const {
|
|
39
35
|
children: childrenProp,
|
|
@@ -134,7 +130,7 @@ var Popover = forwardRef(function Popover2(props, ref) {
|
|
|
134
130
|
Popover$1,
|
|
135
131
|
{
|
|
136
132
|
...rest,
|
|
137
|
-
ref:
|
|
133
|
+
ref: finalRef,
|
|
138
134
|
className: classNames?.popover?.container,
|
|
139
135
|
style,
|
|
140
136
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/popover/index.tsx"],"names":["Popover","RACDialog","RACPopover"],"mappings":";;;;;;;;;;;;;;;;;AA6CA,IAAM,cAAA,GAAiC;AAAA,EACrC,SAAS,QAAA,CAAS,EAAA;AAAA,EAClB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,aAAA;AAAA,IACT,WAAA,EAAa,YAAA;AAAA,IACb,OAAA,EAAS;AA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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 type HTMLAttributes,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Provider,\n Dialog as RACDialog,\n Popover as RACPopover,\n type PopoverRenderProps as RACPopoverRenderProps,\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 { popoverClassNames, popoverStateVars } from './popover.css';\nimport type { ButtonProps } from '../button/types';\nimport type { ElementProps } from '../element/types';\nimport type { GroupProps } from '../group/types';\nimport type { PopoverMapping, PopoverProps } from './types';\n\nconst defaultMapping: PopoverMapping = {\n heading: headings.v4,\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: {\n size: 'sm',\n },\n close: { size: 'sm', variant: 'bare' },\n};\n\nexport const PopoverContext =\n createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\nexport const Popover = forwardRef(function Popover(\n props: PopoverProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [contextProps, finalRef] = useContextProps(props, ref, PopoverContext);\n const finalProps = useDefaultProps(contextProps, 'Popover');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(popoverClassNames, theme.Popover, classNamesProp, {\n popover: {\n container: theme.className, // required to consume global theme within Popover\n },\n }),\n [theme.className, theme.Popover, classNamesProp],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n (renderProps: RACPopoverRenderProps) =>\n inlineVars(popoverStateVars, {\n ...theme.style, // required to consume global styles within Popover\n ...renderProps,\n hasHeader,\n }),\n [theme.style, 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 className: mapping.heading,\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 ?? {},\n close: mapping.close ?? {},\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 ],\n );\n\n const children = useCallback(\n (renderProps: RACPopoverRenderProps) => (\n <Provider values={values}>\n <RACDialog className={classNames?.popover?.popover}>\n {({ close }) =>\n callRenderProps(childrenProp, {\n ...renderProps,\n close,\n defaultChildren: null,\n })\n }\n </RACDialog>\n </Provider>\n ),\n [childrenProp, classNames?.popover?.popover, values],\n );\n\n return (\n <RACPopover\n {...rest}\n ref={finalRef}\n className={classNames?.popover?.container}\n style={style}\n >\n {children}\n </RACPopover>\n );\n});\n"]}
|
|
@@ -12,7 +12,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
12
12
|
|
|
13
13
|
var RadioContext = createContext(null);
|
|
14
14
|
var Radio = forwardRef(function Radio2(props, ref) {
|
|
15
|
-
const [contextProps,
|
|
15
|
+
const [contextProps, finalRef] = useContextProps(props, ref, RadioContext);
|
|
16
16
|
const finalProps = useDefaultProps(contextProps, "Radio");
|
|
17
17
|
const {
|
|
18
18
|
children: childrenProp,
|
|
@@ -43,7 +43,7 @@ var Radio = forwardRef(function Radio2(props, ref) {
|
|
|
43
43
|
Radio$1,
|
|
44
44
|
{
|
|
45
45
|
...rest,
|
|
46
|
-
ref:
|
|
46
|
+
ref: finalRef,
|
|
47
47
|
style,
|
|
48
48
|
className: classNames?.radio?.container,
|
|
49
49
|
children
|
|
@@ -52,7 +52,7 @@ var Radio = forwardRef(function Radio2(props, ref) {
|
|
|
52
52
|
});
|
|
53
53
|
var RadioGroupContext = createContext(null);
|
|
54
54
|
var RadioGroup = forwardRef(function RadioGroup2(props, ref) {
|
|
55
|
-
const [contextProps,
|
|
55
|
+
const [contextProps, finalRef] = useContextProps(
|
|
56
56
|
props,
|
|
57
57
|
ref,
|
|
58
58
|
RadioGroupContext
|
|
@@ -107,7 +107,7 @@ var RadioGroup = forwardRef(function RadioGroup2(props, ref) {
|
|
|
107
107
|
RadioGroup$1,
|
|
108
108
|
{
|
|
109
109
|
...rest,
|
|
110
|
-
ref:
|
|
110
|
+
ref: finalRef,
|
|
111
111
|
className: classNames?.group?.container,
|
|
112
112
|
style,
|
|
113
113
|
orientation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["Radio","RACRadio","RadioGroup","RACRadioGroup"],"mappings":";;;;;;;;;;;;AA6CO,IAAM,YAAA,GACX,cAAiE,IAAI;AAEhE,IAAM,KAAA,GAAQ,UAAA,CAAW,SAASA,MAAAA,CACvC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["Radio","RACRadio","RadioGroup","RACRadioGroup"],"mappings":";;;;;;;;;;;;AA6CO,IAAM,YAAA,GACX,cAAiE,IAAI;AAEhE,IAAM,KAAA,GAAQ,UAAA,CAAW,SAASA,MAAAA,CACvC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,QAAQ,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,YAAY,CAAA;AACzE,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,YAAA,EAAc,OAAO,CAAA;AAExD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,UAAA,GAAa,KAAA;AAAA,IACb,GAAG;AAAA,GACL,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,eAAA,EAAiB,KAAA,CAAM,OAAO,cAAc,CAAA;AAAA,IAClE,CAAC,cAAA,EAAgB,KAAA,CAAM,KAAK;AAAA,GAC9B;AAEA,EAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,IACZ,CAAC,WAAA,KACC,UAAA,CAAW,cAAA,EAAgB;AAAA,MACzB,GAAG,WAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,IACH,CAAC,UAAU;AAAA,GACb;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,gCACC,GAAA,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B;AAAA,MAC9B,GAAG,WAAA;AAAA,MACH,UAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH,CAAC,YAAY,WAAW;AAAA,GAC1B;AAEA,EAAA,MAAM,MAAA,GAAS,OAAA;AAAA,IAMb,MAAM;AAAA,MACJ;AAAA,QACE,YAAA;AAAA,QACA;AAAA,UACE,UAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,MACA;AAAA,QACE,gBAAA;AAAA,QACA;AAAA,UACE,WAAW,UAAA,EAAY;AAAA;AACzB;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,YAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,QAAA;AAAA,MACL,SAAA,EAAW,YAAY,KAAA,EAAO,SAAA;AAAA,MAC9B,KAAA;AAAA,MACA,WAAA;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 Radio as RACRadio,\n RadioGroup as RACRadioGroup,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaLabelContext } from '../aria';\nimport {\n radioClassNames,\n radioGroupStateVars,\n radioStateVars,\n} from './radio.css';\nimport type {\n RadioContextProps,\n RadioGroupProps,\n RadioGroupRenderProps,\n RadioProps,\n RadioRenderProps,\n} from './types';\n\nexport const RadioContext =\n createContext<ContextValue<RadioContextProps, HTMLLabelElement>>(null);\n\nexport const Radio = forwardRef(function Radio(\n props: RadioProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const [contextProps, finalRef] = useContextProps(props, ref, RadioContext);\n const finalProps = useDefaultProps(contextProps, 'Radio');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(radioClassNames, theme.Radio, classNamesProp),\n [classNamesProp, theme.Radio],\n );\n\n const style = useCallback(\n (renderProps: RadioRenderProps) =>\n inlineVars(radioStateVars, {\n ...renderProps,\n alignInput,\n }),\n [alignInput],\n );\n\n const children = useCallback(\n (renderProps: RadioRenderProps) => (\n <span className={classNames?.radio?.radio}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </span>\n ),\n [childrenProp, classNames?.radio],\n );\n\n return (\n <RACRadio\n {...rest}\n ref={finalRef}\n style={style}\n className={classNames?.radio?.container}\n >\n {children}\n </RACRadio>\n );\n});\n\nexport const RadioGroupContext =\n createContext<ContextValue<RadioGroupProps, HTMLDivElement>>(null);\n\nexport const RadioGroup = forwardRef(function RadioGroup(\n props: RadioGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(\n props,\n ref,\n RadioGroupContext,\n );\n\n const finalProps = useDefaultProps(contextProps, 'RadioGroup');\n\n const theme = useTheme();\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n orientation = 'vertical',\n ...rest\n } = finalProps;\n\n const classNames = useMemo(\n () => mergeClassNames(radioClassNames, theme.Radio, classNamesProp),\n [classNamesProp, theme.Radio],\n );\n\n const style = useCallback(\n (renderProps: RadioGroupRenderProps) =>\n inlineVars(radioGroupStateVars, {\n ...renderProps,\n alignInput,\n orientation,\n }),\n [alignInput, orientation],\n );\n\n const values = useMemo<\n [\n [typeof RadioContext, ContextValue<RadioContextProps, HTMLLabelElement>],\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n ]\n >(\n () => [\n [\n RadioContext,\n {\n classNames,\n alignInput,\n },\n ],\n [\n AriaLabelContext,\n {\n className: classNames?.label,\n },\n ],\n ],\n [alignInput, classNames],\n );\n\n const children = useCallback(\n (renderProps: RadioGroupRenderProps) => (\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 <RACRadioGroup\n {...rest}\n ref={finalRef}\n className={classNames?.group?.container}\n style={style}\n orientation={orientation}\n >\n {children}\n </RACRadioGroup>\n );\n});\n"]}
|
|
@@ -25,7 +25,7 @@ var defaultMapping = {
|
|
|
25
25
|
};
|
|
26
26
|
var SearchFieldContext = createContext(null);
|
|
27
27
|
var SearchField = forwardRef(function SearchField2(props, ref) {
|
|
28
|
-
const [contextProps,
|
|
28
|
+
const [contextProps, finalRef] = useContextProps(
|
|
29
29
|
props,
|
|
30
30
|
ref,
|
|
31
31
|
SearchFieldContext
|
|
@@ -86,7 +86,7 @@ var SearchField = forwardRef(function SearchField2(props, ref) {
|
|
|
86
86
|
SearchField$1,
|
|
87
87
|
{
|
|
88
88
|
...finalProps,
|
|
89
|
-
ref:
|
|
89
|
+
ref: finalRef,
|
|
90
90
|
className: classNames?.container,
|
|
91
91
|
style,
|
|
92
92
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/search-field/index.tsx"],"names":["SearchField","RACSearchField"],"mappings":";;;;;;;;;;;;;;;AA4CA,IAAM,cAAA,GAAqC;AAAA,EACzC,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,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,kBAAA,GACX,cAA8D,IAAI;AAE7D,IAAM,WAAA,GAAc,UAAA,CAAW,SAASA,YAAAA,CAC7C,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/search-field/index.tsx"],"names":["SearchField","RACSearchField"],"mappings":";;;;;;;;;;;;;;;AA4CA,IAAM,cAAA,GAAqC;AAAA,EACzC,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,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAClC,EAA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Y,UAAA,EAAY,KAAA,EAAO,MAAM,CAAA;AAAA,MACtD;AAAA,QACE,aAAA;AAAA,QACA;AAAA,UACE,GAAG,OAAA,CAAQ,KAAA,CAAM,IAAI,CAAA;AAAA,UACrB,YAAY,UAAA,EAAY,KAAA;AAAA,UACxB,YAAY,UAAA,IAAc;AAAA;AAC5B;AACF,KACF;AAAA,IACA,CAAC,UAAA,EAAY,OAAA,EAAS,UAAA,EAAY,YAAY,IAAI;AAAA,GACpD;AAEA,EAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,IACZ,CAAC,EAAE,KAAA,EAAO,GAAG,WAAA,EAAY,KACvB,WAAW,oBAAA,EAAsB;AAAA,MAC/B,GAAG,WAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,IACH,CAAC,OAAO;AAAA,GACV;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,WAAA,qBACC,GAAA,CAAC,QAAA,EAAA,EAAS,MAAA,EACP,0BAAgB,YAAA,EAAc;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAA,EAAiB;AAAA,KAClB,CAAA,EACH,CAAA;AAAA,IAEF,CAAC,cAAc,MAAM;AAAA,GACvB;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,GAAA,EAAK,QAAA;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 ContextValue,\n Provider,\n type GroupProps as RACGroupProps,\n SearchField as RACSearchField,\n type SearchFieldRenderProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaGroupContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport { IconContext } from '../icon';\nimport { InputContext } from '../input';\nimport {\n searchFieldClassNames,\n searchFieldStateVars,\n} from './search-field.css';\nimport type { ButtonProps } from '../button/types';\nimport type { IconProps } from '../icon/types';\nimport type { InputProps } from '../input/types';\nimport type { SearchFieldMapping, SearchFieldProps } from './types';\n\nconst defaultMapping: SearchFieldMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'sm' },\n },\n clear: {\n sm: { size: 'xs', variant: 'icon' },\n lg: { size: 'sm', variant: 'icon' },\n },\n};\n\nexport const SearchFieldContext =\n createContext<ContextValue<SearchFieldProps, HTMLDivElement>>(null);\n\nexport const SearchField = forwardRef(function SearchField(\n props: SearchFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(\n props,\n ref,\n SearchFieldContext,\n );\n const finalProps = useDefaultProps(contextProps, 'SearchField');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = 'lg',\n variant = 'solid',\n isDisabled,\n isReadOnly,\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(searchFieldClassNames, theme.SearchField, classNamesProp),\n [theme.SearchField, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof AriaGroupContext, ContextValue<RACGroupProps, HTMLDivElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [typeof InputContext, ContextValue<InputProps, HTMLInputElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n ]\n >(\n () => [\n [AriaGroupContext, { className: classNames?.group }],\n [IconContext, { ...mapping.icon[size], classNames: classNames?.icon }],\n [InputContext, { classNames: classNames?.input, size }],\n [\n ButtonContext,\n {\n ...mapping.clear[size],\n classNames: classNames?.clear,\n isDisabled: isDisabled ?? isReadOnly,\n },\n ],\n ],\n [classNames, mapping, isDisabled, isReadOnly, size],\n );\n\n const style = useCallback(\n ({ state, ...renderProps }: SearchFieldRenderProps) =>\n inlineVars(searchFieldStateVars, {\n ...renderProps,\n variant,\n }),\n [variant],\n );\n\n const children = useCallback(\n (renderProps: SearchFieldRenderProps) => (\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n ),\n [childrenProp, values],\n );\n\n return (\n <RACSearchField\n {...finalProps}\n ref={finalRef}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACSearchField>\n );\n});\n"]}
|
|
@@ -11,7 +11,7 @@ import '../icon/types.js';
|
|
|
11
11
|
import '../options/types.js';
|
|
12
12
|
|
|
13
13
|
declare const SelectContext: react.Context<ContextValue<SelectProps<object>, HTMLDivElement>>;
|
|
14
|
-
declare const Select: <T extends object>(props: Omit<react_aria_components.SelectProps<T>, "className" | "style"> & {
|
|
14
|
+
declare const Select: <T extends object>(props: Omit<react_aria_components.SelectProps<T, "single">, "className" | "style"> & {
|
|
15
15
|
classNames?: SelectClassNames;
|
|
16
16
|
mapping?: Partial<SelectMapping>;
|
|
17
17
|
size?: SelectSizes;
|
|
@@ -29,7 +29,7 @@ var defaultMapping = {
|
|
|
29
29
|
};
|
|
30
30
|
var SelectContext = createContext(null);
|
|
31
31
|
var Select = forwardRef(function Select2(props, ref) {
|
|
32
|
-
const [contextProps,
|
|
32
|
+
const [contextProps, finalRef] = useContextProps(props, ref, SelectContext);
|
|
33
33
|
const finalProps = useDefaultProps(contextProps, "Select");
|
|
34
34
|
const {
|
|
35
35
|
children: childrenProp,
|
|
@@ -99,7 +99,7 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
99
99
|
Select$1,
|
|
100
100
|
{
|
|
101
101
|
...finalProps,
|
|
102
|
-
ref:
|
|
102
|
+
ref: finalRef,
|
|
103
103
|
className: classNames?.container,
|
|
104
104
|
style,
|
|
105
105
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/select/index.tsx"],"names":["Select","RACSelect"],"mappings":";;;;;;;;;;;;;;;AAgDA,IAAM,cAAA,GAAgC;AAAA,EACpC,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,QAAA,EAAS;AAAA,IACpC,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,QAAA;AAAS;AAExC,CAAA;AAEO,IAAM,aAAA,GACX,cAAiE,IAAI;AAEhE,IAAM,MAAA,GAAS,UAAA,CAAW,SAASA,OAAAA,CACxC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/select/index.tsx"],"names":["Select","RACSelect"],"mappings":";;;;;;;;;;;;;;;AAgDA,IAAM,cAAA,GAAgC;AAAA,EACpC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,E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AA,GAC3C;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,GAAA,EAAK,QAAA;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 ContextValue,\n type FieldErrorProps,\n type LabelProps,\n Provider,\n Select as RACSelect,\n type SelectRenderProps as RACSelectRenderProps,\n type SelectValueProps,\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 AriaLabelContext,\n AriaSelectValueContext,\n AriaTextContext,\n} from '../aria';\nimport { ButtonContext } from '../button';\nimport { OptionsContext } from '../options';\nimport { selectClassNames, selectStateVars } from './select.css';\nimport type { ButtonProps } from '../button/types';\nimport type { OptionsProps } from '../options/types';\nimport type { SelectMapping, SelectProps } from './types';\n\nconst defaultMapping: SelectMapping = {\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: 'hollow' },\n lg: { size: 'md', variant: 'hollow' },\n },\n};\n\nexport const SelectContext =\n createContext<ContextValue<SelectProps<object>, HTMLDivElement>>(null);\n\nexport const Select = forwardRef(function Select<T extends object>(\n props: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, finalRef] = useContextProps(props, ref, SelectContext);\n const finalProps = useDefaultProps(contextProps, 'Select');\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(selectClassNames, theme.Select, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [classNamesProp, theme.Select, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n [\n typeof AriaSelectValueContext,\n ContextValue<SelectValueProps<object>, HTMLSpanElement>,\n ],\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 [AriaLabelContext, { className: classNames?.label }],\n [\n ButtonContext,\n {\n ...mapping.toggle[size],\n classNames: classNames?.toggle,\n },\n ],\n [\n AriaSelectValueContext,\n {\n className: classNames?.value,\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: RACSelectRenderProps) =>\n inlineVars(selectStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: RACSelectRenderProps) => (\n <div className={classNames?.select}>\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n </div>\n ),\n [childrenProp, values, classNames?.select],\n );\n\n return (\n <RACSelect\n {...finalProps}\n ref={finalRef}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACSelect>\n );\n});\n"]}
|