@povio/ui 3.4.0-rc.1 → 3.4.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/assets/locales/en/translation.json.d.ts +158 -0
  2. package/dist/assets/locales/sl/translation.json.d.ts +154 -0
  3. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +2 -1
  4. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +2 -1
  5. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +6 -4
  6. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +2 -1
  7. package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
  8. package/dist/components/inputs/DateTime/shared/DateField.js +2 -2
  9. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +3 -2
  10. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +2 -2
  11. package/dist/components/inputs/Inputs/Form.js +1 -1
  12. package/dist/components/inputs/Inputs/InputItem.d.ts +1 -1
  13. package/dist/components/inputs/Inputs/InputItem.js +1 -1
  14. package/dist/components/inputs/Selection/shared/select.context.js +21 -8
  15. package/dist/components/inputs/Skeleton/InputFrame.js +6 -3
  16. package/dist/components/inputs/shared/InputClear.js +42 -25
  17. package/dist/components/table/Table.js +1 -1
  18. package/dist/config/uiConfig.context.d.ts +13 -4
  19. package/dist/config/uiConfig.context.js +14 -5
  20. package/dist/index.d.ts +1 -263
  21. package/dist/index.js +10 -31
  22. package/dist/rhf/Inputs.d.ts +60 -0
  23. package/dist/rhf/Inputs.js +148 -0
  24. package/dist/rhf/components.d.ts +80 -0
  25. package/dist/rhf/components.js +101 -0
  26. package/dist/rhf/dynamicInputs.d.ts +18 -0
  27. package/dist/rhf/dynamicInputs.js +5 -0
  28. package/dist/rhf/entrypoints.type-test.d.ts +1 -0
  29. package/dist/rhf/fieldAdapter.d.ts +7 -0
  30. package/dist/rhf/fieldAdapter.js +40 -0
  31. package/dist/rhf/form.types.d.ts +12 -0
  32. package/dist/rhf/useAutosave.d.ts +10 -0
  33. package/dist/rhf/useAutosave.js +71 -0
  34. package/dist/rhf/useForm.d.ts +18 -0
  35. package/dist/rhf/useForm.js +48 -0
  36. package/dist/rhf/useFormAutosave.d.ts +15 -0
  37. package/dist/rhf/useFormAutosave.js +59 -0
  38. package/dist/rhf.d.ts +264 -0
  39. package/dist/tanstack.d.ts +263 -0
  40. package/dist/tanstack.js +180 -0
  41. package/package.json +14 -2
