arkenstone-ui 0.0.33 → 0.0.34

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/index.js CHANGED
@@ -13705,7 +13705,7 @@ const E_ = ({
13705
13705
  );
13706
13706
  });
13707
13707
  }, [e]);
13708
- const g = (v, w, x) => x ? x.required && (w === "" || w === null || w === void 0) ? x.message || "Required" : x.min && typeof w == "number" && w < x.min ? `Min value is ${x.min}` : x.pattern && !x.pattern.test(w) ? x.message || "Invalid format" : x.custom ? x.custom(w, l) : null : null, h = (v, w) => {
13708
+ const g = (v, w, x) => x ? x.required && o && (w === "" || w === null || w === void 0) ? x.message || "Required" : x.min && typeof w == "number" && w < x.min ? `Min value is ${x.min}` : x.pattern && !x.pattern.test(w) ? x.message || "Invalid format" : x.custom ? x.custom(w, l) : null : null, h = (v, w) => {
13709
13709
  c((x) => {
13710
13710
  const S = { ...x, [v]: w };
13711
13711
  return a && n(S), S;
@@ -13735,13 +13735,13 @@ const E_ = ({
13735
13735
  return null;
13736
13736
  const w = d[v.name];
13737
13737
  let x = l[v.name] ?? v.defaultValue ?? "";
13738
- return v.currentDataLoadConfig && !o && (v.currentDataLoadConfig.useObjectKey ? x = cl(l, v.currentDataLoadConfig.useObjectKey) : v.currentDataLoadConfig.transform && (x = v.currentDataLoadConfig.transform(l))), v.currentDataLoadConfig && (v.currentDataLoadConfig.useObjectKey ? console.log(
13738
+ return v.currentDataLoadConfig && !o && (v.currentDataLoadConfig.useObjectKey ? x = cl(l, v.currentDataLoadConfig.useObjectKey) : v.currentDataLoadConfig.transform && (x = v.currentDataLoadConfig.transform(l)), console.log("fieldValue fresh", l)), v.currentDataLoadConfig && (v.currentDataLoadConfig.useObjectKey ? console.log(
13739
13739
  "Temp Val:",
13740
13740
  cl(l, v.currentDataLoadConfig.useObjectKey)
13741
13741
  ) : v.currentDataLoadConfig.transform && console.log(
13742
13742
  "Temp Val:",
13743
13743
  v.currentDataLoadConfig.transform(l)
13744
- )), /* @__PURE__ */ O(
13744
+ )), console.log("fieldValue", x), /* @__PURE__ */ O(
13745
13745
  "div",
13746
13746
  {
13747
13747
  className: _("flex flex-col gap-1.5", v.className),
@@ -13786,13 +13786,13 @@ const E_ = ({
13786
13786
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
13787
13787
  w && "border-destructive"
13788
13788
  ),
13789
- value: (x == null ? void 0 : x.id) ?? null,
13789
+ value: x ?? null,
13790
13790
  onChange: (E) => {
13791
13791
  v.onChange && v.onChange(E), h(v.name, E.target.value);
13792
13792
  },
13793
13793
  disabled: v.disabled,
13794
13794
  children: [
13795
- /* @__PURE__ */ f("option", { value: "", disabled: !0, children: "Select..." }),
13795
+ v.defaultOption && /* @__PURE__ */ f("option", { value: typeof v.defaultOption == "function" ? v.defaultOption().value : v.defaultOption.value, disabled: !v.enableDefaultOption, children: typeof v.defaultOption == "function" ? v.defaultOption().label : v.defaultOption.label }),
13796
13796
  (v.options || m[v.name] || []).map(
13797
13797
  (E) => /* @__PURE__ */ f("option", { value: E.value, children: E.label }, E.value)
13798
13798
  )
@@ -26,6 +26,8 @@ export interface FieldConfig {
26
26
  onChange?: (value: any) => void;
27
27
  options?: InputOption[];
28
28
  fetchOptions?: () => Promise<InputOption[]>;
29
+ defaultOption?: InputOption | (() => InputOption);
30
+ enableDefaultOption?: boolean;
29
31
  uploadEndpoint?: string;
30
32
  validation?: ValidationRule;
31
33
  hidden?: boolean | ((values: any) => boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkenstone-ui",
3
- "version": "0.0.33",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",