@strapi/design-system 1.4.1 → 1.4.2

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.
@@ -1,4 +1,4 @@
1
- "use strict";var b=Object.defineProperty;var u=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var m=(e,r,t)=>r in e?b(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,d=(e,r)=>{for(var t in r||(r={}))x.call(r,t)&&m(e,t,r[t]);if(u)for(var t of u(r))y.call(r,t)&&m(e,t,r[t]);return e};var g=(e,r)=>{var t={};for(var l in e)x.call(e,l)&&r.indexOf(l)<0&&(t[l]=e[l]);if(e!=null&&u)for(var l of u(e))r.indexOf(l)<0&&y.call(e,l)&&(t[l]=e[l]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react"),T=require("prop-types"),$=require("styled-components"),k=require("@strapi/icons/Information"),A=require("@strapi/icons/CheckCircle"),I=require("@strapi/icons/ExclamationMarkCircle"),j=require("@strapi/icons/Cross"),s=require("../Box/Box.cjs"),C=require("../Typography/Typography.cjs"),w=require("../Flex/Flex.cjs"),i=require("./utils.cjs"),v=require("../themes/utils.cjs"),n=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},a=n(R),o=n(T),c=n($),F=n(k),M=n(A),P=n(I),S=n(j),L=c.default(s.Box)`
1
+ "use strict";var b=Object.defineProperty;var u=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var m=(e,r,t)=>r in e?b(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,d=(e,r)=>{for(var t in r||(r={}))x.call(r,t)&&m(e,t,r[t]);if(u)for(var t of u(r))y.call(r,t)&&m(e,t,r[t]);return e};var g=(e,r)=>{var t={};for(var l in e)x.call(e,l)&&r.indexOf(l)<0&&(t[l]=e[l]);if(e!=null&&u)for(var l of u(e))r.indexOf(l)<0&&y.call(e,l)&&(t[l]=e[l]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react"),T=require("prop-types"),$=require("styled-components"),k=require("@strapi/icons/Information"),w=require("@strapi/icons/CheckCircle"),A=require("@strapi/icons/ExclamationMarkCircle"),I=require("@strapi/icons/Cross"),s=require("../Box/Box.cjs"),C=require("../Typography/Typography.cjs"),j=require("../Flex/Flex.cjs"),i=require("./utils.cjs"),v=require("../themes/utils.cjs"),n=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},a=n(R),o=n(T),c=n($),F=n(k),M=n(w),P=n(A),S=n(I),L=c.default(s.Box)`
2
2
  flex: 1;
3
3
  flex-wrap: wrap;
4
4
  display: flex;
@@ -21,7 +21,7 @@
21
21
  svg path {
22
22
  fill: ${i.handleIconColor};
23
23
  }
24
- `,E=t=>{var l=t,{variant:e}=l,r=g(l,["variant"]);return e==="success"?a.default.createElement(M.default,d({},r)):e==="danger"?a.default.createElement(P.default,d({},r)):a.default.createElement(F.default,d({},r))},D=c.default(s.Box)`
24
+ `,E=t=>{var l=t,{variant:e}=l,r=g(l,["variant"]);return e==="success"?a.default.createElement(M.default,d({},r)):e==="danger"||e==="warning"?a.default.createElement(P.default,d({},r)):a.default.createElement(F.default,d({},r))},D=c.default(s.Box)`
25
25
  // Checked with the designers, validated
26
26
  padding-top: 1px;
27
27
 
@@ -32,4 +32,4 @@
32
32
  fill: ${i.handleIconColor};
33
33
  }
34
34
  }
35
- `,f=G=>{var h=G,{title:e,children:r,variant:t,onClose:l,closeLabel:q,titleAs:B,action:p}=h,_=g(h,["title","children","variant","onClose","closeLabel","titleAs","action"]);return a.default.createElement(W,d({hasRadius:!0,paddingLeft:5,paddingRight:6,paddingTop:5,variant:t},_),a.default.createElement(w.Flex,{alignItems:"flex-start"},a.default.createElement(O,{paddingRight:3,variant:t},a.default.createElement(E,{variant:t,"aria-hidden":!0})),a.default.createElement(L,{role:t==="danger"?"alert":"status"},a.default.createElement(s.Box,{paddingBottom:2,paddingRight:1},a.default.createElement(C.Typography,{fontWeight:"bold",textColor:"neutral800",as:B},e)),a.default.createElement(s.Box,{paddingBottom:p?2:5,paddingRight:2},a.default.createElement(C.Typography,{as:"p",textColor:"neutral800"},r)),p&&a.default.createElement(D,{paddingBottom:5,variant:t},p)),a.default.createElement(z,{onClick:l,"aria-label":q},a.default.createElement(S.default,{"aria-hidden":!0}))))};f.defaultProps={action:void 0,variant:"default",titleAs:"p"};f.propTypes={action:o.default.element,children:o.default.node.isRequired,closeLabel:o.default.string.isRequired,onClose:o.default.func.isRequired,title:o.default.string.isRequired,titleAs:o.default.string,variant:o.default.oneOf(["danger","success","default"])};E.propTypes={variant:f.propTypes.variant.isRequired};exports.Alert=f;
35
+ `,f=G=>{var h=G,{title:e,children:r,variant:t,onClose:l,closeLabel:q,titleAs:B,action:p}=h,_=g(h,["title","children","variant","onClose","closeLabel","titleAs","action"]);return a.default.createElement(W,d({hasRadius:!0,paddingLeft:5,paddingRight:6,paddingTop:5,variant:t},_),a.default.createElement(j.Flex,{alignItems:"flex-start"},a.default.createElement(O,{paddingRight:3,variant:t},a.default.createElement(E,{variant:t,"aria-hidden":!0})),a.default.createElement(L,{role:t==="danger"?"alert":"status"},a.default.createElement(s.Box,{paddingBottom:2,paddingRight:1},a.default.createElement(C.Typography,{fontWeight:"bold",textColor:"neutral800",as:B},e)),a.default.createElement(s.Box,{paddingBottom:p?2:5,paddingRight:2},a.default.createElement(C.Typography,{as:"p",textColor:"neutral800"},r)),p&&a.default.createElement(D,{paddingBottom:5,variant:t},p)),a.default.createElement(z,{onClick:l,"aria-label":q},a.default.createElement(S.default,{"aria-hidden":!0}))))};f.defaultProps={action:void 0,variant:"default",titleAs:"p"};f.propTypes={action:o.default.element,children:o.default.node.isRequired,closeLabel:o.default.string.isRequired,onClose:o.default.func.isRequired,title:o.default.string.isRequired,titleAs:o.default.string,variant:o.default.oneOf(["danger","success","default","warning"])};E.propTypes={variant:f.propTypes.variant.isRequired};exports.Alert=f;
@@ -1,7 +1,7 @@
1
1
  var y = Object.defineProperty;
2
2
  var s = Object.getOwnPropertySymbols;
3
3
  var h = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
4
- var u = (e, r, t) => r in e ? y(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, i = (e, r) => {
4
+ var u = (e, r, t) => r in e ? y(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, l = (e, r) => {
5
5
  for (var t in r || (r = {}))
6
6
  h.call(r, t) && u(e, t, r[t]);
7
7
  if (s)
@@ -21,21 +21,21 @@ var m = (e, r) => {
21
21
  import o from "react";
22
22
  import a from "prop-types";
23
23
  import d from "styled-components";
24
- import B from "@strapi/icons/Information";
25
- import A from "@strapi/icons/CheckCircle";
26
- import k from "@strapi/icons/ExclamationMarkCircle";
27
- import w from "@strapi/icons/Cross";
28
- import { Box as l } from "../Box/Box.js";
24
+ import w from "@strapi/icons/Information";
25
+ import B from "@strapi/icons/CheckCircle";
26
+ import A from "@strapi/icons/ExclamationMarkCircle";
27
+ import k from "@strapi/icons/Cross";
28
+ import { Box as i } from "../Box/Box.js";
29
29
  import { Typography as x } from "../Typography/Typography.js";
30
30
  import { Flex as T } from "../Flex/Flex.js";
31
31
  import { handleBorderColor as q, handleBackgroundColor as I, handleIconColor as c } from "./utils.js";
32
32
  import { buttonFocusStyle as v } from "../themes/utils.js";
33
- const W = d(l)`
33
+ const W = d(i)`
34
34
  flex: 1;
35
35
  flex-wrap: wrap;
36
36
  display: flex;
37
37
  flex-direction: row;
38
- `, z = d(l)`
38
+ `, z = d(i)`
39
39
  border: 1px solid ${q};
40
40
  background: ${I};
41
41
  box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
@@ -48,15 +48,15 @@ const W = d(l)`
48
48
  }
49
49
  margin-top: ${({ theme: e }) => e.spaces[1]};
50
50
  ${v};
51
- `, L = d(l)`
51
+ `, L = d(i)`
52
52
  font-size: ${20 / 16}rem;
53
53
  svg path {
54
54
  fill: ${c};
55
55
  }
56
56
  `, C = (t) => {
57
57
  var n = t, { variant: e } = n, r = m(n, ["variant"]);
58
- return e === "success" ? /* @__PURE__ */ o.createElement(A, i({}, r)) : e === "danger" ? /* @__PURE__ */ o.createElement(k, i({}, r)) : /* @__PURE__ */ o.createElement(B, i({}, r));
59
- }, P = d(l)`
58
+ return e === "success" ? /* @__PURE__ */ o.createElement(B, l({}, r)) : e === "danger" || e === "warning" ? /* @__PURE__ */ o.createElement(A, l({}, r)) : /* @__PURE__ */ o.createElement(w, l({}, r));
59
+ }, P = d(i)`
60
60
  // Checked with the designers, validated
61
61
  padding-top: 1px;
62
62
 
@@ -69,7 +69,7 @@ const W = d(l)`
69
69
  }
70
70
  `, f = (S) => {
71
71
  var g = S, { title: e, children: r, variant: t, onClose: n, closeLabel: R, titleAs: $, action: p } = g, b = m(g, ["title", "children", "variant", "onClose", "closeLabel", "titleAs", "action"]);
72
- return /* @__PURE__ */ o.createElement(z, i({
72
+ return /* @__PURE__ */ o.createElement(z, l({
73
73
  hasRadius: !0,
74
74
  paddingLeft: 5,
75
75
  paddingRight: 6,
@@ -85,14 +85,14 @@ const W = d(l)`
85
85
  "aria-hidden": !0
86
86
  })), /* @__PURE__ */ o.createElement(W, {
87
87
  role: t === "danger" ? "alert" : "status"
88
- }, /* @__PURE__ */ o.createElement(l, {
88
+ }, /* @__PURE__ */ o.createElement(i, {
89
89
  paddingBottom: 2,
90
90
  paddingRight: 1
91
91
  }, /* @__PURE__ */ o.createElement(x, {
92
92
  fontWeight: "bold",
93
93
  textColor: "neutral800",
94
94
  as: $
95
- }, e)), /* @__PURE__ */ o.createElement(l, {
95
+ }, e)), /* @__PURE__ */ o.createElement(i, {
96
96
  paddingBottom: p ? 2 : 5,
97
97
  paddingRight: 2
98
98
  }, /* @__PURE__ */ o.createElement(x, {
@@ -104,7 +104,7 @@ const W = d(l)`
104
104
  }, p)), /* @__PURE__ */ o.createElement(F, {
105
105
  onClick: n,
106
106
  "aria-label": R
107
- }, /* @__PURE__ */ o.createElement(w, {
107
+ }, /* @__PURE__ */ o.createElement(k, {
108
108
  "aria-hidden": !0
109
109
  }))));
110
110
  };
@@ -120,7 +120,7 @@ f.propTypes = {
120
120
  onClose: a.func.isRequired,
121
121
  title: a.string.isRequired,
122
122
  titleAs: a.string,
123
- variant: a.oneOf(["danger", "success", "default"])
123
+ variant: a.oneOf(["danger", "success", "default", "warning"])
124
124
  };
125
125
  C.propTypes = {
126
126
  variant: f.propTypes.variant.isRequired
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=({theme:r,variant:o})=>o==="danger"?r.colors.danger100:o==="success"?r.colors.success100:r.colors.primary100,c=({theme:r,variant:o})=>o==="danger"?r.colors.danger200:o==="success"?r.colors.success200:r.colors.primary200,e=({theme:r,variant:o})=>o==="danger"?r.colors.danger700:o==="success"?r.colors.success700:r.colors.primary700;exports.handleBackgroundColor=s;exports.handleBorderColor=c;exports.handleIconColor=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=({theme:r,variant:o})=>o==="danger"?r.colors.danger100:o==="success"?r.colors.success100:o==="warning"?r.colors.warning100:r.colors.primary100,s=({theme:r,variant:o})=>o==="danger"?r.colors.danger200:o==="success"?r.colors.success200:o==="warning"?r.colors.warning200:r.colors.primary200,c=({theme:r,variant:o})=>o==="danger"?r.colors.danger700:o==="success"?r.colors.success700:o==="warning"?r.colors.warning700:r.colors.primary700;exports.handleBackgroundColor=n;exports.handleBorderColor=s;exports.handleIconColor=c;
@@ -1,6 +1,6 @@
1
- const s = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger100 : o === "success" ? r.colors.success100 : r.colors.primary100, c = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger200 : o === "success" ? r.colors.success200 : r.colors.primary200, n = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger700 : o === "success" ? r.colors.success700 : r.colors.primary700;
1
+ const s = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger100 : o === "success" ? r.colors.success100 : o === "warning" ? r.colors.warning100 : r.colors.primary100, n = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger200 : o === "success" ? r.colors.success200 : o === "warning" ? r.colors.warning200 : r.colors.primary200, c = ({ theme: r, variant: o }) => o === "danger" ? r.colors.danger700 : o === "success" ? r.colors.success700 : o === "warning" ? r.colors.warning700 : r.colors.primary700;
2
2
  export {
3
3
  s as handleBackgroundColor,
4
- c as handleBorderColor,
5
- n as handleIconColor
4
+ n as handleBorderColor,
5
+ c as handleIconColor
6
6
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),f=require("styled-components"),v=require("prop-types"),t=require("./constants.cjs"),g=require("../Typography/Typography.cjs"),h=require("../Flex/Flex.cjs"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},a=l(d),o=l(f),r=l(v),y=o.default.img`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),f=require("styled-components"),v=require("prop-types"),t=require("./constants.cjs"),g=require("../Typography/Typography.cjs"),h=require("../Flex/Flex.cjs"),s=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},i=s(c),o=s(f),a=s(v),y=o.default.img`
2
2
  border-radius: 50%;
3
3
  object-fit: cover;
4
4
  display: block;
@@ -14,7 +14,7 @@
14
14
  position: absolute;
15
15
  transform: translate(-${(t.previewSize-t.avatarSize)/2}px, -100%);
16
16
  margin-top: -${({theme:e})=>e.spaces[1]};
17
- `,S=o.default.div`
17
+ `,x=o.default.div`
18
18
  z-index: 1;
19
19
  border-radius: 30%;
20
20
  position: absolute;
@@ -22,8 +22,8 @@
22
22
  height: ${t.avatarSize/16}rem;
23
23
  background: ${({theme:e})=>e.colors.neutral0};
24
24
  opacity: 0.4;
25
- `,s=({src:e,alt:c,preview:i})=>{const[n,u]=d.useState(!1);return a.default.createElement("span",null,i&&n?a.default.createElement(b,{"aria-hidden":!0,alt:"",width:`${t.previewSize}px`,height:`${t.previewSize}px`,src:i===!0?e:i}):null,a.default.createElement(m,{hovering:i&&n,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1)},i&&n?a.default.createElement(S,null):null,a.default.createElement(y,{src:e,alt:c,width:`${t.avatarSize}px`,height:`${t.avatarSize}px`})))},x=o.default(h.Flex)`
25
+ `,u=({src:e,alt:l,preview:r})=>{const[n,p]=c.useState(!1);return i.default.createElement("span",null,r&&n?i.default.createElement(b,{"aria-hidden":!0,alt:"",width:`${t.previewSize}px`,height:`${t.previewSize}px`,src:r===!0?e:r}):null,i.default.createElement(m,{hovering:r&&n,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1)},r&&n?i.default.createElement(x,null):null,i.default.createElement(y,{src:e,alt:l,width:`${t.avatarSize}px`,height:`${t.avatarSize}px`})))},S=o.default(h.Flex)`
26
26
  span {
27
27
  line-height: 0;
28
28
  }
29
- `,p=({children:e})=>a.default.createElement(x,{borderRadius:"50%",width:`${t.avatarSize}px`,height:`${t.avatarSize}px`,background:"primary600",justifyContent:"center"},a.default.createElement(g.Typography,{fontWeight:"bold",textColor:"buttonNeutral0",fontSize:0,textTransform:"uppercase"},e));p.propTypes={children:r.default.node.isRequired};s.defaultProps={alt:void 0,preview:void 0};s.propTypes={alt:r.default.string,preview:r.default.oneOfType([r.default.string,r.default.bool]),src:r.default.string.isRequired};exports.Avatar=s;exports.Initials=p;
29
+ `,d=({children:e,background:l,textColor:r})=>i.default.createElement(S,{background:l,borderRadius:"50%",width:`${t.avatarSize}px`,height:`${t.avatarSize}px`,justifyContent:"center"},i.default.createElement(g.Typography,{fontSize:0,fontWeight:"bold",textColor:r,textTransform:"uppercase"},e));d.defaultProps={background:"primary600",textColor:"buttonNeutral0"};d.propTypes={background:a.default.string,children:a.default.node.isRequired,textColor:a.default.string};u.defaultProps={alt:void 0,preview:void 0};u.propTypes={alt:a.default.string,preview:a.default.oneOfType([a.default.string,a.default.bool]),src:a.default.string.isRequired};exports.Avatar=u;exports.Initials=d;
@@ -1,26 +1,26 @@
1
- import r, { useState as m } from "react";
1
+ import i, { useState as m } from "react";
2
2
  import a from "styled-components";
3
- import i from "prop-types";
4
- import { avatarSize as t, previewSize as s } from "./constants.js";
5
- import { Typography as c } from "../Typography/Typography.js";
6
- import { Flex as u } from "../Flex/Flex.js";
3
+ import r from "prop-types";
4
+ import { avatarSize as t, previewSize as l } from "./constants.js";
5
+ import { Typography as u } from "../Typography/Typography.js";
6
+ import { Flex as g } from "../Flex/Flex.js";
7
7
  const h = a.img`
8
8
  border-radius: 50%;
9
9
  object-fit: cover;
10
10
  display: block;
11
11
  position: relative;
12
- `, g = a.div`
12
+ `, f = a.div`
13
13
  position: relative;
14
14
  width: ${t / 16}rem;
15
15
  height: ${t / 16}rem;
16
16
  z-index: ${({ hovering: e }) => e ? 1 : void 0};
17
- `, f = a.img`
17
+ `, v = a.img`
18
18
  border-radius: 50%;
19
19
  object-fit: cover;
20
20
  position: absolute;
21
- transform: translate(-${(s - t) / 2}px, -100%);
21
+ transform: translate(-${(l - t) / 2}px, -100%);
22
22
  margin-top: -${({ theme: e }) => e.spaces[1]};
23
- `, v = a.div`
23
+ `, b = a.div`
24
24
  z-index: 1;
25
25
  border-radius: 30%;
26
26
  position: absolute;
@@ -28,53 +28,59 @@ const h = a.img`
28
28
  height: ${t / 16}rem;
29
29
  background: ${({ theme: e }) => e.colors.neutral0};
30
30
  opacity: 0.4;
31
- `, p = ({ src: e, alt: d, preview: o }) => {
32
- const [n, l] = m(!1);
33
- return /* @__PURE__ */ r.createElement("span", null, o && n ? /* @__PURE__ */ r.createElement(f, {
31
+ `, d = ({ src: e, alt: n, preview: o }) => {
32
+ const [s, p] = m(!1);
33
+ return /* @__PURE__ */ i.createElement("span", null, o && s ? /* @__PURE__ */ i.createElement(v, {
34
34
  "aria-hidden": !0,
35
35
  alt: "",
36
- width: `${s}px`,
37
- height: `${s}px`,
36
+ width: `${l}px`,
37
+ height: `${l}px`,
38
38
  src: o === !0 ? e : o
39
- }) : null, /* @__PURE__ */ r.createElement(g, {
40
- hovering: o && n,
41
- onMouseEnter: () => l(!0),
42
- onMouseLeave: () => l(!1)
43
- }, o && n ? /* @__PURE__ */ r.createElement(v, null) : null, /* @__PURE__ */ r.createElement(h, {
39
+ }) : null, /* @__PURE__ */ i.createElement(f, {
40
+ hovering: o && s,
41
+ onMouseEnter: () => p(!0),
42
+ onMouseLeave: () => p(!1)
43
+ }, o && s ? /* @__PURE__ */ i.createElement(b, null) : null, /* @__PURE__ */ i.createElement(h, {
44
44
  src: e,
45
- alt: d,
45
+ alt: n,
46
46
  width: `${t}px`,
47
47
  height: `${t}px`
48
48
  })));
49
- }, b = a(u)`
49
+ }, x = a(g)`
50
50
  span {
51
51
  line-height: 0;
52
52
  }
53
- `, $ = ({ children: e }) => /* @__PURE__ */ r.createElement(b, {
53
+ `, c = ({ children: e, background: n, textColor: o }) => /* @__PURE__ */ i.createElement(x, {
54
+ background: n,
54
55
  borderRadius: "50%",
55
56
  width: `${t}px`,
56
57
  height: `${t}px`,
57
- background: "primary600",
58
58
  justifyContent: "center"
59
- }, /* @__PURE__ */ r.createElement(c, {
60
- fontWeight: "bold",
61
- textColor: "buttonNeutral0",
59
+ }, /* @__PURE__ */ i.createElement(u, {
62
60
  fontSize: 0,
61
+ fontWeight: "bold",
62
+ textColor: o,
63
63
  textTransform: "uppercase"
64
64
  }, e));
65
- $.propTypes = {
66
- children: i.node.isRequired
65
+ c.defaultProps = {
66
+ background: "primary600",
67
+ textColor: "buttonNeutral0"
68
+ };
69
+ c.propTypes = {
70
+ background: r.string,
71
+ children: r.node.isRequired,
72
+ textColor: r.string
67
73
  };
68
- p.defaultProps = {
74
+ d.defaultProps = {
69
75
  alt: void 0,
70
76
  preview: void 0
71
77
  };
72
- p.propTypes = {
73
- alt: i.string,
74
- preview: i.oneOfType([i.string, i.bool]),
75
- src: i.string.isRequired
78
+ d.propTypes = {
79
+ alt: r.string,
80
+ preview: r.oneOfType([r.string, r.bool]),
81
+ src: r.string.isRequired
76
82
  };
77
83
  export {
78
- p as Avatar,
79
- $ as Initials
84
+ d as Avatar,
85
+ c as Initials
80
86
  };
@@ -1 +1 @@
1
- "use strict";var W=Object.defineProperty;var c=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var P=(e,a,t)=>a in e?W(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,j=(e,a)=>{for(var t in a||(a={}))I.call(a,t)&&P(e,t,a[t]);if(c)for(var t of c(a))_.call(a,t)&&P(e,t,a[t]);return e};var y=(e,a)=>{var t={};for(var n in e)I.call(e,n)&&a.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&c)for(var n of c(e))a.indexOf(n)<0&&_.call(e,n)&&(t[n]=e[n]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react"),A=require("prop-types"),V=require("@strapi/icons/Calendar"),w=require("@strapi/icons/Cross"),F=require("../themes/sizes.cjs"),G=require("../TextInput/TextInput.cjs"),D=require("./components.cjs"),H=require("./DatePickerCalendar.cjs"),R=require("./utils/formatDate.cjs"),J=require("../helpers/useId.cjs"),K=require("../helpers/getDefaultLocale.cjs"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},l=u(i),r=u(A),N=u(V),Q=u(w),g=U=>{var C=U,{ariaLabel:e,initialDate:a,selectedDate:t,onChange:n,label:d,locale:E,selectedDateLabel:T,onClear:b,clearLabel:L,disabled:o,id:x}=C,z=y(C,["ariaLabel","initialDate","selectedDate","onChange","label","locale","selectedDateLabel","onClear","clearLabel","disabled","id"]);const O=J.useId("datepicker",x),[m,f]=i.useState(!1),s=i.useRef(null),v=i.useRef(null),h=E||K.getDefaultLocale(),k=t?R.formatDate(t,h):"",q=()=>{o||f(p=>!p)},S=()=>{o||(b(),v.current.focus())},B=p=>{n(p),f(!1)},M=()=>{f(!1)};return l.default.createElement(D.DatePickerWrapper,{bold:m},l.default.createElement(G.TextInput,j({ref:s,onClick:q,onChange:()=>{},value:k,startAction:l.default.createElement(D.DatePickerButton,{ref:v,onClick:q,"aria-label":t?T(R.formatDate(t,h)):d||e,type:"button","aria-disabled":o},l.default.createElement(N.default,{"aria-hidden":!0})),endAction:b&&k?l.default.createElement(D.IconBox,{as:"button",onClick:S,"aria-label":L,"aria-disabled":o},l.default.createElement(Q.default,null)):void 0,"aria-autocomplete":"none",label:d,"aria-label":e,disabled:o,id:O},z)),s.current&&s.current.inputWrapperRef&&m&&l.default.createElement(H.DatePickerCalendar,{selectedDate:t,initialDate:a,onChange:B,onEscape:M,popoverSource:s.current.inputWrapperRef,label:d||e}))};g.defaultProps={ariaLabel:void 0,clearLabel:void 0,disabled:!1,id:void 0,label:void 0,locale:void 0,initialDate:new Date,onClear:void 0,placeholder:void 0,selectedDate:void 0,size:"M"};g.propTypes={ariaLabel:r.default.string,clearLabel:r.default.string,disabled:r.default.bool,id:r.default.string,initialDate:r.default.instanceOf(Date),label:r.default.string,locale:r.default.string,onChange:r.default.func.isRequired,onClear:r.default.func,placeholder:r.default.string,selectedDate:r.default.instanceOf(Date),selectedDateLabel:r.default.func.isRequired,size:r.default.oneOf(Object.keys(F.sizes.input))};exports.DatePicker=g;
1
+ "use strict";var V=Object.defineProperty;var s=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var P=(e,a,t)=>a in e?V(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,j=(e,a)=>{for(var t in a||(a={}))I.call(a,t)&&P(e,t,a[t]);if(s)for(var t of s(a))_.call(a,t)&&P(e,t,a[t]);return e};var y=(e,a)=>{var t={};for(var r in e)I.call(e,r)&&a.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&s)for(var r of s(e))a.indexOf(r)<0&&_.call(e,r)&&(t[r]=e[r]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),w=require("prop-types"),F=require("@strapi/icons/Calendar"),G=require("@strapi/icons/Cross"),H=require("../themes/sizes.cjs"),J=require("../TextInput/TextInput.cjs"),D=require("./components.cjs"),K=require("./DatePickerCalendar.cjs"),R=require("./utils/formatDate.cjs"),N=require("../helpers/useId.cjs"),Q=require("../helpers/getDefaultLocale.cjs"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},l=u(c),n=u(w),U=u(F),X=u(G),m=Y=>{var b=Y,{ariaLabel:e,initialDate:a,selectedDate:t,onChange:r,label:d,locale:E,selectedDateLabel:T,onClear:g,clearLabel:x,disabled:o,id:L,minDate:O,maxDate:z}=b,S=y(b,["ariaLabel","initialDate","selectedDate","onChange","label","locale","selectedDateLabel","onClear","clearLabel","disabled","id","minDate","maxDate"]);const B=N.useId("datepicker",L),[C,f]=c.useState(!1),i=c.useRef(null),v=c.useRef(null),h=E||Q.getDefaultLocale(),k=t?R.formatDate(t,h):"",q=()=>{o||f(p=>!p)},M=()=>{o||(g(),v.current.focus())},W=p=>{r(p),f(!1)},A=()=>{f(!1)};return l.default.createElement(D.DatePickerWrapper,{bold:C},l.default.createElement(J.TextInput,j({ref:i,onClick:q,onChange:()=>{},value:k,startAction:l.default.createElement(D.DatePickerButton,{ref:v,onClick:q,"aria-label":t?T(R.formatDate(t,h)):d||e,type:"button","aria-disabled":o},l.default.createElement(U.default,{"aria-hidden":!0})),endAction:g&&k?l.default.createElement(D.IconBox,{as:"button",onClick:M,"aria-label":x,"aria-disabled":o},l.default.createElement(X.default,null)):void 0,"aria-autocomplete":"none",label:d,"aria-label":e,disabled:o,id:B},S)),i.current&&i.current.inputWrapperRef&&C&&l.default.createElement(K.DatePickerCalendar,{selectedDate:t,initialDate:a,onChange:W,onEscape:A,popoverSource:i.current.inputWrapperRef,label:d||e,minDate:O,maxDate:z}))};m.defaultProps={ariaLabel:void 0,clearLabel:void 0,disabled:!1,id:void 0,label:void 0,locale:void 0,initialDate:new Date,minDate:void 0,maxDate:void 0,onClear:void 0,placeholder:void 0,selectedDate:void 0,size:"M"};m.propTypes={ariaLabel:n.default.string,clearLabel:n.default.string,disabled:n.default.bool,id:n.default.string,initialDate:n.default.instanceOf(Date),label:n.default.string,locale:n.default.string,maxDate:n.default.instanceOf(Date),minDate:n.default.instanceOf(Date),onChange:n.default.func.isRequired,onClear:n.default.func,placeholder:n.default.string,selectedDate:n.default.instanceOf(Date),selectedDateLabel:n.default.func.isRequired,size:n.default.oneOf(Object.keys(H.sizes.input))};exports.DatePicker=m;
@@ -1,48 +1,50 @@
1
- var S = Object.defineProperty;
1
+ var _ = Object.defineProperty;
2
2
  var c = Object.getOwnPropertySymbols;
3
3
  var h = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
4
- var D = (t, r, e) => r in t ? S(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e, E = (t, r) => {
5
- for (var e in r || (r = {}))
6
- h.call(r, e) && D(t, e, r[e]);
4
+ var C = (t, a, e) => a in t ? _(t, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[a] = e, E = (t, a) => {
5
+ for (var e in a || (a = {}))
6
+ h.call(a, e) && C(t, e, a[e]);
7
7
  if (c)
8
- for (var e of c(r))
9
- k.call(r, e) && D(t, e, r[e]);
8
+ for (var e of c(a))
9
+ k.call(a, e) && C(t, e, a[e]);
10
10
  return t;
11
11
  };
12
- var R = (t, r) => {
12
+ var R = (t, a) => {
13
13
  var e = {};
14
14
  for (var o in t)
15
- h.call(t, o) && r.indexOf(o) < 0 && (e[o] = t[o]);
15
+ h.call(t, o) && a.indexOf(o) < 0 && (e[o] = t[o]);
16
16
  if (t != null && c)
17
17
  for (var o of c(t))
18
- r.indexOf(o) < 0 && k.call(t, o) && (e[o] = t[o]);
18
+ a.indexOf(o) < 0 && k.call(t, o) && (e[o] = t[o]);
19
19
  return e;
20
20
  };
21
- import n, { useState as V, useRef as P } from "react";
22
- import a from "prop-types";
23
- import _ from "@strapi/icons/Calendar";
24
- import j from "@strapi/icons/Cross";
25
- import { sizes as w } from "../themes/sizes.js";
26
- import { TextInput as M } from "../TextInput/TextInput.js";
27
- import { DatePickerWrapper as F, DatePickerButton as G, IconBox as H } from "./components.js";
28
- import { DatePickerCalendar as J } from "./DatePickerCalendar.js";
29
- import { formatDate as y } from "./utils/formatDate.js";
30
- import { useId as K } from "../helpers/useId.js";
31
- import { getDefaultLocale as N } from "../helpers/getDefaultLocale.js";
32
- const I = (Q) => {
33
- var d = Q, {
21
+ import n, { useState as j, useRef as P } from "react";
22
+ import r from "prop-types";
23
+ import w from "@strapi/icons/Calendar";
24
+ import M from "@strapi/icons/Cross";
25
+ import { sizes as F } from "../themes/sizes.js";
26
+ import { TextInput as G } from "../TextInput/TextInput.js";
27
+ import { DatePickerWrapper as H, DatePickerButton as J, IconBox as K } from "./components.js";
28
+ import { DatePickerCalendar as N } from "./DatePickerCalendar.js";
29
+ import { formatDate as O } from "./utils/formatDate.js";
30
+ import { useId as Q } from "../helpers/useId.js";
31
+ import { getDefaultLocale as U } from "../helpers/getDefaultLocale.js";
32
+ const x = (X) => {
33
+ var u = X, {
34
34
  ariaLabel: t,
35
- initialDate: r,
35
+ initialDate: a,
36
36
  selectedDate: e,
37
37
  onChange: o,
38
38
  label: s,
39
- locale: L,
40
- selectedDateLabel: O,
41
- onClear: u,
42
- clearLabel: x,
39
+ locale: y,
40
+ selectedDateLabel: I,
41
+ onClear: m,
42
+ clearLabel: L,
43
43
  disabled: i,
44
- id: z
45
- } = d, B = R(d, [
44
+ id: z,
45
+ minDate: B,
46
+ maxDate: T
47
+ } = u, W = R(u, [
46
48
  "ariaLabel",
47
49
  "initialDate",
48
50
  "selectedDate",
@@ -53,55 +55,59 @@ const I = (Q) => {
53
55
  "onClear",
54
56
  "clearLabel",
55
57
  "disabled",
56
- "id"
58
+ "id",
59
+ "minDate",
60
+ "maxDate"
57
61
  ]);
58
- const T = K("datepicker", z), [m, p] = V(!1), l = P(null), b = P(null), g = L || N(), v = e ? y(e, g) : "", C = () => {
59
- i || p((f) => !f);
60
- }, W = () => {
61
- i || (u(), b.current.focus());
62
- }, q = (f) => {
63
- o(f), p(!1);
62
+ const q = Q("datepicker", z), [d, f] = j(!1), l = P(null), D = P(null), b = y || U(), g = e ? O(e, b) : "", v = () => {
63
+ i || f((p) => !p);
64
64
  }, A = () => {
65
- p(!1);
65
+ i || (m(), D.current.focus());
66
+ }, S = (p) => {
67
+ o(p), f(!1);
68
+ }, V = () => {
69
+ f(!1);
66
70
  };
67
- return /* @__PURE__ */ n.createElement(F, {
68
- bold: m
69
- }, /* @__PURE__ */ n.createElement(M, E({
71
+ return /* @__PURE__ */ n.createElement(H, {
72
+ bold: d
73
+ }, /* @__PURE__ */ n.createElement(G, E({
70
74
  ref: l,
71
- onClick: C,
75
+ onClick: v,
72
76
  onChange: () => {
73
77
  },
74
- value: v,
75
- startAction: /* @__PURE__ */ n.createElement(G, {
76
- ref: b,
77
- onClick: C,
78
- "aria-label": e ? O(y(e, g)) : s || t,
78
+ value: g,
79
+ startAction: /* @__PURE__ */ n.createElement(J, {
80
+ ref: D,
81
+ onClick: v,
82
+ "aria-label": e ? I(O(e, b)) : s || t,
79
83
  type: "button",
80
84
  "aria-disabled": i
81
- }, /* @__PURE__ */ n.createElement(_, {
85
+ }, /* @__PURE__ */ n.createElement(w, {
82
86
  "aria-hidden": !0
83
87
  })),
84
- endAction: u && v ? /* @__PURE__ */ n.createElement(H, {
88
+ endAction: m && g ? /* @__PURE__ */ n.createElement(K, {
85
89
  as: "button",
86
- onClick: W,
87
- "aria-label": x,
90
+ onClick: A,
91
+ "aria-label": L,
88
92
  "aria-disabled": i
89
- }, /* @__PURE__ */ n.createElement(j, null)) : void 0,
93
+ }, /* @__PURE__ */ n.createElement(M, null)) : void 0,
90
94
  "aria-autocomplete": "none",
91
95
  label: s,
92
96
  "aria-label": t,
93
97
  disabled: i,
94
- id: T
95
- }, B)), l.current && l.current.inputWrapperRef && m && /* @__PURE__ */ n.createElement(J, {
98
+ id: q
99
+ }, W)), l.current && l.current.inputWrapperRef && d && /* @__PURE__ */ n.createElement(N, {
96
100
  selectedDate: e,
97
- initialDate: r,
98
- onChange: q,
99
- onEscape: A,
101
+ initialDate: a,
102
+ onChange: S,
103
+ onEscape: V,
100
104
  popoverSource: l.current.inputWrapperRef,
101
- label: s || t
105
+ label: s || t,
106
+ minDate: B,
107
+ maxDate: T
102
108
  }));
103
109
  };
104
- I.defaultProps = {
110
+ x.defaultProps = {
105
111
  ariaLabel: void 0,
106
112
  clearLabel: void 0,
107
113
  disabled: !1,
@@ -109,26 +115,30 @@ I.defaultProps = {
109
115
  label: void 0,
110
116
  locale: void 0,
111
117
  initialDate: new Date(),
118
+ minDate: void 0,
119
+ maxDate: void 0,
112
120
  onClear: void 0,
113
121
  placeholder: void 0,
114
122
  selectedDate: void 0,
115
123
  size: "M"
116
124
  };
117
- I.propTypes = {
118
- ariaLabel: a.string,
119
- clearLabel: a.string,
120
- disabled: a.bool,
121
- id: a.string,
122
- initialDate: a.instanceOf(Date),
123
- label: a.string,
124
- locale: a.string,
125
- onChange: a.func.isRequired,
126
- onClear: a.func,
127
- placeholder: a.string,
128
- selectedDate: a.instanceOf(Date),
129
- selectedDateLabel: a.func.isRequired,
130
- size: a.oneOf(Object.keys(w.input))
125
+ x.propTypes = {
126
+ ariaLabel: r.string,
127
+ clearLabel: r.string,
128
+ disabled: r.bool,
129
+ id: r.string,
130
+ initialDate: r.instanceOf(Date),
131
+ label: r.string,
132
+ locale: r.string,
133
+ maxDate: r.instanceOf(Date),
134
+ minDate: r.instanceOf(Date),
135
+ onChange: r.func.isRequired,
136
+ onClear: r.func,
137
+ placeholder: r.string,
138
+ selectedDate: r.instanceOf(Date),
139
+ selectedDateLabel: r.func.isRequired,
140
+ size: r.oneOf(Object.keys(F.input))
131
141
  };
132
142
  export {
133
- I as DatePicker
143
+ x as DatePicker
134
144
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/design-system",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  "@storybook/addon-essentials": "^6.5.13",
32
32
  "@storybook/addon-links": "^6.5.13",
33
33
  "@storybook/react": "^6.5.13",
34
- "@strapi/icons": "^1.4.1",
34
+ "@strapi/icons": "^1.4.2",
35
35
  "@swc/core": "^1.3.11",
36
36
  "@swc/jest": "^0.2.23",
37
37
  "@testing-library/jest-dom": "5.16.5",
@@ -51,7 +51,7 @@
51
51
  "styled-components": "^5.2.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "@strapi/icons": "^1.4.1",
54
+ "@strapi/icons": "^1.4.2",
55
55
  "react": "^17.0.1",
56
56
  "react-dom": "^17.0.1",
57
57
  "react-router-dom": "^5.2.0",
@@ -71,5 +71,5 @@
71
71
  "test:e2e:watch": "chokidar '**/__tests__/*.e2e.js' -c 'npm run test:e2e -- --retries=0 {path}'",
72
72
  "test:e2e:debug": "cross-env PWDEBUG=1 playwright test"
73
73
  },
74
- "gitHead": "50393ea4408afcbc45386001bb5d30559b6f02da"
74
+ "gitHead": "7f8ee2fc8d6e79e5931955f6224ddffee8f9ac3d"
75
75
  }