@@ -0,0 +1,158 @@
1
+ declare const _default: {
2
+ "ui": {
3
+ "openAlt": "Open",
4
+ "closeAlt": "Close",
5
+ "clearAlt": "Clear",
6
+ "loadingState": {
7
+ "text": "Loading..."
8
+ },
9
+ "select": {
10
+ "closeAlt": "Close the menu",
11
+ "selectAll": "Select all",
12
+ "clearSelection": "Clear",
13
+ "allOption": "All",
14
+ "search": "Search",
15
+ "clearSearch": "Clear search"
16
+ },
17
+ "datePicker": {
18
+ "today": "Today",
19
+ "clear": "Clear",
20
+ "save": "Save",
21
+ "presets": {
22
+ "thisWeek": "This week",
23
+ "lastWeek": "Last week",
24
+ "thisAndLastWeek": "This & Last week",
25
+ "thisMonth": "This month",
26
+ "thisAndLastMonth": "This & Last month",
27
+ "thisYear": "This year",
28
+ "lastYear": "Last year",
29
+ "thisAndLastYear": "This & Last year",
30
+ "soFar": "So far"
31
+ },
32
+ "navigation": {
33
+ "previousMonth": "Previous month",
34
+ "nextMonth": "Next month",
35
+ "previousYear": "Previous year",
36
+ "nextYear": "Next year"
37
+ },
38
+ "errors": {
39
+ "endDateBeforeStart": "End date cannot be before start date"
40
+ }
41
+ },
42
+ "modal": {
43
+ "closeBtn": "Close"
44
+ },
45
+ "autocomplete": {
46
+ "createNewBtn": "Create"
47
+ },
48
+ "password": {
49
+ "reveal": "Reveal password",
50
+ "hide": "Hide password"
51
+ },
52
+ "textEditor": {
53
+ "textStyle": {
54
+ "label": "Text style",
55
+ "normal": "Normal text",
56
+ "heading1": "Heading 1",
57
+ "heading2": "Heading 2",
58
+ "heading3": "Heading 3",
59
+ "heading4": "Heading 4",
60
+ "heading5": "Heading 5",
61
+ "heading6": "Heading 6"
62
+ },
63
+ "marks": {
64
+ "bold": "Bold",
65
+ "italic": "Italic",
66
+ "underline": "Underline",
67
+ "strikethrough": "Strikethrough"
68
+ },
69
+ "textAlign": {
70
+ "label": "Text align",
71
+ "left": "Left",
72
+ "center": "Center",
73
+ "right": "Right",
74
+ "justify": "Justify"
75
+ },
76
+ "link": {
77
+ "label": "Hyperlink",
78
+ "apply": "Apply",
79
+ "remove": "Remove",
80
+ "urlLabel": "URL",
81
+ "urlPlaceholder": "Enter the URL"
82
+ }
83
+ },
84
+ "tag": {
85
+ "dismiss": "Dismiss"
86
+ },
87
+ "clearInput": "Clear input",
88
+ "pagination": {
89
+ "nextBtn": "Next",
90
+ "backBtn": "Previous",
91
+ "firstBtn": "First",
92
+ "lastBtn": "Last",
93
+ "resultsPerPage": "Results per page"
94
+ },
95
+ "confirmation": {
96
+ "cancel": "Cancel",
97
+ "confirm": "Confirm"
98
+ },
99
+ "fileUpload": {
100
+ "emptyText": "Upload file",
101
+ "uploadText": "Drag & drop files here or",
102
+ "browse": "Browse",
103
+ "noFileUploaded": "No file uploaded",
104
+ "upload": "Upload",
105
+ "uploadFile": "Upload file",
106
+ "or": "or",
107
+ "removeFile": "Remove file",
108
+ "cancel": "Cancel"
109
+ },
110
+ "table": {
111
+ "column": "Column",
112
+ "show": "Show",
113
+ "configureColumns": "Configure columns"
114
+ }
115
+ },
116
+ "zodErrors": {
117
+ "required": "Required",
118
+ "invalid": "Invalid",
119
+ "string": {
120
+ "includes": "Must include \"{{text}}\"",
121
+ "startsWith": "Must start with \"{{text}}\"",
122
+ "endsWith": "Must end with \"{{text}}\"",
123
+ "constraint": "Invalid {{text}}",
124
+ "contains": "Must contain exactly {{count}} character(s)",
125
+ "containsAtLeast": "Must contain at least {{count}} character(s)",
126
+ "containsOver": "Must contain over {{count}} character(s)",
127
+ "containsAtMost": "Must contain at most {{count}} character(s)",
128
+ "containsUnder": "Must contain under {{count}} character(s)"
129
+ },
130
+ "array": {
131
+ "contains": "Array must contain exactly {{count}} element(s)",
132
+ "containsAtLeast": "Array must contain at least {{count}} element(s)",
133
+ "containsMoreThan": "Array must contain more than {{count}} element(s)",
134
+ "containsAtMost": "Array must contain at most {{count}} element(s)",
135
+ "containsLessThan": "Array must contain less than {{count}} element(s)"
136
+ },
137
+ "number": {
138
+ "exact": "Number must be exactly equal to {{number}}",
139
+ "greaterThanOrEqual": "Number must be greater than or equal to {{number}}",
140
+ "greaterThan": "Number must be greater than {{number}}",
141
+ "over": "Number must be over {{number}}",
142
+ "lessThanOrEqual": "Number must be less than or equal to {{number}}",
143
+ "lessThan": "Number must be less than {{number}}",
144
+ "multipleOf": "Number must be a multiple of {{multipleOf}}"
145
+ },
146
+ "date": {
147
+ "invalid": "Invalid date",
148
+ "exact": "Date must be exactly equal to {{date}}",
149
+ "greaterThanOrEqual": "Date must be greater than or equal to {{date}}",
150
+ "greaterThan": "Date must be greater than {{date}}",
151
+ "smallerThanOrEqual": "Date must be smaller than or equal to {{date}}",
152
+ "smallerThan": "Date must be smaller than {{date}}"
153
+ }
154
+ }
155
+ }
156
+ ;
157
+
158
+ export default _default;
@@ -0,0 +1,154 @@
1
+ declare const _default: {
2
+ "ui": {
3
+ "openAlt": "Odpri",
4
+ "closeAlt": "Zapri",
5
+ "clearAlt": "Sprazni",
6
+ "loadingState": {
7
+ "text": "Nalaganje..."
8
+ },
9
+ "select": {
10
+ "closeAlt": "Zapri meni",
11
+ "selectAll": "Izberi vse",
12
+ "clearSelection": "Sprazni",
13
+ "allOption": "Vse",
14
+ "search": "Išči",
15
+ "clearSearch": "Sprazni iskanje"
16
+ },
17
+ "datePicker": {
18
+ "today": "Danes",
19
+ "clear": "Sprazni",
20
+ "save": "Shrani",
21
+ "presets": {
22
+ "thisWeek": "Ta teden",
23
+ "lastWeek": "Prejšnji teden",
24
+ "thisAndLastWeek": "Ta in prejšnji teden",
25
+ "thisMonth": "Ta mesec",
26
+ "thisAndLastMonth": "Ta in prejšnji mesec",
27
+ "thisYear": "To leto",
28
+ "lastYear": "Prejšnje leto",
29
+ "thisAndLastYear": "To in prejšnje leto",
30
+ "soFar": "Od začetka"
31
+ },
32
+ "navigation": {
33
+ "previousMonth": "Prejšnji mesec",
34
+ "nextMonth": "Naslednji mesec",
35
+ "previousYear": "Prejšnje leto",
36
+ "nextYear": "Naslednje leto"
37
+ },
38
+ "errors": {
39
+ "endDateBeforeStart": "Datum konca ne more biti pred datumom začetka"
40
+ }
41
+ },
42
+ "modal": {
43
+ "closeBtn": "Zapri"
44
+ },
45
+ "autocomplete": {
46
+ "createNewBtn": "Ustvari"
47
+ },
48
+ "password": {
49
+ "reveal": "Prikaži geslo",
50
+ "hide": "Skrij geslo"
51
+ },
52
+ "textEditor": {
53
+ "textStyle": {
54
+ "label": "Vrsta besedila",
55
+ "normal": "Normalni tekst",
56
+ "heading1": "Naslov 1",
57
+ "heading2": "Naslov 2",
58
+ "heading3": "Naslov 3",
59
+ "heading4": "Naslov 4",
60
+ "heading5": "Naslov 5",
61
+ "heading6": "Naslov 6"
62
+ },
63
+ "marks": {
64
+ "bold": "Krepko",
65
+ "italic": "Poševno",
66
+ "underline": "Podčrtano",
67
+ "strikethrough": "Prečrtano"
68
+ },
69
+ "textAlign": {
70
+ "label": "Poravnava besedila",
71
+ "left": "Levo",
72
+ "center": "Sredina",
73
+ "right": "Desno",
74
+ "justify": "Obojestransko"
75
+ },
76
+ "link": {
77
+ "label": "Povezava",
78
+ "apply": "Ustvari",
79
+ "remove": "Odstrani",
80
+ "urlLabel": "URL",
81
+ "urlPlaceholder": "Vnesite URL"
82
+ }
83
+ },
84
+ "pagination": {
85
+ "nextBtn": "Naprej",
86
+ "backBtn": "Nazaj",
87
+ "firstBtn": "Prva",
88
+ "lastBtn": "Zadnja",
89
+ "resultsPerPage": "Rezultatov na stran"
90
+ },
91
+ "confirmation": {
92
+ "cancel": "Prekliči",
93
+ "confirm": "Potrdi"
94
+ },
95
+ "fileUpload": {
96
+ "emptyText": "Naloži datoteko",
97
+ "uploadText": "Povlecite datoteke sem ali",
98
+ "browse": "Izberi",
99
+ "noFileUploaded": "Ni datotek",
100
+ "upload": "Naloži",
101
+ "uploadFile": "Naloži datoteko",
102
+ "or": "ali",
103
+ "removeFile": "Odstrani datoteko",
104
+ "cancel": "Prekliči"
105
+ },
106
+ "table": {
107
+ "column": "Stolpec",
108
+ "show": "Prikaži",
109
+ "configureColumns": "Nastavi stolpce"
110
+ }
111
+ },
112
+ "zodErrors": {
113
+ "required": "Obvezno",
114
+ "invalid": "Neveljavno",
115
+ "string": {
116
+ "includes": "Mora vključevati \"{{text}}\"",
117
+ "startsWith": "Se mora začeti z \"{{text}}\"",
118
+ "endsWith": "Se mora končati z \"{{text}}\"",
119
+ "constraint": "Neveljaven {{text}}",
120
+ "contains": "Mora vsebovati natančno {{count}} znak(ov)",
121
+ "containsAtLeast": "Mora vsebovati vsaj {{count}} znak(ov)",
122
+ "containsOver": "Mora vsebovati več kot {{count}} znak(ov)",
123
+ "containsAtMost": "Mora vsebovati največ {{count}} znak(ov)",
124
+ "containsUnder": "Mora vsebovati manj kot {{count}} znak(ov)"
125
+ },
126
+ "array": {
127
+ "contains": "Polje mora vsebovati natančno {{count}} element(ov)",
128
+ "containsAtLeast": "Polje mora vsebovati vsaj {{count}} element(ov)",
129
+ "containsMoreThan": "Polje mora vsebovati več kot {{count}} element(ov)",
130
+ "containsAtMost": "Polje mora vsebovati največ {{count}} element(ov)",
131
+ "containsLessThan": "Polje mora vsebovati manj kot {{count}} element(ov)"
132
+ },
133
+ "number": {
134
+ "exact": "Število mora biti natančno enako {{number}}",
135
+ "greaterThanOrEqual": "Število mora biti večje ali enako {{number}}",
136
+ "greaterThan": "Število mora biti večje od {{number}}",
137
+ "over": "Število mora biti nad {{number}}",
138
+ "lessThanOrEqual": "Število mora biti manjše ali enako {{number}}",
139
+ "lessThan": "Število mora biti manjše od {{number}}",
140
+ "multipleOf": "Število mora biti večkratnik števila {{multipleOf}}"
141
+ },
142
+ "date": {
143
+ "invalid": "Neveljaven datum",
144
+ "exact": "Datum mora biti natančno enak {{date}}",
145
+ "greaterThanOrEqual": "Datum mora biti večji ali enak {{date}}",
146
+ "greaterThan": "Datum mora biti večji od {{date}}",
147
+ "smallerThanOrEqual": "Datum mora biti manjši ali enak {{date}}",
148
+ "smallerThan": "Datum mora biti manjši od {{date}}"
149
+ }
150
+ }
151
+ }
152
+ ;
153
+
154
+ export default _default;
@@ -340,6 +340,7 @@ var DatePickerInner = ({ fullIso = true, granularity = "day", minValue, maxValue
340
340
  });
