@timeax/form-palette 0.1.12 → 0.1.14

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.
@@ -1412,11 +1412,7 @@ type CheckboxTriStateValue = true | false;
1412
1412
  * "none" is used to represent "no stance yet".
1413
1413
  */
1414
1414
  type CheckboxInternalState = true | false | "none";
1415
- interface CheckboxGroupEntry<TValue> {
1416
- value: TValue;
1417
- state: CheckboxTriStateValue;
1418
- }
1419
- type CheckboxGroupValue<TValue> = readonly CheckboxGroupEntry<TValue>[] | undefined;
1415
+ type CheckboxGroupValueMain<TValue extends string | number | symbol> = Record<TValue, CheckboxTriStateValue>;
1420
1416
  /**
1421
1417
  * Single checkbox value.
1422
1418
  * undefined → "none"
@@ -1430,7 +1426,7 @@ type CheckboxSingleValue = boolean | undefined;
1430
1426
  *
1431
1427
  * At the type level this is a union; at runtime we branch using `single`.
1432
1428
  */
1433
- type CheckboxVariantValue<TValue> = CheckboxSingleValue | CheckboxGroupValue<TValue>;
1429
+ type CheckboxVariantValue<TValue> = CheckboxSingleValue | CheckboxGroupValueMain<TValue>;
1434
1430
  interface CheckboxItem<TValue> {
1435
1431
  value: TValue;
1436
1432
  label: React.ReactNode;
@@ -1412,11 +1412,7 @@ type CheckboxTriStateValue = true | false;
1412
1412
  * "none" is used to represent "no stance yet".
1413
1413
  */
1414
1414
  type CheckboxInternalState = true | false | "none";
1415
- interface CheckboxGroupEntry<TValue> {
1416
- value: TValue;
1417
- state: CheckboxTriStateValue;
1418
- }
1419
- type CheckboxGroupValue<TValue> = readonly CheckboxGroupEntry<TValue>[] | undefined;
1415
+ type CheckboxGroupValueMain<TValue extends string | number | symbol> = Record<TValue, CheckboxTriStateValue>;
1420
1416
  /**
1421
1417
  * Single checkbox value.
1422
1418
  * undefined → "none"
@@ -1430,7 +1426,7 @@ type CheckboxSingleValue = boolean | undefined;
1430
1426
  *
1431
1427
  * At the type level this is a union; at runtime we branch using `single`.
1432
1428
  */
1433
- type CheckboxVariantValue<TValue> = CheckboxSingleValue | CheckboxGroupValue<TValue>;
1429
+ type CheckboxVariantValue<TValue> = CheckboxSingleValue | CheckboxGroupValueMain<TValue>;
1434
1430
  interface CheckboxItem<TValue> {
1435
1431
  value: TValue;
1436
1432
  label: React.ReactNode;
package/dist/extra.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-DwDTiD7w.mjs';
4
- export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-DwDTiD7w.mjs';
3
+ import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-B0VZEMYY.mjs';
4
+ export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-B0VZEMYY.mjs';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.mjs';
7
7
  import '@inertiajs/core';
package/dist/extra.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-ya4_MUaP.js';
4
- export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-ya4_MUaP.js';
3
+ import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-BFcyKS5S.js';
4
+ export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-BFcyKS5S.js';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.js';
7
7
  import '@inertiajs/core';
package/dist/extra.js CHANGED
@@ -14400,7 +14400,7 @@ var ShadcnChipsVariant = React72__namespace.forwardRef(function ShadcnChipsVaria
14400
14400
  {
14401
14401
  "data-slot": "chips-upper",
14402
14402
  className: cn(
14403
- "flex items-center gap-1 text-xs",
14403
+ "flex items-center gap-1 text-xs flex-wrap",
14404
14404
  chipsClassName
14405
14405
  ),
14406
14406
  children: [
@@ -15686,7 +15686,9 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
15686
15686
  nativeEvent: void 0,
15687
15687
  meta: void 0
15688
15688
  };
15689
- onValue(nextList, detail);
15689
+ const value2 = {};
15690
+ nextList.forEach((item) => value2[item.value] = item.state);
15691
+ onValue(value2, detail);
15690
15692
  },
15691
15693
  [onValue, disabled, groupValue]
15692
15694
  );
@@ -24617,6 +24619,7 @@ function useField(options) {
24617
24619
  main,
24618
24620
  ignore,
24619
24621
  required: requiredProp = false,
24622
+ value: valueProp,
24620
24623
  defaultValue,
24621
24624
  disabled: disabledProp = false,
24622
24625
  readOnly: readOnlyProp = false,
@@ -24632,9 +24635,17 @@ function useField(options) {
24632
24635
  loading: false,
24633
24636
  original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
24634
24637
  });
24635
- const [value, setValueState] = React72__namespace.useState(
24638
+ const [valueState, setValueState] = React72__namespace.useState(
24636
24639
  stateRef.current.value
24637
24640
  );
24641
+ const isControlled = valueProp !== void 0;
24642
+ const value = isControlled ? valueProp : valueState;
24643
+ React72__namespace.useEffect(() => {
24644
+ if (isControlled && valueProp !== stateRef.current.value) {
24645
+ stateRef.current.value = valueProp;
24646
+ setValueState(valueProp);
24647
+ }
24648
+ }, [isControlled, valueProp]);
24638
24649
  const [error, setErrorState] = React72__namespace.useState(
24639
24650
  stateRef.current.error
24640
24651
  );
@@ -24884,6 +24895,7 @@ function useOptionalField(options) {
24884
24895
  main,
24885
24896
  ignore,
24886
24897
  required: requiredProp = false,
24898
+ value: valueProp,
24887
24899
  defaultValue,
24888
24900
  disabled: disabledProp = false,
24889
24901
  readOnly: readOnlyProp = false,
@@ -24892,7 +24904,14 @@ function useOptionalField(options) {
24892
24904
  onValueChange
24893
24905
  } = options;
24894
24906
  const ref = React72__namespace.useRef(null);
24895
- const [value, setValueState] = React72__namespace.useState(defaultValue);
24907
+ const [valueState, setValueState] = React72__namespace.useState(defaultValue);
24908
+ const isControlled = valueProp !== void 0;
24909
+ const value = isControlled ? valueProp : valueState;
24910
+ React72__namespace.useEffect(() => {
24911
+ if (isControlled) {
24912
+ setValueState(valueProp);
24913
+ }
24914
+ }, [isControlled, valueProp]);
24896
24915
  const [error, setErrorState] = React72__namespace.useState("");
24897
24916
  const [loading, setLoadingState] = React72__namespace.useState(false);
24898
24917
  const [required, setRequired] = React72__namespace.useState(requiredProp);
@@ -25142,6 +25161,7 @@ function InputField(props) {
25142
25161
  fullWidth,
25143
25162
  size,
25144
25163
  density,
25164
+ value,
25145
25165
  // Validation hook
25146
25166
  onValidate,
25147
25167
  onChange,
@@ -25245,10 +25265,11 @@ function InputField(props) {
25245
25265
  onSubmit,
25246
25266
  variant,
25247
25267
  required,
25268
+ value,
25248
25269
  defaultValue,
25249
25270
  validate
25250
25271
  });
25251
- const { value, setValue, error, ref, key } = field;
25272
+ const { value: fieldValue, setValue, error, ref, key } = field;
25252
25273
  const Variant = module2.Variant;
25253
25274
  const visualError = (errorText != null ? errorText : error) || "";
25254
25275
  const handleValueChange = React72__namespace.useCallback(
@@ -25381,7 +25402,7 @@ function InputField(props) {
25381
25402
  ...rest,
25382
25403
  name: autoOff ? void 0 : name,
25383
25404
  id: key,
25384
- value,
25405
+ value: fieldValue,
25385
25406
  onValue: handleValueChange,
25386
25407
  error,
25387
25408
  required,
@@ -25577,7 +25598,7 @@ function InputField(props) {
25577
25598
  ...rest,
25578
25599
  name: autoOff ? void 0 : name,
25579
25600
  id: key,
25580
- value,
25601
+ value: fieldValue,
25581
25602
  onValue: handleValueChange,
25582
25603
  error,
25583
25604
  required,