@accelint/design-toolkit 3.0.0 → 5.0.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/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +1 -1
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/accordion/types.d.ts +1 -1
- package/dist/components/action-bar/index.d.ts +10 -0
- package/dist/components/action-bar/index.js +2 -0
- package/dist/components/action-bar/index.js.map +1 -0
- package/dist/components/action-bar/styles.d.ts +5 -0
- package/dist/components/action-bar/styles.js +2 -0
- package/dist/components/action-bar/styles.js.map +1 -0
- package/dist/components/action-bar/types.d.ts +5 -0
- package/dist/components/action-bar/types.js +2 -0
- package/dist/components/action-bar/types.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/styles.d.ts +1 -1
- package/dist/components/avatar/styles.js +1 -1
- package/dist/components/avatar/styles.js.map +1 -1
- package/dist/components/avatar/types.d.ts +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/styles.d.ts +1 -1
- package/dist/components/badge/styles.js +1 -1
- package/dist/components/badge/styles.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +3 -3
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +1 -1
- package/dist/components/checkbox/styles.d.ts +1 -1
- package/dist/components/checkbox/styles.js +1 -1
- package/dist/components/checkbox/styles.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.d.ts +4 -4
- package/dist/components/chip/styles.js +1 -1
- package/dist/components/chip/styles.js.map +1 -1
- package/dist/components/classification-badge/index.d.ts +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.js +1 -1
- package/dist/components/classification-badge/styles.js.map +1 -1
- package/dist/components/classification-banner/index.d.ts +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.js +1 -1
- package/dist/components/classification-banner/styles.js.map +1 -1
- package/dist/components/color-picker/styles.d.ts +1 -1
- package/dist/components/color-picker/styles.js +1 -1
- package/dist/components/color-picker/styles.js.map +1 -1
- package/dist/components/combobox-field/index.d.ts +1 -1
- package/dist/components/combobox-field/index.js.map +1 -1
- package/dist/components/combobox-field/styles.d.ts +3 -3
- package/dist/components/combobox-field/styles.js +1 -1
- package/dist/components/combobox-field/styles.js.map +1 -1
- package/dist/components/combobox-field/types.d.ts +1 -1
- package/dist/components/date-field/index.d.ts +1 -3
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.d.ts +41 -51
- package/dist/components/date-field/styles.js +1 -1
- package/dist/components/date-field/styles.js.map +1 -1
- package/dist/components/date-field/types.d.ts +12 -15
- package/dist/components/details-list/index.d.ts +1 -1
- package/dist/components/details-list/index.js +1 -1
- package/dist/components/details-list/index.js.map +1 -1
- package/dist/components/details-list/styles.d.ts +1 -1
- package/dist/components/details-list/styles.js +1 -1
- package/dist/components/details-list/styles.js.map +1 -1
- package/dist/components/dialog/index.d.ts +28 -38
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/styles.d.ts +60 -0
- package/dist/components/dialog/styles.js +2 -0
- package/dist/components/dialog/styles.js.map +1 -0
- package/dist/components/dialog/types.d.ts +14 -0
- package/dist/components/dialog/types.js +2 -0
- package/dist/components/dialog/types.js.map +1 -0
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/styles.d.ts +2 -2
- package/dist/components/drawer/styles.js +1 -1
- package/dist/components/drawer/styles.js.map +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/hero/index.js +1 -1
- package/dist/components/hero/index.js.map +1 -1
- package/dist/components/hero/styles.d.ts +1 -1
- package/dist/components/hero/styles.js +1 -1
- package/dist/components/hero/styles.js.map +1 -1
- package/dist/components/hotkey/index.d.ts +1 -1
- package/dist/components/hotkey/index.js.map +1 -1
- package/dist/components/hotkey/styles.d.ts +1 -1
- package/dist/components/hotkey/styles.js +1 -1
- package/dist/components/hotkey/styles.js.map +1 -1
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.d.ts +1 -1
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/styles.d.ts +1 -1
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/label/index.d.ts +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.d.ts +1 -1
- package/dist/components/label/styles.js +1 -1
- package/dist/components/label/styles.js.map +1 -1
- package/dist/components/lines/index.d.ts +9 -0
- package/dist/components/lines/index.js +2 -0
- package/dist/components/lines/index.js.map +1 -0
- package/dist/components/lines/styles.d.ts +32 -0
- package/dist/components/lines/styles.js +2 -0
- package/dist/components/lines/styles.js.map +1 -0
- package/dist/components/lines/types.d.ts +10 -0
- package/dist/components/lines/types.js +2 -0
- package/dist/components/lines/types.js.map +1 -0
- package/dist/components/link/index.d.ts +17 -0
- package/dist/components/link/index.js +2 -0
- package/dist/components/link/index.js.map +1 -0
- package/dist/components/link/styles.d.ts +5 -0
- package/dist/components/link/styles.js +2 -0
- package/dist/components/link/styles.js.map +1 -0
- package/dist/components/link/types.d.ts +9 -0
- package/dist/components/link/types.js +2 -0
- package/dist/components/link/types.js.map +1 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/styles.d.ts +1 -1
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/styles.d.ts +3 -3
- package/dist/components/options/styles.js +1 -1
- package/dist/components/options/styles.js.map +1 -1
- package/dist/components/options/types.d.ts +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.d.ts +1 -1
- package/dist/components/popover/styles.js +1 -1
- package/dist/components/popover/styles.js.map +1 -1
- package/dist/components/query-builder/action-element.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.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/styles.d.ts +1 -1
- package/dist/components/radio/styles.js +1 -1
- package/dist/components/radio/styles.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-field/styles.d.ts +1 -1
- package/dist/components/search-field/styles.js +1 -1
- package/dist/components/search-field/styles.js.map +1 -1
- package/dist/components/select-field/index.d.ts +1 -1
- package/dist/components/select-field/index.js +1 -1
- package/dist/components/select-field/index.js.map +1 -1
- package/dist/components/select-field/styles.d.ts +4 -4
- package/dist/components/select-field/styles.js +1 -1
- package/dist/components/select-field/styles.js.map +1 -1
- package/dist/components/select-field/types.d.ts +1 -1
- package/dist/components/sidenav/events.d.ts +8 -0
- package/dist/components/sidenav/events.js +2 -0
- package/dist/components/sidenav/events.js.map +1 -0
- package/dist/components/sidenav/index.d.ts +51 -0
- package/dist/components/sidenav/index.js +2 -0
- package/dist/components/sidenav/index.js.map +1 -0
- package/dist/components/sidenav/styles.d.ts +114 -0
- package/dist/components/sidenav/styles.js +2 -0
- package/dist/components/sidenav/styles.js.map +1 -0
- package/dist/components/sidenav/types.d.ts +38 -0
- package/dist/components/sidenav/types.js +2 -0
- package/dist/components/sidenav/types.js.map +1 -0
- package/dist/components/skeleton/styles.d.ts +2 -2
- package/dist/components/skeleton/styles.js +1 -1
- package/dist/components/skeleton/styles.js.map +1 -1
- package/dist/components/slider/index.d.ts +4 -43
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/styles.d.ts +84 -0
- package/dist/components/slider/styles.js +2 -0
- package/dist/components/slider/styles.js.map +1 -0
- package/dist/components/slider/types.d.ts +22 -0
- package/dist/components/slider/types.js +2 -0
- package/dist/components/slider/types.js.map +1 -0
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.d.ts +1 -1
- package/dist/components/switch/styles.js +1 -1
- package/dist/components/switch/styles.js.map +1 -1
- package/dist/components/tabs/index.d.ts +37 -36
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs/styles.d.ts +48 -0
- package/dist/components/tabs/styles.js +2 -0
- package/dist/components/tabs/styles.js.map +1 -0
- package/dist/components/tabs/types.d.ts +6 -0
- package/dist/components/tabs/types.js +2 -0
- package/dist/components/tabs/types.js.map +1 -0
- package/dist/components/text-area-field/index.d.ts +1 -1
- package/dist/components/text-area-field/index.js.map +1 -1
- package/dist/components/text-area-field/styles.d.ts +4 -4
- package/dist/components/text-area-field/styles.js +1 -1
- package/dist/components/text-area-field/styles.js.map +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/text-field/styles.d.ts +4 -4
- package/dist/components/text-field/styles.js +1 -1
- package/dist/components/text-field/styles.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/styles.d.ts +1 -1
- package/dist/components/tooltip/styles.js +1 -1
- package/dist/components/tooltip/styles.js.map +1 -1
- package/dist/components/tooltip/types.d.ts +3 -1
- package/dist/components/tree/index.d.ts +51 -0
- package/dist/components/tree/index.js +2 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/styles.d.ts +128 -0
- package/dist/components/tree/styles.js +2 -0
- package/dist/components/tree/styles.js.map +1 -0
- package/dist/components/tree/types.d.ts +41 -0
- package/dist/components/tree/types.js +2 -0
- package/dist/components/tree/types.js.map +1 -0
- package/dist/components/view-stack/index.js.map +1 -1
- package/dist/foundation/token-data.d.ts +17 -0
- package/dist/foundation/token-data.js +2 -0
- package/dist/foundation/token-data.js.map +1 -0
- package/dist/hooks/use-tree/actions/cache.d.ts +78 -0
- package/dist/hooks/use-tree/actions/cache.js +2 -0
- package/dist/hooks/use-tree/actions/cache.js.map +1 -0
- package/dist/hooks/use-tree/actions/index.d.ts +38 -0
- package/dist/hooks/use-tree/actions/index.js +2 -0
- package/dist/hooks/use-tree/actions/index.js.map +1 -0
- package/dist/hooks/use-tree/state/index.d.ts +8 -0
- package/dist/hooks/use-tree/state/index.js +2 -0
- package/dist/hooks/use-tree/state/index.js.map +1 -0
- package/dist/hooks/use-tree/state/utils.d.ts +7 -0
- package/dist/hooks/use-tree/state/utils.js +2 -0
- package/dist/hooks/use-tree/state/utils.js.map +1 -0
- package/dist/hooks/use-tree/types.d.ts +171 -0
- package/dist/hooks/use-tree/types.js +2 -0
- package/dist/hooks/use-tree/types.js.map +1 -0
- package/dist/icons/catalog.js +1 -1
- package/dist/icons/catalog.js.map +1 -1
- package/dist/index.css +12 -18
- package/dist/index.d.ts +35 -8
- package/dist/index.js +1 -1
- package/dist/lib/react.d.ts +22 -8
- package/dist/lib/react.js +8 -4
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/utils.d.ts +15 -5
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/theme-provider.d.ts +22 -0
- package/dist/providers/theme-provider.js +2 -0
- package/dist/providers/theme-provider.js.map +1 -0
- package/dist/styles.css +2071 -1007
- package/dist/tokens/themes.css +741 -53
- package/dist/tokens/tokens.css +133 -65
- package/dist/tokens/tokens.d.ts +449 -1
- package/dist/tokens/tokens.js +2 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/tokens/types.d.ts +299 -0
- package/dist/tokens/types.js +2 -0
- package/dist/tokens/types.js.map +1 -0
- package/dist/variants/variants.css +19 -1
- package/package.json +20 -9
- package/dist/tokens/index.d.ts +0 -123
- package/dist/tokens/index.js +0 -2
- package/dist/tokens/index.js.map +0 -1
|
@@ -1,69 +1,59 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
-
import * as tailwind_merge from 'tailwind-merge';
|
|
3
2
|
|
|
4
|
-
declare const
|
|
5
|
-
readonly
|
|
3
|
+
declare const DateFieldStylesDefaults: {
|
|
4
|
+
readonly shortMonth: true;
|
|
6
5
|
};
|
|
7
6
|
declare const DateFieldStyles: tailwind_variants.TVReturnType<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
field?: tailwind_merge.ClassNameValue;
|
|
12
|
-
error?: tailwind_merge.ClassNameValue;
|
|
13
|
-
dateInputContainer?: tailwind_merge.ClassNameValue;
|
|
14
|
-
dateSegment?: tailwind_merge.ClassNameValue;
|
|
15
|
-
dateInput?: tailwind_merge.ClassNameValue;
|
|
16
|
-
descriptionText?: tailwind_merge.ClassNameValue;
|
|
7
|
+
shortMonth: {
|
|
8
|
+
true: {
|
|
9
|
+
segment: string[];
|
|
17
10
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
[x: string]: {
|
|
21
|
-
[x: string]: tailwind_merge.ClassNameValue | {
|
|
22
|
-
icon?: tailwind_merge.ClassNameValue;
|
|
23
|
-
field?: tailwind_merge.ClassNameValue;
|
|
24
|
-
error?: tailwind_merge.ClassNameValue;
|
|
25
|
-
dateInputContainer?: tailwind_merge.ClassNameValue;
|
|
26
|
-
dateSegment?: tailwind_merge.ClassNameValue;
|
|
27
|
-
dateInput?: tailwind_merge.ClassNameValue;
|
|
28
|
-
descriptionText?: tailwind_merge.ClassNameValue;
|
|
11
|
+
false: {
|
|
12
|
+
segment: string[];
|
|
29
13
|
};
|
|
30
14
|
};
|
|
31
|
-
}
|
|
15
|
+
}, {
|
|
32
16
|
field: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
label: string;
|
|
18
|
+
control: string[];
|
|
19
|
+
input: string;
|
|
20
|
+
segment: string[];
|
|
21
|
+
description: string[];
|
|
37
22
|
error: string;
|
|
38
|
-
dateSegment: string;
|
|
39
23
|
}, undefined, {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
dateSegment?: tailwind_merge.ClassNameValue;
|
|
47
|
-
dateInput?: tailwind_merge.ClassNameValue;
|
|
48
|
-
descriptionText?: tailwind_merge.ClassNameValue;
|
|
24
|
+
shortMonth: {
|
|
25
|
+
true: {
|
|
26
|
+
segment: string[];
|
|
27
|
+
};
|
|
28
|
+
false: {
|
|
29
|
+
segment: string[];
|
|
49
30
|
};
|
|
50
31
|
};
|
|
51
|
-
}
|
|
32
|
+
}, {
|
|
52
33
|
field: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
label: string;
|
|
35
|
+
control: string[];
|
|
36
|
+
input: string;
|
|
37
|
+
segment: string[];
|
|
38
|
+
description: string[];
|
|
57
39
|
error: string;
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
}, tailwind_variants.TVReturnType<{
|
|
41
|
+
shortMonth: {
|
|
42
|
+
true: {
|
|
43
|
+
segment: string[];
|
|
44
|
+
};
|
|
45
|
+
false: {
|
|
46
|
+
segment: string[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
60
50
|
field: string;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
label: string;
|
|
52
|
+
control: string[];
|
|
53
|
+
input: string;
|
|
54
|
+
segment: string[];
|
|
55
|
+
description: string[];
|
|
65
56
|
error: string;
|
|
66
|
-
dateSegment: string;
|
|
67
57
|
}, undefined, unknown, unknown, undefined>>;
|
|
68
58
|
|
|
69
|
-
export { DateFieldStyles,
|
|
59
|
+
export { DateFieldStyles, DateFieldStylesDefaults };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {tv}from'tailwind-variants';const t={
|
|
1
|
+
import {tv}from'tailwind-variants';const t={shortMonth:true},o=tv({slots:{field:"group/date-field flex flex-col gap-xs",label:"",control:["flex w-full items-center gap-xs rounded-medium px-s py-xs font-display outline outline-interactive","group-size-medium/date-field:text-body-s","group-size-small/date-field:text-body-xs","fg-primary-bold","hover:outline-interactive-hover","focus-visible-within:outline-accent-primary-bold","group-invalid/date-field:outline-serious-bold","group-disabled/date-field:placeholder:fg-disabled group-disabled/date-field:fg-disabled group-disabled/date-field:outline-interactive-disabled"],input:"flex gap-xs",segment:["text-right","placeholder-shown:fg-primary-muted","focus-visible:fg-a11y-on-accent focus-visible:bg-accent-primary-bold focus-visible:outline-none"],description:["fg-primary-muted text-body-xs","group-disabled/date-field:fg-disabled"],error:"fg-serious-bold text-body-xs"},variants:{shortMonth:{true:{segment:["group-size-medium/date-field:type-month:w-[calc(3ch+(3*var(--typography-body-s-spacing)))]","group-size-small/date-field:type-month:w-[calc(3ch+(3*var(--typography-body-xs-spacing)))]"]},false:{segment:["group-size-medium/date-field:type-month:w-[calc(2ch+(2*var(--typography-body-s-spacing)))]","group-size-small/date-field:type-month:w-[calc(2ch+(2*var(--typography-body-xs-spacing)))]"]}}},defaultVariants:t});export{o as DateFieldStyles,t as DateFieldStylesDefaults};//# sourceMappingURL=styles.js.map
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-field/styles.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/styles.ts"],"names":["DateFieldStylesDefaults","DateFieldStyles","tv"],"mappings":"mCAcO,MAAMA,EAA0B,CACrC,UAAA,CAAY,IACd,CAAA,CAEaC,CAAAA,CAAkBC,EAAAA,CAAG,CAChC,KAAA,CAAO,CACL,KAAA,CAAO,uCAAA,CACP,KAAA,CAAO,EAAA,CACP,OAAA,CAAS,CACP,oGAAA,CACA,0CAAA,CACA,2CACA,iBAAA,CACA,iCAAA,CACA,kDAAA,CACA,+CAAA,CACA,gJACF,CAAA,CACA,KAAA,CAAO,aAAA,CACP,QAAS,CACP,YAAA,CACA,oCAAA,CACA,iGACF,CAAA,CACA,WAAA,CAAa,CACX,+BAAA,CACA,uCACF,CAAA,CACA,KAAA,CAAO,8BACT,CAAA,CACA,QAAA,CAAU,CACR,UAAA,CAAY,CACV,KAAM,CACJ,OAAA,CAAS,CACP,4FAAA,CACA,4FACF,CACF,CAAA,CACA,KAAA,CAAO,CACL,OAAA,CAAS,CACP,4FAAA,CACA,4FACF,CACF,CACF,CACF,CAAA,CACA,eAAA,CAAiBF,CACnB,CAAC","file":"styles.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 { tv } from 'tailwind-variants';\n\nexport const DateFieldStylesDefaults = {\n shortMonth: true,\n} as const;\n\nexport const DateFieldStyles = tv({\n slots: {\n field: 'group/date-field flex flex-col gap-xs',\n label: '',\n control: [\n 'flex w-full items-center gap-xs rounded-medium px-s py-xs font-display outline outline-interactive',\n 'group-size-medium/date-field:text-body-s',\n 'group-size-small/date-field:text-body-xs',\n 'fg-primary-bold',\n 'hover:outline-interactive-hover',\n 'focus-visible-within:outline-accent-primary-bold',\n 'group-invalid/date-field:outline-serious-bold',\n 'group-disabled/date-field:placeholder:fg-disabled group-disabled/date-field:fg-disabled group-disabled/date-field:outline-interactive-disabled',\n ],\n input: 'flex gap-xs',\n segment: [\n 'text-right',\n 'placeholder-shown:fg-primary-muted',\n 'focus-visible:fg-a11y-on-accent focus-visible:bg-accent-primary-bold focus-visible:outline-none',\n ],\n description: [\n 'fg-primary-muted text-body-xs',\n 'group-disabled/date-field:fg-disabled',\n ],\n error: 'fg-serious-bold text-body-xs',\n },\n variants: {\n shortMonth: {\n true: {\n segment: [\n 'group-size-medium/date-field:type-month:w-[calc(3ch+(3*var(--typography-body-s-spacing)))]',\n 'group-size-small/date-field:type-month:w-[calc(3ch+(3*var(--typography-body-xs-spacing)))]',\n ],\n },\n false: {\n segment: [\n 'group-size-medium/date-field:type-month:w-[calc(2ch+(2*var(--typography-body-s-spacing)))]',\n 'group-size-small/date-field:type-month:w-[calc(2ch+(2*var(--typography-body-xs-spacing)))]',\n ],\n },\n },\n },\n defaultVariants: DateFieldStylesDefaults,\n});\n"]}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DateValue, DateFieldProps as DateFieldProps$1, DateInputProps as DateInputProps$1, LabelProps, FieldErrorProps } from 'react-aria-components';
|
|
1
|
+
import { DateValue, DateFieldProps as DateFieldProps$1, LabelProps, DateInputProps, DateSegmentProps, FieldErrorProps } from 'react-aria-components';
|
|
3
2
|
import { VariantProps } from 'tailwind-variants';
|
|
4
3
|
import { DateFieldStyles } from './styles.js';
|
|
5
|
-
import 'tailwind-merge';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
ref?: ForwardedRef<HTMLDivElement>;
|
|
9
|
-
size?: 'small' | 'medium';
|
|
10
|
-
isInvalid?: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface DateFieldProps<T extends DateValue> extends VariantProps<typeof DateFieldStyles>, Omit<DateFieldProps$1<T>, 'style' | 'className'>, Omit<DateInputProps$1, 'children' | 'style'> {
|
|
5
|
+
type DateFieldProps<T extends DateValue> = Omit<DateFieldProps$1<T>, 'children' | 'className' | 'placeholder'> & VariantProps<typeof DateFieldStyles> & {
|
|
13
6
|
classNames?: {
|
|
14
7
|
field?: DateFieldProps$1<T>['className'];
|
|
15
8
|
label?: LabelProps['className'];
|
|
9
|
+
control?: string;
|
|
16
10
|
input?: DateInputProps['className'];
|
|
11
|
+
segment?: DateSegmentProps['className'];
|
|
17
12
|
description?: string;
|
|
18
13
|
error?: FieldErrorProps['className'];
|
|
19
14
|
};
|
|
20
|
-
|
|
15
|
+
label?: string;
|
|
21
16
|
description?: string;
|
|
22
17
|
errorMessage?: string;
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
inputProps?: Omit<DateInputProps, 'children' | 'className'>;
|
|
19
|
+
/**
|
|
20
|
+
* When true, will convert month value to 3 letter abbreviation when not editing
|
|
21
|
+
*/
|
|
25
22
|
shortMonth?: boolean;
|
|
26
|
-
|
|
27
|
-
}
|
|
23
|
+
size?: 'small' | 'medium';
|
|
24
|
+
};
|
|
28
25
|
|
|
29
|
-
export type { DateFieldProps
|
|
26
|
+
export type { DateFieldProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ProviderProps } from '../../lib/types.js';
|
|
4
3
|
import { ContextValue } from 'react-aria-components';
|
|
4
|
+
import { ProviderProps } from '../../lib/types.js';
|
|
5
5
|
import { DetailsListProps, DetailsListLabelProps, DetailsListValueProps } from './types.js';
|
|
6
6
|
import 'tailwind-variants';
|
|
7
7
|
import './styles.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {jsx}from'react/jsx-runtime';import'client-only';import {
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {createContext}from'react';import {useContextProps,TextContext,DEFAULT_SLOT,Text}from'react-aria-components';import {containsExactChildren}from'./../../lib/react.js';import {DetailsListStyles,DetailsListStylesDefaults}from'./styles.js';const {list:N,label:b,value:f}=DetailsListStyles(),n=createContext(null);function m({children:e,...s}){return jsx(n.Provider,{value:s,children:e})}m.displayName="DetailsListProvider.Provider";function L(e){return jsx(Text,{...e,elementType:"dt",slot:"label"})}L.displayName="DetailsList.Label";function p(e){return jsx(Text,{...e,elementType:"dd",slot:"value"})}p.displayName="DetailsList.Value";function t({ref:e,...s}){[s,e]=useContextProps(s,e??null,n);const{children:o,classNames:i,align:a=DetailsListStylesDefaults.align,...u}=s;return containsExactChildren({children:o,componentName:t.displayName,restrictions:[[t.Label,{min:1}],[t.Value,{min:1}]]}),jsx(TextContext,{value:{slots:{[DEFAULT_SLOT]:{},label:{className:b({className:i?.label,align:a})},value:{className:f({className:i?.value,align:a})}}},children:jsx("dl",{...u,className:N({className:i?.list,align:a}),children:o})})}t.displayName="DetailsList",t.Provider=m,t.Label=L,t.Value=p;export{t as DetailsList,n as DetailsListContext};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/details-list/index.tsx"],"names":["label","value","DetailsListContext","y","props","jsx","l","DetailsListProvider","Text","r","useContextProps","ref","
|
|
1
|
+
{"version":3,"sources":["../../../src/components/details-list/index.tsx"],"names":["label","value","DetailsListContext","y","props","jsx","l","DetailsListProvider","Text","r","useContextProps","ref","P","classNames","rest","v","DetailsList","TextContext","d","c","align","children","DetailsListValue"],"mappings":"2SA+Bc,MAAAA,CAAAA,IAAO,CAAA,CAAA,CAAAC,KAA4B,CAAA,CAEpCC,CAAAA,KACqD,CAAA,CAAI,CAAA,CAEtEC,wCACE,EAAA,SACA,CAAA,CAAA,CAAGC,QAEH,CAAA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CAAE,CAAAC,YAAA,EAAA,EAAA,CAAA,KAAiB,CAAE,CAAA,SAAWN,CAAAA,CAAAA,CAAY,CAAA,SAAO,CAAA,CAAAO,EAAO,KACjE,CAAA,gBAA0B,CAAE,CAAA,SAAWP,CAAAA,CAAAA,CAAY,CAAA,SAAO,CAAA,CAAAO,EAAO,KAIrE,CAAA,KAAA,CAAA,CAAA,CAAAf,CAAAA,CAAC,WAAa,CAAAC,GAAA,CAAA,IAAA,CAAA,CAAA,GAAgB,CAAE,CAAA,SAAWO,CAAAA,CAAAA,CAAY,CAAA,SAAM,CAAAO,CAAM,EAAC,IACjE,CAAA,KAAAC,CAAAA,CACH,EACF,CAEJ,QACY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WAAA,CAC1BL,aACAA,CAAAA,CAAY,CAAA,QACZA,CAAY,CAAA,CAAA,CAAA,CAAA,KAAQM,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA","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'use client';\n\nimport 'client-only';\nimport { createContext } from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Text,\n TextContext,\n useContextProps,\n} from 'react-aria-components';\nimport { containsExactChildren } from '@/lib/react';\nimport { DetailsListStyles, DetailsListStylesDefaults } from './styles';\nimport type { ProviderProps } from '@/lib/types';\nimport type {\n DetailsListLabelProps,\n DetailsListProps,\n DetailsListValueProps,\n} from './types';\n\nconst { list, label, value } = DetailsListStyles();\n\nexport const DetailsListContext =\n createContext<ContextValue<DetailsListProps, HTMLDListElement>>(null);\n\nfunction DetailsListProvider({\n children,\n ...props\n}: ProviderProps<DetailsListProps>) {\n return (\n <DetailsListContext.Provider value={props}>\n {children}\n </DetailsListContext.Provider>\n );\n}\nDetailsListProvider.displayName = 'DetailsListProvider.Provider';\n\nfunction DetailsListLabel(props: DetailsListLabelProps) {\n return <Text {...props} elementType='dt' slot='label' />;\n}\nDetailsListLabel.displayName = 'DetailsList.Label';\n\nfunction DetailsListValue(props: DetailsListValueProps) {\n return <Text {...props} elementType='dd' slot='value' />;\n}\nDetailsListValue.displayName = 'DetailsList.Value';\n\n/**\n * A semantic details list component for displaying metadata in key-value pairs.\n * Uses CSS Grid layout with labels in the first column and values in the second column.\n * Perfect for map object details, user profiles, or any structured information.\n *\n * @example\n * ```tsx\n * <DetailsList align=\"left\">\n * <DetailsList.Label>Key</DetailsList.Label>\n * <DetailsList.Value>Value</DetailsList.Value>\n *\n * <DetailsList.Label>Ships</DetailsList.Label>\n * <DetailsList.Value>Millennium Falcon</DetailsList.Value>\n * <DetailsList.Value>USS Enterprise NCC-1701</DetailsList.Value>\n * <DetailsList.Value>Serenity</DetailsList.Value>\n *\n * <DetailsList.Label>Coordinates</DetailsList.Label>\n * <DetailsList.Value>\n * <div>Great Pyramid of Giza: 29°58'44\" N 31°08'02\" E</div>\n * <div>Machu Picchu: 13°09'47\" S 72°32'41\" W</div>\n * <div>Colosseum: 41°53'24\" N 12°29'32\" E</div>\n * <div>Taj Mahal: 27°10'30\" N 78°02'31\" E</div>\n * </DetailsList.Value>\n * </DetailsList>\n * ```\n * ## Child Component Behavior\n * - **DetailsList.Label**: Minimum of 1\n * - **DetailsList.Value**: Minimum of 1\n */\nexport function DetailsList({ ref, ...props }: DetailsListProps) {\n [props, ref] = useContextProps(props, ref ?? null, DetailsListContext);\n\n const {\n children,\n classNames,\n align = DetailsListStylesDefaults.align,\n ...rest\n } = props;\n\n containsExactChildren({\n children,\n componentName: DetailsList.displayName,\n restrictions: [\n [DetailsList.Label, { min: 1 }],\n [DetailsList.Value, { min: 1 }],\n ],\n });\n\n return (\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n label: { className: label({ className: classNames?.label, align }) },\n value: { className: value({ className: classNames?.value, align }) },\n },\n }}\n >\n <dl {...rest} className={list({ className: classNames?.list, align })}>\n {children}\n </dl>\n </TextContext>\n );\n}\nDetailsList.displayName = 'DetailsList';\nDetailsList.Provider = DetailsListProvider;\nDetailsList.Label = DetailsListLabel;\nDetailsList.Value = DetailsListValue;\n"]}
|
|
@@ -60,6 +60,6 @@ declare const DetailsListStyles: tailwind_variants.TVReturnType<{
|
|
|
60
60
|
list: string;
|
|
61
61
|
label: string;
|
|
62
62
|
value: string;
|
|
63
|
-
}, undefined, unknown, unknown
|
|
63
|
+
}, undefined, unknown, unknown>>;
|
|
64
64
|
|
|
65
65
|
export { DetailsListStyles, DetailsListStylesDefaults };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {tv}from'./../../lib/utils.js';const l={align:"justify"},a=tv({slots:{list:"grid grid-cols-[auto_1fr] gap-x-m font-display text-body-m",label:"fg-
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const l={align:"justify"},a=tv({slots:{list:"grid grid-cols-[auto_1fr] gap-x-m font-display text-body-m",label:"fg-primary-muted col-start-1",value:"fg-primary-bold col-start-2"},variants:{align:{left:{label:"text-left",value:"text-left"},center:{label:"text-right",value:"text-left"},justify:{label:"text-left",value:"text-right"}}},defaultVariants:l});export{a as DetailsListStyles,l as DetailsListStylesDefaults};//# sourceMappingURL=styles.js.map
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/details-list/styles.ts"],"names":["t"],"mappings":"sCAeS,MAAA,CAAA,CAAA,CAAA,KACT,CAAA,SAGE,CAAA,CAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KAAM,CAAA,CAAA,IAAA,CAAA,4DACC,CAAA,KAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/details-list/styles.ts"],"names":["t"],"mappings":"sCAeS,MAAA,CAAA,CAAA,CAAA,KACT,CAAA,SAGE,CAAA,CAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KAAM,CAAA,CAAA,IAAA,CAAA,4DACC,CAAA,KAAA,CAAA,8BACA,CAAA,KAAA,CAAA,6BAET,CAAU,CACR,eACU,CAAA,CAAA,uBAA2B,CAAA,KAAA,CAAA,WACzB,CAAA,CAAA,MAAO,CAAA,CAAA,KAAA,CAAA,YAAqB,CAAA,KAAA,CAAA,WAC7B,CAAE,CAAA,OAAO,CAAA,CAAA,KAAA,CAAA,WAAoB,CAAA,KAAA,CAAA,YAG1C,CAAA,CAAA,CAAA,CAAA,eACD,CAAA,CAAA,CAAA","file":"styles.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 { tv } from '@/lib/utils';\n\nexport const DetailsListStylesDefaults = {\n align: 'justify',\n} as const;\n\nexport const DetailsListStyles = tv({\n slots: {\n list: 'grid grid-cols-[auto_1fr] gap-x-m font-display text-body-m',\n label: 'fg-primary-muted col-start-1',\n value: 'fg-primary-bold col-start-2',\n },\n variants: {\n align: {\n left: { label: 'text-left', value: 'text-left' },\n center: { label: 'text-right', value: 'text-left' },\n justify: { label: 'text-left', value: 'text-right' },\n },\n },\n defaultVariants: DetailsListStylesDefaults,\n});\n"]}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { RefObject, PropsWithChildren, ReactNode } from 'react';
|
|
3
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '../button/styles.js';
|
|
9
|
-
import 'tailwind-merge';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
import { DialogTrigger, HeadingProps, ContextValue } from 'react-aria-components';
|
|
5
|
+
import { DialogProps } from './types.js';
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
declare const DialogContext: react.Context<ContextValue<DialogProps, HTMLDivElement>>;
|
|
8
|
+
declare function DialogTitle({ children, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare namespace DialogTitle {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
declare function DialogContent({ children, className }: ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare namespace DialogContent {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
16
|
+
declare function DialogFooter({ children, className }: ComponentProps<'footer'>): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare namespace DialogFooter {
|
|
18
|
+
var displayName: string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Dialog - A modal dialog component for important content and interactions
|
|
@@ -26,9 +26,9 @@ interface DialogProps extends DialogTriggerProps {
|
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* // Basic dialog with trigger
|
|
29
|
-
* <Dialog>
|
|
29
|
+
* <Dialog.Trigger>
|
|
30
30
|
* <Button>Open Dialog</Button>
|
|
31
|
-
* <Dialog
|
|
31
|
+
* <Dialog>
|
|
32
32
|
* {({ close }) => (
|
|
33
33
|
* <>
|
|
34
34
|
* <Dialog.Title>Confirm Action</Dialog.Title>
|
|
@@ -38,26 +38,16 @@ interface DialogProps extends DialogTriggerProps {
|
|
|
38
38
|
* </Dialog.Footer>
|
|
39
39
|
* </>
|
|
40
40
|
* )}
|
|
41
|
-
* </Dialog
|
|
42
|
-
* </Dialog>
|
|
41
|
+
* </Dialog>
|
|
42
|
+
* </Dialog.Trigger>
|
|
43
43
|
*/
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
displayName: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Footer: ({ children, className, }: PropsWithChildren<{
|
|
52
|
-
className?: string;
|
|
53
|
-
}>) => react_jsx_runtime.JSX.Element;
|
|
54
|
-
Title: ({ children, className, }: PropsWithChildren<{
|
|
55
|
-
className?: string;
|
|
56
|
-
}>) => react_jsx_runtime.JSX.Element;
|
|
57
|
-
Body: react.ForwardRefExoticComponent<DialogBodyProps & react.RefAttributes<HTMLDivElement>>;
|
|
58
|
-
};
|
|
59
|
-
interface DialogBodyProps {
|
|
60
|
-
children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);
|
|
44
|
+
declare function Dialog({ ref, ...props }: DialogProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
declare namespace Dialog {
|
|
46
|
+
var displayName: string;
|
|
47
|
+
var Trigger: typeof DialogTrigger;
|
|
48
|
+
var Title: typeof DialogTitle;
|
|
49
|
+
var Content: typeof DialogContent;
|
|
50
|
+
var Footer: typeof DialogFooter;
|
|
61
51
|
}
|
|
62
52
|
|
|
63
|
-
export { Dialog,
|
|
53
|
+
export { Dialog, DialogContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {jsx}from'react/jsx-runtime';import
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {UNSAFE_PortalProvider}from'@react-aria/overlays';import {useIsSSR}from'@react-aria/ssr';import {createContext,useState,useEffect,useContext}from'react';import {useContextProps,ModalOverlay,composeRenderProps,Modal,Dialog,DialogTrigger,Heading,OverlayTriggerStateContext}from'react-aria-components';import {isSlottedContextValue}from'./../../lib/utils.js';import {ButtonContext}from'../button/index.js';import {DialogStyles}from'./styles.js';const {overlay:h,modal:B,dialog:U,title:_,content:I,footer:L}=DialogStyles(),d=createContext(null);function g({children:e,className:o}){return jsx(Heading,{slot:"title",className:_({className:o}),children:e})}g.displayName="Dialog.Title";function f({children:e,className:o}){return jsx("div",{className:I({className:o}),children:e})}f.displayName="Dialog.Content";function P({children:e,className:o}){const a=useContext(d),s=(isSlottedContextValue(a)?null:a?.size)??"small",n=useContext(OverlayTriggerStateContext);return jsx("footer",{className:L({className:o}),children:jsx(ButtonContext.Provider,{value:{size:s,onPress:n?.close??(()=>{})},children:e})})}P.displayName="Dialog.Footer";function r({ref:e,...o}){[o,e]=useContextProps(o,e??null,d);const a=useIsSSR(),[s,n]=useState(a?null:document.body),{children:v,classNames:m,parentRef:c,size:C="small",...D}=o;return useEffect(()=>{const l=c?.current,i=a?null:document.createElement("div");return l&&i&&(l.appendChild(i),n(i)),()=>{i?.remove(),n(a?null:document.body);}},[a,c]),jsx(d.Provider,{value:o,children:jsx(UNSAFE_PortalProvider,{getContainer:()=>s,children:jsx(ModalOverlay,{...D,ref:e,className:composeRenderProps(m?.overlay,l=>h({className:l})),"data-size":C,children:jsx(Modal,{className:composeRenderProps(m?.modal,l=>B({className:l})),children:jsx(Dialog,{className:U({className:m?.dialog}),children:v})})})})})}r.displayName="Dialog",r.Trigger=DialogTrigger,r.Title=g,r.Content=f,r.Footer=P;export{r as Dialog,d as DialogContext};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["useDialogContext","h","ctx","DialogContext","z","size","jsx","RACDialogTrigger","s","isDismissable","Dialog","rest","v","ref","useState","isSSR","N","node","P","port","setPortal","parentRef","RACModalOverlay","cn","n","O","children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,CAAA,CAAA,CAAUC,CAAAA,MACV,CAAA,CAAA,CAAA,CAASO,CAAAA,OACT,CAAA,CAAQC,CAAAA,CACfzB,CAAAA,MAAc0B,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,CAAAA","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\n'use client';\nimport { cn } from '@/lib/utils';\nimport { useIsSSR } from '@react-aria/ssr';\nimport 'client-only';\nimport { cva } from 'class-variance-authority';\nimport {\n type PropsWithChildren,\n type ReactNode,\n type RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n type DialogRenderProps,\n type DialogTriggerProps,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { Button } from '../button';\nimport type { ButtonProps } from '../button/types';\n\nconst dialogClasses = cva(\n 'flex flex-col align-end font-light text-body-m text-default-dark',\n {\n variants: {\n size: {\n sm: 'min-w-[280px] max-w-[280px] rounded-medium p-l',\n lg: 'min-w-[320px] max-w-[720px] rounded-large p-xl',\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n },\n);\n\nconst buttonSizes: Record<string, ButtonProps['size']> = {\n sm: 'small',\n lg: 'medium',\n};\n\ntype DialogSize = 'sm' | 'lg';\n\ninterface DialogContextValue {\n size: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nconst DialogContext = createContext<DialogContextValue>({ size: 'sm' });\n\nconst useDialogContext = () => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error('Dialog components must be used within <Dialog>');\n }\n return ctx;\n};\n\nexport interface DialogProps extends DialogTriggerProps {\n size?: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\n/**\n * Dialog - A modal dialog component for important content and interactions\n *\n * Provides accessible modal functionality with focus management, backdrop handling,\n * and keyboard navigation. Supports multiple sizes and customizable dismissal behavior.\n * Perfect for confirmations, forms, or any content requiring user focus.\n *\n * @example\n * // Basic dialog with trigger\n * <Dialog>\n * <Button>Open Dialog</Button>\n * <Dialog.Body>\n * {({ close }) => (\n * <>\n * <Dialog.Title>Confirm Action</Dialog.Title>\n * <p>Are you sure you want to continue?</p>\n * <Dialog.Footer>\n * <Dialog.Button onPress={close}>Confirm</Dialog.Button>\n * </Dialog.Footer>\n * </>\n * )}\n * </Dialog.Body>\n * </Dialog>\n */\nexport const Dialog = ({\n children,\n size,\n isOpen,\n onOpenChange,\n isDismissable = true,\n isKeyboardDismissDisabled = true,\n parentRef,\n}: DialogProps) => {\n return (\n <RACDialogTrigger>\n <DialogContext.Provider\n value={{\n size: size ?? 'sm',\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n }}\n >\n {children}\n </DialogContext.Provider>\n </RACDialogTrigger>\n );\n};\nDialog.displayName = 'Dialog';\n\ninterface DialogBodyProps {\n children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);\n}\n\nconst DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ children, ...rest }, ref) => {\n const {\n size,\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n } = useDialogContext();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n useEffect(() => {\n const node = parentRef?.current;\n /* Ensure proper ssr hydration TODO */\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n node.appendChild(port);\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef]);\n\n return portal ? (\n <RACModalOverlay\n UNSTABLE_portalContainer={portal}\n isKeyboardDismissDisabled={!isDismissable && isKeyboardDismissDisabled}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n isDismissable={isDismissable}\n className='absolute inset-0 flex items-center justify-center'\n {...rest}\n >\n <RACModal\n ref={ref}\n className={cn(\n 'flex flex-col justify-center bg-surface-overlay align-start',\n size === 'sm' && 'rounded-medium',\n size === 'lg' && 'rounded-large',\n )}\n >\n <RACDialog className={dialogClasses({ size })}>{children}</RACDialog>\n </RACModal>\n </RACModalOverlay>\n ) : null;\n },\n);\nDialogBody.displayName = 'DialogBody';\n\nconst DialogContent = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex flex-col',\n size === 'sm' && 'gap-xs',\n size === 'lg' && 'gap-l',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nconst DialogTitle = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <RACHeading\n slot='title'\n className={cn(\n 'text-default-light',\n size === 'sm' && 'mb-s text-header-m',\n size === 'lg' && 'mb-m text-header-l',\n className,\n )}\n >\n {children}\n </RACHeading>\n );\n};\n\nconst DialogButton = ({ children, className, ...props }: ButtonProps) => {\n const { size: dialogSize } = useDialogContext();\n const buttonSize = buttonSizes[dialogSize];\n return (\n <Button\n size={buttonSize}\n {...props}\n //overriding the style to deal with rac's pressed state inherited\n //from the trigger state\n className={cn('pressed:bg-initial', className)}\n >\n {children}\n </Button>\n );\n};\n\nconst DialogFooter = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex justify-end gap-xs',\n size === 'sm' && 'mt-l',\n size === 'lg' && 'mt-xl',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nDialog.Button = DialogButton;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Title = DialogTitle;\nDialog.Body = DialogBody;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["title","DialogStyles","DialogContext","DialogTitle","x","className","jsx","Heading","t","H","children","DialogContent","context","useContext","O","state","p","A","size","DialogFooter","props","ref","isSSR","useIsSSR","portal","N","T","classNames","parentRef","useEffect","node","S","port","setPortal","y","rest","composeRenderProps","modal","u","dialog","E","Dialog"],"mappings":"yfAwCwB,MAAA,CAAA,SAAQA,CAAAA,KAAO,CAAA,CAAA,CAAA,MAAS,CAAA,CAAA,CAAA,KAAWC,CAAa,EAE3DC,QACkD,CAAA,CAE/D,MAAA,CAAA,CAAA,CAASC,aAAY,EAAE,CAAA,CAAA,CAAAC,aAAA,CAAA,MAAU,SAAAC,CAAU,EAAiB,QAExDC,EAACC,CAAAA,SAAa,CAAA,CAAA,CAAA,CAAA,CAAA,OAAQC,GAAA,CAAAC,OAAA,CAAWT,CAAAA,YAAQK,CAAU,SAChD,CAAA,CAAA,CAAAK,CAAAA,SAIK,CAAA,CAAA,CAAA,CAAA,CAAA,QAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,YAEjBC,cAA0B,CAAA,SAAAN,CAAU,CAAA,CAA0B,QAC9DC,CAAAA,CAAC,UAAI,CAAA,CAAA,CAAA,CAAA,CAAA,OAAqBE,GAAA,CAAA,KAAA,CAAAH,CAAU,SAAK,CAAA,CAAA,CAAAK,UAEpC,CAAA,CAAA,CAAA,CAAA,CAAA,QAAc,CAA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,EAAA,QAC3B,CACF,CAAA,CAAG,CAACA,MAGFhB,aAAC,EAAuB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAOc,EAC7B,CAAA,CAAAZ,GAAA,CAAA,CAAA,CAAA,QAAuB,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,QAAoBgB,CACzChB,GAAA,CAAA0B,qBAAA,CAAA,CAAA,YACMC,CAAAA,KACCd,CAAAA,QACL,CAAAb,GAAA,CAAW4B,aAAmBT,CAAAA,GAAY,CAAA,CAAA,GAAA,CAAA,CAAUtB,iCACxCA,OAEZ,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,SAEA,CAAA,CAAA,CAAA,CAAA,CAAAC,CAAAA,WACE,CAAA,CAAA,CAAW8B,aAAuC/B,KAAAA,CAAAA,CAChDgC,SAAQ,CAAAC,kBAAA,CAAA,CAAAjC,EAAW,YAGrBC,SAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAWiC,QAAS,CAAA/B,GAAA,CAAAgC,MAAA,CAAWb,CAAAA,SAAoB,CAAA,CAC5D,CAAA,CAAA,SACH,EACF,EACF,MAKRc,EAAO,CAAA,QAAA,CAAA,CAAA,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACrBA,EAAO,CAAA,WACA,CAAA,SACA,CAAA,CAAA,OAAU9B,CACjB8B,cAAO,CAAA,CAAA,KAAStB,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA","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'use client';\n\nimport 'client-only';\nimport { UNSAFE_PortalProvider } from '@react-aria/overlays';\nimport { useIsSSR } from '@react-aria/ssr';\nimport {\n type ComponentProps,\n createContext,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n Dialog as AriaDialog,\n type ContextValue,\n composeRenderProps,\n DialogTrigger,\n Heading,\n type HeadingProps,\n Modal,\n ModalOverlay,\n OverlayTriggerStateContext,\n useContextProps,\n} from 'react-aria-components';\nimport { isSlottedContextValue } from '@/lib/utils';\nimport { ButtonContext } from '../button';\nimport { DialogStyles } from './styles';\nimport type { DialogProps } from './types';\n\nconst { overlay, modal, dialog, title, content, footer } = DialogStyles();\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nfunction DialogTitle({ children, className }: HeadingProps) {\n return (\n <Heading slot='title' className={title({ className })}>\n {children}\n </Heading>\n );\n}\nDialogTitle.displayName = 'Dialog.Title';\n\nfunction DialogContent({ children, className }: ComponentProps<'div'>) {\n return <div className={content({ className })}>{children}</div>;\n}\nDialogContent.displayName = 'Dialog.Content';\n\nfunction DialogFooter({ children, className }: ComponentProps<'footer'>) {\n const context = useContext(DialogContext);\n const size =\n (isSlottedContextValue(context) ? null : context?.size) ?? 'small';\n const state = useContext(OverlayTriggerStateContext);\n\n return (\n <footer className={footer({ className })}>\n <ButtonContext.Provider\n value={{\n size,\n onPress: state?.close ?? (() => undefined),\n }}\n >\n {children}\n </ButtonContext.Provider>\n </footer>\n );\n}\n\nDialogFooter.displayName = 'Dialog.Footer';\n\n/**\n * Dialog - A modal dialog component for important content and interactions\n *\n * Provides accessible modal functionality with focus management, backdrop handling,\n * and keyboard navigation. Supports multiple sizes and customizable dismissal behavior.\n * Perfect for confirmations, forms, or any content requiring user focus.\n *\n * @example\n * // Basic dialog with trigger\n * <Dialog.Trigger>\n * <Button>Open Dialog</Button>\n * <Dialog>\n * {({ close }) => (\n * <>\n * <Dialog.Title>Confirm Action</Dialog.Title>\n * <p>Are you sure you want to continue?</p>\n * <Dialog.Footer>\n * <Dialog.Button onPress={close}>Confirm</Dialog.Button>\n * </Dialog.Footer>\n * </>\n * )}\n * </Dialog>\n * </Dialog.Trigger>\n */\nexport function Dialog({ ref, ...props }: DialogProps) {\n [props, ref] = useContextProps(props, ref ?? null, DialogContext);\n\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n const { children, classNames, parentRef, size = 'small', ...rest } = props;\n\n useEffect(() => {\n const node = parentRef?.current;\n // TODO: Ensure proper ssr hydration\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\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]);\n\n return (\n <DialogContext.Provider value={props}>\n <UNSAFE_PortalProvider getContainer={() => portal}>\n <ModalOverlay\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.overlay, (className) =>\n overlay({ className }),\n )}\n data-size={size}\n >\n <Modal\n className={composeRenderProps(classNames?.modal, (className) =>\n modal({ className }),\n )}\n >\n <AriaDialog className={dialog({ className: classNames?.dialog })}>\n {children}\n </AriaDialog>\n </Modal>\n </ModalOverlay>\n </UNSAFE_PortalProvider>\n </DialogContext.Provider>\n );\n}\nDialog.displayName = 'Dialog';\nDialog.Trigger = DialogTrigger;\nDialog.Title = DialogTitle;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
declare const DialogStyles: tailwind_variants.TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
7
|
+
content?: tailwind_merge.ClassNameValue;
|
|
8
|
+
dialog?: tailwind_merge.ClassNameValue;
|
|
9
|
+
footer?: tailwind_merge.ClassNameValue;
|
|
10
|
+
title?: tailwind_merge.ClassNameValue;
|
|
11
|
+
overlay?: tailwind_merge.ClassNameValue;
|
|
12
|
+
modal?: tailwind_merge.ClassNameValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
[x: string]: {
|
|
17
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
|
18
|
+
content?: tailwind_merge.ClassNameValue;
|
|
19
|
+
dialog?: tailwind_merge.ClassNameValue;
|
|
20
|
+
footer?: tailwind_merge.ClassNameValue;
|
|
21
|
+
title?: tailwind_merge.ClassNameValue;
|
|
22
|
+
overlay?: tailwind_merge.ClassNameValue;
|
|
23
|
+
modal?: tailwind_merge.ClassNameValue;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
} | {}, {
|
|
27
|
+
overlay: string;
|
|
28
|
+
modal: string[];
|
|
29
|
+
dialog: string[];
|
|
30
|
+
title: string[];
|
|
31
|
+
content: string[];
|
|
32
|
+
footer: string[];
|
|
33
|
+
}, undefined, {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
36
|
+
content?: tailwind_merge.ClassNameValue;
|
|
37
|
+
dialog?: tailwind_merge.ClassNameValue;
|
|
38
|
+
footer?: tailwind_merge.ClassNameValue;
|
|
39
|
+
title?: tailwind_merge.ClassNameValue;
|
|
40
|
+
overlay?: tailwind_merge.ClassNameValue;
|
|
41
|
+
modal?: tailwind_merge.ClassNameValue;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
} | {}, {
|
|
45
|
+
overlay: string;
|
|
46
|
+
modal: string[];
|
|
47
|
+
dialog: string[];
|
|
48
|
+
title: string[];
|
|
49
|
+
content: string[];
|
|
50
|
+
footer: string[];
|
|
51
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
52
|
+
overlay: string;
|
|
53
|
+
modal: string[];
|
|
54
|
+
dialog: string[];
|
|
55
|
+
title: string[];
|
|
56
|
+
content: string[];
|
|
57
|
+
footer: string[];
|
|
58
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
59
|
+
|
|
60
|
+
export { DialogStyles };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {tv}from'tailwind-variants';const o=tv({slots:{overlay:"group/dialog absolute inset-0 flex items-center justify-center",modal:["flex flex-col justify-center bg-surface-overlay align-start","group-size-small/dialog:rounded-medium","group-size-large/dialog:rounded-large","shadow-elevation-overlay"],dialog:["focus-visible:outline-none","fg-primary-muted flex flex-col align-end font-light text-body-m","group-size-small/dialog:w-[280px] group-size-small/dialog:rounded-medium group-size-small/dialog:p-l","group-size-large/dialog:min-w-[320px] group-size-small/dialog:max-w-[720px] group-size-large/dialog:rounded-medium group-size-large/dialog:p-xl"],title:["fg-primary-bold","group-size-small/dialog:mb-s group-size-small/dialog:text-header-m","group-size-large/dialog:mb-m group-size-large/dialog:text-header-l"],content:["flex flex-col","fg-primary-muted","group-size-small/dialog:gap-xs","group-size-large/dialog:gap-l"],footer:["flex justify-end gap-xs","group-size-small/dialog:mt-l","group-size-large/dialog:mt-xl"]}});export{o as DialogStyles};//# sourceMappingURL=styles.js.map
|
|
2
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/styles.ts"],"names":["DialogStyles","tv"],"mappings":"mCAcO,MAAMA,EAAeC,EAAAA,CAAG,CAC7B,MAAO,CACL,OAAA,CAAS,iEACT,KAAA,CAAO,CACL,8DACA,wCAAA,CACA,uCAAA,CACA,0BACF,CAAA,CACA,MAAA,CAAQ,CACN,4BAAA,CACA,iEAAA,CACA,uGACA,iJACF,CAAA,CACA,MAAO,CACL,iBAAA,CACA,qEACA,oEACF,CAAA,CACA,QAAS,CACP,eAAA,CACA,mBACA,gCAAA,CACA,+BACF,EACA,MAAA,CAAQ,CACN,0BACA,8BAAA,CACA,+BACF,CACF,CACF,CAAC","file":"styles.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 { tv } from 'tailwind-variants';\n\nexport const DialogStyles = tv({\n slots: {\n overlay: 'group/dialog absolute inset-0 flex items-center justify-center',\n modal: [\n 'flex flex-col justify-center bg-surface-overlay align-start',\n 'group-size-small/dialog:rounded-medium',\n 'group-size-large/dialog:rounded-large',\n 'shadow-elevation-overlay',\n ],\n dialog: [\n 'focus-visible:outline-none',\n 'fg-primary-muted flex flex-col align-end font-light text-body-m',\n 'group-size-small/dialog:w-[280px] group-size-small/dialog:rounded-medium group-size-small/dialog:p-l',\n 'group-size-large/dialog:min-w-[320px] group-size-small/dialog:max-w-[720px] group-size-large/dialog:rounded-medium group-size-large/dialog:p-xl',\n ],\n title: [\n 'fg-primary-bold',\n 'group-size-small/dialog:mb-s group-size-small/dialog:text-header-m',\n 'group-size-large/dialog:mb-m group-size-large/dialog:text-header-l',\n ],\n content: [\n 'flex flex-col',\n 'fg-primary-muted',\n 'group-size-small/dialog:gap-xs',\n 'group-size-large/dialog:gap-l',\n ],\n footer: [\n 'flex justify-end gap-xs',\n 'group-size-small/dialog:mt-l',\n 'group-size-large/dialog:mt-xl',\n ],\n },\n});\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefAttributes, RefObject } from 'react';
|
|
2
|
+
import { ModalOverlayProps, DialogProps as DialogProps$1 } from 'react-aria-components';
|
|
3
|
+
|
|
4
|
+
type DialogProps = Omit<ModalOverlayProps, 'children' | 'className'> & Pick<DialogProps$1, 'children'> & RefAttributes<HTMLDivElement> & {
|
|
5
|
+
classNames?: {
|
|
6
|
+
overlay?: ModalOverlayProps['className'];
|
|
7
|
+
modal?: ModalOverlayProps['className'];
|
|
8
|
+
dialog?: DialogProps$1['className'];
|
|
9
|
+
};
|
|
10
|
+
parentRef?: RefObject<HTMLElement | null>;
|
|
11
|
+
size?: 'small' | 'large';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type { DialogProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
|
@@ -7,9 +7,9 @@ import { DrawerProps, DrawerLayoutProps, DrawerMenuProps, DrawerMenuItemProps, D
|
|
|
7
7
|
import '@accelint/bus';
|
|
8
8
|
import 'react-aria-components';
|
|
9
9
|
import '../view-stack/events.js';
|
|
10
|
-
import '../../lib/types.js';
|
|
11
10
|
import '@react-types/shared';
|
|
12
11
|
import 'tailwind-variants';
|
|
12
|
+
import '../../lib/types.js';
|
|
13
13
|
import '../button/types.js';
|
|
14
14
|
import '../button/styles.js';
|
|
15
15
|
import 'tailwind-merge';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {jsx}from'react/jsx-runtime';import'client-only';import {
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {Broadcast}from'@accelint/bus';import {isUUID}from'@accelint/core';import {Pressable}from'@react-aria/interactions';import {createContext,useRef,useState,useCallback,useEffect,useContext}from'react';import {composeRenderProps,Heading,Header}from'react-aria-components';import {containsExactChildren}from'./../../lib/react.js';import {ToggleButton}from'../button/index.js';import {Icon}from'../icon/index.js';import {ViewStackEventHandlers,ViewStack,ViewStackContext}from'../view-stack/index.js';import {ViewStackEventTypes}from'../view-stack/events.js';import {DrawerEventTypes}from'./events.js';import {DrawerStyles,DrawerMenuStyles,DrawerTitleStyles}from'./styles.js';const {layout:j,main:ee,drawer:re,panel:te,view:ae,header:ne,content:oe,footer:ie}=DrawerStyles(),{menu:se,item:pe}=DrawerMenuStyles(),l=Broadcast.getInstance(),R=createContext({register:()=>{},unregister:()=>{}}),le={...ViewStackEventHandlers,close:ViewStackEventHandlers.clear,open:e=>l.emit(DrawerEventTypes.open,{view:e}),toggle:e=>l.emit(DrawerEventTypes.toggle,{view:e})};function g({children:e,for:r}){const{parent:n}=useContext(ViewStackContext);function o(){for(const i of Array.isArray(r)?r:[r]){let[p,m]=isUUID(i)?["push",i]:i.split(":");m??=n,m&&le[p](m);}}return jsx(Pressable,{onPress:o,children:e})}g.displayName="Drawer.Trigger";function q({className:e,...r}){return jsx("main",{...r,className:ee({className:e})})}q.displayName="Drawer.Layout.Main";function P({className:e,extend:r="left right",push:n,...o}){return jsx("div",{...o,className:j({className:e}),"data-extend":r,"data-push":n})}P.displayName="Drawer.Layout",P.Main=q;function N({for:e,children:r,className:n,toggle:o,views:i,...p}){const{parent:m,stack:y}=useContext(ViewStackContext),c=y.at(-1),w=o?"toggle":"open";return m?jsx(g,{for:`${w}:${e}`,children:jsx(ToggleButton,{...p,className:composeRenderProps(n,u=>pe({className:u})),role:"tab",variant:"icon",isSelected:e===c||!!i?.some(u=>e===u),children:composeRenderProps(r,u=>jsx(Icon,{children:u}))})}):null}N.displayName="Drawer.Menu.Item";function d({className:e,position:r="center",children:n,...o}){return containsExactChildren({children:n,componentName:d.displayName,restrictions:[[N,{min:1}],[g,{min:0,max:0}]]}),jsx("nav",{...o,className:se({position:r,className:e}),children:n})}d.displayName="Drawer.Menu",d.Item=N;function h({className:e,...r}){return jsx("div",{...r,className:te({className:e})})}h.displayName="Drawer.Panel";function H({id:e,children:r,className:n,...o}){const{register:i,unregister:p}=useContext(R);return useEffect(()=>{i(e);},[i,p,e]),jsx(ViewStack.View,{id:e,children:jsx("div",{...o,className:ae({className:n}),role:"tabpanel",children:r})})}H.displayName="Drawer.View";function b({className:e,level:r,...n}){return jsx(Heading,{...n,className:DrawerTitleStyles({className:e,level:r}),level:r})}b.displayName="Drawer.Title";function C({className:e,...r}){return jsx(Header,{...r,className:ne({className:e})})}C.displayName="Drawer.Header",C.Title=b;function L({className:e,...r}){return jsx("div",{...r,className:oe({className:e})})}L.displayName="Drawer.Content";function W({className:e,...r}){return jsx("footer",{...r,className:ie({className:e})})}W.displayName="Drawer.Footer";function s({id:e,children:r,className:n,defaultView:o,placement:i="left",size:p="medium",onChange:m,...y}){containsExactChildren({children:r,componentName:s.displayName,restrictions:[[d,{min:0,max:1}],[h,{min:1,max:1}]]});const c=useRef(new Set),[w,u]=useState(o||null),T=useCallback(a=>{c.current.has(a?.payload?.view)&&(l.emit(ViewStackEventTypes.clear,{stack:e}),l.emit(ViewStackEventTypes.push,a.payload));},[e]),V=useCallback(a=>{c.current.has(a?.payload?.view)&&(l.emit(ViewStackEventTypes.clear,{stack:e}),w!==a?.payload?.view&&l.emit(ViewStackEventTypes.push,a.payload));},[e,w]);return useEffect(()=>{const a=[l.on(DrawerEventTypes.open,T),l.on(DrawerEventTypes.toggle,V)];return ()=>{for(const A of a)A();}},[T,V]),jsx(R.Provider,{value:{register:a=>c.current.add(a),unregister:a=>c.current.delete(a)},children:jsx(ViewStack,{id:e,defaultView:o,onChange:a=>{u(a),m?.(a);},children:jsx("div",{...y,className:re({className:n}),"data-open":!!w||null,"data-placement":i,"data-size":p,children:r})})})}s.displayName="Drawer",s.Layout=P,s.Menu=d,s.Panel=h,s.View=H,s.Header=C,s.Content=L,s.Footer=W,s.Trigger=g;export{s as Drawer,R as DrawerContext,le as DrawerEventHandlers};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|