341
341
  return /* @__PURE__ */ jsx(InputFrame, {
342
342
  ...props,
343
+ onClear: () => props.onChange?.(null),
343
344
  isDisabled,
344
345
  className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
345
346
  inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
@@ -394,7 +395,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
394
395
  ...innerProps,
395
396
  ref: mergeRefs(ref, field_0.ref),
396
397
  value: field_0.value ?? null,
397
- onChange: field_0.onChange,
398
+ onChange: (value) => field_0.onChange(value ?? null),
398
399
  onBlur: field_0.onBlur,
399
400
  isDirty,
400
401
  isDisabled: field_0.disabled || props.isDisabled,
@@ -804,6 +804,7 @@ var DateRangePickerInner = ({ fullIso = true, minValue, maxValue, renderStaticIn
804
804
  });
805
805
  return /* @__PURE__ */ jsx(InputFrame, {
806
806
  ...props,
807
+ onClear: () => props.onChange?.(null),
807
808
  isDisabled,
808
809
  className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
809
810
  inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
@@ -857,7 +858,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
857
858
  ...innerProps,
858
859
  ref: mergeRefs(ref, field_0.ref),
859
860
  value: field_0.value ?? null,
860
- onChange: field_0.onChange,
861
+ onChange: (value) => field_0.onChange(value ?? null),
861
862
  onBlur: field_0.onBlur,
862
863
  isDirty,
863
864
  isDisabled: field_0.disabled || props.isDisabled,
@@ -122,9 +122,10 @@ var DateTimePickerBase = (props) => {
122
122
  labelProps
123
123
  };
124
124
  const onApply = () => {
125
- const newValue = dialogState.value;
126
- state.setValue(newValue);
127
- state.toggle();
125
+ const newValue = dialogState.value ?? null;
126
+ onChange?.(newValue);
127
+ dialogState.setValue(newValue);
128
+ state.close();
128
129
  };
129
130
  const onMonthYearChange = (selectedDate) => {
130
131
  if (!shouldUpdateDateOnMonthYearChange) return;
@@ -307,6 +308,7 @@ var DateTimePickerInner = ({ fullIso: _fullIso = true, renderStaticInput, isForm
307
308
  });
308
309
  return /* @__PURE__ */ jsx(InputFrame, {
309
310
  ...props,
311
+ onClear: () => props.onChange?.(null),
310
312
  isDisabled,
311
313
  className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
312
314
  inputClassName: clsx(props.shouldShrinkInput ? "min-w-0" : "min-w-input-width-min-width", props.inputClassName),
@@ -359,7 +361,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
359
361
  ...innerProps,
360
362
  ref: mergeRefs(ref, field_0.ref),
361
363
  value: field_0.value ?? null,
362
- onChange: field_0.onChange,
364
+ onChange: (value) => field_0.onChange(value ?? null),
363
365
  onBlur: field_0.onBlur,
364
366
  isDirty,
365
367
  isDisabled: field_0.disabled || props.isDisabled,
@@ -494,6 +494,7 @@ var TimePickerInner = (t0) => {
494
494
  });
495
495
  return /* @__PURE__ */ jsx(InputFrame, {
496
496
  ...props,
497
+ onClear: () => props.onChange?.(null),
497
498
  isDisabled,
498
499
  className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
499
500
  inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
@@ -589,7 +590,7 @@ var TimePicker = (t0) => {
589
590
  ...innerProps,
590
591
  ref: mergeRefs(ref, field_0.ref),
591
592
  value: field_0.value ?? null,
592
- onChange: field_0.onChange,
593
+ onChange: (value) => field_0.onChange(value ?? null),
593
594
  onBlur: field_0.onBlur,
594
595
  isDirty,
595
596
  isDisabled: field_0.disabled || props.isDisabled,
@@ -15,6 +15,7 @@ interface DateFieldProps extends Omit<DateFieldStateOptions, "locale" | "createC
15
15
  timeZone?: string;
16
16
  segmentGroup?: string;
17
17
  shouldAutoFixYear?: boolean;
18
+ preserveNullValue?: boolean;
18
19
  }
19
- export declare const DateField: ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity, isTimeOptional, format, timeZone, segmentGroup, shouldAutoFixYear, ...props }: DateFieldProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const DateField: ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity, isTimeOptional, format, timeZone, segmentGroup, shouldAutoFixYear, preserveNullValue, ...props }: DateFieldProps) => import("react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -9,10 +9,10 @@ import { DateTime } from "luxon";
9
9
  import { useDateFieldState } from "react-stately";
10
10
  //#region src/components/inputs/DateTime/shared/DateField.tsx
11
11
  var omitNullValue = ({ value: _value, ...props }) => props;
12
- var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, ...props }) => {
12
+ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, preserveNullValue = false, ...props }) => {
13
13
  const { locale } = useLocale();
14
14
  const previousValueRef = useRef(props.value);
15
- const dateFieldProps = props.value == null ? omitNullValue(props) : props;
15
+ const dateFieldProps = props.value == null && !preserveNullValue ? omitNullValue(props) : props;
16
16
  const state = useDateFieldState({
17
17
  ...dateFieldProps,
18
18
  isDisabled,
@@ -51,10 +51,10 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, fieldVa
51
51
  shouldAutoFixYear: autoFixYear
52
52
  } : void 0;
53
53
  const clearInput = useCallback(() => {
54
- dateFieldRef.current?.clearField();
55
- endDateFieldRef.current?.clearField();
56
54
  if (onClearProp) onClearProp();
57
55
  else {
56
+ dateFieldRef.current?.clearField();
57
+ endDateFieldRef.current?.clearField();
58
58
  fieldProps.onChange?.(null);
59
59
  endFieldProps?.onChange?.(null);
60
60
  }
@@ -150,6 +150,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, fieldVa
150
150
  disableManualEntry,
151
151
  dateGranularity,
152
152
  isTimeOptional,
153
+ preserveNullValue: isValueControlled && !endFieldProps,
153
154
  format,
154
155
  timeZone: effectiveTimeZone,
155
156
  segmentGroup: normalizedEndFieldProps ? "start" : void 0
@@ -150,8 +150,8 @@ var TimePickerInput = (t0) => {
150
150
  if ($[33] !== canClear || $[34] !== isClearable || $[35] !== onClear || $[36] !== state) {
151
151
  t23 = isClearable && /* @__PURE__ */ jsx(InputClear, {
152
152
  onClear: () => {
153
- state.setValue(null);
154
- onClear?.();
153
+ if (onClear) onClear();
154
+ else state.setValue(null);
155
155
  },
156
156
  show: canClear
157
157
  });
@@ -1,7 +1,7 @@
1
- import { InputItem } from "./InputItem.js";
2
1
  import { StringUtils } from "../../../utils/string.utils.js";
3
2
  import { ZodUtils } from "../../../utils/zod.utils.js";
4
3
  import { getDefaultInputComponentType } from "../../../helpers/dynamicInputs.js";
4
+ import { InputItem } from "./InputItem.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { z } from "zod";
@@ -18,7 +18,7 @@ declare const componentRegistry: {
18
18
  readonly querySelect: <TFieldValues extends import('../shared/form.binding').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../../..').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Select/QuerySelect').QuerySelectProps<TFieldValues, TQueryFn, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
19
19
  readonly autocomplete: typeof Autocomplete;
20
20
  readonly queryAutocomplete: <TFieldValues extends import('../shared/form.binding').FieldValues, TSelectItem extends import('../../..').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn>(props: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
21
- readonly segment: <TFieldValues extends import('../shared/form.binding').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key>(props: import('../../..').ControlledSegmentProps<TFieldValues, TKey>) => import("react/jsx-runtime").JSX.Element;
21
+ readonly segment: <TFieldValues extends import('../shared/form.binding').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key>(props: import('../../segment/segment.types').ControlledSegmentProps<TFieldValues, TKey>) => import("react/jsx-runtime").JSX.Element;
22
22
  readonly datePicker: <TFieldValues extends import('../shared/form.binding').FieldValues>({ fullIso, granularity, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
23
23
  readonly dateTimePicker: <TFieldValues extends import('../shared/form.binding').FieldValues>({ fullIso, renderStaticInput, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
24
24
  readonly timePicker: <TFieldValues extends import('../shared/form.binding').FieldValues>({ renderStaticInput, ...props }: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
@@ -12,10 +12,10 @@ import { PasswordInput } from "../Input/PasswordInput/PasswordInput.js";
12
12
  import { TextArea } from "../Input/TextArea/TextArea.js";
13
13
  import { Autocomplete } from "../Selection/Autocomplete/Autocomplete.js";
14
14
  import { QueryAutocomplete } from "../Selection/Autocomplete/QueryAutocomplete.js";
15
+ import { QuerySelect } from "../Selection/Select/QuerySelect.js";
15
16
  import { Slider } from "../Slider/Slider.js";
16
17
  import { Toggle } from "../Toggle/Toggle.js";
17
18
  import { Segment } from "../../segment/Segment.js";
18
- import { QuerySelect } from "../Selection/Select/QuerySelect.js";
19
19
  import { c } from "react/compiler-runtime";
20
20
  import { jsx } from "react/jsx-runtime";
21
21
  //#region src/components/inputs/Inputs/InputItem.tsx
@@ -12,11 +12,24 @@ var SelectContext;
12
12
  });
13
13
  _SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, searchDebounceDelay, multiSelectAutoConfirm = false, onBlur: fieldOnBlur, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
14
14
  const isMultiple = props.selectionMode === "multiple";
15
+ const initialSelection = props.initialSelection;
16
+ const controlledValue = props.value;
17
+ const hasControlledValue = Object.hasOwn(props, "value");
15
18
  const initialSelectedItems = useMemo(() => {
16
- if (!props.initialSelection) return null;
17
- if (Array.isArray(props.initialSelection)) return props.initialSelection.map(mapInitialToSelectItem);
18
- return mapInitialToSelectItem(props.initialSelection);
19
- }, [props.initialSelection, mapInitialToSelectItem]);
19
+ if (!initialSelection) return null;
20
+ const controlledIds = Array.isArray(controlledValue) ? new Set(controlledValue) : controlledValue != null ? new Set([controlledValue]) : /* @__PURE__ */ new Set();
21
+ const mapMatchingInitialItem = (item) => {
22
+ const mappedItem = mapInitialToSelectItem(item);
23
+ return !hasControlledValue || controlledIds.has(mappedItem.id) ? mappedItem : null;
24
+ };
25
+ if (Array.isArray(initialSelection)) return initialSelection.map(mapMatchingInitialItem).filter((item_0) => item_0 !== null);
26
+ return mapMatchingInitialItem(initialSelection);
27
+ }, [
28
+ controlledValue,
29
+ hasControlledValue,
30
+ initialSelection,
31
+ mapInitialToSelectItem
32
+ ]);
20
33
  const [isOpen, setIsOpen] = useState(false);
21
34
  const [fieldState, setFieldState] = useState({
22
35
  value: props.value ?? (isMultiple ? [] : null),
@@ -45,15 +58,15 @@ var SelectContext;
45
58
  isClientSearchDisabled: ignoreInputValueFiltering ?? isClientSearchDisabled
46
59
  });
47
60
  const selectedItems = useMemo(() => {
48
- const getItem = (id) => allItems.find((item) => item.id === id) ?? null;
49
- if (Array.isArray(fieldState.value)) return fieldState.value.map((id_0) => getItem(id_0)).filter((item_0) => item_0 !== null);
61
+ const getItem = (id) => allItems.find((item_1) => item_1.id === id) ?? null;
62
+ if (Array.isArray(fieldState.value)) return fieldState.value.map((id_0) => getItem(id_0)).filter((item_2) => item_2 !== null);
50
63
  const selectedItem = fieldState.value != null ? getItem(fieldState.value) : null;
51
64
  return selectedItem ? [selectedItem] : [];
52
65
  }, [allItems, fieldState.value]);
53
66
  const selectedIds = useMemo(() => selectedItems.map(({ id: id_1 }) => id_1), [selectedItems]);
54
- const getItem_0 = useCallback((value) => allItems.find((item_1) => item_1 && item_1.id === value) ?? null, [allItems]);
67
+ const getItem_0 = useCallback((value) => allItems.find((item_3) => item_3 && item_3.id === value) ?? null, [allItems]);
55
68
  const updateValue = useCallback((value_0) => {
56
- if (Array.isArray(value_0)) valueRef.current = value_0.map((id_2) => getItem_0(id_2)).filter((item_2) => item_2 !== null);
69
+ if (Array.isArray(value_0)) valueRef.current = value_0.map((id_2) => getItem_0(id_2)).filter((item_4) => item_4 !== null);
57
70
  else valueRef.current = getItem_0(value_0);
58
71
  }, [getItem_0]);
59
72
  const getValueIds = () => Array.isArray(valueRef.current) ? valueRef.current.map(({ id: id_3 }) => id_3) : valueRef.current?.id ?? null;
@@ -103,7 +103,7 @@ var InputFrame = (props) => {
103
103
  hasClear && /* @__PURE__ */ jsx(InputClear, {
104
104
  onClear: () => onClear?.(),
105
105
  className: clearClassName,
106
- show: !!showClear,
106
+ show: !!showClear && !isDisabled,
107
107
  renderStatic: true
108
108
  }),
109
109
  trailingContent,
@@ -152,6 +152,7 @@ var InputFrame = (props) => {
152
152
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [contentRow, trailingRow] });
153
153
  const shouldReplayStaticPress = (target) => staticPressTarget === "frame" || target instanceof Element && !!target.closest("[data-static-press-action]");
154
154
  const isStaticPressActionTarget = (target_0) => target_0 instanceof Element && !!target_0.closest("[data-static-press-action]");
155
+ const isStaticClearActionTarget = (target_1) => target_1 instanceof Element && !!target_1.closest("[data-static-clear-action]");
155
156
  return /* @__PURE__ */ jsx(TooltipWrapper, {
156
157
  as,
157
158
  error,
@@ -170,7 +171,7 @@ var InputFrame = (props) => {
170
171
  },
171
172
  onFocusCapture: (event_0) => {
172
173
  onFocusCapture?.(event_0);
173
- if (pendingStaticPressPointerIdRef.current == null) onStaticInteract?.(true, event_0.target);
174
+ if (pendingStaticPressPointerIdRef.current == null && !isStaticClearActionTarget(event_0.target)) onStaticInteract?.(true, event_0.target);
174
175
  },
175
176
  children: /* @__PURE__ */ jsx("div", {
176
177
  ref,
@@ -181,9 +182,10 @@ var InputFrame = (props) => {
181
182
  }), inputClassName),
182
183
  tabIndex: isDisabled ? -1 : 0,
183
184
  onFocus: (event_1) => {
184
- if (pendingStaticPressPointerIdRef.current == null) onStaticInteract?.(true, event_1.target);
185
+ if (pendingStaticPressPointerIdRef.current == null && !isStaticClearActionTarget(event_1.target)) onStaticInteract?.(true, event_1.target);
185
186
  },
186
187
  onClick: (event_2) => {
188
+ if (isStaticClearActionTarget(event_2.target)) return;
187
189
  if (onStaticPress && shouldReplayStaticPress(event_2.target)) {
188
190
  onStaticPress();
189
191
  return;
@@ -194,6 +196,7 @@ var InputFrame = (props) => {
194
196
  if (onStaticPress && shouldReplayStaticPress(event_3.target) || isStaticPressActionTarget(event_3.target)) pendingStaticPressPointerIdRef.current = event_3.pointerId;
195
197
  },
196
198
  onPointerDown: (event_4) => {
199
+ if (isStaticClearActionTarget(event_4.target)) return;
197
200
  if (pendingStaticPressPointerIdRef.current === event_4.pointerId) return;
198
201
  if (onStaticPress && shouldReplayStaticPress(event_4.target)) {
199
202
  pendingStaticPressPointerIdRef.current = event_4.pointerId;