@timeax/form-palette 0.0.37 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-BYqslKTy.mjs';
4
- export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-BYqslKTy.mjs';
3
+ import { O as ListerDefinition, Q as ListerRuntimeState, U as ListerProviderHost, W as PresetMap, X as ListerStoreState, Y as ListerSessionId, Z as ListerId, _ as ListerSearchMode, $ as ListerSearchTarget, a0 as ListerSearchPayload, a1 as ListerFilterCtx, a2 as ListerFilterOption, a3 as ListerMode, a4 as ListerApi, a5 as ShadcnJsonEditorProps, a6 as JsonEditorIndexHandle } from './variant-aFXJGBXI.mjs';
4
+ export { ab as ListerChangeEvent, av as ListerDetails, al as ListerFilterApply, ak as ListerFilterApplyMode, am as ListerFilterBindKey, ao as ListerFilterGroupOption, an as ListerFilterInput, aq as ListerFilterInputOption, ar as ListerFilterSpec, ap as ListerFilterValueOption, ad as ListerLogCode, ae as ListerLogEntry, ac as ListerLogLevel, ah as ListerMapping, aw as ListerOpenOptions, a7 as ListerOpenReason, ax as ListerOpenResult, ag as ListerOption, au as ListerOptionsForMode, af as ListerPermissionCtx, at as ListerRawForMode, aj as ListerSearchSpec, aC as ListerSessionState, ai as ListerSource, as as ListerValueForMode, aa as OpenAnchor, aA as PresetFilters, aB as PresetMeta, ay as PresetRaw, az as PresetValue, a9 as Resolver, a8 as Selector } from './variant-aFXJGBXI.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 { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-DLlGPgPJ.js';
4
- export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-DLlGPgPJ.js';
3
+ import { O as ListerDefinition, Q as ListerRuntimeState, U as ListerProviderHost, W as PresetMap, X as ListerStoreState, Y as ListerSessionId, Z as ListerId, _ as ListerSearchMode, $ as ListerSearchTarget, a0 as ListerSearchPayload, a1 as ListerFilterCtx, a2 as ListerFilterOption, a3 as ListerMode, a4 as ListerApi, a5 as ShadcnJsonEditorProps, a6 as JsonEditorIndexHandle } from './variant-Jrd0I0Ey.js';
4
+ export { ab as ListerChangeEvent, av as ListerDetails, al as ListerFilterApply, ak as ListerFilterApplyMode, am as ListerFilterBindKey, ao as ListerFilterGroupOption, an as ListerFilterInput, aq as ListerFilterInputOption, ar as ListerFilterSpec, ap as ListerFilterValueOption, ad as ListerLogCode, ae as ListerLogEntry, ac as ListerLogLevel, ah as ListerMapping, aw as ListerOpenOptions, a7 as ListerOpenReason, ax as ListerOpenResult, ag as ListerOption, au as ListerOptionsForMode, af as ListerPermissionCtx, at as ListerRawForMode, aj as ListerSearchSpec, aC as ListerSessionState, ai as ListerSource, as as ListerValueForMode, aa as OpenAnchor, aA as PresetFilters, aB as PresetMeta, ay as PresetRaw, az as PresetValue, a9 as Resolver, a8 as Selector } from './variant-Jrd0I0Ey.js';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.js';
7
7
  import '@inertiajs/core';
package/dist/extra.js CHANGED
@@ -7890,7 +7890,6 @@ var DEFAULT_COUNTRIES = [
7890
7890
  }
7891
7891
  ];
7892
7892
  cachedCountries = DEFAULT_COUNTRIES;
