@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.
Files changed (77) hide show
  1. package/dist/BaseButton/BaseButton.cjs +3 -3
  2. package/dist/BaseButton/BaseButton.js +5 -5
  3. package/dist/CarouselInput/Carousel.cjs +6 -7
  4. package/dist/CarouselInput/Carousel.js +25 -79
  5. package/dist/CarouselInput/CarouselActions.cjs +1 -1
  6. package/dist/CarouselInput/CarouselActions.js +1 -14
  7. package/dist/CarouselInput/CarouselImage.cjs +3 -4
  8. package/dist/CarouselInput/CarouselImage.js +13 -23
  9. package/dist/CarouselInput/CarouselInput.cjs +1 -1
  10. package/dist/CarouselInput/CarouselInput.js +12 -75
  11. package/dist/CarouselInput/CarouselSlide.cjs +1 -3
  12. package/dist/CarouselInput/CarouselSlide.js +4 -29
  13. package/dist/Checkbox/Checkbox.cjs +3 -3
  14. package/dist/Checkbox/Checkbox.js +18 -40
  15. package/dist/Dialog/Dialog.cjs +5 -5
  16. package/dist/Dialog/Dialog.js +21 -49
  17. package/dist/Dialog/DialogBody.cjs +2 -2
  18. package/dist/Dialog/DialogBody.js +6 -19
  19. package/dist/Dialog/DialogFooter.cjs +2 -2
  20. package/dist/Dialog/DialogFooter.js +7 -21
  21. package/dist/EmptyStateLayout/story-assets/Illo.cjs +1 -1
  22. package/dist/EmptyStateLayout/story-assets/Illo.js +2 -70
  23. package/dist/ModalLayout/ModalBody.cjs +2 -2
  24. package/dist/ModalLayout/ModalBody.js +4 -5
  25. package/dist/ModalLayout/ModalContext.cjs +1 -1
  26. package/dist/ModalLayout/ModalContext.js +2 -1
  27. package/dist/ModalLayout/ModalFooter.cjs +2 -6
  28. package/dist/ModalLayout/ModalFooter.js +9 -26
  29. package/dist/ModalLayout/ModalHeader.cjs +2 -2
  30. package/dist/ModalLayout/ModalHeader.js +10 -22
  31. package/dist/ModalLayout/ModalLayout.cjs +3 -5
  32. package/dist/ModalLayout/ModalLayout.js +10 -30
  33. package/dist/NumberInput/NumberInput.cjs +2 -2
  34. package/dist/NumberInput/NumberInput.js +68 -168
  35. package/dist/Pagination/Pagination.cjs +1 -5
  36. package/dist/Pagination/Pagination.js +7 -21
  37. package/dist/Pagination/components.cjs +7 -10
  38. package/dist/Pagination/components.js +34 -81
  39. package/dist/Popover/Popover.cjs +3 -3
  40. package/dist/Popover/Popover.js +93 -48
  41. package/dist/ProgressBar/ProgressBar.cjs +5 -5
  42. package/dist/ProgressBar/ProgressBar.js +6 -37
  43. package/dist/Radio/Radio.cjs +1 -4
  44. package/dist/Radio/Radio.js +5 -18
  45. package/dist/Searchbar/SearchForm.cjs +1 -1
  46. package/dist/Searchbar/SearchForm.js +2 -3
  47. package/dist/Searchbar/Searchbar.cjs +10 -11
  48. package/dist/Searchbar/Searchbar.js +25 -54
  49. package/dist/Status/Status.cjs +6 -6
  50. package/dist/Status/Status.js +8 -46
  51. package/dist/Switch/Switch.cjs +5 -5
  52. package/dist/Switch/Switch.js +16 -52
  53. package/dist/Tabs/TabGroup.cjs +1 -1
  54. package/dist/Tabs/TabGroup.js +13 -37
  55. package/dist/Tabs/TabPanels.cjs +1 -1
  56. package/dist/Tabs/TabPanels.js +11 -22
  57. package/dist/Tabs/Tabs.cjs +2 -2
  58. package/dist/Tabs/Tabs.js +55 -110
  59. package/dist/Tabs/TabsContext.cjs +1 -1
  60. package/dist/Tabs/TabsContext.js +11 -4
  61. package/dist/Textarea/Textarea.cjs +14 -12
  62. package/dist/Textarea/Textarea.js +33 -55
  63. package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
  64. package/dist/ToggleCheckbox/ToggleCheckbox.js +25 -121
  65. package/dist/ToggleInput/ToggleInput.cjs +3 -3
  66. package/dist/ToggleInput/ToggleInput.js +17 -70
  67. package/dist/Typography/Typography.cjs +1 -1
  68. package/dist/Typography/Typography.js +6 -6
  69. package/dist/hooks/useControllableState.cjs +1 -1
  70. package/dist/hooks/useControllableState.js +6 -6
  71. package/dist/themes/utils.cjs +2 -2
  72. package/dist/themes/utils.js +1 -1
  73. package/package.json +8 -5
  74. package/dist/Tabs/useTabsFocus.cjs +0 -1
  75. package/dist/Tabs/useTabsFocus.js +0 -17
  76. package/dist/Textarea/TextareaInput.cjs +0 -30
  77. package/dist/Textarea/TextareaInput.js +0 -65
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),$=require("react"),_=require("prop-types"),L=require("styled-components"),m=require("../themes/sizes.cjs"),z=require("../themes/utils.cjs"),S=require("../Box/Box.cjs"),F=require("../Flex/Flex.cjs"),W=require("../Field/FieldContext.cjs"),B=require("../VisuallyHidden/VisuallyHidden.cjs"),h=require("../Typography/Typography.cjs"),c=e=>e&&e.__esModule?e:{default:e},M=c($),n=c(_),i=c(L),P=i.default.label`
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
- `,I=i.default(S.Box)`
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
- ${z.inputFocusStyle()}
13
- `,g=i.default(F.Flex).attrs({hasRadius:!0})`
14
- background-color: ${({theme:e,checked:l,disabled:a})=>l?a?e.colors.neutral200:e.colors.neutral0:"transparent"};
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:l,disabled:a})=>l&&l!==null?a?e.colors.neutral300:e.colors.neutral200:a?e.colors.neutral150:e.colors.neutral100};
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
- `,O=i.default.input`
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
- `,s=M.default.forwardRef(({size:e,onLabel:l,offLabel:a,children:x,checked:t,disabled:r,onChange:b,...y},C)=>{const{error:q,hint:w,id:p,name:j,required:T}=W.useField(),f="neutral600";let v=!t&&t!==null?"danger700":f,R=t?"primary600":f;const k=d=>{r||b(d)};let u;return q?u=`${p}-error`:w&&(u=`${p}-hint`),o.jsxs(P,{children:[o.jsx(B.VisuallyHidden,{children:x}),o.jsxs(I,{hasRadius:!0,disabled:r,padding:1,display:"flex",background:r?"neutral150":"neutral100",borderStyle:"solid",borderWidth:"1px",borderColor:"neutral200",children:[o.jsx(g,{size:e,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:t===null?!1:!t,disabled:r,children:o.jsx(h.Typography,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:r?"neutral700":v,children:a})}),o.jsx(g,{size:e,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:t===null?!1:t,disabled:r,children:o.jsx(h.Typography,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:r?"neutral700":R,children:l})}),o.jsx(O,{type:"checkbox","aria-disabled":r,"aria-describedby":u,onChange:d=>k(d),name:j,ref:C,"aria-required":T,...y,checked:!(t===null||!t)})]})]})});s.displayName="ToggleCheckbox";s.defaultProps={disabled:!1,checked:!1,onChange:void 0,size:"M"};s.propTypes={checked:n.default.bool,children:n.default.string.isRequired,disabled:n.default.bool,offLabel:n.default.string.isRequired,onChange:n.default.func,onLabel:n.default.string.isRequired,size:n.default.oneOf(Object.keys(m.sizes.input))};exports.ToggleCheckbox=s;
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 l } from "react/jsx-runtime";
2
- import L from "react";
3
- import t from "prop-types";
4
- import a from "styled-components";
5
- import { sizes as j } from "../themes/sizes.js";
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 S } from "../Field/FieldContext.js";
10
- import { VisuallyHidden as B } from "../VisuallyHidden/VisuallyHidden.js";
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 F = a.label`
10
+ const B = i.label`
13
11
  position: relative;
