@accelint/design-system 1.1.6 → 1.1.8
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/button.css.d.ts +24 -24
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/checkbox.css.d.ts +23 -23
- package/dist/components/checkbox/index.js +7 -11
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/chip.css.d.ts +18 -18
- package/dist/components/chip/index.js +2 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/combo-box/combo-box.css.d.ts +9 -9
- package/dist/components/combo-box/index.js +2 -6
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/date-field.css.d.ts +17 -17
- package/dist/components/date-field/index.js +2 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-input/date-input.css.d.ts +25 -25
- package/dist/components/date-input/index.js +4 -4
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/dialog.css.d.ts +15 -15
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/drawer.css.d.ts +16 -16
- 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/group/group.css.d.ts +7 -7
- package/dist/components/group/index.js +4 -4
- package/dist/components/group/index.js.map +1 -1
- package/dist/components/icon/icon.css.d.ts +9 -9
- 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/input/input.css.d.ts +20 -20
- package/dist/components/menu/index.js +9 -9
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.css.d.ts +42 -42
- package/dist/components/number-field/index.js +2 -2
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/number-field/number-field.css.d.ts +11 -11
- package/dist/components/options/index.js +11 -17
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/options.css.d.ts +44 -44
- package/dist/components/picker/index.js +6 -10
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/picker/picker.css.d.ts +18 -18
- package/dist/components/popover/index.js +2 -6
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/popover.css.d.ts +12 -12
- package/dist/components/query-builder/query-builder.css.d.ts +53 -53
- package/dist/components/radio/index.js +4 -4
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/radio.css.d.ts +22 -22
- package/dist/components/search-field/index.js +2 -2
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-field/search-field.css.d.ts +9 -9
- 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/select/select.css.d.ts +12 -12
- package/dist/components/slider/index.js +10 -10
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.css.d.ts +27 -27
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.css.d.ts +16 -16
- 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 +27 -25
- 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/text-field/text-field.css.d.ts +8 -8
- package/dist/components/textarea/index.js +8 -8
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.css.d.ts +22 -22
- package/dist/components/time-field/index.js +2 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/time-field/time-field.css.d.ts +17 -17
- package/dist/components/tooltip/index.js +5 -9
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/tooltip.css.d.ts +11 -11
- package/dist/components/tree/index.js +2 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/tree.css.d.ts +45 -45
- 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/styles/theme.css.d.ts +200 -200
- package/dist/test/setup.js +146 -25
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/css/index.d.ts +1 -1
- package/package.json +45 -45
|
@@ -12,28 +12,28 @@ import '../input/types.js';
|
|
|
12
12
|
declare const numberFieldContainer: string;
|
|
13
13
|
declare const numberFieldColorVars: {
|
|
14
14
|
description: {
|
|
15
|
-
color: `var(--${string})
|
|
15
|
+
color: `var(--${string})`;
|
|
16
16
|
};
|
|
17
17
|
error: {
|
|
18
|
-
color: `var(--${string})
|
|
18
|
+
color: `var(--${string})`;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
declare const numberFieldSpaceVars: {
|
|
22
22
|
group: {
|
|
23
|
-
gap: `var(--${string})
|
|
24
|
-
x: `var(--${string})
|
|
25
|
-
y: `var(--${string})
|
|
23
|
+
gap: `var(--${string})`;
|
|
24
|
+
x: `var(--${string})`;
|
|
25
|
+
y: `var(--${string})`;
|
|
26
26
|
};
|
|
27
27
|
numberField: {
|
|
28
|
-
gap: `var(--${string})
|
|
28
|
+
gap: `var(--${string})`;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
declare const numberFieldStateVars: {
|
|
32
|
-
size: `var(--${string})
|
|
33
|
-
isDisabled: `var(--${string})
|
|
34
|
-
isInvalid: `var(--${string})
|
|
35
|
-
isReadOnly: `var(--${string})
|
|
36
|
-
isRequired: `var(--${string})
|
|
32
|
+
size: `var(--${string})`;
|
|
33
|
+
isDisabled: `var(--${string})`;
|
|
34
|
+
isInvalid: `var(--${string})`;
|
|
35
|
+
isReadOnly: `var(--${string})`;
|
|
36
|
+
isRequired: `var(--${string})`;
|
|
37
37
|
};
|
|
38
38
|
declare const numberFieldClassNames: NumberFieldClassNames;
|
|
39
39
|
|
|
@@ -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,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,cAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CACzC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,aAAA,EAAe,WAAW,CAAA,GAAI,eAAA;AAAA,IACnC,KAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,aAAA,EAAe,SAAS,CAAA;AAE3D,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,WAAA;AAAA,IACP,GAAG;AAAA,GACL,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ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Y,IAAA,EAAM,KAAA;AAAA,MAClB,cAAA;AAAA,MACA,YAAY,IAAA,EAAM,WAAA;AAAA,MAClB,YAAY,IAAA,EAAM,IAAA;AAAA,MAClB,YAAY,IAAA,EAAM;AAAA;AACpB,GACF;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,WAAA,KAAwC;AACvC,MAAA,MAAM,OAAA,GAAU,gBAAgB,YAAA,EAAc;AAAA,QAC5C,GAAG,WAAA;AAAA,QACH,IAAA;AAAA,QACA,eAAA,EAAiB;AAAA,OAClB,CAAA;AAED,MAAA,2BACG,QAAA,EAAA,EAAS,MAAA,EACR,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,IAAA,EAAM,IAAA,EAC/B,iBAAO,OAAA,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,IAAA,EAAM,MAAM,MAAM;AAAA,GACrD;AAEA,EAAA,uBACE,GAAA;AAAA,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;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAI,QAAA,CAAS,EAAA;AAAA,IACb,IAAI,QAAA,CAAS;AAAA,GACf;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,cAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CACzC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,QAAQ,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,cAAc,CAAA;AAC3E,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,Y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;AACF,OACF;AAAA,MACA,CAAC,WAAA,EAAa,EAAE,YAAY,UAAA,EAAY,IAAA,EAAM,MAAM,CAAA;AAAA,MACpD,CAAC,mBAAA,EAAqB,EAAE,WAAW,UAAA,EAAY,IAAA,EAAM,UAAU;AAAA,KACjE;AAAA,IACA;AAAA,MACE,YAAY,IAAA,EAAM,KAAA;AAAA,MAClB,cAAA;AAAA,MACA,YAAY,IAAA,EAAM,WAAA;AAAA,MAClB,YAAY,IAAA,EAAM,IAAA;AAAA,MAClB,YAAY,IAAA,EAAM;AAAA;AACpB,GACF;AAEA,EAAA,MAAM,QAAA,GAAW,WAAA;AAAA,IACf,CAAC,WAAA,KAAwC;AACvC,MAAA,MAAM,OAAA,GAAU,gBAAgB,YAAA,EAAc;AAAA,QAC5C,GAAG,WAAA;AAAA,QACH,eAAA,EAAiB;AAAA,OAClB,CAAA;AAED,MAAA,2BACG,QAAA,EAAA,EAAS,MAAA,EACR,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,IAAA,EAAM,IAAA,EAC/B,iBAAO,OAAA,KAAY,QAAA,uBACjB,QAAA,EAAA,EAAS,IAAA,EAAK,SAAS,QAAA,EAAA,OAAA,EAAQ,CAAA,GAEhC,SAEJ,CAAA,EACF,CAAA;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,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"]}
|
|
@@ -11,75 +11,75 @@ declare const optionsContainers: {
|
|
|
11
11
|
item: string;
|
|
12
12
|
};
|
|
13
13
|
declare const optionsStateVars: {
|
|
14
|
-
size: `var(--${string})
|
|
15
|
-
isEntering: `var(--${string})
|
|
16
|
-
isExiting: `var(--${string})
|
|
17
|
-
placement: `var(--${string})
|
|
14
|
+
size: `var(--${string})`;
|
|
15
|
+
isEntering: `var(--${string})`;
|
|
16
|
+
isExiting: `var(--${string})`;
|
|
17
|
+
placement: `var(--${string})`;
|
|
18
18
|
};
|
|
19
19
|
declare const optionsListStateVars: {
|
|
20
|
-
size: `var(--${string})
|
|
21
|
-
isEmpty: `var(--${string})
|
|
22
|
-
isFocused: `var(--${string})
|
|
23
|
-
isFocusVisible: `var(--${string})
|
|
20
|
+
size: `var(--${string})`;
|
|
21
|
+
isEmpty: `var(--${string})`;
|
|
22
|
+
isFocused: `var(--${string})`;
|
|
23
|
+
isFocusVisible: `var(--${string})`;
|
|
24
24
|
};
|
|
25
25
|
declare const optionsItemStateVars: {
|
|
26
|
-
selectionBehavior: `var(--${string})
|
|
27
|
-
selectionMode: `var(--${string})
|
|
28
|
-
size: `var(--${string})
|
|
29
|
-
hasDescription: `var(--${string})
|
|
30
|
-
isDisabled: `var(--${string})
|
|
31
|
-
isHovered: `var(--${string})
|
|
32
|
-
isPressed: `var(--${string})
|
|
33
|
-
isSelected: `var(--${string})
|
|
34
|
-
isFocused: `var(--${string})
|
|
35
|
-
isFocusVisible: `var(--${string})
|
|
26
|
+
selectionBehavior: `var(--${string})`;
|
|
27
|
+
selectionMode: `var(--${string})`;
|
|
28
|
+
size: `var(--${string})`;
|
|
29
|
+
hasDescription: `var(--${string})`;
|
|
30
|
+
isDisabled: `var(--${string})`;
|
|
31
|
+
isHovered: `var(--${string})`;
|
|
32
|
+
isPressed: `var(--${string})`;
|
|
33
|
+
isSelected: `var(--${string})`;
|
|
34
|
+
isFocused: `var(--${string})`;
|
|
35
|
+
isFocusVisible: `var(--${string})`;
|
|
36
36
|
};
|
|
37
37
|
declare const optionsColorVars: {
|
|
38
38
|
list: {
|
|
39
|
-
background: `var(--${string})
|
|
40
|
-
border: `var(--${string})
|
|
41
|
-
color: `var(--${string})
|
|
39
|
+
background: `var(--${string})`;
|
|
40
|
+
border: `var(--${string})`;
|
|
41
|
+
color: `var(--${string})`;
|
|
42
42
|
};
|
|
43
43
|
header: {
|
|
44
|
-
background: `var(--${string})
|
|
45
|
-
border: `var(--${string})
|
|
46
|
-
color: `var(--${string})
|
|
44
|
+
background: `var(--${string})`;
|
|
45
|
+
border: `var(--${string})`;
|
|
46
|
+
color: `var(--${string})`;
|
|
47
47
|
};
|
|
48
|
-
separator: `var(--${string})
|
|
48
|
+
separator: `var(--${string})`;
|
|
49
49
|
item: {
|
|
50
|
-
background: `var(--${string})
|
|
51
|
-
border: `var(--${string})
|
|
52
|
-
color: `var(--${string})
|
|
50
|
+
background: `var(--${string})`;
|
|
51
|
+
border: `var(--${string})`;
|
|
52
|
+
color: `var(--${string})`;
|
|
53
53
|
};
|
|
54
|
-
label: `var(--${string})
|
|
55
|
-
description: `var(--${string})
|
|
54
|
+
label: `var(--${string})`;
|
|
55
|
+
description: `var(--${string})`;
|
|
56
56
|
};
|
|
57
57
|
declare const optionsSpaceVars: {
|
|
58
58
|
options: {
|
|
59
|
-
minWidth: `var(--${string})
|
|
60
|
-
x: `var(--${string})
|
|
61
|
-
y: `var(--${string})
|
|
59
|
+
minWidth: `var(--${string})`;
|
|
60
|
+
x: `var(--${string})`;
|
|
61
|
+
y: `var(--${string})`;
|
|
62
62
|
};
|
|
63
63
|
list: {
|
|
64
|
-
x: `var(--${string})
|
|
65
|
-
y: `var(--${string})
|
|
64
|
+
x: `var(--${string})`;
|
|
65
|
+
y: `var(--${string})`;
|
|
66
66
|
};
|
|
67
67
|
section: {
|
|
68
|
-
x: `var(--${string})
|
|
69
|
-
y: `var(--${string})
|
|
68
|
+
x: `var(--${string})`;
|
|
69
|
+
y: `var(--${string})`;
|
|
70
70
|
};
|
|
71
71
|
header: {
|
|
72
|
-
x: `var(--${string})
|
|
73
|
-
y: `var(--${string})
|
|
72
|
+
x: `var(--${string})`;
|
|
73
|
+
y: `var(--${string})`;
|
|
74
74
|
};
|
|
75
75
|
separator: {
|
|
76
|
-
x: `var(--${string})
|
|
77
|
-
y: `var(--${string})
|
|
76
|
+
x: `var(--${string})`;
|
|
77
|
+
y: `var(--${string})`;
|
|
78
78
|
};
|
|
79
79
|
item: {
|
|
80
|
-
x: `var(--${string})
|
|
81
|
-
y: `var(--${string})
|
|
82
|
-
gap: `var(--${string})
|
|
80
|
+
x: `var(--${string})`;
|
|
81
|
+
y: `var(--${string})`;
|
|
82
|
+
gap: `var(--${string})`;
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
declare const optionsClassNames: OptionsClassNames;
|
|
@@ -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,EAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,IACZ,CAAC,EAAE,KAAA,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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"]}
|
|
@@ -7,30 +7,30 @@ declare const pickerContainers: {
|
|
|
7
7
|
item: string;
|
|
8
8
|
};
|
|
9
9
|
declare const pickerSpaceVars: {
|
|
10
|
-
gap: `var(--${string})
|
|
10
|
+
gap: `var(--${string})`;
|
|
11
11
|
};
|
|
12
12
|
declare const pickerStateVars: {
|
|
13
|
-
columns: `var(--${string})
|
|
14
|
-
layout: `var(--${string})
|
|
15
|
-
orientation: `var(--${string})
|
|
16
|
-
isEmpty: `var(--${string})
|
|
17
|
-
isFocused: `var(--${string})
|
|
18
|
-
isFocusVisible: `var(--${string})
|
|
13
|
+
columns: `var(--${string})`;
|
|
14
|
+
layout: `var(--${string})`;
|
|
15
|
+
orientation: `var(--${string})`;
|
|
16
|
+
isEmpty: `var(--${string})`;
|
|
17
|
+
isFocused: `var(--${string})`;
|
|
18
|
+
isFocusVisible: `var(--${string})`;
|
|
19
19
|
};
|
|
20
20
|
declare const pickerItemColorVars: {
|
|
21
|
-
background: `var(--${string})
|
|
22
|
-
border: `var(--${string})
|
|
23
|
-
color: `var(--${string})
|
|
21
|
+
background: `var(--${string})`;
|
|
22
|
+
border: `var(--${string})`;
|
|
23
|
+
color: `var(--${string})`;
|
|
24
24
|
};
|
|
25
25
|
declare const pickerItemStateVars: {
|
|
26
|
-
selectionMode: `var(--${string})
|
|
27
|
-
selectionBehavior: `var(--${string})
|
|
28
|
-
isDisabled: `var(--${string})
|
|
29
|
-
isFocused: `var(--${string})
|
|
30
|
-
isFocusVisible: `var(--${string})
|
|
31
|
-
isHovered: `var(--${string})
|
|
32
|
-
isPressed: `var(--${string})
|
|
33
|
-
isSelected: `var(--${string})
|
|
26
|
+
selectionMode: `var(--${string})`;
|
|
27
|
+
selectionBehavior: `var(--${string})`;
|
|
28
|
+
isDisabled: `var(--${string})`;
|
|
29
|
+
isFocused: `var(--${string})`;
|
|
30
|
+
isFocusVisible: `var(--${string})`;
|
|
31
|
+
isHovered: `var(--${string})`;
|
|
32
|
+
isPressed: `var(--${string})`;
|
|
33
|
+
isSelected: `var(--${string})`;
|
|
34
34
|
};
|
|
35
35
|
declare const pickerClassNames: PickerClassNames;
|
|
36
36
|
|
|
@@ -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;AAAA,GACX;AAAA,EACA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM;AAAA,GACR;AAAA,EACA,KAAA,EAAO,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAChC,CAAA;AAEO,IAAM,cAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CACzC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,
|
|
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;AAAA,GACX;AAAA,EACA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM;AAAA,GACR;AAAA,EACA,KAAA,EAAO,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAChC,CAAA;AAEO,IAAM,cAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CACzC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,QAAQ,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,cAAc,CAAA;AAC3E,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,YAAA,EAAc,SAAS,CAAA;AAE1D,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,GAAG;AAAA,GACL,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,OAAA,GAAU,OAAA;AAAA,IAC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EAAS,SAAA;AAAA,MAChC,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 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"]}
|
|
@@ -14,31 +14,31 @@ import '@react-types/shared';
|
|
|
14
14
|
declare const popoverContainer: string;
|
|
15
15
|
declare const popoverColorVars: {
|
|
16
16
|
content: {
|
|
17
|
-
color: `var(--${string})
|
|
17
|
+
color: `var(--${string})`;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
declare const popoverSpaceVars: {
|
|
21
|
-
width: `var(--${string})
|
|
22
|
-
x: `var(--${string})
|
|
23
|
-
y: `var(--${string})
|
|
21
|
+
width: `var(--${string})`;
|
|
22
|
+
x: `var(--${string})`;
|
|
23
|
+
y: `var(--${string})`;
|
|
24
24
|
gap: {
|
|
25
|
-
default: `var(--${string})
|
|
25
|
+
default: `var(--${string})`;
|
|
26
26
|
header: {
|
|
27
|
-
after: `var(--${string})
|
|
27
|
+
after: `var(--${string})`;
|
|
28
28
|
};
|
|
29
29
|
content: {
|
|
30
|
-
before: `var(--${string})
|
|
30
|
+
before: `var(--${string})`;
|
|
31
31
|
};
|
|
32
32
|
footer: {
|
|
33
|
-
before: `var(--${string})
|
|
33
|
+
before: `var(--${string})`;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
declare const popoverStateVars: {
|
|
38
|
-
hasHeader: `var(--${string})
|
|
39
|
-
placement: `var(--${string})
|
|
40
|
-
isEntering: `var(--${string})
|
|
41
|
-
isExiting: `var(--${string})
|
|
38
|
+
hasHeader: `var(--${string})`;
|
|
39
|
+
placement: `var(--${string})`;
|
|
40
|
+
isEntering: `var(--${string})`;
|
|
41
|
+
isExiting: `var(--${string})`;
|
|
42
42
|
};
|
|
43
43
|
declare const popoverClassNames: PopoverClassNames;
|
|
44
44
|
|