7893
- var validatedOnce = false;
7894
7893
  function isPhoneCountry(value) {
7895
7894
  if (!value || typeof value !== "object") return false;
7896
7895
  const v2 = value;
@@ -7900,35 +7899,35 @@ function getGlobalCountryList() {
7900
7899
  var _a;
7901
7900
  if (cachedCountries) return cachedCountries;
7902
7901
  if (typeof window === "undefined") {
7903
- cachedCountries = [];
7904
- return cachedCountries;
7902
+ return DEFAULT_COUNTRIES;
7905
7903
  }
7906
7904
  const raw = (_a = window["form-palette"]) == null ? void 0 : _a.countries;
7907
- if (!Array.isArray(raw)) {
7908
- if (!validatedOnce && true) {
7909
- console.warn(
7910
- "['form-palette'] window.'form-palette'.countries is not an array:",
7911
- raw
7912
- );
7905
+ if (Array.isArray(raw) && raw.length > 0) {
7906
+ const result = [];
7907
+ for (const item of raw) {
7908
+ if (isPhoneCountry(item)) {
7909
+ result.push(item);
7910
+ }
7913
7911
  }
7914
- validatedOnce = true;
7915
- cachedCountries = [];
7916
- return cachedCountries;
7917
- }
7918
- const result = [];
7919
- for (const item of raw) {
7920
- if (isPhoneCountry(item)) {
7921
- result.push(item);
7922
- } else {
7923
- console.warn(
7924
- "['form-palette'] Ignoring invalid PhoneCountry entry:",
7925
- item
7926
- );
7912
+ if (result.length > 0) {
7913
+ cachedCountries = result;
7914
+ return result;
7927
7915
  }
7928
7916
  }
7929
- validatedOnce = true;
7930
- cachedCountries = result;
7931
- return result;
7917
+ cachedCountries = DEFAULT_COUNTRIES;
7918
+ return cachedCountries;
7919
+ }
7920
+
7921
+ // src/lib/register-global.ts
7922
+ function getPaletteUtil(key, defaultValue) {
7923
+ if (typeof window === "undefined") {
7924
+ return defaultValue;
7925
+ }
7926
+ const registry2 = window["form-palette"];
7927
+ if (registry2 && key in registry2) {
7928
+ return registry2[key];
7929
+ }
7930
+ return defaultValue;
7932
7931
  }
7933
7932
  var TOKEN_CHARS = /* @__PURE__ */ new Set(["9", "a", "*"]);
7934
7933
  function compileMask(pattern, placeholderChar = "_") {
@@ -8143,7 +8142,19 @@ var ShadcnPhoneVariant = React__namespace.forwardRef(function ShadcnPhoneVariant
8143
8142
  ...restTextProps
8144
8143
  } = props;
8145
8144
  let DEFAULT_COUNTRIES2 = getGlobalCountryList();
8146
- const countries = countriesProp && countriesProp.length > 0 ? countriesProp : DEFAULT_COUNTRIES2;
8145
+ const defaultCountries = countriesProp && countriesProp.length > 0 ? countriesProp : DEFAULT_COUNTRIES2;
8146
+ const [loadedCountries, setLoadedCountries] = React__namespace.useState(defaultCountries);
8147
+ React__namespace.useEffect(() => {
8148
+ const loader = getPaletteUtil("countries");
8149
+ if (loader) {
8150
+ Promise.resolve(loader).then((list) => {
8151
+ setLoadedCountries(list);
8152
+ });
8153
+ }
8154
+ }, []);
8155
+ const countries = React__namespace.useMemo(() => {
8156
+ return defaultCountries;
8157
+ }, [loadedCountries, countriesProp]);
8147
8158
  const [country, setCountry] = React__namespace.useState(() => {
8148
8159
  var _a;
8149
8160
  if (defaultCountry) {
@@ -19504,9 +19515,10 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19504
19515
  const openPicker = React__namespace.useCallback(async () => {
19505
19516
  var _a;
19506
19517
  if (isDisabled) return;
19507
- if (customLoader) {
19518
+ let resolvedLoader = customLoader != null ? customLoader : getPaletteUtil("customLoader");
19519
+ if (resolvedLoader) {
19508
19520
  try {
19509
- const result = await customLoader({ multiple, current: items });
19521
+ const result = await resolvedLoader({ multiple, current: items, allowedTypes: toArray2(accept) });
19510
19522
  if (!result) return;
19511
19523
  const normalized = toArray2(result).map(normaliseFileLike);
19512
19524
  if (mergeMode === "replace" || !multiple) {
@@ -25430,7 +25442,6 @@ function InputField(props) {
25430
25442
  ...rest,
25431
25443
  name: autoOff ? void 0 : name,
25432
25444
  id: key,
25433
- ref,
25434
25445
  value,
25435
25446
  onValue: handleValueChange,
25436
25447
  error,
@@ -25518,6 +25529,7 @@ function InputField(props) {
25518
25529
  Field,
25519
25530
  {
25520
25531
  className: rootClassName,
25532
+ ref,
25521
25533
  style,
25522
25534
  "data-variant": String(variant),
25523
25535
  "data-label-placement": lp != null ? lp : void 0,
@@ -25543,7 +25555,11 @@ function InputField(props) {
25543
25555
  hasStackedLabelBlock && /* @__PURE__ */ jsxRuntime.jsxs(Element, { ...attrs(), children: [
25544
25556
  graph.getSlotsFor("label", "above").render(
25545
25557
  (slots) => slots.map(
25546
- (slot) => renderHelperSlot("label", slot, classes)
25558
+ (slot) => renderHelperSlot(
25559
+ "label",
25560
+ slot,
25561
+ classes
25562
+ )
25547
25563
  )
25548
25564
  ),
25549
25565
  hasLabelRowContent && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -25598,7 +25614,11 @@ function InputField(props) {
25598
25614
  ),
25599
25615
  graph.getSlotsFor("label", "below").render(
25600
25616
  (slots) => slots.map(
25601
- (slot) => renderHelperSlot("label", slot, classes)
25617
+ (slot) => renderHelperSlot(
25618
+ "label",
25619
+ slot,
25620
+ classes
25621
+ )
25602
25622
  )
25603
25623
  )
25604
25624
  ] }),
@@ -25618,7 +25638,6 @@ function InputField(props) {
25618
25638
  ...rest,
25619
25639
  name: autoOff ? void 0 : name,
25620
25640
  id: key,
25621
- ref,
25622
25641
  value,
25623
25642
  onValue: handleValueChange,
25624
25643
  error,