@povio/ui 3.3.0-rc.4 → 3.4.0-rc.1

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 (125) hide show
  1. package/README.md +15 -1
  2. package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  4. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  5. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -2
  6. package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
  7. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  8. package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
  9. package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
  10. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
  11. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +97 -238
  12. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
  13. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +88 -214
  14. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
  15. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +64 -143
  16. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
  17. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
  18. package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
  19. package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
  20. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
  21. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
  22. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
  23. package/dist/components/inputs/DateTime/shared/DateField.js +135 -306
  24. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
  25. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -343
  26. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  27. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
  28. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
  29. package/dist/components/inputs/File/FileUpload.d.ts +1 -1
  30. package/dist/components/inputs/File/FileUpload.js +18 -18
  31. package/dist/components/inputs/File/InputUpload.d.ts +1 -1
  32. package/dist/components/inputs/File/InputUpload.js +82 -278
  33. package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
  34. package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
  35. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
  36. package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
  37. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
  38. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
  39. package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
  40. package/dist/components/inputs/FormField/FormField.js +34 -47
  41. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
  42. package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
  43. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
  44. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +93 -331
  45. package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
  46. package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
  47. package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
  48. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
  49. package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
  50. package/dist/components/inputs/Inputs/Form.d.ts +4 -4
  51. package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
  52. package/dist/components/inputs/Inputs/InputItem.js +35 -36
  53. package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
  54. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
  55. package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
  56. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
  57. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +26 -86
  58. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  59. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
  60. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
  61. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
  62. package/dist/components/inputs/Selection/Select/QuerySelect.js +49 -115
  63. package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
  64. package/dist/components/inputs/Selection/Select/Select.js +22 -22
  65. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
  66. package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
  67. package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
  68. package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
  69. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  70. package/dist/components/inputs/Selection/shared/select.context.js +4 -8
  71. package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
  72. package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
  73. package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
  74. package/dist/components/inputs/Slider/Slider.d.ts +1 -1
  75. package/dist/components/inputs/Slider/Slider.js +18 -18
  76. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
  77. package/dist/components/inputs/TextEditor/TextEditor.js +105 -407
  78. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
  79. package/dist/components/inputs/Toggle/Toggle.js +59 -63
  80. package/dist/components/inputs/shared/InputClear.js +24 -40
  81. package/dist/components/inputs/shared/form.binding.d.ts +27 -0
  82. package/dist/components/inputs/shared/form.binding.js +57 -0
  83. package/dist/components/inputs/shared/form.types.d.ts +9 -8
  84. package/dist/components/inputs/shared/form.types.js +8 -0
  85. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  86. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  87. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  88. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  89. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
  90. package/dist/components/segment/Segment.d.ts +1 -1
  91. package/dist/components/segment/Segment.js +17 -17
  92. package/dist/components/segment/segment.types.d.ts +1 -1
  93. package/dist/components/shared/pagination/Pagination.js +22 -108
  94. package/dist/components/status/Alert/Alert.js +30 -97
  95. package/dist/components/table/InfiniteTable.js +16 -67
  96. package/dist/components/table/Table.d.ts +2 -8
  97. package/dist/components/table/Table.js +33 -55
  98. package/dist/components/text/Typography/Typography.js +8 -23
  99. package/dist/config/confirmation.context.js +1 -1
  100. package/dist/config/theme.context.js +45 -98
  101. package/dist/config/uiConfig.context.d.ts +5 -5
  102. package/dist/config/uiConfig.context.js +11 -51
  103. package/dist/config/uiOverrides.context.d.ts +0 -1
  104. package/dist/helpers/dynamicColumns.d.ts +1 -1
  105. package/dist/helpers/dynamicInputs.d.ts +7 -7
  106. package/dist/hooks/useAutosave.d.ts +4 -4
  107. package/dist/hooks/useAutosave.js +64 -49
  108. package/dist/hooks/useDebounceCallback.js +17 -51
  109. package/dist/hooks/useForm.d.ts +39 -15
  110. package/dist/hooks/useForm.js +96 -43
  111. package/dist/hooks/useFormAutosave.d.ts +8 -9
  112. package/dist/hooks/useFormAutosave.js +49 -122
  113. package/dist/hooks/useLongPressRepeat.js +20 -55
  114. package/dist/index.d.ts +2 -3
  115. package/dist/index.js +3 -4
  116. package/package.json +3 -4
  117. package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
  118. package/dist/components/inputs/FormField/formField.cva.js +0 -16
  119. package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
  120. package/dist/components/table/TableColumnFilterInput.js +0 -108
  121. package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
  122. package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
  123. package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
  124. package/dist/components/table/TableColumnFilterRow.js +0 -68
  125. package/dist/hooks/useAutosave.spec.d.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { FocusEvent, Ref } from 'react';
