@accelint/design-system 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/aria/index.js.map +1 -1
- package/dist/components/button/button.css.d.ts +25 -24
- package/dist/components/button/index.d.ts +9 -40
- package/dist/components/button/index.js +23 -17
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/types.d.ts +3 -2
- package/dist/components/checkbox/checkbox.css.d.ts +23 -23
- 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.map +1 -1
- package/dist/components/collection/index.d.ts +3 -3
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/combo-box/combo-box.css.d.ts +9 -9
- package/dist/components/combo-box/index.js +9 -5
- 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 +8 -4
- 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 +19 -8
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/dialog.css.d.ts +16 -15
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +7 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/types.d.ts +1 -0
- package/dist/components/drawer/drawer.css.d.ts +17 -17
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.js +21 -8
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/element/index.d.ts +1 -1
- package/dist/components/element/index.js +7 -3
- package/dist/components/element/index.js.map +1 -1
- package/dist/components/element/types.d.ts +2 -0
- package/dist/components/group/group.css.d.ts +7 -7
- package/dist/components/group/index.js +6 -6
- 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 +4 -4
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/index.d.ts +35 -35
- package/dist/components/input/index.js +17 -8
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/input.css.d.ts +20 -20
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.css.d.ts +42 -42
- package/dist/components/merge-provider/index.js +15 -7
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/merge-provider/types.d.ts +2 -0
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/index.js +8 -4
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/number-field/number-field.css.d.ts +12 -12
- package/dist/components/number-field/types.d.ts +1 -1
- package/dist/components/options/index.js +1 -1
- 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.map +1 -1
- package/dist/components/picker/picker.css.d.ts +18 -18
- package/dist/components/popover/index.js +8 -4
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/popover.css.d.ts +12 -12
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/dataset-sample.js.map +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/query-builder.css.d.ts +53 -53
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +12 -8
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/radio.css.d.ts +22 -22
- package/dist/components/search-field/index.js +9 -5
- 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.js +5 -5
- 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 +48 -20
- 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 +4 -4
- 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 +32 -20
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs/tabs.css.d.ts +25 -25
- package/dist/components/text-field/index.d.ts +3 -128
- package/dist/components/text-field/index.js +11 -7
- 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 +16 -7
- 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 +8 -4
- 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 +17 -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 +5 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/tree.css.d.ts +45 -45
- package/dist/hooks/index.d.ts +13 -13
- package/dist/hooks/use-collection-render/index.d.ts +1 -1
- package/dist/hooks/use-collection-render/index.js +2 -3
- package/dist/hooks/use-collection-render/index.js.map +1 -1
- package/dist/hooks/use-context-props/index.js.map +1 -1
- package/dist/hooks/use-defaults/index.d.ts +32 -80
- package/dist/hooks/use-defaults/index.js +1 -4
- package/dist/hooks/use-defaults/index.js.map +1 -1
- package/dist/hooks/use-defaults/types.d.ts +1 -1
- package/dist/hooks/use-theme/index.d.ts +2 -2
- package/dist/hooks/use-theme/index.js.map +1 -1
- package/dist/hooks/use-theme/types.d.ts +1 -1
- package/dist/hooks/use-tree/index.js +3 -2
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-tree/utils.js +6 -9
- package/dist/hooks/use-tree/utils.js.map +1 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.css +32 -32
- package/dist/index.d.ts +39 -39
- package/dist/ladle/actions.js.map +1 -1
- package/dist/styles/theme.css.d.ts +200 -200
- package/dist/test/setup.js +778 -1276
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/css/index.d.ts +1 -1
- package/dist/utils/css/index.js.map +1 -1
- package/dist/utils/props/index.d.ts +1 -2
- package/dist/utils/props/index.js +1 -2
- package/dist/utils/props/index.js.map +1 -1
- package/dist/vanilla.d.ts +29 -29
- package/package.json +49 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/combo-box/index.tsx"],"names":["ComboBox","RACComboBox"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAkC;AAAA,EACtC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAClC,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAM,SAAS,MAAA;AAAO;AAEtC,CAAA;AAEO,IAAM,eAAA,GACX,cAAmE,IAAI;AAElE,IAAM,QAAA,GAAW,UAAA,CAAW,SAASA,SAAAA,CAC1C,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/combo-box/index.tsx"],"names":["ComboBox","RACComboBox"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAkC;AAAA,EACtC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,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EAAQ,YAAY;AAAA,GAC7C;AAEA,EAAA,uBACE,GAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,GAAA,EAAK,UAAA;AAAA,MACL,WAAW,UAAA,EAAY,SAAA;AAAA,MACvB,KAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ComboBoxRenderProps,\n type ContextValue,\n type FieldErrorProps,\n type LabelProps,\n Provider,\n ComboBox as RACComboBox,\n type GroupProps as RACGroupProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaFieldErrorContext,\n AriaGroupContext,\n AriaLabelContext,\n AriaTextContext,\n} from '../aria';\nimport { ButtonContext } from '../button';\nimport { InputContext } from '../input';\nimport { OptionsContext } from '../options';\nimport { comboBoxClassNames, comboBoxStateVars } from './combo-box.css';\nimport type { ButtonProps } from '../button/types';\nimport type { InputProps } from '../input/types';\nimport type { OptionsProps } from '../options/types';\nimport type { ComboBoxMapping, ComboBoxProps } from './types';\n\nconst defaultMapping: ComboBoxMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n error: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n toggle: {\n sm: { size: 'sm', variant: 'icon' },\n lg: { size: 'md', variant: 'icon' },\n },\n};\n\nexport const ComboBoxContext =\n createContext<ContextValue<ComboBoxProps<object>, HTMLDivElement>>(null);\n\nexport const ComboBox = forwardRef(function ComboBox<T extends object>(\n props: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n ComboBoxContext,\n );\n const finalProps = useDefaultProps(contextProps, 'ComboBox');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = 'lg',\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(comboBoxClassNames, theme.ComboBox, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [theme.ComboBox, classNamesProp, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof AriaGroupContext, ContextValue<RACGroupProps, HTMLDivElement>],\n [typeof InputContext, ContextValue<InputProps, HTMLInputElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [\n typeof AriaFieldErrorContext,\n ContextValue<FieldErrorProps, HTMLElement>,\n ],\n [typeof OptionsContext, ContextValue<OptionsProps, HTMLElement>],\n ]\n >(\n () => [\n [\n AriaLabelContext,\n {\n className: classNames?.label,\n },\n ],\n [\n AriaGroupContext,\n {\n className: classNames?.group,\n },\n ],\n [InputContext, { classNames: classNames?.input, size }],\n [\n ButtonContext,\n {\n ...mapping.toggle[size],\n classNames: classNames?.toggle,\n },\n ],\n [\n AriaTextContext,\n {\n slots: {\n description: { className: classNames?.description },\n },\n },\n ],\n [AriaFieldErrorContext, { className: classNames?.error }],\n [OptionsContext, { classNames: classNames?.options, size }],\n ],\n [classNames, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: ComboBoxRenderProps) =>\n inlineVars(comboBoxStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: ComboBoxRenderProps) => (\n <div className={classNames?.comboBox}>\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n </div>\n ),\n [classNames?.comboBox, values, childrenProp],\n );\n\n return (\n <RACComboBox\n {...finalProps}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACComboBox>\n );\n});\n"]}
|
|
@@ -11,33 +11,33 @@ import '../icon/types.js';
|
|
|
11
11
|
|
|
12
12
|
declare const dateFieldContainer: string;
|
|
13
13
|
declare const dateFieldSpaceVars: {
|
|
14
|
-
x: `var(--${string})
|
|
15
|
-
y: `var(--${string})
|
|
16
|
-
gap: `var(--${string})
|
|
17
|
-
minWidth: `var(--${string})
|
|
18
|
-
width: `var(--${string})
|
|
19
|
-
maxWidth: `var(--${string})
|
|
14
|
+
x: `var(--${string})`;
|
|
15
|
+
y: `var(--${string})`;
|
|
16
|
+
gap: `var(--${string})`;
|
|
17
|
+
minWidth: `var(--${string})`;
|
|
18
|
+
width: `var(--${string})`;
|
|
19
|
+
maxWidth: `var(--${string})`;
|
|
20
20
|
};
|
|
21
21
|
declare const dateFieldColorVars: {
|
|
22
|
-
border: `var(--${string})
|
|
22
|
+
border: `var(--${string})`;
|
|
23
23
|
description: {
|
|
24
|
-
color: `var(--${string})
|
|
24
|
+
color: `var(--${string})`;
|
|
25
25
|
};
|
|
26
26
|
error: {
|
|
27
|
-
color: `var(--${string})
|
|
27
|
+
color: `var(--${string})`;
|
|
28
28
|
};
|
|
29
29
|
label: {
|
|
30
|
-
color: `var(--${string})
|
|
30
|
+
color: `var(--${string})`;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
declare const dateFieldStateVars: {
|
|
34
|
-
size: `var(--${string})
|
|
35
|
-
isDisabled: `var(--${string})
|
|
36
|
-
isFocused: `var(--${string})
|
|
37
|
-
isHovered: `var(--${string})
|
|
38
|
-
isInvalid: `var(--${string})
|
|
39
|
-
isReadOnly: `var(--${string})
|
|
40
|
-
isRequired: `var(--${string})
|
|
34
|
+
size: `var(--${string})`;
|
|
35
|
+
isDisabled: `var(--${string})`;
|
|
36
|
+
isFocused: `var(--${string})`;
|
|
37
|
+
isHovered: `var(--${string})`;
|
|
38
|
+
isInvalid: `var(--${string})`;
|
|
39
|
+
isReadOnly: `var(--${string})`;
|
|
40
|
+
isRequired: `var(--${string})`;
|
|
41
41
|
};
|
|
42
42
|
declare const dateFieldClassNames: DateFieldClassNames;
|
|
43
43
|
|
|
@@ -30,9 +30,13 @@ var defaultMapping = {
|
|
|
30
30
|
var defaultSize = "lg";
|
|
31
31
|
var DateFieldContext = createContext(null);
|
|
32
32
|
var DateField = forwardRef(function DateField2(props, ref) {
|
|
33
|
-
[
|
|
34
|
-
props = useDefaultProps(
|
|
33
|
+
const [contextProps, contextRef] = useContextProps(
|
|
35
34
|
props,
|
|
35
|
+
ref,
|
|
36
|
+
DateFieldContext
|
|
37
|
+
);
|
|
38
|
+
const finalProps = useDefaultProps(
|
|
39
|
+
contextProps,
|
|
36
40
|
"DateField"
|
|
37
41
|
);
|
|
38
42
|
const {
|
|
@@ -42,7 +46,7 @@ var DateField = forwardRef(function DateField2(props, ref) {
|
|
|
42
46
|
size = defaultSize,
|
|
43
47
|
value,
|
|
44
48
|
...rest
|
|
45
|
-
} =
|
|
49
|
+
} = finalProps;
|
|
46
50
|
const theme = useTheme();
|
|
47
51
|
const mapping = useMemo(
|
|
48
52
|
() => ({
|
|
@@ -95,7 +99,7 @@ var DateField = forwardRef(function DateField2(props, ref) {
|
|
|
95
99
|
DateField$1,
|
|
96
100
|
{
|
|
97
101
|
...rest,
|
|
98
|
-
ref,
|
|
102
|
+
ref: contextRef,
|
|
99
103
|
className: classNames?.container,
|
|
100
104
|
style,
|
|
101
105
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["DateField","RACDateField"],"mappings":";;;;;;;;;;;;;;;AAmDA,IAAM,cAAA,GAAmC;AAAA,EACvC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK;AAErB,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,gBAAA,GACX,cAAuE,IAAI;AAEtE,IAAM,SAAA,GAAY,UAAA,CAAW,SAASA,UAAAA,CAC3C,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["DateField","RACDateField"],"mappings":";;;;;;;;;;;;;;;AAmDA,IAAM,cAAA,GAAmC;AAAA,EACvC,WAAA,EAAa;AAAA,IACX,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA,GACb;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK;AAErB,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,gBAAA,GACX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ed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n type DateValue,\n type FieldErrorProps,\n LabelContext,\n type LabelProps,\n Provider,\n DateField as RACDateField,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { bodies } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport {\n AriaFieldErrorContext,\n type AriaLabelContext,\n AriaTextContext,\n} from '../aria';\nimport { DateInputContext } from '../date-input';\nimport { IconContext } from '../icon';\nimport { dateFieldClassNames, dateFieldStateVars } from './date-field.css';\nimport type { DateInputProps } from '../date-input/types';\nimport type { IconProps } from '../icon/types';\nimport type {\n DateFieldMapping,\n DateFieldProps,\n DateFieldRenderProps,\n} from './types';\n\nconst defaultMapping: DateFieldMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n error: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateFieldContext =\n createContext<ContextValue<DateFieldProps<DateValue>, HTMLDivElement>>(null);\n\nexport const DateField = forwardRef(function DateField<T extends DateValue>(\n props: DateFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateFieldContext,\n );\n\n const finalProps = useDefaultProps(\n contextProps as DateFieldProps<DateValue>,\n 'DateField',\n ) as DateFieldProps<T>;\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n value,\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateFieldClassNames, theme.DateField, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [theme.DateField, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateFieldRenderProps) =>\n inlineVars(dateFieldStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const values = useMemo<\n [\n [typeof DateInputContext, ContextValue<DateInputProps, HTMLDivElement>],\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [\n typeof AriaFieldErrorContext,\n ContextValue<FieldErrorProps, HTMLElement>,\n ],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n ]\n >(\n () => [\n [DateInputContext, { classNames: classNames?.input, size }],\n [LabelContext, { className: classNames?.label }],\n [\n AriaTextContext,\n {\n slots: {\n description: { className: classNames?.description },\n },\n },\n ],\n [AriaFieldErrorContext, { className: classNames?.error }],\n [IconContext, { ...mapping.icon[size], classNames: classNames?.icon }],\n ],\n [classNames, mapping, size],\n );\n\n const children = useCallback(\n (renderProps: DateFieldRenderProps) => {\n return (\n <Provider values={values}>\n <div className={classNames?.dateField}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n );\n },\n [childrenProp, values, classNames?.dateField],\n );\n\n return (\n <RACDateField\n {...rest}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n value={value}\n >\n {children}\n </RACDateField>\n );\n});\n"]}
|
|
@@ -10,44 +10,44 @@ import '../icon/types.js';
|
|
|
10
10
|
declare const dateInputContainer: string;
|
|
11
11
|
declare const dateSegmentsContainer: string;
|
|
12
12
|
declare const dateInputStateVars: {
|
|
13
|
-
size: `var(--${string})
|
|
14
|
-
isHovered: `var(--${string})
|
|
15
|
-
isFocusWithin: `var(--${string})
|
|
16
|
-
isFocusVisible: `var(--${string})
|
|
17
|
-
isDisabled: `var(--${string})
|
|
18
|
-
isInvalid: `var(--${string})
|
|
13
|
+
size: `var(--${string})`;
|
|
14
|
+
isHovered: `var(--${string})`;
|
|
15
|
+
isFocusWithin: `var(--${string})`;
|
|
16
|
+
isFocusVisible: `var(--${string})`;
|
|
17
|
+
isDisabled: `var(--${string})`;
|
|
18
|
+
isInvalid: `var(--${string})`;
|
|
19
19
|
};
|
|
20
20
|
declare const dateSegmentStateVars: {
|
|
21
|
-
isHovered: `var(--${string})
|
|
22
|
-
isFocused: `var(--${string})
|
|
23
|
-
isFocusVisible: `var(--${string})
|
|
24
|
-
isDisabled: `var(--${string})
|
|
25
|
-
isInvalid: `var(--${string})
|
|
26
|
-
isPlaceholder: `var(--${string})
|
|
27
|
-
isReadOnly: `var(--${string})
|
|
28
|
-
isEditable: `var(--${string})
|
|
21
|
+
isHovered: `var(--${string})`;
|
|
22
|
+
isFocused: `var(--${string})`;
|
|
23
|
+
isFocusVisible: `var(--${string})`;
|
|
24
|
+
isDisabled: `var(--${string})`;
|
|
25
|
+
isInvalid: `var(--${string})`;
|
|
26
|
+
isPlaceholder: `var(--${string})`;
|
|
27
|
+
isReadOnly: `var(--${string})`;
|
|
28
|
+
isEditable: `var(--${string})`;
|
|
29
29
|
};
|
|
30
30
|
declare const dateInputSpaceVars: {
|
|
31
31
|
input: {
|
|
32
|
-
x: `var(--${string})
|
|
33
|
-
y: `var(--${string})
|
|
34
|
-
gap: `var(--${string})
|
|
35
|
-
minWidth: `var(--${string})
|
|
36
|
-
width: `var(--${string})
|
|
37
|
-
maxWidth: `var(--${string})
|
|
32
|
+
x: `var(--${string})`;
|
|
33
|
+
y: `var(--${string})`;
|
|
34
|
+
gap: `var(--${string})`;
|
|
35
|
+
minWidth: `var(--${string})`;
|
|
36
|
+
width: `var(--${string})`;
|
|
37
|
+
maxWidth: `var(--${string})`;
|
|
38
38
|
};
|
|
39
39
|
segments: {
|
|
40
|
-
gap: `var(--${string})
|
|
40
|
+
gap: `var(--${string})`;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
declare const dateInputColorVars: {
|
|
44
|
-
border: `var(--${string})
|
|
45
|
-
color: `var(--${string})
|
|
44
|
+
border: `var(--${string})`;
|
|
45
|
+
color: `var(--${string})`;
|
|
46
46
|
description: {
|
|
47
|
-
color: `var(--${string})
|
|
47
|
+
color: `var(--${string})`;
|
|
48
48
|
};
|
|
49
49
|
error: {
|
|
50
|
-
color: `var(--${string})
|
|
50
|
+
color: `var(--${string})`;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
declare const dateInputClassNames: DateInputClassNames;
|
|
@@ -24,8 +24,12 @@ var defaultMapping = {
|
|
|
24
24
|
var defaultSize = "lg";
|
|
25
25
|
var DateInputContext = createContext(null);
|
|
26
26
|
var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
27
|
-
[
|
|
28
|
-
|
|
27
|
+
const [contextProps, contextRef] = useContextProps(
|
|
28
|
+
props,
|
|
29
|
+
ref,
|
|
30
|
+
DateInputContext
|
|
31
|
+
);
|
|
32
|
+
const finalProps = useDefaultProps(contextProps, "DateInput");
|
|
29
33
|
const {
|
|
30
34
|
children: childrenProp,
|
|
31
35
|
classNames: classNamesProp,
|
|
@@ -33,7 +37,7 @@ var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
33
37
|
size = defaultSize,
|
|
34
38
|
provider,
|
|
35
39
|
...rest
|
|
36
|
-
} =
|
|
40
|
+
} = finalProps;
|
|
37
41
|
const dateFieldState = useContext(DateFieldStateContext);
|
|
38
42
|
const timeFieldState = useContext(TimeFieldStateContext);
|
|
39
43
|
const state = dateFieldState ?? timeFieldState ?? null;
|
|
@@ -61,14 +65,17 @@ var DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
61
65
|
[size]
|
|
62
66
|
);
|
|
63
67
|
const children = useCallback(
|
|
64
|
-
(renderProps) => /* @__PURE__ */ jsx("div", { className: classNames?.input?.input, children: childrenProp && (provider ? callRenderProps(childrenProp, { ...renderProps, ...state }) :
|
|
68
|
+
(renderProps) => /* @__PURE__ */ jsx("div", { className: classNames?.input?.input, children: childrenProp && (provider ? callRenderProps(childrenProp, { ...renderProps, ...state }) : (
|
|
69
|
+
// biome-ignore lint/complexity/noUselessFragments: children group needs to be wrapped
|
|
70
|
+
/* @__PURE__ */ jsx(Fragment, { children: state.segments.map((segment, idx) => /* @__PURE__ */ jsx(Fragment$1, { children: childrenProp(segment) }, `${segment.type}_${idx}`)) })
|
|
71
|
+
)) }),
|
|
65
72
|
[childrenProp, state, provider, classNames?.input]
|
|
66
73
|
);
|
|
67
74
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
75
|
/* @__PURE__ */ jsx(
|
|
69
76
|
Group,
|
|
70
77
|
{
|
|
71
|
-
ref,
|
|
78
|
+
ref: contextRef,
|
|
72
79
|
...rest,
|
|
73
80
|
className: classNames?.input?.container,
|
|
74
81
|
style,
|
|
@@ -100,12 +107,16 @@ var DateSegments = forwardRef(
|
|
|
100
107
|
var DateSegmentContext = createContext(null);
|
|
101
108
|
var DateSegment = forwardRef(
|
|
102
109
|
function DateSegment2(props, ref) {
|
|
103
|
-
[
|
|
110
|
+
const [contextProps, contextRef] = useContextProps(
|
|
111
|
+
props,
|
|
112
|
+
ref,
|
|
113
|
+
DateSegmentContext
|
|
114
|
+
);
|
|
104
115
|
const {
|
|
105
116
|
classNames: classNamesProp,
|
|
106
117
|
children: childrenProp,
|
|
107
118
|
...rest
|
|
108
|
-
} =
|
|
119
|
+
} = contextProps;
|
|
109
120
|
const classNames = useMemo(
|
|
110
121
|
() => mergeClassNames(dateInputClassNames, classNamesProp),
|
|
111
122
|
[classNamesProp]
|
|
@@ -132,7 +143,7 @@ var DateSegment = forwardRef(
|
|
|
132
143
|
return /* @__PURE__ */ jsx(
|
|
133
144
|
DateSegment$1,
|
|
134
145
|
{
|
|
135
|
-
ref,
|
|
146
|
+
ref: contextRef,
|
|
136
147
|
...rest,
|
|
137
148
|
style,
|
|
138
149
|
className: classNames?.segment?.container,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-input/index.tsx"],"names":["DateInput","Fragment","DateSegment","RACDateSegment"],"mappings":";;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAiB;AAAA,EACrB,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA;AAAK,GACnB;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,IAAI,MAAA,CAAO;AAAA;AAEf,CAAA;AAEA,IAAM,WAAA,GAAc,IAAA;AAEb,IAAM,gBAAA,GACX,cAA4D,IAAI;AAE3D,IAAM,SAAA,GAAY,UAAA,CAAW,SAASA,UAAAA,CAC3C,OACA,GAAA,EACA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,gBAAgB,CAAA;AAC3D,EAAA,KAAA,GAAQ,eAAA,CAAgB,OAAO,WAAW,CAAA;AAE1C,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,GAAO,WAAA;AAAA,IACP,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,cAAA,GAAiB,WAAW,qBAAqB,CAAA;AACvD,EAAA,MAAM,cAAA,GAAiB,WAAW,qBAAqB,CAAA;AACvD,EAAA,MAAM,KA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c,UAAU;AAAA,KAC3B;AAEA,IAAA,uBACE,GAAA;AAAA,MAACC,aAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QACJ,KAAA;AAAA,QACA,SAAA,EAAW,YAAY,OAAA,EAAS,SAAA;AAAA,QAE/B;AAAA;AAAA,KACH;AAAA,EAEJ;AACF","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type FC,\n type ForwardedRef,\n Fragment,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n DateFieldStateContext,\n Group,\n DateSegment as RACDateSegment,\n type SlotProps,\n TimeFieldStateContext,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inputs } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { Input } from '../input';\nimport {\n dateInputClassNames,\n dateInputStateVars,\n dateSegmentStateVars,\n} from './date-input.css';\nimport type {\n DateInputProps,\n DateInputRenderProps,\n DateSegmentProps,\n DateSegmentRenderProps,\n DateSegmentsProps,\n} from './types';\n\nconst defaultMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n input: {\n sm: inputs.sm,\n lg: inputs.lg,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateInputContext =\n createContext<ContextValue<DateInputProps, HTMLDivElement>>(null);\n\nexport const DateInput = forwardRef(function DateInput(\n props: DateInputProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DateInputContext);\n props = useDefaultProps(props, 'DateInput');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n provider,\n ...rest\n } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Input component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp, {\n input: { input: mapping.input[size] },\n }),\n [theme.DateInput, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateInputRenderProps) =>\n inlineVars(dateInputStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: DateInputRenderProps) => (\n <div className={classNames?.input?.input}>\n {childrenProp &&\n (provider ? (\n callRenderProps(childrenProp, { ...renderProps, ...state })\n ) : (\n <>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {childrenProp(segment)}\n </Fragment>\n ))}\n </>\n ))}\n </div>\n ),\n [childrenProp, state, provider, classNames?.input],\n );\n\n return (\n <>\n <Group\n ref={ref}\n {...rest}\n className={classNames?.input?.container}\n style={style}\n >\n {children}\n </Group>\n <Input />\n </>\n );\n});\n\nexport const DateSegments = forwardRef(\n (props: DateSegmentsProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { children, classNames: classNamesProp } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Segments component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp),\n [theme.DateInput, classNamesProp],\n );\n\n return (\n <div className={classNames?.input?.segments} ref={ref}>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {children(segment)}\n </Fragment>\n ))}\n </div>\n );\n },\n);\n\nexport const DateSegmentContext =\n createContext<ContextValue<SlotProps, HTMLDivElement>>(null);\n\nexport const DateSegment: FC<DateSegmentProps> = forwardRef(\n function DateSegment(\n props: DateSegmentProps,\n ref: ForwardedRef<HTMLDivElement>,\n ) {\n [props, ref] = useContextProps(props, ref, DateSegmentContext);\n\n const {\n classNames: classNamesProp,\n children: childrenProp,\n ...rest\n } = props;\n\n const classNames = useMemo(\n () => mergeClassNames(dateInputClassNames, classNamesProp),\n [classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: DateSegmentRenderProps) =>\n inlineVars(dateSegmentStateVars, {\n ...renderProps,\n }),\n [],\n );\n\n const children = useCallback(\n (renderProps: DateSegmentRenderProps) => {\n const { isPlaceholder, placeholder, text, value } = renderProps;\n if (typeof childrenProp === 'function') {\n return childrenProp({ ...renderProps, defaultChildren: null });\n }\n\n if (isPlaceholder) {\n return placeholder;\n }\n\n return (\n <div className={classNames?.segment?.segment}>{value ?? text}</div>\n );\n },\n [childrenProp, classNames],\n );\n\n return (\n <RACDateSegment\n ref={ref}\n {...rest}\n style={style}\n className={classNames?.segment?.container}\n >\n {children}\n </RACDateSegment>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-input/index.tsx"],"names":["DateInput","Fragment","DateSegment","RACDateSegment"],"mappings":";;;;;;;;;;;;;AAkDA,IAAM,cAAA,GAAiB;AAAA,EACrB,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAA,EAAK;AAAA,IACjB,EAAA,EAAI,E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,EAAY,cAAA;AAAA,MACZ,QAAA,EAAU,YAAA;AAAA,MACV,GAAG;AAAA,KACL,GAAI,YAAA;AAEJ,IAAA,MAAM,UAAA,GAAa,OAAA;AAAA,MACjB,MAAM,eAAA,CAAgB,mBAAA,EAAqB,cAAc,CAAA;AAAA,MACzD,CAAC,cAAc;AAAA,KACjB;AAEA,IAAA,MAAM,KAAA,GAAQ,WAAA;AAAA,MACZ,CAAC,WAAA,KACC,UAAA,CAAW,oBAAA,EAAsB;AAAA,QAC/B,GAAG;AAAA,OACJ,CAAA;AAAA,MACH;AAAC,KACH;AAEA,IAAA,MAAM,QAAA,GAAW,WAAA;AAAA,MACf,CAAC,WAAA,KAAwC;AACvC,QAAA,MAAM,EAAE,aAAA,EAAe,WAAA,EAAa,IAAA,EAAM,OAAM,GAAI,WAAA;AACpD,QAAA,IAAI,OAAO,iBAAiB,UAAA,EAAY;AACtC,UAAA,OAAO,aAAa,EAAE,GAAG,WAAA,EAAa,eAAA,EAAiB,MAAM,CAAA;AAAA,QAC/D;AAEA,QAAA,IAAI,aAAA,EAAe;AACjB,UAAA,OAAO,WAAA;AAAA,QACT;AAEA,QAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAW,YAAY,OAAA,EAAS,OAAA,EAAU,mBAAS,IAAA,EAAK,CAAA;AAAA,MAEjE,CAAA;AAAA,MACA,CAAC,cAAc,UAAU;AAAA,KAC3B;AAEA,IAAA,uBACE,GAAA;AAAA,MAACC,aAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,UAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QACJ,KAAA;AAAA,QACA,SAAA,EAAW,YAAY,OAAA,EAAS,SAAA;AAAA,QAE/B;AAAA;AAAA,KACH;AAAA,EAEJ;AACF","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n type FC,\n type ForwardedRef,\n Fragment,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n DateFieldStateContext,\n Group,\n DateSegment as RACDateSegment,\n type SlotProps,\n TimeFieldStateContext,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inputs } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { Input } from '../input';\nimport {\n dateInputClassNames,\n dateInputStateVars,\n dateSegmentStateVars,\n} from './date-input.css';\nimport type {\n DateInputProps,\n DateInputRenderProps,\n DateSegmentProps,\n DateSegmentRenderProps,\n DateSegmentsProps,\n} from './types';\n\nconst defaultMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'md' },\n },\n input: {\n sm: inputs.sm,\n lg: inputs.lg,\n },\n};\n\nconst defaultSize = 'lg';\n\nexport const DateInputContext =\n createContext<ContextValue<DateInputProps, HTMLDivElement>>(null);\n\nexport const DateInput = forwardRef(function DateInput(\n props: DateInputProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateInputContext,\n );\n const finalProps = useDefaultProps(contextProps, 'DateInput');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = defaultSize,\n provider,\n ...rest\n } = finalProps;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Input component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp, {\n input: { input: mapping.input[size] },\n }),\n [theme.DateInput, classNamesProp, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: DateInputRenderProps) =>\n inlineVars(dateInputStateVars, { ...renderProps, size }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: DateInputRenderProps) => (\n <div className={classNames?.input?.input}>\n {childrenProp &&\n (provider ? (\n callRenderProps(childrenProp, { ...renderProps, ...state })\n ) : (\n // biome-ignore lint/complexity/noUselessFragments: children group needs to be wrapped\n <>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {childrenProp(segment)}\n </Fragment>\n ))}\n </>\n ))}\n </div>\n ),\n [childrenProp, state, provider, classNames?.input],\n );\n\n return (\n <>\n <Group\n ref={contextRef}\n {...rest}\n className={classNames?.input?.container}\n style={style}\n >\n {children}\n </Group>\n <Input />\n </>\n );\n});\n\nexport const DateSegments = forwardRef(\n (props: DateSegmentsProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { children, classNames: classNamesProp } = props;\n\n const dateFieldState = useContext(DateFieldStateContext);\n const timeFieldState = useContext(TimeFieldStateContext);\n const state = dateFieldState ?? timeFieldState ?? null;\n\n if (!state) {\n throw new Error(\n 'Date Segments component must be used as a child of either DateField or TimeField.',\n );\n }\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dateInputClassNames, theme.DateInput, classNamesProp),\n [theme.DateInput, classNamesProp],\n );\n\n return (\n <div className={classNames?.input?.segments} ref={ref}>\n {state.segments.map((segment, idx) => (\n <Fragment key={`${segment.type}_${idx}`}>\n {children(segment)}\n </Fragment>\n ))}\n </div>\n );\n },\n);\n\nexport const DateSegmentContext =\n createContext<ContextValue<SlotProps, HTMLDivElement>>(null);\n\nexport const DateSegment: FC<DateSegmentProps> = forwardRef(\n function DateSegment(\n props: DateSegmentProps,\n ref: ForwardedRef<HTMLDivElement>,\n ) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DateSegmentContext,\n );\n\n const {\n classNames: classNamesProp,\n children: childrenProp,\n ...rest\n } = contextProps;\n\n const classNames = useMemo(\n () => mergeClassNames(dateInputClassNames, classNamesProp),\n [classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: DateSegmentRenderProps) =>\n inlineVars(dateSegmentStateVars, {\n ...renderProps,\n }),\n [],\n );\n\n const children = useCallback(\n (renderProps: DateSegmentRenderProps) => {\n const { isPlaceholder, placeholder, text, value } = renderProps;\n if (typeof childrenProp === 'function') {\n return childrenProp({ ...renderProps, defaultChildren: null });\n }\n\n if (isPlaceholder) {\n return placeholder;\n }\n\n return (\n <div className={classNames?.segment?.segment}>{value ?? text}</div>\n );\n },\n [childrenProp, classNames],\n );\n\n return (\n <RACDateSegment\n ref={contextRef}\n {...rest}\n style={style}\n className={classNames?.segment?.container}\n >\n {children}\n </RACDateSegment>\n );\n },\n);\n"]}
|
|
@@ -4,41 +4,42 @@ import 'react-aria-components';
|
|
|
4
4
|
import '../../types/props.js';
|
|
5
5
|
import '../../types/react-aria.js';
|
|
6
6
|
import '../button/types.js';
|
|
7
|
+
import '../../types/generic.js';
|
|
7
8
|
import '../icon/types.js';
|
|
8
9
|
import '../group/types.js';
|
|
9
10
|
import '@react-types/shared';
|
|
10
11
|
|
|
11
12
|
declare const dialogContainer: string;
|
|
12
13
|
declare const dialogColorVars: {
|
|
13
|
-
overlay: `var(--${string})
|
|
14
|
+
overlay: `var(--${string})`;
|
|
14
15
|
content: {
|
|
15
|
-
color: `var(--${string})
|
|
16
|
+
color: `var(--${string})`;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
declare const dialogSpaceVars: {
|
|
19
|
-
width: `var(--${string})
|
|
20
|
-
x: `var(--${string})
|
|
21
|
-
y: `var(--${string})
|
|
20
|
+
width: `var(--${string})`;
|
|
21
|
+
x: `var(--${string})`;
|
|
22
|
+
y: `var(--${string})`;
|
|
22
23
|
gap: {
|
|
23
|
-
default: `var(--${string})
|
|
24
|
+
default: `var(--${string})`;
|
|
24
25
|
header: {
|
|
25
|
-
after: `var(--${string})
|
|
26
|
+
after: `var(--${string})`;
|
|
26
27
|
};
|
|
27
28
|
content: {
|
|
28
|
-
before: `var(--${string})
|
|
29
|
+
before: `var(--${string})`;
|
|
29
30
|
};
|
|
30
31
|
footer: {
|
|
31
|
-
before: `var(--${string})
|
|
32
|
+
before: `var(--${string})`;
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
};
|
|
35
36
|
declare const dialogStateVars: {
|
|
36
|
-
hasHeader: `var(--${string})
|
|
37
|
-
size: `var(--${string})
|
|
38
|
-
isEntering: `var(--${string})
|
|
39
|
-
isExiting: `var(--${string})
|
|
40
|
-
isGlobal: `var(--${string})
|
|
41
|
-
isOpen: `var(--${string})
|
|
37
|
+
hasHeader: `var(--${string})`;
|
|
38
|
+
size: `var(--${string})`;
|
|
39
|
+
isEntering: `var(--${string})`;
|
|
40
|
+
isExiting: `var(--${string})`;
|
|
41
|
+
isGlobal: `var(--${string})`;
|
|
42
|
+
isOpen: `var(--${string})`;
|
|
42
43
|
};
|
|
43
44
|
declare const dialogClassNames: DialogClassNames;
|
|
44
45
|
|
|
@@ -5,6 +5,7 @@ import { RenderPropsChildren } from '../../types/react-aria.js';
|
|
|
5
5
|
import { DialogRenderProps, DialogMapping, DialogSizes, DialogProps } from './types.js';
|
|
6
6
|
import '../../types/props.js';
|
|
7
7
|
import '../button/types.js';
|
|
8
|
+
import '../../types/generic.js';
|
|
8
9
|
import '../icon/types.js';
|
|
9
10
|
import '../group/types.js';
|
|
10
11
|
import '@react-types/shared';
|
|
@@ -44,8 +44,8 @@ var defaultMapping = {
|
|
|
44
44
|
};
|
|
45
45
|
var DialogContext = createContext(null);
|
|
46
46
|
var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
47
|
-
[
|
|
48
|
-
|
|
47
|
+
const [contextProps, contextRef] = useContextProps(props, ref, DialogContext);
|
|
48
|
+
const finalProps = useDefaultProps(contextProps, "Dialog");
|
|
49
49
|
const {
|
|
50
50
|
children: childrenProp,
|
|
51
51
|
classNames: classNamesProp,
|
|
@@ -54,7 +54,7 @@ var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
54
54
|
role,
|
|
55
55
|
size = "lg",
|
|
56
56
|
...rest
|
|
57
|
-
} =
|
|
57
|
+
} = finalProps;
|
|
58
58
|
const theme = useTheme();
|
|
59
59
|
const isSSR = useIsSSR();
|
|
60
60
|
const [portal, setPortal] = useState(isSSR ? null : document.body);
|
|
@@ -171,12 +171,14 @@ var Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
171
171
|
setPortal(isSSR ? null : document.body);
|
|
172
172
|
};
|
|
173
173
|
}, [isSSR, parentRef, classNames?.portal]);
|
|
174
|
-
if (!portal)
|
|
174
|
+
if (!portal) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
175
177
|
return /* @__PURE__ */ jsx(
|
|
176
178
|
ModalOverlay,
|
|
177
179
|
{
|
|
178
180
|
...rest,
|
|
179
|
-
ref,
|
|
181
|
+
ref: contextRef,
|
|
180
182
|
className: classNames?.container,
|
|
181
183
|
style,
|
|
182
184
|
UNSTABLE_portalContainer: portal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["Dialog","RACDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,IAAM,WAAA,GAA6B,CAAC,IAAA,EAAM,IAAI,CAAA;AAE9C,IAAM,cAAA,GAAgC;AAAA,EACpC,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA,EAAG;AAAA,IAC7B,EAAA,EAAI,EAAE,SAAA,EAAW,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Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useIsSSR } from '@react-aria/ssr';\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Modal,\n ModalOverlay,\n type ModalRenderProps,\n Provider,\n Dialog as RACDialog,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { headings } from '../../styles/typography.css';\nimport type { OmitProtectedProps } from '../../types/props';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport type { ButtonProps } from '../button/types';\nimport { ElementContext } from '../element';\nimport type { ElementProps } from '../element/types';\nimport { GroupContext } from '../group';\nimport type { GroupProps } from '../group/types';\nimport { dialogClassNames, dialogStateVars } from './dialog.css';\nimport type { DialogMapping, DialogProps, DialogSizes } from './types';\n\nconst dialogSizes: DialogSizes[] = ['sm', 'lg'];\n\nconst defaultMapping: DialogMapping = {\n heading: {\n sm: { className: headings.v4 },\n lg: { className: headings.v2 },\n },\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n close: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size, variant: 'bare' };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n};\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DialogContext);\n props = useDefaultProps(props, 'Dialog');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n parentRef,\n role,\n size = 'lg',\n ...rest\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n const isGlobal = useMemo(\n () => !isSSR && portal === document.body,\n [isSSR, portal],\n );\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {\n container: isGlobal ? theme.className : undefined,\n }),\n [theme.Dialog, classNamesProp, isGlobal, theme.className],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n ({ state, ...renderProps }: ModalRenderProps) => ({\n ...(isGlobal ? theme.style : {}),\n ...inlineVars(dialogStateVars, {\n hasHeader,\n size,\n ...renderProps,\n isGlobal,\n }),\n }),\n [size, theme.style, isGlobal, hasHeader],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>,\n ContextValue<\n GroupProps<ButtonProps, HTMLButtonElement>,\n HTMLDivElement\n >\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header,\n ref: headerRef,\n values: [\n [\n AriaHeadingContext,\n {\n ...mapping.heading[size],\n slot: 'title',\n },\n ],\n [GroupContext, null],\n ],\n },\n content: { className: classNames?.content },\n footer: {\n as: 'footer',\n className: classNames?.footer,\n values: [\n [AriaHeadingContext, null],\n [\n GroupContext,\n {\n values: {\n slots: {\n [DEFAULT_SLOT]: mapping.primary[size] ?? {},\n close: mapping.close[size] ?? {},\n },\n },\n ...mapping.actions,\n },\n ],\n ],\n },\n },\n },\n ],\n ],\n [\n classNames?.header,\n classNames?.content,\n classNames?.footer,\n headerRef,\n mapping.actions,\n mapping.heading,\n mapping.primary,\n mapping.close,\n size,\n ],\n );\n\n const children = useCallback(\n (renderProps: ModalRenderProps) => (\n <Provider values={values}>\n <Modal className={classNames?.modal}>\n <RACDialog className={classNames?.dialog} role={role}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n isGlobal,\n isOpen: renderProps.state.isOpen,\n })}\n </RACDialog>\n </Modal>\n </Provider>\n ),\n [\n values,\n classNames?.modal,\n classNames?.dialog,\n role,\n childrenProp,\n isGlobal,\n ],\n );\n\n useEffect(() => {\n const node = parentRef?.current;\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n port.classList.add(classNames?.portal ?? '');\n\n node.appendChild(port);\n\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef, classNames?.portal]);\n\n if (!portal) return null;\n\n return (\n <ModalOverlay\n {...rest}\n ref={ref}\n className={classNames?.container}\n style={style}\n UNSTABLE_portalContainer={portal}\n >\n {children}\n </ModalOverlay>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["Dialog","RACDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,IAAM,WAAA,GAA6B,CAAC,IAAA,EAAM,IAAI,CAAA;AAE9C,IAAM,cAAA,GAAgC;AAAA,EACpC,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,EAAE,SAAA,EAAW,QAAA,CAAS,EAAA,EAAG;AAAA,IAC7B,EA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,MAAA;AAAA,MAEzB;AAAA;AAAA,GACH;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useIsSSR } from '@react-aria/ssr';\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Modal,\n ModalOverlay,\n type ModalRenderProps,\n Provider,\n Dialog as RACDialog,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport { callRenderProps, mergeClassNames } from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport { ElementContext } from '../element';\nimport { GroupContext } from '../group';\nimport { dialogClassNames, dialogStateVars } from './dialog.css';\nimport type { OmitProtectedProps } from '../../types/props';\nimport type { ButtonProps } from '../button/types';\nimport type { ElementProps } from '../element/types';\nimport type { GroupProps } from '../group/types';\nimport type { DialogMapping, DialogProps, DialogSizes } from './types';\n\nconst dialogSizes: DialogSizes[] = ['sm', 'lg'];\n\nconst defaultMapping: DialogMapping = {\n heading: {\n sm: { className: headings.v4 },\n lg: { className: headings.v2 },\n },\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n close: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size, variant: 'bare' };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n};\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, DialogContext);\n const finalProps = useDefaultProps(contextProps, 'Dialog');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n parentRef,\n role,\n size = 'lg',\n ...rest\n } = finalProps;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n const isGlobal = useMemo(\n () => !isSSR && portal === document.body,\n [isSSR, portal],\n );\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {\n container: isGlobal ? theme.className : undefined,\n }),\n [theme.Dialog, classNamesProp, isGlobal, theme.className],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n ({ state, ...renderProps }: ModalRenderProps) => ({\n ...(isGlobal ? theme.style : {}),\n ...inlineVars(dialogStateVars, {\n hasHeader,\n size,\n ...renderProps,\n isGlobal,\n }),\n }),\n [size, theme.style, isGlobal, hasHeader],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>,\n ContextValue<\n GroupProps<ButtonProps, HTMLButtonElement>,\n HTMLDivElement\n >\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header,\n ref: headerRef,\n values: [\n [\n AriaHeadingContext,\n {\n ...mapping.heading[size],\n slot: 'title',\n },\n ],\n [GroupContext, null],\n ],\n },\n content: { className: classNames?.content },\n footer: {\n as: 'footer',\n className: classNames?.footer,\n values: [\n [AriaHeadingContext, null],\n [\n GroupContext,\n {\n values: {\n slots: {\n [DEFAULT_SLOT]: mapping.primary[size] ?? {},\n close: mapping.close[size] ?? {},\n },\n },\n ...mapping.actions,\n },\n ],\n ],\n },\n },\n },\n ],\n ],\n [\n classNames?.header,\n classNames?.content,\n classNames?.footer,\n headerRef,\n mapping.actions,\n mapping.heading,\n mapping.primary,\n mapping.close,\n size,\n ],\n );\n\n const children = useCallback(\n (renderProps: ModalRenderProps) => (\n <Provider values={values}>\n <Modal className={classNames?.modal}>\n <RACDialog className={classNames?.dialog} role={role}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n isGlobal,\n isOpen: renderProps.state.isOpen,\n })}\n </RACDialog>\n </Modal>\n </Provider>\n ),\n [\n values,\n classNames?.modal,\n classNames?.dialog,\n role,\n childrenProp,\n isGlobal,\n ],\n );\n\n useEffect(() => {\n const node = parentRef?.current;\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n port.classList.add(classNames?.portal ?? '');\n\n node.appendChild(port);\n\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef, classNames?.portal]);\n\n if (!portal) {\n return null;\n }\n\n return (\n <ModalOverlay\n {...rest}\n ref={contextRef}\n className={classNames?.container}\n style={style}\n UNSTABLE_portalContainer={portal}\n >\n {children}\n </ModalOverlay>\n );\n});\n"]}
|
|
@@ -4,6 +4,7 @@ import { OmitProtectedProps } from '../../types/props.js';
|
|
|
4
4
|
import { RenderPropsChildren } from '../../types/react-aria.js';
|
|
5
5
|
import { ButtonProps } from '../button/types.js';
|
|
6
6
|
import { GroupProps } from '../group/types.js';
|
|
7
|
+
import '../../types/generic.js';
|
|
7
8
|
import '../icon/types.js';
|
|
8
9
|
import '@react-types/shared';
|
|
9
10
|
|
|
@@ -8,40 +8,40 @@ import '../../types/props.js';
|
|
|
8
8
|
import '../../types/react-aria.js';
|
|
9
9
|
import '../button/types.js';
|
|
10
10
|
import 'react-aria-components';
|
|
11
|
+
import '../../types/generic.js';
|
|
11
12
|
import '../icon/types.js';
|
|
12
13
|
import '../tabs/types.js';
|
|
13
|
-
import '../../types/generic.js';
|
|
14
14
|
|
|
15
15
|
declare const drawerContainer: string;
|
|
16
16
|
declare const drawerAnimationVars: {
|
|
17
|
-
delay: `var(--${string})
|
|
18
|
-
duration: `var(--${string})
|
|
19
|
-
easing: `var(--${string})
|
|
17
|
+
delay: `var(--${string})`;
|
|
18
|
+
duration: `var(--${string})`;
|
|
19
|
+
easing: `var(--${string})`;
|
|
20
20
|
};
|
|
21
21
|
declare const drawerColorVars: {
|
|
22
|
-
background: `var(--${string})
|
|
23
|
-
color: `var(--${string})
|
|
22
|
+
background: `var(--${string})`;
|
|
23
|
+
color: `var(--${string})`;
|
|
24
24
|
};
|
|
25
25
|
declare const drawerSpaceVars: {
|
|
26
26
|
drawer: {
|
|
27
|
-
width: `var(--${string})
|
|
28
|
-
gap: `var(--${string})
|
|
29
|
-
x: `var(--${string})
|
|
30
|
-
y: `var(--${string})
|
|
27
|
+
width: `var(--${string})`;
|
|
28
|
+
gap: `var(--${string})`;
|
|
29
|
+
x: `var(--${string})`;
|
|
30
|
+
y: `var(--${string})`;
|
|
31
31
|
};
|
|
32
32
|
list: {
|
|
33
|
-
top: `var(--${string})
|
|
34
|
-
translateY: `var(--${string})
|
|
33
|
+
top: `var(--${string})`;
|
|
34
|
+
translateY: `var(--${string})`;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
declare const drawerStateVars: {
|
|
38
|
-
anchor: `var(--${string})
|
|
39
|
-
layoutShift: `var(--${string})
|
|
40
|
-
isChild: `var(--${string})
|
|
41
|
-
isOpen: `var(--${string})
|
|
38
|
+
anchor: `var(--${string})`;
|
|
39
|
+
layoutShift: `var(--${string})`;
|
|
40
|
+
isChild: `var(--${string})`;
|
|
41
|
+
isOpen: `var(--${string})`;
|
|
42
42
|
};
|
|
43
43
|
declare const drawerDialogStateVars: {
|
|
44
|
-
isChild: `var(--${string})
|
|
44
|
+
isChild: `var(--${string})`;
|
|
45
45
|
};
|
|
46
46
|
declare const drawerClassNames: DrawerClassNames;
|
|
47
47
|
|
|
@@ -9,9 +9,9 @@ import 'type-fest';
|
|
|
9
9
|
import '../../types/props.js';
|
|
10
10
|
import '../../types/react-aria.js';
|
|
11
11
|
import '../button/types.js';
|
|
12
|
+
import '../../types/generic.js';
|
|
12
13
|
import '../icon/types.js';
|
|
13
14
|
import '../tabs/types.js';
|
|
14
|
-
import '../../types/generic.js';
|
|
15
15
|
|
|
16
16
|
declare function Drawer(props: DrawerProps): react_jsx_runtime.JSX.Element;
|
|
17
17
|
declare function DrawerTabList<T extends object>(props: DrawerTabListProps<T>): react_jsx_runtime.JSX.Element;
|