@wrdagency/blockout 0.1.5 → 0.1.6
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/components/button/button.js +17 -10
- package/dist/components/controls/card-number-control/index.js +0 -1
- package/dist/components/controls/date-control/component.d.ts +3 -3
- package/dist/components/controls/date-control/component.js +26 -26
- package/dist/components/controls/date-control/index.d.ts +4 -2
- package/dist/components/controls/date-control/index.js +25 -23
- package/dist/components/controls/date-control/types.d.ts +12 -3
- package/dist/components/controls/date-control/types.js +54 -13
- package/dist/components/controls/toggle-group-control/index.js +38 -31
- package/package.json +1 -1
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
import '../../assets/button.css';const
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { cn as p } from "../../utils/css.js";
|
|
3
|
+
import '../../assets/button.css';const l = (e) => {
|
|
4
|
+
const {
|
|
5
|
+
className: s,
|
|
6
|
+
wide: m,
|
|
7
|
+
size: r,
|
|
8
|
+
variant: a,
|
|
9
|
+
as: c,
|
|
10
|
+
...t
|
|
11
|
+
} = e, n = p(
|
|
12
|
+
s,
|
|
6
13
|
"component-button",
|
|
7
|
-
`component-button--${
|
|
8
|
-
`component-button--${
|
|
9
|
-
|
|
14
|
+
`component-button--${a || "primary"}`,
|
|
15
|
+
`component-button--${r || "medium"}`,
|
|
16
|
+
m && "component-button--wide"
|
|
10
17
|
);
|
|
11
|
-
return
|
|
18
|
+
return c === "link" ? /* @__PURE__ */ o("a", { ...t, className: n }) : /* @__PURE__ */ o("button", { type: "button", ...t, className: n });
|
|
12
19
|
};
|
|
13
20
|
export {
|
|
14
|
-
|
|
21
|
+
l as Button
|
|
15
22
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
|
-
import { DateComponent, DateString } from './types';
|
|
2
|
+
import { DateComponent, DateFormat, DateString } from './types';
|
|
3
3
|
interface DateComponentInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
component: DateComponent;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
dataFormat: DateFormat;
|
|
6
|
+
viewFormat: DateFormat;
|
|
7
7
|
value: DateString;
|
|
8
8
|
onChangeValue: (value: string) => void;
|
|
9
9
|
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { parseDateString as D, formatDateString as
|
|
4
|
-
const
|
|
2
|
+
import { forwardRef as V } from "react";
|
|
3
|
+
import { parseDateString as f, getComponentMaxValue as v, getComponentMinValue as D, getComponentMaxLength as M, getComponentPlaceholder as w, formatDateString as F } from "./types.js";
|
|
4
|
+
const j = V((r, m) => {
|
|
5
5
|
const {
|
|
6
6
|
component: e,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
value:
|
|
10
|
-
onChangeValue:
|
|
11
|
-
autoComplete:
|
|
12
|
-
...
|
|
13
|
-
} =
|
|
14
|
-
const
|
|
15
|
-
...
|
|
16
|
-
[e]:
|
|
7
|
+
dataFormat: t,
|
|
8
|
+
viewFormat: L,
|
|
9
|
+
value: p,
|
|
10
|
+
onChangeValue: l,
|
|
11
|
+
autoComplete: u,
|
|
12
|
+
...c
|
|
13
|
+
} = r, n = f(p, t), s = n[e], i = w(e), o = D(e), a = v(e), g = M(e), C = (d) => {
|
|
14
|
+
const h = {
|
|
15
|
+
...n,
|
|
16
|
+
[e]: d.currentTarget.value
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
l(F(h, t));
|
|
19
19
|
};
|
|
20
20
|
return /* @__PURE__ */ x(
|
|
21
21
|
"input",
|
|
22
22
|
{
|
|
23
|
-
ref:
|
|
24
|
-
value:
|
|
23
|
+
ref: m,
|
|
24
|
+
value: s,
|
|
25
25
|
className: "component-date-control__input",
|
|
26
26
|
inputMode: "numeric",
|
|
27
|
-
autoComplete:
|
|
28
|
-
placeholder:
|
|
29
|
-
maxLength: 2,
|
|
27
|
+
autoComplete: u + "-" + e,
|
|
28
|
+
placeholder: i,
|
|
30
29
|
step: 1,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
maxLength: g,
|
|
31
|
+
"aria-valuemin": o,
|
|
32
|
+
min: o,
|
|
33
|
+
max: a,
|
|
34
|
+
"aria-valuemax": a,
|
|
35
|
+
onChange: C,
|
|
36
|
+
...c
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
j as DateComponentInput
|
|
42
42
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { HTMLInputAutoCompleteAttribute } from 'react';
|
|
2
2
|
import { ControlFC } from '../base-control/props';
|
|
3
|
-
import {
|
|
3
|
+
import { DateFormat, DateString } from './types';
|
|
4
4
|
interface DateControlProps {
|
|
5
5
|
value?: DateString;
|
|
6
6
|
onChangeValue?: (value: DateString) => void;
|
|
7
7
|
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
8
|
-
|
|
8
|
+
dataFormat?: DateFormat;
|
|
9
|
+
viewFormat?: DateFormat;
|
|
9
10
|
separator?: string;
|
|
11
|
+
fullYear?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare const DateControl: ControlFC<DateControlProps>;
|
|
12
14
|
export {};
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as g } from "react";
|
|
2
3
|
import { useSplitInput as h } from "../../../hooks/input.js";
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useBaseControlProps as x } from "../base-control/props.js";
|
|
4
|
+
import { noop as F } from "../../../utils/noop.js";
|
|
5
|
+
import { BaseControl as x } from "../base-control/index.js";
|
|
6
|
+
import { useBaseControlProps as D } from "../base-control/props.js";
|
|
7
7
|
import { DateComponentInput as P } from "./component.js";
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import { getDefaultFormat as a } from "./types.js";
|
|
9
|
+
import '../../../assets/index6.css';const w = (n) => {
|
|
10
|
+
const { baseProps: m, controlProps: p } = D(n, {
|
|
10
11
|
className: "component-date-control"
|
|
11
12
|
}), { register: s } = h(), {
|
|
12
|
-
value:
|
|
13
|
-
onChangeValue:
|
|
14
|
-
autoComplete:
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
value: l = "",
|
|
14
|
+
onChangeValue: c = F,
|
|
15
|
+
autoComplete: i,
|
|
16
|
+
dataFormat: f = a(),
|
|
17
|
+
viewFormat: o = a()
|
|
17
18
|
} = p;
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ e(x, { ...m, children: o.components.map((t, r, u) => /* @__PURE__ */ d(C, { children: [
|
|
20
|
+
/* @__PURE__ */ g(
|
|
20
21
|
P,
|
|
21
22
|
{
|
|
22
|
-
...s(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
...s(r),
|
|
24
|
+
key: t,
|
|
25
|
+
component: t,
|
|
26
|
+
dataFormat: f,
|
|
27
|
+
viewFormat: o,
|
|
28
|
+
value: l,
|
|
29
|
+
onChangeValue: c,
|
|
30
|
+
autoComplete: i
|
|
29
31
|
}
|
|
30
32
|
),
|
|
31
|
-
u.length - 1 !==
|
|
33
|
+
u.length - 1 !== r && /* @__PURE__ */ e("span", { className: "component-date-control__separator", children: o.separator })
|
|
32
34
|
] })) });
|
|
33
35
|
};
|
|
34
36
|
export {
|
|
35
|
-
|
|
37
|
+
w as DateControl
|
|
36
38
|
};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
export type DateComponent = "day" | "month" | "year";
|
|
1
|
+
export type DateComponent = "day" | "month" | "year" | "fullYear";
|
|
2
2
|
export type DateString = string;
|
|
3
|
+
export type DateFormat = {
|
|
4
|
+
components: DateComponent[];
|
|
5
|
+
separator: string;
|
|
6
|
+
};
|
|
3
7
|
export type ParsedDate = Partial<Record<DateComponent, string>>;
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
8
|
+
export declare function getDefaultFormat(): DateFormat;
|
|
9
|
+
export declare function parseDateString(value: DateString | undefined, format: DateFormat): ParsedDate;
|
|
10
|
+
export declare function formatDateString(value: ParsedDate, format: DateFormat): DateString;
|
|
11
|
+
export declare function getComponentMaxLength(component: DateComponent): 4 | 2;
|
|
12
|
+
export declare function getComponentMinValue(component: DateComponent): 1 | 0 | 1900;
|
|
13
|
+
export declare function getComponentMaxValue(component: DateComponent): 12 | 31 | 99 | 3000;
|
|
14
|
+
export declare function getComponentPlaceholder(component: DateComponent): "DD" | "MM" | "YY" | "YYYY";
|
|
@@ -1,20 +1,61 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function i() {
|
|
2
|
+
return {
|
|
3
|
+
components: ["fullYear", "month", "day"],
|
|
4
|
+
separator: "-"
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function l(e, r) {
|
|
8
|
+
const { separator: n, components: a } = r, u = (e || "").split(n);
|
|
9
|
+
return a.reduce(
|
|
10
|
+
(t, o, c) => ({
|
|
11
|
+
...t,
|
|
12
|
+
[o]: u[c]
|
|
7
13
|
}),
|
|
8
14
|
{}
|
|
9
15
|
);
|
|
10
16
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
return (t
|
|
15
|
-
}).join(
|
|
17
|
+
function f(e, r) {
|
|
18
|
+
const { separator: n, components: a } = r, u = /\D/g;
|
|
19
|
+
return a.map(function(t) {
|
|
20
|
+
return (e[t] || "").replace(u, "").substring(0, s(t));
|
|
21
|
+
}).join(n);
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
return e === "fullYear" ? 4 : 2;
|
|
25
|
+
}
|
|
26
|
+
function p(e) {
|
|
27
|
+
return e === "year" ? 0 : e === "fullYear" ? 1900 : 1;
|
|
28
|
+
}
|
|
29
|
+
function g(e) {
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "day":
|
|
32
|
+
return 31;
|
|
33
|
+
case "month":
|
|
34
|
+
return 12;
|
|
35
|
+
case "year":
|
|
36
|
+
return 99;
|
|
37
|
+
case "fullYear":
|
|
38
|
+
return 3e3;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function m(e) {
|
|
42
|
+
switch (e) {
|
|
43
|
+
case "day":
|
|
44
|
+
return "DD";
|
|
45
|
+
case "month":
|
|
46
|
+
return "MM";
|
|
47
|
+
case "year":
|
|
48
|
+
return "YY";
|
|
49
|
+
case "fullYear":
|
|
50
|
+
return "YYYY";
|
|
51
|
+
}
|
|
16
52
|
}
|
|
17
53
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
54
|
+
f as formatDateString,
|
|
55
|
+
s as getComponentMaxLength,
|
|
56
|
+
g as getComponentMaxValue,
|
|
57
|
+
p as getComponentMinValue,
|
|
58
|
+
m as getComponentPlaceholder,
|
|
59
|
+
i as getDefaultFormat,
|
|
60
|
+
l as parseDateString
|
|
20
61
|
};
|
|
@@ -6,44 +6,51 @@ import '../../../assets/style4.css';import '../../../assets/style3.css';import '
|
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { VisuallyHidden as N } from "../../../primitives/visually-hidden/index.js";
|
|
8
8
|
import { normalizeOption as k } from "../../../types/options.js";
|
|
9
|
-
import { BaseControl as
|
|
10
|
-
import { useBaseControlProps as
|
|
11
|
-
function M(
|
|
12
|
-
const { baseProps:
|
|
9
|
+
import { BaseControl as v } from "../base-control/index.js";
|
|
10
|
+
import { useBaseControlProps as x } from "../base-control/props.js";
|
|
11
|
+
function M(a) {
|
|
12
|
+
const { baseProps: p, controlProps: m } = x(a, {
|
|
13
13
|
className: "component-toggle-group-control"
|
|
14
14
|
}), {
|
|
15
|
-
id:
|
|
15
|
+
id: u,
|
|
16
16
|
value: n,
|
|
17
|
-
options:
|
|
17
|
+
options: t,
|
|
18
18
|
multiple: r = !1,
|
|
19
|
-
onChange:
|
|
20
|
-
onChangeValue:
|
|
19
|
+
onChange: g = s,
|
|
20
|
+
onChangeValue: l = s,
|
|
21
21
|
...d
|
|
22
22
|
} = m, _ = (o) => {
|
|
23
|
-
|
|
23
|
+
g(o);
|
|
24
24
|
const i = o.currentTarget.value;
|
|
25
|
-
r ? o.currentTarget.checked ?
|
|
26
|
-
}, h = (o) => r ? n.includes(o) : n === o, f = b(() =>
|
|
27
|
-
return /* @__PURE__ */ e(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
r ? o.currentTarget.checked ? l([...n, i]) : l(n.filter((C) => C !== i)) : l(o.target.value);
|
|
26
|
+
}, h = (o) => r ? n.includes(o) : n === o, f = b(() => t.map(k), [t]);
|
|
27
|
+
return /* @__PURE__ */ e(v, { ...p, children: /* @__PURE__ */ e("div", { className: "component-toggle-group-control__options", children: f.map((o) => /* @__PURE__ */ c(
|
|
28
|
+
"label",
|
|
29
|
+
{
|
|
30
|
+
className: "component-toggle-group-control__option",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
className: "component-toggle-group-control__option__input",
|
|
36
|
+
type: r ? "checkbox" : "radio",
|
|
37
|
+
value: o.value,
|
|
38
|
+
name: u,
|
|
39
|
+
disabled: o.disabled,
|
|
40
|
+
checked: h(o.value),
|
|
41
|
+
onChange: _,
|
|
42
|
+
...d
|
|
43
|
+
}
|
|
44
|
+
) }),
|
|
45
|
+
/* @__PURE__ */ c("span", { className: "component-toggle-group-control__option__label", children: [
|
|
46
|
+
o.icon,
|
|
47
|
+
o.label
|
|
48
|
+
] }),
|
|
49
|
+
o.description && /* @__PURE__ */ e("p", { className: "component-toggle-group-control__option__description", children: o.description })
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
o.value
|
|
53
|
+
)) }) });
|
|
47
54
|
}
|
|
48
55
|
export {
|
|
49
56
|
M as ToggleGroupControl
|