2
2
  import { SliderProps as AriaSliderProps } from 'react-aria-components';
3
- import { FieldValues } from 'react-hook-form';
3
+ import { FieldValues } from '../shared/form.binding';
4
4
  import { FormFieldProps } from '../FormField/FormField';
5
5
  import { ControlProps } from '../shared/form.types';
6
6
  type SliderValue<IsRange extends boolean = false> = IsRange extends false ? number : number[];
@@ -1,13 +1,13 @@
1
1
  import { Typography } from "../../text/Typography/Typography.js";
2
2
  import { UIConfig } from "../../../config/uiConfig.context.js";
3
3
  import { uiOutlineClass } from "../../outline.clsx.js";
4
+ import { FieldController } from "../shared/form.binding.js";
4
5
  import { FormField } from "../FormField/FormField.js";
5
6
  import { c } from "react/compiler-runtime";
6
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
8
  import { clsx } from "clsx";
8
9
  import { Slider, SliderThumb, SliderTrack } from "react-aria-components";
9
10
  import { mergeRefs } from "@react-aria/utils";
10
- import { Controller } from "react-hook-form";
11
11
  //#region src/components/inputs/Slider/Slider.tsx
12
12
  var SliderBase = (props) => {
13
13
  const $ = c(61);
@@ -223,33 +223,33 @@ var SliderBase = (props) => {
223
223
  };
224
224
  var Slider$1 = (props) => {
225
225
  const $ = c(15);
226
- if ("formControl" in props && props.formControl) {
227
- let formControl;
226
+ if ("field" in props && props.field) {
227
+ let field;
228
228
  let innerProps;
229
229
  let ref;
230
230
  if ($[0] !== props) {
231
- ({formControl, ref, ...innerProps} = props);
231
+ ({field, ref, ...innerProps} = props);
232
232
  $[0] = props;
233
- $[1] = formControl;
233
+ $[1] = field;
234
234
  $[2] = innerProps;
235
235
  $[3] = ref;
236
236
  } else {
237
- formControl = $[1];
237
+ field = $[1];
238
238
  innerProps = $[2];
239
239
  ref = $[3];
240
240
  }
241
241
  let t0;
242
242
  if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
243
243
  t0 = (t1) => {
244
- const { field, fieldState: t2 } = t1;
244
+ const { field: field_0, fieldState: t2 } = t1;
245
245
  const { error } = t2;
246
246
  return /* @__PURE__ */ jsx(SliderBase, {
247
247
  ...innerProps,
248
- ref: mergeRefs(ref, field.ref),
249
- value: field.value,
250
- onBlur: field.onBlur,
251
- onChange: field.onChange,
252
- isDisabled: field.disabled || props.isDisabled,
248
+ ref: mergeRefs(ref, field_0.ref),
249
+ value: field_0.value,
250
+ onBlur: field_0.onBlur,
251
+ onChange: field_0.onChange,
252
+ isDisabled: field_0.disabled || props.isDisabled,
253
253
  error: props.error ?? error?.message
254
254
  });
255
255
  };
@@ -260,14 +260,14 @@ var Slider$1 = (props) => {
260
260
  $[8] = t0;
261
261
  } else t0 = $[8];
262
262
  let t1;
263
- if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
264
- t1 = /* @__PURE__ */ jsx(Controller, {
265
- control: formControl.control,
266
- name: formControl.name,
263
+ if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
264
+ t1 = /* @__PURE__ */ jsx(FieldController, {
265
+ control: field.form,
266
+ name: field.name,
267
267
  render: t0
268
268
  });
269
- $[9] = formControl.control;
270
- $[10] = formControl.name;
269
+ $[9] = field.form;
270
+ $[10] = field.name;
271
271
  $[11] = t0;
272
272
  $[12] = t1;
273
273
  } else t1 = $[12];
@@ -1,6 +1,6 @@
1
1
  import { JSONContent } from '@tiptap/react';
2
2
  import { Ref } from 'react';
3
- import { FieldValues } from 'react-hook-form';
3
+ import { FieldValues } from '../shared/form.binding';
4
4
  import { FormFieldProps } from '../FormField/FormField';
5
5
  import { ControlProps } from '../shared/form.types';
6
6
  export interface TextEditorValue {
@@ -1,6 +1,7 @@
1
1
  import { UIOverrides } from "../../../config/uiOverrides.context.js";
2
2
  import { isEqual } from "../../../utils/isEqual.js";
3
3
  import { uiOutlineClass } from "../../outline.clsx.js";
4
+ import { FieldController } from "../shared/form.binding.js";
4
5
  import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
5
6
  import { FormField } from "../FormField/FormField.js";
6
7
  import { inputSideDefinition } from "../shared/input.cva.js";
@@ -11,7 +12,6 @@ import { clsx } from "clsx";
11
12
  import { useEffect, useRef, useState } from "react";
12
13
  import { useFocusVisible, useFocusWithin, useHover, useLabel } from "react-aria";
13
14
  import { mergeRefs } from "@react-aria/utils";
14
- import { Controller } from "react-hook-form";
15
15
  import { Color } from "@tiptap/extension-color";
16
16
  import { Highlight } from "@tiptap/extension-highlight";
17
17
  import { Link } from "@tiptap/extension-link";
@@ -38,434 +38,132 @@ var extensions = [
38
38
  defaultProtocol: "https"
39
39
  })
40
40
  ];
41
- var TextEditorBase = (t0) => {
42
- const $ = c(132);
43
- const { ref, as: t1, placeholder, label, hideLabel, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, value, className, editorClassName, isDirty, onChange, onBlur } = t0;
44
- const as = t1 === void 0 ? "default" : t1;
41
+ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, value, className, editorClassName, isDirty, onChange, onBlur }) => {
45
42
  const contentRef = useRef(null);
46
- let t2;
47
- if ($[0] !== isDisabled) {
48
- t2 = { isDisabled };
49
- $[0] = isDisabled;
50
- $[1] = t2;
51
- } else t2 = $[1];
52
- const { hoverProps, isHovered } = useHover(t2);
43
+ const { hoverProps, isHovered } = useHover({ isDisabled });
53
44
  const [isFocused, setIsFocused] = useState(false);
54
- let t3;
55
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
56
- t3 = { onFocusWithinChange: setIsFocused };
57
- $[2] = t3;
58
- } else t3 = $[2];
59
- const { focusWithinProps } = useFocusWithin(t3);
45
+ const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
60
46
  const { isFocusVisible } = useFocusVisible();
61
47
  const inputSideCva = UIOverrides.useCva("input.sideCva", inputSideDefinition);
62
- const t4 = isHeaderHidden || as === "filter" || as === "floating";
63
- let t5;
64
- if ($[3] !== error || $[4] !== errorClassName || $[5] !== headerClassName || $[6] !== helperText || $[7] !== hideLabel || $[8] !== isDisabled || $[9] !== isRequired || $[10] !== label || $[11] !== rightContent || $[12] !== t4 || $[13] !== tooltipText) {
65
- t5 = {
66
- error,
67
- label,
68
- tooltipText,
69
- helperText,
70
- isRequired,
71
- rightContent,
72
- isHeaderHidden: t4,
73
- hideLabel,
74
- isDisabled,
75
- headerClassName,
76
- errorClassName
77
- };
78
- $[3] = error;
79
- $[4] = errorClassName;
80
- $[5] = headerClassName;
81
- $[6] = helperText;
82
- $[7] = hideLabel;
83
- $[8] = isDisabled;
84
- $[9] = isRequired;
85
- $[10] = label;
86
- $[11] = rightContent;
87
- $[12] = t4;
88
- $[13] = tooltipText;
89
- $[14] = t5;
90
- } else t5 = $[14];
91
- const formFieldProps = t5;
92
- let t6;
93
- if ($[15] !== label) {
94
- t6 = { label };
95
- $[15] = label;
96
- $[16] = t6;
97
- } else t6 = $[16];
98
- const { labelProps, fieldProps } = useLabel(t6);
99
- let t7;
100
- if ($[17] !== as || $[18] !== placeholder) {
101
- t7 = Placeholder.configure({ placeholder: as === "floating" ? "" : placeholder });
102
- $[17] = as;
103
- $[18] = placeholder;
104
- $[19] = t7;
105
- } else t7 = $[19];
106
- let t8;
107
- if ($[20] !== t7) {
108
- t8 = [...extensions, t7];
109
- $[20] = t7;
110
- $[21] = t8;
111
- } else t8 = $[21];
112
- let t9;
113
- if ($[22] !== editorClassName) {
114
- t9 = clsx("min-h-40 rounded-b-sm p-2 outline-none", editorClassName);
115
- $[22] = editorClassName;
116
- $[23] = t9;
117
- } else t9 = $[23];
118
- let t10;
119
- if ($[24] !== t9) {
120
- t10 = { attributes: { class: t9 } };
121
- $[24] = t9;
122
- $[25] = t10;
123
- } else t10 = $[25];
124
- let t11;
125
- if ($[26] !== onChange) {
126
- t11 = (event) => {
48
+ const formFieldProps = {
49
+ error,
50
+ label,
51
+ tooltipText,
52
+ helperText,
53
+ isRequired,
54
+ rightContent,
55
+ isHeaderHidden: isHeaderHidden || as === "filter" || as === "floating",
56
+ hideLabel,
57
+ isDisabled,
58
+ headerClassName,
59
+ errorClassName
60
+ };
61
+ const { labelProps, fieldProps } = useLabel({ label });
62
+ const editor = useEditor({
63
+ extensions: [...extensions, Placeholder.configure({ placeholder: as === "floating" ? "" : placeholder })],
64
+ editorProps: { attributes: { class: clsx("min-h-40 rounded-b-sm p-2 outline-none", editorClassName) } },
65
+ onUpdate: (event) => {
127
66
  onChange?.({
128
67
  json: event.editor.getJSON(),
129
68
  html: event.editor.getHTML()
130
69
  });
131
- };
132
- $[26] = onChange;
133
- $[27] = t11;
134
- } else t11 = $[27];
135
- const t12 = !isDisabled;
136
- let t13;
137
- if ($[28] !== onBlur || $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t8) {
138
- t13 = {
139
- extensions: t8,
140
- editorProps: t10,
141
- onUpdate: t11,
142
- immediatelyRender: false,
143
- editable: t12,
144
- onBlur
145
- };
146
- $[28] = onBlur;
147
- $[29] = t10;
148
- $[30] = t11;
149
- $[31] = t12;
150
- $[32] = t8;
151
- $[33] = t13;
152
- } else t13 = $[33];
153
- let t14;
154
- if ($[34] !== editorClassName || $[35] !== isDisabled) {
155
- t14 = [isDisabled, editorClassName];
156
- $[34] = editorClassName;
157
- $[35] = isDisabled;
158
- $[36] = t14;
159
- } else t14 = $[36];
160
- const editor = useEditor(t13, t14);
161
- let t15;
162
- if ($[37] !== editor || $[38] !== value?.json) {
163
- t15 = () => {
164
- const content = value?.json ?? null;
165
- if (editor) {
166
- if (!isEqual(content, editor.getJSON())) editor.commands.setContent(content);
167
- } else if (!isEqual(content, contentRef.current)) contentRef.current = content ?? null;
168
- };
169
- $[37] = editor;
170
- $[38] = value?.json;
171
- $[39] = t15;
172
- } else t15 = $[39];
173
- let t16;
174
- if ($[40] !== value) {
175
- t16 = [value];
176
- $[40] = value;
177
- $[41] = t16;
178
- } else t16 = $[41];
179
- useEffect(t15, t16);
180
- let t17;
181
- let t18;
182
- if ($[42] !== editor) {
183
- t17 = () => {
184
- if (editor && contentRef.current) {
185
- editor.commands.setContent(contentRef.current);
186
- contentRef.current = null;
187
- }
188
- };
189
- t18 = [editor];
190
- $[42] = editor;
191
- $[43] = t17;
192
- $[44] = t18;
193
- } else {
194
- t17 = $[43];
195
- t18 = $[44];
196
- }
197
- useEffect(t17, t18);
198
- const t19 = hideLabel || isHeaderHidden;
199
- let T0;
200
- let t20;
201
- let t21;
202
- let t22;
203
- let t23;
204
- let t24;
205
- let t25;
206
- let t26;
207
- let t27;
208
- let t28;
209
- let t29;
210
- let t30;
211
- let t31;
212
- let t32;
213
- let t33;
214
- let t34;
215
- let t35;
216
- let t36;
217
- let t37;
218
- let t38;
219
- let t39;
220
- let t40;
221
- let t41;
222
- if ($[45] !== as || $[46] !== className || $[47] !== editor || $[48] !== fieldProps || $[49] !== focusWithinProps || $[50] !== formFieldProps || $[51] !== headerClassName || $[52] !== helperText || $[53] !== hoverProps || $[54] !== inputSideCva || $[55] !== isDirty || $[56] !== isDisabled || $[57] !== isFocusVisible || $[58] !== isFocused || $[59] !== isHovered || $[60] !== isRequired || $[61] !== label || $[62] !== labelProps || $[63] !== ref || $[64] !== rightContent || $[65] !== t19 || $[66] !== tooltipText) {
223
- const headerProps = {
224
- label,
225
- tooltipText,
226
- helperText,
227
- isRequired,
228
- rightContent,
229
- isHeaderHidden: t19,
230
- isDisabled,
231
- className: headerClassName,
232
- labelProps
233
- };
234
- T0 = FormField;
235
- t37 = formFieldProps;
236
- t38 = ref;
237
- t39 = as;
238
- t40 = labelProps;
239
- if ($[90] !== className) {
240
- t41 = clsx("group w-full", className);
241
- $[90] = className;
242
- $[91] = t41;
243
- } else t41 = $[91];
244
- if ($[92] === Symbol.for("react.memo_cache_sentinel")) {
245
- t22 = clsx("group/text-editor relative", "h-full w-full rounded-sm border border-elevation-outline-default-2 border-solid bg-elevation-fill-default-1", uiOutlineClass, "focus-within:border focus-within:border-input-outlined-outline-active", "focus-visible:outline-interactive-contained-primary-focus", "hover:border hover:border-input-outlined-outline-hover");
246
- $[92] = t22;
247
- } else t22 = $[92];
248
- t23 = true;
249
- t24 = "";
250
- t25 = isHovered || void 0;
251
- t26 = isDisabled || void 0;
252
- t27 = isDisabled || void 0;
253
- t28 = isFocused || void 0;
254
- t29 = isFocused && isFocusVisible || void 0;
255
- t30 = !editor?.isEmpty;
256
- t31 = isRequired || void 0;
257
- t32 = isDirty || void 0;
258
- t33 = hoverProps;
259
- t34 = focusWithinProps;
260
- t35 = fieldProps;
261
- if ($[93] !== editor) {
262
- t36 = /* @__PURE__ */ jsx(TextEditorToolbar, { editor });
263
- $[93] = editor;
264
- $[94] = t36;
265
- } else t36 = $[94];
266
- const t42 = as === "floating" && "pt-3";
267
- if ($[95] !== t42) {
268
- t20 = clsx("relative overflow-auto", t42);
269
- $[95] = t42;
270
- $[96] = t20;
271
- } else t20 = $[96];
272
- t21 = as === "floating" && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
273
- as,
274
- ...headerProps,
275
- className: clsx(headerProps.className, inputSideCva({
276
- size: "default",
277
- type: "left"
278
- }))
279
- });
280
- $[45] = as;
281
- $[46] = className;
282
- $[47] = editor;
283
- $[48] = fieldProps;
284
- $[49] = focusWithinProps;
285
- $[50] = formFieldProps;
286
- $[51] = headerClassName;
287
- $[52] = helperText;
288
- $[53] = hoverProps;
289
- $[54] = inputSideCva;
290
- $[55] = isDirty;
291
- $[56] = isDisabled;
292
- $[57] = isFocusVisible;
293
- $[58] = isFocused;
294
- $[59] = isHovered;
295
- $[60] = isRequired;
296
- $[61] = label;
297
- $[62] = labelProps;
298
- $[63] = ref;
299
- $[64] = rightContent;
300
- $[65] = t19;
301
- $[66] = tooltipText;
302
- $[67] = T0;
303
- $[68] = t20;
304
- $[69] = t21;
305
- $[70] = t22;
306
- $[71] = t23;
307
- $[72] = t24;
308
- $[73] = t25;
309
- $[74] = t26;
310
- $[75] = t27;
311
- $[76] = t28;
312
- $[77] = t29;
313
- $[78] = t30;
314
- $[79] = t31;
315
- $[80] = t32;
316
- $[81] = t33;
317
- $[82] = t34;
318
- $[83] = t35;
319
- $[84] = t36;
320
- $[85] = t37;
321
- $[86] = t38;
322
- $[87] = t39;
323
- $[88] = t40;
324
- $[89] = t41;
325
- } else {
326
- T0 = $[67];
327
- t20 = $[68];
328
- t21 = $[69];
329
- t22 = $[70];
330
- t23 = $[71];
331
- t24 = $[72];
332
- t25 = $[73];
333
- t26 = $[74];
334
- t27 = $[75];
335
- t28 = $[76];
336
- t29 = $[77];
337
- t30 = $[78];
338
- t31 = $[79];
339
- t32 = $[80];
340
- t33 = $[81];
341
- t34 = $[82];
342
- t35 = $[83];
343
- t36 = $[84];
344
- t37 = $[85];
345
- t38 = $[86];
346
- t39 = $[87];
347
- t40 = $[88];
348
- t41 = $[89];
349
- }
350
- const t42 = as === "floating" ? "" : placeholder;
351
- const t43 = as === "floating" && editor?.isEmpty && "[&_p:before]:opacity-0";
352
- let t44;
353
- if ($[97] !== t43) {
354
- t44 = clsx(t43);
355
- $[97] = t43;
356
- $[98] = t44;
357
- } else t44 = $[98];
358
- let t45;
359
- if ($[99] !== editor || $[100] !== t42 || $[101] !== t44) {
360
- t45 = /* @__PURE__ */ jsx(EditorContent, {
361
- editor,
362
- placeholder: t42,
363
- className: t44
364
- });
365
- $[99] = editor;
366
- $[100] = t42;
367
- $[101] = t44;
368
- $[102] = t45;
369
- } else t45 = $[102];
370
- let t46;
371
- if ($[103] !== t20 || $[104] !== t21 || $[105] !== t45) {
372
- t46 = /* @__PURE__ */ jsxs("div", {
373
- className: t20,
374
- children: [t21, t45]
375
- });
376
- $[103] = t20;
377
- $[104] = t21;
378
- $[105] = t45;
379
- $[106] = t46;
380
- } else t46 = $[106];
381
- let t47;
382
- if ($[107] !== t22 || $[108] !== t23 || $[109] !== t24 || $[110] !== t25 || $[111] !== t26 || $[112] !== t27 || $[113] !== t28 || $[114] !== t29 || $[115] !== t30 || $[116] !== t31 || $[117] !== t32 || $[118] !== t33 || $[119] !== t34 || $[120] !== t35 || $[121] !== t36 || $[122] !== t46) {
383
- t47 = /* @__PURE__ */ jsxs("div", {
384
- className: t22,
385
- "data-text-editor": t23,
386
- "data-rac": t24,
387
- "data-hovered": t25,
388
- "data-disabled": t26,
389
- "data-is-disabled": t27,
390
- "data-focus-within": t28,
391
- "data-focus-visible": t29,
392
- "data-is-filled": t30,
393
- "data-is-required": t31,
394
- "data-is-dirty": t32,
395
- ...t33,
396
- ...t34,
397
- ...t35,
398
- children: [t36, t46]
399
- });
400
- $[107] = t22;
401
- $[108] = t23;
402
- $[109] = t24;
403
- $[110] = t25;
404
- $[111] = t26;
405
- $[112] = t27;
406
- $[113] = t28;
407
- $[114] = t29;
408
- $[115] = t30;
409
- $[116] = t31;
410
- $[117] = t32;
411
- $[118] = t33;
412
- $[119] = t34;
413
- $[120] = t35;
414
- $[121] = t36;
415
- $[122] = t46;
416
- $[123] = t47;
417
- } else t47 = $[123];
418
- let t48;
419
- if ($[124] !== T0 || $[125] !== t37 || $[126] !== t38 || $[127] !== t39 || $[128] !== t40 || $[129] !== t41 || $[130] !== t47) {
420
- t48 = /* @__PURE__ */ jsx(T0, {
421
- ...t37,
422
- ref: t38,
423
- as: t39,
424
- labelProps: t40,
425
- className: t41,
426
- children: t47
427
- });
428
- $[124] = T0;
429
- $[125] = t37;
430
- $[126] = t38;
431
- $[127] = t39;
432
- $[128] = t40;
433
- $[129] = t41;
434
- $[130] = t47;
435
- $[131] = t48;
436
- } else t48 = $[131];
437
- return t48;
70
+ },
71
+ immediatelyRender: false,
72
+ editable: !isDisabled,
73
+ onBlur
74
+ }, [isDisabled, editorClassName]);
75
+ useEffect(() => {
76
+ const content = value?.json ?? null;
77
+ if (editor) {
78
+ if (!isEqual(content, editor.getJSON())) editor.commands.setContent(content);
79
+ } else if (!isEqual(content, contentRef.current)) contentRef.current = content ?? null;
80
+ }, [value]);
81
+ useEffect(() => {
82
+ if (editor && contentRef.current) {
83
+ editor.commands.setContent(contentRef.current);
84
+ contentRef.current = null;
85
+ }
86
+ }, [editor]);
87
+ const headerProps = {
88
+ label,
89
+ tooltipText,
90
+ helperText,
91
+ isRequired,
92
+ rightContent,
93
+ isHeaderHidden: hideLabel || isHeaderHidden,
94
+ isDisabled,
95
+ className: headerClassName,
96
+ labelProps
97
+ };
98
+ return /* @__PURE__ */ jsx(FormField, {
99
+ ...formFieldProps,
100
+ ref,
101
+ as,
102
+ labelProps,
103
+ className: clsx("group w-full", className),
104
+ children: /* @__PURE__ */ jsxs("div", {
105
+ className: clsx("group/text-editor relative", "h-full w-full rounded-sm border border-elevation-outline-default-2 border-solid bg-elevation-fill-default-1", uiOutlineClass, "focus-within:border focus-within:border-input-outlined-outline-active", "focus-visible:outline-interactive-contained-primary-focus", "hover:border hover:border-input-outlined-outline-hover"),
106
+ "data-text-editor": true,
107
+ "data-rac": "",
108
+ "data-hovered": isHovered || void 0,
109
+ "data-disabled": isDisabled || void 0,
110
+ "data-is-disabled": isDisabled || void 0,
111
+ "data-focus-within": isFocused || void 0,
112
+ "data-focus-visible": isFocused && isFocusVisible || void 0,
113
+ "data-is-filled": !editor?.isEmpty,
114
+ "data-is-required": isRequired || void 0,
115
+ "data-is-dirty": isDirty || void 0,
116
+ ...hoverProps,
117
+ ...focusWithinProps,
118
+ ...fieldProps,
119
+ children: [/* @__PURE__ */ jsx(TextEditorToolbar, { editor }), /* @__PURE__ */ jsxs("div", {
120
+ className: clsx("relative overflow-auto", as === "floating" && "pt-3"),
121
+ children: [as === "floating" && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
122
+ as,
123
+ ...headerProps,
124
+ className: clsx(headerProps.className, inputSideCva({
125
+ size: "default",
126
+ type: "left"
127
+ }))
128
+ }), /* @__PURE__ */ jsx(EditorContent, {
129
+ editor,
130
+ placeholder: as === "floating" ? "" : placeholder,
131
+ className: clsx(as === "floating" && editor?.isEmpty && "[&_p:before]:opacity-0")
132
+ })]
133
+ })]
134
+ })
135
+ });
438
136
  };