14
12
  display: inline-block;
15
13
  z-index: 0;
16
14
  width: 100%;
17
- `, I = a(z)`
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
- ${q()}
24
- `, g = a(W).attrs({
21
+ ${T()}
22
+ `, g = i(W).attrs({
25
23
  hasRadius: !0
26
24
  })`
27
- background-color: ${({ theme: e, checked: n, disabled: i }) => n ? i ? e.colors.neutral200 : e.colors.neutral0 : "transparent"};
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: n, disabled: i }) => n && n !== null ? i ? e.colors.neutral300 : e.colors.neutral200 : i ? e.colors.neutral150 : e.colors.neutral100};
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
- `, M = a.input`
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
- `, u = L.forwardRef(
50
- ({ size: e, onLabel: n, offLabel: i, children: b, checked: r, disabled: o, onChange: x, ...m }, y) => {
51
- const { error: C, hint: w, id: d, name: v, required: $ } = S(), f = "neutral600";
52
- let k = !r && r !== null ? "danger700" : f, R = r ? "primary600" : f;
53
- const T = (p) => {
54
- o || x(p);
55
- };
56
- let s;
57
- return C ? s = `${d}-error` : w && (s = `${d}-hint`), /* @__PURE__ */ c(F, { children: [
58
- /* @__PURE__ */ l(B, { children: b }),
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
- u as ToggleCheckbox
58
+ I as ToggleCheckbox
155
59
  };
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("react");const T=require("prop-types"),j=require("styled-components"),y=require("../hooks/useId.cjs"),m=require("../themes/sizes.cjs"),v=require("../ToggleCheckbox/ToggleCheckbox.cjs"),I=require("../Field/Field.cjs"),_=require("../TextButton/TextButton.cjs"),u=require("../Flex/Flex.cjs"),k=require("../Field/FieldLabel.cjs"),C=require("../Field/FieldHint.cjs"),O=require("../Field/FieldError.cjs"),a=l=>l&&l.__esModule?l:{default:l},e=a(T),c=a(j),z=c.default(I.Field)`
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
- `,P=c.default(_.TextButton)`
3
+ `,C=d.default(I.TextButton)`
4
4
  align-self: flex-end;
5
5
  margin-left: auto;
6
- `,r=({disabled:l,size:f,error:g,hint:p,label:i,name:x,labelAction:b,required:q,id:h,onClear:d,clearLabel:n,checked:o,...F})=>{const s=y.useId(h);return t.jsx(z,{name:x,hint:p,error:g,id:s,required:q,children:t.jsxs(u.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsxs(u.Flex,{children:[t.jsx(k.FieldLabel,{action:b,children:i}),n&&d&&o!==null&&!l&&t.jsx(P,{onClick:d,children:n})]}),t.jsx(v.ToggleCheckbox,{id:s,size:f,checked:o,disabled:l,...F,children:i}),t.jsx(C.FieldHint,{}),t.jsx(O.FieldError,{})]})})};r.displayName="ToggleInput";r.defaultProps={checked:!1,clearLabel:void 0,disabled:!1,error:void 0,hint:void 0,id:void 0,label:"",labelAction:void 0,name:"",onClear:void 0,required:!1,size:"M"};r.propTypes={checked:e.default.bool,clearLabel:e.default.string,disabled:e.default.bool,error:e.default.string,hint:e.default.oneOfType([e.default.string,e.default.node,e.default.arrayOf(e.default.node)]),id:e.default.string,label:e.default.string,labelAction:e.default.node,name:e.default.string,onClear:e.default.func,required:e.default.bool,size:e.default.oneOf(Object.keys(m.sizes.input))};exports.ToggleInput=r;
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 o, jsxs as s } from "react/jsx-runtime";
2
- import "react";
3
- import e from "prop-types";
4
- import a from "styled-components";
5
- import { useId as T } from "../hooks/useId.js";
6
- import { sizes as v } from "../themes/sizes.js";
7
- import { ToggleCheckbox as F } from "../ToggleCheckbox/ToggleCheckbox.js";
8
- import { Field as I } from "../Field/Field.js";
9
- import { TextButton as k } from "../TextButton/TextButton.js";
10
- import { Flex as p } from "../Flex/Flex.js";
11
- import { FieldLabel as C } from "../Field/FieldLabel.js";
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 = a(k)`
13
+ `, q = p(j)`
17
14
  align-self: flex-end;
18
15
  margin-left: auto;
19
- `, r = ({
20
- disabled: i,
21
- size: c,
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
- r as ToggleInput
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,void 0)};
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 i from "styled-components";
2
- import { variantStyle as r, ellipsisStyle as n, handleColor as a } from "./utils.js";
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
- }, d = i.span.withConfig({
7
+ }, m = r.span.withConfig({
8
8
  shouldForwardProp: (t, e) => !s[t] && e(t)
9
9
  })`
10
- ${r}
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, void 0)};
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
- d as Typography
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=typeof e=="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
+ "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 R({ prop: n, defaultProp: u, onChange: c = () => {
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 = typeof n == "function" ? n(t) : n, d = o ? l : t, f = i(c), C = r.useCallback((s) => {
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 a = typeof s == "function" ? s(l) : s;
8
- a !== l && (f(a), e(s));
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, f]);
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
- R as useControllableState
21
+ S as useControllableState
22
22
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("styled-components"),i=t=>({theme:o,size:r})=>o.sizes[t][r],s=(t="&")=>({theme:o,hasError:r})=>e.css`
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=i;exports.inputFocusStyle=s;
41
+ `;exports.buttonFocusStyle=n;exports.getThemeSize=s;exports.inputFocusStyle=i;
@@ -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.5",
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
- "@strapi/ui-primitives": "^1.7.5",
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.5",
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": "d4ccec39bd885549af18112e972cb7d6d64ec01d"
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
- };