@strapi/design-system 1.7.5 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +5 -5
- package/dist/CarouselInput/Carousel.cjs +6 -7
- package/dist/CarouselInput/Carousel.js +25 -79
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +1 -14
- package/dist/CarouselInput/CarouselImage.cjs +3 -4
- package/dist/CarouselInput/CarouselImage.js +13 -23
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +12 -75
- package/dist/CarouselInput/CarouselSlide.cjs +1 -3
- package/dist/CarouselInput/CarouselSlide.js +4 -29
- package/dist/Checkbox/Checkbox.cjs +3 -3
- package/dist/Checkbox/Checkbox.js +18 -40
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +21 -49
- package/dist/Dialog/DialogBody.cjs +2 -2
- package/dist/Dialog/DialogBody.js +6 -19
- package/dist/Dialog/DialogFooter.cjs +2 -2
- package/dist/Dialog/DialogFooter.js +7 -21
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +1 -1
- package/dist/EmptyStateLayout/story-assets/Illo.js +2 -70
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +4 -5
- package/dist/ModalLayout/ModalContext.cjs +1 -1
- package/dist/ModalLayout/ModalContext.js +2 -1
- package/dist/ModalLayout/ModalFooter.cjs +2 -6
- package/dist/ModalLayout/ModalFooter.js +9 -26
- package/dist/ModalLayout/ModalHeader.cjs +2 -2
- package/dist/ModalLayout/ModalHeader.js +10 -22
- package/dist/ModalLayout/ModalLayout.cjs +3 -5
- package/dist/ModalLayout/ModalLayout.js +10 -30
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +68 -168
- package/dist/Pagination/Pagination.cjs +1 -5
- package/dist/Pagination/Pagination.js +7 -21
- package/dist/Pagination/components.cjs +7 -10
- package/dist/Pagination/components.js +34 -81
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +93 -48
- package/dist/ProgressBar/ProgressBar.cjs +5 -5
- package/dist/ProgressBar/ProgressBar.js +6 -37
- package/dist/Radio/Radio.cjs +1 -4
- package/dist/Radio/Radio.js +5 -18
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +2 -3
- package/dist/Searchbar/Searchbar.cjs +10 -11
- package/dist/Searchbar/Searchbar.js +25 -54
- package/dist/Status/Status.cjs +6 -6
- package/dist/Status/Status.js +8 -46
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +16 -52
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +13 -37
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +11 -22
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +55 -110
- package/dist/Tabs/TabsContext.cjs +1 -1
- package/dist/Tabs/TabsContext.js +11 -4
- package/dist/Textarea/Textarea.cjs +14 -12
- package/dist/Textarea/Textarea.js +33 -55
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +25 -121
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +17 -70
- package/dist/Typography/Typography.cjs +1 -1
- package/dist/Typography/Typography.js +6 -6
- package/dist/hooks/useControllableState.cjs +1 -1
- package/dist/hooks/useControllableState.js +6 -6
- package/dist/themes/utils.cjs +2 -2
- package/dist/themes/utils.js +1 -1
- package/package.json +8 -5
- package/dist/Tabs/useTabsFocus.cjs +0 -1
- package/dist/Tabs/useTabsFocus.js +0 -17
- package/dist/Textarea/TextareaInput.cjs +0 -30
- package/dist/Textarea/TextareaInput.js +0 -65
|
@@ -1,179 +1,79 @@
|
|
|
1
|
-
import { jsx as n, jsxs as h, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { NumberParser as
|
|
1
|
+
import { jsx as n, jsxs as h, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import _, { useRef as b } from "react";
|
|
3
|
+
import { NumberParser as j, NumberFormatter as E } from "@internationalized/number";
|
|
4
4
|
import { CarretDown as N } from "@strapi/icons";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { FieldLabel as X } from "../Field/FieldLabel.js";
|
|
15
|
-
import { FieldInput as Y } from "../Field/FieldInput.js";
|
|
5
|
+
import M from "styled-components";
|
|
6
|
+
import { getDefaultLocale as q } from "../helpers/getDefaultLocale.js";
|
|
7
|
+
import { KeyboardKeys as g } from "../helpers/keyboardKeys.js";
|
|
8
|
+
import { useControllableState as z } from "../hooks/useControllableState.js";
|
|
9
|
+
import { useId as H } from "../hooks/useId.js";
|
|
10
|
+
import { Field as O } from "../Field/Field.js";
|
|
11
|
+
import { Flex as T } from "../Flex/Flex.js";
|
|
12
|
+
import { FieldLabel as W } from "../Field/FieldLabel.js";
|
|
13
|
+
import { FieldInput as X } from "../Field/FieldInput.js";
|
|
16
14
|
import { Icon as w } from "../Icon/Icon.js";
|
|
17
|
-
import { FieldHint as
|
|
18
|
-
import { FieldError as
|
|
19
|
-
const x =
|
|
15
|
+
import { FieldHint as Y } from "../Field/FieldHint.js";
|
|
16
|
+
import { FieldError as G } from "../Field/FieldError.js";
|
|
17
|
+
const x = M.button`
|
|
20
18
|
display: flex;
|
|
21
19
|
height: 1rem;
|
|
22
|
-
align-items: ${({ reverse:
|
|
23
|
-
transform: translateY(${({ reverse:
|
|
24
|
-
cursor: ${({ disabled:
|
|
20
|
+
align-items: ${({ reverse: t }) => t ? "flex-end" : "flex-start"};
|
|
21
|
+
transform: translateY(${({ reverse: t }) => t ? "-2px" : "2px"});
|
|
22
|
+
cursor: ${({ disabled: t }) => t ? "not-allowed" : void 0};
|
|
25
23
|
svg {
|
|
26
24
|
display: block;
|
|
27
25
|
height: ${4 / 16}rem;
|
|
28
|
-
transform: ${({ reverse:
|
|
26
|
+
transform: ${({ reverse: t }) => t ? "rotateX(180deg)" : void 0};
|
|
29
27
|
}
|
|
30
|
-
`,
|
|
31
|
-
({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const e = s.current.parse(a), t = isNaN(e) ? i : e + i;
|
|
68
|
-
l(m.current.format(t));
|
|
69
|
-
}, g = () => {
|
|
70
|
-
if (!a) {
|
|
71
|
-
l(-i);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const e = s.current.parse(a), t = isNaN(e) ? -i : e - i;
|
|
75
|
-
l(m.current.format(t));
|
|
76
|
-
};
|
|
77
|
-
return /* @__PURE__ */ n(M, { name: A, hint: V, error: D, id: $, required: R, children: /* @__PURE__ */ h(W, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
78
|
-
c && /* @__PURE__ */ n(X, { action: F, children: c }),
|
|
79
|
-
/* @__PURE__ */ n(
|
|
80
|
-
Y,
|
|
81
|
-
{
|
|
82
|
-
ref: O,
|
|
83
|
-
startAction: I,
|
|
84
|
-
disabled: d,
|
|
85
|
-
type: "text",
|
|
86
|
-
inputmode: "decimal",
|
|
87
|
-
onChange: B,
|
|
88
|
-
onKeyDown: (e) => {
|
|
89
|
-
if (!d)
|
|
90
|
-
switch (e.key) {
|
|
91
|
-
case v.DOWN: {
|
|
92
|
-
e.preventDefault(), g();
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case v.UP: {
|
|
96
|
-
e.preventDefault(), b();
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
onBlur: () => {
|
|
102
|
-
if (a) {
|
|
103
|
-
const e = s.current.parse(a), t = isNaN(e) ? "" : m.current.format(e);
|
|
104
|
-
l(t);
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
value: a,
|
|
108
|
-
size: o,
|
|
109
|
-
endAction: /* @__PURE__ */ h(L, { children: [
|
|
110
|
-
/* @__PURE__ */ n(
|
|
111
|
-
x,
|
|
112
|
-
{
|
|
113
|
-
disabled: d,
|
|
114
|
-
"aria-hidden": !0,
|
|
115
|
-
reverse: !0,
|
|
116
|
-
onClick: b,
|
|
117
|
-
tabIndex: -1,
|
|
118
|
-
type: "button",
|
|
119
|
-
"data-testid": "ArrowUp",
|
|
120
|
-
children: /* @__PURE__ */ n(w, { as: N, color: "neutral500" })
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ n(
|
|
124
|
-
x,
|
|
125
|
-
{
|
|
126
|
-
disabled: d,
|
|
127
|
-
"aria-hidden": !0,
|
|
128
|
-
onClick: g,
|
|
129
|
-
tabIndex: -1,
|
|
130
|
-
type: "button",
|
|
131
|
-
"data-testid": "ArrowDown",
|
|
132
|
-
children: /* @__PURE__ */ n(w, { as: N, color: "neutral500" })
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
] }),
|
|
136
|
-
...K
|
|
28
|
+
`, J = "", pr = _.forwardRef(({ size: t = "M", startAction: y, name: I, hint: F, error: V, label: c, labelAction: D, locale: A, id: C, onValueChange: k, value: d, step: a = 1, required: P = !1, disabled: m = !1, ...R }, $) => {
|
|
29
|
+
const K = H(C), u = A || q(), s = b(new j(u, { style: "decimal" })), l = b(new E(u, { maximumFractionDigits: 20 })), [o, L] = z({
|
|
30
|
+
prop(r) {
|
|
31
|
+
const e = String(d);
|
|
32
|
+
return isNaN(Number(e)) || e !== r && r !== "" ? r : l.current.format(Number(d));
|
|
33
|
+
},
|
|
34
|
+
defaultProp: J,
|
|
35
|
+
onChange(r) {
|
|
36
|
+
const e = s.current.parse(r ?? "");
|
|
37
|
+
k(isNaN(e) ? void 0 : e);
|
|
38
|
+
}
|
|
39
|
+
}), i = (r) => {
|
|
40
|
+
L(String(r));
|
|
41
|
+
}, S = ({ target: { value: r } }) => {
|
|
42
|
+
s.current.isValidPartialNumber(r) && i(r);
|
|
43
|
+
}, f = () => {
|
|
44
|
+
if (!o) {
|
|
45
|
+
i(a);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const r = s.current.parse(o), e = isNaN(r) ? a : r + a;
|
|
49
|
+
i(l.current.format(e));
|
|
50
|
+
}, p = () => {
|
|
51
|
+
if (!o) {
|
|
52
|
+
i(-a);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const r = s.current.parse(o), e = isNaN(r) ? -a : r - a;
|
|
56
|
+
i(l.current.format(e));
|
|
57
|
+
}, v = (r) => {
|
|
58
|
+
if (!m)
|
|
59
|
+
switch (r.key) {
|
|
60
|
+
case g.DOWN: {
|
|
61
|
+
r.preventDefault(), p();
|
|
62
|
+
break;
|
|
137
63
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
hint:
|
|
150
|
-
|
|
151
|
-
label: void 0,
|
|
152
|
-
labelAction: void 0,
|
|
153
|
-
locale: void 0,
|
|
154
|
-
required: !1,
|
|
155
|
-
size: "M",
|
|
156
|
-
startAction: void 0,
|
|
157
|
-
step: 1,
|
|
158
|
-
value: void 0
|
|
159
|
-
};
|
|
160
|
-
u.propTypes = {
|
|
161
|
-
"aria-label": r.string,
|
|
162
|
-
disabled: r.bool,
|
|
163
|
-
error: r.string,
|
|
164
|
-
hint: r.oneOfType([r.string, r.node, r.arrayOf(r.node)]),
|
|
165
|
-
id: r.string,
|
|
166
|
-
label: r.string,
|
|
167
|
-
labelAction: r.element,
|
|
168
|
-
locale: r.string,
|
|
169
|
-
name: r.string.isRequired,
|
|
170
|
-
onValueChange: r.func.isRequired,
|
|
171
|
-
required: r.bool,
|
|
172
|
-
size: r.oneOf(Object.keys(H.input)),
|
|
173
|
-
startAction: r.element,
|
|
174
|
-
step: r.number,
|
|
175
|
-
value: r.number
|
|
176
|
-
};
|
|
64
|
+
case g.UP: {
|
|
65
|
+
r.preventDefault(), f();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, B = () => {
|
|
70
|
+
if (o) {
|
|
71
|
+
const r = s.current.parse(o), e = isNaN(r) ? "" : l.current.format(r);
|
|
72
|
+
i(e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return n(O, { name: I, hint: F, error: V, id: K, required: P, children: h(T, { direction: "column", alignItems: "stretch", gap: 1, children: [c && n(W, { action: D, children: c }), n(X, { ref: $, startAction: y, disabled: m, type: "text", inputMode: "decimal", onChange: S, onKeyDown: v, onBlur: B, value: o, size: t, endAction: h(U, { children: [n(x, { disabled: m, "aria-hidden": !0, reverse: !0, onClick: f, tabIndex: -1, type: "button", "data-testid": "ArrowUp", children: n(w, { as: N, color: "neutral500" }) }), n(x, { disabled: m, "aria-hidden": !0, onClick: p, tabIndex: -1, type: "button", "data-testid": "ArrowDown", children: n(w, { as: N, color: "neutral500" }) })] }), ...R }), n(Y, {}), n(G, {})] }) });
|
|
76
|
+
});
|
|
177
77
|
export {
|
|
178
|
-
|
|
78
|
+
pr as NumberInput
|
|
179
79
|
};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
& > * + * {
|
|
3
|
-
margin-left: ${({theme:e})=>e.spaces[1]};
|
|
4
|
-
}
|
|
5
|
-
`,o=({children:e,label:n,activePage:t,pageCount:r})=>{const c=l.useMemo(()=>({activePage:t,pageCount:r}),[t,r]);return i.jsx(P.PaginationContext.Provider,{value:c,children:i.jsx(j,{"aria-label":n,children:i.jsx(x,{as:"ul",children:l.Children.map(e,(d,f)=>i.jsx("li",{children:d},f))})})})};o.defaultProps={label:"pagination"};o.propTypes={activePage:a.default.number.isRequired,children:a.default.node.isRequired,label:a.default.string,pageCount:a.default.number.isRequired};exports.Pagination=o;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("react"),u=require("./PaginationContext.cjs"),d=require("../Box/Box.cjs"),x=require("../Flex/Flex.cjs");function g(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const i=g(l),f=({children:e,label:n="Pagination",activePage:t,pageCount:r})=>{const a=i.useMemo(()=>({activePage:t,pageCount:r}),[t,r]);return o.jsx(u.PaginationContext.Provider,{value:a,children:o.jsx(d.Box,{"aria-label":n,as:"nav",children:o.jsx(x.Flex,{as:"ol",gap:1,children:i.Children.map(e,(c,s)=>o.jsx("li",{children:c},s))})})})};exports.Pagination=f;
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import e from "prop-types";
|
|
4
|
-
import a from "styled-components";
|
|
2
|
+
import * as n from "react";
|
|
5
3
|
import { PaginationContext as c } from "./PaginationContext.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
`, l = ({ children: i, label: s, activePage: n, pageCount: o }) => {
|
|
12
|
-
const p = t.useMemo(() => ({ activePage: n, pageCount: o }), [n, o]);
|
|
13
|
-
return /* @__PURE__ */ r(c.Provider, { value: p, children: /* @__PURE__ */ r(f, { "aria-label": s, children: /* @__PURE__ */ r(g, { as: "ul", children: t.Children.map(i, (m, d) => /* @__PURE__ */ r("li", { children: m }, d)) }) }) });
|
|
14
|
-
};
|
|
15
|
-
l.defaultProps = {
|
|
16
|
-
label: "pagination"
|
|
17
|
-
};
|
|
18
|
-
l.propTypes = {
|
|
19
|
-
activePage: e.number.isRequired,
|
|
20
|
-
children: e.node.isRequired,
|
|
21
|
-
label: e.string,
|
|
22
|
-
pageCount: e.number.isRequired
|
|
4
|
+
import { Box as p } from "../Box/Box.js";
|
|
5
|
+
import { Flex as s } from "../Flex/Flex.js";
|
|
6
|
+
const u = ({ children: t, label: a = "Pagination", activePage: o, pageCount: i }) => {
|
|
7
|
+
const e = n.useMemo(() => ({ activePage: o, pageCount: i }), [o, i]);
|
|
8
|
+
return r(c.Provider, { value: e, children: r(p, { "aria-label": a, as: "nav", children: r(s, { as: "ol", gap: 1, children: n.Children.map(t, (m, l) => r("li", { children: m }, l)) }) }) });
|
|
23
9
|
};
|
|
24
10
|
export {
|
|
25
|
-
|
|
11
|
+
u as Pagination
|
|
26
12
|
};
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
line-height: revert;
|
|
3
|
-
`,T={active:!0},c=n.default(j.NavLink).withConfig({shouldForwardProp:(e,i)=>!T[e]&&i(e)})`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("@strapi/icons"),v=require("react-router-dom"),y=require("styled-components"),d=require("./PaginationContext.cjs"),b=require("../themes/utils.cjs"),o=require("../VisuallyHidden/VisuallyHidden.cjs"),c=require("../Typography/Typography.cjs"),P=require("../Box/Box.cjs"),j=e=>e&&e.__esModule?e:{default:e},l=j(y),k={active:!0},h=l.default(v.NavLink).withConfig({shouldForwardProp:(e,i)=>!k[e]&&i(e)})`
|
|
4
2
|
padding: ${({theme:e})=>e.spaces[3]};
|
|
5
3
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
6
4
|
box-shadow: ${({active:e,theme:i})=>e?i.shadows.filterShadow:void 0};
|
|
7
5
|
text-decoration: none;
|
|
8
6
|
display: flex;
|
|
9
7
|
|
|
10
|
-
${
|
|
11
|
-
|
|
8
|
+
${b.buttonFocusStyle}
|
|
9
|
+
`,L=l.default(h)`
|
|
12
10
|
color: ${({theme:e,active:i})=>i?e.colors.primary700:e.colors.neutral800};
|
|
13
11
|
background: ${({theme:e,active:i})=>i?e.colors.neutral0:void 0};
|
|
14
12
|
|
|
15
13
|
&:hover {
|
|
16
14
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
17
15
|
}
|
|
18
|
-
`,
|
|
19
|
-
font-size:
|
|
16
|
+
`,g=l.default(h)`
|
|
17
|
+
font-size: ${11/16}rem;
|
|
18
|
+
|
|
20
19
|
svg path {
|
|
21
20
|
fill: ${e=>e["aria-disabled"]?e.theme.colors.neutral300:e.theme.colors.neutral600};
|
|
22
21
|
}
|
|
@@ -31,6 +30,4 @@
|
|
|
31
30
|
${e=>e["aria-disabled"]?`
|
|
32
31
|
pointer-events: none;
|
|
33
32
|
`:void 0}
|
|
34
|
-
`,
|
|
35
|
-
color: ${({theme:e})=>e.colors.neutral800};
|
|
36
|
-
`,p=({children:e,to:i,...o})=>{const{activePage:s}=u.usePagination(),t=s===1;return r.jsxs(x,{to:t?"#":i,"aria-disabled":t,tabIndex:t?-1:void 0,...o,children:[r.jsx(d.VisuallyHidden,{children:e}),r.jsx(g.ChevronLeft,{"aria-hidden":!0})]})};p.displayName="PreviousLink";const h=({children:e,to:i,...o})=>{const{activePage:s,pageCount:t}=u.usePagination(),l=s===t;return r.jsxs(x,{to:l?"#":i,"aria-disabled":l,tabIndex:l?-1:void 0,...o,children:[r.jsx(d.VisuallyHidden,{children:e}),r.jsx(g.ChevronRight,{"aria-hidden":!0})]})};h.displayName="NextLink";const v=({number:e,children:i,...o})=>{const{activePage:s}=u.usePagination(),t=s===e;return r.jsxs($,{...o,active:t,children:[r.jsx(d.VisuallyHidden,{children:i}),r.jsx(f,{"aria-hidden":!0,variant:"pi",fontWeight:t?"bold":null,children:e})]})};v.displayName="PageLink";const P=({children:e,...i})=>r.jsxs(R,{...i,as:"div",children:[r.jsx(d.VisuallyHidden,{children:e}),r.jsx(f,{"aria-hidden":!0,variant:"pi",children:"…"})]});v.propTypes={children:a.default.node.isRequired,number:a.default.number.isRequired};const b={children:a.default.node.isRequired,to:a.default.string.isRequired};h.propTypes=b;p.propTypes=b;P.propTypes={children:a.default.node.isRequired};exports.Dots=P;exports.NextLink=h;exports.PageLink=v;exports.PreviousLink=p;
|
|
33
|
+
`,x=({children:e,to:i,...r})=>{const{activePage:a}=d.usePagination(),t=a===1;return n.jsxs(g,{to:t?"#":i,"aria-disabled":t,tabIndex:t?-1:void 0,...r,children:[n.jsx(o.VisuallyHidden,{children:e}),n.jsx(u.ChevronLeft,{"aria-hidden":!0})]})};x.displayName="PreviousLink";const f=({children:e,to:i,...r})=>{const{activePage:a,pageCount:t}=d.usePagination(),s=a===t;return n.jsxs(g,{to:s?"#":i,"aria-disabled":s,tabIndex:s?-1:void 0,...r,children:[n.jsx(o.VisuallyHidden,{children:e}),n.jsx(u.ChevronRight,{"aria-hidden":!0})]})};f.displayName="NextLink";const p=({number:e,children:i,...r})=>{const{activePage:a}=d.usePagination(),t=a===e;return n.jsxs(L,{...r,active:t,children:[n.jsx(o.VisuallyHidden,{children:i}),n.jsx(c.Typography,{"aria-hidden":!0,fontWeight:t?"bold":void 0,lineHeight:"revert",variant:"pi",children:e})]})};p.displayName="PageLink";const $=({children:e,...i})=>n.jsxs(P.Box,{...i,children:[n.jsx(o.VisuallyHidden,{children:e}),n.jsx(c.Typography,{"aria-hidden":!0,lineHeight:"revert",textColor:"neutral800",variant:"pi",children:"…"})]});exports.Dots=$;exports.NextLink=f;exports.PageLink=p;exports.PreviousLink=x;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const u = s(L)`
|
|
12
|
-
line-height: revert;
|
|
13
|
-
`, $ = {
|
|
1
|
+
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as f, ChevronRight as m } from "@strapi/icons";
|
|
3
|
+
import { NavLink as v } from "react-router-dom";
|
|
4
|
+
import l from "styled-components";
|
|
5
|
+
import { usePagination as c } from "./PaginationContext.js";
|
|
6
|
+
import { buttonFocusStyle as g } from "../themes/utils.js";
|
|
7
|
+
import { VisuallyHidden as d } from "../VisuallyHidden/VisuallyHidden.js";
|
|
8
|
+
import { Typography as h } from "../Typography/Typography.js";
|
|
9
|
+
import { Box as b } from "../Box/Box.js";
|
|
10
|
+
const x = {
|
|
14
11
|
active: !0
|
|
15
|
-
},
|
|
16
|
-
shouldForwardProp: (e, r) =>
|
|
12
|
+
}, u = l(v).withConfig({
|
|
13
|
+
shouldForwardProp: (e, r) => !x[e] && r(e)
|
|
17
14
|
})`
|
|
18
15
|
padding: ${({ theme: e }) => e.spaces[3]};
|
|
19
16
|
border-radius: ${({ theme: e }) => e.borderRadius};
|
|
@@ -21,16 +18,17 @@ const u = s(L)`
|
|
|
21
18
|
text-decoration: none;
|
|
22
19
|
display: flex;
|
|
23
20
|
|
|
24
|
-
${
|
|
25
|
-
`,
|
|
21
|
+
${g}
|
|
22
|
+
`, k = l(u)`
|
|
26
23
|
color: ${({ theme: e, active: r }) => r ? e.colors.primary700 : e.colors.neutral800};
|
|
27
24
|
background: ${({ theme: e, active: r }) => r ? e.colors.neutral0 : void 0};
|
|
28
25
|
|
|
29
26
|
&:hover {
|
|
30
27
|
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
31
28
|
}
|
|
32
|
-
`,
|
|
33
|
-
font-size:
|
|
29
|
+
`, p = l(u)`
|
|
30
|
+
font-size: ${11 / 16}rem;
|
|
31
|
+
|
|
34
32
|
svg path {
|
|
35
33
|
fill: ${(e) => e["aria-disabled"] ? e.theme.colors.neutral300 : e.theme.colors.neutral600};
|
|
36
34
|
}
|
|
@@ -45,70 +43,25 @@ const u = s(L)`
|
|
|
45
43
|
${(e) => e["aria-disabled"] ? `
|
|
46
44
|
pointer-events: none;
|
|
47
45
|
` : void 0}
|
|
48
|
-
`,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const { activePage: a } = p(), o = a === 1;
|
|
52
|
-
return /* @__PURE__ */ d(
|
|
53
|
-
m,
|
|
54
|
-
{
|
|
55
|
-
to: o ? "#" : r,
|
|
56
|
-
"aria-disabled": o,
|
|
57
|
-
tabIndex: o ? -1 : void 0,
|
|
58
|
-
...t,
|
|
59
|
-
children: [
|
|
60
|
-
/* @__PURE__ */ i(l, { children: e }),
|
|
61
|
-
/* @__PURE__ */ i(y, { "aria-hidden": !0 })
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
v.displayName = "PreviousLink";
|
|
67
|
-
const f = ({ children: e, to: r, ...t }) => {
|
|
68
|
-
const { activePage: a, pageCount: o } = p(), c = a === o;
|
|
69
|
-
return /* @__PURE__ */ d(
|
|
70
|
-
m,
|
|
71
|
-
{
|
|
72
|
-
to: c ? "#" : r,
|
|
73
|
-
"aria-disabled": c,
|
|
74
|
-
tabIndex: c ? -1 : void 0,
|
|
75
|
-
...t,
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ i(l, { children: e }),
|
|
78
|
-
/* @__PURE__ */ i(P, { "aria-hidden": !0 })
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
f.displayName = "NextLink";
|
|
84
|
-
const g = ({ number: e, children: r, ...t }) => {
|
|
85
|
-
const { activePage: a } = p(), o = a === e;
|
|
86
|
-
return /* @__PURE__ */ d(w, { ...t, active: o, children: [
|
|
87
|
-
/* @__PURE__ */ i(l, { children: r }),
|
|
88
|
-
/* @__PURE__ */ i(u, { "aria-hidden": !0, variant: "pi", fontWeight: o ? "bold" : null, children: e })
|
|
89
|
-
] });
|
|
90
|
-
};
|
|
91
|
-
g.displayName = "PageLink";
|
|
92
|
-
const R = ({ children: e, ...r }) => /* @__PURE__ */ d(T, { ...r, as: "div", children: [
|
|
93
|
-
/* @__PURE__ */ i(l, { children: e }),
|
|
94
|
-
/* @__PURE__ */ i(u, { "aria-hidden": !0, variant: "pi", children: "…" })
|
|
95
|
-
] });
|
|
96
|
-
g.propTypes = {
|
|
97
|
-
children: n.node.isRequired,
|
|
98
|
-
number: n.number.isRequired
|
|
46
|
+
`, L = ({ children: e, to: r, ...n }) => {
|
|
47
|
+
const { activePage: t } = c(), i = t === 1;
|
|
48
|
+
return a(p, { to: i ? "#" : r, "aria-disabled": i, tabIndex: i ? -1 : void 0, ...n, children: [o(d, { children: e }), o(f, { "aria-hidden": !0 })] });
|
|
99
49
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
L.displayName = "PreviousLink";
|
|
51
|
+
const P = ({ children: e, to: r, ...n }) => {
|
|
52
|
+
const { activePage: t, pageCount: i } = c(), s = t === i;
|
|
53
|
+
return a(p, { to: s ? "#" : r, "aria-disabled": s, tabIndex: s ? -1 : void 0, ...n, children: [o(d, { children: e }), o(m, { "aria-hidden": !0 })] });
|
|
103
54
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
children:
|
|
55
|
+
P.displayName = "NextLink";
|
|
56
|
+
const $ = ({ number: e, children: r, ...n }) => {
|
|
57
|
+
const { activePage: t } = c(), i = t === e;
|
|
58
|
+
return a(k, { ...n, active: i, children: [o(d, { children: r }), o(h, { "aria-hidden": !0, fontWeight: i ? "bold" : void 0, lineHeight: "revert", variant: "pi", children: e })] });
|
|
108
59
|
};
|
|
60
|
+
$.displayName = "PageLink";
|
|
61
|
+
const F = ({ children: e, ...r }) => a(b, { ...r, children: [o(d, { children: e }), o(h, { "aria-hidden": !0, lineHeight: "revert", textColor: "neutral800", variant: "pi", children: "…" })] });
|
|
109
62
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
63
|
+
F as Dots,
|
|
64
|
+
P as NextLink,
|
|
65
|
+
$ as PageLink,
|
|
66
|
+
L as PreviousLink
|
|
114
67
|
};
|
package/dist/Popover/Popover.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),F=require("react"),u=require("@floating-ui/react-dom"),M=require("@radix-ui/react-focus-scope"),m=require("@strapi/ui-primitives"),z=require("aria-hidden"),T=require("react-remove-scroll"),W=require("styled-components"),A=require("../DismissibleLayer/index.cjs"),P=require("../helpers/strings.cjs"),B=require("../hooks/useComposeRefs.cjs"),H=require("../hooks/useId.cjs"),K=require("../hooks/useIntersection.cjs"),g=require("../Box/Box.cjs"),N=require("../Portal/Portal.cjs"),U=e=>e&&e.__esModule?e:{default:e};function V(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=V(F),E=U(W),Z=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],G=E.default(g.Box)`
|
|
2
2
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
3
3
|
z-index: ${({theme:e})=>e.zIndices[0]};
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
5
5
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
6
|
-
`,
|
|
6
|
+
`,R=({source:e,children:r,spacing:t=0,fullWidth:n=!1,placement:c="bottom-start",centered:l=!1,onEscapeKeyDown:d,onPointerDownOutside:f,onDismiss:a,onFocusOutside:p,...O})=>{const[h,k]=i.useState(null),v=i.useRef(!1),[S,j]=i.useState(void 0),{x:q,y:C,reference:w,floating:D,strategy:_}=u.useFloating({strategy:"fixed",placement:l?"bottom":c,middleware:[u.offset({mainAxis:t}),u.shift(),u.flip()],whileElementsMounted:u.autoUpdate});i.useLayoutEffect(()=>{w(e.current)},[e,w]),i.useLayoutEffect(()=>{n&&j(e.current.offsetWidth)},[n,e]),i.useEffect(()=>{if(h)return z.hideOthers(h)},[h]);const x=m.useCallbackRef(a);i.useEffect(()=>{const o=()=>{x()};return window.addEventListener("blur",o),window.addEventListener("resize",o),()=>{window.removeEventListener("blur",o),window.removeEventListener("resize",o)}},[x]);const L=B.useComposedRefs(o=>k(o),D);return s.jsx(T.RemoveScroll,{allowPinchZoom:!0,children:s.jsx(M.FocusScope,{asChild:!0,loop:!0,trapped:!0,onUnmountAutoFocus:o=>{o.preventDefault(),v.current||e.current?.focus({preventScroll:!0})},children:s.jsx(A.DismissibleLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m.composeEventHandlers(f,o=>{const b=o.detail.originalEvent,$=b.button===0&&b.ctrlKey===!0,I=b.button===2||$;v.current=I},{checkForDefaultPrevented:!1}),onFocusOutside:m.composeEventHandlers(p,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:a,children:s.jsx(G,{ref:L,style:{left:q,top:C,position:_,width:S||void 0},hasRadius:!0,background:"neutral0",padding:1,...O,children:r})})})})},y=({children:e,intersectionId:r,onReachEnd:t,...n})=>{const c=i.useRef(null),l=H.useId();return K.useIntersection(c,t??(()=>{}),{selectorToWatch:`#${P.stripReactIdOfColon(l)}`,skipWhen:!r||!t}),s.jsxs(J,{ref:c,...n,children:[e,r&&t&&s.jsx(g.Box,{id:P.stripReactIdOfColon(l),width:"100%",height:"1px"})]})},J=E.default(g.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
|
+
`,Q=({children:e,source:r,spacing:t,fullWidth:n,placement:c,centered:l,onEscapeKeyDown:d,onPointerDownOutside:f,onDismiss:a,...p})=>s.jsx(N.Portal,{children:s.jsx(R,{source:r,spacing:t,fullWidth:n,placement:c,centered:l,onEscapeKeyDown:d,onPointerDownOutside:f,onDismiss:a,children:s.jsx(y,{...p,children:e})})});exports.Content=R;exports.POPOVER_PLACEMENTS=Z;exports.Popover=Q;exports.Scrolling=y;
|