439
137
  var TextEditor = (props) => {
440
138
  const $ = c(15);
441
- if ("formControl" in props && props.formControl) {
442
- let formControl;
139
+ if ("field" in props && props.field) {
140
+ let field;
443
141
  let innerProps;
444
142
  let ref;
445
143
  if ($[0] !== props) {
446
- ({formControl, ref, ...innerProps} = props);
144
+ ({field, ref, ...innerProps} = props);
447
145
  $[0] = props;
448
- $[1] = formControl;
146
+ $[1] = field;
449
147
  $[2] = innerProps;
450
148
  $[3] = ref;
451
149
  } else {
452
- formControl = $[1];
150
+ field = $[1];
453
151
  innerProps = $[2];
454
152
  ref = $[3];
455
153
  }
456
154
  let t0;
457
155
  if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
458
156
  t0 = (t1) => {
459
- const { field, fieldState: t2 } = t1;
157
+ const { field: field_0, fieldState: t2 } = t1;
460
158
  const { error, isDirty } = t2;
461
159
  return /* @__PURE__ */ jsx(TextEditorBase, {
462
160
  ...innerProps,
463
- ref: mergeRefs(ref, field.ref),
464
- value: field.value,
465
- onChange: field.onChange,
466
- onBlur: field.onBlur,
161
+ ref: mergeRefs(ref, field_0.ref),
162
+ value: field_0.value,
163
+ onChange: field_0.onChange,
164
+ onBlur: field_0.onBlur,
467
165
  isDirty,
468
- isDisabled: field.disabled || props.isDisabled,
166
+ isDisabled: field_0.disabled || props.isDisabled,
469
167
  error: props.error ?? error?.message
470
168
  });
471
169
  };
@@ -476,14 +174,14 @@ var TextEditor = (props) => {
476
174
  $[8] = t0;
477
175
  } else t0 = $[8];
478
176
  let t1;
479
- if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
480
- t1 = /* @__PURE__ */ jsx(Controller, {
481
- control: formControl.control,
482
- name: formControl.name,
177
+ if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
178
+ t1 = /* @__PURE__ */ jsx(FieldController, {
179
+ control: field.form,
180
+ name: field.name,
483
181
  render: t0
484
182
  });
485
- $[9] = formControl.control;
486
- $[10] = formControl.name;
183
+ $[9] = field.form;
184
+ $[10] = field.name;
487
185
  $[11] = t0;
488
186
  $[12] = t1;
489
187
  } else t1 = $[12];
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'react';
2
2
  import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
3
- import { FieldValues } from 'react-hook-form';
3
+ import { FieldValues } from '../shared/form.binding';
4
4
  import { FormFieldErrorProps } from '../FormField/FormFieldError';
5
5
  import { ControlProps } from '../shared/form.types';
6
6
  import { ToggleVariantProps } from './toggle.cva';
@@ -9,7 +9,6 @@ interface ToggleBaseProps extends FormFieldErrorProps, ToggleVariantProps, Omit<
9
9
  children?: string;
10
10
  isDirty?: boolean;
11
11
  isRequired?: boolean;
12
- fireBlurOnChange?: boolean;
13
12
  }
14
13
  export type ToggleProps = ToggleBaseProps;
15
14
  export type ControlledToggleProps<TFieldValues extends FieldValues> = ControlProps<ToggleProps, TFieldValues, "isSelected">;