@companix/uikit 0.0.2 → 0.0.4

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 (222) hide show
  1. package/dist/Button/index.d.ts +20 -0
  2. package/dist/ButtonGroup/index.d.ts +7 -0
  3. package/dist/Checkbox/index.d.ts +10 -0
  4. package/dist/Countdown/index.d.ts +7 -0
  5. package/dist/DateInput/index.d.ts +13 -0
  6. package/dist/DatePicker/Calendar.d.ts +14 -0
  7. package/dist/DatePicker/CalendarHeader.d.ts +10 -0
  8. package/dist/DatePicker/index.d.ts +12 -0
  9. package/dist/Dialog/index.d.ts +12 -0
  10. package/dist/DialogAlert/Alert.d.ts +19 -0
  11. package/dist/DialogAlert/Viewport.d.ts +8 -0
  12. package/dist/DialogAlert/index.d.ts +11 -0
  13. package/dist/Drawer/index.d.ts +13 -0
  14. package/dist/File/index.d.ts +10 -0
  15. package/dist/Form/index.d.ts +17 -0
  16. package/dist/Icon/index.d.ts +7 -0
  17. package/dist/LoadButton/index.d.ts +5 -0
  18. package/dist/NumberInput/index.d.ts +6 -0
  19. package/dist/OptionItem/OptionItem.d.ts +7 -0
  20. package/dist/OptionItem/OptionsList.d.ts +8 -0
  21. package/dist/Popover/index.d.ts +26 -0
  22. package/dist/Radio/index.d.ts +20 -0
  23. package/dist/Scrollable/ImitateScroll.d.ts +10 -0
  24. package/dist/Scrollable/index.d.ts +33 -0
  25. package/dist/Select/SelectInput.d.ts +14 -0
  26. package/dist/Select/index.d.ts +15 -0
  27. package/dist/SelectTags/index.d.ts +15 -0
  28. package/dist/Spinner/index.d.ts +8 -0
  29. package/dist/Stepper/index.d.ts +8 -0
  30. package/dist/Switch/index.d.ts +10 -0
  31. package/dist/Tabs/index.d.ts +13 -0
  32. package/dist/TextArea/index.d.ts +7 -0
  33. package/dist/Toaster/RemoveListener.d.ts +3 -0
  34. package/dist/Toaster/Toast.d.ts +9 -0
  35. package/dist/Toaster/Viewport.d.ts +13 -0
  36. package/dist/Toaster/index.d.ts +15 -0
  37. package/dist/Tooltip/index.d.ts +8 -0
  38. package/dist/__hooks/use-frooze-closing.d.ts +5 -0
  39. package/dist/__hooks/use-loading.d.ts +8 -0
  40. package/dist/__hooks/use-local-storage.d.ts +1 -0
  41. package/dist/__hooks/use-popover-position.d.ts +8 -0
  42. package/dist/__hooks/use-previos.d.ts +2 -0
  43. package/dist/__hooks/use-resize.d.ts +3 -0
  44. package/dist/__hooks/use-scrollbox.d.ts +7 -0
  45. package/dist/__hooks/use-stepper-input.d.ts +13 -0
  46. package/dist/__hooks/use-update.d.ts +1 -0
  47. package/dist/__hooks/useCalendar.d.ts +17 -0
  48. package/dist/__hooks/useCalendarOptions-copy.d.ts +22 -0
  49. package/dist/__hooks/useCalendarOptions.d.ts +31 -0
  50. package/dist/__libs/calendar.d.ts +25 -0
  51. package/dist/__utils/utils.d.ts +25 -0
  52. package/dist/bundle.es.js +58 -0
  53. package/dist/bundle.es10.js +38 -0
  54. package/dist/bundle.es11.js +33 -0
  55. package/dist/bundle.es12.js +18 -0
  56. package/dist/bundle.es13.js +10 -0
  57. package/dist/bundle.es14.js +35 -0
  58. package/dist/bundle.es15.js +27 -0
  59. package/dist/bundle.es16.js +23 -0
  60. package/dist/bundle.es17.js +24 -0
  61. package/dist/bundle.es18.js +15 -0
  62. package/dist/bundle.es19.js +40 -0
  63. package/dist/bundle.es2.js +45 -0
  64. package/dist/bundle.es20.js +18 -0
  65. package/dist/bundle.es21.js +36 -0
  66. package/dist/bundle.es22.js +23 -0
  67. package/dist/bundle.es23.js +42 -0
  68. package/dist/bundle.es24.js +113 -0
  69. package/dist/bundle.es25.js +114 -0
  70. package/dist/bundle.es26.js +38 -0
  71. package/dist/bundle.es27.js +13 -0
  72. package/dist/bundle.es28.js +27 -0
  73. package/dist/bundle.es29.js +38 -0
  74. package/dist/bundle.es3.js +13 -0
  75. package/dist/bundle.es30.js +26 -0
  76. package/dist/bundle.es31.js +83 -0
  77. package/dist/bundle.es32.js +20 -0
  78. package/dist/bundle.es33.js +16 -0
  79. package/dist/bundle.es34.js +24 -0
  80. package/dist/bundle.es35.js +7 -0
  81. package/dist/bundle.es36.js +23 -0
  82. package/dist/bundle.es37.js +16 -0
  83. package/dist/bundle.es38.js +72 -0
  84. package/dist/bundle.es39.js +70 -0
  85. package/dist/bundle.es4.js +87 -0
  86. package/dist/bundle.es40.js +34 -0
  87. package/dist/bundle.es41.js +70 -0
  88. package/dist/bundle.es42.js +33 -0
  89. package/dist/bundle.es43.js +77 -0
  90. package/dist/bundle.es44.js +51 -0
  91. package/dist/bundle.es45.js +45 -0
  92. package/dist/bundle.es5.js +87 -0
  93. package/dist/bundle.es6.js +80 -0
  94. package/dist/bundle.es7.js +28 -0
  95. package/dist/bundle.es8.js +87 -0
  96. package/dist/bundle.es9.js +75 -0
  97. package/dist/index.d.ts +30 -0
  98. package/{src → dist}/index.scss +3 -0
  99. package/{src → dist}/mixins.scss +4 -3
  100. package/{src → dist}/theme.scss +0 -2
  101. package/dist/types.d.ts +13 -0
  102. package/package.json +10 -6
  103. package/.eslintrc +0 -54
  104. package/declaration.d.ts +0 -4
  105. package/index.html +0 -12
  106. package/playground/App.tsx +0 -166
  107. package/playground/Example.tsx +0 -14
  108. package/playground/Test.tsx +0 -44
  109. package/playground/animation-test-1/index.scss +0 -20
  110. package/playground/animation-test-1/index.tsx +0 -17
  111. package/playground/animation-test-2/index.scss +0 -62
  112. package/playground/animation-test-2/index.tsx +0 -32
  113. package/playground/bootstrap.tsx +0 -19
  114. package/playground/buttons/index.tsx +0 -132
  115. package/playground/checkbox/index.tsx +0 -64
  116. package/playground/date-input/index.tsx +0 -45
  117. package/playground/date-picker/index.tsx +0 -41
  118. package/playground/dialog/index.tsx +0 -92
  119. package/playground/dialog-alert/index.tsx +0 -47
  120. package/playground/drawer/index.tsx +0 -55
  121. package/playground/index.css +0 -33
  122. package/playground/index.scss +0 -270
  123. package/playground/input/index.tsx +0 -112
  124. package/playground/number-inputs/index.tsx +0 -50
  125. package/playground/popovers/index.tsx +0 -70
  126. package/playground/radio-group/index.tsx +0 -69
  127. package/playground/select/index.tsx +0 -72
  128. package/playground/select-tags/index.tsx +0 -36
  129. package/playground/styles.scss +0 -2
  130. package/playground/switch/index.tsx +0 -44
  131. package/playground/tabs/index.tsx +0 -16
  132. package/playground/test.scss +0 -0
  133. package/playground/text-area/index.tsx +0 -17
  134. package/playground/text-input/index.tsx +0 -12
  135. package/playground/toaster/index.tsx +0 -156
  136. package/playground/tooltip/index.tsx +0 -26
  137. package/src/Button/index.tsx +0 -72
  138. package/src/ButtonGroup/index.tsx +0 -20
  139. package/src/Checkbox/index.tsx +0 -46
  140. package/src/Countdown/index.tsx +0 -54
  141. package/src/DateInput/index.tsx +0 -96
  142. package/src/DatePicker/Calendar.tsx +0 -157
  143. package/src/DatePicker/CalendarHeader.tsx +0 -139
  144. package/src/DatePicker/index.tsx +0 -177
  145. package/src/Dialog/index.tsx +0 -31
  146. package/src/DialogAlert/Alert.tsx +0 -78
  147. package/src/DialogAlert/Viewport.tsx +0 -52
  148. package/src/DialogAlert/index.tsx +0 -37
  149. package/src/Drawer/index.tsx +0 -46
  150. package/src/File/index.tsx +0 -60
  151. package/src/Form/index.tsx +0 -131
  152. package/src/Icon/index.tsx +0 -43
  153. package/src/LoadButton/index.tsx +0 -17
  154. package/src/NumberInput/index.tsx +0 -74
  155. package/src/OptionItem/OptionItem.tsx +0 -49
  156. package/src/OptionItem/OptionsList.tsx +0 -26
  157. package/src/Popover/index.tsx +0 -117
  158. package/src/Radio/index.tsx +0 -68
  159. package/src/Scrollable/ImitateScroll.tsx +0 -141
  160. package/src/Scrollable/index.tsx +0 -141
  161. package/src/Select/SelectInput.tsx +0 -131
  162. package/src/Select/index.tsx +0 -134
  163. package/src/SelectTags/index.tsx +0 -192
  164. package/src/Spinner/index.tsx +0 -19
  165. package/src/Stepper/index.tsx +0 -76
  166. package/src/Switch/index.tsx +0 -49
  167. package/src/Tabs/index.tsx +0 -89
  168. package/src/TextArea/index.tsx +0 -51
  169. package/src/Toaster/RemoveListener.tsx +0 -11
  170. package/src/Toaster/Toast.tsx +0 -69
  171. package/src/Toaster/Viewport.tsx +0 -117
  172. package/src/Toaster/index.tsx +0 -52
  173. package/src/Tooltip/index.tsx +0 -33
  174. package/src/__hooks/use-frooze-closing.ts +0 -51
  175. package/src/__hooks/use-loading.ts +0 -34
  176. package/src/__hooks/use-local-storage.ts +0 -19
  177. package/src/__hooks/use-popover-position.ts +0 -24
  178. package/src/__hooks/use-previos.ts +0 -25
  179. package/src/__hooks/use-resize.ts +0 -41
  180. package/src/__hooks/use-scrollbox.ts +0 -45
  181. package/src/__hooks/use-stepper-input.ts +0 -82
  182. package/src/__hooks/use-update.ts +0 -19
  183. package/src/__hooks/useCalendar.ts +0 -104
  184. package/src/__hooks/useCalendarOptions-copy.ts +0 -87
  185. package/src/__hooks/useCalendarOptions.ts +0 -68
  186. package/src/__libs/calendar.ts +0 -175
  187. package/src/__utils/utils.ts +0 -137
  188. package/src/index.ts +0 -36
  189. package/src/types.ts +0 -14
  190. package/tailwind.config.js +0 -91
  191. package/themes/classic/animations.scss +0 -179
  192. package/themes/classic/classic.scss +0 -493
  193. package/tsconfig.json +0 -27
  194. package/vite.build.ts +0 -35
  195. package/vite.config.ts +0 -33
  196. /package/{src → dist}/Button/Button.scss +0 -0
  197. /package/{src → dist}/ButtonGroup/ButtonGroup.scss +0 -0
  198. /package/{src → dist}/Checkbox/Checkbox.scss +0 -0
  199. /package/{src → dist}/DateInput/DateInput.scss +0 -0
  200. /package/{src → dist}/DatePicker/Calendar.scss +0 -0
  201. /package/{src → dist}/DatePicker/DatePicker.scss +0 -0
  202. /package/{src → dist}/Dialog/Dialog.scss +0 -0
  203. /package/{src → dist}/Dialog/Popup.scss +0 -0
  204. /package/{src → dist}/DialogAlert/Alert.scss +0 -0
  205. /package/{src → dist}/Drawer/Drawer.scss +0 -0
  206. /package/{src → dist}/Form/Form.scss +0 -0
  207. /package/{src → dist}/Form/Input.scss +0 -0
  208. /package/{src → dist}/Icon/icon.scss +0 -0
  209. /package/{src → dist}/OptionItem/Option.scss +0 -0
  210. /package/{src → dist}/Popover/Popover.scss +0 -0
  211. /package/{src → dist}/Radio/Radio.scss +0 -0
  212. /package/{src → dist}/Scrollable/Scrollable.scss +0 -0
  213. /package/{src → dist}/Select/Select.scss +0 -0
  214. /package/{src → dist}/SelectTags/SelectTags.scss +0 -0
  215. /package/{src → dist}/Spinner/Spinner.scss +0 -0
  216. /package/{src → dist}/Stepper/StepperInput.scss +0 -0
  217. /package/{src → dist}/Switch/Switch.scss +0 -0
  218. /package/{src → dist}/Tabs/Tabs.scss +0 -0
  219. /package/{src → dist}/TextArea/TextArea.scss +0 -0
  220. /package/{src → dist}/Toaster/Toaster.scss +0 -0
  221. /package/{src → dist}/Tooltip/Tooltip.scss +0 -0
  222. /package/{src/css.scss → dist/css-properties.scss} +0 -0
