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