@strapi/design-system 1.6.4 → 1.6.6
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 +1 -1
- package/dist/Accordion/Accordion.js +1 -1
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +48 -51
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +17 -16
- package/dist/BaseRadio/BaseRadio.cjs +1 -1
- package/dist/BaseRadio/BaseRadio.js +1 -1
- package/dist/Box/Box.cjs +3 -3
- package/dist/Box/Box.js +26 -26
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +1 -1
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +16 -4
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +13 -13
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +13 -13
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +62 -63
- package/dist/DatePicker/DatePicker.cjs +8 -1
- package/dist/DatePicker/DatePicker.js +71 -98
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +125 -57
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +43 -26
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +31 -15
- package/dist/DatePicker/components.cjs +8 -6
- package/dist/DatePicker/components.js +15 -13
- package/dist/DatePicker/utils/getDayOfWeek.js +8 -8
- package/dist/DatePicker/utils/getMonths.cjs +1 -1
- package/dist/DatePicker/utils/getMonths.js +3 -3
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +1 -1
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +97 -104
- package/dist/Dialog/Dialog.cjs +4 -4
- package/dist/Dialog/Dialog.js +2 -2
- package/dist/Dialog/DialogFooter.cjs +3 -3
- package/dist/Dialog/DialogFooter.js +2 -2
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +31 -27
- package/dist/Field/FieldAction.cjs +2 -8
- package/dist/Field/FieldAction.js +27 -16
- package/dist/Field/FieldContext.cjs +1 -1
- package/dist/Field/FieldContext.js +2 -2
- package/dist/Field/FieldError.cjs +1 -1
- package/dist/Field/FieldError.js +14 -4
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +17 -7
- package/dist/Field/FieldInput.cjs +14 -16
- package/dist/Field/FieldInput.js +104 -72
- package/dist/Field/FieldLabel.cjs +6 -3
- package/dist/Field/FieldLabel.js +43 -25
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +34 -38
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +32 -30
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +29 -27
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +3 -3
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +33 -13
- package/dist/MainNav/NavSections.cjs +2 -2
- package/dist/MainNav/NavSections.js +20 -10
- package/dist/ModalLayout/ModalLayout.cjs +1 -1
- package/dist/ModalLayout/ModalLayout.js +1 -1
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +32 -32
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +1 -1
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +64 -67
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +39 -37
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +14 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +13 -8
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +20 -13
- package/dist/Searchbar/Searchbar.cjs +2 -2
- package/dist/Searchbar/Searchbar.js +7 -6
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +66 -65
- package/dist/Select/SelectButton.cjs +3 -3
- package/dist/Select/SelectButton.js +17 -15
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +10 -8
- package/dist/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/SimpleMenu/SimpleMenu.js +1 -1
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +2 -2
- package/dist/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/SubNav/SubNavLinkSection.js +1 -1
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +7 -7
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +17 -7
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +1 -1
- package/dist/Tag/Tag.cjs +8 -8
- package/dist/Tag/Tag.js +52 -49
- package/dist/TextButton/TextButton.cjs +6 -12
- package/dist/TextButton/TextButton.js +32 -46
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +48 -47
- package/dist/Textarea/Textarea.cjs +2 -2
- package/dist/Textarea/Textarea.js +12 -13
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +13 -12
- package/dist/TimePicker/TimePicker.cjs +5 -7
- package/dist/TimePicker/TimePicker.js +48 -100
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +2 -2
- package/dist/ToggleCheckbox/ToggleCheckbox.js +1 -0
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +28 -29
- package/dist/Tooltip/Tooltip.cjs +1 -1
- package/dist/Tooltip/Tooltip.js +1 -1
- package/dist/helpers/deprecations.cjs +1 -1
- package/dist/helpers/deprecations.js +7 -7
- package/dist/helpers/useElementOnScreen.cjs +1 -1
- package/dist/helpers/useElementOnScreen.js +4 -13
- package/dist/helpers/useId.cjs +1 -1
- package/dist/helpers/useId.js +4 -11
- package/dist/helpers/useIntersection.cjs +1 -1
- package/dist/helpers/useIntersection.js +4 -21
- package/dist/helpers/useLockScroll.cjs +1 -1
- package/dist/helpers/useLockScroll.js +4 -7
- package/dist/helpers/usePrevious.cjs +1 -1
- package/dist/helpers/usePrevious.js +4 -8
- package/dist/helpers/useResizeObserver.cjs +1 -1
- package/dist/helpers/useResizeObserver.js +4 -14
- package/dist/hooks/useElementOnScreen.cjs +1 -0
- package/dist/hooks/useElementOnScreen.js +15 -0
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +3 -3
- package/dist/hooks/useLockScroll.cjs +1 -0
- package/dist/hooks/useLockScroll.js +9 -0
- package/dist/hooks/usePrevious.cjs +1 -0
- package/dist/hooks/usePrevious.js +10 -0
- package/dist/hooks/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver.js +16 -0
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +33 -13
- package/dist/v2/MainNav/NavSections.cjs +2 -2
- package/dist/v2/MainNav/NavSections.js +20 -10
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/v2/SimpleMenu/SimpleMenu.js +1 -1
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +2 -2
- package/dist/v2/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/v2/SubNav/SubNavLinkSection.js +1 -1
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +10 -10
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +17 -7
- package/package.json +5 -3
- package/dist/DateTimePicker/DateTimePickerProps.cjs +0 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +0 -40
- package/dist/DateTimePicker/__tests__/parseDate.test.cjs +0 -1
- package/dist/DateTimePicker/__tests__/parseDate.test.js +0 -8
- package/dist/DateTimePicker/parseDate.cjs +0 -1
- package/dist/DateTimePicker/parseDate.js +0 -7
- package/dist/Select/SingleSelect.cjs +0 -82
- package/dist/Select/SingleSelect.js +0 -285
package/dist/Field/FieldInput.js
CHANGED
|
@@ -1,33 +1,96 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as y, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w } from "react";
|
|
3
|
+
import p, { css as R } from "styled-components";
|
|
4
4
|
import { useField as I } from "./FieldContext.js";
|
|
5
|
-
import { Box as
|
|
6
|
-
import { Flex as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const u = {
|
|
5
|
+
import { Box as l } from "../Box/Box.js";
|
|
6
|
+
import { Flex as k } from "../Flex/Flex.js";
|
|
7
|
+
import { inputFocusStyle as B } from "../themes/utils.js";
|
|
8
|
+
const c = {
|
|
10
9
|
S: 6.5,
|
|
11
10
|
M: 10.5
|
|
12
|
-
},
|
|
11
|
+
}, M = w(({
|
|
12
|
+
endAction: r,
|
|
13
|
+
startAction: o,
|
|
14
|
+
disabled: e = !1,
|
|
15
|
+
onChange: d,
|
|
16
|
+
size: u = "M",
|
|
17
|
+
...f
|
|
18
|
+
}, $) => {
|
|
19
|
+
const {
|
|
20
|
+
id: i,
|
|
21
|
+
error: t,
|
|
22
|
+
hint: h,
|
|
23
|
+
name: g,
|
|
24
|
+
required: m
|
|
25
|
+
} = I();
|
|
26
|
+
let n;
|
|
27
|
+
t ? n = `${i}-error` : h && (n = `${i}-hint`);
|
|
28
|
+
const s = Boolean(t), b = (x) => {
|
|
29
|
+
!e && d && d(x);
|
|
30
|
+
};
|
|
31
|
+
return y(j, {
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
hasError: s,
|
|
34
|
+
disabled: e,
|
|
35
|
+
children: [o ? a(l, {
|
|
36
|
+
paddingLeft: 3,
|
|
37
|
+
paddingRight: 2,
|
|
38
|
+
children: o
|
|
39
|
+
}) : null, a(F, {
|
|
40
|
+
id: i,
|
|
41
|
+
name: g,
|
|
42
|
+
ref: $,
|
|
43
|
+
"aria-describedby": n,
|
|
44
|
+
"aria-invalid": s,
|
|
45
|
+
"aria-disabled": e,
|
|
46
|
+
disabled: e,
|
|
47
|
+
"data-disabled": e ? "" : void 0,
|
|
48
|
+
hasLeftAction: Boolean(o),
|
|
49
|
+
hasRightAction: Boolean(r),
|
|
50
|
+
onChange: b,
|
|
51
|
+
"aria-required": m,
|
|
52
|
+
$size: u,
|
|
53
|
+
...f
|
|
54
|
+
}), r ? a(l, {
|
|
55
|
+
paddingLeft: 2,
|
|
56
|
+
paddingRight: 3,
|
|
57
|
+
children: r
|
|
58
|
+
}) : null]
|
|
59
|
+
});
|
|
60
|
+
}), F = p.input`
|
|
13
61
|
border: none;
|
|
14
|
-
border-radius: ${({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
padding-
|
|
18
|
-
|
|
19
|
-
|
|
62
|
+
border-radius: ${({
|
|
63
|
+
theme: r
|
|
64
|
+
}) => r.borderRadius};
|
|
65
|
+
padding-bottom: ${({
|
|
66
|
+
$size: r
|
|
67
|
+
}) => `${c[r] / 16}rem`};
|
|
68
|
+
padding-left: ${({
|
|
69
|
+
theme: r,
|
|
70
|
+
hasLeftAction: o
|
|
71
|
+
}) => o ? 0 : r.spaces[4]};
|
|
72
|
+
padding-right: ${({
|
|
73
|
+
theme: r,
|
|
74
|
+
hasRightAction: o
|
|
75
|
+
}) => o ? 0 : r.spaces[4]};
|
|
76
|
+
padding-top: ${({
|
|
77
|
+
$size: r
|
|
78
|
+
}) => `${c[r] / 16}rem`};
|
|
79
|
+
cursor: ${(r) => r["aria-disabled"] ? "not-allowed" : void 0};
|
|
20
80
|
|
|
21
|
-
color: ${({
|
|
81
|
+
color: ${({
|
|
82
|
+
theme: r
|
|
83
|
+
}) => r.colors.neutral800};
|
|
22
84
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
-
font-size: ${14 / 16}rem;
|
|
85
|
+
font-size: ${(r) => r.theme.fontSizes[2]};
|
|
25
86
|
display: block;
|
|
26
87
|
width: 100%;
|
|
27
88
|
background: inherit;
|
|
28
89
|
|
|
29
90
|
::placeholder {
|
|
30
|
-
color: ${({
|
|
91
|
+
color: ${({
|
|
92
|
+
theme: r
|
|
93
|
+
}) => r.colors.neutral500};
|
|
31
94
|
opacity: 1;
|
|
32
95
|
}
|
|
33
96
|
|
|
@@ -40,59 +103,28 @@ const u = {
|
|
|
40
103
|
outline: none;
|
|
41
104
|
box-shadow: none;
|
|
42
105
|
}
|
|
43
|
-
`,
|
|
44
|
-
border: 1px solid ${({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
106
|
+
`, j = p(k)`
|
|
107
|
+
border: 1px solid ${({
|
|
108
|
+
theme: r,
|
|
109
|
+
hasError: o
|
|
110
|
+
}) => o ? r.colors.danger600 : r.colors.neutral200};
|
|
111
|
+
border-radius: ${({
|
|
112
|
+
theme: r
|
|
113
|
+
}) => r.borderRadius};
|
|
114
|
+
background: ${({
|
|
115
|
+
theme: r
|
|
116
|
+
}) => r.colors.neutral0};
|
|
117
|
+
${B()}
|
|
48
118
|
|
|
49
|
-
${({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
l ? i = `${n}-error` : h && (i = `${n}-hint`);
|
|
58
|
-
const p = Boolean(l), w = (R) => {
|
|
59
|
-
a || f(R);
|
|
60
|
-
};
|
|
61
|
-
return /* @__PURE__ */ t.createElement(F, { size: s, justifyContent: "space-between", hasError: p, disabled: a }, o && /* @__PURE__ */ t.createElement(c, { paddingLeft: 3, paddingRight: 2 }, o), /* @__PURE__ */ t.createElement(
|
|
62
|
-
E,
|
|
63
|
-
{
|
|
64
|
-
id: n,
|
|
65
|
-
name: $,
|
|
66
|
-
ref: b,
|
|
67
|
-
"aria-describedby": i,
|
|
68
|
-
"aria-invalid": p,
|
|
69
|
-
"aria-disabled": a,
|
|
70
|
-
hasLeftAction: Boolean(o),
|
|
71
|
-
hasRightAction: Boolean(e),
|
|
72
|
-
onChange: w,
|
|
73
|
-
"aria-required": y,
|
|
74
|
-
size: s,
|
|
75
|
-
...g
|
|
76
|
-
}
|
|
77
|
-
), e && /* @__PURE__ */ t.createElement(c, { paddingLeft: 2, paddingRight: 3 }, e));
|
|
78
|
-
});
|
|
79
|
-
d.displayName = "FieldInput";
|
|
80
|
-
d.defaultProps = {
|
|
81
|
-
disabled: !1,
|
|
82
|
-
endAction: void 0,
|
|
83
|
-
size: "M",
|
|
84
|
-
startAction: void 0,
|
|
85
|
-
onChange() {
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
d.propTypes = {
|
|
89
|
-
disabled: r.bool,
|
|
90
|
-
endAction: r.element,
|
|
91
|
-
onChange: r.func,
|
|
92
|
-
size: r.oneOf(Object.keys(x.input)),
|
|
93
|
-
startAction: r.element
|
|
94
|
-
};
|
|
119
|
+
${({
|
|
120
|
+
theme: r,
|
|
121
|
+
disabled: o
|
|
122
|
+
}) => o ? R`
|
|
123
|
+
color: ${r.colors.neutral600};
|
|
124
|
+
background: ${r.colors.neutral150};
|
|
125
|
+
` : void 0}
|
|
126
|
+
`;
|
|
95
127
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
128
|
+
M as FieldInput,
|
|
129
|
+
j as InputWrapper
|
|
98
130
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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 t=require("react/jsx-runtime"),u=require("react"),p=require("styled-components"),h=require("./FieldContext.cjs"),y=require("../Flex/Flex.cjs"),g=require("../helpers/deprecations.cjs"),i=require("../Typography/Typography.cjs"),f=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},r=f(p),x=g.once(console.warn),F=u.forwardRef(({children:e,action:o,required:n,...l},s)=>{const{id:a,required:c}=h.useField(),d=c||n;return n!==void 0&&x('Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'),t.jsxs(j,{ref:s,variant:"pi",textColor:"neutral800",htmlFor:a,fontWeight:"bold",as:"label",...l,children:[e,d&&t.jsx(q,{textColor:"danger600",children:"*"}),o&&t.jsx(m,{marginLeft:1,children:o})]})}),j=r.default(i.Typography)`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
`,q=r.default(i.Typography)`
|
|
2
5
|
line-height: 0;
|
|
3
|
-
`,
|
|
6
|
+
`,m=r.default(y.Flex)`
|
|
4
7
|
line-height: 0;
|
|
5
8
|
|
|
6
9
|
svg path {
|
|
7
10
|
fill: ${({theme:e})=>e.colors.neutral500};
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
`;exports.FieldLabel=F;
|
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useField as
|
|
5
|
-
import { Flex as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import r from "styled-components";
|
|
4
|
+
import { useField as h } from "./FieldContext.js";
|
|
5
|
+
import { Flex as f } from "../Flex/Flex.js";
|
|
6
|
+
import { once as g } from "../helpers/deprecations.js";
|
|
7
|
+
import { Typography as n } from "../Typography/Typography.js";
|
|
8
|
+
const u = g(console.warn), A = c(({
|
|
9
|
+
children: e,
|
|
10
|
+
action: o,
|
|
11
|
+
required: i,
|
|
12
|
+
...l
|
|
13
|
+
}, s) => {
|
|
14
|
+
const {
|
|
15
|
+
id: a,
|
|
16
|
+
required: d
|
|
17
|
+
} = h(), p = d || i;
|
|
18
|
+
return i !== void 0 && u('Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'), m(x, {
|
|
19
|
+
ref: s,
|
|
20
|
+
variant: "pi",
|
|
21
|
+
textColor: "neutral800",
|
|
22
|
+
htmlFor: a,
|
|
23
|
+
fontWeight: "bold",
|
|
24
|
+
as: "label",
|
|
25
|
+
...l,
|
|
26
|
+
children: [e, p && t(y, {
|
|
27
|
+
textColor: "danger600",
|
|
28
|
+
children: "*"
|
|
29
|
+
}), o && t(F, {
|
|
30
|
+
marginLeft: 1,
|
|
31
|
+
children: o
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
}), x = r(n)`
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
`, y = r(n)`
|
|
8
38
|
line-height: 0;
|
|
9
|
-
`,
|
|
39
|
+
`, F = r(f)`
|
|
10
40
|
line-height: 0;
|
|
11
41
|
|
|
12
42
|
svg path {
|
|
13
|
-
fill: ${({
|
|
43
|
+
fill: ${({
|
|
44
|
+
theme: e
|
|
45
|
+
}) => e.colors.neutral500};
|
|
14
46
|
}
|
|
15
|
-
|
|
16
|
-
const { id: p, required: m } = u(), c = m || i;
|
|
17
|
-
return i !== void 0 && console.warn(
|
|
18
|
-
'Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'
|
|
19
|
-
), /* @__PURE__ */ e.createElement(a, { variant: "pi", textColor: "neutral800", htmlFor: p, fontWeight: "bold", as: "label", ...s }, /* @__PURE__ */ e.createElement(l, { alignItems: "center" }, r, c && /* @__PURE__ */ e.createElement(h, { textColor: "danger600" }, "*"), t && /* @__PURE__ */ e.createElement(f, { marginLeft: 1 }, t)));
|
|
20
|
-
};
|
|
21
|
-
d.defaultProps = {
|
|
22
|
-
action: void 0,
|
|
23
|
-
required: void 0
|
|
24
|
-
};
|
|
25
|
-
d.propTypes = {
|
|
26
|
-
action: o.element,
|
|
27
|
-
children: o.node.isRequired,
|
|
28
|
-
required: o.bool
|
|
29
|
-
};
|
|
47
|
+
`;
|
|
30
48
|
export {
|
|
31
|
-
|
|
49
|
+
A as FieldLabel
|
|
32
50
|
};
|
|
@@ -1 +1 @@
|
|
|
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 d=require("react/jsx-runtime"),r=require("react"),l=require("../helpers/getFocusableNodes.cjs"),a=require("../helpers/keyboardKeys.cjs"),m=({onEscape:n,restoreFocus:o=!0,...f})=>{const s=r.useRef(null);r.useEffect(()=>{let e=null;return o&&(e=document.activeElement),()=>{e&&e.focus()}},[o]),r.useEffect(()=>{if(!s.current)return;const e=l.getFocusableNodes(s.current);e.length>0?e[0].focus():console.warn("[FocusTrap]: it seems there are no focusable elements in the focus trap tree. Make sure there s at least one.")},[]);const i=e=>{if(e.key===a.KeyboardKeys.ESCAPE&&n){n();return}if(e.key!==a.KeyboardKeys.TAB)return;const t=l.getFocusableNodes(s.current);if(t.length>0){const u=t[0],c=t[t.length-1];e.shiftKey?u===document.activeElement&&(e.preventDefault(),c.focus()):c===document.activeElement&&(e.preventDefault(),u.focus())}};return d.jsx("div",{ref:s,onKeyDown:i,...f})};exports.FocusTrap=m;
|
|
@@ -1,45 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { getFocusableNodes as
|
|
4
|
-
import { KeyboardKeys as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as m, useEffect as l } from "react";
|
|
3
|
+
import { getFocusableNodes as u } from "../helpers/getFocusableNodes.js";
|
|
4
|
+
import { KeyboardKeys as c } from "../helpers/keyboardKeys.js";
|
|
5
|
+
const v = ({
|
|
6
|
+
onEscape: r,
|
|
7
|
+
restoreFocus: o = !0,
|
|
8
|
+
...i
|
|
9
|
+
}) => {
|
|
10
|
+
const n = m(null);
|
|
11
|
+
return l(() => {
|
|
8
12
|
let e = null;
|
|
9
|
-
return
|
|
13
|
+
return o && (e = document.activeElement), () => {
|
|
10
14
|
e && e.focus();
|
|
11
15
|
};
|
|
12
|
-
}, [
|
|
13
|
-
if (!
|
|
16
|
+
}, [o]), l(() => {
|
|
17
|
+
if (!n.current)
|
|
14
18
|
return;
|
|
15
|
-
const e =
|
|
16
|
-
e.length > 0 ? e[0].focus() : console.warn(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
a.defaultProps = {
|
|
36
|
-
onEscape: void 0,
|
|
37
|
-
restoreFocus: !0
|
|
38
|
-
};
|
|
39
|
-
a.propTypes = {
|
|
40
|
-
onEscape: u.func,
|
|
41
|
-
restoreFocus: u.bool
|
|
19
|
+
const e = u(n.current);
|
|
20
|
+
e.length > 0 ? e[0].focus() : console.warn("[FocusTrap]: it seems there are no focusable elements in the focus trap tree. Make sure there s at least one.");
|
|
21
|
+
}, []), a("div", {
|
|
22
|
+
ref: n,
|
|
23
|
+
onKeyDown: (e) => {
|
|
24
|
+
if (e.key === c.ESCAPE && r) {
|
|
25
|
+
r();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (e.key !== c.TAB)
|
|
29
|
+
return;
|
|
30
|
+
const t = u(n.current);
|
|
31
|
+
if (t.length > 0) {
|
|
32
|
+
const s = t[0], f = t[t.length - 1];
|
|
33
|
+
e.shiftKey ? s === document.activeElement && (e.preventDefault(), f.focus()) : f === document.activeElement && (e.preventDefault(), s.focus());
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
...i
|
|
37
|
+
});
|
|
42
38
|
};
|
|
43
39
|
export {
|
|
44
|
-
|
|
40
|
+
v as FocusTrap
|
|
45
41
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),j=require("react"),v=require("styled-components"),y=require("../BaseButton/BaseButton.cjs"),B=require("../Flex/Flex.cjs"),m=require("../Tooltip/Tooltip.cjs"),x=require("../VisuallyHidden/VisuallyHidden.cjs"),_=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function R(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 o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=R(j),c=_(v),q=u.forwardRef(({label:e,background:r,borderWidth:t,noBorder:o=!1,children:d,icon:f,disabled:l=!1,onClick:a,"aria-label":p,...b},g)=>{const $=h=>{!l&&a&&a(h)},s=n.jsxs(i,{"aria-disabled":l,background:l?"neutral150":r,borderWidth:o?0:t,justifyContent:"center",height:`${2}rem`,width:`${2}rem`,...b,ref:g,onClick:$,children:[n.jsx(x.VisuallyHidden,{as:"span",children:e??p}),u.cloneElement(f||d,{"aria-hidden":!0,focusable:!1})]});return e?n.jsx(m.Tooltip,{label:e,children:s}):s}),i=c.default(y.BaseButton)`
|
|
2
2
|
svg {
|
|
3
3
|
> g,
|
|
4
4
|
path {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,O=c.default(B.Flex)`
|
|
35
35
|
& span:first-child button {
|
|
36
36
|
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
37
37
|
border-radius: ${({theme:e})=>`${e.borderRadius} 0 0 ${e.borderRadius}`};
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
border-radius: ${({theme:e})=>`0 ${e.borderRadius} ${e.borderRadius} 0`};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
& ${
|
|
44
|
+
& ${i} {
|
|
45
45
|
border-radius: 0;
|
|
46
46
|
border-left: none;
|
|
47
47
|
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
`;exports.IconButton=
|
|
81
|
+
`;exports.IconButton=q;exports.IconButtonGroup=O;
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { BaseButton as
|
|
5
|
-
import { Flex as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import { VisuallyHidden as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import s from "styled-components";
|
|
4
|
+
import { BaseButton as g } from "../BaseButton/BaseButton.js";
|
|
5
|
+
import { Flex as v } from "../Flex/Flex.js";
|
|
6
|
+
import { Tooltip as R } from "../Tooltip/Tooltip.js";
|
|
7
|
+
import { VisuallyHidden as k } from "../VisuallyHidden/VisuallyHidden.js";
|
|
8
|
+
const W = e.forwardRef(({
|
|
9
9
|
label: r,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
background: i,
|
|
11
|
+
borderWidth: c,
|
|
12
|
+
noBorder: d = !1,
|
|
13
|
+
children: u,
|
|
14
|
+
icon: f,
|
|
13
15
|
disabled: o = !1,
|
|
14
16
|
onClick: l,
|
|
15
|
-
"aria-label":
|
|
16
|
-
...
|
|
17
|
-
},
|
|
18
|
-
const t =
|
|
17
|
+
"aria-label": p,
|
|
18
|
+
...h
|
|
19
|
+
}, $) => {
|
|
20
|
+
const t = m(n, {
|
|
19
21
|
"aria-disabled": o,
|
|
20
|
-
background: o ? "neutral150" :
|
|
21
|
-
borderWidth:
|
|
22
|
+
background: o ? "neutral150" : i,
|
|
23
|
+
borderWidth: d ? 0 : c,
|
|
22
24
|
justifyContent: "center",
|
|
23
25
|
height: `${2}rem`,
|
|
24
26
|
width: `${2}rem`,
|
|
25
|
-
...
|
|
26
|
-
ref:
|
|
27
|
-
onClick: (
|
|
28
|
-
!o && l && l(
|
|
27
|
+
...h,
|
|
28
|
+
ref: $,
|
|
29
|
+
onClick: (b) => {
|
|
30
|
+
!o && l && l(b);
|
|
29
31
|
},
|
|
30
|
-
children: [
|
|
32
|
+
children: [a(k, {
|
|
31
33
|
as: "span",
|
|
32
|
-
children: r ??
|
|
33
|
-
}),
|
|
34
|
+
children: r ?? p
|
|
35
|
+
}), e.cloneElement(f || u, {
|
|
34
36
|
"aria-hidden": !0,
|
|
35
37
|
focusable: !1
|
|
36
38
|
})]
|
|
37
39
|
});
|
|
38
|
-
return r ?
|
|
40
|
+
return r ? a(R, {
|
|
39
41
|
label: r,
|
|
40
42
|
children: t
|
|
41
43
|
}) : t;
|
|
42
|
-
}),
|
|
44
|
+
}), n = s(g)`
|
|
43
45
|
svg {
|
|
44
46
|
> g,
|
|
45
47
|
path {
|
|
@@ -80,7 +82,7 @@ const I = a.forwardRef(({
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
`,
|
|
85
|
+
`, E = s(v)`
|
|
84
86
|
& span:first-child button {
|
|
85
87
|
border-left: 1px solid ${({
|
|
86
88
|
theme: r
|
|
@@ -96,7 +98,7 @@ const I = a.forwardRef(({
|
|
|
96
98
|
}) => `0 ${r.borderRadius} ${r.borderRadius} 0`};
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
& ${
|
|
101
|
+
& ${n} {
|
|
100
102
|
border-radius: 0;
|
|
101
103
|
border-left: none;
|
|
102
104
|
|
|
@@ -147,6 +149,6 @@ const I = a.forwardRef(({
|
|
|
147
149
|
}
|
|
148
150
|
`;
|
|
149
151
|
export {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
W as IconButton,
|
|
153
|
+
E as IconButtonGroup
|
|
152
154
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("react"),j=require("@codemirror/lang-json"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("react"),j=require("@codemirror/lang-json"),N=require("@uiw/react-codemirror"),k=require("./JSONInputContainer.cjs"),u=require("./utils/decorationExtension.cjs"),H=require("../Field/Field.cjs"),R=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const L=require("../Field/FieldHint.cjs"),A=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const y=require("../Flex/Flex.cjs"),z=({label:d,error:a,hint:E,labelAction:x,value:S="",required:m=!1,disabled:h=!1,onChange:q=()=>null,...p})=>{const i=l.useRef(),o=l.useRef(),c=l.useRef(),C=Boolean(a),b=e=>{const r=o.current?.doc;if(r){const{text:s,to:t}=r.line(e),g=t-s.trimStart().length;t>g&&c.current?.dispatch({effects:u.addMarks.of([u.lineHighlightMark.range(g,t)])})}},I=()=>{const e=o.current?.doc;if(e){const r=e.length||0;c.current?.dispatch({effects:u.filterMarks.of((s,t)=>t<=0||s>=r)})}},F=({state:e,view:r})=>{c.current=r,o.current=e,I();const t=j.jsonParseLinter()(r);t.length&&b(e.doc.lineAt(t[0].from).number)},O=(e,r)=>{F(r),q(e)},J=(e,r)=>{c.current=e,o.current=r,F({view:e,state:r})},{setContainer:f}=N.useCodeMirror({value:S,onCreateEditor:J,container:i.current,editable:!h,extensions:[j.json(),u.markField],onChange:O,theme:"dark",basicSetup:{lineNumbers:!0,bracketMatching:!0,closeBrackets:!0,indentOnInput:!0,syntaxHighlighting:!0,highlightSelectionMatches:!0,tabSize:2}}),M=()=>{h||i.current?.children[0].children[1].children[1]?.focus()};return l.useEffect(()=>{const e=i.current;e&&f(e)},[f]),n.jsx(H.Field,{error:a,hint:E,required:m,children:n.jsxs(y.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[d&&n.jsx(R.FieldLabel,{onClick:M,action:x,children:d}),n.jsx(k.JSONInputContainer,{ref:i,hasError:C,alignItems:"stretch",fontSize:2,hasRadius:!0,...p}),n.jsx(A.FieldError,{}),n.jsx(L.FieldHint,{})]})})};exports.JSONInput=z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as O } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as l, useEffect as J } from "react";
|
|
3
3
|
import { json as j, jsonParseLinter as H } from "@codemirror/lang-json";
|
|
4
4
|
import { useCodeMirror as L } from "@uiw/react-codemirror";
|
|
@@ -11,8 +11,8 @@ import { FieldHint as V } from "../Field/FieldHint.js";
|
|
|
11
11
|
import { FieldError as D } from "../Field/FieldError.js";
|
|
12
12
|
import "../Field/FieldContext.js";
|
|
13
13
|
import "../Field/FieldAction.js";
|
|
14
|
-
import {
|
|
15
|
-
const
|
|
14
|
+
import { Flex as G } from "../Flex/Flex.js";
|
|
15
|
+
const er = ({
|
|
16
16
|
label: a,
|
|
17
17
|
error: d,
|
|
18
18
|
hint: p,
|
|
@@ -23,35 +23,35 @@ const nr = ({
|
|
|
23
23
|
onChange: k = () => null,
|
|
24
24
|
...C
|
|
25
25
|
}) => {
|
|
26
|
-
const o = l(), i = l(), c = l(),
|
|
26
|
+
const o = l(), i = l(), c = l(), F = Boolean(d), b = (r) => {
|
|
27
27
|
const t = i.current?.doc;
|
|
28
28
|
if (t) {
|
|
29
29
|
const {
|
|
30
30
|
text: s,
|
|
31
|
-
to:
|
|
32
|
-
} = t.line(r), m =
|
|
33
|
-
|
|
34
|
-
effects: B.of([R.range(m,
|
|
31
|
+
to: e
|
|
32
|
+
} = t.line(r), m = e - s.trimStart().length;
|
|
33
|
+
e > m && c.current?.dispatch({
|
|
34
|
+
effects: B.of([R.range(m, e)])
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
},
|
|
37
|
+
}, x = () => {
|
|
38
38
|
const r = i.current?.doc;
|
|
39
39
|
if (r) {
|
|
40
40
|
const t = r.length || 0;
|
|
41
41
|
c.current?.dispatch({
|
|
42
|
-
effects: q.of((s,
|
|
42
|
+
effects: q.of((s, e) => e <= 0 || s >= t)
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}, f = ({
|
|
46
46
|
state: r,
|
|
47
47
|
view: t
|
|
48
48
|
}) => {
|
|
49
|
-
c.current = t, i.current = r,
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
},
|
|
49
|
+
c.current = t, i.current = r, x();
|
|
50
|
+
const e = H()(t);
|
|
51
|
+
e.length && b(r.doc.lineAt(e[0].from).number);
|
|
52
|
+
}, M = (r, t) => {
|
|
53
53
|
f(t), k(r);
|
|
54
|
-
},
|
|
54
|
+
}, I = (r, t) => {
|
|
55
55
|
c.current = r, i.current = t, f({
|
|
56
56
|
view: r,
|
|
57
57
|
state: t
|
|
@@ -60,11 +60,11 @@ const nr = ({
|
|
|
60
60
|
setContainer: h
|
|
61
61
|
} = L({
|
|
62
62
|
value: E,
|
|
63
|
-
onCreateEditor:
|
|
63
|
+
onCreateEditor: I,
|
|
64
64
|
container: o.current,
|
|
65
65
|
editable: !u,
|
|
66
66
|
extensions: [j(), A],
|
|
67
|
-
onChange:
|
|
67
|
+
onChange: M,
|
|
68
68
|
theme: "dark",
|
|
69
69
|
basicSetup: {
|
|
70
70
|
lineNumbers: !0,
|
|
@@ -75,33 +75,35 @@ const nr = ({
|
|
|
75
75
|
highlightSelectionMatches: !0,
|
|
76
76
|
tabSize: 2
|
|
77
77
|
}
|
|
78
|
-
}),
|
|
78
|
+
}), N = () => {
|
|
79
79
|
u || o.current?.children[0].children[1].children[1]?.focus();
|
|
80
80
|
};
|
|
81
81
|
return J(() => {
|
|
82
82
|
const r = o.current;
|
|
83
83
|
r && h(r);
|
|
84
|
-
}, [h]),
|
|
84
|
+
}, [h]), n(y, {
|
|
85
85
|
error: d,
|
|
86
86
|
hint: p,
|
|
87
87
|
required: S,
|
|
88
|
-
children:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
children: O(G, {
|
|
89
|
+
direction: "column",
|
|
90
|
+
alignItems: "stretch",
|
|
91
|
+
gap: 1,
|
|
92
|
+
children: [a && n(P, {
|
|
93
|
+
onClick: N,
|
|
92
94
|
action: g,
|
|
93
95
|
children: a
|
|
94
|
-
}),
|
|
96
|
+
}), n(z, {
|
|
95
97
|
ref: o,
|
|
96
|
-
hasError:
|
|
98
|
+
hasError: F,
|
|
97
99
|
alignItems: "stretch",
|
|
98
100
|
fontSize: 2,
|
|
99
101
|
hasRadius: !0,
|
|
100
102
|
...C
|
|
101
|
-
}),
|
|
103
|
+
}), n(D, {}), n(V, {})]
|
|
102
104
|
})
|
|
103
105
|
});
|
|
104
106
|
};
|
|
105
107
|
export {
|
|
106
|
-
|
|
108
|
+
er as JSONInput
|
|
107
109
|
};
|