@x-plat/design-system 0.1.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.
Files changed (165) hide show
  1. package/README.md +123 -0
  2. package/dist/attributes-DJIWir_0.d.cts +7 -0
  3. package/dist/attributes-DJIWir_0.d.ts +7 -0
  4. package/dist/breakpoints-DsXkJgdl.d.cts +35 -0
  5. package/dist/breakpoints-DsXkJgdl.d.ts +35 -0
  6. package/dist/colors-BG91q_uV.d.cts +133 -0
  7. package/dist/colors-BG91q_uV.d.ts +133 -0
  8. package/dist/components/Button/index.cjs +203 -0
  9. package/dist/components/Button/index.css +1231 -0
  10. package/dist/components/Button/index.d.cts +132 -0
  11. package/dist/components/Button/index.d.ts +132 -0
  12. package/dist/components/Button/index.js +176 -0
  13. package/dist/components/Card/index.cjs +56 -0
  14. package/dist/components/Card/index.css +27 -0
  15. package/dist/components/Card/index.d.cts +13 -0
  16. package/dist/components/Card/index.d.ts +13 -0
  17. package/dist/components/Card/index.js +29 -0
  18. package/dist/components/Chart/index.cjs +393 -0
  19. package/dist/components/Chart/index.css +4 -0
  20. package/dist/components/Chart/index.d.cts +10 -0
  21. package/dist/components/Chart/index.d.ts +10 -0
  22. package/dist/components/Chart/index.js +367 -0
  23. package/dist/components/CheckBox/index.cjs +1116 -0
  24. package/dist/components/CheckBox/index.css +598 -0
  25. package/dist/components/CheckBox/index.d.cts +132 -0
  26. package/dist/components/CheckBox/index.d.ts +132 -0
  27. package/dist/components/CheckBox/index.js +1089 -0
  28. package/dist/components/Chip/index.cjs +193 -0
  29. package/dist/components/Chip/index.css +1227 -0
  30. package/dist/components/Chip/index.d.cts +132 -0
  31. package/dist/components/Chip/index.d.ts +132 -0
  32. package/dist/components/Chip/index.js +166 -0
  33. package/dist/components/DatePicker/index.cjs +1653 -0
  34. package/dist/components/DatePicker/index.css +1417 -0
  35. package/dist/components/DatePicker/index.d.cts +56 -0
  36. package/dist/components/DatePicker/index.d.ts +56 -0
  37. package/dist/components/DatePicker/index.js +1613 -0
  38. package/dist/components/HtmlTypeWriter/index.cjs +172 -0
  39. package/dist/components/HtmlTypeWriter/index.css +23 -0
  40. package/dist/components/HtmlTypeWriter/index.d.cts +14 -0
  41. package/dist/components/HtmlTypeWriter/index.d.ts +14 -0
  42. package/dist/components/HtmlTypeWriter/index.js +135 -0
  43. package/dist/components/ImageSelector/index.cjs +1063 -0
  44. package/dist/components/ImageSelector/index.css +85 -0
  45. package/dist/components/ImageSelector/index.d.cts +10 -0
  46. package/dist/components/ImageSelector/index.d.ts +10 -0
  47. package/dist/components/ImageSelector/index.js +1026 -0
  48. package/dist/components/Input/index.cjs +410 -0
  49. package/dist/components/Input/index.css +74 -0
  50. package/dist/components/Input/index.d.cts +23 -0
  51. package/dist/components/Input/index.d.ts +23 -0
  52. package/dist/components/Input/index.js +372 -0
  53. package/dist/components/Modal/index.cjs +101 -0
  54. package/dist/components/Modal/index.css +39 -0
  55. package/dist/components/Modal/index.d.cts +16 -0
  56. package/dist/components/Modal/index.d.ts +16 -0
  57. package/dist/components/Modal/index.js +64 -0
  58. package/dist/components/PopOver/index.cjs +176 -0
  59. package/dist/components/PopOver/index.css +27 -0
  60. package/dist/components/PopOver/index.d.cts +15 -0
  61. package/dist/components/PopOver/index.d.ts +15 -0
  62. package/dist/components/PopOver/index.js +139 -0
  63. package/dist/components/Radio/index.cjs +257 -0
  64. package/dist/components/Radio/index.css +777 -0
  65. package/dist/components/Radio/index.d.cts +154 -0
  66. package/dist/components/Radio/index.d.ts +154 -0
  67. package/dist/components/Radio/index.js +219 -0
  68. package/dist/components/Select/index.cjs +1203 -0
  69. package/dist/components/Select/index.css +136 -0
  70. package/dist/components/Select/index.d.cts +44 -0
  71. package/dist/components/Select/index.d.ts +44 -0
  72. package/dist/components/Select/index.js +1165 -0
  73. package/dist/components/Swiper/index.cjs +144 -0
  74. package/dist/components/Swiper/index.d.cts +24 -0
  75. package/dist/components/Swiper/index.d.ts +24 -0
  76. package/dist/components/Swiper/index.js +128 -0
  77. package/dist/components/Switch/index.cjs +240 -0
  78. package/dist/components/Switch/index.css +780 -0
  79. package/dist/components/Switch/index.d.cts +131 -0
  80. package/dist/components/Switch/index.d.ts +131 -0
  81. package/dist/components/Switch/index.js +203 -0
  82. package/dist/components/Tab/index.cjs +122 -0
  83. package/dist/components/Tab/index.css +59 -0
  84. package/dist/components/Tab/index.d.cts +18 -0
  85. package/dist/components/Tab/index.d.ts +18 -0
  86. package/dist/components/Tab/index.js +85 -0
  87. package/dist/components/Table/index.cjs +384 -0
  88. package/dist/components/Table/index.css +4093 -0
  89. package/dist/components/Table/index.d.cts +174 -0
  90. package/dist/components/Table/index.d.ts +174 -0
  91. package/dist/components/Table/index.js +343 -0
  92. package/dist/components/TextArea/index.cjs +114 -0
  93. package/dist/components/TextArea/index.css +34 -0
  94. package/dist/components/TextArea/index.d.cts +6 -0
  95. package/dist/components/TextArea/index.d.ts +6 -0
  96. package/dist/components/TextArea/index.js +77 -0
  97. package/dist/components/Tooltip/index.cjs +210 -0
  98. package/dist/components/Tooltip/index.css +599 -0
  99. package/dist/components/Tooltip/index.d.cts +134 -0
  100. package/dist/components/Tooltip/index.d.ts +134 -0
  101. package/dist/components/Tooltip/index.js +173 -0
  102. package/dist/components/Video/index.cjs +269 -0
  103. package/dist/components/Video/index.css +71 -0
  104. package/dist/components/Video/index.d.cts +15 -0
  105. package/dist/components/Video/index.d.ts +15 -0
  106. package/dist/components/Video/index.js +232 -0
  107. package/dist/components/index.cjs +3221 -0
  108. package/dist/components/index.css +9972 -0
  109. package/dist/components/index.d.cts +23 -0
  110. package/dist/components/index.d.ts +23 -0
  111. package/dist/components/index.js +3167 -0
  112. package/dist/index.cjs +8216 -0
  113. package/dist/index.css +10087 -0
  114. package/dist/index.d.cts +31 -0
  115. package/dist/index.d.ts +31 -0
  116. package/dist/index.js +7855 -0
  117. package/dist/layout/Grid/FullGrid/index.cjs +54 -0
  118. package/dist/layout/Grid/FullGrid/index.css +21 -0
  119. package/dist/layout/Grid/FullGrid/index.d.cts +9 -0
  120. package/dist/layout/Grid/FullGrid/index.d.ts +9 -0
  121. package/dist/layout/Grid/FullGrid/index.js +27 -0
  122. package/dist/layout/Grid/FullScreen/index.cjs +54 -0
  123. package/dist/layout/Grid/FullScreen/index.css +23 -0
  124. package/dist/layout/Grid/FullScreen/index.d.cts +9 -0
  125. package/dist/layout/Grid/FullScreen/index.d.ts +9 -0
  126. package/dist/layout/Grid/FullScreen/index.js +27 -0
  127. package/dist/layout/Grid/GapGrid/index.cjs +32 -0
  128. package/dist/layout/Grid/GapGrid/index.d.cts +12 -0
  129. package/dist/layout/Grid/GapGrid/index.d.ts +12 -0
  130. package/dist/layout/Grid/GapGrid/index.js +11 -0
  131. package/dist/layout/Grid/Item/index.cjs +71 -0
  132. package/dist/layout/Grid/Item/index.css +19 -0
  133. package/dist/layout/Grid/Item/index.d.cts +20 -0
  134. package/dist/layout/Grid/Item/index.d.ts +20 -0
  135. package/dist/layout/Grid/Item/index.js +44 -0
  136. package/dist/layout/Grid/index.cjs +95 -0
  137. package/dist/layout/Grid/index.css +65 -0
  138. package/dist/layout/Grid/index.d.cts +5 -0
  139. package/dist/layout/Grid/index.d.ts +5 -0
  140. package/dist/layout/Grid/index.js +65 -0
  141. package/dist/layout/Header/index.cjs +45 -0
  142. package/dist/layout/Header/index.css +11 -0
  143. package/dist/layout/Header/index.d.cts +10 -0
  144. package/dist/layout/Header/index.d.ts +10 -0
  145. package/dist/layout/Header/index.js +18 -0
  146. package/dist/layout/Layout/index.cjs +44 -0
  147. package/dist/layout/Layout/index.css +23 -0
  148. package/dist/layout/Layout/index.d.cts +15 -0
  149. package/dist/layout/Layout/index.d.ts +15 -0
  150. package/dist/layout/Layout/index.js +17 -0
  151. package/dist/layout/SideBar/index.cjs +101 -0
  152. package/dist/layout/SideBar/index.css +10 -0
  153. package/dist/layout/SideBar/index.d.cts +16 -0
  154. package/dist/layout/SideBar/index.d.ts +16 -0
  155. package/dist/layout/SideBar/index.js +62 -0
  156. package/dist/layout/index.cjs +188 -0
  157. package/dist/layout/index.css +112 -0
  158. package/dist/layout/index.d.cts +8 -0
  159. package/dist/layout/index.d.ts +8 -0
  160. package/dist/layout/index.js +143 -0
  161. package/dist/tokens/index.cjs +6225 -0
  162. package/dist/tokens/index.d.cts +593 -0
  163. package/dist/tokens/index.d.ts +593 -0
  164. package/dist/tokens/index.js +5900 -0
  165. package/package.json +86 -0
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Swiper/index.tsx
21
+ var Swiper_exports = {};
22
+ __export(Swiper_exports, {
23
+ default: () => Swiper_default
24
+ });
25
+ module.exports = __toCommonJS(Swiper_exports);
26
+ var import_react = require("react");
27
+ var import_modules = require("swiper/modules");
28
+ var import_react2 = require("swiper/react");
29
+ var import_css = require("swiper/css");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var SwiperContentComponent = ({
32
+ auto = false,
33
+ swiperRef = null,
34
+ renderItems,
35
+ viewItemCount = 3,
36
+ maxItems,
37
+ freeMode = false,
38
+ options,
39
+ loop = false,
40
+ spaceBetween = 50,
41
+ centeredSlides = false,
42
+ loopSlides = 0,
43
+ isProgress = true,
44
+ totalItemCount = 3,
45
+ showAutoplayProgress = false,
46
+ autoplayDelay = 3e3
47
+ }) => {
48
+ const progressRef = (0, import_react.useRef)(null);
49
+ const [isAnimating, setIsAnimating] = (0, import_react.useState)(false);
50
+ const [activeIndex, setActiveIndex] = (0, import_react.useState)(1);
51
+ const [_width, setWidth] = (0, import_react.useState)(0);
52
+ const setSwiperInstance = (0, import_react.useCallback)(
53
+ (swiper) => {
54
+ if (swiperRef) swiperRef.current = swiper;
55
+ },
56
+ [swiperRef]
57
+ );
58
+ const onChangeCurrentSlide = (swiper) => {
59
+ const activeIndex2 = swiper.realIndex;
60
+ if (activeIndex2 > 2) {
61
+ const setIdx = activeIndex2 % totalItemCount;
62
+ setActiveIndex(setIdx);
63
+ } else {
64
+ setActiveIndex(activeIndex2);
65
+ }
66
+ if (showAutoplayProgress) {
67
+ setIsAnimating(false);
68
+ requestAnimationFrame(() => {
69
+ setIsAnimating(true);
70
+ });
71
+ }
72
+ };
73
+ (0, import_react.useEffect)(() => {
74
+ if (progressRef.current) {
75
+ const updateWidth = () => {
76
+ const width = progressRef.current?.getBoundingClientRect().width || 420;
77
+ setWidth(width);
78
+ };
79
+ updateWidth();
80
+ window.addEventListener("resize", updateWidth);
81
+ return () => {
82
+ window.removeEventListener("resize", updateWidth);
83
+ };
84
+ }
85
+ }, []);
86
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full", children: [
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
+ import_react2.Swiper,
89
+ {
90
+ className: "w-full overflow-hidden text-[0px] !mr-0",
91
+ wrapperTag: "ul",
92
+ loop,
93
+ freeMode: { enabled: freeMode },
94
+ modules: auto ? [import_modules.Autoplay, import_modules.FreeMode, import_modules.Pagination] : [import_modules.FreeMode],
95
+ slidesPerView: viewItemCount,
96
+ spaceBetween,
97
+ onSlideChange: onChangeCurrentSlide,
98
+ onSwiper: setSwiperInstance,
99
+ autoplay: {
100
+ disableOnInteraction: false,
101
+ delay: autoplayDelay
102
+ },
103
+ speed: 500,
104
+ centeredSlides,
105
+ loopAdditionalSlides: loopSlides,
106
+ ...options,
107
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative", children: renderItems && renderItems.map((item, idx) => {
108
+ if (maxItems && idx < maxItems) {
109
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
+ import_react2.SwiperSlide,
111
+ {
112
+ className: "w-auto h-auto flex items-center [transition-timing-function:linear]",
113
+ tag: "li",
114
+ children: item
115
+ },
116
+ idx
117
+ );
118
+ }
119
+ if (!maxItems) {
120
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
121
+ import_react2.SwiperSlide,
122
+ {
123
+ className: "w-auto h-auto flex items-center [transition-timing-function:linear]",
124
+ tag: "li",
125
+ children: item
126
+ },
127
+ idx
128
+ );
129
+ }
130
+ }) })
131
+ }
132
+ ),
133
+ (isProgress || showAutoplayProgress) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-6 md:mt-10 flex justify-center w-full px-9 md:px-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-[90%] md:w-[580px] h-[2px] bg-[#f5f5f5] relative", children: auto && showAutoplayProgress && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ "span",
135
+ {
136
+ className: `absolute inset-y-0 left-0 h-full bg-[#10b259] w-0 ${isAnimating ? "animate-fillBar" : ""}`,
137
+ style: { animationDuration: `${autoplayDelay}ms` }
138
+ },
139
+ activeIndex
140
+ ) }) })
141
+ ] });
142
+ };
143
+ SwiperContentComponent.displayName = "Swiper";
144
+ var Swiper_default = SwiperContentComponent;
@@ -0,0 +1,24 @@
1
+ import React, { MutableRefObject, ReactNode } from 'react';
2
+ import { SwiperClass } from 'swiper/react';
3
+ import { SwiperOptions } from 'swiper/types';
4
+
5
+ interface SwiperComponentProps {
6
+ auto?: boolean;
7
+ swiperRef?: MutableRefObject<SwiperClass | null>;
8
+ renderItems?: Array<ReactNode>;
9
+ viewItemCount?: number | "auto";
10
+ maxItems?: number;
11
+ freeMode?: boolean;
12
+ options?: SwiperOptions;
13
+ loop?: boolean;
14
+ spaceBetween?: number;
15
+ centeredSlides?: boolean;
16
+ loopSlides?: number;
17
+ isProgress?: boolean;
18
+ totalItemCount?: number;
19
+ showAutoplayProgress?: boolean;
20
+ autoplayDelay?: number;
21
+ }
22
+ declare const SwiperContentComponent: React.FC<SwiperComponentProps>;
23
+
24
+ export { SwiperContentComponent as default };
@@ -0,0 +1,24 @@
1
+ import React, { MutableRefObject, ReactNode } from 'react';
2
+ import { SwiperClass } from 'swiper/react';
3
+ import { SwiperOptions } from 'swiper/types';
4
+
5
+ interface SwiperComponentProps {
6
+ auto?: boolean;
7
+ swiperRef?: MutableRefObject<SwiperClass | null>;
8
+ renderItems?: Array<ReactNode>;
9
+ viewItemCount?: number | "auto";
10
+ maxItems?: number;
11
+ freeMode?: boolean;
12
+ options?: SwiperOptions;
13
+ loop?: boolean;
14
+ spaceBetween?: number;
15
+ centeredSlides?: boolean;
16
+ loopSlides?: number;
17
+ isProgress?: boolean;
18
+ totalItemCount?: number;
19
+ showAutoplayProgress?: boolean;
20
+ autoplayDelay?: number;
21
+ }
22
+ declare const SwiperContentComponent: React.FC<SwiperComponentProps>;
23
+
24
+ export { SwiperContentComponent as default };
@@ -0,0 +1,128 @@
1
+ // src/components/Swiper/index.tsx
2
+ import {
3
+ useCallback,
4
+ useEffect,
5
+ useRef,
6
+ useState
7
+ } from "react";
8
+ import { Autoplay, FreeMode, Pagination } from "swiper/modules";
9
+ import { Swiper, SwiperSlide } from "swiper/react";
10
+ import "swiper/css";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ var SwiperContentComponent = ({
13
+ auto = false,
14
+ swiperRef = null,
15
+ renderItems,
16
+ viewItemCount = 3,
17
+ maxItems,
18
+ freeMode = false,
19
+ options,
20
+ loop = false,
21
+ spaceBetween = 50,
22
+ centeredSlides = false,
23
+ loopSlides = 0,
24
+ isProgress = true,
25
+ totalItemCount = 3,
26
+ showAutoplayProgress = false,
27
+ autoplayDelay = 3e3
28
+ }) => {
29
+ const progressRef = useRef(null);
30
+ const [isAnimating, setIsAnimating] = useState(false);
31
+ const [activeIndex, setActiveIndex] = useState(1);
32
+ const [_width, setWidth] = useState(0);
33
+ const setSwiperInstance = useCallback(
34
+ (swiper) => {
35
+ if (swiperRef) swiperRef.current = swiper;
36
+ },
37
+ [swiperRef]
38
+ );
39
+ const onChangeCurrentSlide = (swiper) => {
40
+ const activeIndex2 = swiper.realIndex;
41
+ if (activeIndex2 > 2) {
42
+ const setIdx = activeIndex2 % totalItemCount;
43
+ setActiveIndex(setIdx);
44
+ } else {
45
+ setActiveIndex(activeIndex2);
46
+ }
47
+ if (showAutoplayProgress) {
48
+ setIsAnimating(false);
49
+ requestAnimationFrame(() => {
50
+ setIsAnimating(true);
51
+ });
52
+ }
53
+ };
54
+ useEffect(() => {
55
+ if (progressRef.current) {
56
+ const updateWidth = () => {
57
+ const width = progressRef.current?.getBoundingClientRect().width || 420;
58
+ setWidth(width);
59
+ };
60
+ updateWidth();
61
+ window.addEventListener("resize", updateWidth);
62
+ return () => {
63
+ window.removeEventListener("resize", updateWidth);
64
+ };
65
+ }
66
+ }, []);
67
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
68
+ /* @__PURE__ */ jsx(
69
+ Swiper,
70
+ {
71
+ className: "w-full overflow-hidden text-[0px] !mr-0",
72
+ wrapperTag: "ul",
73
+ loop,
74
+ freeMode: { enabled: freeMode },
75
+ modules: auto ? [Autoplay, FreeMode, Pagination] : [FreeMode],
76
+ slidesPerView: viewItemCount,
77
+ spaceBetween,
78
+ onSlideChange: onChangeCurrentSlide,
79
+ onSwiper: setSwiperInstance,
80
+ autoplay: {
81
+ disableOnInteraction: false,
82
+ delay: autoplayDelay
83
+ },
84
+ speed: 500,
85
+ centeredSlides,
86
+ loopAdditionalSlides: loopSlides,
87
+ ...options,
88
+ children: /* @__PURE__ */ jsx("div", { className: "relative", children: renderItems && renderItems.map((item, idx) => {
89
+ if (maxItems && idx < maxItems) {
90
+ return /* @__PURE__ */ jsx(
91
+ SwiperSlide,
92
+ {
93
+ className: "w-auto h-auto flex items-center [transition-timing-function:linear]",
94
+ tag: "li",
95
+ children: item
96
+ },
97
+ idx
98
+ );
99
+ }
100
+ if (!maxItems) {
101
+ return /* @__PURE__ */ jsx(
102
+ SwiperSlide,
103
+ {
104
+ className: "w-auto h-auto flex items-center [transition-timing-function:linear]",
105
+ tag: "li",
106
+ children: item
107
+ },
108
+ idx
109
+ );
110
+ }
111
+ }) })
112
+ }
113
+ ),
114
+ (isProgress || showAutoplayProgress) && /* @__PURE__ */ jsx("div", { className: "mt-6 md:mt-10 flex justify-center w-full px-9 md:px-0", children: /* @__PURE__ */ jsx("div", { className: "w-[90%] md:w-[580px] h-[2px] bg-[#f5f5f5] relative", children: auto && showAutoplayProgress && /* @__PURE__ */ jsx(
115
+ "span",
116
+ {
117
+ className: `absolute inset-y-0 left-0 h-full bg-[#10b259] w-0 ${isAnimating ? "animate-fillBar" : ""}`,
118
+ style: { animationDuration: `${autoplayDelay}ms` }
119
+ },
120
+ activeIndex
121
+ ) }) })
122
+ ] });
123
+ };
124
+ SwiperContentComponent.displayName = "Swiper";
125
+ var Swiper_default = SwiperContentComponent;
126
+ export {
127
+ Swiper_default as default
128
+ };
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/Switch/index.ts
31
+ var Switch_exports = {};
32
+ __export(Switch_exports, {
33
+ Switch: () => Switch_default
34
+ });
35
+ module.exports = __toCommonJS(Switch_exports);
36
+
37
+ // src/components/Switch/Switch.tsx
38
+ var import_react = __toESM(require("react"), 1);
39
+
40
+ // src/tokens/colors.ts
41
+ var colors = {
42
+ xplat: {
43
+ red: {
44
+ 50: "#FFF0F0",
45
+ 100: "#FFDDDE",
46
+ 200: "#FFC1C2",
47
+ 300: "#FF9698",
48
+ 400: "#FF5A5D",
49
+ 500: "#FF272B",
50
+ 600: "#F80409",
51
+ 700: "#D40105",
52
+ 800: "#AE0609",
53
+ 900: "#900C0F"
54
+ },
55
+ green: {
56
+ 50: "#E5F6EA",
57
+ 100: "#C1E7CC",
58
+ 200: "#98D8AC",
59
+ 300: "#6CCA8B",
60
+ 400: "#47BE72",
61
+ 500: "#10B259",
62
+ 600: "#00A34F",
63
+ 700: "#009143",
64
+ 800: "#007F38",
65
+ 900: "#006024"
66
+ },
67
+ orange: {
68
+ 50: "#FFF8EC",
69
+ 100: "#FFF0D3",
70
+ 200: "#FFDDA5",
71
+ 300: "#FFC46D",
72
+ 400: "#FF9F32",
73
+ 500: "#FF820A",
74
+ 600: "#FF6900",
75
+ 700: "#CC4B02",
76
+ 800: "#A13A0B",
77
+ 900: "#82320C"
78
+ },
79
+ yellow: {
80
+ 50: "#FFFDE7",
81
+ 100: "#FFFAC1",
82
+ 200: "#FFF186",
83
+ 300: "#FFE041",
84
+ 400: "#FFCC0D",
85
+ 500: "#F0B100",
86
+ 600: "#D18800",
87
+ 700: "#A66002",
88
+ 800: "#894B0A",
89
+ 900: "#743D0F"
90
+ },
91
+ blue: {
92
+ 50: "#F1F4FD",
93
+ 100: "#DFE7FA",
94
+ 200: "#C5D4F8",
95
+ 300: "#9EB8F2",
96
+ 400: "#7093EA",
97
+ 500: "#4D6DE3",
98
+ 600: "#3950D7",
99
+ 700: "#303EC5",
100
+ 800: "#2D35A0",
101
+ 900: "#29317F"
102
+ },
103
+ lightblue: {
104
+ 50: "#EEFAFF",
105
+ 100: "#D9F4FF",
106
+ 200: "#BBEDFF",
107
+ 300: "#8DE3FF",
108
+ 400: "#57D0FF",
109
+ 500: "#30B6FF",
110
+ 600: "#1999F7",
111
+ 700: "#1280E3",
112
+ 800: "#1566B8",
113
+ 900: "#175791"
114
+ },
115
+ purple: {
116
+ 50: "#FBF6FE",
117
+ 100: "#F5EAFD",
118
+ 200: "#EDD8FC",
119
+ 300: "#E0BAF8",
120
+ 400: "#CD8DF3",
121
+ 500: "#B961EB",
122
+ 600: "#A541DC",
123
+ 700: "#9230C5",
124
+ 800: "#782B9E",
125
+ 900: "#62247F"
126
+ },
127
+ pink: {
128
+ 50: "#FFF4FE",
129
+ 100: "#FFE7FD",
130
+ 200: "#FFCFFA",
131
+ 300: "#FEA9F1",
132
+ 400: "#FD75E7",
133
+ 500: "#F553DA",
134
+ 600: "#D821B6",
135
+ 700: "#B31892",
136
+ 800: "#921676",
137
+ 900: "#781761"
138
+ },
139
+ neutral: {
140
+ 50: "#FAFAFA",
141
+ 100: "#F5F5F5",
142
+ 200: "#E5E5E5",
143
+ 300: "#D4D4D4",
144
+ 400: "#A1A1A1",
145
+ 500: "#737373",
146
+ 600: "#525252",
147
+ 700: "#404040",
148
+ 800: "#262626",
149
+ 900: "#171717"
150
+ },
151
+ black: "#000000",
152
+ white: "#FFFFFF"
153
+ },
154
+ test: {
155
+ default: "#ffffff"
156
+ }
157
+ };
158
+
159
+ // src/util/getColor.ts
160
+ var getColorClass = (namespace, palette, shade) => {
161
+ const namespaceMap = colors[namespace];
162
+ const paletteMap = namespaceMap[palette];
163
+ const hasShade = paletteMap && typeof paletteMap === "object" && shade !== void 0 && shade in paletteMap;
164
+ return `${String(namespace)}-${String(palette)}${hasShade ? `-${String(shade)}` : ""}`;
165
+ };
166
+
167
+ // node_modules/clsx/dist/clsx.mjs
168
+ function r(e) {
169
+ var t, f, n = "";
170
+ if ("string" == typeof e || "number" == typeof e) n += e;
171
+ else if ("object" == typeof e) if (Array.isArray(e)) {
172
+ var o = e.length;
173
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
174
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
175
+ return n;
176
+ }
177
+ function clsx() {
178
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
179
+ return n;
180
+ }
181
+ var clsx_default = clsx;
182
+
183
+ // src/components/Switch/Switch.tsx
184
+ var import_jsx_runtime = require("react/jsx-runtime");
185
+ var KNOB_TRANSITION_MS = 250;
186
+ var Switch = (props) => {
187
+ const {
188
+ value,
189
+ disabled,
190
+ onChange,
191
+ colorNamespace = "xplat",
192
+ color = "blue",
193
+ colorDepth,
194
+ className
195
+ } = props;
196
+ const [isAnimating, setIsAnimating] = import_react.default.useState(false);
197
+ const timeoutRef = import_react.default.useRef(null);
198
+ import_react.default.useEffect(() => {
199
+ return () => {
200
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
201
+ };
202
+ }, []);
203
+ const handleClick = () => {
204
+ if (disabled || isAnimating) return;
205
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
206
+ setIsAnimating(true);
207
+ onChange?.(!value);
208
+ timeoutRef.current = setTimeout(() => {
209
+ setIsAnimating(false);
210
+ timeoutRef.current = null;
211
+ }, KNOB_TRANSITION_MS);
212
+ };
213
+ const colorClass = getColorClass(
214
+ colorNamespace,
215
+ color,
216
+ colorDepth ?? 500
217
+ );
218
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
+ "div",
220
+ {
221
+ className: clsx_default(
222
+ "lib-xplat-switch",
223
+ value ? "checked" : void 0,
224
+ disabled && "disabled",
225
+ isAnimating && "animating",
226
+ colorClass,
227
+ className
228
+ ),
229
+ onClick: handleClick,
230
+ "aria-disabled": disabled || isAnimating,
231
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
232
+ }
233
+ );
234
+ };
235
+ Switch.displayName = "Switch";
236
+ var Switch_default = Switch;
237
+ // Annotate the CommonJS export names for ESM import in node:
238
+ 0 && (module.exports = {
239
+ Switch
240
+ });