@accelint/design-system 0.8.1 → 0.9.0
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 +32 -3
- package/dist/components/aria/index.js +36 -1
- package/dist/components/aria/index.js.map +1 -1
- package/dist/components/button/index.d.ts +45 -6
- package/dist/components/button/index.js +105 -3
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +28 -7
- package/dist/components/checkbox/index.js +124 -3
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +36 -6
- package/dist/components/chip/index.js +171 -3
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/collection/index.d.ts +16 -5
- package/dist/components/collection/index.js +19 -1
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +13 -5
- package/dist/components/combo-box/index.js +116 -3
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +13 -5
- package/dist/components/date-field/index.js +106 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-input/index.d.ts +19 -7
- package/dist/components/date-input/index.js +134 -2
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +24 -6
- package/dist/components/dialog/index.js +187 -3
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.d.ts +19 -7
- package/dist/components/drawer/index.js +306 -3
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/element/index.d.ts +15 -4
- package/dist/components/element/index.js +21 -2
- package/dist/components/element/index.js.map +1 -1
- package/dist/components/group/index.d.ts +15 -5
- package/dist/components/group/index.js +60 -3
- package/dist/components/group/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +17 -5
- package/dist/components/icon/index.js +39 -3
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/index.d.ts +35 -35
- package/dist/components/index.js +58 -28
- package/dist/components/input/index.d.ts +12 -5
- package/dist/components/input/index.js +141 -3
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +29 -5
- package/dist/components/menu/index.js +253 -3
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/merge-provider/index.d.ts +18 -3
- package/dist/components/merge-provider/index.js +43 -2
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +14 -6
- package/dist/components/number-field/index.js +127 -2
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/number-field/number-field.css.d.ts +1 -1
- package/dist/components/number-field/types.d.ts +1 -1
- package/dist/components/options/index.d.ts +25 -5
- package/dist/components/options/index.js +254 -3
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.d.ts +23 -5
- package/dist/components/picker/index.js +113 -3
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +14 -6
- package/dist/components/popover/index.js +140 -3
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/query-builder/group.js +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.d.ts +7 -7
- package/dist/components/query-builder/index.js +198 -5
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/rule.js +1 -1
- package/dist/components/query-builder/rule.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.d.ts +22 -6
- package/dist/components/radio/index.js +114 -3
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +15 -6
- package/dist/components/search-field/index.js +92 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.d.ts +13 -5
- package/dist/components/select/index.js +109 -3
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +41 -7
- package/dist/components/slider/index.js +232 -3
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.css.d.ts +1 -1
- package/dist/components/slider/types.d.ts +1 -1
- package/dist/components/switch/index.d.ts +9 -5
- package/dist/components/switch/index.js +60 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +74 -7
- package/dist/components/tabs/index.js +259 -3
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +61 -6
- package/dist/components/text-field/index.js +93 -2
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/textarea/index.d.ts +18 -5
- package/dist/components/textarea/index.js +134 -3
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +14 -6
- package/dist/components/time-field/index.js +103 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +29 -6
- package/dist/components/tooltip/index.js +112 -3
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +17 -5
- package/dist/components/tree/index.js +491 -3
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/utils.js.map +1 -1
- package/dist/hooks/index.d.ts +12 -12
- package/dist/hooks/use-collection-render/index.d.ts +11 -3
- package/dist/hooks/use-collection-render/index.js +25 -1
- package/dist/hooks/use-collection-render/index.js.map +1 -1
- package/dist/hooks/use-context-props/index.d.ts +10 -3
- package/dist/hooks/use-context-props/index.js +15 -1
- package/dist/hooks/use-context-props/index.js.map +1 -1
- package/dist/hooks/use-defaults/index.d.ts +99 -31
- package/dist/hooks/use-defaults/index.js +33 -2
- package/dist/hooks/use-defaults/index.js.map +1 -1
- package/dist/hooks/use-defaults/types.d.ts +6 -6
- package/dist/hooks/use-propagating-press/index.d.ts +13 -2
- package/dist/hooks/use-propagating-press/index.js +19 -1
- package/dist/hooks/use-propagating-press/index.js.map +1 -1
- package/dist/hooks/use-slot/index.d.ts +16 -2
- package/dist/hooks/use-slot/index.js +18 -1
- package/dist/hooks/use-slot/index.js.map +1 -1
- package/dist/hooks/use-theme/index.d.ts +37 -8
- package/dist/hooks/use-theme/index.js +105 -2
- package/dist/hooks/use-theme/index.js.map +1 -1
- package/dist/hooks/use-theme/types.d.ts +2 -2
- package/dist/hooks/use-tree/index.d.ts +5 -2
- package/dist/hooks/use-tree/index.js +259 -1
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-tree/utils.js.map +1 -1
- package/dist/hooks/use-update-effect/index.d.ts +3 -1
- package/dist/hooks/use-update-effect/index.js +20 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.css +119 -119
- package/dist/index.d.ts +47 -47
- package/dist/ladle/actions.js.map +1 -1
- package/dist/styles/layers.css.d.ts +3 -3
- package/dist/styles/surfaces.css.d.ts +1 -1
- package/dist/test/setup.js +78 -8
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/{css.d.ts → css/index.d.ts} +2 -2
- package/dist/utils/{css.js → css/index.js} +5 -5
- package/dist/utils/css/index.js.map +1 -0
- package/dist/utils/events/index.js +10 -0
- package/dist/utils/events/index.js.map +1 -0
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.js +4 -4
- package/dist/utils/{props.d.ts → props/index.d.ts} +2 -2
- package/dist/utils/{props.js → props/index.js} +3 -3
- package/dist/utils/props/index.js.map +1 -0
- package/dist/utils/{validators.d.ts → validators/index.d.ts} +1 -1
- package/dist/utils/{validators.js → validators/index.js} +3 -3
- package/dist/utils/validators/index.js.map +1 -0
- package/dist/vanilla.d.ts +1 -1
- package/dist/vanilla.js +1 -1
- package/package.json +7 -8
- package/dist/components/aria/aria.d.ts +0 -32
- package/dist/components/aria/aria.js +0 -39
- package/dist/components/aria/aria.js.map +0 -1
- package/dist/components/button/button.d.ts +0 -47
- package/dist/components/button/button.js +0 -104
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/checkbox/checkbox.d.ts +0 -30
- package/dist/components/checkbox/checkbox.js +0 -123
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/chip/chip.d.ts +0 -41
- package/dist/components/chip/chip.js +0 -171
- package/dist/components/chip/chip.js.map +0 -1
- package/dist/components/collection/collection.d.ts +0 -17
- package/dist/components/collection/collection.js +0 -22
- package/dist/components/collection/collection.js.map +0 -1
- package/dist/components/combo-box/combo-box.d.ts +0 -21
- package/dist/components/combo-box/combo-box.js +0 -116
- package/dist/components/combo-box/combo-box.js.map +0 -1
- package/dist/components/date-field/date-field.d.ts +0 -20
- package/dist/components/date-field/date-field.js +0 -106
- package/dist/components/date-field/date-field.js.map +0 -1
- package/dist/components/date-input/date-input.d.ts +0 -42
- package/dist/components/date-input/date-input.js +0 -128
- package/dist/components/date-input/date-input.js.map +0 -1
- package/dist/components/dialog/dialog.d.ts +0 -29
- package/dist/components/dialog/dialog.js +0 -186
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/drawer/drawer.d.ts +0 -28
- package/dist/components/drawer/drawer.js +0 -305
- package/dist/components/drawer/drawer.js.map +0 -1
- package/dist/components/element/element.d.ts +0 -16
- package/dist/components/element/element.js +0 -24
- package/dist/components/element/element.js.map +0 -1
- package/dist/components/group/group.d.ts +0 -16
- package/dist/components/group/group.js +0 -61
- package/dist/components/group/group.js.map +0 -1
- package/dist/components/icon/icon.d.ts +0 -17
- package/dist/components/icon/icon.js +0 -39
- package/dist/components/icon/icon.js.map +0 -1
- package/dist/components/input/input.d.ts +0 -13
- package/dist/components/input/input.js +0 -141
- package/dist/components/input/input.js.map +0 -1
- package/dist/components/menu/menu.d.ts +0 -32
- package/dist/components/menu/menu.js +0 -252
- package/dist/components/menu/menu.js.map +0 -1
- package/dist/components/merge-provider/merge-provider.d.ts +0 -20
- package/dist/components/merge-provider/merge-provider.js +0 -46
- package/dist/components/merge-provider/merge-provider.js.map +0 -1
- package/dist/components/number-field/number-field.d.ts +0 -20
- package/dist/components/number-field/number-field.js +0 -125
- package/dist/components/number-field/number-field.js.map +0 -1
- package/dist/components/options/options.d.ts +0 -28
- package/dist/components/options/options.js +0 -253
- package/dist/components/options/options.js.map +0 -1
- package/dist/components/picker/picker.d.ts +0 -24
- package/dist/components/picker/picker.js +0 -113
- package/dist/components/picker/picker.js.map +0 -1
- package/dist/components/popover/popover.d.ts +0 -22
- package/dist/components/popover/popover.js +0 -139
- package/dist/components/popover/popover.js.map +0 -1
- package/dist/components/query-builder/query-builder.d.ts +0 -23
- package/dist/components/query-builder/query-builder.js +0 -200
- package/dist/components/query-builder/query-builder.js.map +0 -1
- package/dist/components/radio/radio.d.ts +0 -23
- package/dist/components/radio/radio.js +0 -114
- package/dist/components/radio/radio.js.map +0 -1
- package/dist/components/search-field/search-field.d.ts +0 -21
- package/dist/components/search-field/search-field.js +0 -92
- package/dist/components/search-field/search-field.js.map +0 -1
- package/dist/components/select/select.d.ts +0 -20
- package/dist/components/select/select.js +0 -109
- package/dist/components/select/select.js.map +0 -1
- package/dist/components/slider/slider.d.ts +0 -49
- package/dist/components/slider/slider.js +0 -230
- package/dist/components/slider/slider.js.map +0 -1
- package/dist/components/switch/switch.d.ts +0 -10
- package/dist/components/switch/switch.js +0 -60
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/tabs/tabs.d.ts +0 -75
- package/dist/components/tabs/tabs.js +0 -258
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/text-field/text-field.d.ts +0 -64
- package/dist/components/text-field/text-field.js +0 -92
- package/dist/components/text-field/text-field.js.map +0 -1
- package/dist/components/textarea/textarea.d.ts +0 -19
- package/dist/components/textarea/textarea.js +0 -134
- package/dist/components/textarea/textarea.js.map +0 -1
- package/dist/components/time-field/time-field.d.ts +0 -21
- package/dist/components/time-field/time-field.js +0 -106
- package/dist/components/time-field/time-field.js.map +0 -1
- package/dist/components/tooltip/tooltip.d.ts +0 -30
- package/dist/components/tooltip/tooltip.js +0 -112
- package/dist/components/tooltip/tooltip.js.map +0 -1
- package/dist/components/tree/tree.d.ts +0 -29
- package/dist/components/tree/tree.js +0 -491
- package/dist/components/tree/tree.js.map +0 -1
- package/dist/hooks/use-collection-render/use-collection-render.d.ts +0 -11
- package/dist/hooks/use-collection-render/use-collection-render.js +0 -28
- package/dist/hooks/use-collection-render/use-collection-render.js.map +0 -1
- package/dist/hooks/use-context-props/use-context-props.d.ts +0 -10
- package/dist/hooks/use-context-props/use-context-props.js +0 -18
- package/dist/hooks/use-context-props/use-context-props.js.map +0 -1
- package/dist/hooks/use-defaults/use-defaults.d.ts +0 -110
- package/dist/hooks/use-defaults/use-defaults.js +0 -36
- package/dist/hooks/use-defaults/use-defaults.js.map +0 -1
- package/dist/hooks/use-propagating-press/use-propagating-press.d.ts +0 -13
- package/dist/hooks/use-propagating-press/use-propagating-press.js +0 -21
- package/dist/hooks/use-propagating-press/use-propagating-press.js.map +0 -1
- package/dist/hooks/use-slot/use-slot.d.ts +0 -16
- package/dist/hooks/use-slot/use-slot.js +0 -21
- package/dist/hooks/use-slot/use-slot.js.map +0 -1
- package/dist/hooks/use-theme/use-theme.d.ts +0 -77
- package/dist/hooks/use-theme/use-theme.js +0 -108
- package/dist/hooks/use-theme/use-theme.js.map +0 -1
- package/dist/hooks/use-tree/use-tree.d.ts +0 -7
- package/dist/hooks/use-tree/use-tree.js +0 -262
- package/dist/hooks/use-tree/use-tree.js.map +0 -1
- package/dist/hooks/use-update-effect/use-update-effect.d.ts +0 -3
- package/dist/hooks/use-update-effect/use-update-effect.js +0 -23
- package/dist/hooks/use-update-effect/use-update-effect.js.map +0 -1
- package/dist/utils/css.js.map +0 -1
- package/dist/utils/events.js +0 -10
- package/dist/utils/events.js.map +0 -1
- package/dist/utils/props.js.map +0 -1
- package/dist/utils/validators.js.map +0 -1
- /package/dist/utils/{events.d.ts → events/index.d.ts} +0 -0
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import '../../chunk-PZ5AY32C.js';
|
|
2
|
-
import { toBoolean } from '@accelint/converters';
|
|
3
|
-
import { noop } from '@accelint/core';
|
|
4
|
-
import { useFocusWithin } from '@react-aria/interactions';
|
|
5
|
-
import { useOverlay } from '@react-aria/overlays';
|
|
6
|
-
import { useIsSSR } from '@react-aria/ssr';
|
|
7
|
-
import { useOverlayTriggerState } from '@react-stately/overlays';
|
|
8
|
-
import { createContext, forwardRef, useContext, useMemo, useCallback, useRef } from 'react';
|
|
9
|
-
import { DEFAULT_SLOT, Provider } from 'react-aria-components';
|
|
10
|
-
import { useContextProps, useSlot, useTheme, useDefaultProps } from '../../hooks/index.js';
|
|
11
|
-
import { headings } from '../../styles/index.js';
|
|
12
|
-
import { mergeClassNames, inlineVars, callRenderProps, mergeProps } from '../../utils/index.js';
|
|
13
|
-
import { AriaHeadingContext } from '../aria/index.js';
|
|
14
|
-
import { ButtonContext } from '../button/index.js';
|
|
15
|
-
import { ElementContext } from '../element/index.js';
|
|
16
|
-
import { Tabs, TabList, Tab } from '../tabs/index.js';
|
|
17
|
-
import { TooltipContext, TooltipTargetContext } from '../tooltip/index.js';
|
|
18
|
-
import { drawerClassNames, drawerDialogStateVars, drawerStateVars } from './drawer.css.js';
|
|
19
|
-
import { jsx } from 'react/jsx-runtime';
|
|
20
|
-
|
|
21
|
-
var DrawerContext = createContext({
|
|
22
|
-
anchor: "right",
|
|
23
|
-
layoutShift: false,
|
|
24
|
-
isOpen: false,
|
|
25
|
-
close: noop,
|
|
26
|
-
open: noop,
|
|
27
|
-
setOpen: noop,
|
|
28
|
-
toggle: noop
|
|
29
|
-
});
|
|
30
|
-
function Drawer(props) {
|
|
31
|
-
props = useDefaultProps(props, "Drawer");
|
|
32
|
-
const {
|
|
33
|
-
children: childrenProp,
|
|
34
|
-
classNames: classNamesProp,
|
|
35
|
-
anchor = "right",
|
|
36
|
-
defaultOpen = false,
|
|
37
|
-
layoutShift = false,
|
|
38
|
-
shouldCloseOnBlur = false,
|
|
39
|
-
isDismissable = true,
|
|
40
|
-
isKeyboardDismissDisabled = false,
|
|
41
|
-
isOpen: isOpenProp,
|
|
42
|
-
onOpenChange,
|
|
43
|
-
...rest
|
|
44
|
-
} = props;
|
|
45
|
-
const theme = useTheme();
|
|
46
|
-
const isSSR = useIsSSR();
|
|
47
|
-
const classNames = useMemo(
|
|
48
|
-
() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),
|
|
49
|
-
[theme.Drawer, classNamesProp]
|
|
50
|
-
);
|
|
51
|
-
const handleOpenChange = useCallback(
|
|
52
|
-
(isOpen2) => {
|
|
53
|
-
if (!isOpen2) {
|
|
54
|
-
const focused = isSSR ? null : document.activeElement;
|
|
55
|
-
if (focused && "blur" in focused && typeof focused.blur === "function") {
|
|
56
|
-
focused.blur();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
onOpenChange?.(isOpen2);
|
|
60
|
-
},
|
|
61
|
-
[isSSR, onOpenChange]
|
|
62
|
-
);
|
|
63
|
-
const state = useOverlayTriggerState({
|
|
64
|
-
defaultOpen,
|
|
65
|
-
isOpen: isOpenProp,
|
|
66
|
-
onOpenChange: handleOpenChange
|
|
67
|
-
});
|
|
68
|
-
const { isOpen, close, open } = state;
|
|
69
|
-
const ref = useRef(null);
|
|
70
|
-
const { overlayProps } = useOverlay(
|
|
71
|
-
{
|
|
72
|
-
isOpen,
|
|
73
|
-
shouldCloseOnBlur,
|
|
74
|
-
isDismissable,
|
|
75
|
-
isKeyboardDismissDisabled,
|
|
76
|
-
onClose: close
|
|
77
|
-
},
|
|
78
|
-
ref
|
|
79
|
-
);
|
|
80
|
-
const { focusWithinProps } = useFocusWithin({
|
|
81
|
-
onFocusWithin: open
|
|
82
|
-
});
|
|
83
|
-
const context = useMemo(
|
|
84
|
-
() => ({ ...state, anchor, layoutShift }),
|
|
85
|
-
[state, anchor, layoutShift]
|
|
86
|
-
);
|
|
87
|
-
const values = useMemo(
|
|
88
|
-
() => [
|
|
89
|
-
[DrawerContext, context],
|
|
90
|
-
[DrawerDialogContext, { classNames }]
|
|
91
|
-
],
|
|
92
|
-
[context, classNames]
|
|
93
|
-
);
|
|
94
|
-
const style = useMemo(
|
|
95
|
-
() => inlineVars(drawerStateVars, {
|
|
96
|
-
anchor,
|
|
97
|
-
layoutShift,
|
|
98
|
-
isOpen
|
|
99
|
-
}),
|
|
100
|
-
[anchor, layoutShift, isOpen]
|
|
101
|
-
);
|
|
102
|
-
const children = useMemo(
|
|
103
|
-
() => callRenderProps(childrenProp, state),
|
|
104
|
-
[childrenProp, state]
|
|
105
|
-
);
|
|
106
|
-
return /* @__PURE__ */ jsx(Provider, { values, children: /* @__PURE__ */ jsx(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
...mergeProps(overlayProps, focusWithinProps),
|
|
110
|
-
ref,
|
|
111
|
-
className: classNames?.container,
|
|
112
|
-
style,
|
|
113
|
-
children: /* @__PURE__ */ jsx(Tabs, { classNames: classNames?.tabs, ...rest, children })
|
|
114
|
-
}
|
|
115
|
-
) });
|
|
116
|
-
}
|
|
117
|
-
function DrawerTabList(props) {
|
|
118
|
-
props = useDefaultProps(props, "DrawerTabList");
|
|
119
|
-
const { children, classNames: classNamesProp, variant = "fill" } = props;
|
|
120
|
-
const { anchor } = useContext(DrawerContext);
|
|
121
|
-
const theme = useTheme();
|
|
122
|
-
const classNames = useMemo(
|
|
123
|
-
() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),
|
|
124
|
-
[theme.Drawer, classNamesProp]
|
|
125
|
-
);
|
|
126
|
-
const values = useMemo(
|
|
127
|
-
() => [
|
|
128
|
-
[TooltipContext, { placement: anchor === "left" ? "right" : "left" }],
|
|
129
|
-
[TooltipTargetContext, { focusable: false, relative: "parent" }]
|
|
130
|
-
],
|
|
131
|
-
[anchor]
|
|
132
|
-
);
|
|
133
|
-
return /* @__PURE__ */ jsx(Provider, { values, children: /* @__PURE__ */ jsx(
|
|
134
|
-
TabList,
|
|
135
|
-
{
|
|
136
|
-
classNames: classNames?.tabs,
|
|
137
|
-
align: "center",
|
|
138
|
-
anchor: anchor === "left" ? "start" : "end",
|
|
139
|
-
orientation: "vertical",
|
|
140
|
-
variant,
|
|
141
|
-
children
|
|
142
|
-
}
|
|
143
|
-
) });
|
|
144
|
-
}
|
|
145
|
-
function DrawerTab(props) {
|
|
146
|
-
props = useDefaultProps(props, "DrawerTab");
|
|
147
|
-
const { children: childrenProp, classNames: classNamesProp, ...rest } = props;
|
|
148
|
-
const { isOpen, open, toggle } = useContext(DrawerContext);
|
|
149
|
-
const theme = useTheme();
|
|
150
|
-
const classNames = useMemo(
|
|
151
|
-
() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),
|
|
152
|
-
[theme.Drawer, classNamesProp]
|
|
153
|
-
);
|
|
154
|
-
const handlePressStart = useCallback(
|
|
155
|
-
(event) => {
|
|
156
|
-
const { selected } = event.target.parentElement?.dataset ?? {};
|
|
157
|
-
if (toBoolean(selected)) {
|
|
158
|
-
toggle();
|
|
159
|
-
} else {
|
|
160
|
-
open();
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
[open, toggle]
|
|
164
|
-
);
|
|
165
|
-
const children = useCallback(
|
|
166
|
-
(renderProps) => callRenderProps(childrenProp, { ...renderProps, isOpen }),
|
|
167
|
-
[childrenProp, isOpen]
|
|
168
|
-
);
|
|
169
|
-
return /* @__PURE__ */ jsx(
|
|
170
|
-
Tab,
|
|
171
|
-
{
|
|
172
|
-
...rest,
|
|
173
|
-
classNames: classNames?.tabs,
|
|
174
|
-
onPressStart: handlePressStart,
|
|
175
|
-
children
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
var defaultMapping = {
|
|
180
|
-
heading: {
|
|
181
|
-
child: headings.v4,
|
|
182
|
-
parent: headings.v3
|
|
183
|
-
},
|
|
184
|
-
back: {
|
|
185
|
-
variant: "icon"
|
|
186
|
-
},
|
|
187
|
-
close: {
|
|
188
|
-
variant: "icon"
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
var DrawerDialogContext = createContext(null);
|
|
192
|
-
var DrawerDialog = forwardRef(function DrawerDialog2(props, ref) {
|
|
193
|
-
[props, ref] = useContextProps(props, ref, DrawerDialogContext);
|
|
194
|
-
const {
|
|
195
|
-
children,
|
|
196
|
-
classNames: classNamesProp,
|
|
197
|
-
mapping: mappingProp,
|
|
198
|
-
"aria-label": ariaLabel,
|
|
199
|
-
"aria-labelledby": ariaLabelledBy,
|
|
200
|
-
...rest
|
|
201
|
-
} = props;
|
|
202
|
-
const { close } = useContext(DrawerContext);
|
|
203
|
-
const [backRef, hasBack] = useSlot();
|
|
204
|
-
const [titleRef, hasTitle] = useSlot();
|
|
205
|
-
const theme = useTheme();
|
|
206
|
-
const mapping = useMemo(
|
|
207
|
-
() => ({ ...defaultMapping, ...mappingProp }),
|
|
208
|
-
[mappingProp]
|
|
209
|
-
);
|
|
210
|
-
const classNames = useMemo(
|
|
211
|
-
() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {
|
|
212
|
-
header: {
|
|
213
|
-
title: hasBack ? mapping.heading.child : mapping.heading.parent
|
|
214
|
-
}
|
|
215
|
-
}),
|
|
216
|
-
[theme.Drawer, classNamesProp, hasBack, mapping]
|
|
217
|
-
);
|
|
218
|
-
const style = useMemo(
|
|
219
|
-
() => inlineVars(drawerDialogStateVars, {
|
|
220
|
-
isChild: !!hasBack
|
|
221
|
-
}),
|
|
222
|
-
[hasBack]
|
|
223
|
-
);
|
|
224
|
-
const values = useMemo(
|
|
225
|
-
() => [
|
|
226
|
-
[
|
|
227
|
-
ElementContext,
|
|
228
|
-
{
|
|
229
|
-
slots: {
|
|
230
|
-
[DEFAULT_SLOT]: {},
|
|
231
|
-
header: {
|
|
232
|
-
as: "header",
|
|
233
|
-
className: classNames?.header?.header,
|
|
234
|
-
values: [
|
|
235
|
-
[
|
|
236
|
-
ButtonContext,
|
|
237
|
-
{
|
|
238
|
-
slots: {
|
|
239
|
-
[DEFAULT_SLOT]: {},
|
|
240
|
-
back: {
|
|
241
|
-
...mapping.back,
|
|
242
|
-
ref: backRef,
|
|
243
|
-
classNames: classNames?.header?.back
|
|
244
|
-
},
|
|
245
|
-
close: {
|
|
246
|
-
...mapping.close,
|
|
247
|
-
classNames: classNames?.header?.close,
|
|
248
|
-
onPress: close
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
],
|
|
253
|
-
[
|
|
254
|
-
AriaHeadingContext,
|
|
255
|
-
{
|
|
256
|
-
slots: {
|
|
257
|
-
title: {
|
|
258
|
-
ref: titleRef,
|
|
259
|
-
className: classNames?.header?.title
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
]
|
|
265
|
-
},
|
|
266
|
-
content: { className: classNames?.content },
|
|
267
|
-
footer: { as: "footer", className: classNames?.footer }
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
]
|
|
271
|
-
],
|
|
272
|
-
[
|
|
273
|
-
classNames?.header?.header,
|
|
274
|
-
classNames?.header?.back,
|
|
275
|
-
classNames?.header?.close,
|
|
276
|
-
classNames?.header?.title,
|
|
277
|
-
classNames?.content,
|
|
278
|
-
classNames?.footer,
|
|
279
|
-
backRef,
|
|
280
|
-
close,
|
|
281
|
-
mapping,
|
|
282
|
-
titleRef
|
|
283
|
-
]
|
|
284
|
-
);
|
|
285
|
-
if (!ariaLabel && !ariaLabelledBy && !hasTitle) {
|
|
286
|
-
console.warn(
|
|
287
|
-
'If a Drawer does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.'
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
return /* @__PURE__ */ jsx(Provider, { values, children: /* @__PURE__ */ jsx(
|
|
291
|
-
"div",
|
|
292
|
-
{
|
|
293
|
-
...rest,
|
|
294
|
-
className: classNames?.dialog?.container,
|
|
295
|
-
style,
|
|
296
|
-
"aria-label": ariaLabel,
|
|
297
|
-
"aria-labelledby": ariaLabelledBy,
|
|
298
|
-
children: /* @__PURE__ */ jsx("div", { className: classNames?.dialog?.dialog, children })
|
|
299
|
-
}
|
|
300
|
-
) });
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
export { Drawer, DrawerDialog, DrawerDialogContext, DrawerTab, DrawerTabList };
|
|
304
|
-
//# sourceMappingURL=drawer.js.map
|
|
305
|
-
//# sourceMappingURL=drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/drawer/drawer.tsx"],"names":["isOpen","DrawerDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuEA,IAAM,gBAAgB,aAAkC,CAAA;AAAA,EACtD,MAAQ,EAAA,OAAA;AAAA,EACR,WAAa,EAAA,KAAA;AAAA,EACb,MAAQ,EAAA,KAAA;AAAA,EACR,KAAO,EAAA,IAAA;AAAA,EACP,IAAM,EAAA,IAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,MAAQ,EAAA;AACV,CAAC,CAAA;AAEM,SAAS,OAAO,KAAoB,EAAA;AACzC,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,QAAQ,CAAA;AAEvC,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,cAAA;AAAA,IACZ,MAAS,GAAA,OAAA;AAAA,IACT,WAAc,GAAA,KAAA;AAAA,IACd,WAAc,GAAA,KAAA;AAAA,IACd,iBAAoB,GAAA,KAAA;AAAA,IACpB,aAAgB,GAAA,IAAA;AAAA,IAChB,yBAA4B,GAAA,KAAA;AAAA,IAC5B,MAAQ,EAAA,UAAA;AAAA,IACR,YAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAkB,EAAA,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAM,CAAA,MAAA,EAAQ,cAAc;AAAA,GAC/B;AAGA,EAAA,MAAM,gBAAmB,GAAA,WAAA;AAAA,IACvB,CAACA,OAAoB,KAAA;AACnB,MAAA,IAAI,CAAC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UAAY,EAAA,MAAA,EAAQ,QAAS,QAAS,EAAA;AAAA;AAAA,GAE1D,EAAA,CAAA;AAEJ,CAAC","file":"drawer.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 { toBoolean } from '@accelint/converters';\nimport { noop } from '@accelint/core';\nimport { useFocusWithin } from '@react-aria/interactions';\nimport { useOverlay } from '@react-aria/overlays';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { useOverlayTriggerState } from '@react-stately/overlays';\nimport type { PressEvent } from '@react-types/shared';\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Provider,\n} from 'react-aria-components';\nimport {\n useContextProps,\n useDefaultProps,\n useSlot,\n useTheme,\n} from '../../hooks';\nimport { headings } from '../../styles';\nimport {\n callRenderProps,\n inlineVars,\n mergeClassNames,\n mergeProps,\n} from '../../utils';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext, type ButtonProps } from '../button';\nimport { ElementContext, type ElementProps } from '../element';\nimport { Tab, TabList, type TabRenderProps, Tabs } from '../tabs';\nimport {\n TooltipContext,\n type TooltipProps,\n TooltipTargetContext,\n type TooltipTargetProps,\n} from '../tooltip';\nimport {\n drawerClassNames,\n drawerDialogStateVars,\n drawerStateVars,\n} from './drawer.css';\nimport type {\n DrawerContextValue,\n DrawerDialogProps,\n DrawerMapping,\n DrawerProps,\n DrawerTabListProps,\n DrawerTabProps,\n} from './types';\n\nconst DrawerContext = createContext<DrawerContextValue>({\n anchor: 'right',\n layoutShift: false,\n isOpen: false,\n close: noop,\n open: noop,\n setOpen: noop,\n toggle: noop,\n});\n\nexport function Drawer(props: DrawerProps) {\n props = useDefaultProps(props, 'Drawer');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n anchor = 'right',\n defaultOpen = false,\n layoutShift = false,\n shouldCloseOnBlur = false,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen: isOpenProp,\n onOpenChange,\n ...rest\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Remove focus when Drawer closes\n const handleOpenChange = useCallback(\n (isOpen: boolean) => {\n if (!isOpen) {\n const focused = isSSR ? null : document.activeElement;\n\n if (\n focused &&\n 'blur' in focused &&\n typeof focused.blur === 'function'\n ) {\n focused.blur();\n }\n }\n\n onOpenChange?.(isOpen);\n },\n [isSSR, onOpenChange],\n );\n\n const state = useOverlayTriggerState({\n defaultOpen,\n isOpen: isOpenProp,\n onOpenChange: handleOpenChange,\n });\n\n const { isOpen, close, open } = state;\n const ref = useRef<HTMLDivElement>(null);\n\n const { overlayProps } = useOverlay(\n {\n isOpen,\n shouldCloseOnBlur,\n isDismissable,\n isKeyboardDismissDisabled,\n onClose: close,\n },\n ref,\n );\n\n // TODO: it may be desirable to disallow focus within the closed Drawer instead\n // If focus forces the Drawer open\n const { focusWithinProps } = useFocusWithin({\n onFocusWithin: open,\n });\n\n const context = useMemo(\n () => ({ ...state, anchor, layoutShift }),\n [state, anchor, layoutShift],\n );\n\n const values = useMemo<\n [\n [typeof DrawerContext, DrawerContextValue],\n [\n typeof DrawerDialogContext,\n ContextValue<DrawerDialogProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [DrawerContext, context],\n [DrawerDialogContext, { classNames }],\n ],\n [context, classNames],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerStateVars, {\n anchor,\n layoutShift,\n isOpen,\n }),\n [anchor, layoutShift, isOpen],\n );\n\n const children = useMemo(\n () => callRenderProps(childrenProp, state),\n [childrenProp, state],\n );\n\n return (\n <Provider values={values}>\n <div\n {...mergeProps(overlayProps, focusWithinProps)}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n <Tabs classNames={classNames?.tabs} {...rest}>\n {children}\n </Tabs>\n </div>\n </Provider>\n );\n}\n\nexport function DrawerTabList<T extends object>(props: DrawerTabListProps<T>) {\n props = useDefaultProps(props, 'DrawerTabList');\n\n const { children, classNames: classNamesProp, variant = 'fill' } = props;\n const { anchor } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof TooltipContext, ContextValue<TooltipProps, HTMLDivElement>],\n [\n typeof TooltipTargetContext,\n ContextValue<TooltipTargetProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [TooltipContext, { placement: anchor === 'left' ? 'right' : 'left' }],\n [TooltipTargetContext, { focusable: false, relative: 'parent' }],\n ],\n [anchor],\n );\n\n return (\n <Provider values={values}>\n <TabList<T>\n classNames={classNames?.tabs}\n align='center'\n anchor={anchor === 'left' ? 'start' : 'end'}\n orientation='vertical'\n variant={variant}\n >\n {children}\n </TabList>\n </Provider>\n );\n}\n\nexport function DrawerTab(props: DrawerTabProps) {\n props = useDefaultProps(props, 'DrawerTab');\n\n const { children: childrenProp, classNames: classNamesProp, ...rest } = props;\n const { isOpen, open, toggle } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Must bind to press start (instead of later press events) due to Tab changing selected state on start\n const handlePressStart = useCallback(\n (event: PressEvent) => {\n const { selected } = event.target.parentElement?.dataset ?? {};\n\n if (toBoolean(selected)) {\n toggle();\n } else {\n open();\n }\n },\n [open, toggle],\n );\n\n const children = useCallback(\n (renderProps: TabRenderProps) =>\n callRenderProps(childrenProp, { ...renderProps, isOpen }),\n [childrenProp, isOpen],\n );\n\n return (\n <Tab\n {...rest}\n classNames={classNames?.tabs}\n onPressStart={handlePressStart}\n >\n {children}\n </Tab>\n );\n}\n\nconst defaultMapping: DrawerMapping = {\n heading: {\n child: headings.v4,\n parent: headings.v3,\n },\n back: {\n variant: 'icon',\n },\n close: {\n variant: 'icon',\n },\n};\n\nexport const DrawerDialogContext =\n createContext<ContextValue<DrawerDialogProps, HTMLDivElement>>(null);\n\nexport const DrawerDialog = forwardRef(function DrawerDialog(\n props: DrawerDialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DrawerDialogContext);\n\n const {\n children,\n classNames: classNamesProp,\n mapping: mappingProp,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const { close } = useContext(DrawerContext);\n const [backRef, hasBack] = useSlot();\n const [titleRef, hasTitle] = useSlot();\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {\n header: {\n title: hasBack ? mapping.heading.child : mapping.heading.parent,\n },\n }),\n [theme.Drawer, classNamesProp, hasBack, mapping],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerDialogStateVars, {\n isChild: !!hasBack,\n }),\n [hasBack],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<ButtonProps, HTMLButtonElement>,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>\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?.header,\n values: [\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n back: {\n ...mapping.back,\n ref: backRef,\n classNames: classNames?.header?.back,\n },\n close: {\n ...mapping.close,\n classNames: classNames?.header?.close,\n onPress: close,\n },\n },\n },\n ],\n [\n AriaHeadingContext,\n {\n slots: {\n title: {\n ref: titleRef,\n className: classNames?.header?.title,\n },\n },\n },\n ],\n ],\n },\n content: { className: classNames?.content },\n footer: { as: 'footer', className: classNames?.footer },\n },\n },\n ],\n ],\n [\n classNames?.header?.header,\n classNames?.header?.back,\n classNames?.header?.close,\n classNames?.header?.title,\n classNames?.content,\n classNames?.footer,\n backRef,\n close,\n mapping,\n titleRef,\n ],\n );\n\n // biome-ignore lint/complexity/useSimplifiedLogicExpression: intentional\n if (!ariaLabel && !ariaLabelledBy && !hasTitle) {\n console.warn(\n 'If a Drawer does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.',\n );\n }\n\n return (\n <Provider values={values}>\n <div\n {...rest}\n className={classNames?.dialog?.container}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n <div className={classNames?.dialog?.dialog}>{children}</div>\n </div>\n </Provider>\n );\n});\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ContextValue } from 'react-aria-components';
|
|
3
|
-
import { ElementProps } from './types.js';
|
|
4
|
-
import '../../types/react-aria.js';
|
|
5
|
-
|
|
6
|
-
declare const ElementContext: react.Context<ContextValue<ElementProps<any, any, any, any, any, any, any, any, any, any, any>, HTMLElement>>;
|
|
7
|
-
/**
|
|
8
|
-
* This generic component serves as any easy way for more complex components
|
|
9
|
-
* to establish stylable content areas within their layout with optional
|
|
10
|
-
* targetted contexts for any subcomponents
|
|
11
|
-
*
|
|
12
|
-
* See Dialog & Drawer as examples
|
|
13
|
-
*/
|
|
14
|
-
declare const Element: <A, B, C, D, E, F, G, H, I, J, K>(props: ElementProps<A, B, C, D, E, F, G, H, I, J, K> & react.RefAttributes<HTMLElement>) => react.ReactElement | null;
|
|
15
|
-
|
|
16
|
-
export { Element, ElementContext };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import '../../chunk-PZ5AY32C.js';
|
|
2
|
-
import { createContext, forwardRef } from 'react';
|
|
3
|
-
import { Provider } from 'react-aria-components';
|
|
4
|
-
import { useContextProps } from '../../hooks/index.js';
|
|
5
|
-
import { MergeProvider } from '../merge-provider/index.js';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var ElementContext = createContext(null);
|
|
9
|
-
var Element = forwardRef(function Element2(props, ref) {
|
|
10
|
-
[props, ref] = useContextProps(props, ref, ElementContext);
|
|
11
|
-
const { as: El = "div", values, mergeValues, ...rest } = props;
|
|
12
|
-
let children = /* @__PURE__ */ jsx(El, { ...rest, ref });
|
|
13
|
-
if (mergeValues) {
|
|
14
|
-
children = /* @__PURE__ */ jsx(MergeProvider, { values: mergeValues, children });
|
|
15
|
-
}
|
|
16
|
-
if (values) {
|
|
17
|
-
children = /* @__PURE__ */ jsx(Provider, { values, children });
|
|
18
|
-
}
|
|
19
|
-
return children;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export { Element, ElementContext };
|
|
23
|
-
//# sourceMappingURL=element.js.map
|
|
24
|
-
//# sourceMappingURL=element.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/element/element.tsx"],"names":["Element"],"mappings":";;;;;;;AAmBa,IAAA,cAAA,GACX,cAKE,IAAI;AASD,IAAM,OAAU,GAAA,UAAA,CAAW,SAASA,QAAAA,CAazC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,cAAc,CAAA;AAEzD,EAAM,MAAA,EAAE,IAAI,EAAK,GAAA,KAAA,EAAO,QAAQ,WAAa,EAAA,GAAG,MAAS,GAAA,KAAA;AAGzD,EAAA,IAAI,QAAW,mBAAA,GAAA,CAAC,EAAI,EAAA,EAAA,GAAG,MAAM,GAAU,EAAA,CAAA;AAEvC,EAAA,IAAI,WAAa,EAAA;AACf,IAAA,QAAA,mBAAY,GAAA,CAAA,aAAA,EAAA,EAAc,MAAQ,EAAA,WAAA,EAAc,QAAS,EAAA,CAAA;AAAA;AAG3D,EAAA,IAAI,MAAQ,EAAA;AACV,IAAW,QAAA,mBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,MAAA,EAAiB,QAAS,EAAA,CAAA;AAAA;AAGjD,EAAO,OAAA,QAAA;AACT,CAAC","file":"element.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\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type ForwardedRef, createContext, forwardRef } from 'react';\nimport { type ContextValue, Provider } from 'react-aria-components';\nimport { useContextProps } from '../../hooks';\nimport { MergeProvider } from '../merge-provider';\nimport type { ElementProps } from './types';\n\nexport const ElementContext =\n createContext<\n ContextValue<\n ElementProps<any, any, any, any, any, any, any, any, any, any, any>,\n HTMLElement\n >\n >(null);\n\n/**\n * This generic component serves as any easy way for more complex components\n * to establish stylable content areas within their layout with optional\n * targetted contexts for any subcomponents\n *\n * See Dialog & Drawer as examples\n */\nexport const Element = forwardRef(function Element<\n A,\n B,\n C,\n D,\n E,\n F,\n G,\n H,\n I,\n J,\n K,\n>(\n props: ElementProps<A, B, C, D, E, F, G, H, I, J, K>,\n ref: ForwardedRef<HTMLElement>,\n) {\n [props, ref] = useContextProps(props, ref, ElementContext);\n\n const { as: El = 'div', values, mergeValues, ...rest } = props;\n\n // @ts-expect-error Can't narrow props type to match element or ref, making this less dynamic runs into union complexity and performance issues\n let children = <El {...rest} ref={ref} />;\n\n if (mergeValues) {\n children = <MergeProvider values={mergeValues}>{children}</MergeProvider>;\n }\n\n if (values) {\n children = <Provider values={values}>{children}</Provider>;\n }\n\n return children;\n});\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as react_aria_components from 'react-aria-components';
|
|
2
|
-
import { ContextValue } from 'react-aria-components';
|
|
3
|
-
import { BaseGroupProps, GroupProps } from './types.js';
|
|
4
|
-
import * as react from 'react';
|
|
5
|
-
import { ReactElement } from 'react';
|
|
6
|
-
import '@react-types/shared';
|
|
7
|
-
|
|
8
|
-
declare const GroupContext: react.Context<ContextValue<GroupProps<any, Element>, HTMLDivElement>>;
|
|
9
|
-
/**
|
|
10
|
-
* This generic component allows for collective prop distribution to a collection of components of the same type
|
|
11
|
-
*
|
|
12
|
-
* @example A list of <Button />s and you want to control their size instead of passing the same props to each
|
|
13
|
-
*/
|
|
14
|
-
declare const Group: <T, E extends Element>(props: BaseGroupProps<T, E> & react_aria_components.SlotProps & react.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
15
|
-
|
|
16
|
-
export { Group, GroupContext };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import '../../chunk-PZ5AY32C.js';
|
|
2
|
-
import { createContext, forwardRef, useMemo, Children } from 'react';
|
|
3
|
-
import { useContextProps, useTheme } from '../../hooks/index.js';
|
|
4
|
-
import { mergeClassNames, inlineVars } from '../../utils/index.js';
|
|
5
|
-
import { MergeProvider } from '../merge-provider/index.js';
|
|
6
|
-
import { groupClassNames, groupStateVars } from './group.css.js';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var GroupContext = (
|
|
10
|
-
// Unforunately, using "unknown" or "object" here creates complex type issues with <Provider />
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
createContext(null)
|
|
13
|
-
);
|
|
14
|
-
var Group = forwardRef(function Group2(props, ref) {
|
|
15
|
-
[props, ref] = useContextProps(props, ref, GroupContext);
|
|
16
|
-
const {
|
|
17
|
-
children: childrenProp,
|
|
18
|
-
classNames: classNamesProp,
|
|
19
|
-
context,
|
|
20
|
-
orientation = "horizontal",
|
|
21
|
-
reverse = false,
|
|
22
|
-
values: valuesProp
|
|
23
|
-
} = props;
|
|
24
|
-
const theme = useTheme();
|
|
25
|
-
const classNames = useMemo(
|
|
26
|
-
() => mergeClassNames(groupClassNames, theme.Group, classNamesProp),
|
|
27
|
-
[theme.Group, classNamesProp]
|
|
28
|
-
);
|
|
29
|
-
const style = useMemo(() => {
|
|
30
|
-
const types = Children.toArray(childrenProp).reduce(
|
|
31
|
-
(acc, child) => {
|
|
32
|
-
if (child && typeof child !== "boolean" && typeof child !== "number" && typeof child !== "string") {
|
|
33
|
-
const type2 = child.type;
|
|
34
|
-
const name = typeof type2 !== "string" ? type2.render?.name : type2;
|
|
35
|
-
if (name) {
|
|
36
|
-
acc.add(name);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return acc;
|
|
40
|
-
},
|
|
41
|
-
/* @__PURE__ */ new Set()
|
|
42
|
-
);
|
|
43
|
-
const type = { 0: "Empty", 1: [...types].at(0) }[types.size] ?? "Mixed";
|
|
44
|
-
return inlineVars(groupStateVars, {
|
|
45
|
-
count: Children.count(childrenProp),
|
|
46
|
-
orientation,
|
|
47
|
-
reverse,
|
|
48
|
-
type
|
|
49
|
-
});
|
|
50
|
-
}, [childrenProp, orientation, reverse]);
|
|
51
|
-
const values = useMemo(() => [[context, valuesProp]], [context, valuesProp]);
|
|
52
|
-
const children = useMemo(
|
|
53
|
-
() => /* @__PURE__ */ jsx("div", { ref, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.group, children: childrenProp }) }),
|
|
54
|
-
[ref, classNames?.container, classNames?.group, style, childrenProp]
|
|
55
|
-
);
|
|
56
|
-
return context && valuesProp ? /* @__PURE__ */ jsx(MergeProvider, { values, children }) : children;
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
export { Group, GroupContext };
|
|
60
|
-
//# sourceMappingURL=group.js.map
|
|
61
|
-
//# sourceMappingURL=group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/group/group.tsx"],"names":["Group","type"],"mappings":";;;;;;;;AA2Ba,IAAA,YAAA;AAAA;AAAA;AAAA,EAGX,cAAsE,IAAI;AAAA;AAOrE,IAAM,KAAQ,GAAA,UAAA,CAAW,SAASA,MAAAA,CACvC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,YAAY,CAAA;AAEvD,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,cAAA;AAAA,IACZ,OAAA;AAAA,IACA,WAAc,GAAA,YAAA;AAAA,IACd,OAAU,GAAA,KAAA;AAAA,IACV,MAAQ,EAAA;AAAA,GACN,GAAA,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,eAAiB,EAAA,KAAA,CAAM,OAAO,cAAc,CAAA;AAAA,IAClE,CAAC,KAAM,CAAA,KAAA,EAAO,cAAc;AAAA,GAC9B;AAEA,EAAM,MAAA,KAAA,GAAQ,QAAQ,MAAM;AAC1B,IAAA,MAAM,KAAQ,GAAA,QAAA,CAAS,OAAQ,CAAA,YAAY,CAAE,CAAA,MAAA;AAAA,MAC3C,CAAC,KAAK,KAAU,KAAA;AACd,QACE,IAAA,KAAA,IACA,OAAO,KAAU,KAAA,SAAA,IACjB,OAAO,KAAU,KAAA,QAAA,IACjB,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AAC,aAAc,EAAA,EAAA,MAAA,EAAiB,UAAS,CAEzC,GAAA,QAAA;AAEJ,CAAC","file":"group.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Children,\n type ForwardedRef,\n type ReactElement,\n createContext,\n forwardRef,\n useMemo,\n} from 'react';\nimport type { ContextValue } from 'react-aria-components';\nimport { useContextProps, useTheme } from '../../hooks';\nimport { inlineVars, mergeClassNames } from '../../utils';\nimport { MergeProvider } from '../merge-provider';\nimport { groupClassNames, groupStateVars } from './group.css';\nimport type { GroupProps } from './types';\n\nexport const GroupContext =\n // Unforunately, using \"unknown\" or \"object\" here creates complex type issues with <Provider />\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n createContext<ContextValue<GroupProps<any, Element>, HTMLDivElement>>(null);\n\n/**\n * This generic component allows for collective prop distribution to a collection of components of the same type\n *\n * @example A list of <Button />s and you want to control their size instead of passing the same props to each\n */\nexport const Group = forwardRef(function Group<T, E extends Element>(\n props: GroupProps<T, E>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, GroupContext);\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n context,\n orientation = 'horizontal',\n reverse = false,\n values: valuesProp,\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(groupClassNames, theme.Group, classNamesProp),\n [theme.Group, classNamesProp],\n );\n\n const style = useMemo(() => {\n const types = Children.toArray(childrenProp).reduce<Set<string>>(\n (acc, child) => {\n if (\n child &&\n typeof child !== 'boolean' &&\n typeof child !== 'number' &&\n typeof child !== 'string'\n ) {\n const type = (child as ReactElement).type;\n // @ts-expect-error TS doesn't know about \"render\" type\n const name = typeof type !== 'string' ? type.render?.name : type;\n\n if (name) {\n acc.add(name);\n }\n }\n\n return acc;\n },\n new Set<string>(),\n );\n\n const type = { 0: 'Empty', 1: [...types].at(0) }[types.size] ?? 'Mixed';\n\n return inlineVars(groupStateVars, {\n count: Children.count(childrenProp),\n orientation,\n reverse,\n type,\n });\n }, [childrenProp, orientation, reverse]);\n\n const values = useMemo<\n [[Exclude<typeof context, undefined>, ContextValue<T, E>]]\n // biome-ignore lint/style/noNonNullAssertion: intentional\n >(() => [[context!, valuesProp]], [context, valuesProp]);\n\n const children = useMemo(\n () => (\n <div ref={ref} className={classNames?.container} style={style}>\n <div className={classNames?.group}>{childrenProp}</div>\n </div>\n ),\n [ref, classNames?.container, classNames?.group, style, childrenProp],\n );\n\n return context && valuesProp ? (\n <MergeProvider values={values}>{children}</MergeProvider>\n ) : (\n children\n );\n});\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as react_aria_components from 'react-aria-components';
|
|
2
|
-
import { ContextValue } from 'react-aria-components';
|
|
3
|
-
import { IconSizes, IconProps } from './types.js';
|
|
4
|
-
import * as react from 'react';
|
|
5
|
-
|
|
6
|
-
declare const IconContext: react.Context<ContextValue<IconProps, HTMLDivElement>>;
|
|
7
|
-
declare const Icon: (props: Pick<react.CSSProperties, "fill" | "color" | "stroke"> & {
|
|
8
|
-
classNames?: Partial<{
|
|
9
|
-
container: string;
|
|
10
|
-
icon: string;
|
|
11
|
-
}> | undefined;
|
|
12
|
-
size?: IconSizes;
|
|
13
|
-
} & react_aria_components.SlotProps & {
|
|
14
|
-
children?: react.ReactNode | undefined;
|
|
15
|
-
} & react.RefAttributes<HTMLDivElement>) => react.ReactElement | null;
|
|
16
|
-
|
|
17
|
-
export { Icon, IconContext };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import '../../chunk-PZ5AY32C.js';
|
|
2
|
-
import { createContext, forwardRef, useMemo } from 'react';
|
|
3
|
-
import { useContextProps, useDefaultProps, useTheme } from '../../hooks/index.js';
|
|
4
|
-
import { mergeClassNames, inlineVars } from '../../utils/index.js';
|
|
5
|
-
import { iconClassNames, iconStateVars } from './icon.css.js';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var IconContext = createContext(null);
|
|
9
|
-
var Icon = forwardRef(function Icon2(props, ref) {
|
|
10
|
-
[props, ref] = useContextProps(props, ref, IconContext);
|
|
11
|
-
props = useDefaultProps(props, "Icon");
|
|
12
|
-
const {
|
|
13
|
-
children,
|
|
14
|
-
classNames: classNamesProp,
|
|
15
|
-
color,
|
|
16
|
-
fill,
|
|
17
|
-
size = "relative",
|
|
18
|
-
stroke
|
|
19
|
-
} = props;
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
const classNames = useMemo(
|
|
22
|
-
() => mergeClassNames(iconClassNames, theme.Icon, classNamesProp),
|
|
23
|
-
[theme.Icon, classNamesProp]
|
|
24
|
-
);
|
|
25
|
-
const style = useMemo(
|
|
26
|
-
() => inlineVars(iconStateVars, {
|
|
27
|
-
color,
|
|
28
|
-
fill,
|
|
29
|
-
size,
|
|
30
|
-
stroke
|
|
31
|
-
}),
|
|
32
|
-
[color, fill, size, stroke]
|
|
33
|
-
);
|
|
34
|
-
return /* @__PURE__ */ jsx("div", { ref, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.icon, children }) });
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export { Icon, IconContext };
|
|
38
|
-
//# sourceMappingURL=icon.js.map
|
|
39
|
-
//# sourceMappingURL=icon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/icon/icon.tsx"],"names":["Icon"],"mappings":";;;;;;;AAOa,IAAA,WAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,IAAO,GAAA,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,WAAW,CAAA;AAEtD,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,MAAM,CAAA;AAErC,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,UAAY,EAAA,cAAA;AAAA,IACZ,KAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAO,GAAA,UAAA;AAAA,IACP;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,cAAgB,EAAA,KAAA,CAAM,MAAM,cAAc,CAAA;AAAA,IAChE,CAAC,KAAM,CAAA,IAAA,EAAM,cAAc;AAAA,GAC7B;AAEA,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MACE,WAAW,aAAe,EAAA;AAAA,MACxB,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH,CAAC,KAAA,EAAO,IAAM,EAAA,IAAA,EAAM,MAAM;AAAA,GAC5B;AAEA,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA,EAAI,GAAU,EAAA,SAAA,EAAW,UAAY,EAAA,SAAA,EAAW,KAC/C,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,UAAY,EAAA,IAAA,EAAO,UAAS,CAC9C,EAAA,CAAA;AAEJ,CAAC","file":"icon.js","sourcesContent":["import { type ForwardedRef, createContext, forwardRef, useMemo } from 'react';\nimport type { ContextValue } from 'react-aria-components';\nimport { useContextProps, useDefaultProps, useTheme } from '../../hooks';\nimport { inlineVars, mergeClassNames } from '../../utils';\nimport { iconClassNames, iconStateVars } from './icon.css';\nimport type { IconProps } from './types';\n\nexport const IconContext =\n createContext<ContextValue<IconProps, HTMLDivElement>>(null);\n\nexport const Icon = forwardRef(function Icon(\n props: IconProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, IconContext);\n\n props = useDefaultProps(props, 'Icon');\n\n const {\n children,\n classNames: classNamesProp,\n color,\n fill,\n size = 'relative',\n stroke,\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(iconClassNames, theme.Icon, classNamesProp),\n [theme.Icon, classNamesProp],\n );\n\n const style = useMemo(\n () =>\n inlineVars(iconStateVars, {\n color,\n fill,\n size,\n stroke,\n }),\n [color, fill, size, stroke],\n );\n\n return (\n <div ref={ref} className={classNames?.container} style={style}>\n <div className={classNames?.icon}>{children}</div>\n </div>\n );\n});\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseInputProps, InputProps as InputProps$1 } from './types.js';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { InputProps, ContextValue } from 'react-aria-components';
|
|
4
|
-
import '../../types/generic.js';
|
|
5
|
-
|
|
6
|
-
declare const InputContext: react.Context<ContextValue<InputProps$1, HTMLInputElement>>;
|
|
7
|
-
/**
|
|
8
|
-
* Only intended for generic text-like inputs, see types in props for list
|
|
9
|
-
* Other more specific inputs should be handled by other components
|
|
10
|
-
*/
|
|
11
|
-
declare const Input: (props: Omit<InputProps, "children" | "className" | "style" | "size" | "type"> & BaseInputProps & react.RefAttributes<HTMLInputElement>) => react.ReactElement | null;
|
|
12
|
-
|
|
13
|
-
export { Input, InputContext };
|