@strapi/design-system 1.7.5 → 1.7.7
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/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +5 -5
- package/dist/CarouselInput/Carousel.cjs +6 -7
- package/dist/CarouselInput/Carousel.js +25 -79
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +1 -14
- package/dist/CarouselInput/CarouselImage.cjs +3 -4
- package/dist/CarouselInput/CarouselImage.js +13 -23
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +12 -75
- package/dist/CarouselInput/CarouselSlide.cjs +1 -3
- package/dist/CarouselInput/CarouselSlide.js +4 -29
- package/dist/Checkbox/Checkbox.cjs +3 -3
- package/dist/Checkbox/Checkbox.js +18 -40
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +21 -49
- package/dist/Dialog/DialogBody.cjs +2 -2
- package/dist/Dialog/DialogBody.js +6 -19
- package/dist/Dialog/DialogFooter.cjs +2 -2
- package/dist/Dialog/DialogFooter.js +7 -21
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +1 -1
- package/dist/EmptyStateLayout/story-assets/Illo.js +2 -70
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +4 -5
- package/dist/ModalLayout/ModalContext.cjs +1 -1
- package/dist/ModalLayout/ModalContext.js +2 -1
- package/dist/ModalLayout/ModalFooter.cjs +2 -6
- package/dist/ModalLayout/ModalFooter.js +9 -26
- package/dist/ModalLayout/ModalHeader.cjs +2 -2
- package/dist/ModalLayout/ModalHeader.js +10 -22
- package/dist/ModalLayout/ModalLayout.cjs +3 -5
- package/dist/ModalLayout/ModalLayout.js +10 -30
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +68 -168
- package/dist/Pagination/Pagination.cjs +1 -5
- package/dist/Pagination/Pagination.js +7 -21
- package/dist/Pagination/components.cjs +7 -10
- package/dist/Pagination/components.js +34 -81
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +93 -48
- package/dist/ProgressBar/ProgressBar.cjs +5 -5
- package/dist/ProgressBar/ProgressBar.js +6 -37
- package/dist/Radio/Radio.cjs +1 -4
- package/dist/Radio/Radio.js +5 -18
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +2 -3
- package/dist/Searchbar/Searchbar.cjs +10 -11
- package/dist/Searchbar/Searchbar.js +25 -54
- package/dist/Status/Status.cjs +6 -6
- package/dist/Status/Status.js +8 -46
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +16 -52
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +13 -37
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +11 -22
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +55 -110
- package/dist/Tabs/TabsContext.cjs +1 -1
- package/dist/Tabs/TabsContext.js +11 -4
- package/dist/Textarea/Textarea.cjs +14 -12
- package/dist/Textarea/Textarea.js +33 -55
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +25 -121
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +17 -70
- package/dist/Typography/Typography.cjs +1 -1
- package/dist/Typography/Typography.js +6 -6
- package/dist/hooks/useControllableState.cjs +1 -1
- package/dist/hooks/useControllableState.js +6 -6
- package/dist/themes/utils.cjs +2 -2
- package/dist/themes/utils.js +1 -1
- package/package.json +8 -5
- package/dist/Tabs/useTabsFocus.cjs +0 -1
- package/dist/Tabs/useTabsFocus.js +0 -17
- package/dist/Textarea/TextareaInput.cjs +0 -30
- package/dist/Textarea/TextareaInput.js +0 -65
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),R=require("react"),k=require("styled-components"),m=require("../themes/utils.cjs"),_=require("../Box/Box.cjs"),S=require("../Flex/Flex.cjs"),B=require("../Field/FieldContext.cjs"),F=require("../VisuallyHidden/VisuallyHidden.cjs"),f=require("../Typography/Typography.cjs"),x=e=>e&&e.__esModule?e:{default:e},L=x(R),a=x(k),W=a.default.label`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: inline-block;
|
|
4
4
|
z-index: 0;
|
|
5
5
|
width: 100%;
|
|
6
|
-
`,
|
|
6
|
+
`,z=a.default(_.Box)`
|
|
7
7
|
cursor: ${({disabled:e})=>e?"not-allowed":void 0};
|
|
8
8
|
// Masks the background of each value
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
flex-wrap: wrap;
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`,
|
|
14
|
-
background-color: ${({theme:e,checked:
|
|
12
|
+
${m.inputFocusStyle()}
|
|
13
|
+
`,h=a.default(S.Flex).attrs({hasRadius:!0})`
|
|
14
|
+
background-color: ${({theme:e,checked:o,disabled:l})=>o?l?e.colors.neutral200:e.colors.neutral0:"transparent"};
|
|
15
15
|
border: 1px solid
|
|
16
|
-
${({theme:e,checked:
|
|
16
|
+
${({theme:e,checked:o,disabled:l})=>o&&o!==null?l?e.colors.neutral300:e.colors.neutral200:l?e.colors.neutral150:e.colors.neutral100};
|
|
17
17
|
position: relative;
|
|
18
18
|
user-select: none;
|
|
19
19
|
z-index: 2;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
padding-top: ${({size:e})=>`${e==="S"?"2px":"6px"}`};
|
|
27
27
|
padding-bottom: ${({size:e})=>`${e==="S"?"2px":"6px"}`};
|
|
28
|
-
`,
|
|
28
|
+
`,M=a.default.input`
|
|
29
29
|
height: 100%;
|
|
30
30
|
left: 0;
|
|
31
31
|
opacity: 0;
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
top: 0;
|
|
34
34
|
z-index: 1;
|
|
35
35
|
width: 100%;
|
|
36
|
-
`,
|
|
36
|
+
`,g=L.default.forwardRef(({size:e="M",onLabel:o,offLabel:l,children:b,checked:r=!1,disabled:t=!1,onChange:u,...y},C)=>{const{error:d,hint:w,id:c,name:j,required:q}=B.useField(),p="neutral600";let T=!r&&r!==null?"danger700":p,$=r?"primary600":p;const v=s=>{t||u&&u(s)};let i;return d?i=`${c}-error`:w&&(i=`${c}-hint`),n.jsxs(W,{children:[n.jsx(F.VisuallyHidden,{children:b}),n.jsxs(z,{hasRadius:!0,disabled:t,padding:1,display:"flex",background:t?"neutral150":"neutral100",borderStyle:"solid",borderWidth:"1px",borderColor:"neutral200",hasError:!!d,children:[n.jsx(h,{size:e,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:r===null?!1:!r,disabled:t,children:n.jsx(f.Typography,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:t?"neutral700":T,children:l})}),n.jsx(h,{size:e,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:r===null?!1:r,disabled:t,children:n.jsx(f.Typography,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:t?"neutral700":$,children:o})}),n.jsx(M,{type:"checkbox","aria-disabled":t,"aria-describedby":i,onChange:s=>v(s),name:j,ref:C,"aria-required":q,...y,checked:!(r===null||!r)})]})]})});g.displayName="ToggleCheckbox";exports.ToggleCheckbox=g;
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { inputFocusStyle as q } from "../themes/utils.js";
|
|
7
|
-
import { Box as z } from "../Box/Box.js";
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import R from "react";
|
|
3
|
+
import i from "styled-components";
|
|
4
|
+
import { inputFocusStyle as T } from "../themes/utils.js";
|
|
5
|
+
import { Box as L } from "../Box/Box.js";
|
|
8
6
|
import { Flex as W } from "../Flex/Flex.js";
|
|
9
|
-
import { useField as
|
|
10
|
-
import { VisuallyHidden as
|
|
7
|
+
import { useField as j } from "../Field/FieldContext.js";
|
|
8
|
+
import { VisuallyHidden as z } from "../VisuallyHidden/VisuallyHidden.js";
|
|
11
9
|
import { Typography as h } from "../Typography/Typography.js";
|
|
12
|
-
const
|
|
10
|
+
const B = i.label`
|
|
13
11
|
position: relative;
|
|
14
12
|
display: inline-block;
|
|
15
13
|
z-index: 0;
|
|
16
14
|
width: 100%;
|
|
17
|
-
`,
|
|
15
|
+
`, S = i(L)`
|
|
18
16
|
cursor: ${({ disabled: e }) => e ? "not-allowed" : void 0};
|
|
19
17
|
// Masks the background of each value
|
|
20
18
|
overflow: hidden;
|
|
21
19
|
flex-wrap: wrap;
|
|
22
20
|
|
|
23
|
-
${
|
|
24
|
-
`, g =
|
|
21
|
+
${T()}
|
|
22
|
+
`, g = i(W).attrs({
|
|
25
23
|
hasRadius: !0
|
|
26
24
|
})`
|
|
27
|
-
background-color: ${({ theme: e, checked:
|
|
25
|
+
background-color: ${({ theme: e, checked: o, disabled: n }) => o ? n ? e.colors.neutral200 : e.colors.neutral0 : "transparent"};
|
|
28
26
|
border: 1px solid
|
|
29
|
-
${({ theme: e, checked:
|
|
27
|
+
${({ theme: e, checked: o, disabled: n }) => o && o !== null ? n ? e.colors.neutral300 : e.colors.neutral200 : n ? e.colors.neutral150 : e.colors.neutral100};
|
|
30
28
|
position: relative;
|
|
31
29
|
user-select: none;
|
|
32
30
|
z-index: 2;
|
|
@@ -38,7 +36,7 @@ const F = a.label`
|
|
|
38
36
|
*/
|
|
39
37
|
padding-top: ${({ size: e }) => `${e === "S" ? "2px" : "6px"}`};
|
|
40
38
|
padding-bottom: ${({ size: e }) => `${e === "S" ? "2px" : "6px"}`};
|
|
41
|
-
`,
|
|
39
|
+
`, F = i.input`
|
|
42
40
|
height: 100%;
|
|
43
41
|
left: 0;
|
|
44
42
|
opacity: 0;
|
|
@@ -46,110 +44,16 @@ const F = a.label`
|
|
|
46
44
|
top: 0;
|
|
47
45
|
z-index: 1;
|
|
48
46
|
width: 100%;
|
|
49
|
-
`,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */ c(
|
|
60
|
-
I,
|
|
61
|
-
{
|
|
62
|
-
hasRadius: !0,
|
|
63
|
-
disabled: o,
|
|
64
|
-
padding: 1,
|
|
65
|
-
display: "flex",
|
|
66
|
-
background: o ? "neutral150" : "neutral100",
|
|
67
|
-
borderStyle: "solid",
|
|
68
|
-
borderWidth: "1px",
|
|
69
|
-
borderColor: "neutral200",
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ l(
|
|
72
|
-
g,
|
|
73
|
-
{
|
|
74
|
-
size: e,
|
|
75
|
-
paddingLeft: 3,
|
|
76
|
-
paddingRight: 3,
|
|
77
|
-
justifyContent: "center",
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
"aria-hidden": !0,
|
|
80
|
-
checked: r === null ? !1 : !r,
|
|
81
|
-
disabled: o,
|
|
82
|
-
children: /* @__PURE__ */ l(
|
|
83
|
-
h,
|
|
84
|
-
{
|
|
85
|
-
variant: "pi",
|
|
86
|
-
fontWeight: "bold",
|
|
87
|
-
textTransform: "uppercase",
|
|
88
|
-
textColor: o ? "neutral700" : k,
|
|
89
|
-
children: i
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
/* @__PURE__ */ l(
|
|
95
|
-
g,
|
|
96
|
-
{
|
|
97
|
-
size: e,
|
|
98
|
-
paddingLeft: 3,
|
|
99
|
-
paddingRight: 3,
|
|
100
|
-
justifyContent: "center",
|
|
101
|
-
alignItems: "center",
|
|
102
|
-
"aria-hidden": !0,
|
|
103
|
-
checked: r === null ? !1 : r,
|
|
104
|
-
disabled: o,
|
|
105
|
-
children: /* @__PURE__ */ l(
|
|
106
|
-
h,
|
|
107
|
-
{
|
|
108
|
-
variant: "pi",
|
|
109
|
-
fontWeight: "bold",
|
|
110
|
-
textTransform: "uppercase",
|
|
111
|
-
textColor: o ? "neutral700" : R,
|
|
112
|
-
children: n
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
/* @__PURE__ */ l(
|
|
118
|
-
M,
|
|
119
|
-
{
|
|
120
|
-
type: "checkbox",
|
|
121
|
-
"aria-disabled": o,
|
|
122
|
-
"aria-describedby": s,
|
|
123
|
-
onChange: (p) => T(p),
|
|
124
|
-
name: v,
|
|
125
|
-
ref: y,
|
|
126
|
-
"aria-required": $,
|
|
127
|
-
...m,
|
|
128
|
-
checked: !(r === null || !r)
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
] });
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
u.displayName = "ToggleCheckbox";
|
|
138
|
-
u.defaultProps = {
|
|
139
|
-
disabled: !1,
|
|
140
|
-
checked: !1,
|
|
141
|
-
onChange: void 0,
|
|
142
|
-
size: "M"
|
|
143
|
-
};
|
|
144
|
-
u.propTypes = {
|
|
145
|
-
checked: t.bool,
|
|
146
|
-
children: t.string.isRequired,
|
|
147
|
-
disabled: t.bool,
|
|
148
|
-
offLabel: t.string.isRequired,
|
|
149
|
-
onChange: t.func,
|
|
150
|
-
onLabel: t.string.isRequired,
|
|
151
|
-
size: t.oneOf(Object.keys(j.input))
|
|
152
|
-
};
|
|
47
|
+
`, I = R.forwardRef(({ size: e = "M", onLabel: o, offLabel: n, children: x, checked: r = !1, disabled: t = !1, onChange: s, ...b }, m) => {
|
|
48
|
+
const { error: d, hint: y, id: p, name: w, required: C } = j(), f = "neutral600";
|
|
49
|
+
let $ = !r && r !== null ? "danger700" : f, v = r ? "primary600" : f;
|
|
50
|
+
const k = (u) => {
|
|
51
|
+
t || s && s(u);
|
|
52
|
+
};
|
|
53
|
+
let l;
|
|
54
|
+
return d ? l = `${p}-error` : y && (l = `${p}-hint`), c(B, { children: [a(z, { children: x }), c(S, { hasRadius: !0, disabled: t, padding: 1, display: "flex", background: t ? "neutral150" : "neutral100", borderStyle: "solid", borderWidth: "1px", borderColor: "neutral200", hasError: !!d, children: [a(g, { size: e, paddingLeft: 3, paddingRight: 3, justifyContent: "center", alignItems: "center", "aria-hidden": !0, checked: r === null ? !1 : !r, disabled: t, children: a(h, { variant: "pi", fontWeight: "bold", textTransform: "uppercase", textColor: t ? "neutral700" : $, children: n }) }), a(g, { size: e, paddingLeft: 3, paddingRight: 3, justifyContent: "center", alignItems: "center", "aria-hidden": !0, checked: r === null ? !1 : r, disabled: t, children: a(h, { variant: "pi", fontWeight: "bold", textTransform: "uppercase", textColor: t ? "neutral700" : v, children: o }) }), a(F, { type: "checkbox", "aria-disabled": t, "aria-describedby": l, onChange: (u) => k(u), name: w, ref: m, "aria-required": C, ...b, checked: !(r === null || !r) })] })] });
|
|
55
|
+
});
|
|
56
|
+
I.displayName = "ToggleCheckbox";
|
|
153
57
|
export {
|
|
154
|
-
|
|
58
|
+
I as ToggleCheckbox
|
|
155
59
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("styled-components"),p=require("../hooks/useId.cjs"),m=require("../ToggleCheckbox/ToggleCheckbox.cjs"),T=require("../Field/Field.cjs"),I=require("../TextButton/TextButton.cjs"),o=require("../Flex/Flex.cjs"),y=require("../Field/FieldLabel.cjs"),_=require("../Field/FieldHint.cjs"),b=require("../Field/FieldError.cjs"),k=t=>t&&t.__esModule?t:{default:t},d=k(j),B=d.default(T.Field)`
|
|
2
2
|
max-width: 320px;
|
|
3
|
-
`,
|
|
3
|
+
`,C=d.default(I.TextButton)`
|
|
4
4
|
align-self: flex-end;
|
|
5
5
|
margin-left: auto;
|
|
6
|
-
`,
|
|
6
|
+
`,u=({disabled:t=!1,size:c="M",error:a,hint:x,label:r,name:g,labelAction:f,required:F=!1,id:h,onClear:i,clearLabel:n,checked:l=!1,...q})=>{const s=p.useId(h);return e.jsx(B,{name:g,hint:x,error:a,id:s,required:F,children:e.jsxs(o.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsxs(o.Flex,{children:[e.jsx(y.FieldLabel,{action:f,children:r}),n&&i&&l!==null&&!t&&e.jsx(C,{onClick:i,children:n})]}),e.jsx(m.ToggleCheckbox,{id:s,size:c,checked:l,disabled:t,...q,children:r}),e.jsx(_.FieldHint,{}),e.jsx(b.FieldError,{})]})})};u.displayName="ToggleInput";exports.ToggleInput=u;
|
|
@@ -1,76 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { FieldHint as O } from "../Field/FieldHint.js";
|
|
13
|
-
import { FieldError as j } from "../Field/FieldError.js";
|
|
14
|
-
const z = a(I)`
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import p from "styled-components";
|
|
3
|
+
import { useId as F } from "../hooks/useId.js";
|
|
4
|
+
import { ToggleCheckbox as I } from "../ToggleCheckbox/ToggleCheckbox.js";
|
|
5
|
+
import { Field as T } from "../Field/Field.js";
|
|
6
|
+
import { TextButton as j } from "../TextButton/TextButton.js";
|
|
7
|
+
import { Flex as d } from "../Flex/Flex.js";
|
|
8
|
+
import { FieldLabel as k } from "../Field/FieldLabel.js";
|
|
9
|
+
import { FieldHint as y } from "../Field/FieldHint.js";
|
|
10
|
+
import { FieldError as B } from "../Field/FieldError.js";
|
|
11
|
+
const C = p(T)`
|
|
15
12
|
max-width: 320px;
|
|
16
|
-
`, q =
|
|
13
|
+
`, q = p(j)`
|
|
17
14
|
align-self: flex-end;
|
|
18
15
|
margin-left: auto;
|
|
19
|
-
`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
error: f,
|
|
23
|
-
hint: g,
|
|
24
|
-
label: t,
|
|
25
|
-
name: u,
|
|
26
|
-
labelAction: h,
|
|
27
|
-
required: b,
|
|
28
|
-
id: x,
|
|
29
|
-
onClear: n,
|
|
30
|
-
clearLabel: l,
|
|
31
|
-
checked: d,
|
|
32
|
-
...y
|
|
33
|
-
}) => {
|
|
34
|
-
const m = T(x);
|
|
35
|
-
return /* @__PURE__ */ o(z, { name: u, hint: g, error: f, id: m, required: b, children: /* @__PURE__ */ s(p, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
36
|
-
/* @__PURE__ */ s(p, { children: [
|
|
37
|
-
/* @__PURE__ */ o(C, { action: h, children: t }),
|
|
38
|
-
l && n && d !== null && !i && /* @__PURE__ */ o(q, { onClick: n, children: l })
|
|
39
|
-
] }),
|
|
40
|
-
/* @__PURE__ */ o(F, { id: m, size: c, checked: d, disabled: i, ...y, children: t }),
|
|
41
|
-
/* @__PURE__ */ o(O, {}),
|
|
42
|
-
/* @__PURE__ */ o(j, {})
|
|
43
|
-
] }) });
|
|
44
|
-
};
|
|
45
|
-
r.displayName = "ToggleInput";
|
|
46
|
-
r.defaultProps = {
|
|
47
|
-
checked: !1,
|
|
48
|
-
clearLabel: void 0,
|
|
49
|
-
disabled: !1,
|
|
50
|
-
error: void 0,
|
|
51
|
-
hint: void 0,
|
|
52
|
-
id: void 0,
|
|
53
|
-
label: "",
|
|
54
|
-
labelAction: void 0,
|
|
55
|
-
name: "",
|
|
56
|
-
onClear: void 0,
|
|
57
|
-
required: !1,
|
|
58
|
-
size: "M"
|
|
59
|
-
};
|
|
60
|
-
r.propTypes = {
|
|
61
|
-
checked: e.bool,
|
|
62
|
-
clearLabel: e.string,
|
|
63
|
-
disabled: e.bool,
|
|
64
|
-
error: e.string,
|
|
65
|
-
hint: e.oneOfType([e.string, e.node, e.arrayOf(e.node)]),
|
|
66
|
-
id: e.string,
|
|
67
|
-
label: e.string,
|
|
68
|
-
labelAction: e.node,
|
|
69
|
-
name: e.string,
|
|
70
|
-
onClear: e.func,
|
|
71
|
-
required: e.bool,
|
|
72
|
-
size: e.oneOf(Object.keys(v.input))
|
|
16
|
+
`, w = ({ disabled: e = !1, size: s = "M", error: f, hint: c, label: o, name: a, labelAction: g, required: h = !1, id: u, onClear: i, clearLabel: t, checked: n = !1, ...x }) => {
|
|
17
|
+
const l = F(u);
|
|
18
|
+
return r(C, { name: a, hint: c, error: f, id: l, required: h, children: m(d, { direction: "column", alignItems: "stretch", gap: 1, children: [m(d, { children: [r(k, { action: g, children: o }), t && i && n !== null && !e && r(q, { onClick: i, children: t })] }), r(I, { id: l, size: s, checked: n, disabled: e, ...x, children: o }), r(y, {}), r(B, {})] }) });
|
|
73
19
|
};
|
|
20
|
+
w.displayName = "ToggleInput";
|
|
74
21
|
export {
|
|
75
|
-
|
|
22
|
+
w as ToggleInput
|
|
76
23
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// overwrite a variant attribute
|
|
7
7
|
font-weight: ${({theme:e,fontWeight:t})=>r.extractStyleFromTheme(e.fontWeights,t,void 0)};
|
|
8
8
|
font-size: ${({theme:e,fontSize:t})=>r.extractStyleFromTheme(e.fontSizes,t,void 0)};
|
|
9
|
-
line-height: ${({theme:e,lineHeight:t})=>r.extractStyleFromTheme(e.lineHeights,t,
|
|
9
|
+
line-height: ${({theme:e,lineHeight:t})=>r.extractStyleFromTheme(e.lineHeights,t,t)};
|
|
10
10
|
color: ${o.handleColor};
|
|
11
11
|
text-align: ${({textAlign:e})=>e};
|
|
12
12
|
text-decoration: ${({textDecoration:e})=>e};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { variantStyle as
|
|
1
|
+
import r from "styled-components";
|
|
2
|
+
import { variantStyle as i, ellipsisStyle as n, handleColor as a } from "./utils.js";
|
|
3
3
|
import { extractStyleFromTheme as o } from "../helpers/theme.js";
|
|
4
4
|
const s = {
|
|
5
5
|
fontSize: !0,
|
|
6
6
|
fontWeight: !0
|
|
7
|
-
},
|
|
7
|
+
}, m = r.span.withConfig({
|
|
8
8
|
shouldForwardProp: (t, e) => !s[t] && e(t)
|
|
9
9
|
})`
|
|
10
|
-
${
|
|
10
|
+
${i}
|
|
11
11
|
${n}
|
|
12
12
|
|
|
13
13
|
// These properties need to come after {variantStyle}, because they might
|
|
14
14
|
// overwrite a variant attribute
|
|
15
15
|
font-weight: ${({ theme: t, fontWeight: e }) => o(t.fontWeights, e, void 0)};
|
|
16
16
|
font-size: ${({ theme: t, fontSize: e }) => o(t.fontSizes, e, void 0)};
|
|
17
|
-
line-height: ${({ theme: t, lineHeight: e }) => o(t.lineHeights, e,
|
|
17
|
+
line-height: ${({ theme: t, lineHeight: e }) => o(t.lineHeights, e, e)};
|
|
18
18
|
color: ${a};
|
|
19
19
|
text-align: ${({ textAlign: t }) => t};
|
|
20
20
|
text-decoration: ${({ textDecoration: t }) => t};
|
|
21
21
|
text-transform: ${({ textTransform: t }) => t};
|
|
22
22
|
`;
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
m as Typography
|
|
25
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),f=require("@strapi/ui-primitives");function g(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const u=g(S);function p({prop:e,defaultProp:o,onChange:n=()=>{}}){const[t,c]=v({defaultProp:o,onChange:n}),r=e!==void 0,l=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),f=require("@strapi/ui-primitives");function g(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const u=g(S);function p({prop:e,defaultProp:o,onChange:n=()=>{}}){const[t,c]=v({defaultProp:o,onChange:n}),r=e!==void 0,l=e instanceof Function?e(t):e,d=r?l:t,a=f.useCallbackRef(n),b=u.useCallback(s=>{if(r){const i=typeof s=="function"?s(l):s;i!==l&&(a(i),c(s))}else c(s)},[r,l,c,a]);return[d,b]}function v({defaultProp:e,onChange:o}){const n=u.useState(e),[t]=n,c=u.useRef(t),r=f.useCallbackRef(o);return u.useEffect(()=>{c.current!==t&&(r(t),c.current=t)},[t,c,r]),n}exports.useControllableState=p;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
2
|
import { useCallbackRef as i } from "@strapi/ui-primitives";
|
|
3
|
-
function
|
|
3
|
+
function S({ prop: n, defaultProp: u, onChange: c = () => {
|
|
4
4
|
} }) {
|
|
5
|
-
const [t, e] = m({ defaultProp: u, onChange: c }), o = n !== void 0, l =
|
|
5
|
+
const [t, e] = m({ defaultProp: u, onChange: c }), o = n !== void 0, l = n instanceof Function ? n(t) : n, d = o ? l : t, a = i(c), C = r.useCallback((s) => {
|
|
6
6
|
if (o) {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const f = typeof s == "function" ? s(l) : s;
|
|
8
|
+
f !== l && (a(f), e(s));
|
|
9
9
|
} else
|
|
10
10
|
e(s);
|
|
11
|
-
}, [o, l, e,
|
|
11
|
+
}, [o, l, e, a]);
|
|
12
12
|
return [d, C];
|
|
13
13
|
}
|
|
14
14
|
function m({ defaultProp: n, onChange: u }) {
|
|
@@ -18,5 +18,5 @@ function m({ defaultProp: n, onChange: u }) {
|
|
|
18
18
|
}, [t, e, o]), c;
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
S as useControllableState
|
|
22
22
|
};
|
package/dist/themes/utils.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("styled-components"),s=t=>({theme:o,size:r})=>o.sizes[t][r],i=(t="&")=>({theme:o,hasError:r=!1})=>e.css`
|
|
2
2
|
outline: none;
|
|
3
3
|
box-shadow: 0;
|
|
4
4
|
transition-property: border-color, box-shadow, fill;
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
border: 2px solid ${t.colors.primary600};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
`;exports.buttonFocusStyle=n;exports.getThemeSize=
|
|
41
|
+
`;exports.buttonFocusStyle=n;exports.getThemeSize=s;exports.inputFocusStyle=i;
|
package/dist/themes/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css as i } from "styled-components";
|
|
2
|
-
const s = (t) => ({ theme: o, size: r }) => o.sizes[t][r], p = (t = "&") => ({ theme: o, hasError: r }) => i`
|
|
2
|
+
const s = (t) => ({ theme: o, size: r }) => o.sizes[t][r], p = (t = "&") => ({ theme: o, hasError: r = !1 }) => i`
|
|
3
3
|
outline: none;
|
|
4
4
|
box-shadow: 0;
|
|
5
5
|
transition-property: border-color, box-shadow, fill;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/design-system",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,14 +23,17 @@
|
|
|
23
23
|
"@internationalized/number": "^3.2.0",
|
|
24
24
|
"@radix-ui/react-dismissable-layer": "^1.0.3",
|
|
25
25
|
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
|
26
|
-
"@
|
|
26
|
+
"@radix-ui/react-focus-scope": "1.0.2",
|
|
27
|
+
"@strapi/ui-primitives": "^1.7.7",
|
|
27
28
|
"@uiw/react-codemirror": "^4.19.16",
|
|
29
|
+
"aria-hidden": "^1.2.3",
|
|
28
30
|
"compute-scroll-into-view": "^3.0.3",
|
|
29
|
-
"prop-types": "^15.8.1"
|
|
31
|
+
"prop-types": "^15.8.1",
|
|
32
|
+
"react-remove-scroll": "^2.5.5"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
35
|
"@playwright/test": "1.33.0",
|
|
33
|
-
"@strapi/icons": "^1.7.
|
|
36
|
+
"@strapi/icons": "^1.7.7",
|
|
34
37
|
"@types/react-router-dom": "^5.3.3",
|
|
35
38
|
"@types/styled-components": "^5.1.26",
|
|
36
39
|
"axe-playwright": "^1.2.3",
|
|
@@ -61,5 +64,5 @@
|
|
|
61
64
|
"test:e2e:watch": "chokidar '**/__tests__/*.e2e.js' -c 'npm run test:e2e -- --retries=0 {path}'",
|
|
62
65
|
"test:e2e:debug": "cross-env PWDEBUG=1 playwright test"
|
|
63
66
|
},
|
|
64
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "95a02179f945511d2c5fb50efb880ed13f3169c9"
|
|
65
68
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),o=require("@strapi/ui-primitives"),i=(r,c)=>{const e=u.useRef(null),t=u.useRef(null),n=o.useCallbackRef(c);return u.useEffect(()=>{if(e.current){if(t.current){const s=e.current.querySelector('[tabindex="0"]');s&&(s.focus(),n(r))}t.current||(t.current=!0)}},[r,n]),e};exports.useTabsFocus=i;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useRef as c, useEffect as f } from "react";
|
|
2
|
-
import { useCallbackRef as s } from "@strapi/ui-primitives";
|
|
3
|
-
const i = (t, o) => {
|
|
4
|
-
const e = c(null), r = c(null), u = s(o);
|
|
5
|
-
return f(() => {
|
|
6
|
-
if (e.current) {
|
|
7
|
-
if (r.current) {
|
|
8
|
-
const n = e.current.querySelector('[tabindex="0"]');
|
|
9
|
-
n && (n.focus(), u(t));
|
|
10
|
-
}
|
|
11
|
-
r.current || (r.current = !0);
|
|
12
|
-
}
|
|
13
|
-
}, [t, u]), e;
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
i as useTabsFocus
|
|
17
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),$=require("react"),b=require("prop-types"),y=require("styled-components"),g=require("../themes/utils.cjs"),x=require("../Field/FieldContext.cjs"),l=e=>e&&e.__esModule?e:{default:e},T=l(b),d=l(y),q=d.default.div`
|
|
2
|
-
border: 1px solid ${({theme:e,hasError:r})=>r?e.colors.danger600:e.colors.neutral200};
|
|
3
|
-
border-radius: ${({theme:e})=>e.borderRadius};
|
|
4
|
-
|
|
5
|
-
padding-left: ${({theme:e,hasLeftAction:r})=>r?0:e.spaces[4]};
|
|
6
|
-
padding-right: ${({theme:e,hasRightAction:r})=>r?0:e.spaces[4]};
|
|
7
|
-
padding-top: ${({theme:e})=>`${e.spaces[3]}`};
|
|
8
|
-
padding-bottom: ${({theme:e})=>`${e.spaces[3]}`};
|
|
9
|
-
|
|
10
|
-
background: ${({theme:e,disabled:r})=>r?e.colors.neutral150:e.colors.neutral0};
|
|
11
|
-
${g.inputFocusStyle()}
|
|
12
|
-
`,h=d.default.textarea`
|
|
13
|
-
display: block;
|
|
14
|
-
width: 100%;
|
|
15
|
-
font-weight: 400;
|
|
16
|
-
font-size: ${14/16}rem;
|
|
17
|
-
border: none;
|
|
18
|
-
color: ${({theme:e,disabled:r})=>r?e.colors.neutral600:e.colors.neutral800};
|
|
19
|
-
resize: none;
|
|
20
|
-
background: inherit;
|
|
21
|
-
|
|
22
|
-
::placeholder {
|
|
23
|
-
color: ${({theme:e})=>e.colors.neutral500};
|
|
24
|
-
opacity: 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&:focus-within {
|
|
28
|
-
outline: none;
|
|
29
|
-
}
|
|
30
|
-
`,o=$.forwardRef(({disabled:e,...r},u)=>{const{id:t,error:n,hint:c,name:p,required:f}=x.useField();let a;n?a=`${t}-error`:c&&(a=`${t}-hint`);const s=!!n;return i.jsx(q,{hasError:s,disabled:e,children:i.jsx(h,{id:t,name:p,ref:u,"aria-describedby":a,"aria-invalid":s,disabled:e,hasError:s,"aria-required":f,...r})})});o.displayName="TextareaInput";o.defaultProps={disabled:!1};o.propTypes={disabled:T.default.bool};exports.TextareaInput=o;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as f } from "react";
|
|
3
|
-
import $ from "prop-types";
|
|
4
|
-
import d from "styled-components";
|
|
5
|
-
import { inputFocusStyle as m } from "../themes/utils.js";
|
|
6
|
-
import { useField as b } from "../Field/FieldContext.js";
|
|
7
|
-
const g = d.div`
|
|
8
|
-
border: 1px solid ${({ theme: r, hasError: o }) => o ? r.colors.danger600 : r.colors.neutral200};
|
|
9
|
-
border-radius: ${({ theme: r }) => r.borderRadius};
|
|
10
|
-
|
|
11
|
-
padding-left: ${({ theme: r, hasLeftAction: o }) => o ? 0 : r.spaces[4]};
|
|
12
|
-
padding-right: ${({ theme: r, hasRightAction: o }) => o ? 0 : r.spaces[4]};
|
|
13
|
-
padding-top: ${({ theme: r }) => `${r.spaces[3]}`};
|
|
14
|
-
padding-bottom: ${({ theme: r }) => `${r.spaces[3]}`};
|
|
15
|
-
|
|
16
|
-
background: ${({ theme: r, disabled: o }) => o ? r.colors.neutral150 : r.colors.neutral0};
|
|
17
|
-
${m()}
|
|
18
|
-
`, x = d.textarea`
|
|
19
|
-
display: block;
|
|
20
|
-
width: 100%;
|
|
21
|
-
font-weight: 400;
|
|
22
|
-
font-size: ${14 / 16}rem;
|
|
23
|
-
border: none;
|
|
24
|
-
color: ${({ theme: r, disabled: o }) => o ? r.colors.neutral600 : r.colors.neutral800};
|
|
25
|
-
resize: none;
|
|
26
|
-
background: inherit;
|
|
27
|
-
|
|
28
|
-
::placeholder {
|
|
29
|
-
color: ${({ theme: r }) => r.colors.neutral500};
|
|
30
|
-
opacity: 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&:focus-within {
|
|
34
|
-
outline: none;
|
|
35
|
-
}
|
|
36
|
-
`, t = f(({ disabled: r, ...o }, l) => {
|
|
37
|
-
const { id: e, error: s, hint: p, name: c, required: u } = b();
|
|
38
|
-
let a;
|
|
39
|
-
s ? a = `${e}-error` : p && (a = `${e}-hint`);
|
|
40
|
-
const i = !!s;
|
|
41
|
-
return /* @__PURE__ */ n(g, { hasError: i, disabled: r, children: /* @__PURE__ */ n(
|
|
42
|
-
x,
|
|
43
|
-
{
|
|
44
|
-
id: e,
|
|
45
|
-
name: c,
|
|
46
|
-
ref: l,
|
|
47
|
-
"aria-describedby": a,
|
|
48
|
-
"aria-invalid": i,
|
|
49
|
-
disabled: r,
|
|
50
|
-
hasError: i,
|
|
51
|
-
"aria-required": u,
|
|
52
|
-
...o
|
|
53
|
-
}
|
|
54
|
-
) });
|
|
55
|
-
});
|
|
56
|
-
t.displayName = "TextareaInput";
|
|
57
|
-
t.defaultProps = {
|
|
58
|
-
disabled: !1
|
|
59
|
-
};
|
|
60
|
-
t.propTypes = {
|
|
61
|
-
disabled: $.bool
|
|
62
|
-
};
|
|
63
|
-
export {
|
|
64
|
-
t as TextareaInput
|
|
65
|
-
};
|