@aveonline/ui-react 1.14.1 → 1.14.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.
@@ -1,8 +1,9 @@
1
+ import { IColorText } from '../../../types';
1
2
  declare type Change = {
2
3
  value: string | number;
3
4
  checked: boolean;
4
5
  };
5
- declare type IPropsCheckbox = {
6
+ interface IPropsCheckbox extends IColorText {
6
7
  /**
7
8
  * ID unique
8
9
  */
@@ -43,5 +44,5 @@ declare type IPropsCheckbox = {
43
44
  * Option for checked
44
45
  */
45
46
  checked?: boolean;
46
- };
47
+ }
47
48
  export type { IPropsCheckbox };
@@ -1,8 +1,9 @@
1
+ import { IColorText } from '../../../types';
1
2
  declare type Change = {
2
3
  value: string | number;
3
4
  checked: boolean;
4
5
  };
5
- declare type IPropsRadio = {
6
+ interface IPropsRadio extends IColorText {
6
7
  /**
7
8
  * ID unique
8
9
  */
@@ -35,5 +36,5 @@ declare type IPropsRadio = {
35
36
  * Event for control to checked and value
36
37
  */
37
38
  onChange?: (value: Change) => void;
38
- };
39
+ }
39
40
  export type { IPropsRadio };
@@ -15,5 +15,9 @@ interface ISwitch {
15
15
  * The function to call when the switch is toggled.
16
16
  */
17
17
  onChange(checked: boolean): void;
18
+ /**
19
+ * Frozen state current
20
+ */
21
+ hasFrozenState?: boolean;
18
22
  }
19
23
  export type { ISwitch };
@@ -1,7 +1,7 @@
1
1
  import type { ISwitch } from './ISwitch';
2
2
  /**
3
- * Atoms: Switch
3
+ * Atom: Switch
4
4
  * Switches toggle the state of a single item on or off.
5
5
  */
6
- declare function Switch({ onChange, isSelected, isDisabled, name, ...props }: ISwitch): JSX.Element;
6
+ declare function Switch({ onChange, isSelected, isDisabled, name, hasFrozenState, ...props }: ISwitch): JSX.Element;
7
7
  export default Switch;
package/dist/ui-react.mjs CHANGED
@@ -3701,30 +3701,33 @@ function D8({
3701
3701
  isSelected: t = !1,
3702
3702
  isDisabled: n,
3703
3703
  name: i = "",
3704
- ...r
3704
+ hasFrozenState: r = !1,
3705
+ ...o
3705
3706
  }) {
3706
- const [o, a] = j(t), l = (u) => {
3707
- a(u), e(u);
3708
- }, s = ({
3709
- checked: u
3710
- }) => n ? "bg-surface-disabled" : u ? "bg-action-primary-default" : "bg-action-primary-disabled";
3707
+ const [a, l] = j(t), s = (c) => {
3708
+ if (r)
3709
+ return l(!c), e(!c);
3710
+ l(c), e(c);
3711
+ }, u = ({
3712
+ checked: c
3713
+ }) => n ? "bg-surface-disabled" : c ? "bg-action-primary-default" : "bg-action-primary-disabled";
3711
3714
  return /* @__PURE__ */ d(Ks, {
3712
3715
  name: i,
3713
- checked: o,
3714
- onChange: l,
3716
+ checked: a,
3717
+ onChange: s,
3715
3718
  as: we,
3716
- ...r,
3719
+ ...o,
3717
3720
  children: ({
3718
- checked: u
3721
+ checked: c
3719
3722
  }) => /* @__PURE__ */ M("button", {
3720
3723
  disabled: n,
3721
- className: D("relative inline-flex h-6 w-12 items-center rounded-full", s({
3722
- checked: u
3724
+ className: D("relative inline-flex h-6 w-12 items-center rounded-full", u({
3725
+ checked: c
3723
3726
  })),
3724
3727
  children: [/* @__PURE__ */ d("span", {
3725
3728
  className: "sr-only"
3726
3729
  }), /* @__PURE__ */ d("span", {
3727
- className: D("inline-block h-4 w-4 transform rounded-full transition", u ? "translate-x-7" : "translate-x-1", n ? "bg-icon-disabled" : "bg-icon-on")
3730
+ className: D("inline-block h-4 w-4 transform rounded-full transition", c ? "translate-x-7" : "translate-x-1", n ? "bg-icon-disabled" : "bg-icon-on")
3728
3731
  })]
3729
3732
  })
3730
3733
  });
@@ -5741,31 +5744,32 @@ const b0 = mt((e, t) => {
5741
5744
  label: a,
5742
5745
  helpText: l,
5743
5746
  onChange: s,
5744
- checked: u
5745
- } = e, c = ({
5747
+ checked: u,
5748
+ color: c = "default"
5749
+ } = e, A = ({
5746
5750
  target: {
5747
- value: f,
5748
- checked: C
5751
+ value: C,
5752
+ checked: p
5749
5753
  }
5750
5754
  }) => {
5751
5755
  s == null || s({
5752
- checked: C,
5753
- value: f
5756
+ checked: p,
5757
+ value: C
5754
5758
  });
5755
- }, A = () => r ? "border-border-disabled checked:text-action-primary-disabled" : "border-border-default cursor-pointer checked:border-action-primary-default checked:bg-white hover:border-border-hovered checked:hover:border-action-primary-default checked:hover:bg-white checked:focus:border-action-primary-default checked:focus:bg-white checked:focus:ring-focused-default", g = W(() => Zn([t]), [t]);
5759
+ }, g = () => r ? "border-border-disabled checked:text-action-primary-disabled" : "border-border-default cursor-pointer checked:border-action-primary-default checked:bg-white hover:border-border-hovered checked:hover:border-action-primary-default checked:hover:bg-white checked:focus:border-action-primary-default checked:focus:bg-white checked:focus:ring-focused-default", f = W(() => Zn([t]), [t]);
5756
5760
  return /* @__PURE__ */ d(ye, {
5757
5761
  children: /* @__PURE__ */ M("div", {
5758
5762
  className: D("flex gap-x-2", !l && "items-center"),
5759
5763
  children: [/* @__PURE__ */ d("input", {
5760
5764
  type: "radio",
5761
- ref: g,
5765
+ ref: f,
5762
5766
  id: n,
5763
5767
  name: i,
5764
5768
  disabled: r,
5765
- onChange: c,
5769
+ onChange: A,
5766
5770
  checked: u,
5767
5771
  value: o,
5768
- className: D("border-2", A())
5772
+ className: D("border-2", g())
5769
5773
  }), a && /* @__PURE__ */ M("div", {
5770
5774
  className: "flex flex-col items-start justify-center",
5771
5775
  children: [/* @__PURE__ */ d(ne, {
@@ -5773,7 +5777,7 @@ const b0 = mt((e, t) => {
5773
5777
  variant: "body",
5774
5778
  className: "break-words",
5775
5779
  htmlFor: n,
5776
- color: r ? "disabled" : "default",
5780
+ color: r ? "disabled" : c,
5777
5781
  children: a
5778
5782
  }), l && /* @__PURE__ */ d(ne, {
5779
5783
  variant: "body",
@@ -6372,7 +6376,8 @@ const Uo = mt((e, t) => {
6372
6376
  onChange: s,
6373
6377
  isError: u,
6374
6378
  checked: c,
6375
- size: A = "sm"
6379
+ color: A = "default",
6380
+ size: g = "sm"
6376
6381
  } = e;
6377
6382
  return /* @__PURE__ */ d(ye, {
6378
6383
  children: /* @__PURE__ */ M("div", {
@@ -6385,18 +6390,18 @@ const Uo = mt((e, t) => {
6385
6390
  disabled: r,
6386
6391
  onChange: ({
6387
6392
  target: {
6388
- value: C,
6389
- checked: p
6393
+ value: p,
6394
+ checked: I
6390
6395
  }
6391
6396
  }) => {
6392
6397
  s == null || s({
6393
- checked: p,
6394
- value: C
6398
+ checked: I,
6399
+ value: p
6395
6400
  });
6396
6401
  },
6397
6402
  value: o,
6398
6403
  checked: c,
6399
- className: D((() => r ? "border-border-disabled checked:text-action-primary-disabled bg-action-secondary-default disabled:bg-action-secondary-disabled checked:hover:bg-action-secondary-disabled" : u ? "checked:bg-action-critical-default checked:text-letter-critical active:bg-action-critical-default border-border-critical-default checked:hover:bg-action-critical-default focus:ring-none ring-offset-0 active:ring-transparent focus:ring-transparent focus:ring-offset-0 focus:ring-critical-default" : "border-border-default hover:border-border-hovered focus:ring-focused-default ring-offset-1 active:ring-1 focus:ring-1 focus:ring-offset-1 cursor-pointer")(), "rounded-[5px] bg-white border-[1.5px]", A === "sm" && "h-[18px] w-[18px]", A === "md" && "h-[20px] w-[20px]")
6404
+ className: D((() => r ? "border-border-disabled checked:text-action-primary-disabled bg-action-secondary-default disabled:bg-action-secondary-disabled checked:hover:bg-action-secondary-disabled" : u ? "checked:bg-action-critical-default checked:text-letter-critical active:bg-action-critical-default border-border-critical-default checked:hover:bg-action-critical-default focus:ring-none ring-offset-0 active:ring-transparent focus:ring-transparent focus:ring-offset-0 focus:ring-critical-default" : "border-border-default hover:border-border-hovered focus:ring-focused-default ring-offset-1 active:ring-1 focus:ring-1 focus:ring-offset-1 cursor-pointer")(), "rounded-[5px] bg-white border-[1.5px]", g === "sm" && "h-[18px] w-[18px]", g === "md" && "h-[20px] w-[20px]")
6400
6405
  }), a && /* @__PURE__ */ M("div", {
6401
6406
  className: "flex flex-col items-start justify-center",
6402
6407
  children: [/* @__PURE__ */ d(ne, {
@@ -6404,7 +6409,7 @@ const Uo = mt((e, t) => {
6404
6409
  variant: "body",
6405
6410
  className: "break-words select-none",
6406
6411
  htmlFor: n,
6407
- color: r ? "disabled" : "default",
6412
+ color: r ? "disabled" : A,
6408
6413
  children: a
6409
6414
  }), l && /* @__PURE__ */ d(ne, {
6410
6415
  variant: "body",