@strapi/design-system 1.6.5 → 1.7.0-alpha.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/README.md +55 -0
- package/dist/BaseButton/BaseButton.cjs +4 -4
- package/dist/BaseButton/BaseButton.js +18 -17
- package/dist/BaseLink/BaseLink.cjs +1 -3
- package/dist/BaseLink/BaseLink.js +14 -14
- package/dist/Combobox/Combobox.cjs +104 -1
- package/dist/Combobox/Combobox.js +348 -278
- package/dist/Combobox/ComboboxList.cjs +1 -1
- package/dist/Combobox/ComboboxList.js +7 -6
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +3 -29
- package/dist/DatePicker/DatePicker.cjs +12 -1
- package/dist/DatePicker/DatePicker.js +79 -100
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +124 -57
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +42 -24
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +29 -12
- package/dist/DatePicker/components.cjs +8 -6
- package/dist/DatePicker/components.js +15 -13
- package/dist/DatePicker/utils/getDayOfWeek.js +8 -8
- package/dist/DatePicker/utils/getMonths.cjs +1 -1
- package/dist/DatePicker/utils/getMonths.js +3 -3
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +1 -1
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +97 -104
- package/dist/DateTimePicker/parseDate.cjs +1 -1
- package/dist/DateTimePicker/parseDate.js +2 -1
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +3 -3
- package/dist/Field/FieldLabel.cjs +5 -2
- package/dist/Field/FieldLabel.js +27 -27
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +32 -30
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +31 -31
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +4 -1
- package/dist/Select/MultiSelect.cjs +30 -0
- package/dist/Select/MultiSelect.js +239 -0
- package/dist/Select/MultiSelectNested.cjs +3 -1
- package/dist/Select/MultiSelectNested.js +25 -12
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +3 -22
- package/dist/Select/Option.cjs +1 -45
- package/dist/Select/Option.js +12 -100
- package/dist/Select/Select.cjs +1 -3
- package/dist/Select/Select.js +9 -205
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +98 -80
- package/dist/Select/SelectParts.cjs +79 -0
- package/dist/Select/SelectParts.js +221 -0
- package/dist/Select/SingleSelect.cjs +1 -0
- package/dist/Select/SingleSelect.js +129 -0
- package/dist/Select/index.cjs +1 -1
- package/dist/Select/index.js +15 -10
- package/dist/TextButton/TextButton.cjs +6 -12
- package/dist/TextButton/TextButton.js +32 -46
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +47 -46
- package/dist/TimePicker/TimePicker.cjs +5 -7
- package/dist/TimePicker/TimePicker.js +53 -103
- package/dist/helpers/objects.cjs +1 -1
- package/dist/helpers/objects.js +6 -22
- package/dist/hooks/useComposeRefs.cjs +1 -0
- package/dist/hooks/useComposeRefs.js +14 -0
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +143 -138
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +21 -13
- package/dist/themes/utils.cjs +6 -6
- package/dist/themes/utils.js +7 -6
- package/dist/v2/Link/Link.cjs +13 -11
- package/dist/v2/Link/Link.js +52 -37
- package/dist/v2/SimpleMenu/Menu.cjs +65 -0
- package/dist/v2/SimpleMenu/Menu.js +229 -0
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -33
- package/dist/v2/SimpleMenu/SimpleMenu.js +37 -176
- package/dist/v2/SimpleMenu/index.cjs +1 -1
- package/dist/v2/SimpleMenu/index.js +5 -3
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.js +53 -51
- package/package.json +7 -19
- package/dist/Combobox/components.cjs +0 -53
- package/dist/Combobox/components.js +0 -64
- package/dist/Combobox/utils.cjs +0 -1
- package/dist/Combobox/utils.js +0 -78
- package/dist/DateTimePicker/DateTimePickerProps.cjs +0 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +0 -40
- package/dist/DateTimePicker/__tests__/parseDate.test.cjs +0 -1
- package/dist/DateTimePicker/__tests__/parseDate.test.js +0 -8
- package/dist/Select/SelectButton.cjs +0 -19
- package/dist/Select/SelectButton.js +0 -67
- package/dist/Select/SelectTags.cjs +0 -6
- package/dist/Select/SelectTags.js +0 -38
- package/dist/Select/components.cjs +0 -39
- package/dist/Select/components.js +0 -48
- package/dist/Select/constants.cjs +0 -1
- package/dist/Select/constants.js +0 -8
- package/dist/Select/hooks/useButtonRef.cjs +0 -1
- package/dist/Select/hooks/useButtonRef.js +0 -13
- package/dist/Select/hooks/useListRef.cjs +0 -1
- package/dist/Select/hooks/useListRef.js +0 -18
- package/dist/Select/utils.cjs +0 -1
- package/dist/Select/utils.js +0 -17
- package/dist/helpers/arrays.cjs +0 -1
- package/dist/helpers/arrays.js +0 -6
- package/dist/v2/SimpleMenu/utils.cjs +0 -12
- package/dist/v2/SimpleMenu/utils.js +0 -15
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),w=require("react"),u=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),h=require("../Box/Box.cjs"),a=require("../Flex/Flex.cjs"),R=require("../hooks/useComposeRefs.cjs");require("../themes/lightTheme/index.cjs");require("../themes/darkTheme/index.cjs");require("lodash");const d=require("../themes/utils.cjs"),g=require("../Typography/Typography.cjs"),T=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function I(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const l=I(w),i=T(p),q=l.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:f,size:m="M",children:x,...b},y)=>{const c=l.useRef(null),S=j=>{e&&!n&&(e(j),c.current.focus())},$=R.useComposedRefs(c,y);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(C,{"aria-disabled":n,$hasError:f,$size:m,ref:$,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,...b,children:[r.jsxs(a.Flex,{as:"span",gap:4,children:[s&&r.jsx(h.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(a.Flex,{as:"span",gap:3,children:[e?r.jsx(v,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:S,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(u.Cross,{})}):null,r.jsx(k,{children:r.jsx(u.CarretDown,{})})]})]})})}),v=i.default(h.Box)`
|
|
2
|
+
border: none;
|
|
3
|
+
|
|
4
|
+
svg {
|
|
5
|
+
height: ${11/16}rem;
|
|
6
|
+
width: ${11/16}rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
svg path {
|
|
10
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
11
|
+
}
|
|
12
|
+
`,C=i.default(a.Flex)`
|
|
13
|
+
border: 1px solid ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
|
|
14
|
+
min-height: ${({theme:e,$size:t})=>d.getThemeSize("input")({theme:e,size:t})};
|
|
15
|
+
|
|
16
|
+
&[aria-disabled='true'] {
|
|
17
|
+
color: ${e=>e.theme.colors.neutral600};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({theme:e,$hasError:t})=>d.inputFocusStyle()({theme:e,hasError:t})};
|
|
26
|
+
`,k=i.default(o.Select.Icon)`
|
|
27
|
+
& > svg {
|
|
28
|
+
width: ${6/16}rem;
|
|
29
|
+
|
|
30
|
+
& > path {
|
|
31
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`,_=l.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(g.Typography,{ref:n,ellipsis:!0,...s,children:r.jsx(V,{placeholder:t,children:e})})),V=i.default(o.Select.Value)`
|
|
35
|
+
display: flex;
|
|
36
|
+
gap: ${({theme:e})=>e.spaces[1]};
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
`,F=i.default(o.Select.Content)`
|
|
39
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
40
|
+
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
41
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
42
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
43
|
+
min-width: var(--radix-select-trigger-width);
|
|
44
|
+
/* This is from the design-system figma file. */
|
|
45
|
+
max-height: 15rem;
|
|
46
|
+
`,P=i.default(o.Select.Viewport)`
|
|
47
|
+
padding: ${({theme:e})=>e.spaces[1]};
|
|
48
|
+
`,B=l.forwardRef((e,t)=>r.jsx(M,{ref:t,...e})),O=p.css`
|
|
49
|
+
width: 100%;
|
|
50
|
+
border: none;
|
|
51
|
+
text-align: left;
|
|
52
|
+
outline-offset: -3px;
|
|
53
|
+
border-radius: ${e=>e.theme.borderRadius};
|
|
54
|
+
padding: ${e=>`${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
55
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
56
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: ${({theme:e})=>e.spaces[2]};
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
outline: none;
|
|
64
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
65
|
+
}
|
|
66
|
+
`,M=i.default(o.Select.Item)`
|
|
67
|
+
${O}
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&[data-state='checked'] {
|
|
74
|
+
${g.Typography} {
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,z=o.Select.Root,D=q,G=_,E=o.Select.Portal,L=F,N=P,A=B,H=o.Select.ItemIndicator,J=o.Select.ItemText,K=o.Select.Group;exports.Content=L;exports.Group=K;exports.Item=A;exports.ItemIndicator=H;exports.ItemText=J;exports.Portal=E;exports.Root=z;exports.Trigger=D;exports.Value=G;exports.Viewport=N;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { Cross as y, CarretDown as R } from "@strapi/icons";
|
|
4
|
+
import { Select as o } from "@strapi/ui-primitives";
|
|
5
|
+
import s, { css as S } from "styled-components";
|
|
6
|
+
import { Box as p } from "../Box/Box.js";
|
|
7
|
+
import { Flex as c } from "../Flex/Flex.js";
|
|
8
|
+
import { useComposedRefs as I } from "../hooks/useComposeRefs.js";
|
|
9
|
+
import "../themes/lightTheme/index.js";
|
|
10
|
+
import "../themes/darkTheme/index.js";
|
|
11
|
+
import "lodash";
|
|
12
|
+
import { getThemeSize as C, inputFocusStyle as k } from "../themes/utils.js";
|
|
13
|
+
import { Typography as u } from "../Typography/Typography.js";
|
|
14
|
+
const v = a.forwardRef(({
|
|
15
|
+
onClear: e,
|
|
16
|
+
clearLabel: r = "Clear",
|
|
17
|
+
startIcon: n,
|
|
18
|
+
disabled: i,
|
|
19
|
+
hasError: m,
|
|
20
|
+
size: h = "M",
|
|
21
|
+
children: f,
|
|
22
|
+
...g
|
|
23
|
+
}, $) => {
|
|
24
|
+
const d = a.useRef(null), w = (x) => {
|
|
25
|
+
e && !i && (e(x), d.current.focus());
|
|
26
|
+
}, b = I(d, $);
|
|
27
|
+
return t(o.Trigger, {
|
|
28
|
+
asChild: !0,
|
|
29
|
+
children: l(V, {
|
|
30
|
+
"aria-disabled": i,
|
|
31
|
+
$hasError: m,
|
|
32
|
+
$size: h,
|
|
33
|
+
ref: b,
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
position: "relative",
|
|
37
|
+
overflow: "hidden",
|
|
38
|
+
hasRadius: !0,
|
|
39
|
+
background: i ? "neutral150" : "neutral0",
|
|
40
|
+
paddingLeft: 3,
|
|
41
|
+
paddingRight: 3,
|
|
42
|
+
gap: 4,
|
|
43
|
+
...g,
|
|
44
|
+
children: [l(c, {
|
|
45
|
+
as: "span",
|
|
46
|
+
gap: 4,
|
|
47
|
+
children: [n && t(p, {
|
|
48
|
+
as: "span",
|
|
49
|
+
"aria-hidden": !0,
|
|
50
|
+
children: n
|
|
51
|
+
}), f]
|
|
52
|
+
}), l(c, {
|
|
53
|
+
as: "span",
|
|
54
|
+
gap: 3,
|
|
55
|
+
children: [e ? t(T, {
|
|
56
|
+
as: "button",
|
|
57
|
+
hasRadius: !0,
|
|
58
|
+
background: "transparent",
|
|
59
|
+
role: "button",
|
|
60
|
+
tabIndex: 0,
|
|
61
|
+
onClick: w,
|
|
62
|
+
"aria-disabled": i,
|
|
63
|
+
"aria-label": r,
|
|
64
|
+
title: r,
|
|
65
|
+
cursor: "pointer",
|
|
66
|
+
children: t(y, {})
|
|
67
|
+
}) : null, t(j, {
|
|
68
|
+
children: t(R, {})
|
|
69
|
+
})]
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}), T = s(p)`
|
|
74
|
+
border: none;
|
|
75
|
+
|
|
76
|
+
svg {
|
|
77
|
+
height: ${11 / 16}rem;
|
|
78
|
+
width: ${11 / 16}rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
svg path {
|
|
82
|
+
fill: ${({
|
|
83
|
+
theme: e
|
|
84
|
+
}) => e.colors.neutral600};
|
|
85
|
+
}
|
|
86
|
+
`, V = s(c)`
|
|
87
|
+
border: 1px solid ${({
|
|
88
|
+
theme: e,
|
|
89
|
+
$hasError: r
|
|
90
|
+
}) => r ? e.colors.danger600 : e.colors.neutral200};
|
|
91
|
+
min-height: ${({
|
|
92
|
+
theme: e,
|
|
93
|
+
$size: r
|
|
94
|
+
}) => C("input")({
|
|
95
|
+
theme: e,
|
|
96
|
+
size: r
|
|
97
|
+
})};
|
|
98
|
+
|
|
99
|
+
&[aria-disabled='true'] {
|
|
100
|
+
color: ${(e) => e.theme.colors.neutral600};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
104
|
+
&:focus-visible {
|
|
105
|
+
outline: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
${({
|
|
109
|
+
theme: e,
|
|
110
|
+
$hasError: r
|
|
111
|
+
}) => k()({
|
|
112
|
+
theme: e,
|
|
113
|
+
hasError: r
|
|
114
|
+
})};
|
|
115
|
+
`, j = s(o.Icon)`
|
|
116
|
+
& > svg {
|
|
117
|
+
width: ${6 / 16}rem;
|
|
118
|
+
|
|
119
|
+
& > path {
|
|
120
|
+
fill: ${({
|
|
121
|
+
theme: e
|
|
122
|
+
}) => e.colors.neutral600};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`, z = a.forwardRef(({
|
|
126
|
+
children: e,
|
|
127
|
+
placeholder: r,
|
|
128
|
+
...n
|
|
129
|
+
}, i) => t(u, {
|
|
130
|
+
ref: i,
|
|
131
|
+
ellipsis: !0,
|
|
132
|
+
...n,
|
|
133
|
+
children: t(F, {
|
|
134
|
+
placeholder: r,
|
|
135
|
+
children: e
|
|
136
|
+
})
|
|
137
|
+
})), F = s(o.Value)`
|
|
138
|
+
display: flex;
|
|
139
|
+
gap: ${({
|
|
140
|
+
theme: e
|
|
141
|
+
}) => e.spaces[1]};
|
|
142
|
+
flex-wrap: wrap;
|
|
143
|
+
`, B = s(o.Content)`
|
|
144
|
+
background: ${({
|
|
145
|
+
theme: e
|
|
146
|
+
}) => e.colors.neutral0};
|
|
147
|
+
box-shadow: ${({
|
|
148
|
+
theme: e
|
|
149
|
+
}) => e.shadows.filterShadow};
|
|
150
|
+
border: 1px solid ${({
|
|
151
|
+
theme: e
|
|
152
|
+
}) => e.colors.neutral150};
|
|
153
|
+
border-radius: ${({
|
|
154
|
+
theme: e
|
|
155
|
+
}) => e.borderRadius};
|
|
156
|
+
min-width: var(--radix-select-trigger-width);
|
|
157
|
+
/* This is from the design-system figma file. */
|
|
158
|
+
max-height: 15rem;
|
|
159
|
+
`, D = s(o.Viewport)`
|
|
160
|
+
padding: ${({
|
|
161
|
+
theme: e
|
|
162
|
+
}) => e.spaces[1]};
|
|
163
|
+
`, E = a.forwardRef((e, r) => t(P, {
|
|
164
|
+
ref: r,
|
|
165
|
+
...e
|
|
166
|
+
})), G = S`
|
|
167
|
+
width: 100%;
|
|
168
|
+
border: none;
|
|
169
|
+
text-align: left;
|
|
170
|
+
outline-offset: -3px;
|
|
171
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
172
|
+
padding: ${(e) => `${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
173
|
+
padding-left: ${({
|
|
174
|
+
theme: e
|
|
175
|
+
}) => e.spaces[4]};
|
|
176
|
+
background-color: ${({
|
|
177
|
+
theme: e
|
|
178
|
+
}) => e.colors.neutral0};
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: ${({
|
|
182
|
+
theme: e
|
|
183
|
+
}) => e.spaces[2]};
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
|
|
186
|
+
&:focus-visible {
|
|
187
|
+
outline: none;
|
|
188
|
+
background-color: ${({
|
|
189
|
+
theme: e
|
|
190
|
+
}) => e.colors.primary100};
|
|
191
|
+
}
|
|
192
|
+
`, P = s(o.Item)`
|
|
193
|
+
${G}
|
|
194
|
+
|
|
195
|
+
&:hover {
|
|
196
|
+
background-color: ${({
|
|
197
|
+
theme: e
|
|
198
|
+
}) => e.colors.primary100};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&[data-state='checked'] {
|
|
202
|
+
${u} {
|
|
203
|
+
font-weight: bold;
|
|
204
|
+
color: ${({
|
|
205
|
+
theme: e
|
|
206
|
+
}) => e.colors.primary600};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`, X = o.Root, Y = v, Z = z, _ = o.Portal, ee = B, re = D, oe = E, te = o.ItemIndicator, se = o.ItemText, ie = o.Group;
|
|
210
|
+
export {
|
|
211
|
+
ee as Content,
|
|
212
|
+
ie as Group,
|
|
213
|
+
oe as Item,
|
|
214
|
+
te as ItemIndicator,
|
|
215
|
+
se as ItemText,
|
|
216
|
+
_ as Portal,
|
|
217
|
+
X as Root,
|
|
218
|
+
Y as Trigger,
|
|
219
|
+
Z as Value,
|
|
220
|
+
re as Viewport
|
|
221
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),l=require("./SelectParts.cjs"),q=require("../Box/Box.cjs"),V=require("../Field/Field.cjs"),H=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const z=require("../Field/FieldHint.cjs"),W=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const A=require("../Flex/Flex.cjs"),D=require("../hooks/useId.cjs"),G=require("../hooks/useIntersection.cjs"),J=require("../Typography/Typography.cjs");function K(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const d=K(N),Q=({children:t,clearLabel:n="Clear",customizeContent:i=p=>p?.toString()??"",disabled:s,error:u,hint:m,id:y,label:x,labelAction:O,onChange:a,onClear:h,onReachEnd:f,placeholder:T,required:g,selectButtonTitle:X,startIcon:B,size:C="M",value:j,...R})=>{const[p,F]=d.useState(),[_,k]=d.useState(!1),o=D.useId(y),v=`${o}-hint`,P=`${o}-error`,$=r=>{a?a(typeof j=="number"?Number(r):r):F(r)},w=r=>{k(r)},L=r=>{h&&h(r),a||F("")},b=d.useRef(null),M=()=>{b.current.focus()},S=d.useRef(null),I=`intersection-${o}`,E=r=>{f&&f(r)};G.useIntersection(S,E,{selectorToWatch:`#${I}`,skipWhen:!_});const c=(typeof j<"u"?j.toString():p)??"";return e.jsx(V.Field,{hint:m,error:u,id:o,required:g,children:e.jsxs(A.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsx(H.FieldLabel,{onClick:M,action:O,children:x}),e.jsxs(l.Root,{onOpenChange:w,disabled:s,required:g,onValueChange:$,value:c,...R,children:[e.jsx(l.Trigger,{ref:b,"aria-label":x,"aria-describedby":`${v} ${P}`,id:o,startIcon:B,size:C,hasError:Boolean(u),disabled:s,clearLabel:n,onClear:c&&h?L:void 0,children:e.jsx(l.Value,{placeholder:T,textColor:c?"neutral800":"neutral600",children:c?i(c):null})}),e.jsx(l.Portal,{children:e.jsx(l.Content,{position:"popper",sideOffset:4,children:e.jsxs(l.Viewport,{ref:S,children:[t,e.jsx(q.Box,{id:I,width:"100%",height:"1px"})]})})})]}),e.jsx(z.FieldHint,{}),e.jsx(W.FieldError,{})]})})},U=d.forwardRef(({value:t,startIcon:n,children:i,...s},u)=>e.jsxs(l.Item,{ref:u,value:t.toString(),...s,children:[n&&e.jsx(q.Box,{as:"span","aria-hidden":!0,children:n}),e.jsx(J.Typography,{textColor:"neutral800",children:e.jsx(l.ItemText,{children:i})})]}));exports.SingleSelect=Q;exports.SingleSelectOption=U;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { Item as q, ItemText as z, Root as H, Trigger as M, Value as P, Portal as _, Content as A, Viewport as D } from "./SelectParts.js";
|
|
4
|
+
import { Box as R } from "../Box/Box.js";
|
|
5
|
+
import { Field as G } from "../Field/Field.js";
|
|
6
|
+
import { FieldLabel as J } from "../Field/FieldLabel.js";
|
|
7
|
+
import "../Field/FieldInput.js";
|
|
8
|
+
import { FieldHint as K } from "../Field/FieldHint.js";
|
|
9
|
+
import { FieldError as Q } from "../Field/FieldError.js";
|
|
10
|
+
import "../Field/FieldContext.js";
|
|
11
|
+
import "../Field/FieldAction.js";
|
|
12
|
+
import { Flex as U } from "../Flex/Flex.js";
|
|
13
|
+
import { useId as X } from "../hooks/useId.js";
|
|
14
|
+
import { useIntersection as Y } from "../hooks/useIntersection.js";
|
|
15
|
+
import { Typography as Z } from "../Typography/Typography.js";
|
|
16
|
+
const Ie = ({
|
|
17
|
+
children: a,
|
|
18
|
+
clearLabel: i = "Clear",
|
|
19
|
+
customizeContent: s = (u) => u?.toString() ?? "",
|
|
20
|
+
disabled: l,
|
|
21
|
+
error: c,
|
|
22
|
+
hint: O,
|
|
23
|
+
id: B,
|
|
24
|
+
label: f,
|
|
25
|
+
labelAction: F,
|
|
26
|
+
onChange: h,
|
|
27
|
+
onClear: m,
|
|
28
|
+
onReachEnd: g,
|
|
29
|
+
placeholder: T,
|
|
30
|
+
required: I,
|
|
31
|
+
selectButtonTitle: ee,
|
|
32
|
+
startIcon: $,
|
|
33
|
+
size: y = "M",
|
|
34
|
+
value: p,
|
|
35
|
+
...w
|
|
36
|
+
}) => {
|
|
37
|
+
const [u, b] = o.useState(), [V, k] = o.useState(!1), t = X(B), v = `${t}-hint`, E = `${t}-error`, L = (r) => {
|
|
38
|
+
h ? h(typeof p == "number" ? Number(r) : r) : b(r);
|
|
39
|
+
}, N = (r) => {
|
|
40
|
+
k(r);
|
|
41
|
+
}, j = (r) => {
|
|
42
|
+
m && m(r), h || b("");
|
|
43
|
+
}, S = o.useRef(null), W = () => {
|
|
44
|
+
S.current.focus();
|
|
45
|
+
}, x = o.useRef(null), C = `intersection-${t}`;
|
|
46
|
+
Y(x, (r) => {
|
|
47
|
+
g && g(r);
|
|
48
|
+
}, {
|
|
49
|
+
selectorToWatch: `#${C}`,
|
|
50
|
+
skipWhen: !V
|
|
51
|
+
});
|
|
52
|
+
const n = (typeof p < "u" ? p.toString() : u) ?? "";
|
|
53
|
+
return e(G, {
|
|
54
|
+
hint: O,
|
|
55
|
+
error: c,
|
|
56
|
+
id: t,
|
|
57
|
+
required: I,
|
|
58
|
+
children: d(U, {
|
|
59
|
+
direction: "column",
|
|
60
|
+
alignItems: "stretch",
|
|
61
|
+
gap: 1,
|
|
62
|
+
children: [e(J, {
|
|
63
|
+
onClick: W,
|
|
64
|
+
action: F,
|
|
65
|
+
children: f
|
|
66
|
+
}), d(H, {
|
|
67
|
+
onOpenChange: N,
|
|
68
|
+
disabled: l,
|
|
69
|
+
required: I,
|
|
70
|
+
onValueChange: L,
|
|
71
|
+
value: n,
|
|
72
|
+
...w,
|
|
73
|
+
children: [e(M, {
|
|
74
|
+
ref: S,
|
|
75
|
+
"aria-label": f,
|
|
76
|
+
"aria-describedby": `${v} ${E}`,
|
|
77
|
+
id: t,
|
|
78
|
+
startIcon: $,
|
|
79
|
+
size: y,
|
|
80
|
+
hasError: Boolean(c),
|
|
81
|
+
disabled: l,
|
|
82
|
+
clearLabel: i,
|
|
83
|
+
onClear: n && m ? j : void 0,
|
|
84
|
+
children: e(P, {
|
|
85
|
+
placeholder: T,
|
|
86
|
+
textColor: n ? "neutral800" : "neutral600",
|
|
87
|
+
children: n ? s(n) : null
|
|
88
|
+
})
|
|
89
|
+
}), e(_, {
|
|
90
|
+
children: e(A, {
|
|
91
|
+
position: "popper",
|
|
92
|
+
sideOffset: 4,
|
|
93
|
+
children: d(D, {
|
|
94
|
+
ref: x,
|
|
95
|
+
children: [a, e(R, {
|
|
96
|
+
id: C,
|
|
97
|
+
width: "100%",
|
|
98
|
+
height: "1px"
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
}), e(K, {}), e(Q, {})]
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}, be = o.forwardRef(({
|
|
107
|
+
value: a,
|
|
108
|
+
startIcon: i,
|
|
109
|
+
children: s,
|
|
110
|
+
...l
|
|
111
|
+
}, c) => d(q, {
|
|
112
|
+
ref: c,
|
|
113
|
+
value: a.toString(),
|
|
114
|
+
...l,
|
|
115
|
+
children: [i && e(R, {
|
|
116
|
+
as: "span",
|
|
117
|
+
"aria-hidden": !0,
|
|
118
|
+
children: i
|
|
119
|
+
}), e(Z, {
|
|
120
|
+
textColor: "neutral800",
|
|
121
|
+
children: e(z, {
|
|
122
|
+
children: s
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
}));
|
|
126
|
+
export {
|
|
127
|
+
Ie as SingleSelect,
|
|
128
|
+
be as SingleSelectOption
|
|
129
|
+
};
|
package/dist/Select/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./MultiSelectNested.cjs"),e=require("./MultiSelect.cjs"),t=require("./SingleSelect.cjs"),i=require("./Option.cjs"),c=require("./OptGroup.cjs"),u=require("./SelectList.cjs");exports.MultiSelectNested=l.MultiSelectNested;exports.MultiSelect=e.MultiSelect;exports.MultiSelectGroup=e.MultiSelectGroup;exports.MultiSelectOption=e.MultiSelectOption;exports.SingleSelect=t.SingleSelect;exports.SingleSelectOption=t.SingleSelectOption;exports.Option=i.Option;exports.OptGroup=c.OptGroup;exports.SelectList=u.SelectList;
|
package/dist/Select/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { MultiSelectNested as o } from "./MultiSelectNested.js";
|
|
2
|
+
import { MultiSelect as l, MultiSelectGroup as p, MultiSelectOption as i } from "./MultiSelect.js";
|
|
3
|
+
import { SingleSelect as c, SingleSelectOption as f } from "./SingleSelect.js";
|
|
4
|
+
import { Option as u } from "./Option.js";
|
|
5
|
+
import { OptGroup as n } from "./OptGroup.js";
|
|
6
|
+
import { SelectList as O } from "./SelectList.js";
|
|
6
7
|
export {
|
|
7
|
-
l as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
l as MultiSelect,
|
|
9
|
+
p as MultiSelectGroup,
|
|
10
|
+
o as MultiSelectNested,
|
|
11
|
+
i as MultiSelectOption,
|
|
12
|
+
n as OptGroup,
|
|
13
|
+
u as Option,
|
|
14
|
+
O as SelectList,
|
|
15
|
+
c as SingleSelect,
|
|
16
|
+
f as SingleSelectOption
|
|
12
17
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),y=require("react"),g=require("@strapi/icons"),c=require("styled-components"),m=require("../Flex/Flex.cjs"),b=require("../themes/utils.cjs"),j=require("../Typography/Typography.cjs"),x=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function h(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const T=h(y),l=x(c),_=c.keyframes`
|
|
2
2
|
from {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
5
5
|
to {
|
|
6
6
|
transform: rotate(359deg);
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
9
|
-
animation: ${
|
|
8
|
+
`,v=l.default.div`
|
|
9
|
+
animation: ${_} 2s infinite linear;
|
|
10
10
|
will-change: transform;
|
|
11
|
-
`,q=
|
|
12
|
-
background: transparent;
|
|
11
|
+
`,q=l.default(m.Flex)`
|
|
13
12
|
border: none;
|
|
14
13
|
|
|
15
14
|
&[aria-disabled='true'] {
|
|
@@ -19,14 +18,9 @@
|
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
svg {
|
|
23
|
-
display: flex;
|
|
24
|
-
font-size: ${10/16}rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
21
|
svg path {
|
|
28
22
|
fill: ${({theme:e})=>e.colors.primary600};
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
${
|
|
32
|
-
`,
|
|
25
|
+
${b.buttonFocusStyle}
|
|
26
|
+
`,u=T.forwardRef(({children:e,startIcon:r,endIcon:t,onClick:n,disabled:a=!1,loading:s=!1,...d},p)=>{const f=n&&!a?n:void 0,i=a||s;return o.jsxs(q,{ref:p,"aria-disabled":i,onClick:f,as:"button",type:"button",background:"transparent",gap:2,...d,children:[s?o.jsx(v,{"aria-hidden":!0,children:o.jsx(g.Loader,{})}):r,o.jsx(j.Typography,{variant:"pi",textColor:i?"neutral600":"primary600",children:e}),t]})});u.displayName="TextButton";exports.TextButton=u;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Loader as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const v = g`
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { Loader as u } from "@strapi/icons";
|
|
4
|
+
import i, { keyframes as h } from "styled-components";
|
|
5
|
+
import { Flex as y } from "../Flex/Flex.js";
|
|
6
|
+
import { buttonFocusStyle as g } from "../themes/utils.js";
|
|
7
|
+
import { Typography as x } from "../Typography/Typography.js";
|
|
8
|
+
const b = h`
|
|
10
9
|
from {
|
|
11
10
|
transform: rotate(0deg);
|
|
12
11
|
}
|
|
13
12
|
to {
|
|
14
13
|
transform: rotate(359deg);
|
|
15
14
|
}
|
|
16
|
-
`,
|
|
17
|
-
animation: ${
|
|
15
|
+
`, v = i.div`
|
|
16
|
+
animation: ${b} 2s infinite linear;
|
|
18
17
|
will-change: transform;
|
|
19
|
-
`,
|
|
20
|
-
background: transparent;
|
|
18
|
+
`, T = i(y)`
|
|
21
19
|
border: none;
|
|
22
20
|
|
|
23
21
|
&[aria-disabled='true'] {
|
|
@@ -29,55 +27,43 @@ const v = g`
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
svg {
|
|
33
|
-
display: flex;
|
|
34
|
-
font-size: ${10 / 16}rem;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
30
|
svg path {
|
|
38
31
|
fill: ${({
|
|
39
32
|
theme: r
|
|
40
33
|
}) => r.colors.primary600};
|
|
41
34
|
}
|
|
42
35
|
|
|
43
|
-
${
|
|
44
|
-
`,
|
|
36
|
+
${g}
|
|
37
|
+
`, $ = c.forwardRef(({
|
|
45
38
|
children: r,
|
|
46
|
-
startIcon:
|
|
47
|
-
endIcon:
|
|
48
|
-
onClick:
|
|
49
|
-
disabled:
|
|
50
|
-
loading:
|
|
51
|
-
...
|
|
39
|
+
startIcon: s,
|
|
40
|
+
endIcon: l,
|
|
41
|
+
onClick: o,
|
|
42
|
+
disabled: e = !1,
|
|
43
|
+
loading: a = !1,
|
|
44
|
+
...p
|
|
52
45
|
}, m) => {
|
|
53
|
-
const f =
|
|
54
|
-
return
|
|
46
|
+
const f = o && !e ? o : void 0, n = e || a;
|
|
47
|
+
return d(T, {
|
|
55
48
|
ref: m,
|
|
56
|
-
"aria-disabled":
|
|
49
|
+
"aria-disabled": n,
|
|
57
50
|
onClick: f,
|
|
58
51
|
as: "button",
|
|
59
52
|
type: "button",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
background: "transparent",
|
|
54
|
+
gap: 2,
|
|
55
|
+
...p,
|
|
56
|
+
children: [a ? t(v, {
|
|
64
57
|
"aria-hidden": !0,
|
|
65
|
-
children:
|
|
66
|
-
|
|
67
|
-
}) : o
|
|
68
|
-
}), t(b, {
|
|
58
|
+
children: t(u, {})
|
|
59
|
+
}) : s, t(x, {
|
|
69
60
|
variant: "pi",
|
|
70
|
-
textColor:
|
|
61
|
+
textColor: n ? "neutral600" : "primary600",
|
|
71
62
|
children: r
|
|
72
|
-
}),
|
|
73
|
-
as: "span",
|
|
74
|
-
paddingLeft: 2,
|
|
75
|
-
"aria-hidden": !0,
|
|
76
|
-
children: a
|
|
77
|
-
})]
|
|
63
|
+
}), l]
|
|
78
64
|
});
|
|
79
65
|
});
|
|
80
|
-
|
|
66
|
+
$.displayName = "TextButton";
|
|
81
67
|
export {
|
|
82
|
-
|
|
68
|
+
$ as TextButton
|
|
83
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),i=require("react"),x=require("../Field/Field.cjs"),p=require("../Field/FieldLabel.cjs"),I=require("../Field/FieldInput.cjs"),q=require("../Field/FieldHint.cjs"),h=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const m=require("../Flex/Flex.cjs"),f=require("../hooks/useId.cjs"),n=i.forwardRef(({name:s,hint:d,error:c,label:r,labelAction:u,id:o,required:F,...t},a)=>{const j=f.useId(o),l=i.useRef(null);if(!r&&!t["aria-label"])throw new Error('The TextInput component needs a "label" or an "aria-label" props');return i.useImperativeHandle(a,()=>({inputWrapperRef:l})),e.jsx("div",{ref:l,children:e.jsx(x.Field,{name:s,hint:d,error:c,id:j,required:F,children:e.jsxs(m.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[r&&e.jsx(p.FieldLabel,{action:u,children:r}),e.jsx(I.FieldInput,{...t}),e.jsx(q.FieldHint,{}),e.jsx(h.FieldError,{})]})})})});n.displayName="TextInput";exports.TextInput=n;
|