@@ -0,0 +1,31 @@
1
+ import { DateFormat } from '..';
2
+ export declare const defaultMax: {
3
+ day: number;
4
+ month: number;
5
+ year: number;
6
+ };
7
+ export declare const defaultMin: {
8
+ day: number;
9
+ month: number;
10
+ year: number;
11
+ };
12
+ interface Options {
13
+ min?: DateFormat;
14
+ max?: DateFormat;
15
+ now: DateFormat;
16
+ }
17
+ export declare const useCalendarOptions: ({ min, max, now }: Options) => {
18
+ years: {
19
+ title: string;
20
+ value: number;
21
+ }[];
22
+ months: {
23
+ title: string;
24
+ value: number;
25
+ }[];
26
+ days: {
27
+ title: string;
28
+ value: number;
29
+ }[];
30
+ };
31
+ export {};
@@ -0,0 +1,25 @@
1
+ import { CalendarProps } from '../DatePicker/Calendar';
2
+ export declare function isSameDate(d1: Date, d2: Date): boolean;
3
+ export declare const MONDAY = 1;
4
+ export declare function startOfWeek(date: Date, { weekStartsOn }: {
5
+ weekStartsOn?: number | undefined;
6
+ }): Date;
7
+ export declare function endOfWeek(date: Date, { weekStartsOn }: {
8
+ weekStartsOn?: number | undefined;
9
+ }): Date;
10
+ export declare function startOfDay(date: Date): Date;
11
+ export declare function endOfDay(date: Date): Date;
12
+ export declare function isDayMinMaxRestricted(day: Date, options?: {
13
+ min?: Date;
14
+ max?: Date;
15
+ withTime?: boolean;
16
+ }): boolean;
17
+ export declare function addMonths(date: Date, amount: number): Date;
18
+ export declare function subMonths(date: Date, amount: number): Date;
19
+ export declare function setYear(date: Date, year: number): Date;
20
+ export declare function setMonth(date: Date, month: number): Date;
21
+ interface DisableOptions extends Pick<CalendarProps, 'disableFuture' | 'disablePast' | 'maxDateTime' | 'minDateTime' | 'shouldDisableDate'> {
22
+ }
23
+ export declare const createDayDisableChecker: (options: DisableOptions) => (day: Date, withTime?: boolean) => boolean;
24
+ export declare const useDayDisableCheker: (options: DisableOptions) => (day: Date, withTime?: boolean) => boolean;
25
+ export {};
@@ -0,0 +1,25 @@
1
+ import { DateFormat, Option } from '..';
2
+ export declare const getMonthMaxDay: (month: number, year: number) => number;
3
+ export declare const getFirstDay: (month: number, year: number) => number;
4
+ export declare const getDayIndex: (day: number) => number;
5
+ export declare const createVoids: (length: number) => any[];
6
+ export declare const dateToFormat: (date: Date) => DateFormat;
7
+ export declare const createDateValidation: ({ min, max }: {
8
+ min: DateFormat;
9
+ max: DateFormat;
10
+ }) => (value: DateFormat) => DateFormat | undefined;
11
+ export declare const createRangeValidation: ({ min, max }: {
12
+ min?: DateFormat;
13
+ max?: DateFormat;
14
+ }) => {
15
+ isDateMinValid: (value: DateFormat) => boolean;
16
+ isDateMaxValid: (value: DateFormat) => boolean;
17
+ isDateInRange: (value: DateFormat) => boolean;
18
+ };
19
+ export declare const formatToDate: (format: DateFormat) => Date;
20
+ export declare const weeks: string[];
21
+ export declare const DefaultMonths: string[];
22
+ export declare const DEFAULT_MAX_YEAR = 9999;
23
+ export declare const DEFAULT_MIN_YEAR = 100;
24
+ export declare const getYears: (currentYear: number, range: number) => Option<number>[];
25
+ export declare const getMonths: (locale?: string) => Option<number>[];
@@ -0,0 +1,58 @@
1
+ import { Button as e } from "./bundle.es2.js";
2
+ import { Spinner as p } from "./bundle.es3.js";
3
+ import { Scrollable as x } from "./bundle.es4.js";
4
+ import { ImitateScroll as a } from "./bundle.es5.js";
5
+ import { Popover as i } from "./bundle.es6.js";
6
+ import { Tooltip as c } from "./bundle.es7.js";
7
+ import { Select as S } from "./bundle.es8.js";
8
+ import { Form as g } from "./bundle.es9.js";
9
+ import { OptionItem as b } from "./bundle.es10.js";
10
+ import { NumberInput as D } from "./bundle.es11.js";
11
+ import { OptionsList as w } from "./bundle.es12.js";
12
+ import { ButtonGroup as I } from "./bundle.es13.js";
13
+ import { Checkbox as O } from "./bundle.es14.js";
14
+ import { Switch as k } from "./bundle.es15.js";
15
+ import { Radio as C } from "./bundle.es16.js";
16
+ import { Drawer as P } from "./bundle.es17.js";
17
+ import { Dialog as G } from "./bundle.es18.js";
18
+ import { AlertDialog as R } from "./bundle.es19.js";
19
+ import { LoadButton as q } from "./bundle.es20.js";
20
+ import { Tabs as E } from "./bundle.es21.js";
21
+ import { Countdown as J } from "./bundle.es22.js";
22
+ import { TextArea as M } from "./bundle.es23.js";
23
+ import { SelectTags as U } from "./bundle.es24.js";
24
+ import { DatePicker as W } from "./bundle.es25.js";
25
+ import { FileOverlay as Y } from "./bundle.es26.js";
26
+ import { useLocalStorage as _ } from "./bundle.es27.js";
27
+ import { createAlertAgent as oo } from "./bundle.es28.js";
28
+ import { createToaster as eo } from "./bundle.es29.js";
29
+ export {
30
+ R as AlertDialog,
31
+ e as Button,
32
+ I as ButtonGroup,
33
+ O as Checkbox,
34
+ J as Countdown,
35
+ W as DatePicker,
36
+ G as Dialog,
37
+ P as Drawer,
38
+ Y as FileOverlay,
39
+ g as Form,
40
+ a as ImitateScroll,
41
+ q as LoadButton,
42
+ D as NumberInput,
43
+ b as OptionItem,
44
+ w as OptionsList,
45
+ i as Popover,
46
+ C as Radio,
47
+ x as Scrollable,
48
+ S as Select,
49
+ U as SelectTags,
50
+ p as Spinner,
51
+ k as Switch,
52
+ E as Tabs,
53
+ M as TextArea,
54
+ c as Tooltip,
55
+ oo as createAlertAgent,
56
+ eo as createToaster,
57
+ _ as useLocalStorage
58
+ };
@@ -0,0 +1,38 @@
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import N from "classnames";
3
+ import { Icon as v } from "./bundle.es34.js";
4
+ import { attr as t } from "@companix/utils-browser";
5
+ import { forwardRef as k } from "react";
6
+ import { faCheck as x } from "@fortawesome/free-solid-svg-icons";
7
+ const O = k(
8
+ ({ title: d, icon: n, active: c, label: e, disabled: r, minimal: a, onClick: l, className: m, ...s }, p) => {
9
+ const f = (h) => {
10
+ r || l?.(h);
11
+ };
12
+ return /* @__PURE__ */ i(
13
+ "div",
14
+ {
15
+ ref: p,
16
+ ...s,
17
+ className: N("option", m),
18
+ "data-selected": t(c),
19
+ "data-disabled": t(r),
20
+ "data-minimal": t(a),
21
+ onClick: f,
22
+ children: [
23
+ /* @__PURE__ */ i("div", { className: "option-content", children: [
24
+ n && /* @__PURE__ */ o("div", { className: "option-icon", children: n }),
25
+ /* @__PURE__ */ i("div", { className: "option-content-layout", children: [
26
+ /* @__PURE__ */ o("div", { className: "option-title", children: d }),
27
+ e && /* @__PURE__ */ o("div", { className: "option-label", children: e })
28
+ ] })
29
+ ] }),
30
+ c && !a && /* @__PURE__ */ o("div", { className: "option-check", children: /* @__PURE__ */ o(v, { icon: x }) })
31
+ ]
32
+ }
33
+ );
34
+ }
35
+ );
36
+ export {
37
+ O as OptionItem
38
+ };
@@ -0,0 +1,33 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useState as m, useRef as p } from "react";
3
+ import { Form as l } from "./bundle.es9.js";
4
+ const N = ({ value: r, onChange: u, ...e }) => {
5
+ const [, t] = m([]), n = p(o(r));
6
+ return +n.current !== r && (n.current = o(r)), /* @__PURE__ */ f(
7
+ l,
8
+ {
9
+ ...e,
10
+ value: n.current,
11
+ onChange: (i) => {
12
+ const s = i.currentTarget.value.trim();
13
+ if (s === "")
14
+ return n.current = "", u(null);
15
+ if (!(s.startsWith(".") || s.replace(".", "").split("").some((c) => isNaN(parseInt(c))))) {
16
+ if (n.current = a(s.split("")), +n.current === r)
17
+ return t([]);
18
+ u(+n.current);
19
+ }
20
+ }
21
+ }
22
+ );
23
+ }, o = (r) => r === null ? "" : r.toString(), a = (r) => {
24
+ const u = [...r], e = [...r];
25
+ if (e.every((t) => t === "0"))
26
+ return "0";
27
+ for (let t = 0; t < e.length && e[t] === "0"; t++)
28
+ e[t] === "0" && e[t + 1] !== "." && u.shift();
29
+ return u.join("");
30
+ };
31
+ export {
32
+ N as NumberInput
33
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { Scrollable as n } from "./bundle.es4.js";
3
+ const s = ({ children: o, maxHeight: t, scrollboxRef: i, optionsWrapperRef: e }) => /* @__PURE__ */ r(
4
+ n,
5
+ {
6
+ ref: i,
7
+ implementation: "inner",
8
+ padding: 10,
9
+ thumbPadding: 3,
10
+ thumbColor: "#0000002b",
11
+ maxHeight: t,
12
+ scrollY: !0,
13
+ children: /* @__PURE__ */ r("div", { className: "option-list", ref: e, children: o })
14
+ }
15
+ );
16
+ export {
17
+ s as OptionsList
18
+ };
@@ -0,0 +1,10 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { forwardRef as p } from "react";
3
+ import a from "classnames";
4
+ import { attr as i } from "@companix/utils-browser";
5
+ const c = p(
6
+ ({ children: r, className: o, fill: t }, m) => /* @__PURE__ */ f("div", { ref: m, className: a("button-group", o), "data-fill": i(t), children: r })
7
+ );
8
+ export {
9
+ c as ButtonGroup
10
+ };
@@ -0,0 +1,35 @@
1
+ import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
+ import * as t from "@radix-ui/react-checkbox";
3
+ import { Icon as h } from "./bundle.es34.js";
4
+ import { faCheck as l } from "@fortawesome/free-solid-svg-icons";
5
+ import { useId as n } from "react";
6
+ import { attr as c } from "@companix/utils-browser";
7
+ const u = ({ checked: e, required: m, disabled: r, onCheckedChange: s, size: d, label: a }) => {
8
+ const i = n();
9
+ return /* @__PURE__ */ x(
10
+ "div",
11
+ {
12
+ className: "checkbox",
13
+ "data-size": d ?? "md",
14
+ "data-required": c(m && !e),
15
+ "data-disabled": c(r),
16
+ children: [
17
+ /* @__PURE__ */ o(
18
+ t.Root,
19
+ {
20
+ className: "checkbox-box",
21
+ checked: e,
22
+ onCheckedChange: s,
23
+ disabled: r,
24
+ id: i,
25
+ children: /* @__PURE__ */ o(t.Indicator, { className: "checkbox-icon", children: /* @__PURE__ */ o(h, { icon: l, size: "xxxs" }) })
26
+ }
27
+ ),
28
+ a && /* @__PURE__ */ o("label", { className: "checkbox-label", htmlFor: i, "data-disabled": c(r), children: a })
29
+ ]
30
+ }
31
+ );
32
+ };
33
+ export {
34
+ u as Checkbox
35
+ };
@@ -0,0 +1,27 @@
1
+ import { jsxs as d, jsx as c } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-switch";
3
+ import { attr as a } from "@companix/utils-browser";
4
+ import { useId as n } from "react";
5
+ const u = (m) => {
6
+ const { checked: e, disabled: s, onCheckedChange: o, uncheckedIcon: i, checkedIcon: t, label: h } = m, l = n();
7
+ return /* @__PURE__ */ d("div", { className: "switch", "data-disabled": a(s), children: [
8
+ /* @__PURE__ */ c(
9
+ r.Root,
10
+ {
11
+ className: "switch-track",
12
+ checked: e,
13
+ onCheckedChange: o,
14
+ disabled: s,
15
+ id: l,
16
+ children: /* @__PURE__ */ d(r.Thumb, { className: "switch-thumb", children: [
17
+ i && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(!e), children: i }),
18
+ t && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(e), children: t })
19
+ ] })
20
+ }
21
+ ),
22
+ h && /* @__PURE__ */ c("label", { className: "switch-label", htmlFor: l, "data-disabled": s, children: h })
23
+ ] });
24
+ };
25
+ export {
26
+ u as Switch
27
+ };
@@ -0,0 +1,23 @@
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ import { useId as c } from "react";
3
+ import * as d from "@radix-ui/react-radio-group";
4
+ import { attr as i } from "@companix/utils-browser";
5
+ const h = ({ value: t, label: e, size: m = "md", disabled: a, required: s }) => {
6
+ const o = c();
7
+ return /* @__PURE__ */ l(
8
+ "span",
9
+ {
10
+ className: "radio",
11
+ "data-disabled": i(a),
12
+ "data-size": m,
13
+ "data-required": i(s),
14
+ children: [
15
+ /* @__PURE__ */ r(d.Item, { className: "radio-box", value: t, disabled: a, id: o, children: /* @__PURE__ */ r(d.Indicator, { className: "radio-mark" }) }),
16
+ /* @__PURE__ */ r("label", { className: "radio-label", htmlFor: o, "data-disabled": i(a), children: e })
17
+ ]
18
+ }
19
+ );
20
+ };
21
+ export {
22
+ h as Radio
23
+ };
@@ -0,0 +1,24 @@
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import d from "classnames";
3
+ import * as r from "@radix-ui/react-dialog";
4
+ import { VisuallyHidden as n } from "@radix-ui/react-visually-hidden";
5
+ import { varToStyle as c } from "@companix/utils-browser";
6
+ const p = ({ open: i, onOpenChange: t, children: a, size: l, direction: s, className: m }) => /* @__PURE__ */ e(r.Root, { open: i, onOpenChange: t, children: /* @__PURE__ */ o(r.Portal, { children: [
7
+ /* @__PURE__ */ e(r.Overlay, { className: "drawer-overlay" }),
8
+ /* @__PURE__ */ o(
9
+ r.Content,
10
+ {
11
+ style: c({ "--drawer-size": l ?? "50%" }),
12
+ className: d("drawer", m),
13
+ "data-direction": s,
14
+ children: [
15
+ /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(r.Title, {}) }),
16
+ a
17
+ ]
18
+ }
19
+ )
20
+ ] }) });
21
+ p.Close = r.Close;
22
+ export {
23
+ p as Drawer
24
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx as i, jsxs as r } from "react/jsx-runtime";
2
+ import n from "classnames";
3
+ import * as o from "@radix-ui/react-dialog";
4
+ import { VisuallyHidden as p } from "@radix-ui/react-visually-hidden";
5
+ const c = ({ size: e = "s", open: l, onOpenChange: a, children: s, className: t }) => /* @__PURE__ */ i(o.Root, { open: l, onOpenChange: a, children: /* @__PURE__ */ r(o.Portal, { children: [
6
+ /* @__PURE__ */ i(o.Overlay, { className: "popup-overlay dialog-overlay" }),
7
+ /* @__PURE__ */ i(o.Content, { className: "popup-container dialog-container", "data-size": e, children: /* @__PURE__ */ r("div", { className: n("popup dialog", t), children: [
8
+ /* @__PURE__ */ i(p, { children: /* @__PURE__ */ i(o.Title, {}) }),
9
+ s
10
+ ] }) })
11
+ ] }) });
12
+ c.Close = o.Close;
13
+ export {
14
+ c as Dialog
15
+ };
@@ -0,0 +1,40 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-alert-dialog";
3
+ import { Button as c } from "./bundle.es2.js";
4
+ import { RemoveListener as N } from "./bundle.es35.js";
5
+ import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
+ const C = ({
7
+ open: d,
8
+ defaultOpen: p,
9
+ onOpenChange: m,
10
+ onUnMounted: h,
11
+ icon: i,
12
+ title: l,
13
+ description: o,
14
+ cancelDefaultText: n,
15
+ cancel: t,
16
+ disableCancel: v,
17
+ confirm: s
18
+ }) => /* @__PURE__ */ a(r.Root, { open: d, defaultOpen: p, onOpenChange: m, children: [
19
+ /* @__PURE__ */ e(N, { callback: h }),
20
+ /* @__PURE__ */ a(r.Portal, { children: [
21
+ /* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
22
+ /* @__PURE__ */ e(r.Content, { className: "popup-container dialog-container", children: /* @__PURE__ */ a("div", { className: "popup alert", children: [
23
+ /* @__PURE__ */ a("div", { className: "alert-body", children: [
24
+ i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
25
+ /* @__PURE__ */ a("div", { className: "alert-content", children: [
26
+ l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
27
+ !l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
28
+ o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
29
+ ] })
30
+ ] }),
31
+ /* @__PURE__ */ a("div", { className: "alert-footer", children: [
32
+ !v && (t?.text || n) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? n }) }),
33
+ s?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...s }) })
34
+ ] })
35
+ ] }) })
36
+ ] })
37
+ ] });
38
+ export {
39
+ C as AlertDialog
40
+ };
@@ -0,0 +1,45 @@
1
+ import { jsx as e, jsxs as b, Fragment as h } from "react/jsx-runtime";
2
+ import j from "classnames";
3
+ import { Spinner as k } from "./bundle.es3.js";
4
+ import { forwardRef as v } from "react";
5
+ import { attr as r } from "@companix/utils-browser";
6
+ const F = v(
7
+ ({
8
+ children: d,
9
+ fill: o,
10
+ text: m,
11
+ active: l,
12
+ mode: c = "default",
13
+ appearance: f = "neutral",
14
+ size: s = "md",
15
+ align: p,
16
+ icon: n,
17
+ loading: a,
18
+ className: u,
19
+ iconRight: i,
20
+ ...t
21
+ }, x) => /* @__PURE__ */ e(
22
+ "button",
23
+ {
24
+ ref: x,
25
+ className: j("button", u),
26
+ "data-size": s,
27
+ "data-loading": r(a),
28
+ "data-align": a ? "center" : p ?? (n && i ? "left" : "center"),
29
+ "data-appearance": f,
30
+ "data-mode": c,
31
+ "data-fill": r(o),
32
+ "data-active": r(l),
33
+ ...t,
34
+ onClick: a ?? t.disabled ? void 0 : t.onClick,
35
+ children: a ? /* @__PURE__ */ e(k, { size: 14, width: 2 }) : /* @__PURE__ */ b(h, { children: [
36
+ n,
37
+ (d ?? m) && /* @__PURE__ */ e("span", { className: "button-text", children: m ?? d }),
38
+ i
39
+ ] })
40
+ }
41
+ )
42
+ );
43
+ export {
44
+ F as Button
45
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Button as m } from "./bundle.es2.js";
3
+ import { useLoading as p } from "./bundle.es36.js";
4
+ const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
5
+ const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
6
+ return /* @__PURE__ */ e(
7
+ m,
8
+ {
9
+ appearance: t ? "negative" : r,
10
+ ...i,
11
+ loading: n,
12
+ onClick: a
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ g as LoadButton
18
+ };
@@ -0,0 +1,36 @@
1
+ import { jsx as n, jsxs as T } from "react/jsx-runtime";
2
+ import * as c from "@radix-ui/react-tabs";
3
+ import { useRef as g, useId as p, createContext as v, useState as I, useContext as d, useEffect as R } from "react";
4
+ const l = v({ baseId: "", listRef: {} }), b = (t, e) => `radix-${t}-trigger-${e}`, y = ({ children: t, value: e, onChange: s }) => {
5
+ const r = g(null), o = p();
6
+ return /* @__PURE__ */ n(c.Root, { value: e, onValueChange: s, children: /* @__PURE__ */ n(l.Provider, { value: { baseId: o, listRef: r }, children: /* @__PURE__ */ T(c.List, { className: "tabs", ref: r, children: [
7
+ /* @__PURE__ */ n($, { value: e }),
8
+ t
9
+ ] }) }) });
10
+ }, $ = ({ value: t }) => {
11
+ const [e, s] = I({}), { baseId: r, listRef: o } = d(l);
12
+ return R(() => {
13
+ const a = { observer: null };
14
+ if (o.current) {
15
+ const f = `.tab[id="${b(r, t)}"]`, i = o.current.querySelector(f);
16
+ i != null ? (a.observer = new ResizeObserver(() => {
17
+ const { clientHeight: u, clientWidth: m, offsetLeft: h, offsetTop: x } = i;
18
+ s({
19
+ height: u,
20
+ transform: `translateX(${Math.floor(h)}px) translateY(${Math.floor(x)}px)`,
21
+ width: m
22
+ });
23
+ }), a.observer.observe(i)) : s({ display: "none" });
24
+ }
25
+ return () => {
26
+ a.observer && a.observer.disconnect();
27
+ };
28
+ }, [t]), /* @__PURE__ */ n("div", { className: "tab-indicator-container", style: e, children: /* @__PURE__ */ n("div", { className: "tab-indicator" }) });
29
+ }, C = ({ children: t, value: e, ...s }) => {
30
+ const { baseId: r } = d(l), o = b(r, e);
31
+ return /* @__PURE__ */ n(c.Trigger, { ...s, id: o, className: "tab", value: e, children: t });
32
+ };
33
+ y.Tab = C;
34
+ export {
35
+ y as Tabs
36
+ };
@@ -0,0 +1,23 @@
1
+ import { jsx as d, Fragment as p } from "react/jsx-runtime";
2
+ import { getNextCandleTime as T, sleep as S, getTimes as x } from "@companix/utils-js";
3
+ import { useRef as g, useState as v, useEffect as s } from "react";
4
+ const n = (t) => String(t).padStart(2, "0"), j = ({ expiration: t, separator: m = ":", onExpired: a }) => {
5
+ const e = g(null), [, o] = v([]);
6
+ s(() => {
7
+ const c = Date.now(), f = T(c, "1s") - c;
8
+ return e.current && clearInterval(e.current), S(f).then(() => {
9
+ o([]), e.current = setInterval(() => {
10
+ o([]);
11
+ }, 1e3);
12
+ }), () => {
13
+ e.current && clearInterval(e.current);
14
+ };
15
+ }, [t]);
16
+ const r = t - Date.now(), { hours: i, minutes: u, seconds: l } = x(r);
17
+ return s(() => {
18
+ r <= 0 && (a?.(), e.current && clearInterval(e.current));
19
+ }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(i), n(u), n(l)].join(m) });
20
+ };
21
+ export {
22
+ j as Countdown
23
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useResizeTextarea as p } from "./bundle.es37.js";
3
+ import { attr as e, callMultiple as x } from "@companix/utils-browser";
4
+ import { useEffect as u } from "react";
5
+ const R = ({
6
+ onResize: s,
7
+ grow: a = !1,
8
+ value: t,
9
+ onChange: i,
10
+ disabled: o,
11
+ required: m,
12
+ rows: l = 2,
13
+ fill: c = !1,
14
+ ...d
15
+ }) => {
16
+ const [n, r] = p(s, a);
17
+ return u(r, [r, t]), /* @__PURE__ */ f(
18
+ "div",
19
+ {
20
+ className: "form form-textarea",
21
+ "data-required": e(m),
22
+ "data-disabled": e(o),
23
+ "data-fill": e(c),
24
+ children: /* @__PURE__ */ f(
25
+ "textarea",
26
+ {
27
+ className: "form-input",
28
+ "data-grow": e(a),
29
+ value: t,
30
+ ref: n,
31
+ rows: l,
32
+ disabled: o,
33
+ onChange: x(i, r),
34
+ ...d
35
+ }
36
+ )
37
+ }
38
+ );
39
+ };
40
+ export {
41
+ R as TextArea
42
+ };