@strapi/design-system 1.6.1 → 1.6.3
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/Accordion/Accordion.cjs +5 -5
- package/dist/Accordion/Accordion.js +24 -22
- package/dist/Avatar/Avatar.cjs +5 -16
- package/dist/Avatar/Avatar.js +44 -48
- package/dist/BaseRadio/BaseRadio.cjs +2 -2
- package/dist/BaseRadio/BaseRadio.js +25 -23
- package/dist/Box/Box.cjs +1 -1
- package/dist/Box/Box.js +36 -33
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +1 -1
- package/dist/Card/CardHeader.cjs +1 -2
- package/dist/Card/CardHeader.js +1 -1
- package/dist/Card/CardTimer.cjs +1 -5
- package/dist/Card/CardTimer.js +14 -20
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +9 -9
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +16 -16
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +139 -139
- package/dist/Combobox/ComboboxList.cjs +1 -1
- package/dist/Combobox/ComboboxList.js +5 -12
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +71 -71
- package/dist/Dialog/Dialog.cjs +4 -7
- package/dist/Dialog/Dialog.js +30 -29
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +7 -7
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +4 -4
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +45 -42
- package/dist/JSONInput/JSONInputContainer.cjs +5 -2
- package/dist/JSONInput/JSONInputContainer.js +6 -3
- package/dist/Layout/HeaderLayout.cjs +3 -8
- package/dist/Layout/HeaderLayout.js +38 -38
- package/dist/Main/SkipToContent.cjs +1 -2
- package/dist/Main/SkipToContent.js +1 -1
- package/dist/MainNav/MainNav.cjs +1 -6
- package/dist/MainNav/MainNav.js +15 -15
- package/dist/MainNav/NavFooter.cjs +1 -3
- package/dist/MainNav/NavFooter.js +3 -4
- package/dist/ModalLayout/ModalLayout.cjs +3 -9
- package/dist/ModalLayout/ModalLayout.js +24 -23
- package/dist/NumberInput/NumberInput.cjs +1 -1
- package/dist/NumberInput/NumberInput.js +18 -18
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +112 -103
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.js +9 -3
- package/dist/Select/Option.cjs +3 -7
- package/dist/Select/Option.js +6 -6
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +58 -58
- package/dist/Select/SelectTags.cjs +1 -3
- package/dist/Select/SelectTags.js +4 -4
- package/dist/Select/SingleSelect.cjs +82 -0
- package/dist/Select/SingleSelect.js +285 -0
- package/dist/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/SimpleMenu/SimpleMenu.js +10 -10
- package/dist/Stack/Stack.cjs +5 -5
- package/dist/Stack/Stack.js +7 -6
- package/dist/SubNav/SubNavHeader.cjs +1 -1
- package/dist/SubNav/SubNavHeader.js +15 -15
- package/dist/SubNav/SubNavLinkSection.cjs +2 -2
- package/dist/SubNav/SubNavLinkSection.js +6 -6
- package/dist/SubNav/SubNavSection.cjs +1 -1
- package/dist/SubNav/SubNavSection.js +12 -12
- package/dist/Table/Table.cjs +1 -3
- package/dist/Table/Table.js +2 -3
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +11 -11
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +24 -24
- package/dist/Textarea/Textarea.cjs +1 -1
- package/dist/Textarea/Textarea.js +1 -1
- package/dist/TimePicker/TimePicker.cjs +2 -2
- package/dist/TimePicker/TimePicker.js +2 -2
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +6 -6
- package/dist/ToggleCheckbox/ToggleCheckbox.js +45 -43
- package/dist/ToggleInput/ToggleInput.cjs +1 -1
- package/dist/ToggleInput/ToggleInput.js +10 -10
- package/dist/Tooltip/Tooltip.cjs +2 -3
- package/dist/Tooltip/Tooltip.js +18 -18
- package/dist/helpers/deprecations.cjs +1 -0
- package/dist/helpers/deprecations.js +13 -0
- package/dist/helpers/useId.cjs +1 -1
- package/dist/helpers/useId.js +11 -4
- package/dist/hooks/useIntersection.cjs +1 -0
- package/dist/hooks/useIntersection.js +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +136 -134
- package/dist/v2/MainNav/MainNav.cjs +1 -6
- package/dist/v2/MainNav/MainNav.js +15 -15
- package/dist/v2/MainNav/NavFooter.cjs +1 -3
- package/dist/v2/MainNav/NavFooter.js +3 -4
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/v2/SimpleMenu/SimpleMenu.js +12 -12
- package/dist/v2/SubNav/SubNavHeader.cjs +1 -1
- package/dist/v2/SubNav/SubNavHeader.js +15 -15
- package/dist/v2/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/v2/SubNav/SubNavLinkSection.js +8 -8
- package/dist/v2/SubNav/SubNavSection.cjs +1 -1
- package/dist/v2/SubNav/SubNavSection.js +4 -4
- package/package.json +3 -4
- package/dist/helpers/genId.cjs +0 -1
- package/dist/helpers/genId.js +0 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import e, { useRef as h, useState as E, useEffect as v } from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import R from "styled-components";
|
|
3
|
+
import t from "prop-types";
|
|
4
4
|
import { Typography as c } from "../Typography/Typography.js";
|
|
5
5
|
import { Box as i } from "../Box/Box.js";
|
|
6
6
|
import { Flex as l } from "../Flex/Flex.js";
|
|
7
|
-
import { useElementOnScreen as
|
|
7
|
+
import { useElementOnScreen as b } from "../helpers/useElementOnScreen.js";
|
|
8
8
|
import { useResizeObserver as w } from "../helpers/useResizeObserver.js";
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const L = () => {
|
|
10
|
+
const n = h(null), [o, a] = E(null), [r, d] = b({
|
|
11
11
|
root: null,
|
|
12
12
|
rootMargin: "0px",
|
|
13
13
|
threshold: 0
|
|
@@ -15,51 +15,51 @@ const x = () => {
|
|
|
15
15
|
return w(r, () => {
|
|
16
16
|
r.current && a(r.current.getBoundingClientRect());
|
|
17
17
|
}), v(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
18
|
+
n.current && a(n.current.getBoundingClientRect());
|
|
19
|
+
}, [n]), {
|
|
20
20
|
containerRef: r,
|
|
21
21
|
isVisible: d,
|
|
22
|
-
baseHeaderLayoutRef:
|
|
22
|
+
baseHeaderLayoutRef: n,
|
|
23
23
|
headerSize: o
|
|
24
24
|
};
|
|
25
|
-
}, p = (
|
|
26
|
-
const { containerRef: o, isVisible: a, baseHeaderLayoutRef: r, headerSize: d } =
|
|
25
|
+
}, p = (n) => {
|
|
26
|
+
const { containerRef: o, isVisible: a, baseHeaderLayoutRef: r, headerSize: d } = L();
|
|
27
27
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", {
|
|
28
28
|
style: { height: d?.height },
|
|
29
29
|
ref: o
|
|
30
30
|
}, a && /* @__PURE__ */ e.createElement(s, {
|
|
31
31
|
ref: r,
|
|
32
|
-
...
|
|
32
|
+
...n
|
|
33
33
|
})), !a && /* @__PURE__ */ e.createElement(s, {
|
|
34
|
-
...
|
|
34
|
+
...n,
|
|
35
35
|
sticky: !0,
|
|
36
36
|
width: d?.width
|
|
37
37
|
}));
|
|
38
38
|
};
|
|
39
39
|
p.displayName = "HeaderLayout";
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
top: 0;
|
|
43
|
-
right: 0;
|
|
44
|
-
width: ${(t) => t.width}px;
|
|
45
|
-
z-index: 4;
|
|
46
|
-
box-shadow: ${({ theme: t }) => t.shadows.tableShadow};
|
|
40
|
+
const x = R(i)`
|
|
41
|
+
width: ${(n) => n.width}px;
|
|
47
42
|
`, s = e.forwardRef(
|
|
48
|
-
({ navigationAction:
|
|
43
|
+
({ navigationAction: n, primaryAction: o, secondaryAction: a, subtitle: r, title: d, sticky: f, width: g, ...u }, y) => {
|
|
49
44
|
const m = typeof r == "string";
|
|
50
|
-
return f ? /* @__PURE__ */ e.createElement(
|
|
45
|
+
return f ? /* @__PURE__ */ e.createElement(x, {
|
|
51
46
|
paddingLeft: 6,
|
|
52
47
|
paddingRight: 6,
|
|
53
48
|
paddingTop: 3,
|
|
54
49
|
paddingBottom: 3,
|
|
50
|
+
position: "fixed",
|
|
51
|
+
top: 0,
|
|
52
|
+
right: 0,
|
|
55
53
|
background: "neutral0",
|
|
54
|
+
shadow: "tableShadow",
|
|
56
55
|
width: g,
|
|
56
|
+
zIndex: 4,
|
|
57
57
|
"data-strapi-header-sticky": !0
|
|
58
58
|
}, /* @__PURE__ */ e.createElement(l, {
|
|
59
59
|
justifyContent: "space-between"
|
|
60
|
-
}, /* @__PURE__ */ e.createElement(l, null,
|
|
60
|
+
}, /* @__PURE__ */ e.createElement(l, null, n && /* @__PURE__ */ e.createElement(i, {
|
|
61
61
|
paddingRight: 3
|
|
62
|
-
},
|
|
62
|
+
}, n), /* @__PURE__ */ e.createElement(i, null, /* @__PURE__ */ e.createElement(c, {
|
|
63
63
|
variant: "beta",
|
|
64
64
|
as: "h1",
|
|
65
65
|
...u
|
|
@@ -75,12 +75,12 @@ const L = b(i)`
|
|
|
75
75
|
paddingLeft: 10,
|
|
76
76
|
paddingRight: 10,
|
|
77
77
|
paddingBottom: 8,
|
|
78
|
-
paddingTop:
|
|
78
|
+
paddingTop: n ? 6 : 8,
|
|
79
79
|
background: "neutral100",
|
|
80
80
|
"data-strapi-header": !0
|
|
81
|
-
},
|
|
81
|
+
}, n ? /* @__PURE__ */ e.createElement(i, {
|
|
82
82
|
paddingBottom: 2
|
|
83
|
-
},
|
|
83
|
+
}, n) : null, /* @__PURE__ */ e.createElement(l, {
|
|
84
84
|
justifyContent: "space-between"
|
|
85
85
|
}, /* @__PURE__ */ e.createElement(l, null, /* @__PURE__ */ e.createElement(c, {
|
|
86
86
|
as: "h1",
|
|
@@ -105,13 +105,13 @@ s.defaultProps = {
|
|
|
105
105
|
width: void 0
|
|
106
106
|
};
|
|
107
107
|
s.propTypes = {
|
|
108
|
-
navigationAction:
|
|
109
|
-
primaryAction:
|
|
110
|
-
secondaryAction:
|
|
111
|
-
sticky:
|
|
112
|
-
subtitle:
|
|
113
|
-
title:
|
|
114
|
-
width:
|
|
108
|
+
navigationAction: t.node,
|
|
109
|
+
primaryAction: t.node,
|
|
110
|
+
secondaryAction: t.node,
|
|
111
|
+
sticky: t.bool,
|
|
112
|
+
subtitle: t.oneOfType([t.string, t.node]),
|
|
113
|
+
title: t.string.isRequired,
|
|
114
|
+
width: t.number
|
|
115
115
|
};
|
|
116
116
|
p.defaultProps = {
|
|
117
117
|
navigationAction: void 0,
|
|
@@ -120,11 +120,11 @@ p.defaultProps = {
|
|
|
120
120
|
subtitle: void 0
|
|
121
121
|
};
|
|
122
122
|
p.propTypes = {
|
|
123
|
-
navigationAction:
|
|
124
|
-
primaryAction:
|
|
125
|
-
secondaryAction:
|
|
126
|
-
subtitle:
|
|
127
|
-
title:
|
|
123
|
+
navigationAction: t.node,
|
|
124
|
+
primaryAction: t.node,
|
|
125
|
+
secondaryAction: t.node,
|
|
126
|
+
subtitle: t.oneOfType([t.string, t.node]),
|
|
127
|
+
title: t.string.isRequired
|
|
128
128
|
};
|
|
129
129
|
export {
|
|
130
130
|
s as BaseHeaderLayout,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react"),s=require("styled-components"),r=require("prop-types"),a=require("../Box/Box.cjs"),t=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=t(n),u=t(s),l=t(r),d=u.default(a.Box)`
|
|
2
2
|
text-decoration: none;
|
|
3
|
-
position: absolute;
|
|
4
3
|
z-index: 9999;
|
|
5
4
|
left: -100%;
|
|
6
5
|
top: -100%;
|
|
@@ -9,4 +8,4 @@
|
|
|
9
8
|
left: ${({theme:e})=>e.spaces[3]};
|
|
10
9
|
top: ${({theme:e})=>e.spaces[3]};
|
|
11
10
|
}
|
|
12
|
-
`,o=({children:e})=>c.default.createElement(d,{as:"a",href:"#main-content",background:"primary600",color:"neutral0",padding:3,hasRadius:!0},e);o.propTypes={children:l.default.node.isRequired};exports.SkipToContent=o;
|
|
11
|
+
`,o=({children:e})=>c.default.createElement(d,{as:"a",href:"#main-content",background:"primary600",color:"neutral0",padding:3,position:"absolute",hasRadius:!0},e);o.propTypes={children:l.default.node.isRequired};exports.SkipToContent=o;
|
|
@@ -4,7 +4,6 @@ import r from "prop-types";
|
|
|
4
4
|
import { Box as n } from "../Box/Box.js";
|
|
5
5
|
const p = t(n)`
|
|
6
6
|
text-decoration: none;
|
|
7
|
-
position: absolute;
|
|
8
7
|
z-index: 9999;
|
|
9
8
|
left: -100%;
|
|
10
9
|
top: -100%;
|
|
@@ -19,6 +18,7 @@ const p = t(n)`
|
|
|
19
18
|
background: "primary600",
|
|
20
19
|
color: "neutral0",
|
|
21
20
|
padding: 3,
|
|
21
|
+
position: "absolute",
|
|
22
22
|
hasRadius: !0
|
|
23
23
|
}, o);
|
|
24
24
|
a.propTypes = {
|
package/dist/MainNav/MainNav.cjs
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),l=require("styled-components"),s=require("prop-types"),c=require("../Flex/Flex.cjs"),i=require("./MainNavContext.cjs"),t=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},a=t(r),u=t(l),d=t(s),p=u.default(c.Flex)`
|
|
2
2
|
width: ${({condensed:e})=>e?"max-content":`${224/16}rem`};
|
|
3
|
-
background: ${({theme:e})=>e.colors.neutral0};
|
|
4
|
-
position: sticky;
|
|
5
|
-
top: 0;
|
|
6
|
-
height: 100vh;
|
|
7
|
-
z-index: 2;
|
|
8
3
|
border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
9
|
-
`,o=({condensed:e,...n})=>a.default.createElement(i.MainNavContext.Provider,{value:e},a.default.createElement(p,{alignItems:"normal",direction:"column",
|
|
4
|
+
`,o=({condensed:e,...n})=>a.default.createElement(i.MainNavContext.Provider,{value:e},a.default.createElement(p,{alignItems:"normal",as:"nav",background:"neutral0",condensed:e,direction:"column",height:"100vh",position:"sticky",top:0,zIndex:2,...n}));o.defaultProps={condensed:!1};o.propTypes={condensed:d.default.bool};exports.MainNav=o;
|
package/dist/MainNav/MainNav.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "react";
|
|
2
2
|
import n from "styled-components";
|
|
3
3
|
import a from "prop-types";
|
|
4
4
|
import { Flex as i } from "../Flex/Flex.js";
|
|
5
|
-
import { MainNavContext as
|
|
6
|
-
const
|
|
7
|
-
width: ${({ condensed:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
z-index: 2;
|
|
13
|
-
border-right: 1px solid ${({ theme: o }) => o.colors.neutral150};
|
|
14
|
-
`, r = ({ condensed: o, ...t }) => /* @__PURE__ */ e.createElement(l.Provider, {
|
|
15
|
-
value: o
|
|
16
|
-
}, /* @__PURE__ */ e.createElement(m, {
|
|
5
|
+
import { MainNavContext as m } from "./MainNavContext.js";
|
|
6
|
+
const p = n(i)`
|
|
7
|
+
width: ${({ condensed: e }) => e ? "max-content" : `${224 / 16}rem`};
|
|
8
|
+
border-right: 1px solid ${({ theme: e }) => e.colors.neutral150};
|
|
9
|
+
`, r = ({ condensed: e, ...t }) => /* @__PURE__ */ o.createElement(m.Provider, {
|
|
10
|
+
value: e
|
|
11
|
+
}, /* @__PURE__ */ o.createElement(p, {
|
|
17
12
|
alignItems: "normal",
|
|
18
|
-
direction: "column",
|
|
19
13
|
as: "nav",
|
|
20
|
-
|
|
14
|
+
background: "neutral0",
|
|
15
|
+
condensed: e,
|
|
16
|
+
direction: "column",
|
|
17
|
+
height: "100vh",
|
|
18
|
+
position: "sticky",
|
|
19
|
+
top: 0,
|
|
20
|
+
zIndex: 2,
|
|
21
21
|
...t
|
|
22
22
|
}));
|
|
23
23
|
r.defaultProps = {
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),
|
|
2
|
-
position: relative;
|
|
3
|
-
`,o=({children:e})=>n.default.createElement(d,null,e);o.displayName="NavFooter";o.propTypes={children:u.default.node.isRequired};exports.NavFooter=o;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),a=require("prop-types"),s=require("../Box/Box.cjs"),o=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},u=o(r),c=o(a),t=({children:e})=>u.default.createElement(s.Box,{position:"relative"},e);t.displayName="NavFooter";t.propTypes={children:c.default.node.isRequired};exports.NavFooter=t;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import r from "react";
|
|
2
2
|
import t from "prop-types";
|
|
3
|
-
import i from "styled-components";
|
|
4
3
|
import { Box as p } from "../Box/Box.js";
|
|
5
|
-
const
|
|
6
|
-
position: relative
|
|
7
|
-
|
|
4
|
+
const e = ({ children: o }) => /* @__PURE__ */ r.createElement(p, {
|
|
5
|
+
position: "relative"
|
|
6
|
+
}, o);
|
|
8
7
|
e.displayName = "NavFooter";
|
|
9
8
|
e.propTypes = {
|
|
10
9
|
children: t.node.isRequired
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("styled-components"),d=require("prop-types"),p=require("../Box/Box.cjs"),f=require("../FocusTrap/FocusTrap.cjs"),
|
|
2
|
-
position: fixed;
|
|
3
|
-
z-index: 4;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("styled-components"),d=require("prop-types"),p=require("../Box/Box.cjs"),f=require("../Flex/Flex.cjs"),y=require("../FocusTrap/FocusTrap.cjs"),m=require("../Portal/Portal.cjs"),x=require("./ModalContext.cjs"),b=require("../DismissibleLayer/DismissibleLayer.cjs"),q=require("../helpers/useLockScroll.cjs"),o=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=o(c),a=o(i),r=o(d),g=a.default(f.Flex)`
|
|
4
2
|
inset: 0;
|
|
5
3
|
background: ${({theme:e})=>`${e.colors.neutral800}1F`};
|
|
6
|
-
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
`,x=r.default(p.Box)`
|
|
4
|
+
`,j=a.default(p.Box)`
|
|
11
5
|
width: ${830/16}rem;
|
|
12
|
-
`,l=({onClose:e,labelledBy:s,...
|
|
6
|
+
`,l=({onClose:e,labelledBy:s,...u})=>(q(!0),t.default.createElement(m.Portal,null,t.default.createElement(x.ModalContext.Provider,{value:e},t.default.createElement(g,{justifyContent:"center",paddingLeft:8,paddingRight:8,position:"fixed",zIndex:4},t.default.createElement(y.FocusTrap,null,t.default.createElement(b.DismissibleLayer,{onEscapeKeyDown:e,onPointerDownOutside:e},t.default.createElement(j,{"aria-labelledby":s,onClick:n=>n.stopPropagation(),background:"neutral0",hasRadius:!0,shadow:"popupShadow",role:"dialog","aria-modal":!0,...u})))))));l.propTypes={labelledBy:r.default.string.isRequired,onClose:r.default.func.isRequired};exports.ModalLayout=l;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "react";
|
|
2
2
|
import t from "styled-components";
|
|
3
3
|
import r from "prop-types";
|
|
4
|
-
import { Box as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Box as l } from "../Box/Box.js";
|
|
5
|
+
import { Flex as m } from "../Flex/Flex.js";
|
|
6
|
+
import { FocusTrap as p } from "../FocusTrap/FocusTrap.js";
|
|
7
|
+
import { Portal as d } from "../Portal/Portal.js";
|
|
7
8
|
import { ModalContext as s } from "./ModalContext.js";
|
|
8
|
-
import { DismissibleLayer as
|
|
9
|
+
import { DismissibleLayer as u } from "../DismissibleLayer/DismissibleLayer.js";
|
|
9
10
|
import c from "../helpers/useLockScroll.js";
|
|
10
|
-
const
|
|
11
|
-
position: fixed;
|
|
12
|
-
z-index: 4;
|
|
11
|
+
const f = t(m)`
|
|
13
12
|
inset: 0;
|
|
14
|
-
background: ${({ theme:
|
|
15
|
-
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
`, f = t(n)`
|
|
13
|
+
background: ${({ theme: o }) => `${o.colors.neutral800}1F`};
|
|
14
|
+
`, y = t(l)`
|
|
20
15
|
width: ${830 / 16}rem;
|
|
21
|
-
`,
|
|
22
|
-
value:
|
|
23
|
-
}, /* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
`, g = ({ onClose: o, labelledBy: a, ...i }) => (c(!0), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(s.Provider, {
|
|
17
|
+
value: o
|
|
18
|
+
}, /* @__PURE__ */ e.createElement(f, {
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
paddingLeft: 8,
|
|
21
|
+
paddingRight: 8,
|
|
22
|
+
position: "fixed",
|
|
23
|
+
zIndex: 4
|
|
24
|
+
}, /* @__PURE__ */ e.createElement(p, null, /* @__PURE__ */ e.createElement(u, {
|
|
25
|
+
onEscapeKeyDown: o,
|
|
26
|
+
onPointerDownOutside: o
|
|
27
|
+
}, /* @__PURE__ */ e.createElement(y, {
|
|
27
28
|
"aria-labelledby": a,
|
|
28
|
-
onClick: (
|
|
29
|
+
onClick: (n) => n.stopPropagation(),
|
|
29
30
|
background: "neutral0",
|
|
30
31
|
hasRadius: !0,
|
|
31
32
|
shadow: "popupShadow",
|
|
@@ -33,10 +34,10 @@ const u = t.div`
|
|
|
33
34
|
"aria-modal": !0,
|
|
34
35
|
...i
|
|
35
36
|
})))))));
|
|
36
|
-
|
|
37
|
+
g.propTypes = {
|
|
37
38
|
labelledBy: r.string.isRequired,
|
|
38
39
|
onClose: r.func.isRequired
|
|
39
40
|
};
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
g as ModalLayout
|
|
42
43
|
};
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
height: ${4/16}rem;
|
|
10
10
|
transform: ${({reverse:r})=>r?"rotateX(180deg)":void 0};
|
|
11
11
|
}
|
|
12
|
-
`,Z="",d=a.default.forwardRef(({size:r,startAction:N,name:j,hint:w,error:E,label:p,labelAction:k,locale:D,id:A,onValueChange:C,value:S,step:o,required:V,disabled:
|
|
12
|
+
`,Z="",d=a.default.forwardRef(({size:r,startAction:N,name:j,hint:w,error:E,label:p,labelAction:k,locale:D,id:A,onValueChange:C,value:S,step:o,required:V,disabled:u,...x},_)=>{const L=Y.useId(A),b=D||G.getDefaultLocale(),i=f.useRef(new q.NumberParser(b,{style:"decimal"})),c=f.useRef(new q.NumberFormatter(b,{maximumFractionDigits:20})),[l,P]=J.useControllableState({prop(e){const n=String(S);return isNaN(n)||n!==e&&e!==""?e:n},defaultProp:Z,onChange(e){const n=i.current.parse(e);C(isNaN(n)?void 0:n)}}),s=e=>{P(String(e))},R=({target:{value:e}})=>{i.current.isValidPartialNumber(e)&&s(e)},y=()=>{if(!l){s(o);return}const e=i.current.parse(l),n=isNaN(e)?o:e+o;s(c.current.format(n))},g=()=>{if(!l){s(-o);return}const e=i.current.parse(l),n=isNaN(e)?-o:e-o;s(c.current.format(n))},K=e=>{if(!u)switch(e.key){case v.KeyboardKeys.DOWN:{e.preventDefault(),g();break}case v.KeyboardKeys.UP:{e.preventDefault(),y();break}}},z=()=>{if(l){const e=i.current.parse(l),n=isNaN(e)?"":c.current.format(e);s(n)}};return a.default.createElement($.Field,{name:j,hint:w,error:E,id:L,required:V},a.default.createElement(W.Stack,{spacing:1},p&&a.default.createElement(B.FieldLabel,{action:k},p),a.default.createElement(H.FieldInput,{ref:_,startAction:N,disabled:u,type:"text",inputmode:"decimal",onChange:R,onKeyDown:K,onBlur:z,value:l,size:r,endAction:a.default.createElement(a.default.Fragment,null,a.default.createElement(I,{disabled:u,"aria-hidden":!0,reverse:!0,onClick:y,tabIndex:-1,type:"button","data-testid":"ArrowUp"},a.default.createElement(h.Icon,{as:F.CarretDown,color:"neutral500"})),a.default.createElement(I,{disabled:u,"aria-hidden":!0,onClick:g,tabIndex:-1,type:"button","data-testid":"ArrowDown"},a.default.createElement(h.Icon,{as:F.CarretDown,color:"neutral500"}))),...x}),a.default.createElement(M.FieldHint,null),a.default.createElement(U.FieldError,null)))});d.displayName="NumberInput";d.defaultProps={"aria-label":void 0,disabled:!1,error:void 0,hint:void 0,id:void 0,label:void 0,labelAction:void 0,locale:void 0,required:!1,size:"M",startAction:void 0,step:1,value:void 0};d.propTypes={"aria-label":t.default.string,disabled:t.default.bool,error:t.default.string,hint:t.default.oneOfType([t.default.string,t.default.node,t.default.arrayOf(t.default.node)]),id:t.default.string,label:t.default.string,labelAction:t.default.element,locale:t.default.string,name:t.default.string.isRequired,onValueChange:t.default.func.isRequired,required:t.default.bool,size:t.default.oneOf(Object.keys(X.sizes.input)),startAction:t.default.element,step:t.default.number,value:t.default.number};exports.NumberInput=d;
|
|
@@ -28,7 +28,7 @@ const h = L.button`
|
|
|
28
28
|
height: ${4 / 16}rem;
|
|
29
29
|
transform: ${({ reverse: n }) => n ? "rotateX(180deg)" : void 0};
|
|
30
30
|
}
|
|
31
|
-
`, J = "",
|
|
31
|
+
`, J = "", u = t.forwardRef(
|
|
32
32
|
({
|
|
33
33
|
size: n,
|
|
34
34
|
startAction: w,
|
|
@@ -43,39 +43,39 @@ const h = L.button`
|
|
|
43
43
|
value: k,
|
|
44
44
|
step: i,
|
|
45
45
|
required: C,
|
|
46
|
-
disabled:
|
|
46
|
+
disabled: m,
|
|
47
47
|
...P
|
|
48
48
|
}, R) => {
|
|
49
|
-
const O = X(
|
|
49
|
+
const O = X(D), p = x || Y(), s = g(new T(p, { style: "decimal" })), c = g(new z(p, { maximumFractionDigits: 20 })), [a, S] = G({
|
|
50
50
|
prop(e) {
|
|
51
51
|
const o = String(k);
|
|
52
52
|
return isNaN(o) || o !== e && e !== "" ? e : o;
|
|
53
53
|
},
|
|
54
54
|
defaultProp: J,
|
|
55
55
|
onChange(e) {
|
|
56
|
-
const o =
|
|
56
|
+
const o = s.current.parse(e);
|
|
57
57
|
F(isNaN(o) ? void 0 : o);
|
|
58
58
|
}
|
|
59
59
|
}), l = (e) => {
|
|
60
60
|
S(String(e));
|
|
61
61
|
}, $ = ({ target: { value: e } }) => {
|
|
62
|
-
|
|
62
|
+
s.current.isValidPartialNumber(e) && l(e);
|
|
63
63
|
}, f = () => {
|
|
64
64
|
if (!a) {
|
|
65
65
|
l(i);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
const e =
|
|
69
|
-
l(
|
|
68
|
+
const e = s.current.parse(a), o = isNaN(e) ? i : e + i;
|
|
69
|
+
l(c.current.format(o));
|
|
70
70
|
}, b = () => {
|
|
71
71
|
if (!a) {
|
|
72
72
|
l(-i);
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
const e =
|
|
76
|
-
l(
|
|
75
|
+
const e = s.current.parse(a), o = isNaN(e) ? -i : e - i;
|
|
76
|
+
l(c.current.format(o));
|
|
77
77
|
}, q = (e) => {
|
|
78
|
-
if (!
|
|
78
|
+
if (!m)
|
|
79
79
|
switch (e.key) {
|
|
80
80
|
case y.DOWN: {
|
|
81
81
|
e.preventDefault(), b();
|
|
@@ -88,7 +88,7 @@ const h = L.button`
|
|
|
88
88
|
}
|
|
89
89
|
}, K = () => {
|
|
90
90
|
if (a) {
|
|
91
|
-
const e =
|
|
91
|
+
const e = s.current.parse(a), o = isNaN(e) ? "" : c.current.format(e);
|
|
92
92
|
l(o);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -105,7 +105,7 @@ const h = L.button`
|
|
|
105
105
|
}, d), /* @__PURE__ */ t.createElement(_, {
|
|
106
106
|
ref: R,
|
|
107
107
|
startAction: w,
|
|
108
|
-
disabled:
|
|
108
|
+
disabled: m,
|
|
109
109
|
type: "text",
|
|
110
110
|
inputmode: "decimal",
|
|
111
111
|
onChange: $,
|
|
@@ -114,7 +114,7 @@ const h = L.button`
|
|
|
114
114
|
value: a,
|
|
115
115
|
size: n,
|
|
116
116
|
endAction: /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(h, {
|
|
117
|
-
disabled:
|
|
117
|
+
disabled: m,
|
|
118
118
|
"aria-hidden": !0,
|
|
119
119
|
reverse: !0,
|
|
120
120
|
onClick: f,
|
|
@@ -125,7 +125,7 @@ const h = L.button`
|
|
|
125
125
|
as: v,
|
|
126
126
|
color: "neutral500"
|
|
127
127
|
})), /* @__PURE__ */ t.createElement(h, {
|
|
128
|
-
disabled:
|
|
128
|
+
disabled: m,
|
|
129
129
|
"aria-hidden": !0,
|
|
130
130
|
onClick: b,
|
|
131
131
|
tabIndex: -1,
|
|
@@ -139,8 +139,8 @@ const h = L.button`
|
|
|
139
139
|
}), /* @__PURE__ */ t.createElement(j, null), /* @__PURE__ */ t.createElement(H, null)));
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
u.displayName = "NumberInput";
|
|
143
|
+
u.defaultProps = {
|
|
144
144
|
"aria-label": void 0,
|
|
145
145
|
disabled: !1,
|
|
146
146
|
error: void 0,
|
|
@@ -155,7 +155,7 @@ c.defaultProps = {
|
|
|
155
155
|
step: 1,
|
|
156
156
|
value: void 0
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
u.propTypes = {
|
|
159
159
|
"aria-label": r.string,
|
|
160
160
|
disabled: r.bool,
|
|
161
161
|
error: r.string,
|
|
@@ -173,5 +173,5 @@ c.propTypes = {
|
|
|
173
173
|
value: r.number
|
|
174
174
|
};
|
|
175
175
|
export {
|
|
176
|
-
|
|
176
|
+
u as NumberInput
|
|
177
177
|
};
|
package/dist/Popover/Popover.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),y=require("styled-components"),a=require("@floating-ui/react-dom"),u=require("../Box/Box.cjs"),_=require("../Portal/Portal.cjs"),k=require("../helpers/useIntersection.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const l=S(w),f=v(y),O=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],$=f.default(u.Box)`
|
|
2
2
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
3
3
|
z-index: 4;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
5
5
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
6
|
-
`,
|
|
6
|
+
`,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:i=!1,...c})=>{const[h,g]=l.useState(void 0),{x:m,y:x,reference:d,floating:j,strategy:P}=a.useFloating({strategy:"fixed",placement:i?"bottom":s,middleware:[a.offset({mainAxis:o}),a.shift(),a.flip()],whileElementsMounted:a.autoUpdate});return l.useLayoutEffect(()=>{d(e.current)},[e,d]),l.useLayoutEffect(()=>{r&&g(e.current.offsetWidth)},[r,e]),n.jsx($,{ref:j,style:{left:m,top:x,position:P,width:h||void 0},hasRadius:!0,background:"neutral0",padding:1,...c,children:t})},b=({children:e,intersectionId:t,onReachEnd:o,...r})=>{const s=l.useRef(null);return k.useIntersection(s,o??(()=>{}),{selectorToWatch:`#${t}`,skipWhen:!t||!o}),n.jsxs(q,{ref:s,...r,children:[e,t&&o&&n.jsx(u.Box,{id:t,width:"100%",height:"1px"})]})},q=f.default(u.Box)`
|
|
7
7
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
8
8
|
max-height: ${3*5}rem;
|
|
9
9
|
overflow-y: auto;
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
24
24
|
margin-right: 10px;
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:i,...c})=>n.jsx(_.Portal,{children:n.jsx(p,{source:t,spacing:o,fullWidth:r,placement:s,centered:i,children:n.jsx(b,{...c,children:e})})});exports.Content=p;exports.POPOVER_PLACEMENTS=O;exports.Popover=E;exports.Scrolling=b;
|