@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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),W=require("react"),U=require("@radix-ui/react-select"),w=require("@strapi/icons"),Y=require("styled-components"),G=require("../Field/Field.cjs"),J=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const Q=require("../Field/FieldHint.cjs"),X=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const Z=require("../Stack/Stack.cjs"),g=require("../Box/Box.cjs"),q=require("../Flex/Flex.cjs"),j=require("../Typography/Typography.cjs"),ee=require("../helpers/useId.cjs"),te=require("../hooks/useIntersection.cjs"),I=require("../themes/utils.cjs"),re=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function v(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const h=v(W),o=v(U),c=re(Y),ne=[" ","Enter","ArrowUp","ArrowDown"],oe=({children:e,clearLabel:n="Clear",customizeContent:s=p=>p.toString(),disabled:i,error:b,hint:k,id:R,label:T,labelAction:O,onChange:$,onClear:a,onReachEnd:m,placeholder:_,required:y,selectButtonTitle:he,startIcon:S,size:B="M",value:f})=>{const p=h.useRef(null),x=h.useRef(null),d=h.useRef(null),[D,C]=h.useState(""),[E,P]=h.useState(!1),u=ee.useId(R),V=`${u}-hint`,M=`${u}-error`,N=r=>{$?$(typeof f=="number"?Number(r):r):C(r)},z=r=>{a&&!i&&(a(r),x.current.focus())},A=r=>{P(r)},H=r=>{d.current&&d.current===r.target.closest("div")&&r.preventDefault()},K=r=>{ne.includes(r.key)&&d.current&&d.current===r.target.closest("div")&&!i&&a&&(r.preventDefault(),a(r),x.current.focus())},F=`intersection-${u}`,L=r=>{m&&m(r)};te.useIntersection(p,L,{selectorToWatch:`#${F}`,skipWhen:!E});const l=typeof f<"u"?f.toString():D;return t.jsx(G.Field,{hint:k,error:b,id:u,required:y,children:t.jsxs(Z.Stack,{spacing:1,children:[t.jsx(J.FieldLabel,{action:O,children:T}),t.jsxs(o.Root,{onOpenChange:A,disabled:i,required:y,onValueChange:N,value:l,children:[t.jsxs(ie,{id:u,"aria-labelledby":`${V} ${M}`,"aria-disabled":i,$hasError:Boolean(b),$size:B,onPointerDown:H,onKeyDown:K,ref:x,children:[t.jsxs(q.Flex,{as:"span",gap:4,children:[S&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:S}),t.jsx(j.Typography,{ellipsis:!0,textColor:l?"neutral800":"neutral600",children:t.jsx(o.Value,{"aria-label":l,children:l?s(l):_})})]}),t.jsxs(q.Flex,{as:"span",gap:3,children:[l&&a?t.jsx(se,{hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:z,"aria-disabled":i,"aria-label":n,title:n,ref:d,children:t.jsx(w.Cross,{})}):null,t.jsx(le,{children:t.jsx(w.CarretDown,{})})]})]}),t.jsx(o.Portal,{children:t.jsx(ce,{position:"popper",sideOffset:4,children:t.jsxs(ae,{ref:p,children:[e,t.jsx(g.Box,{id:F,width:"100%",height:"1px"})]})})})]}),t.jsx(Q.FieldHint,{}),t.jsx(X.FieldError,{})]})})},se=c.default(g.Box)`
|
|
2
|
+
border: none;
|
|
3
|
+
|
|
4
|
+
svg {
|
|
5
|
+
height: ${11/16}rem;
|
|
6
|
+
width: ${11/16}rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
svg path {
|
|
10
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
11
|
+
}
|
|
12
|
+
`,ie=c.default(o.Trigger)`
|
|
13
|
+
position: relative;
|
|
14
|
+
border: 1px solid ${({theme:e,$hasError:n})=>n?e.colors.danger600:e.colors.neutral200};
|
|
15
|
+
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
16
|
+
padding-left: ${({theme:e})=>e.spaces[3]};
|
|
17
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
18
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
min-height: ${({theme:e,$size:n})=>I.getThemeSize("input")({theme:e,size:n})};
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
gap: ${({theme:e})=>e.spaces[4]};
|
|
25
|
+
|
|
26
|
+
&[aria-disabled='true'] {
|
|
27
|
+
color: ${e=>e.theme.colors.neutral600};
|
|
28
|
+
background: ${e=>e.theme.colors.neutral150};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${({theme:e,$hasError:n})=>I.inputFocusStyle()({theme:e,hasError:n})};
|
|
37
|
+
`,le=c.default(o.Icon)`
|
|
38
|
+
& > svg {
|
|
39
|
+
width: ${6/16}rem;
|
|
40
|
+
|
|
41
|
+
& > path {
|
|
42
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`,ce=c.default(o.Content)`
|
|
46
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
47
|
+
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
48
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
49
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
50
|
+
width: var(--radix-select-trigger-width);
|
|
51
|
+
/* This is from the design-system figma file. */
|
|
52
|
+
max-height: 15rem;
|
|
53
|
+
`,ae=c.default(o.Viewport)`
|
|
54
|
+
padding: ${({theme:e})=>e.spaces[1]};
|
|
55
|
+
`,de=({children:e,startIcon:n,value:s})=>t.jsxs(ue,{textValue:e.toString(),value:s.toString(),children:[n&&t.jsx(g.Box,{as:"span",paddingRight:2,"aria-hidden":!0,children:n}),t.jsx(j.Typography,{textColor:"neutral800",children:t.jsx(o.ItemText,{children:e})})]}),ue=c.default(o.Item)`
|
|
56
|
+
width: 100%;
|
|
57
|
+
border: none;
|
|
58
|
+
text-align: left;
|
|
59
|
+
outline-offset: -3px;
|
|
60
|
+
border-radius: ${e=>e.theme.borderRadius};
|
|
61
|
+
padding: ${e=>`${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
62
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
63
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
|
|
67
|
+
&:focus-visible {
|
|
68
|
+
outline: none;
|
|
69
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[data-state='checked'] {
|
|
77
|
+
${j.Typography} {
|
|
78
|
+
font-weight: bold;
|
|
79
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;exports.SingleSelect=oe;exports.SingleSelectOption=de;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import * as n from "@radix-ui/react-select";
|
|
4
|
+
import { Cross as H, CarretDown as M } from "@strapi/icons";
|
|
5
|
+
import s from "styled-components";
|
|
6
|
+
import { Field as U } from "../Field/Field.js";
|
|
7
|
+
import { FieldLabel as Y } from "../Field/FieldLabel.js";
|
|
8
|
+
import "../Field/FieldInput.js";
|
|
9
|
+
import { FieldHint as _ } from "../Field/FieldHint.js";
|
|
10
|
+
import { FieldError as G } from "../Field/FieldError.js";
|
|
11
|
+
import "../Field/FieldContext.js";
|
|
12
|
+
import "../Field/FieldAction.js";
|
|
13
|
+
import { Stack as J } from "../Stack/Stack.js";
|
|
14
|
+
import { Box as m } from "../Box/Box.js";
|
|
15
|
+
import { Flex as I } from "../Flex/Flex.js";
|
|
16
|
+
import { Typography as b } from "../Typography/Typography.js";
|
|
17
|
+
import { useId as L } from "../helpers/useId.js";
|
|
18
|
+
import { useIntersection as Q } from "../hooks/useIntersection.js";
|
|
19
|
+
import { getThemeSize as X, inputFocusStyle as Z } from "../themes/utils.js";
|
|
20
|
+
const ee = [" ", "Enter", "ArrowUp", "ArrowDown"], Te = ({
|
|
21
|
+
children: e,
|
|
22
|
+
clearLabel: o = "Clear",
|
|
23
|
+
customizeContent: g = (p) => p.toString(),
|
|
24
|
+
disabled: a,
|
|
25
|
+
error: w,
|
|
26
|
+
hint: k,
|
|
27
|
+
id: T,
|
|
28
|
+
label: C,
|
|
29
|
+
labelAction: D,
|
|
30
|
+
onChange: x,
|
|
31
|
+
onClear: c,
|
|
32
|
+
onReachEnd: y,
|
|
33
|
+
placeholder: E,
|
|
34
|
+
required: S,
|
|
35
|
+
selectButtonTitle: se,
|
|
36
|
+
startIcon: v,
|
|
37
|
+
size: F = "M",
|
|
38
|
+
value: f
|
|
39
|
+
}) => {
|
|
40
|
+
const p = h.useRef(null), $ = h.useRef(null), d = h.useRef(null), [O, B] = h.useState(""), [V, N] = h.useState(!1), u = L(T), P = `${u}-hint`, j = `${u}-error`, z = (r) => {
|
|
41
|
+
x ? x(typeof f == "number" ? Number(r) : r) : B(r);
|
|
42
|
+
}, K = (r) => {
|
|
43
|
+
c && !a && (c(r), $.current.focus());
|
|
44
|
+
}, q = (r) => {
|
|
45
|
+
N(r);
|
|
46
|
+
}, A = (r) => {
|
|
47
|
+
d.current && d.current === r.target.closest("div") && r.preventDefault();
|
|
48
|
+
}, W = (r) => {
|
|
49
|
+
ee.includes(r.key) && d.current && d.current === r.target.closest("div") && !a && c && (r.preventDefault(), c(r), $.current.focus());
|
|
50
|
+
}, R = `intersection-${u}`;
|
|
51
|
+
Q(p, (r) => {
|
|
52
|
+
y && y(r);
|
|
53
|
+
}, {
|
|
54
|
+
selectorToWatch: `#${R}`,
|
|
55
|
+
skipWhen: !V
|
|
56
|
+
});
|
|
57
|
+
const l = typeof f < "u" ? f.toString() : O;
|
|
58
|
+
return t(U, {
|
|
59
|
+
hint: k,
|
|
60
|
+
error: w,
|
|
61
|
+
id: u,
|
|
62
|
+
required: S,
|
|
63
|
+
children: i(J, {
|
|
64
|
+
spacing: 1,
|
|
65
|
+
children: [t(Y, {
|
|
66
|
+
action: D,
|
|
67
|
+
children: C
|
|
68
|
+
}), i(n.Root, {
|
|
69
|
+
onOpenChange: q,
|
|
70
|
+
disabled: a,
|
|
71
|
+
required: S,
|
|
72
|
+
onValueChange: z,
|
|
73
|
+
value: l,
|
|
74
|
+
children: [i(te, {
|
|
75
|
+
id: u,
|
|
76
|
+
"aria-labelledby": `${P} ${j}`,
|
|
77
|
+
"aria-disabled": a,
|
|
78
|
+
$hasError: Boolean(w),
|
|
79
|
+
$size: F,
|
|
80
|
+
onPointerDown: A,
|
|
81
|
+
onKeyDown: W,
|
|
82
|
+
ref: $,
|
|
83
|
+
children: [i(I, {
|
|
84
|
+
as: "span",
|
|
85
|
+
gap: 4,
|
|
86
|
+
children: [v && t(m, {
|
|
87
|
+
as: "span",
|
|
88
|
+
"aria-hidden": !0,
|
|
89
|
+
children: v
|
|
90
|
+
}), t(b, {
|
|
91
|
+
ellipsis: !0,
|
|
92
|
+
textColor: l ? "neutral800" : "neutral600",
|
|
93
|
+
children: t(n.Value, {
|
|
94
|
+
"aria-label": l,
|
|
95
|
+
children: l ? g(l) : E
|
|
96
|
+
})
|
|
97
|
+
})]
|
|
98
|
+
}), i(I, {
|
|
99
|
+
as: "span",
|
|
100
|
+
gap: 3,
|
|
101
|
+
children: [l && c ? t(re, {
|
|
102
|
+
hasRadius: !0,
|
|
103
|
+
background: "transparent",
|
|
104
|
+
role: "button",
|
|
105
|
+
tabIndex: 0,
|
|
106
|
+
onClick: K,
|
|
107
|
+
"aria-disabled": a,
|
|
108
|
+
"aria-label": o,
|
|
109
|
+
title: o,
|
|
110
|
+
ref: d,
|
|
111
|
+
children: t(H, {})
|
|
112
|
+
}) : null, t(oe, {
|
|
113
|
+
children: t(M, {})
|
|
114
|
+
})]
|
|
115
|
+
})]
|
|
116
|
+
}), t(n.Portal, {
|
|
117
|
+
children: t(ne, {
|
|
118
|
+
position: "popper",
|
|
119
|
+
sideOffset: 4,
|
|
120
|
+
children: i(ie, {
|
|
121
|
+
ref: p,
|
|
122
|
+
children: [e, t(m, {
|
|
123
|
+
id: R,
|
|
124
|
+
width: "100%",
|
|
125
|
+
height: "1px"
|
|
126
|
+
})]
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
})]
|
|
130
|
+
}), t(_, {}), t(G, {})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}, re = s(m)`
|
|
134
|
+
border: none;
|
|
135
|
+
|
|
136
|
+
svg {
|
|
137
|
+
height: ${11 / 16}rem;
|
|
138
|
+
width: ${11 / 16}rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
svg path {
|
|
142
|
+
fill: ${({
|
|
143
|
+
theme: e
|
|
144
|
+
}) => e.colors.neutral600};
|
|
145
|
+
}
|
|
146
|
+
`, te = s(n.Trigger)`
|
|
147
|
+
position: relative;
|
|
148
|
+
border: 1px solid ${({
|
|
149
|
+
theme: e,
|
|
150
|
+
$hasError: o
|
|
151
|
+
}) => o ? e.colors.danger600 : e.colors.neutral200};
|
|
152
|
+
padding-right: ${({
|
|
153
|
+
theme: e
|
|
154
|
+
}) => e.spaces[3]};
|
|
155
|
+
padding-left: ${({
|
|
156
|
+
theme: e
|
|
157
|
+
}) => e.spaces[3]};
|
|
158
|
+
border-radius: ${({
|
|
159
|
+
theme: e
|
|
160
|
+
}) => e.borderRadius};
|
|
161
|
+
background: ${({
|
|
162
|
+
theme: e
|
|
163
|
+
}) => e.colors.neutral0};
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
min-height: ${({
|
|
166
|
+
theme: e,
|
|
167
|
+
$size: o
|
|
168
|
+
}) => X("input")({
|
|
169
|
+
theme: e,
|
|
170
|
+
size: o
|
|
171
|
+
})};
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: space-between;
|
|
175
|
+
gap: ${({
|
|
176
|
+
theme: e
|
|
177
|
+
}) => e.spaces[4]};
|
|
178
|
+
|
|
179
|
+
&[aria-disabled='true'] {
|
|
180
|
+
color: ${(e) => e.theme.colors.neutral600};
|
|
181
|
+
background: ${(e) => e.theme.colors.neutral150};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
185
|
+
&:focus-visible {
|
|
186
|
+
outline: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
${({
|
|
190
|
+
theme: e,
|
|
191
|
+
$hasError: o
|
|
192
|
+
}) => Z()({
|
|
193
|
+
theme: e,
|
|
194
|
+
hasError: o
|
|
195
|
+
})};
|
|
196
|
+
`, oe = s(n.Icon)`
|
|
197
|
+
& > svg {
|
|
198
|
+
width: ${6 / 16}rem;
|
|
199
|
+
|
|
200
|
+
& > path {
|
|
201
|
+
fill: ${({
|
|
202
|
+
theme: e
|
|
203
|
+
}) => e.colors.neutral600};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`, ne = s(n.Content)`
|
|
207
|
+
background: ${({
|
|
208
|
+
theme: e
|
|
209
|
+
}) => e.colors.neutral0};
|
|
210
|
+
box-shadow: ${({
|
|
211
|
+
theme: e
|
|
212
|
+
}) => e.shadows.filterShadow};
|
|
213
|
+
border: 1px solid ${({
|
|
214
|
+
theme: e
|
|
215
|
+
}) => e.colors.neutral150};
|
|
216
|
+
border-radius: ${({
|
|
217
|
+
theme: e
|
|
218
|
+
}) => e.borderRadius};
|
|
219
|
+
width: var(--radix-select-trigger-width);
|
|
220
|
+
/* This is from the design-system figma file. */
|
|
221
|
+
max-height: 15rem;
|
|
222
|
+
`, ie = s(n.Viewport)`
|
|
223
|
+
padding: ${({
|
|
224
|
+
theme: e
|
|
225
|
+
}) => e.spaces[1]};
|
|
226
|
+
`, Ce = ({
|
|
227
|
+
children: e,
|
|
228
|
+
startIcon: o,
|
|
229
|
+
value: g
|
|
230
|
+
}) => i(le, {
|
|
231
|
+
textValue: e.toString(),
|
|
232
|
+
value: g.toString(),
|
|
233
|
+
children: [o && t(m, {
|
|
234
|
+
as: "span",
|
|
235
|
+
paddingRight: 2,
|
|
236
|
+
"aria-hidden": !0,
|
|
237
|
+
children: o
|
|
238
|
+
}), t(b, {
|
|
239
|
+
textColor: "neutral800",
|
|
240
|
+
children: t(n.ItemText, {
|
|
241
|
+
children: e
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
}), le = s(n.Item)`
|
|
245
|
+
width: 100%;
|
|
246
|
+
border: none;
|
|
247
|
+
text-align: left;
|
|
248
|
+
outline-offset: -3px;
|
|
249
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
250
|
+
padding: ${(e) => `${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
251
|
+
padding-left: ${({
|
|
252
|
+
theme: e
|
|
253
|
+
}) => e.spaces[4]};
|
|
254
|
+
background-color: ${({
|
|
255
|
+
theme: e
|
|
256
|
+
}) => e.colors.neutral0};
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
|
|
260
|
+
&:focus-visible {
|
|
261
|
+
outline: none;
|
|
262
|
+
background-color: ${({
|
|
263
|
+
theme: e
|
|
264
|
+
}) => e.colors.primary100};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&:hover {
|
|
268
|
+
background-color: ${({
|
|
269
|
+
theme: e
|
|
270
|
+
}) => e.colors.primary100};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&[data-state='checked'] {
|
|
274
|
+
${b} {
|
|
275
|
+
font-weight: bold;
|
|
276
|
+
color: ${({
|
|
277
|
+
theme: e
|
|
278
|
+
}) => e.colors.primary600};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
export {
|
|
283
|
+
Te as SingleSelect,
|
|
284
|
+
Ce as SingleSelectOption
|
|
285
|
+
};
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
}
|
|
33
33
|
`,ne=E.default(j.Button)`
|
|
34
34
|
padding: ${({theme:e})=>`${e.spaces[1]} ${e.spaces[3]}`};
|
|
35
|
-
`,I=({children:e,onClick:h,to:u,isFocused:l,href:c,...x})=>{const
|
|
35
|
+
`,I=({children:e,onClick:h,to:u,isFocused:l,href:c,...x})=>{const d=a.useRef();a.useEffect(()=>{l&&d.current&&d.current.focus()},[l]);const i={tabIndex:l?0:-1,ref:d,role:"menuitem",...x},f=v=>{(v.key===s.KeyboardKeys.SPACE||v.key===s.KeyboardKeys.ENTER)&&h()};return u&&!c?o.default.createElement(Z,{to:u,...i},o.default.createElement(b.Box,{padding:2},o.default.createElement(T.Typography,null,e))):c&&!u?o.default.createElement(ee,{isExternal:!0,href:c,...i},o.default.createElement(b.Box,{padding:2},o.default.createElement(T.Typography,null,e))):o.default.createElement(Y,{onKeyDown:f,onMouseDown:h,type:"button",...i},o.default.createElement(b.Box,{padding:2},o.default.createElement(T.Typography,null,e)))};I.defaultProps={as:void 0,href:void 0,isFocused:!1,onClick(){},to:void 0};I.propTypes={as:t.default.elementType,children:t.default.node.isRequired,href:t.default.string,isFocused:t.default.bool,onClick:t.default.func,to:t.default.string};const g=({label:e,children:h,id:u,as:l,onOpen:c=()=>{},onClose:x=()=>{},size:d,popoverPlacement:i,onReachEnd:f,...v})=>{const p=a.useRef(),K=X.useId(u),R=a.useRef(!1),[y,m]=a.useState(!1),[P,C]=a.useState(0),k=a.Children.toArray(h),L=d==="S"?ne:j.Button,_=l||L,O=!!f&&typeof f=="function";a.useEffect(()=>{if(["string","number"].includes(typeof e)){const n=k.findIndex(r=>r.props.children===e);n!==-1&&C(n)}},[e]);const S=M.useCallbackRef(c),D=M.useCallbackRef(x);a.useEffect(()=>{R?.current?y?S():D():R.current=!0},[R,D,S,y]),a.useEffect(()=>{o.default.isValidElement(e)&&P===-1&&p.current.focus()},[e,P]);const $=n=>{y&&(n.key===s.KeyboardKeys.ESCAPE&&(n.stopPropagation(),m(!1),p.current.focus()),n.key===s.KeyboardKeys.DOWN&&C(r=>r===k.length-1?0:r+1),n.key===s.KeyboardKeys.UP&&C(r=>r===0?k.length-1:r-1))},F=n=>{(n.key===s.KeyboardKeys.ENTER||n.key===s.KeyboardKeys.SPACE)&&m(r=>!r)},A=n=>{n.preventDefault(),n.currentTarget.contains(n.relatedTarget)||m(!1)},N=n=>{n.preventDefault(),m(r=>!r)},V=()=>{O&&f()},W=k.map((n,r)=>o.default.createElement(Q.Flex,{as:"li",key:r,justifyContent:"center",role:"menuitem"},a.cloneElement(n,{onClick(){n.props.onClick(),m(!1),p.current.focus()},isFocused:P===r})));return o.default.createElement("div",{onKeyDown:$},o.default.createElement(_,{label:o.default.isValidElement(e)?null:e,"aria-haspopup":!0,"aria-expanded":y,"aria-controls":K,onKeyDown:F,onMouseDown:N,ref:p,type:"button",variant:"ghost",endIcon:o.default.createElement(te,null,o.default.createElement(G.CarretDown,{"aria-hidden":!0})),...v},e),y&&o.default.createElement(w.Popover,{onBlur:A,placement:i,source:p,onReachEnd:V,intersectionId:O?`popover-${K}`:void 0,spacing:4},o.default.createElement(b.Box,{role:"menu",as:"ul",padding:1,id:K},W)))};g.defaultProps={as:void 0};g.displayName="SimpleMenu";g.defaultProps={id:void 0,onOpen:void 0,onClose:void 0,onReachEnd:void 0,popoverPlacement:"bottom-start",size:"M"};g.propTypes={as:t.default.any,children:t.default.oneOfType([t.default.arrayOf(t.default.node),t.default.node]).isRequired,id:t.default.string,label:t.default.oneOfType([t.default.string,t.default.number,t.default.element]).isRequired,onClose:t.default.func,onOpen:t.default.func,onReachEnd:t.default.func,popoverPlacement:t.default.oneOf(w.POPOVER_PLACEMENTS),size:t.default.oneOf(["S","M"])};exports.MenuItem=I;exports.SimpleMenu=g;
|
|
@@ -110,7 +110,7 @@ const C = ({
|
|
|
110
110
|
onReachEnd: u,
|
|
111
111
|
...g
|
|
112
112
|
}) => {
|
|
113
|
-
const
|
|
113
|
+
const d = T(), R = Y(s), x = T(!1), [m, f] = B(!1), [D, I] = B(0), h = z.toArray(E), A = a || (c === "S" ? oe : $), S = !!u && typeof u == "function";
|
|
114
114
|
v(() => {
|
|
115
115
|
if (["string", "number"].includes(typeof o)) {
|
|
116
116
|
const n = h.findIndex((r) => r.props.children === o);
|
|
@@ -119,12 +119,12 @@ const C = ({
|
|
|
119
119
|
}, [o]);
|
|
120
120
|
const w = K(l), M = K(P);
|
|
121
121
|
v(() => {
|
|
122
|
-
x?.current ?
|
|
123
|
-
}, [x, M, w,
|
|
124
|
-
t.isValidElement(o) && D === -1 &&
|
|
122
|
+
x?.current ? m ? w() : M() : x.current = !0;
|
|
123
|
+
}, [x, M, w, m]), v(() => {
|
|
124
|
+
t.isValidElement(o) && D === -1 && d.current.focus();
|
|
125
125
|
}, [o, D]);
|
|
126
126
|
const N = (n) => {
|
|
127
|
-
|
|
127
|
+
m && (n.key === i.ESCAPE && (n.stopPropagation(), f(!1), d.current.focus()), n.key === i.DOWN && I((r) => r === h.length - 1 ? 0 : r + 1), n.key === i.UP && I((r) => r === 0 ? h.length - 1 : r - 1));
|
|
128
128
|
}, F = (n) => {
|
|
129
129
|
(n.key === i.ENTER || n.key === i.SPACE) && f((r) => !r);
|
|
130
130
|
}, V = (n) => {
|
|
@@ -140,7 +140,7 @@ const C = ({
|
|
|
140
140
|
role: "menuitem"
|
|
141
141
|
}, j(n, {
|
|
142
142
|
onClick() {
|
|
143
|
-
n.props.onClick(), f(!1),
|
|
143
|
+
n.props.onClick(), f(!1), d.current.focus();
|
|
144
144
|
},
|
|
145
145
|
isFocused: D === r
|
|
146
146
|
})));
|
|
@@ -149,21 +149,21 @@ const C = ({
|
|
|
149
149
|
}, /* @__PURE__ */ t.createElement(A, {
|
|
150
150
|
label: t.isValidElement(o) ? null : o,
|
|
151
151
|
"aria-haspopup": !0,
|
|
152
|
-
"aria-expanded":
|
|
152
|
+
"aria-expanded": m,
|
|
153
153
|
"aria-controls": R,
|
|
154
154
|
onKeyDown: F,
|
|
155
155
|
onMouseDown: q,
|
|
156
|
-
ref:
|
|
156
|
+
ref: d,
|
|
157
157
|
type: "button",
|
|
158
158
|
variant: "ghost",
|
|
159
159
|
endIcon: /* @__PURE__ */ t.createElement(te, null, /* @__PURE__ */ t.createElement(U, {
|
|
160
160
|
"aria-hidden": !0
|
|
161
161
|
})),
|
|
162
162
|
...g
|
|
163
|
-
}, o),
|
|
163
|
+
}, o), m && /* @__PURE__ */ t.createElement(X, {
|
|
164
164
|
onBlur: V,
|
|
165
165
|
placement: p,
|
|
166
|
-
source:
|
|
166
|
+
source: d,
|
|
167
167
|
onReachEnd: W,
|
|
168
168
|
intersectionId: S ? `popover-${R}` : void 0,
|
|
169
169
|
spacing: 4
|
package/dist/Stack/Stack.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),d=require("react"),m=require("styled-components"),i=require("../Flex/Flex.cjs"),o=require("../helpers/theme.cjs"),f=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=f(m),l={size:!0,spacing:!0},g=c.default(i.Flex).withConfig({shouldForwardProp:(e,t)=>!l[e]&&t(e)})`
|
|
2
2
|
& > * {
|
|
3
3
|
margin-top: 0;
|
|
4
4
|
margin-bottom: 0;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
& > * + * {
|
|
8
|
-
margin-top: ${({theme:e,spacing:t})=>
|
|
8
|
+
margin-top: ${({theme:e,spacing:t})=>o.extractStyleFromTheme(e.spaces,t,void 0)};
|
|
9
9
|
}
|
|
10
|
-
`,h=c.default(
|
|
10
|
+
`,h=c.default(i.Flex).withConfig({shouldForwardProp:(e,t)=>!l[e]&&t(e)})`
|
|
11
11
|
& > * {
|
|
12
12
|
margin-left: 0;
|
|
13
13
|
margin-right: 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
& > * + * {
|
|
17
|
-
margin-left: ${({theme:e,spacing:t})=>
|
|
17
|
+
margin-left: ${({theme:e,spacing:t})=>o.extractStyleFromTheme(e.spaces,t,void 0)};
|
|
18
18
|
}
|
|
19
|
-
`,d
|
|
19
|
+
`,u=d.forwardRef(({horizontal:e=!1,spacing:t,size:r,...n},a)=>(r&&console.warn('Deprecation warning: Usage of "size" prop in Stack component is deprecated. This is discouraged and will be removed in the next major release. Please use "spacing" instead'),e?s.jsx(h,{ref:a,spacing:t||r,...n}):s.jsx(g,{direction:"column",alignItems:"stretch",ref:a,spacing:t||r,...n})));u.displayName="Stack";exports.Stack=u;
|
package/dist/Stack/Stack.js
CHANGED
|
@@ -4,7 +4,8 @@ import a from "styled-components";
|
|
|
4
4
|
import { Flex as s } from "../Flex/Flex.js";
|
|
5
5
|
import { extractStyleFromTheme as m } from "../helpers/theme.js";
|
|
6
6
|
const c = {
|
|
7
|
-
size: !0
|
|
7
|
+
size: !0,
|
|
8
|
+
spacing: !0
|
|
8
9
|
}, f = a(s).withConfig({
|
|
9
10
|
shouldForwardProp: (e, r) => !c[e] && r(e)
|
|
10
11
|
})`
|
|
@@ -19,7 +20,7 @@ const c = {
|
|
|
19
20
|
spacing: r
|
|
20
21
|
}) => m(e.spaces, r, void 0)};
|
|
21
22
|
}
|
|
22
|
-
`,
|
|
23
|
+
`, g = a(s).withConfig({
|
|
23
24
|
shouldForwardProp: (e, r) => !c[e] && r(e)
|
|
24
25
|
})`
|
|
25
26
|
& > * {
|
|
@@ -33,12 +34,12 @@ const c = {
|
|
|
33
34
|
spacing: r
|
|
34
35
|
}) => m(e.spaces, r, void 0)};
|
|
35
36
|
}
|
|
36
|
-
`,
|
|
37
|
+
`, l = d(({
|
|
37
38
|
horizontal: e = !1,
|
|
38
39
|
spacing: r,
|
|
39
40
|
size: t,
|
|
40
41
|
...o
|
|
41
|
-
}, i) => (t && console.warn('Deprecation warning: Usage of "size" prop in Stack component is deprecated. This is discouraged and will be removed in the next major release. Please use "spacing" instead'), e ? n(
|
|
42
|
+
}, i) => (t && console.warn('Deprecation warning: Usage of "size" prop in Stack component is deprecated. This is discouraged and will be removed in the next major release. Please use "spacing" instead'), e ? n(g, {
|
|
42
43
|
ref: i,
|
|
43
44
|
spacing: r || t,
|
|
44
45
|
...o
|
|
@@ -49,7 +50,7 @@ const c = {
|
|
|
49
50
|
spacing: r || t,
|
|
50
51
|
...o
|
|
51
52
|
})));
|
|
52
|
-
|
|
53
|
+
l.displayName = "Stack";
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
l as Stack
|
|
55
56
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),C=require("prop-types"),I=require("styled-components"),R=require("@strapi/icons"),_=require("../Flex/Flex.cjs"),D=require("../Typography/Typography.cjs"),P=require("../IconButton/IconButton.cjs"),s=require("../Box/Box.cjs"),F=require("../Divider/Divider.cjs"),K=require("../Searchbar/Searchbar.cjs"),L=require("../Searchbar/SearchForm.cjs"),k=require("../helpers/useId.cjs"),w=require("../helpers/usePrevious.cjs"),O=require("../helpers/keyboardKeys.cjs"),d=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=d(o),r=d(C),H=d(I),h=H.default(F.Divider)`
|
|
2
2
|
width: ${24/16}rem;
|
|
3
3
|
background-color: ${({theme:t})=>t.colors.neutral200};
|
|
4
|
-
`,i=({as:t,label:g,searchLabel:f,searchable:
|
|
4
|
+
`,i=({as:t,label:g,searchLabel:f,searchable:y,onChange:b,value:m,onClear:S,onSubmit:v,id:B})=>{const[n,l]=o.useState(!1),p=w.usePrevious(n),q=k.useId(B),c=o.useRef(),u=o.useRef();o.useEffect(()=>{n&&c.current&&c.current.focus(),p&&!n&&u.current&&u.current.focus()},[n,p]);const E=()=>{l(a=>!a)},j=a=>{S(a),c.current.focus()},T=a=>{a.relatedTarget?.id!==q&&l(!1)},x=a=>{a.key===O.KeyboardKeys.ESCAPE&&l(!1)};return n?e.default.createElement(s.Box,{paddingLeft:4,paddingTop:5,paddingBottom:2,paddingRight:4},e.default.createElement(L.SearchForm,null,e.default.createElement(K.Searchbar,{name:"searchbar",value:m,onChange:b,placeholder:"e.g: strapi-plugin-abcd",onKeyDown:x,ref:c,onBlur:T,onClear:j,onSubmit:v,clearLabel:"Clear",size:"S"},f)),e.default.createElement(s.Box,{paddingLeft:2,paddingTop:4},e.default.createElement(h,null))):e.default.createElement(s.Box,{paddingLeft:6,paddingTop:6,paddingBottom:2,paddingRight:4},e.default.createElement(_.Flex,{justifyContent:"space-between",alignItems:"flex-start"},e.default.createElement(D.Typography,{variant:"beta",as:t},g),y&&e.default.createElement(P.IconButton,{ref:u,onClick:E,label:f,icon:e.default.createElement(R.Search,null)})),e.default.createElement(s.Box,{paddingTop:4},e.default.createElement(h,null)))};i.defaultProps={as:"h2",searchable:!1,onChange(){},onClear(){},onSubmit(){},value:"",searchLabel:"",id:void 0};i.propTypes={as:r.default.string,id:r.default.string,label:r.default.string.isRequired,onChange:r.default.func,onClear:r.default.func,onSubmit:r.default.func,searchLabel:r.default.string,searchable:r.default.bool,value:r.default.string};exports.SubNavHeader=i;
|
|
@@ -15,21 +15,21 @@ import { KeyboardKeys as j } from "../helpers/keyboardKeys.js";
|
|
|
15
15
|
const d = x(k)`
|
|
16
16
|
width: ${24 / 16}rem;
|
|
17
17
|
background-color: ${({ theme: l }) => l.colors.neutral200};
|
|
18
|
-
`,
|
|
19
|
-
const [
|
|
18
|
+
`, f = ({ as: l, label: u, searchLabel: s, searchable: g, onChange: h, value: b, onClear: E, onSubmit: S, id: y }) => {
|
|
19
|
+
const [o, i] = L(!1), m = $(o), C = _(y), a = p(), c = p();
|
|
20
20
|
w(() => {
|
|
21
|
-
|
|
22
|
-
}, [
|
|
21
|
+
o && a.current && a.current.focus(), m && !o && c.current && c.current.focus();
|
|
22
|
+
}, [o, m]);
|
|
23
23
|
const v = () => {
|
|
24
|
-
|
|
24
|
+
i((t) => !t);
|
|
25
25
|
}, B = (t) => {
|
|
26
|
-
E(t),
|
|
26
|
+
E(t), a.current.focus();
|
|
27
27
|
}, T = (t) => {
|
|
28
|
-
t.relatedTarget?.id !== C &&
|
|
28
|
+
t.relatedTarget?.id !== C && i(!1);
|
|
29
29
|
}, R = (t) => {
|
|
30
|
-
t.key === j.ESCAPE &&
|
|
30
|
+
t.key === j.ESCAPE && i(!1);
|
|
31
31
|
};
|
|
32
|
-
return
|
|
32
|
+
return o ? /* @__PURE__ */ e.createElement(n, {
|
|
33
33
|
paddingLeft: 4,
|
|
34
34
|
paddingTop: 5,
|
|
35
35
|
paddingBottom: 2,
|
|
@@ -40,7 +40,7 @@ const d = x(k)`
|
|
|
40
40
|
onChange: h,
|
|
41
41
|
placeholder: "e.g: strapi-plugin-abcd",
|
|
42
42
|
onKeyDown: R,
|
|
43
|
-
ref:
|
|
43
|
+
ref: a,
|
|
44
44
|
onBlur: T,
|
|
45
45
|
onClear: B,
|
|
46
46
|
onSubmit: S,
|
|
@@ -60,8 +60,8 @@ const d = x(k)`
|
|
|
60
60
|
}, /* @__PURE__ */ e.createElement(K, {
|
|
61
61
|
variant: "beta",
|
|
62
62
|
as: l
|
|
63
|
-
},
|
|
64
|
-
ref:
|
|
63
|
+
}, u), g && /* @__PURE__ */ e.createElement(P, {
|
|
64
|
+
ref: c,
|
|
65
65
|
onClick: v,
|
|
66
66
|
label: s,
|
|
67
67
|
icon: /* @__PURE__ */ e.createElement(D, null)
|
|
@@ -69,7 +69,7 @@ const d = x(k)`
|
|
|
69
69
|
paddingTop: 4
|
|
70
70
|
}, /* @__PURE__ */ e.createElement(d, null)));
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
f.defaultProps = {
|
|
73
73
|
as: "h2",
|
|
74
74
|
searchable: !1,
|
|
75
75
|
onChange() {
|
|
@@ -82,7 +82,7 @@ u.defaultProps = {
|
|
|
82
82
|
searchLabel: "",
|
|
83
83
|
id: void 0
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
f.propTypes = {
|
|
86
86
|
as: r.string,
|
|
87
87
|
id: r.string,
|
|
88
88
|
label: r.string.isRequired,
|
|
@@ -94,5 +94,5 @@ u.propTypes = {
|
|
|
94
94
|
value: r.string
|
|
95
95
|
};
|
|
96
96
|
export {
|
|
97
|
-
|
|
97
|
+
f as SubNavHeader
|
|
98
98
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),m=require("prop-types"),h=require("styled-components"),x=require("@strapi/icons"),l=require("../Box/Box.cjs"),b=require("../Flex/Flex.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),m=require("prop-types"),h=require("styled-components"),x=require("@strapi/icons"),l=require("../Box/Box.cjs"),b=require("../Flex/Flex.cjs"),S=require("../Typography/Typography.cjs"),v=require("../helpers/useId.cjs"),d=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=d(o),r=d(m),i=d(h),E=i.default(l.Box)`
|
|
2
2
|
svg {
|
|
3
3
|
height: ${4/16}rem;
|
|
4
4
|
path {
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
width: ${12/16}rem;
|
|
18
18
|
transform: rotateX(${({rotated:e})=>e?"0deg":"180deg"});
|
|
19
|
-
`,s=({label:e,children:
|
|
19
|
+
`,s=({label:e,children:u,id:p})=>{const[n,f]=o.useState(!0),c=v.useId(p),g=()=>{f(a=>!a)};return t.default.createElement(l.Box,null,t.default.createElement(E,{paddingLeft:7,paddingTop:2,paddingBottom:2,paddingRight:4},t.default.createElement(b.Flex,{justifyContent:"space-between"},t.default.createElement(k,{onClick:g,"aria-expanded":n,"aria-controls":c},t.default.createElement(q,{rotated:n},t.default.createElement(x.CarretDown,{"aria-hidden":!0})),t.default.createElement(l.Box,{paddingLeft:2},t.default.createElement(S.Typography,{as:"span",fontWeight:"semiBold",textColor:"neutral800"},e))))),n&&t.default.createElement("ul",{id:c},o.Children.map(u,(a,y)=>t.default.createElement("li",{key:y},a))))};s.defaultProps={children:void 0,id:void 0};s.propTypes={children:r.default.node,id:r.default.string,label:r.default.string.isRequired};exports.SubNavLinkSection=s;
|
|
@@ -4,8 +4,8 @@ import a from "styled-components";
|
|
|
4
4
|
import { CarretDown as h } from "@strapi/icons";
|
|
5
5
|
import { Box as i } from "../Box/Box.js";
|
|
6
6
|
import { Flex as E } from "../Flex/Flex.js";
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { useId as
|
|
7
|
+
import { Typography as y } from "../Typography/Typography.js";
|
|
8
|
+
import { useId as b } from "../helpers/useId.js";
|
|
9
9
|
const k = a(i)`
|
|
10
10
|
svg {
|
|
11
11
|
height: ${4 / 16}rem;
|
|
@@ -24,9 +24,9 @@ const k = a(i)`
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
width: ${12 / 16}rem;
|
|
26
26
|
transform: rotateX(${({ rotated: t }) => t ? "0deg" : "180deg"});
|
|
27
|
-
`, l = ({ label: t, children: p, id:
|
|
28
|
-
const [r,
|
|
29
|
-
|
|
27
|
+
`, l = ({ label: t, children: p, id: m }) => {
|
|
28
|
+
const [r, s] = f(!0), d = b(m), c = () => {
|
|
29
|
+
s((n) => !n);
|
|
30
30
|
};
|
|
31
31
|
return /* @__PURE__ */ e.createElement(i, null, /* @__PURE__ */ e.createElement(k, {
|
|
32
32
|
paddingLeft: 7,
|
|
@@ -45,7 +45,7 @@ const k = a(i)`
|
|
|
45
45
|
"aria-hidden": !0
|
|
46
46
|
})), /* @__PURE__ */ e.createElement(i, {
|
|
47
47
|
paddingLeft: 2
|
|
48
|
-
}, /* @__PURE__ */ e.createElement(
|
|
48
|
+
}, /* @__PURE__ */ e.createElement(y, {
|
|
49
49
|
as: "span",
|
|
50
50
|
fontWeight: "semiBold",
|
|
51
51
|
textColor: "neutral800"
|