@cagatayfdn/flora-components 0.0.108 → 0.0.109

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/Switch.css CHANGED
@@ -1 +1 @@
1
- ._switch_ptgnt_1{position:relative;display:inline-block;width:70px;height:26px;border-radius:24px}._switch_ptgnt_1 input{opacity:0;width:0;height:0;margin:0}._switch_ptgnt_1._checked_ptgnt_14{border-color:transparent}._switch_ptgnt_1._disabled_ptgnt_17{opacity:.5}._slider_ptgnt_21{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#d4d6f0;border-color:2px solid;-webkit-transition:.4s;transition:.4s;border-radius:30px;text-align:inherit!important}._slider_ptgnt_21 span{font-size:9px;text-transform:uppercase;font-weight:500;padding:0 5px;display:flex!important;justify-content:flex-end;align-items:center;height:100%}._slider_ptgnt_21:before{position:absolute;content:"";height:22px;width:22px;bottom:2px;background-color:#fff;-webkit-transition:.4s;transition:.4s;border-radius:30px;transform:translate(2px)}input:checked+._slider_ptgnt_21{background-color:#71d200}input:checked+._slider_ptgnt_21 span{justify-content:flex-start}input:focus+._slider_ptgnt_21{box-shadow:0 0 1px #71d200}input:checked+._slider_ptgnt_21:before{transform:translate(46px)}._slider_ptgnt_21._round_ptgnt_75{border-radius:34px}._slider_ptgnt_21._round_ptgnt_75:before{border-radius:50%}._active_ptgnt_83{padding-left:10px!important}._passive_ptgnt_87{padding-right:10px!important}
1
+ ._switch_5793j_1{position:relative;display:inline-block;width:58px;height:26px;border-radius:24px}._switch_5793j_1 input{opacity:0;width:0;height:0;margin:0}._switch_5793j_1._checked_5793j_14{border-color:transparent}._switch_5793j_1._disabled_5793j_17{opacity:.5}._switch__small_5793j_20{width:58px}._switch__small_5793j_20 input:checked+._slider_5793j_23:before{transform:translate(33px)}._switch__small_5793j_20 ._active_5793j_26{padding-left:7px}._switch__small_5793j_20 ._passive_5793j_29{padding-right:7px}._switch__large_5793j_32{width:82px}._switch__large_5793j_32 input:checked+._slider_5793j_23:before{transform:translate(58px)}._switch__large_5793j_32 ._passive_5793j_29{padding-right:11px}._switch__large_5793j_32 ._active_5793j_26{padding-left:11px}._slider_5793j_23{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#d4d6f0;border-color:2px solid;-webkit-transition:.4s;transition:.4s;border-radius:30px;text-align:inherit!important}._slider_5793j_23 span{font-size:9px;text-transform:uppercase;font-weight:700;padding:0 5px;display:flex!important;justify-content:flex-end;align-items:center;height:100%}._slider_5793j_23:before{position:absolute;content:"";height:22px;width:22px;bottom:2px;background-color:#fff;-webkit-transition:.4s;transition:.4s;border-radius:30px;transform:translate(2px)}input:checked+._slider_5793j_23{background-color:#71d200}input:checked+._slider_5793j_23 span{justify-content:flex-start}input:focus+._slider_5793j_23{box-shadow:0 0 1px #71d200}._slider_5793j_23._round_5793j_95{border-radius:34px}._slider_5793j_23._round_5793j_95:before{border-radius:50%}
@@ -1,71 +1,76 @@
1
- import { j as c } from "../../jsx-runtime-BcAkpsdy.js";
2
- import u, { useState as v, useEffect as h } from "react";
3
- import { c as a } from "../../index-BHf7G3IG.js";
4
- import w from "../Label/Label.js";
5
- import { u as g } from "../../useTranslation-CnCPcxVj.js";
6
- import '../../Switch.css';const N = "_checked_ptgnt_14", y = "_disabled_ptgnt_17", b = "_slider_ptgnt_21", O = "_round_ptgnt_75", R = "_active_ptgnt_83", C = "_passive_ptgnt_87", s = {
7
- switch: "_switch_ptgnt_1",
8
- checked: N,
9
- disabled: y,
10
- slider: b,
11
- round: O,
12
- active: R,
13
- passive: C
14
- }, q = u.forwardRef(
1
+ import { j as e } from "../../jsx-runtime-BcAkpsdy.js";
2
+ import u, { useState as v, useEffect as j } from "react";
3
+ import { c as d } from "../../index-BHf7G3IG.js";
4
+ import N from "../Label/Label.js";
5
+ import { Size as y } from "../../enums/size.js";
6
+ import { u as b } from "../../useTranslation-CnCPcxVj.js";
7
+ import '../../Switch.css';const S = "_checked_5793j_14", O = "_disabled_5793j_17", R = "_switch__small_5793j_20", g = "_slider_5793j_23", C = "_active_5793j_26", E = "_passive_5793j_29", F = "_switch__large_5793j_32", L = "_round_5793j_95", t = {
8
+ switch: "_switch_5793j_1",
9
+ checked: S,
10
+ disabled: O,
11
+ switch__small: R,
12
+ slider: g,
13
+ active: C,
14
+ passive: E,
15
+ switch__large: F,
16
+ round: L
17
+ }, B = u.forwardRef(
15
18
  ({
16
- name: d,
19
+ name: a,
17
20
  label: r,
18
- className: m,
21
+ className: p,
19
22
  isDisabled: i,
20
- value: e,
23
+ value: c,
21
24
  onChange: o,
22
- onLabelClick: _,
25
+ onLabelClick: n,
23
26
  checkedChildren: f,
24
- unCheckedChildren: x,
25
- ...n
26
- }, k) => {
27
- const [t, l] = v(e), { t: p } = g();
28
- h(() => {
29
- !n.readOnly && !i && e !== void 0 && o && o(t);
30
- }, [t, e]), h(() => {
31
- e && l(e);
32
- }, [e]);
33
- const j = () => {
34
- !i && !n.readOnly && l(!t), !i && _ && _(!t);
27
+ size: l = y.SM,
28
+ unCheckedChildren: w,
29
+ ..._
30
+ }, x) => {
31
+ const [s, h] = v(c), { t: m } = b();
32
+ j(() => {
33
+ !_.readOnly && !i && c !== void 0 && o && o(s);
34
+ }, [s, c]), j(() => {
35
+ c && h(c);
36
+ }, [c]);
37
+ const k = () => {
38
+ !i && !_.readOnly && h(!s), !i && n && n(!s);
35
39
  };
36
- return /* @__PURE__ */ c.jsxs("div", { className: a(s.container, m), "data-testid": "switch-container", children: [
37
- r && /* @__PURE__ */ c.jsx(w, { name: d, children: r }),
38
- /* @__PURE__ */ c.jsx("div", { className: s.block, children: /* @__PURE__ */ c.jsxs(
40
+ return /* @__PURE__ */ e.jsxs("div", { className: d(t.container, p), "data-testid": "switch-container", children: [
41
+ r && /* @__PURE__ */ e.jsx(N, { name: a, children: r }),
42
+ /* @__PURE__ */ e.jsx("div", { className: t.block, children: /* @__PURE__ */ e.jsxs(
39
43
  "label",
40
44
  {
41
- className: a(s.switch, {
42
- [s.checked]: t,
43
- [s.disabled]: i
45
+ className: d(t.switch, {
46
+ [t.checked]: s,
47
+ [t.disabled]: i,
48
+ [t[`switch__${l}`]]: l
44
49
  }),
45
- htmlFor: d,
46
- onClick: () => j(),
50
+ htmlFor: a,
51
+ onClick: () => k(),
47
52
  children: [
48
- /* @__PURE__ */ c.jsx(
53
+ /* @__PURE__ */ e.jsx(
49
54
  "input",
50
55
  {
51
56
  type: "checkbox",
52
- name: d,
53
- value: e,
57
+ name: a,
58
+ value: c,
54
59
  "data-testid": "switch-input",
55
- ref: k,
56
- checked: t,
60
+ ref: x,
61
+ checked: s,
57
62
  readOnly: !0,
58
- ...n
63
+ ..._
59
64
  }
60
65
  ),
61
- /* @__PURE__ */ c.jsx("span", { className: s.slider, children: /* @__PURE__ */ c.jsx(
66
+ /* @__PURE__ */ e.jsx("span", { className: t.slider, children: /* @__PURE__ */ e.jsx(
62
67
  "span",
63
68
  {
64
- className: a({
65
- [s.active]: t,
66
- [s.passive]: !t
69
+ className: d({
70
+ [t.active]: s,
71
+ [t.passive]: !s
67
72
  }),
68
- children: t ? f || p("text.active") : x || p("text.passive")
73
+ children: s ? f || m("text.active") : w || m("text.passive")
69
74
  }
70
75
  ) })
71
76
  ]
@@ -75,5 +80,5 @@ import '../../Switch.css';const N = "_checked_ptgnt_14", y = "_disabled_ptgnt_17
75
80
  }
76
81
  );
77
82
  export {
78
- q as default
83
+ B as default
79
84
  };
package/dist/index.d.mts CHANGED
@@ -1231,6 +1231,7 @@ export declare const Switch: React_2.ForwardRefExoticComponent<{
1231
1231
  label?: string | undefined;
1232
1232
  checked?: boolean | undefined;
1233
1233
  className?: string | undefined;
1234
+ size?: Size | undefined;
1234
1235
  value?: any;
1235
1236
  onChange?: ((value: boolean) => void) | undefined;
1236
1237
  onLabelClick?: ((value: boolean) => void) | undefined;
@@ -1243,6 +1244,7 @@ export declare type SwitchProps = {
1243
1244
  label?: string;
1244
1245
  checked?: boolean;
1245
1246
  className?: string;
1247
+ size?: Size;
1246
1248
  value?: any;
1247
1249
  onChange?: (value: boolean) => void;
1248
1250
  onLabelClick?: (value: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -1231,6 +1231,7 @@ export declare const Switch: React_2.ForwardRefExoticComponent<{
1231
1231
  label?: string | undefined;
1232
1232
  checked?: boolean | undefined;
1233
1233
  className?: string | undefined;
1234
+ size?: Size | undefined;
1234
1235
  value?: any;
1235
1236
  onChange?: ((value: boolean) => void) | undefined;
1236
1237
  onLabelClick?: ((value: boolean) => void) | undefined;
@@ -1243,6 +1244,7 @@ export declare type SwitchProps = {
1243
1244
  label?: string;
1244
1245
  checked?: boolean;
1245
1246
  className?: string;
1247
+ size?: Size;
1246
1248
  value?: any;
1247
1249
  onChange?: (value: boolean) => void;
1248
1250
  onLabelClick?: (value: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cagatayfdn/flora-components",
3
- "version": "0.0.108",
3
+ "version": "0.0.109",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",