@selfeesas/shared-components 0.5.0 → 0.5.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.
@@ -653,6 +653,7 @@ export declare const DatePicker: DefineComponent<ExtractPropTypes<__VLS_WithDefa
653
653
  outlined: boolean;
654
654
  placeholder: undefined;
655
655
  closeLabel: string;
656
+ rules: () => never[];
656
657
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
657
658
  "update:date": (value: string) => void;
658
659
  }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults_5<__VLS_TypePropsToOption_9<DatePickerProps>, {
@@ -667,6 +668,7 @@ export declare const DatePicker: DefineComponent<ExtractPropTypes<__VLS_WithDefa
667
668
  outlined: boolean;
668
669
  placeholder: undefined;
669
670
  closeLabel: string;
671
+ rules: () => never[];
670
672
  }>>> & Readonly<{
671
673
  "onUpdate:date"?: ((value: string) => any) | undefined;
672
674
  }>, {
@@ -674,6 +676,7 @@ export declare const DatePicker: DefineComponent<ExtractPropTypes<__VLS_WithDefa
674
676
  disabled: boolean;
675
677
  label: string;
676
678
  outlined: boolean;
679
+ rules: ((val: string) => boolean | string)[];
677
680
  date: string;
678
681
  minDate: string;
679
682
  maxDate: string;
@@ -695,6 +698,7 @@ export declare interface DatePickerProps {
695
698
  outlined?: boolean;
696
699
  placeholder?: string;
697
700
  closeLabel?: string;
701
+ rules?: ((val: string) => boolean | string)[];
698
702
  }
699
703
 
700
704
  export declare const DateRange: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_6<__VLS_TypePropsToOption_10<DateRangeProps>, {
@@ -8432,36 +8432,40 @@ const Qr = {
8432
8432
  disabled: { type: Boolean, default: !1 },
8433
8433
  outlined: { type: Boolean, default: !1 },
8434
8434
  placeholder: { default: void 0 },
8435
- closeLabel: { default: "Close" }
8435
+ closeLabel: { default: "Close" },
8436
+ rules: { default: () => [] }
8436
8437
  },
8437
8438
  emits: ["update:date"],
8438
8439
  setup(l, { emit: B }) {
8439
- const t = l, v = B, m = Xi(), f = Se(t.date), a = Se(t.date), o = $(() => (r) => {
8440
- const u = r.replace(/\//g, "-");
8441
- return Do(u, t.minDate, t.maxDate, t.datesDisabled);
8442
- }), n = (r) => {
8443
- f.value = r, a.value = r, v("update:date", r);
8444
- }, e = (r) => {
8445
- typeof r == "string" && (f.value = r, a.value = r, v("update:date", r));
8446
- };
8440
+ const t = l, v = B, m = Xi(), f = Se(t.date), a = Se(t.date), o = $(() => (u) => {
8441
+ const s = u.replaceAll("/", "-");
8442
+ return Do(s, t.minDate, t.maxDate, t.datesDisabled);
8443
+ }), n = (u) => {
8444
+ f.value = u, a.value = u, v("update:date", u);
8445
+ }, e = (u) => {
8446
+ typeof u == "string" && (f.value = u, a.value = u, v("update:date", u));
8447
+ }, r = $(() => {
8448
+ const u = [...t.rules];
8449
+ return t.required && u.push((s) => !!s || t.requiredErrorMessage), u;
8450
+ });
8447
8451
  return We(
8448
8452
  () => t.date,
8449
- (r) => {
8450
- r !== f.value && (f.value = r, a.value = r);
8453
+ (u) => {
8454
+ u !== f.value && (f.value = u, a.value = u);
8451
8455
  }
8452
- ), (r, u) => (Ye(), yt("div", Hc, [
8456
+ ), (u, s) => (Ye(), yt("div", Hc, [
8453
8457
  $e(vn, ar(Bt(m), {
8454
8458
  class: "full-width",
8455
8459
  "model-value": a.value,
8456
8460
  mask: "##-##-####",
8457
8461
  dense: "",
8458
- label: r.label,
8462
+ label: u.label,
8459
8463
  "data-cy": "datePick",
8460
- rules: r.required ? [(s) => !!s || r.requiredErrorMessage] : [],
8461
- disable: r.disabled,
8462
- required: r.required,
8463
- outlined: r.outlined,
8464
- placeholder: r.placeholder,
8464
+ rules: r.value,
8465
+ disable: u.disabled,
8466
+ required: u.required,
8467
+ outlined: u.outlined,
8468
+ placeholder: u.placeholder,
8465
8469
  "onUpdate:modelValue": e
8466
8470
  }), {
8467
8471
  append: Ke(() => [
@@ -8481,13 +8485,13 @@ const Qr = {
8481
8485
  mask: "DD-MM-YYYY",
8482
8486
  "model-value": f.value,
8483
8487
  options: o.value,
8484
- disable: r.disabled,
8488
+ disable: u.disabled,
8485
8489
  "onUpdate:modelValue": n
8486
8490
  }, {
8487
8491
  default: Ke(() => [
8488
8492
  rt("div", Yc, [
8489
8493
  Fr($e(Et, {
8490
- label: r.closeLabel,
8494
+ label: u.closeLabel,
8491
8495
  color: "primary",
8492
8496
  flat: ""
8493
8497
  }, null, 8, ["label"]), [
@@ -8508,7 +8512,7 @@ const Qr = {
8508
8512
  }, 16, ["model-value", "label", "rules", "disable", "required", "outlined", "placeholder"])
8509
8513
  ]));
8510
8514
  }
8511
- }), kd = /* @__PURE__ */ sn(Qc, [["__scopeId", "data-v-e5fcd393"]]), Kc = { class: "row" }, Xc = { class: "row no-wrap items-center" }, Gc = { class: "row items-center justify-end" }, Jc = {
8515
+ }), kd = /* @__PURE__ */ sn(Qc, [["__scopeId", "data-v-17be47e1"]]), Kc = { class: "row" }, Xc = { class: "row no-wrap items-center" }, Gc = { class: "row items-center justify-end" }, Jc = {
8512
8516
  key: 0,
8513
8517
  class: "row items-center text-warning text-caption"
8514
8518
  }, Zc = {