@corefoundry-labs/forge-ui 1.0.2 → 1.1.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/LICENSE +202 -0
- package/README.md +78 -0
- package/dist/components/layout/ThemeScope/ThemeScope.d.ts +11 -0
- package/dist/components/layout/ThemeScope/ThemeScope.d.ts.map +1 -0
- package/dist/components/layout/ThemeScope/ThemeScope.js +13 -0
- package/dist/components/layout/ThemeScope/index.d.ts +3 -0
- package/dist/components/layout/ThemeScope/index.d.ts.map +1 -0
- package/dist/components/layout/ThemeScope/index.js +1 -0
- package/dist/componentsV2/actions/ButtonV2/ButtonV2.d.ts +21 -0
- package/dist/componentsV2/actions/ButtonV2/ButtonV2.d.ts.map +1 -0
- package/dist/componentsV2/actions/ButtonV2/ButtonV2.js +17 -0
- package/dist/componentsV2/actions/ButtonV2/ButtonV2.module.css +158 -0
- package/dist/componentsV2/actions/ButtonV2/index.d.ts +3 -0
- package/dist/componentsV2/actions/ButtonV2/index.d.ts.map +1 -0
- package/dist/componentsV2/actions/ButtonV2/index.js +1 -0
- package/dist/componentsV2/data-display/AvatarV2/AvatarV2.d.ts +36 -0
- package/dist/componentsV2/data-display/AvatarV2/AvatarV2.d.ts.map +1 -0
- package/dist/componentsV2/data-display/AvatarV2/AvatarV2.js +23 -0
- package/dist/componentsV2/data-display/AvatarV2/AvatarV2.module.css +156 -0
- package/dist/componentsV2/data-display/AvatarV2/index.d.ts +3 -0
- package/dist/componentsV2/data-display/AvatarV2/index.d.ts.map +1 -0
- package/dist/componentsV2/data-display/AvatarV2/index.js +1 -0
- package/dist/componentsV2/feedback/AlertV2/AlertV2.d.ts +25 -0
- package/dist/componentsV2/feedback/AlertV2/AlertV2.d.ts.map +1 -0
- package/dist/componentsV2/feedback/AlertV2/AlertV2.js +16 -0
- package/dist/componentsV2/feedback/AlertV2/AlertV2.module.css +144 -0
- package/dist/componentsV2/feedback/AlertV2/index.d.ts +3 -0
- package/dist/componentsV2/feedback/AlertV2/index.d.ts.map +1 -0
- package/dist/componentsV2/feedback/AlertV2/index.js +1 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/FeedbackStateV2.d.ts +13 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/FeedbackStateV2.d.ts.map +1 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/FeedbackStateV2.js +18 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/FeedbackStateV2.module.css +102 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/index.d.ts +3 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/index.d.ts.map +1 -0
- package/dist/componentsV2/feedback/FeedbackStateV2/index.js +1 -0
- package/dist/componentsV2/feedback/ProgressV2/ProgressV2.d.ts +35 -0
- package/dist/componentsV2/feedback/ProgressV2/ProgressV2.d.ts.map +1 -0
- package/dist/componentsV2/feedback/ProgressV2/ProgressV2.js +15 -0
- package/dist/componentsV2/feedback/ProgressV2/ProgressV2.module.css +161 -0
- package/dist/componentsV2/feedback/ProgressV2/index.d.ts +3 -0
- package/dist/componentsV2/feedback/ProgressV2/index.d.ts.map +1 -0
- package/dist/componentsV2/feedback/ProgressV2/index.js +1 -0
- package/dist/componentsV2/feedback/SkeletonV2/SkeletonV2.d.ts +20 -0
- package/dist/componentsV2/feedback/SkeletonV2/SkeletonV2.d.ts.map +1 -0
- package/dist/componentsV2/feedback/SkeletonV2/SkeletonV2.js +8 -0
- package/dist/componentsV2/feedback/SkeletonV2/SkeletonV2.module.css +92 -0
- package/dist/componentsV2/feedback/SkeletonV2/index.d.ts +3 -0
- package/dist/componentsV2/feedback/SkeletonV2/index.d.ts.map +1 -0
- package/dist/componentsV2/feedback/SkeletonV2/index.js +1 -0
- package/dist/componentsV2/feedback/SnackbarV2/SnackbarV2.d.ts +35 -0
- package/dist/componentsV2/feedback/SnackbarV2/SnackbarV2.d.ts.map +1 -0
- package/dist/componentsV2/feedback/SnackbarV2/SnackbarV2.js +90 -0
- package/dist/componentsV2/feedback/SnackbarV2/SnackbarV2.module.css +162 -0
- package/dist/componentsV2/feedback/SnackbarV2/index.d.ts +3 -0
- package/dist/componentsV2/feedback/SnackbarV2/index.d.ts.map +1 -0
- package/dist/componentsV2/feedback/SnackbarV2/index.js +1 -0
- package/dist/componentsV2/forms/CheckboxV2/CheckboxV2.d.ts +10 -0
- package/dist/componentsV2/forms/CheckboxV2/CheckboxV2.d.ts.map +1 -0
- package/dist/componentsV2/forms/CheckboxV2/CheckboxV2.js +18 -0
- package/dist/componentsV2/forms/CheckboxV2/CheckboxV2.module.css +137 -0
- package/dist/componentsV2/forms/CheckboxV2/index.d.ts +3 -0
- package/dist/componentsV2/forms/CheckboxV2/index.d.ts.map +1 -0
- package/dist/componentsV2/forms/CheckboxV2/index.js +1 -0
- package/dist/componentsV2/forms/SelectV2/SelectV2.d.ts +10 -0
- package/dist/componentsV2/forms/SelectV2/SelectV2.d.ts.map +1 -0
- package/dist/componentsV2/forms/SelectV2/SelectV2.js +7 -0
- package/dist/componentsV2/forms/SelectV2/SelectV2.module.css +90 -0
- package/dist/componentsV2/forms/SelectV2/index.d.ts +3 -0
- package/dist/componentsV2/forms/SelectV2/index.d.ts.map +1 -0
- package/dist/componentsV2/forms/SelectV2/index.js +1 -0
- package/dist/componentsV2/forms/SwitchV2/SwitchV2.d.ts +8 -0
- package/dist/componentsV2/forms/SwitchV2/SwitchV2.d.ts.map +1 -0
- package/dist/componentsV2/forms/SwitchV2/SwitchV2.js +8 -0
- package/dist/componentsV2/forms/SwitchV2/SwitchV2.module.css +129 -0
- package/dist/componentsV2/forms/SwitchV2/index.d.ts +3 -0
- package/dist/componentsV2/forms/SwitchV2/index.d.ts.map +1 -0
- package/dist/componentsV2/forms/SwitchV2/index.js +1 -0
- package/dist/componentsV2/forms/TextInputV2/TextInputV2.d.ts +10 -0
- package/dist/componentsV2/forms/TextInputV2/TextInputV2.d.ts.map +1 -0
- package/dist/componentsV2/forms/TextInputV2/TextInputV2.js +7 -0
- package/dist/componentsV2/forms/TextInputV2/TextInputV2.module.css +64 -0
- package/dist/componentsV2/forms/TextInputV2/index.d.ts +3 -0
- package/dist/componentsV2/forms/TextInputV2/index.d.ts.map +1 -0
- package/dist/componentsV2/forms/TextInputV2/index.js +1 -0
- package/dist/componentsV2/forms/selectionControl.d.ts +14 -0
- package/dist/componentsV2/forms/selectionControl.d.ts.map +1 -0
- package/dist/componentsV2/forms/selectionControl.js +1 -0
- package/dist/componentsV2/navigation/TabsV2/TabsV2.d.ts +30 -0
- package/dist/componentsV2/navigation/TabsV2/TabsV2.d.ts.map +1 -0
- package/dist/componentsV2/navigation/TabsV2/TabsV2.js +54 -0
- package/dist/componentsV2/navigation/TabsV2/TabsV2.module.css +128 -0
- package/dist/componentsV2/navigation/TabsV2/index.d.ts +3 -0
- package/dist/componentsV2/navigation/TabsV2/index.d.ts.map +1 -0
- package/dist/componentsV2/navigation/TabsV2/index.js +1 -0
- package/dist/componentsV2/overlays/DialogV2/DialogV2.d.ts +22 -0
- package/dist/componentsV2/overlays/DialogV2/DialogV2.d.ts.map +1 -0
- package/dist/componentsV2/overlays/DialogV2/DialogV2.js +77 -0
- package/dist/componentsV2/overlays/DialogV2/DialogV2.module.css +91 -0
- package/dist/componentsV2/overlays/DialogV2/index.d.ts +3 -0
- package/dist/componentsV2/overlays/DialogV2/index.d.ts.map +1 -0
- package/dist/componentsV2/overlays/DialogV2/index.js +1 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/DropdownMenuV2.d.ts +40 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/DropdownMenuV2.d.ts.map +1 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/DropdownMenuV2.js +115 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/DropdownMenuV2.module.css +122 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/index.d.ts +3 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/index.d.ts.map +1 -0
- package/dist/componentsV2/overlays/DropdownMenuV2/index.js +1 -0
- package/dist/componentsV2/overlays/PopoverV2/PopoverV2.d.ts +46 -0
- package/dist/componentsV2/overlays/PopoverV2/PopoverV2.d.ts.map +1 -0
- package/dist/componentsV2/overlays/PopoverV2/PopoverV2.js +41 -0
- package/dist/componentsV2/overlays/PopoverV2/PopoverV2.module.css +63 -0
- package/dist/componentsV2/overlays/PopoverV2/index.d.ts +3 -0
- package/dist/componentsV2/overlays/PopoverV2/index.d.ts.map +1 -0
- package/dist/componentsV2/overlays/PopoverV2/index.js +1 -0
- package/dist/componentsV2/overlays/TooltipV2/TooltipV2.d.ts +18 -0
- package/dist/componentsV2/overlays/TooltipV2/TooltipV2.d.ts.map +1 -0
- package/dist/componentsV2/overlays/TooltipV2/TooltipV2.js +66 -0
- package/dist/componentsV2/overlays/TooltipV2/TooltipV2.module.css +69 -0
- package/dist/componentsV2/overlays/TooltipV2/index.d.ts +3 -0
- package/dist/componentsV2/overlays/TooltipV2/index.d.ts.map +1 -0
- package/dist/componentsV2/overlays/TooltipV2/index.js +1 -0
- package/dist/componentsV2/overlays/layer.d.ts +29 -0
- package/dist/componentsV2/overlays/layer.d.ts.map +1 -0
- package/dist/componentsV2/overlays/layer.js +224 -0
- package/dist/componentsV2/overlays/position.d.ts +32 -0
- package/dist/componentsV2/overlays/position.d.ts.map +1 -0
- package/dist/componentsV2/overlays/position.js +42 -0
- package/dist/componentsV2/status/BadgeV2/BadgeV2.d.ts +18 -0
- package/dist/componentsV2/status/BadgeV2/BadgeV2.d.ts.map +1 -0
- package/dist/componentsV2/status/BadgeV2/BadgeV2.js +7 -0
- package/dist/componentsV2/status/BadgeV2/BadgeV2.module.css +94 -0
- package/dist/componentsV2/status/BadgeV2/index.d.ts +3 -0
- package/dist/componentsV2/status/BadgeV2/index.d.ts.map +1 -0
- package/dist/componentsV2/status/BadgeV2/index.js +1 -0
- package/dist/componentsV2/surfaces/CardV2/CardV2.d.ts +28 -0
- package/dist/componentsV2/surfaces/CardV2/CardV2.d.ts.map +1 -0
- package/dist/componentsV2/surfaces/CardV2/CardV2.js +16 -0
- package/dist/componentsV2/surfaces/CardV2/CardV2.module.css +84 -0
- package/dist/componentsV2/surfaces/CardV2/index.d.ts +3 -0
- package/dist/componentsV2/surfaces/CardV2/index.d.ts.map +1 -0
- package/dist/componentsV2/surfaces/CardV2/index.js +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/package.json +16 -5
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--cf-v2-selection-gap);
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
color: var(--cf-v2-on-surface);
|
|
7
|
+
font-family: inherit;
|
|
8
|
+
font-size: var(--cf-v2-selection-label-font-size);
|
|
9
|
+
font-weight: var(--cf-v2-selection-label-font-weight);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root[data-disabled] {
|
|
14
|
+
color: var(--cf-v2-on-surface-variant);
|
|
15
|
+
cursor: not-allowed;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.target {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
flex: none;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: var(--cf-v2-selection-target-size);
|
|
25
|
+
height: var(--cf-v2-selection-target-size);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.input {
|
|
29
|
+
position: absolute;
|
|
30
|
+
inset: 0;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin: 0;
|
|
34
|
+
border-radius: var(--cf-v2-checkbox-target-radius);
|
|
35
|
+
background: transparent;
|
|
36
|
+
appearance: none;
|
|
37
|
+
cursor: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input:focus-visible {
|
|
41
|
+
outline: var(--cf-v2-selection-focus-width) solid var(--cf-v2-focus-ring);
|
|
42
|
+
outline-offset: calc(-1 * var(--cf-v2-selection-focus-width));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.box {
|
|
46
|
+
position: relative;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
width: var(--cf-v2-checkbox-size);
|
|
49
|
+
height: var(--cf-v2-checkbox-size);
|
|
50
|
+
border: var(--cf-v2-checkbox-border-width) solid var(--cf-v2-outline);
|
|
51
|
+
border-radius: var(--cf-v2-checkbox-radius);
|
|
52
|
+
background: var(--cf-v2-surface-container);
|
|
53
|
+
color: var(--cf-v2-on-action-primary);
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
transition: background-color var(--cf-v2-selection-transition-duration) ease;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.check,
|
|
59
|
+
.mixed {
|
|
60
|
+
position: absolute;
|
|
61
|
+
inset: calc(-1 * var(--cf-v2-checkbox-border-width));
|
|
62
|
+
display: none;
|
|
63
|
+
width: var(--cf-v2-checkbox-size);
|
|
64
|
+
height: var(--cf-v2-checkbox-size);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.input:checked:not(:indeterminate) + .box .check,
|
|
68
|
+
.input:indeterminate + .box .mixed {
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.root:hover .input:not(:disabled) + .box {
|
|
73
|
+
background: var(--cf-v2-surface-container-hover);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.root:active .input:not(:disabled) + .box {
|
|
77
|
+
background: var(--cf-v2-surface-container-pressed);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.input:checked + .box,
|
|
81
|
+
.input:indeterminate + .box {
|
|
82
|
+
border-color: var(--cf-v2-action-primary);
|
|
83
|
+
background: var(--cf-v2-action-primary);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.root:hover .input:checked:not(:disabled) + .box,
|
|
87
|
+
.root:hover .input:indeterminate:not(:disabled) + .box {
|
|
88
|
+
border-color: var(--cf-v2-action-primary-hover);
|
|
89
|
+
background: var(--cf-v2-action-primary-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.root:active .input:checked:not(:disabled) + .box,
|
|
93
|
+
.root:active .input:indeterminate:not(:disabled) + .box {
|
|
94
|
+
border-color: var(--cf-v2-action-primary-pressed);
|
|
95
|
+
background: var(--cf-v2-action-primary-pressed);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.input[aria-invalid='true'] + .box {
|
|
99
|
+
border-color: var(--cf-v2-error);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.input[aria-invalid='true']:checked + .box,
|
|
103
|
+
.input[aria-invalid='true']:indeterminate + .box {
|
|
104
|
+
background: var(--cf-v2-error);
|
|
105
|
+
color: var(--cf-v2-on-error);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.root:hover .input[aria-invalid='true']:checked:not(:disabled) + .box,
|
|
109
|
+
.root:hover .input[aria-invalid='true']:indeterminate:not(:disabled) + .box {
|
|
110
|
+
border-color: var(--cf-v2-error-hover);
|
|
111
|
+
background: var(--cf-v2-error-hover);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.root:active .input[aria-invalid='true']:checked:not(:disabled) + .box,
|
|
115
|
+
.root:active .input[aria-invalid='true']:indeterminate:not(:disabled) + .box {
|
|
116
|
+
border-color: var(--cf-v2-error-pressed);
|
|
117
|
+
background: var(--cf-v2-error-pressed);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.input:disabled + .box {
|
|
121
|
+
opacity: var(--cf-v2-checkbox-disabled-opacity);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.input:disabled:not(:checked, :indeterminate) + .box {
|
|
125
|
+
background: var(--cf-v2-disabled);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.label {
|
|
129
|
+
min-width: 0;
|
|
130
|
+
overflow-wrap: anywhere;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (prefers-reduced-motion: reduce) {
|
|
134
|
+
.box {
|
|
135
|
+
transition: none;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/CheckboxV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CheckboxV2 } from './CheckboxV2';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
2
|
+
import { type SelectHTMLAttributes } from 'react';
|
|
3
|
+
export type SelectV2Size = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type SelectV2Props = Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'multiple'> & {
|
|
5
|
+
size?: SelectV2Size;
|
|
6
|
+
};
|
|
7
|
+
export declare const SelectV2: import("react").ForwardRefExoticComponent<Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> & {
|
|
8
|
+
size?: SelectV2Size;
|
|
9
|
+
} & import("react").RefAttributes<HTMLSelectElement>>;
|
|
10
|
+
//# sourceMappingURL=SelectV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectV2.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/SelectV2/SelectV2.tsx"],"names":[],"mappings":"AAAA,OAAO,oDAAoD,CAAC;AAC5D,OAAO,EAAc,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG9D,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IAC/F,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,QAAQ;WAHZ,YAAY;qDAqBnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styles from './SelectV2.module.css';
|
|
5
|
+
export const SelectV2 = forwardRef(function SelectV2({ size = 'md', className, style, ...props }, ref) {
|
|
6
|
+
return (_jsxs("span", { className: [styles.root, className].filter(Boolean).join(' '), style: style, children: [_jsx("select", { ...props, ref: ref, "data-size": size, className: [styles.select, styles[size]].join(' ') }), _jsx("svg", { className: styles.chevron, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M3 6L8 11L13 6", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })] }));
|
|
7
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
color: var(--cf-v2-on-surface);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.select {
|
|
10
|
+
display: block;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
width: 100%;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding-inline: var(--cf-v2-field-padding);
|
|
15
|
+
padding-inline-end: calc(var(--cf-v2-field-padding) + var(--cf-v2-select-icon-size) + var(--cf-v2-field-gap));
|
|
16
|
+
border: var(--cf-v2-field-border-width) solid var(--cf-v2-outline);
|
|
17
|
+
border-radius: var(--cf-v2-field-radius);
|
|
18
|
+
background: var(--cf-v2-surface-container);
|
|
19
|
+
color: var(--cf-v2-on-surface);
|
|
20
|
+
font-family: inherit;
|
|
21
|
+
line-height: normal;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
appearance: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
transition: background-color var(--cf-v2-field-transition-duration) ease;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sm {
|
|
29
|
+
height: var(--cf-v2-field-height-sm);
|
|
30
|
+
font-size: var(--cf-v2-field-font-size-sm);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.md {
|
|
34
|
+
height: var(--cf-v2-field-height-md);
|
|
35
|
+
font-size: var(--cf-v2-field-font-size-md);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.lg {
|
|
39
|
+
height: var(--cf-v2-field-height-lg);
|
|
40
|
+
font-size: var(--cf-v2-field-font-size-lg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.select option {
|
|
44
|
+
background: var(--cf-v2-surface-container);
|
|
45
|
+
color: var(--cf-v2-on-surface);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.select:has(option[value='']:checked) {
|
|
49
|
+
color: color-mix(in srgb, var(--cf-v2-on-surface-variant) calc(var(--cf-v2-select-placeholder-opacity) * 100%), transparent);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.select:hover:not(:disabled) {
|
|
53
|
+
background: var(--cf-v2-surface-container-hover);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.select[aria-invalid='true'] {
|
|
57
|
+
outline: var(--cf-v2-field-state-border-width) solid var(--cf-v2-error);
|
|
58
|
+
outline-offset: calc(-1 * var(--cf-v2-field-state-border-width));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.select:focus {
|
|
62
|
+
outline: var(--cf-v2-field-state-border-width) solid var(--cf-v2-focus-ring);
|
|
63
|
+
outline-offset: calc(-1 * var(--cf-v2-field-state-border-width));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.select:disabled {
|
|
67
|
+
background: var(--cf-v2-disabled);
|
|
68
|
+
opacity: var(--cf-v2-select-disabled-opacity);
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.chevron {
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset-block: 0;
|
|
75
|
+
inset-inline-end: var(--cf-v2-field-padding);
|
|
76
|
+
width: var(--cf-v2-select-icon-size);
|
|
77
|
+
height: var(--cf-v2-select-icon-size);
|
|
78
|
+
margin-block: auto;
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.select:disabled + .chevron {
|
|
83
|
+
opacity: var(--cf-v2-select-disabled-opacity);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (prefers-reduced-motion: reduce) {
|
|
87
|
+
.select {
|
|
88
|
+
transition: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/SelectV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectV2 } from './SelectV2';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
2
|
+
import { type InputHTMLAttributes } from 'react';
|
|
3
|
+
import type { SelectionControlName } from '../selectionControl';
|
|
4
|
+
type SwitchV2Base = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'size' | 'children'>;
|
|
5
|
+
export type SwitchV2Props = SwitchV2Base & SelectionControlName;
|
|
6
|
+
export declare const SwitchV2: import("react").ForwardRefExoticComponent<SwitchV2Props & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=SwitchV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchV2.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/SwitchV2/SwitchV2.tsx"],"names":[],"mappings":"AAAA,OAAO,oDAAoD,CAAC;AAC5D,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,KAAK,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;AAEvG,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,oBAAoB,CAAC;AAEhE,eAAO,MAAM,QAAQ,4GAqBnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styles from './SwitchV2.module.css';
|
|
5
|
+
export const SwitchV2 = forwardRef(function SwitchV2({ className, style, children, ...props }, ref) {
|
|
6
|
+
const Root = children == null ? 'span' : 'label';
|
|
7
|
+
return (_jsxs(Root, { className: [styles.root, className].filter(Boolean).join(' '), style: style, "data-disabled": props.disabled || undefined, children: [_jsxs("span", { className: styles.target, children: [_jsx("input", { ...props, ref: ref, type: "checkbox", role: "switch", className: styles.input }), _jsx("span", { className: styles.track, "aria-hidden": "true", children: _jsx("span", { className: styles.thumb }) })] }), children != null && _jsx("span", { className: styles.label, children: children })] }));
|
|
8
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--cf-v2-selection-gap);
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
color: var(--cf-v2-on-surface);
|
|
7
|
+
font-family: inherit;
|
|
8
|
+
font-size: var(--cf-v2-selection-label-font-size);
|
|
9
|
+
font-weight: var(--cf-v2-selection-label-font-weight);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root[data-disabled] {
|
|
14
|
+
color: var(--cf-v2-on-surface-variant);
|
|
15
|
+
cursor: not-allowed;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.target {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
flex: none;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: var(--cf-v2-selection-target-size);
|
|
25
|
+
height: var(--cf-v2-selection-target-size);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.input {
|
|
29
|
+
position: absolute;
|
|
30
|
+
inset: 0;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin: 0;
|
|
34
|
+
border-radius: var(--cf-v2-switch-target-radius);
|
|
35
|
+
background: transparent;
|
|
36
|
+
appearance: none;
|
|
37
|
+
cursor: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input:focus-visible {
|
|
41
|
+
outline: var(--cf-v2-selection-focus-width) solid var(--cf-v2-focus-ring);
|
|
42
|
+
outline-offset: calc(-1 * var(--cf-v2-selection-focus-width));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.track {
|
|
46
|
+
position: relative;
|
|
47
|
+
flex: none;
|
|
48
|
+
width: var(--cf-v2-switch-width);
|
|
49
|
+
height: var(--cf-v2-switch-height);
|
|
50
|
+
border-radius: var(--cf-v2-switch-radius);
|
|
51
|
+
outline: var(--cf-v2-switch-border-width) solid var(--cf-v2-outline);
|
|
52
|
+
outline-offset: calc(-1 * var(--cf-v2-switch-border-width));
|
|
53
|
+
background: var(--cf-v2-surface-container);
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
transition: background-color var(--cf-v2-selection-transition-duration) ease;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.thumb {
|
|
59
|
+
position: absolute;
|
|
60
|
+
inset-block: 0;
|
|
61
|
+
inset-inline-start: var(--cf-v2-switch-thumb-offset-off);
|
|
62
|
+
width: var(--cf-v2-switch-thumb-size);
|
|
63
|
+
height: var(--cf-v2-switch-thumb-size);
|
|
64
|
+
margin-block: auto;
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
background: var(--cf-v2-on-surface);
|
|
67
|
+
transition: inset-inline-start var(--cf-v2-selection-transition-duration) ease;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.root:hover .input:not(:disabled) + .track {
|
|
71
|
+
background: var(--cf-v2-surface-container-hover);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.root:active .input:not(:disabled) + .track {
|
|
75
|
+
background: var(--cf-v2-surface-container-pressed);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.input:checked + .track {
|
|
79
|
+
outline-color: transparent;
|
|
80
|
+
background: var(--cf-v2-action-primary);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.input:checked + .track .thumb {
|
|
84
|
+
inset-inline-start: var(--cf-v2-switch-thumb-offset-on);
|
|
85
|
+
background: var(--cf-v2-on-action-primary);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.root:hover .input:checked:not(:disabled) + .track {
|
|
89
|
+
background: var(--cf-v2-action-primary-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.root:active .input:checked:not(:disabled) + .track {
|
|
93
|
+
background: var(--cf-v2-action-primary-pressed);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.input:disabled + .track {
|
|
97
|
+
opacity: var(--cf-v2-switch-disabled-opacity);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.input:disabled:not(:checked) + .track {
|
|
101
|
+
background: var(--cf-v2-disabled);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.label {
|
|
105
|
+
min-width: 0;
|
|
106
|
+
overflow-wrap: anywhere;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
.track,
|
|
111
|
+
.thumb {
|
|
112
|
+
transition: none;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@media (forced-colors: active) {
|
|
117
|
+
.thumb {
|
|
118
|
+
background: CanvasText;
|
|
119
|
+
forced-color-adjust: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.input:checked + .track {
|
|
123
|
+
outline-color: Highlight;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.input:checked + .track .thumb {
|
|
127
|
+
background: Highlight;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/SwitchV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwitchV2 } from './SwitchV2';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
2
|
+
import { type InputHTMLAttributes } from 'react';
|
|
3
|
+
export type TextInputV2Size = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type TextInputV2Props = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
5
|
+
size?: TextInputV2Size;
|
|
6
|
+
};
|
|
7
|
+
export declare const TextInputV2: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
8
|
+
size?: TextInputV2Size;
|
|
9
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
+
//# sourceMappingURL=TextInputV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInputV2.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/TextInputV2/TextInputV2.tsx"],"names":[],"mappings":"AAAA,OAAO,oDAAoD,CAAC;AAC5D,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAG7D,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAAG;IACnF,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW;WAHf,eAAe;oDAetB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styles from './TextInputV2.module.css';
|
|
5
|
+
export const TextInputV2 = forwardRef(function TextInputV2({ size = 'md', className, ...props }, ref) {
|
|
6
|
+
return (_jsx("input", { ...props, ref: ref, "data-size": size, className: [styles.input, styles[size], className].filter(Boolean).join(' ') }));
|
|
7
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.input {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding-inline: var(--cf-v2-field-padding);
|
|
7
|
+
border: var(--cf-v2-field-border-width) solid var(--cf-v2-outline);
|
|
8
|
+
border-radius: var(--cf-v2-field-radius);
|
|
9
|
+
background: var(--cf-v2-surface-container);
|
|
10
|
+
color: var(--cf-v2-on-surface);
|
|
11
|
+
font-family: inherit;
|
|
12
|
+
line-height: normal;
|
|
13
|
+
transition: background-color var(--cf-v2-field-transition-duration) ease;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sm {
|
|
17
|
+
height: var(--cf-v2-field-height-sm);
|
|
18
|
+
font-size: var(--cf-v2-field-font-size-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.md {
|
|
22
|
+
height: var(--cf-v2-field-height-md);
|
|
23
|
+
font-size: var(--cf-v2-field-font-size-md);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lg {
|
|
27
|
+
height: var(--cf-v2-field-height-lg);
|
|
28
|
+
font-size: var(--cf-v2-field-font-size-lg);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input::placeholder {
|
|
32
|
+
color: var(--cf-v2-on-surface-variant);
|
|
33
|
+
opacity: var(--cf-v2-field-placeholder-opacity);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input:hover:not(:disabled, [readonly]) {
|
|
37
|
+
background: var(--cf-v2-surface-container-hover);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input[aria-invalid='true'] {
|
|
41
|
+
outline: var(--cf-v2-field-state-border-width) solid var(--cf-v2-error);
|
|
42
|
+
outline-offset: calc(-1 * var(--cf-v2-field-state-border-width));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input:focus-visible {
|
|
46
|
+
outline: var(--cf-v2-field-state-border-width) solid var(--cf-v2-focus-ring);
|
|
47
|
+
outline-offset: calc(-1 * var(--cf-v2-field-state-border-width));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.input[readonly] {
|
|
51
|
+
opacity: var(--cf-v2-field-readonly-opacity);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.input:disabled {
|
|
55
|
+
background: var(--cf-v2-disabled);
|
|
56
|
+
opacity: var(--cf-v2-field-disabled-opacity);
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (prefers-reduced-motion: reduce) {
|
|
61
|
+
.input {
|
|
62
|
+
transition: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/forms/TextInputV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextInputV2 } from './TextInputV2';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type SelectionControlName = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
} | {
|
|
5
|
+
children?: undefined;
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
} | {
|
|
8
|
+
children?: undefined;
|
|
9
|
+
'aria-labelledby': string;
|
|
10
|
+
} | {
|
|
11
|
+
children?: undefined;
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=selectionControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionControl.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/forms/selectionControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GACvB;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
2
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
3
|
+
export type TabsV2Variant = 'underline' | 'pill';
|
|
4
|
+
export type TabsV2Size = 'sm' | 'md';
|
|
5
|
+
export type TabsV2Activation = 'automatic' | 'manual';
|
|
6
|
+
export type TabsV2Item = {
|
|
7
|
+
id: string;
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type TabsV2Base = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'aria-label' | 'aria-labelledby'> & {
|
|
13
|
+
items: readonly TabsV2Item[];
|
|
14
|
+
value?: string;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
onValueChange?: (id: string) => void;
|
|
17
|
+
variant?: TabsV2Variant;
|
|
18
|
+
size?: TabsV2Size;
|
|
19
|
+
activation?: TabsV2Activation;
|
|
20
|
+
};
|
|
21
|
+
export type TabsV2Props = TabsV2Base & ({
|
|
22
|
+
'aria-label': string;
|
|
23
|
+
'aria-labelledby'?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
'aria-label'?: undefined;
|
|
26
|
+
'aria-labelledby': string;
|
|
27
|
+
});
|
|
28
|
+
export declare const TabsV2: import("react").ForwardRefExoticComponent<TabsV2Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=TabsV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsV2.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/navigation/TabsV2/TabsV2.tsx"],"names":[],"mappings":"AAAA,OAAO,oDAAoD,CAAC;AAC5D,OAAO,EAML,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AACrC,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,UAAU,GAAG,IAAI,CACpB,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,iBAAiB,CAC5E,GAAG;IACF,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,GAClC,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,YAAY,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtH,eAAO,MAAM,MAAM,wGAyGjB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import '@corefoundry-labs/forge-tokens/theme-v2/tokens.css';
|
|
3
|
+
import { forwardRef, useId, useRef, useState, } from 'react';
|
|
4
|
+
import styles from './TabsV2.module.css';
|
|
5
|
+
export const TabsV2 = forwardRef(function TabsV2({ items, value, defaultValue, onValueChange, variant = 'underline', size = 'md', activation = 'automatic', className, 'aria-label': label, 'aria-labelledby': labelledBy, ...props }, ref) {
|
|
6
|
+
const base = useId();
|
|
7
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
8
|
+
const [focused, setFocused] = useState(null);
|
|
9
|
+
const tabs = useRef(new Map());
|
|
10
|
+
const enabled = items.filter((item) => !item.disabled);
|
|
11
|
+
const requested = value ?? internal;
|
|
12
|
+
const selected = enabled.find((item) => item.id === requested) ?? enabled[0];
|
|
13
|
+
const tabStop = focused ?? selected?.id;
|
|
14
|
+
const select = (id) => {
|
|
15
|
+
if (id === selected?.id && (requested === undefined || requested === id))
|
|
16
|
+
return;
|
|
17
|
+
if (value === undefined)
|
|
18
|
+
setInternal(id);
|
|
19
|
+
onValueChange?.(id);
|
|
20
|
+
};
|
|
21
|
+
const onKeyDown = (event, id) => {
|
|
22
|
+
const index = enabled.findIndex((item) => item.id === id);
|
|
23
|
+
const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';
|
|
24
|
+
const targets = {
|
|
25
|
+
[rtl ? 'ArrowLeft' : 'ArrowRight']: enabled[(index + 1) % enabled.length],
|
|
26
|
+
[rtl ? 'ArrowRight' : 'ArrowLeft']: enabled[(index - 1 + enabled.length) % enabled.length],
|
|
27
|
+
Home: enabled[0],
|
|
28
|
+
End: enabled[enabled.length - 1],
|
|
29
|
+
};
|
|
30
|
+
const target = targets[event.key];
|
|
31
|
+
if (!target)
|
|
32
|
+
return;
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
setFocused(target.id);
|
|
35
|
+
tabs.current.get(target.id)?.focus();
|
|
36
|
+
if (activation === 'automatic')
|
|
37
|
+
select(target.id);
|
|
38
|
+
};
|
|
39
|
+
const onBlur = (event) => {
|
|
40
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
41
|
+
setFocused(null);
|
|
42
|
+
};
|
|
43
|
+
if (items.length === 0)
|
|
44
|
+
return null;
|
|
45
|
+
return (_jsxs("div", { ...props, ref: ref, "data-variant": variant, "data-size": size, className: [styles.root, className].filter(Boolean).join(' '), children: [_jsx("div", { role: "tablist", "aria-label": label, "aria-labelledby": labelledBy, className: styles.list, onBlur: onBlur, children: items.map((item, index) => (_jsxs("button", { ref: (node) => {
|
|
46
|
+
if (node)
|
|
47
|
+
tabs.current.set(item.id, node);
|
|
48
|
+
else
|
|
49
|
+
tabs.current.delete(item.id);
|
|
50
|
+
}, id: `${base}-tab-${index}`, type: "button", role: "tab", "aria-selected": item.id === selected?.id, "aria-controls": `${base}-panel-${index}`, tabIndex: item.id === tabStop ? 0 : -1, disabled: item.disabled, onClick: () => {
|
|
51
|
+
setFocused(item.id);
|
|
52
|
+
select(item.id);
|
|
53
|
+
}, onKeyDown: (event) => onKeyDown(event, item.id), className: [styles.tab, styles[variant], styles[size]].join(' '), children: [_jsx("span", { children: item.label }), variant === 'underline' && _jsx("span", { className: styles.indicator, "aria-hidden": "true" })] }, item.id))) }), items.map((item, index) => (_jsx("div", { id: `${base}-panel-${index}`, role: "tabpanel", "aria-labelledby": `${base}-tab-${index}`, tabIndex: 0, hidden: item.id !== selected?.id, className: styles.panel, children: item.content }, item.id)))] }));
|
|
54
|
+
});
|