@companix/uikit 0.0.8 → 0.0.11
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/README.md +16 -0
- package/dist/DatePicker/index.d.ts +1 -1
- package/dist/FormLabel/FormLabel.scss +32 -0
- package/dist/FormLabel/index.d.ts +10 -0
- package/dist/{Form → Input}/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/Select/index.d.ts +1 -1
- package/dist/bundle.es.js +8 -8
- package/dist/bundle.es11.js +7 -7
- package/dist/bundle.es25.js +12 -12
- package/dist/bundle.es38.js +3 -3
- package/dist/bundle.es41.js +1 -1
- package/dist/bundle.es42.js +30 -42
- package/dist/bundle.es43.js +74 -30
- package/dist/bundle.es44.js +45 -71
- package/dist/bundle.es45.js +41 -47
- package/dist/bundle.es9.js +26 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.scss +3 -2
- package/package.json +5 -3
- /package/dist/{Form → Input}/Form.scss +0 -0
- /package/dist/{Form → Input}/Input.scss +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Unset browser styles
|
|
2
|
+
|
|
3
|
+
If you're not using @tailwind with preflighting, you'll need to override the browser's default styles using the `modern-normalize` package.
|
|
4
|
+
Tailwind's preflighting is actually built on top of the `modern-normalize` package.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm i modern-normalize
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```css
|
|
15
|
+
@import 'node_modules/modern-normalize/modern-normalize.css';
|
|
16
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormProps } from '../
|
|
1
|
+
import { FormProps } from '../Input';
|
|
2
2
|
import { CalendarProps } from './Calendar';
|
|
3
3
|
interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<FormProps, 'value' | 'onChange' | 'rightElement'> {
|
|
4
4
|
onChange?: (value: Date | null) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@use '../mixins.scss';
|
|
2
|
+
|
|
3
|
+
.form-group {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
&[data-fill] {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-label {
|
|
12
|
+
@include mixins.truncate-text();
|
|
13
|
+
@include mixins.use-styles(form-group, label);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-caption {
|
|
17
|
+
@include mixins.truncate-text();
|
|
18
|
+
@include mixins.use-styles(form-group, caption);
|
|
19
|
+
|
|
20
|
+
&[data-appearance='neutral'] {
|
|
21
|
+
@include mixins.use-styles(form-group, caption, neutral);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&[data-appearance='positive'] {
|
|
25
|
+
@include mixins.use-styles(form-group, caption, positive);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[data-appearance='negative'] {
|
|
29
|
+
@include mixins.use-styles(form-group, caption, negative);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface FormLabelProps {
|
|
2
|
+
label: React.ReactNode;
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
caption?: React.ReactNode;
|
|
5
|
+
apperance?: 'neutral' | 'positive' | 'negative';
|
|
6
|
+
fill?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const FormGroup: (props: FormLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -14,4 +14,4 @@ export interface FormProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
mask?: string;
|
|
15
15
|
maskChar?: string;
|
|
16
16
|
}
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const Input: import('react').ForwardRefExoticComponent<FormProps & import('react').RefAttributes<HTMLDivElement>>;
|
package/dist/Select/index.d.ts
CHANGED
package/dist/bundle.es.js
CHANGED
|
@@ -5,15 +5,15 @@ import { ImitateScroll as a } from "./bundle.es5.js";
|
|
|
5
5
|
import { Popover as i } from "./bundle.es6.js";
|
|
6
6
|
import { Tooltip as c } from "./bundle.es7.js";
|
|
7
7
|
import { Select as S } from "./bundle.es8.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Input as g } from "./bundle.es9.js";
|
|
9
9
|
import { OptionItem as b } from "./bundle.es10.js";
|
|
10
10
|
import { NumberInput as D } from "./bundle.es11.js";
|
|
11
|
-
import { OptionsList as
|
|
12
|
-
import { ButtonGroup as
|
|
11
|
+
import { OptionsList as d } from "./bundle.es12.js";
|
|
12
|
+
import { ButtonGroup as B } from "./bundle.es13.js";
|
|
13
13
|
import { Checkbox as O } from "./bundle.es14.js";
|
|
14
14
|
import { Switch as k } from "./bundle.es15.js";
|
|
15
15
|
import { Radio as C } from "./bundle.es16.js";
|
|
16
|
-
import { Drawer as
|
|
16
|
+
import { Drawer as y } from "./bundle.es17.js";
|
|
17
17
|
import { Dialog as G } from "./bundle.es18.js";
|
|
18
18
|
import { AlertDialog as R } from "./bundle.es19.js";
|
|
19
19
|
import { LoadButton as q } from "./bundle.es20.js";
|
|
@@ -29,19 +29,19 @@ import { createToaster as eo } from "./bundle.es29.js";
|
|
|
29
29
|
export {
|
|
30
30
|
R as AlertDialog,
|
|
31
31
|
e as Button,
|
|
32
|
-
|
|
32
|
+
B as ButtonGroup,
|
|
33
33
|
O as Checkbox,
|
|
34
34
|
J as Countdown,
|
|
35
35
|
W as DatePicker,
|
|
36
36
|
G as Dialog,
|
|
37
|
-
|
|
37
|
+
y as Drawer,
|
|
38
38
|
Y as FileOverlay,
|
|
39
|
-
g as Form,
|
|
40
39
|
a as ImitateScroll,
|
|
40
|
+
g as Input,
|
|
41
41
|
q as LoadButton,
|
|
42
42
|
D as NumberInput,
|
|
43
43
|
b as OptionItem,
|
|
44
|
-
|
|
44
|
+
d as OptionsList,
|
|
45
45
|
i as Popover,
|
|
46
46
|
C as Radio,
|
|
47
47
|
x as Scrollable,
|
package/dist/bundle.es11.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
2
|
+
import { useState as p, useRef as m } from "react";
|
|
3
|
+
import { Input as l } from "./bundle.es9.js";
|
|
4
4
|
const N = ({ value: r, onChange: u, ...e }) => {
|
|
5
|
-
const [, t] =
|
|
6
|
-
return +n.current !== r && (n.current =
|
|
5
|
+
const [, t] = p([]), n = m(i(r));
|
|
6
|
+
return +n.current !== r && (n.current = i(r)), /* @__PURE__ */ f(
|
|
7
7
|
l,
|
|
8
8
|
{
|
|
9
9
|
...e,
|
|
10
10
|
value: n.current,
|
|
11
|
-
onChange: (
|
|
12
|
-
const s =
|
|
11
|
+
onChange: (o) => {
|
|
12
|
+
const s = o.currentTarget.value.trim();
|
|
13
13
|
if (s === "")
|
|
14
14
|
return n.current = "", u(null);
|
|
15
15
|
if (!(s.startsWith(".") || s.replace(".", "").split("").some((c) => isNaN(parseInt(c))))) {
|
|
@@ -20,7 +20,7 @@ const N = ({ value: r, onChange: u, ...e }) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
|
-
},
|
|
23
|
+
}, i = (r) => r === null ? "" : r.toString(), a = (r) => {
|
|
24
24
|
const u = [...r], e = [...r];
|
|
25
25
|
if (e.every((t) => t === "0"))
|
|
26
26
|
return "0";
|
package/dist/bundle.es25.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as l, jsxs as O, Fragment as R } from "react/jsx-runtime";
|
|
2
2
|
import { Popover as z } from "./bundle.es6.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Input as Y } from "./bundle.es9.js";
|
|
4
4
|
import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import { Icon as
|
|
5
|
+
import { Icon as k } from "./bundle.es34.js";
|
|
6
6
|
import { useState as _, useRef as q } from "react";
|
|
7
7
|
import { Calendar as G } from "./bundle.es38.js";
|
|
8
8
|
import { useDayDisableCheker as H } from "./bundle.es39.js";
|
|
9
|
-
import { formatTime as
|
|
9
|
+
import { formatTime as y, getNum as d } from "@companix/utils-js";
|
|
10
10
|
const h = (t, i = "-") => {
|
|
11
11
|
if (t) {
|
|
12
|
-
const n =
|
|
12
|
+
const n = y(t.getDate()), r = y(t.getMonth() + 1), s = t.getFullYear();
|
|
13
13
|
return [n, r, s].join(i);
|
|
14
14
|
}
|
|
15
15
|
return "";
|
|
16
|
-
},
|
|
16
|
+
}, F = (t, i = "-") => {
|
|
17
17
|
const n = t.split(i);
|
|
18
18
|
if (n.length === 3) {
|
|
19
19
|
const [r, s, a] = [d(n[0]), d(n[1]), d(n[2])];
|
|
@@ -45,7 +45,7 @@ const h = (t, i = "-") => {
|
|
|
45
45
|
maxDateTime: x,
|
|
46
46
|
// input props
|
|
47
47
|
...T
|
|
48
|
-
} = t, [m, c] = _(() => h(o ?? null)), p = q(null),
|
|
48
|
+
} = t, [m, c] = _(() => h(o ?? null)), p = q(null), I = H({
|
|
49
49
|
disableFuture: C,
|
|
50
50
|
disablePast: D,
|
|
51
51
|
shouldDisableDate: g,
|
|
@@ -57,11 +57,11 @@ const h = (t, i = "-") => {
|
|
|
57
57
|
e.stopPropagation(), c(""), u?.(null);
|
|
58
58
|
}, V = (e) => {
|
|
59
59
|
c(e);
|
|
60
|
-
const f =
|
|
61
|
-
f && !
|
|
60
|
+
const f = F(e);
|
|
61
|
+
f && !I(f) && u?.(f);
|
|
62
62
|
}, j = () => {
|
|
63
|
-
const e =
|
|
64
|
-
(!e ||
|
|
63
|
+
const e = F(m);
|
|
64
|
+
(!e || I(e)) && c(h(o ?? null));
|
|
65
65
|
}, M = (e) => {
|
|
66
66
|
u?.(e), c(h(e));
|
|
67
67
|
};
|
|
@@ -101,8 +101,8 @@ const h = (t, i = "-") => {
|
|
|
101
101
|
onBlur: j,
|
|
102
102
|
mask: "99-99-9999",
|
|
103
103
|
rightElement: /* @__PURE__ */ O(R, { children: [
|
|
104
|
-
n && J(m) && /* @__PURE__ */ l("button", { className: "select-close-button", onClick: B, children: r ?? /* @__PURE__ */ l(
|
|
105
|
-
/* @__PURE__ */ l(
|
|
104
|
+
n && J(m) && /* @__PURE__ */ l("button", { className: "select-close-button", onClick: B, children: r ?? /* @__PURE__ */ l(k, { className: "select-close-icon", icon: E, size: "xxxs" }) }),
|
|
105
|
+
/* @__PURE__ */ l(k, { className: "expand-icon select-expand", icon: S, size: "xxxs" })
|
|
106
106
|
] })
|
|
107
107
|
}
|
|
108
108
|
)
|
package/dist/bundle.es38.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as D, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.
|
|
3
|
-
import { CalendarHeader as F } from "./bundle.
|
|
4
|
-
import { useCalendar as j } from "./bundle.
|
|
2
|
+
import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es42.js";
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es43.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es44.js";
|
|
5
5
|
import { attr as m } from "@companix/utils-browser";
|
|
6
6
|
import { isSameDate as f } from "./bundle.es39.js";
|
|
7
7
|
import { useLayoutEffect as I } from "react";
|
package/dist/bundle.es41.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as T, jsx as $ } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as b, useState as I, useMemo as P, useImperativeHandle as R, useCallback as j, createElement as k } from "react";
|
|
3
3
|
import * as c from "@radix-ui/react-toast";
|
|
4
4
|
import { varToStyle as w } from "@companix/utils-browser";
|
|
5
|
-
import { Toast as C } from "./bundle.
|
|
5
|
+
import { Toast as C } from "./bundle.es45.js";
|
|
6
6
|
var g = /* @__PURE__ */ ((e) => (e["top-center"] = "up", e["top-left"] = "left", e["top-right"] = "right", e["bottom-center"] = "down", e["bottom-left"] = "left", e["bottom-right"] = "right", e))(g || {});
|
|
7
7
|
const M = b((e, h) => {
|
|
8
8
|
const { side: f = "top", align: i = "center", gap: m = 14, duration: u, swipeThreshold: v, closeIcon: x } = e, [l, p] = I([]), o = P(() => ({}), []);
|
package/dist/bundle.es42.js
CHANGED
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
o.current && L(o.current);
|
|
22
|
-
}, []), /* @__PURE__ */ n(
|
|
23
|
-
t.Root,
|
|
24
|
-
{
|
|
25
|
-
ref: o,
|
|
26
|
-
"data-expanded": !0,
|
|
27
|
-
"data-appearance": d,
|
|
28
|
-
"data-mounted": C(c),
|
|
29
|
-
className: "toaster",
|
|
30
|
-
duration: m,
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ e(R, { callback: f }),
|
|
33
|
-
r && /* @__PURE__ */ e("div", { className: "toaster-icon", children: r }),
|
|
34
|
-
/* @__PURE__ */ n("div", { className: "toaster-content", children: [
|
|
35
|
-
a && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: a }),
|
|
36
|
-
s && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: s })
|
|
37
|
-
] }),
|
|
38
|
-
/* @__PURE__ */ e(t.Close, { className: "toaster-close", onClick: p, children: u ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) })
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
);
|
|
1
|
+
import { clamp as a } from "@companix/utils-browser";
|
|
2
|
+
const D = (t, e) => new Date(e, t, 0).getDate(), g = (t, e) => new Date(e, t - 1, 1).getDay(), i = (t) => t === 0 ? 6 : t - 1, u = (t) => new Array(t).fill(0), h = (t) => ({
|
|
3
|
+
day: t.getDate(),
|
|
4
|
+
month: t.getMonth() + 1,
|
|
5
|
+
year: t.getFullYear()
|
|
6
|
+
}), y = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], s = 9999, c = 100, f = (t, e) => {
|
|
7
|
+
const o = [], n = a(t - e, c, s), l = a(t + e, c, s);
|
|
8
|
+
for (let r = n; r <= l; r++)
|
|
9
|
+
o.push({ title: String(r).padStart(4, "0"), value: r });
|
|
10
|
+
return o;
|
|
11
|
+
}, p = (t) => {
|
|
12
|
+
const e = [], o = new Intl.DateTimeFormat(t, {
|
|
13
|
+
month: "long"
|
|
14
|
+
});
|
|
15
|
+
for (let n = 0; n < 12; n++)
|
|
16
|
+
e.push({
|
|
17
|
+
title: o.format(new Date(2023, n, 15)),
|
|
18
|
+
value: n
|
|
19
|
+
});
|
|
20
|
+
return e;
|
|
42
21
|
};
|
|
43
22
|
export {
|
|
44
|
-
|
|
23
|
+
s as DEFAULT_MAX_YEAR,
|
|
24
|
+
c as DEFAULT_MIN_YEAR,
|
|
25
|
+
u as createVoids,
|
|
26
|
+
h as dateToFormat,
|
|
27
|
+
i as getDayIndex,
|
|
28
|
+
g as getFirstDay,
|
|
29
|
+
D as getMonthMaxDay,
|
|
30
|
+
p as getMonths,
|
|
31
|
+
f as getYears,
|
|
32
|
+
y as weeks
|
|
45
33
|
};
|
package/dist/bundle.es43.js
CHANGED
|
@@ -1,33 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as u, useMemo as h } from "react";
|
|
3
|
+
import { Select as p } from "./bundle.es8.js";
|
|
4
|
+
import { getMonths as k, getYears as z, DEFAULT_MAX_YEAR as f, DEFAULT_MIN_YEAR as g } from "./bundle.es42.js";
|
|
5
|
+
import { Icon as C } from "./bundle.es34.js";
|
|
6
|
+
import { faChevronLeft as E, faChevronRight as T } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import { setMonth as _, setYear as F } from "./bundle.es39.js";
|
|
8
|
+
const y = ({
|
|
9
|
+
viewDate: n,
|
|
10
|
+
onChange: c,
|
|
11
|
+
isMonthDisabled: a,
|
|
12
|
+
isYearDisabled: m,
|
|
13
|
+
onNextMonth: N,
|
|
14
|
+
onPrevMonth: v
|
|
15
|
+
}) => {
|
|
16
|
+
const e = n.getFullYear(), r = n.getMonth(), s = "ru", M = u(
|
|
17
|
+
(t) => {
|
|
18
|
+
c(_(n, t));
|
|
19
|
+
},
|
|
20
|
+
[c, n]
|
|
21
|
+
), x = u(
|
|
22
|
+
(t) => {
|
|
23
|
+
c(F(n, t));
|
|
24
|
+
},
|
|
25
|
+
[c, n]
|
|
26
|
+
), A = h(() => k(s).map((t) => ({
|
|
27
|
+
...t,
|
|
28
|
+
className: "capitalize",
|
|
29
|
+
disabled: a && a(t.value)
|
|
30
|
+
})), [s, a]), Y = h(() => z(e, 100).map((t) => ({
|
|
31
|
+
...t,
|
|
32
|
+
disabled: m && m(t.value)
|
|
33
|
+
})), [e, m]);
|
|
34
|
+
let l = r === 11 && e === f;
|
|
35
|
+
a && !l && (l = a(
|
|
36
|
+
r === 11 ? 0 : r + 1,
|
|
37
|
+
r === 11 ? Math.min(e + 1, f) : e
|
|
38
|
+
));
|
|
39
|
+
let i = r === 0 && e === g;
|
|
40
|
+
return a && !i && (i = a(
|
|
41
|
+
r === 0 ? 11 : r - 1,
|
|
42
|
+
r === 0 ? Math.max(e - 1, g) : e
|
|
43
|
+
)), /* @__PURE__ */ d("div", { className: "calendar-header", children: [
|
|
44
|
+
!i && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: v, children: /* @__PURE__ */ o(C, { icon: E }) }),
|
|
45
|
+
/* @__PURE__ */ d("div", { className: "calendar-pickers", children: [
|
|
46
|
+
/* @__PURE__ */ o(
|
|
47
|
+
p,
|
|
48
|
+
{
|
|
49
|
+
fill: !0,
|
|
50
|
+
options: Y,
|
|
51
|
+
size: "sm",
|
|
52
|
+
value: e,
|
|
53
|
+
minimalOptions: !0,
|
|
54
|
+
matchTarget: "min-width",
|
|
55
|
+
onChange: (t) => x(t || 0)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ o(
|
|
59
|
+
p,
|
|
60
|
+
{
|
|
61
|
+
fill: !0,
|
|
62
|
+
options: A,
|
|
63
|
+
size: "sm",
|
|
64
|
+
className: "capitalize",
|
|
65
|
+
value: r,
|
|
66
|
+
minimalOptions: !0,
|
|
67
|
+
matchTarget: "min-width",
|
|
68
|
+
onChange: (t) => M(t || 0)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
!l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
|
|
73
|
+
] });
|
|
21
74
|
};
|
|
22
75
|
export {
|
|
23
|
-
|
|
24
|
-
c as DEFAULT_MIN_YEAR,
|
|
25
|
-
u as createVoids,
|
|
26
|
-
h as dateToFormat,
|
|
27
|
-
i as getDayIndex,
|
|
28
|
-
g as getFirstDay,
|
|
29
|
-
D as getMonthMaxDay,
|
|
30
|
-
p as getMonths,
|
|
31
|
-
f as getYears,
|
|
32
|
-
y as weeks
|
|
76
|
+
y as CalendarHeader
|
|
33
77
|
};
|
package/dist/bundle.es44.js
CHANGED
|
@@ -1,77 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isMonthDisabled: a,
|
|
12
|
-
isYearDisabled: m,
|
|
13
|
-
onNextMonth: N,
|
|
14
|
-
onPrevMonth: v
|
|
1
|
+
import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es39.js";
|
|
2
|
+
import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es42.js";
|
|
3
|
+
import { useState as U, useCallback as M } from "react";
|
|
4
|
+
const X = ({
|
|
5
|
+
value: p,
|
|
6
|
+
disablePast: r,
|
|
7
|
+
disableFuture: c,
|
|
8
|
+
shouldDisableDate: E,
|
|
9
|
+
minDateTime: l,
|
|
10
|
+
maxDateTime: s
|
|
15
11
|
}) => {
|
|
16
|
-
const e =
|
|
17
|
-
(
|
|
18
|
-
|
|
12
|
+
const [e, u] = U(p || /* @__PURE__ */ new Date()), _ = M(() => {
|
|
13
|
+
u(L(e));
|
|
14
|
+
}, [e]), C = M(() => {
|
|
15
|
+
u(N(e, 1));
|
|
16
|
+
}, [e]), D = R({
|
|
17
|
+
disableFuture: c,
|
|
18
|
+
disablePast: r,
|
|
19
|
+
shouldDisableDate: E,
|
|
20
|
+
minDateTime: l,
|
|
21
|
+
maxDateTime: s
|
|
22
|
+
}), k = M(
|
|
23
|
+
(o, t) => {
|
|
24
|
+
const n = /* @__PURE__ */ new Date();
|
|
25
|
+
t = t || e.getFullYear();
|
|
26
|
+
const h = l ? l.getMonth() : 0, Y = s ? s.getMonth() : 11, F = l?.getFullYear() || w, f = s?.getFullYear() || A;
|
|
27
|
+
let g = t >= F && t <= f ? t === F && h > o || t === f && o > Y : !0;
|
|
28
|
+
return c && (g = g || (t === n.getFullYear() ? o > n.getMonth() : t > n.getFullYear())), r && (g = g || (t === n.getFullYear() ? o < n.getMonth() : t < n.getFullYear())), g;
|
|
19
29
|
},
|
|
20
|
-
[c,
|
|
21
|
-
),
|
|
22
|
-
(
|
|
23
|
-
|
|
30
|
+
[c, r, e, l, s]
|
|
31
|
+
), v = M(
|
|
32
|
+
(o) => {
|
|
33
|
+
const t = /* @__PURE__ */ new Date(), n = l?.getFullYear() || w, h = s?.getFullYear() || A;
|
|
34
|
+
let Y = n > o || o > h;
|
|
35
|
+
return c && (Y = Y || o > t.getFullYear()), r && (Y = Y || o < t.getFullYear()), Y;
|
|
24
36
|
},
|
|
25
|
-
[c,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
r === 11 ? 0 : r + 1,
|
|
37
|
-
r === 11 ? Math.min(e + 1, f) : e
|
|
38
|
-
));
|
|
39
|
-
let i = r === 0 && e === g;
|
|
40
|
-
return a && !i && (i = a(
|
|
41
|
-
r === 0 ? 11 : r - 1,
|
|
42
|
-
r === 0 ? Math.max(e - 1, g) : e
|
|
43
|
-
)), /* @__PURE__ */ d("div", { className: "calendar-header", children: [
|
|
44
|
-
!i && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: v, children: /* @__PURE__ */ o(C, { icon: E }) }),
|
|
45
|
-
/* @__PURE__ */ d("div", { className: "calendar-pickers", children: [
|
|
46
|
-
/* @__PURE__ */ o(
|
|
47
|
-
p,
|
|
48
|
-
{
|
|
49
|
-
fill: !0,
|
|
50
|
-
options: Y,
|
|
51
|
-
size: "sm",
|
|
52
|
-
value: e,
|
|
53
|
-
minimalOptions: !0,
|
|
54
|
-
matchTarget: "min-width",
|
|
55
|
-
onChange: (t) => x(t || 0)
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ o(
|
|
59
|
-
p,
|
|
60
|
-
{
|
|
61
|
-
fill: !0,
|
|
62
|
-
options: A,
|
|
63
|
-
size: "sm",
|
|
64
|
-
className: "capitalize",
|
|
65
|
-
value: r,
|
|
66
|
-
minimalOptions: !0,
|
|
67
|
-
matchTarget: "min-width",
|
|
68
|
-
onChange: (t) => M(t || 0)
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }),
|
|
72
|
-
!l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
|
|
73
|
-
] });
|
|
37
|
+
[c, r, l, s]
|
|
38
|
+
);
|
|
39
|
+
return {
|
|
40
|
+
viewDate: e,
|
|
41
|
+
setViewDate: u,
|
|
42
|
+
setPrevMonth: _,
|
|
43
|
+
setNextMonth: C,
|
|
44
|
+
isDayDisabled: D,
|
|
45
|
+
isMonthDisabled: k,
|
|
46
|
+
isYearDisabled: v
|
|
47
|
+
};
|
|
74
48
|
};
|
|
75
49
|
export {
|
|
76
|
-
|
|
50
|
+
X as useCalendar
|
|
77
51
|
};
|
package/dist/bundle.es45.js
CHANGED
|
@@ -1,51 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
u
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "@radix-ui/react-toast";
|
|
3
|
+
import { attr as C } from "@companix/utils-browser";
|
|
4
|
+
import { useState as h, useRef as v, useEffect as N, useLayoutEffect as x } from "react";
|
|
5
|
+
import { RemoveListener as R } from "./bundle.es35.js";
|
|
6
|
+
const E = (i) => {
|
|
7
|
+
const [c, l] = h(!1), o = v(null), {
|
|
8
|
+
appearance: d = "neutral",
|
|
9
|
+
icon: r,
|
|
10
|
+
title: a,
|
|
11
|
+
description: s,
|
|
12
|
+
duration: m,
|
|
13
|
+
closeIcon: u,
|
|
14
|
+
onRemoving: p,
|
|
15
|
+
onRemoved: f,
|
|
16
|
+
onInitialized: L
|
|
17
|
+
} = i;
|
|
18
|
+
return N(() => {
|
|
19
|
+
l(!0);
|
|
20
|
+
}, []), x(() => {
|
|
21
|
+
o.current && L(o.current);
|
|
22
|
+
}, []), /* @__PURE__ */ n(
|
|
23
|
+
t.Root,
|
|
24
|
+
{
|
|
25
|
+
ref: o,
|
|
26
|
+
"data-expanded": !0,
|
|
27
|
+
"data-appearance": d,
|
|
28
|
+
"data-mounted": C(c),
|
|
29
|
+
className: "toaster",
|
|
30
|
+
duration: m,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ e(R, { callback: f }),
|
|
33
|
+
r && /* @__PURE__ */ e("div", { className: "toaster-icon", children: r }),
|
|
34
|
+
/* @__PURE__ */ n("div", { className: "toaster-content", children: [
|
|
35
|
+
a && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: a }),
|
|
36
|
+
s && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: s })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ e(t.Close, { className: "toaster-close", onClick: p, children: u ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
38
41
|
);
|
|
39
|
-
return {
|
|
40
|
-
viewDate: e,
|
|
41
|
-
setViewDate: u,
|
|
42
|
-
setPrevMonth: _,
|
|
43
|
-
setNextMonth: C,
|
|
44
|
-
isDayDisabled: D,
|
|
45
|
-
isMonthDisabled: k,
|
|
46
|
-
isYearDisabled: v
|
|
47
|
-
};
|
|
48
42
|
};
|
|
49
43
|
export {
|
|
50
|
-
|
|
44
|
+
E as Toast
|
|
51
45
|
};
|
package/dist/bundle.es9.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as z, jsx as
|
|
1
|
+
import { jsxs as z, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import A from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { useLayoutAndUpdate as
|
|
3
|
+
import M from "react-input-mask";
|
|
4
|
+
import { useLayoutAndUpdate as U } from "./bundle.es33.js";
|
|
5
5
|
import { attr as c } from "@companix/utils-browser";
|
|
6
|
-
import { forwardRef as R, useRef as
|
|
7
|
-
import { mergeRefs as
|
|
6
|
+
import { forwardRef as R, useRef as l, useCallback as g } from "react";
|
|
7
|
+
import { mergeRefs as v } from "react-merge-refs";
|
|
8
8
|
const Q = R(
|
|
9
9
|
({
|
|
10
|
-
required:
|
|
11
|
-
size:
|
|
10
|
+
required: r,
|
|
11
|
+
size: u,
|
|
12
12
|
fill: a,
|
|
13
13
|
leftElement: e,
|
|
14
|
-
rightElement:
|
|
14
|
+
rightElement: f,
|
|
15
15
|
onChange: x,
|
|
16
16
|
onValueChange: $,
|
|
17
|
-
readOnly:
|
|
18
|
-
className:
|
|
17
|
+
readOnly: I,
|
|
18
|
+
className: b,
|
|
19
19
|
value: N,
|
|
20
20
|
placeholder: W,
|
|
21
21
|
disabled: p,
|
|
@@ -24,15 +24,15 @@ const Q = R(
|
|
|
24
24
|
inputRef: L,
|
|
25
25
|
...j
|
|
26
26
|
}, k) => {
|
|
27
|
-
const s =
|
|
27
|
+
const s = l(null), m = l(null), d = l(null), q = { Right: m, Left: d }, h = g((t) => {
|
|
28
28
|
if (s.current) {
|
|
29
29
|
const i = s.current.style, o = q[t];
|
|
30
30
|
o.current && o.current.clientWidth ? i[`padding${t}`] !== `${o.current.clientWidth}px` && (i[`padding${t}`] = `${o.current.clientWidth}px`) : i[`padding${t}`] && (i[`padding${t}`] = "");
|
|
31
31
|
}
|
|
32
32
|
}, []);
|
|
33
|
-
|
|
33
|
+
U(() => {
|
|
34
34
|
h("Left"), h("Right");
|
|
35
|
-
}, [
|
|
35
|
+
}, [f, e]);
|
|
36
36
|
const w = g((t) => {
|
|
37
37
|
x?.(t), $?.(t.target.value, t.target);
|
|
38
38
|
}, []);
|
|
@@ -40,36 +40,38 @@ const Q = R(
|
|
|
40
40
|
"div",
|
|
41
41
|
{
|
|
42
42
|
ref: k,
|
|
43
|
-
className: A("form",
|
|
44
|
-
"data-size":
|
|
43
|
+
className: A("form", b),
|
|
44
|
+
"data-size": u ?? "md",
|
|
45
45
|
"data-fill": c(a),
|
|
46
|
-
"data-required": c(
|
|
46
|
+
"data-required": c(r),
|
|
47
47
|
"data-disabled": c(p),
|
|
48
48
|
...j,
|
|
49
49
|
children: [
|
|
50
|
-
e && /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
50
|
+
e && /* @__PURE__ */ n("span", { ref: d, className: "form-input-base-left-element", children: e }),
|
|
51
|
+
/* @__PURE__ */ n(
|
|
52
|
+
B,
|
|
53
53
|
{
|
|
54
54
|
type: "text",
|
|
55
|
-
ref:
|
|
55
|
+
ref: v([s, L]),
|
|
56
56
|
className: "form-input form-input-base",
|
|
57
57
|
"aria-disabled": p,
|
|
58
58
|
onChange: w,
|
|
59
59
|
value: N,
|
|
60
60
|
placeholder: W,
|
|
61
61
|
disabled: p,
|
|
62
|
-
readOnly:
|
|
62
|
+
readOnly: I,
|
|
63
63
|
maskChar: C,
|
|
64
64
|
mask: y
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
|
|
67
|
+
f && /* @__PURE__ */ n("span", { ref: m, className: "form-input-base-right-element", children: f })
|
|
68
68
|
]
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
),
|
|
72
|
+
), B = R(
|
|
73
|
+
({ mask: r, maskChar: u, ...a }, e) => r ? /* @__PURE__ */ n(M, { inputRef: e, mask: r, maskChar: u, ...a }) : /* @__PURE__ */ n("input", { ref: e, ...a })
|
|
74
|
+
);
|
|
73
75
|
export {
|
|
74
|
-
Q as
|
|
76
|
+
Q as Input
|
|
75
77
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { ImitateScroll } from './Scrollable/ImitateScroll';
|
|
|
5
5
|
export { Popover } from './Popover';
|
|
6
6
|
export { Tooltip } from './Tooltip';
|
|
7
7
|
export { Select } from './Select';
|
|
8
|
-
export {
|
|
8
|
+
export { Input } from './Input';
|
|
9
9
|
export { OptionItem } from './OptionItem/OptionItem';
|
|
10
10
|
export { NumberInput } from './NumberInput';
|
|
11
11
|
export { OptionsList } from './OptionItem/OptionsList';
|
package/dist/index.scss
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
@use './Dialog/Dialog.scss';
|
|
11
11
|
@use './DialogAlert/Alert.scss';
|
|
12
12
|
@use './Drawer/Drawer.scss';
|
|
13
|
-
@use './Form/Form.scss';
|
|
14
13
|
@use './Select/Select.scss';
|
|
15
14
|
@use './TextArea/TextArea.scss';
|
|
16
15
|
@use './SelectTags/SelectTags.scss';
|
|
@@ -18,8 +17,10 @@
|
|
|
18
17
|
@use './DateInput/DateInput.scss';
|
|
19
18
|
@use './DatePicker/DatePicker.scss';
|
|
20
19
|
@use './DatePicker/Calendar.scss';
|
|
21
|
-
@use './
|
|
20
|
+
@use './Input/Input.scss';
|
|
21
|
+
@use './Input/Form.scss';
|
|
22
22
|
@use './Switch/Switch.scss';
|
|
23
23
|
@use './Spinner/Spinner.scss';
|
|
24
24
|
@use './ButtonGroup/ButtonGroup.scss';
|
|
25
25
|
@use './Scrollable/Scrollable.scss';
|
|
26
|
+
@use './FormLabel/FormLabel.scss';
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companix/uikit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"module": "./dist/bundle.es.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
9
10
|
],
|
|
10
11
|
"author": "Pavel Victorov",
|
|
11
12
|
"scripts": {
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"sass-embedded": "^1.96.0",
|
|
66
67
|
"vite": "^7.0.0",
|
|
67
68
|
"vite-plugin-checker": "^0.9.3",
|
|
68
|
-
"vite-plugin-dts": "^4.5.4"
|
|
69
|
+
"vite-plugin-dts": "^4.5.4",
|
|
70
|
+
"vite-plugin-static-copy": "^3.1.4"
|
|
69
71
|
}
|
|
70
72
|
}
|
|
File without changes
|
|
File without changes
|