@tpc-mare/mare-ui-components-react 0.1.4 → 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/accordion/Accordion.d.ts +2 -0
- package/dist/accordion/Accordion.types.d.ts +20 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +4 -0
- package/dist/checkbox/index.js +1 -1
- package/dist/combobox/index.js +1 -1
- package/dist/date-picker/DatePicker.d.ts +3 -0
- package/dist/date-picker/DatePicker.types.d.ts +52 -0
- package/dist/date-picker/index.d.ts +2 -0
- package/dist/date-picker/index.js +4 -0
- package/dist/dialog/index.js +1 -1
- package/dist/drawer/index.js +1 -1
- package/dist/index/index.d.ts +12 -0
- package/dist/index/index.js +59 -46
- package/dist/paginator/Paginator.d.ts +2 -0
- package/dist/paginator/Paginator.types.d.ts +21 -0
- package/dist/paginator/index.d.ts +2 -0
- package/dist/paginator/index.js +4 -0
- package/dist/panel-menu/PanelMenu.d.ts +2 -0
- package/dist/panel-menu/PanelMenu.types.d.ts +12 -0
- package/dist/panel-menu/index.d.ts +2 -0
- package/dist/panel-menu/index.js +4 -0
- package/dist/search-field/index.js +1 -1
- package/dist/select-field/index.js +1 -1
- package/dist/shared/Accordion-E6aTw9ir.js +63 -0
- package/dist/shared/{Checkbox-DsM70wQl.js → Checkbox-fis7v2xS.js} +12 -12
- package/dist/shared/{Combobox-DeUG_muZ.js → Combobox-DK6nHqAL.js} +1 -1
- package/dist/shared/DatePicker-CF9y6eAm.js +856 -0
- package/dist/shared/{DialogFooter-DLWy6Mln.js → DialogFooter-BwEB19v9.js} +1 -1
- package/dist/shared/{DrawerFooter-DvUgumx0.js → DrawerFooter-C0SLP8KU.js} +1 -1
- package/dist/shared/Paginator-CcN6wND7.js +164 -0
- package/dist/shared/PanelMenu-Ch4NsZD_.js +123 -0
- package/dist/shared/{SearchField-CgDz_s1O.js → SearchField-DuA4ZkBL.js} +1 -1
- package/dist/shared/{SelectField-BSTmWjYy.js → SelectField-DNlX8uuG.js} +1 -1
- package/dist/shared/Snackbar-C29nLHO9.js +100 -0
- package/dist/shared/Stepper-BYRV6yan.js +110 -0
- package/dist/shared/icons-Dfn6EUcz.js +46 -0
- package/dist/shared/icons.d.ts +6 -0
- package/dist/shared/useMediaQuery.d.ts +5 -0
- package/dist/snackbar/Snackbar.d.ts +3 -0
- package/dist/snackbar/Snackbar.types.d.ts +42 -0
- package/dist/snackbar/index.d.ts +2 -0
- package/dist/snackbar/index.js +5 -0
- package/dist/stepper/Stepper.d.ts +2 -0
- package/dist/stepper/Stepper.types.d.ts +18 -0
- package/dist/stepper/index.d.ts +2 -0
- package/dist/stepper/index.js +4 -0
- package/dist/styles.css +1 -1
- package/dist/utilities-standalone.css +1 -0
- package/package.json +4 -6
- package/dist/shared/icons-DeVfnVLm.js +0 -37
|
@@ -2,7 +2,7 @@ import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { Dialog as o } from "@ark-ui/react/dialog";
|
|
3
3
|
import { Portal as w } from "@ark-ui/react/portal";
|
|
4
4
|
import { B as n } from "./Button-AfMqNCme.js";
|
|
5
|
-
import {
|
|
5
|
+
import { g as _ } from "./icons-Dfn6EUcz.js";
|
|
6
6
|
const k = (e) => `
|
|
7
7
|
mare:fixed mare:inset-0 mare:z-40
|
|
8
8
|
${e ?? "mare:bg-overlay"}
|
|
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { Dialog as t } from "@ark-ui/react/dialog";
|
|
3
3
|
import { Portal as g } from "@ark-ui/react/portal";
|
|
4
4
|
import { B as d } from "./Button-AfMqNCme.js";
|
|
5
|
-
import {
|
|
5
|
+
import { g as y } from "./icons-Dfn6EUcz.js";
|
|
6
6
|
const _ = (e) => {
|
|
7
7
|
switch (e) {
|
|
8
8
|
case "left":
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as P, useState as w, useEffect as R } from "react";
|
|
3
|
+
import { Pagination as c } from "@ark-ui/react/pagination";
|
|
4
|
+
import { B as h } from "./Button-AfMqNCme.js";
|
|
5
|
+
import { S as j } from "./SelectField-DNlX8uuG.js";
|
|
6
|
+
import { c as N, d as k, e as W, f as I } from "./icons-Dfn6EUcz.js";
|
|
7
|
+
const O = (a) => `
|
|
8
|
+
mare:w-full mare:flex mare:flex-wrap mare:items-center mare:gap-2
|
|
9
|
+
${a ? "mare:justify-between" : "mare:justify-center"}
|
|
10
|
+
`, T = "mare:flex mare:items-center mare:gap-2 mare:min-w-50", M = "mare:text-default mare:tpc-typography-body-s", q = "mare:max-w-20", A = "mare:flex mare:items-center mare:justify-center mare:gap-2 mare:min-w-3xs", B = "mare:flex mare:items-center mare:justify-center mare:gap-2", E = `
|
|
11
|
+
mare:shrink-0 mare:size-10 mare:flex mare:items-center mare:justify-center mare:truncate
|
|
12
|
+
mare:rounded-full mare:tpc-typography-label-s mare:text-default mare:cursor-pointer
|
|
13
|
+
mare:bg-transparent mare:border-none mare:hover:bg-hover
|
|
14
|
+
mare:ark-selected:bg-accent-weak! mare:ark-selected:text-accent! mare:ark-selected:hover:bg-accent-weak!
|
|
15
|
+
`, b = (a, n) => {
|
|
16
|
+
let i = (a + 2) * 40 + (a + 1) * 8;
|
|
17
|
+
return n && (i += 96), i;
|
|
18
|
+
}, V = ({
|
|
19
|
+
requestedPageLinkSize: a,
|
|
20
|
+
containerWidth: n,
|
|
21
|
+
rowsPerPageWidth: i,
|
|
22
|
+
showFirstLastLinks: o
|
|
23
|
+
}) => {
|
|
24
|
+
if (!n) return a;
|
|
25
|
+
let s = a, l = b(s, o) + i;
|
|
26
|
+
for (; l > n && s > 1; )
|
|
27
|
+
s -= 1, l = b(s, o) + i;
|
|
28
|
+
return s;
|
|
29
|
+
}, L = (a, n, i) => {
|
|
30
|
+
if (n <= 0) return [];
|
|
31
|
+
const o = Math.min(i, n), s = Math.max(1, Math.min(a - Math.floor((o - 1) / 2), n - o + 1));
|
|
32
|
+
return Array.from({ length: o }, (l, g) => s + g);
|
|
33
|
+
};
|
|
34
|
+
function J({
|
|
35
|
+
count: a,
|
|
36
|
+
page: n,
|
|
37
|
+
defaultPage: i,
|
|
38
|
+
onPageChange: o,
|
|
39
|
+
pageSize: s,
|
|
40
|
+
defaultPageSize: l,
|
|
41
|
+
onPageSizeChange: g,
|
|
42
|
+
pageLinkSize: u = 5,
|
|
43
|
+
showFirstLastLinks: m = !0,
|
|
44
|
+
rowsPerPageOptions: f,
|
|
45
|
+
rowsPerPageOptionsLabel: C = "Rows per page"
|
|
46
|
+
}) {
|
|
47
|
+
const p = !!f?.length, v = P(null), y = P(null), [S, z] = w(u);
|
|
48
|
+
return R(() => {
|
|
49
|
+
const r = v.current;
|
|
50
|
+
if (!r) return;
|
|
51
|
+
const t = () => {
|
|
52
|
+
z(
|
|
53
|
+
V({
|
|
54
|
+
requestedPageLinkSize: u,
|
|
55
|
+
containerWidth: r.clientWidth,
|
|
56
|
+
rowsPerPageWidth: y.current?.clientWidth ?? 0,
|
|
57
|
+
showFirstLastLinks: m
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
t();
|
|
62
|
+
const x = new ResizeObserver(t);
|
|
63
|
+
return x.observe(r), () => {
|
|
64
|
+
x.disconnect();
|
|
65
|
+
};
|
|
66
|
+
}, [u, m]), /* @__PURE__ */ d(
|
|
67
|
+
c.Root,
|
|
68
|
+
{
|
|
69
|
+
ref: v,
|
|
70
|
+
className: O(p),
|
|
71
|
+
count: a,
|
|
72
|
+
page: n,
|
|
73
|
+
defaultPage: i,
|
|
74
|
+
pageSize: s,
|
|
75
|
+
defaultPageSize: l,
|
|
76
|
+
onPageChange: (r) => o?.(r.page),
|
|
77
|
+
onPageSizeChange: (r) => g?.(r.pageSize),
|
|
78
|
+
children: [
|
|
79
|
+
p && /* @__PURE__ */ d(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: y,
|
|
83
|
+
className: T,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ e("span", { className: M, children: C }),
|
|
86
|
+
/* @__PURE__ */ e("span", { className: q, children: /* @__PURE__ */ e(c.Context, { children: (r) => /* @__PURE__ */ e(
|
|
87
|
+
j,
|
|
88
|
+
{
|
|
89
|
+
value: String(r.pageSize),
|
|
90
|
+
onValueChange: (t) => {
|
|
91
|
+
t && r.setPageSize(
|
|
92
|
+
Number(t)
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
options: f.map(
|
|
96
|
+
(t) => ({
|
|
97
|
+
value: String(t),
|
|
98
|
+
label: String(t)
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
) }) })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ d("div", { className: A, children: [
|
|
107
|
+
m && /* @__PURE__ */ e(c.FirstTrigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
108
|
+
h,
|
|
109
|
+
{
|
|
110
|
+
severity: "ghost",
|
|
111
|
+
size: "small",
|
|
112
|
+
iconOnly: !0,
|
|
113
|
+
icon: /* @__PURE__ */ e(N, {})
|
|
114
|
+
}
|
|
115
|
+
) }),
|
|
116
|
+
/* @__PURE__ */ e(c.PrevTrigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
117
|
+
h,
|
|
118
|
+
{
|
|
119
|
+
severity: "ghost",
|
|
120
|
+
size: "small",
|
|
121
|
+
iconOnly: !0,
|
|
122
|
+
icon: /* @__PURE__ */ e(k, {})
|
|
123
|
+
}
|
|
124
|
+
) }),
|
|
125
|
+
/* @__PURE__ */ e("div", { className: B, children: /* @__PURE__ */ e(c.Context, { children: (r) => L(
|
|
126
|
+
r.page,
|
|
127
|
+
r.totalPages,
|
|
128
|
+
S
|
|
129
|
+
).map((t) => /* @__PURE__ */ e(
|
|
130
|
+
c.Item,
|
|
131
|
+
{
|
|
132
|
+
type: "page",
|
|
133
|
+
value: t,
|
|
134
|
+
className: E,
|
|
135
|
+
children: t
|
|
136
|
+
},
|
|
137
|
+
t
|
|
138
|
+
)) }) }),
|
|
139
|
+
/* @__PURE__ */ e(c.NextTrigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
140
|
+
h,
|
|
141
|
+
{
|
|
142
|
+
severity: "ghost",
|
|
143
|
+
size: "small",
|
|
144
|
+
iconOnly: !0,
|
|
145
|
+
icon: /* @__PURE__ */ e(W, {})
|
|
146
|
+
}
|
|
147
|
+
) }),
|
|
148
|
+
m && /* @__PURE__ */ e(c.LastTrigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
149
|
+
h,
|
|
150
|
+
{
|
|
151
|
+
severity: "ghost",
|
|
152
|
+
size: "small",
|
|
153
|
+
iconOnly: !0,
|
|
154
|
+
icon: /* @__PURE__ */ e(I, {})
|
|
155
|
+
}
|
|
156
|
+
) })
|
|
157
|
+
] })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
J as P
|
|
164
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as a, jsxs as s, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as x } from "react";
|
|
3
|
+
import { createTreeCollection as f, TreeView as n } from "@ark-ui/react/tree-view";
|
|
4
|
+
import { C as b } from "./icons-Dfn6EUcz.js";
|
|
5
|
+
const g = "mare:flex mare:flex-col mare:gap-1", v = "mare:flex mare:flex-col mare:gap-1", k = `
|
|
6
|
+
mare:group mare:flex mare:items-center mare:gap-2 mare:min-h-10 mare:px-3 mare:py-2
|
|
7
|
+
mare:rounded-menu-item mare:cursor-pointer mare:select-none mare:outline-none
|
|
8
|
+
mare:tpc-typography-body-s mare:text-default
|
|
9
|
+
mare:hover:bg-hover mare:ark-open:bg-accent-weak mare:ark-open:text-accent
|
|
10
|
+
mare:ark-disabled:text-disabled mare:ark-disabled:cursor-not-allowed mare:ark-disabled:pointer-events-none
|
|
11
|
+
`, N = "mare:flex-1 mare:flex mare:items-center mare:gap-2", y = `
|
|
12
|
+
mare:flex mare:items-center mare:shrink-0 mare:text-default
|
|
13
|
+
mare:transition-transform mare:ark-open:rotate-180 mare:ark-open:text-accent
|
|
14
|
+
`, C = `
|
|
15
|
+
mare:flex mare:flex-col mare:gap-1 mare:ps-7 mare:overflow-hidden mare:empty:hidden
|
|
16
|
+
mare:ark-open:[animation:mare-panel-menu-branch-open_150ms_ease-out]
|
|
17
|
+
mare:ark-closed:[animation:mare-panel-menu-branch-close_150ms_ease-out]
|
|
18
|
+
`, _ = (e) => `
|
|
19
|
+
mare:flex mare:items-center mare:gap-2 mare:min-h-10 mare:px-3 mare:py-2
|
|
20
|
+
mare:rounded-menu-item mare:cursor-pointer mare:select-none mare:outline-none
|
|
21
|
+
mare:no-underline mare:text-inherit mare:tpc-typography-body-s
|
|
22
|
+
${e.active ? "mare:bg-accent-weak mare:text-accent" : "mare:text-default mare:hover:bg-hover"}
|
|
23
|
+
mare:ark-disabled:text-disabled mare:ark-disabled:cursor-not-allowed mare:ark-disabled:pointer-events-none
|
|
24
|
+
`, d = "mare:flex-1 mare:flex mare:items-center mare:gap-2", w = "mare:flex mare:items-center mare:shrink-0 mare:[&>svg]:size-5";
|
|
25
|
+
function i(e, t) {
|
|
26
|
+
if (t) return t(e);
|
|
27
|
+
const m = e.icon;
|
|
28
|
+
return /* @__PURE__ */ s(u, { children: [
|
|
29
|
+
m ? /* @__PURE__ */ a("span", { className: w, children: m }) : null,
|
|
30
|
+
/* @__PURE__ */ a("span", { children: e.label })
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
function p({
|
|
34
|
+
node: e,
|
|
35
|
+
indexPath: t,
|
|
36
|
+
renderItem: m
|
|
37
|
+
}) {
|
|
38
|
+
if (e.items?.length)
|
|
39
|
+
return /* @__PURE__ */ a(
|
|
40
|
+
n.NodeProvider,
|
|
41
|
+
{
|
|
42
|
+
node: e,
|
|
43
|
+
indexPath: t,
|
|
44
|
+
children: /* @__PURE__ */ s(n.Branch, { className: v, children: [
|
|
45
|
+
/* @__PURE__ */ s(n.BranchControl, { className: k, children: [
|
|
46
|
+
/* @__PURE__ */ a(n.BranchText, { className: N, children: i(e, m) }),
|
|
47
|
+
/* @__PURE__ */ a(n.BranchIndicator, { className: y, children: /* @__PURE__ */ a(b, {}) })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ a(n.BranchContent, { className: C, children: e.items.map((o, r) => /* @__PURE__ */ a(
|
|
50
|
+
p,
|
|
51
|
+
{
|
|
52
|
+
node: o,
|
|
53
|
+
indexPath: [...t, r],
|
|
54
|
+
renderItem: m
|
|
55
|
+
},
|
|
56
|
+
o.value
|
|
57
|
+
)) })
|
|
58
|
+
] })
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const l = e.href, c = _({ active: e.active });
|
|
62
|
+
return /* @__PURE__ */ a(
|
|
63
|
+
n.NodeProvider,
|
|
64
|
+
{
|
|
65
|
+
node: e,
|
|
66
|
+
indexPath: t,
|
|
67
|
+
children: l ? /* @__PURE__ */ a(
|
|
68
|
+
n.Item,
|
|
69
|
+
{
|
|
70
|
+
className: c,
|
|
71
|
+
asChild: !0,
|
|
72
|
+
children: /* @__PURE__ */ a(
|
|
73
|
+
"a",
|
|
74
|
+
{
|
|
75
|
+
href: l,
|
|
76
|
+
target: e.target,
|
|
77
|
+
children: /* @__PURE__ */ a("span", { className: d, children: i(e, m) })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
) : /* @__PURE__ */ a(n.Item, { className: c, children: /* @__PURE__ */ a("span", { className: d, children: i(e, m) }) })
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function V({
|
|
86
|
+
items: e,
|
|
87
|
+
expandedValue: t,
|
|
88
|
+
defaultExpandedValue: m,
|
|
89
|
+
onExpandedChange: l,
|
|
90
|
+
renderItem: c
|
|
91
|
+
}) {
|
|
92
|
+
const o = x(
|
|
93
|
+
() => f({
|
|
94
|
+
rootNode: { value: "__root__", label: "", items: e },
|
|
95
|
+
nodeToValue: (r) => r.value,
|
|
96
|
+
nodeToString: (r) => r.label,
|
|
97
|
+
nodeToChildren: (r) => r.items ?? [],
|
|
98
|
+
isNodeDisabled: (r) => !!r.disabled
|
|
99
|
+
}),
|
|
100
|
+
[e]
|
|
101
|
+
);
|
|
102
|
+
return /* @__PURE__ */ a(
|
|
103
|
+
n.Root,
|
|
104
|
+
{
|
|
105
|
+
collection: o,
|
|
106
|
+
expandedValue: t,
|
|
107
|
+
defaultExpandedValue: m,
|
|
108
|
+
onExpandedChange: (r) => l?.(r.expandedValue),
|
|
109
|
+
children: /* @__PURE__ */ a(n.Tree, { className: g, children: o.rootNode.items?.map((r, h) => /* @__PURE__ */ a(
|
|
110
|
+
p,
|
|
111
|
+
{
|
|
112
|
+
node: r,
|
|
113
|
+
indexPath: [h],
|
|
114
|
+
renderItem: c
|
|
115
|
+
},
|
|
116
|
+
r.value
|
|
117
|
+
)) })
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
V as P
|
|
123
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { a as x, I as t } from "./IconField-Dh6j6SL1.js";
|
|
3
3
|
import { P as I } from "./ProgressSpinner-B-lrS-tu.js";
|
|
4
|
-
import { S as v,
|
|
4
|
+
import { S as v, b as F } from "./icons-Dfn6EUcz.js";
|
|
5
5
|
const L = (o) => !!o.value && o.clearable, P = (o) => o.loading && !o.disabled;
|
|
6
6
|
function B({
|
|
7
7
|
value: o = "",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as w } from "react";
|
|
3
3
|
import { createListCollection as S, SelectRoot as y, SelectLabel as v, SelectControl as N, SelectTrigger as C, SelectContext as I, SelectValueText as T, SelectClearTrigger as j, SelectIndicator as _, SelectPositioner as z, SelectContent as D, SelectItem as L, SelectItemText as V, SelectItemIndicator as $ } from "@ark-ui/react/select";
|
|
4
|
-
import {
|
|
4
|
+
import { b as F, C as M, a as P } from "./icons-Dfn6EUcz.js";
|
|
5
5
|
const R = {
|
|
6
6
|
small: "mare:h-10",
|
|
7
7
|
medium: "mare:h-12"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { Portal as g } from "@ark-ui/react/portal";
|
|
3
|
+
import { Toaster as y, Toast as m, createToaster as u } from "@ark-ui/react/toast";
|
|
4
|
+
import { B as b } from "./Button-AfMqNCme.js";
|
|
5
|
+
const h = `
|
|
6
|
+
mare:group mare:w-full mare:min-w-[20rem] mare:max-w-[429px]
|
|
7
|
+
mare:relative mare:overflow-hidden mare:rounded-tpc-snackbar
|
|
8
|
+
mare:flex mare:items-center mare:gap-3 mare:p-3 mare:pr-4 mare:min-h-13
|
|
9
|
+
mare:shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.10),0px_4px_6px_-2px_rgba(0,0,0,0.05)]
|
|
10
|
+
mare:outline-none
|
|
11
|
+
mare:[translate:var(--x)_var(--y)] mare:[scale:var(--scale)]
|
|
12
|
+
mare:[z-index:var(--z-index)] mare:[height:var(--height)]
|
|
13
|
+
mare:[opacity:var(--opacity)] mare:[will-change:translate,opacity,scale]
|
|
14
|
+
mare:[transition:translate_400ms,scale_400ms,opacity_400ms,height_400ms]
|
|
15
|
+
mare:ark-closed:[transition:translate_400ms,scale_400ms,opacity_200ms]
|
|
16
|
+
mare:ark-type-contrast:bg-inverse mare:ark-type-contrast:text-on-inverse
|
|
17
|
+
mare:ark-type-secondary:bg-raised mare:ark-type-secondary:text-default mare:ark-type-secondary:border mare:ark-type-secondary:border-default
|
|
18
|
+
mare:ark-type-error:bg-danger mare:ark-type-error:text-on-danger
|
|
19
|
+
`, k = `
|
|
20
|
+
mare:flex mare:max-w-13 mare:min-w-6 mare:aspect-square mare:shrink-0
|
|
21
|
+
mare:items-center mare:justify-center mare:rounded-tpc-container-s
|
|
22
|
+
`, x = (a) => `
|
|
23
|
+
mare:tpc-typography-body-s ${a ? "" : "mare:ps-1"}
|
|
24
|
+
`, f = "mare:ml-auto mare:shrink-0", _ = `
|
|
25
|
+
mare:absolute mare:bottom-0 mare:left-0 mare:h-1 mare:w-0
|
|
26
|
+
mare:[background-color:currentColor]
|
|
27
|
+
mare:[animation:mare-snackbar-progress_var(--mare-snackbar-life)_linear_forwards]
|
|
28
|
+
`, v = {
|
|
29
|
+
"top-left": "top-start",
|
|
30
|
+
"top-center": "top",
|
|
31
|
+
"top-right": "top-end",
|
|
32
|
+
"bottom-left": "bottom-start",
|
|
33
|
+
"bottom-center": "bottom",
|
|
34
|
+
"bottom-right": "bottom-end"
|
|
35
|
+
}, w = (a) => v[a], i = 3e3, c = (a) => Math.max(a ?? i, i), l = /* @__PURE__ */ new WeakMap(), B = {
|
|
36
|
+
error: [1, 2],
|
|
37
|
+
secondary: [3, 6],
|
|
38
|
+
contrast: [6, 8]
|
|
39
|
+
}, T = (a, t) => {
|
|
40
|
+
const [s, e] = B[a];
|
|
41
|
+
return t ? s : e;
|
|
42
|
+
};
|
|
43
|
+
function I(a = {}) {
|
|
44
|
+
const t = u({
|
|
45
|
+
placement: w(a.placement ?? "bottom-center")
|
|
46
|
+
}), s = {
|
|
47
|
+
show(e) {
|
|
48
|
+
const r = e.severity ?? "contrast";
|
|
49
|
+
return t.create({
|
|
50
|
+
description: e.detail,
|
|
51
|
+
type: r,
|
|
52
|
+
priority: T(r, !!e.action),
|
|
53
|
+
duration: c(e.life),
|
|
54
|
+
action: e.action,
|
|
55
|
+
meta: { leading: e.leading, progressBar: e.progressBar }
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
dismiss(e) {
|
|
59
|
+
t.dismiss(e);
|
|
60
|
+
},
|
|
61
|
+
update(e, r) {
|
|
62
|
+
const n = t.getVisibleToasts().find((d) => d.id === e);
|
|
63
|
+
t.update(e, {
|
|
64
|
+
description: r.detail ?? n?.description,
|
|
65
|
+
type: r.severity ?? n?.type,
|
|
66
|
+
duration: r.life != null ? c(r.life) : n?.duration,
|
|
67
|
+
action: r.action ?? n?.action,
|
|
68
|
+
meta: {
|
|
69
|
+
leading: r.leading ?? n?.meta?.leading,
|
|
70
|
+
progressBar: r.progressBar ?? n?.meta?.progressBar
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return l.set(s, t), s;
|
|
76
|
+
}
|
|
77
|
+
function j({ controller: a, portalContainer: t }) {
|
|
78
|
+
const s = l.get(a);
|
|
79
|
+
if (!s)
|
|
80
|
+
throw new Error("Snackbar: controller was not created by createSnackbar().");
|
|
81
|
+
return /* @__PURE__ */ o(g, { container: t, children: /* @__PURE__ */ o(y, { toaster: s, children: (e) => {
|
|
82
|
+
const r = e.meta?.leading, n = !!e.meta?.progressBar;
|
|
83
|
+
return /* @__PURE__ */ p(m.Root, { className: h, children: [
|
|
84
|
+
r ? /* @__PURE__ */ o("div", { className: k, children: r }) : null,
|
|
85
|
+
/* @__PURE__ */ o(m.Description, { className: x(!!r), children: e.description }),
|
|
86
|
+
e.action ? /* @__PURE__ */ o("div", { className: f, children: /* @__PURE__ */ o(m.ActionTrigger, { asChild: !0, children: /* @__PURE__ */ o(b, { severity: "ghost", link: !0, size: "xsmall", children: e.action.label }) }) }) : null,
|
|
87
|
+
n ? /* @__PURE__ */ o(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: _,
|
|
91
|
+
style: { "--mare-snackbar-life": `${e.duration}ms` }
|
|
92
|
+
}
|
|
93
|
+
) : null
|
|
94
|
+
] }, e.id);
|
|
95
|
+
} }) });
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
j as S,
|
|
99
|
+
I as c
|
|
100
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { Steps as a } from "@ark-ui/react/steps";
|
|
3
|
+
import { a as k, d as b, e as v } from "./icons-Dfn6EUcz.js";
|
|
4
|
+
const y = "mare:flex mare:ark-horizontal:flex-col mare:ark-vertical:flex-row mare:gap-4 mare:w-full", N = `
|
|
5
|
+
mare:hidden mare:sm:flex mare:gap-2 mare:overflow-x-auto
|
|
6
|
+
mare:ark-horizontal:flex-row mare:ark-horizontal:items-center mare:ark-horizontal:justify-between
|
|
7
|
+
mare:ark-vertical:flex-col mare:ark-vertical:items-start
|
|
8
|
+
`, w = "mare:relative mare:flex mare:items-center mare:ark-vertical:items-start mare:gap-3 mare:flex-1 mare:last:flex-none", j = `
|
|
9
|
+
mare:group mare:flex mare:items-center mare:gap-3 mare:bg-transparent mare:border-none
|
|
10
|
+
mare:text-left mare:cursor-pointer mare:rounded-md mare:outline-none
|
|
11
|
+
mare:disabled:cursor-not-allowed mare:disabled:opacity-50
|
|
12
|
+
`, z = (t) => `
|
|
13
|
+
mare:group mare:flex mare:items-center mare:justify-center mare:shrink-0 mare:relative
|
|
14
|
+
mare:size-8 mare:rounded-full mare:tpc-typography-label-s
|
|
15
|
+
mare:ark-incomplete:bg-neutral-weak mare:ark-incomplete:text-weak
|
|
16
|
+
mare:ark-current:bg-accent mare:ark-current:text-on-accent
|
|
17
|
+
${t === "strong" ? "mare:ark-complete:bg-accent mare:ark-complete:text-on-accent" : "mare:ark-complete:bg-accent-weak mare:ark-complete:text-accent"}
|
|
18
|
+
`, C = "mare:flex mare:items-center mare:justify-center mare:[&>svg]:size-4", S = "mare:flex mare:items-center mare:justify-center mare:group-[[data-complete]]:hidden", I = "mare:hidden mare:group-[[data-complete]]:flex mare:items-center mare:justify-center mare:absolute mare:inset-0 mare:[&>svg]:size-4", T = `
|
|
19
|
+
mare:flex-1 mare:h-[1.5px] mare:bg-neutral-weak mare:transition-colors mare:duration-300
|
|
20
|
+
mare:ark-complete:bg-accent
|
|
21
|
+
mare:ark-vertical:absolute mare:ark-vertical:flex-none mare:ark-vertical:w-[1.5px] mare:ark-vertical:h-auto
|
|
22
|
+
mare:ark-vertical:top-8 mare:ark-vertical:bottom-[-0.5rem] mare:ark-vertical:start-[calc(1rem-0.75px)]
|
|
23
|
+
`, L = "mare:flex mare:flex-col mare:items-start mare:gap-0.5", R = "mare:tpc-typography-label-s mare:text-default mare:group-[[data-incomplete]]:text-weak", B = "mare:block mare:tpc-typography-body-xs mare:text-weak", F = `
|
|
24
|
+
mare:p-4 mare:min-h-24 mare:rounded-input mare:border mare:border-default
|
|
25
|
+
mare:bg-default mare:text-default mare:tpc-typography-body-s
|
|
26
|
+
`, M = `
|
|
27
|
+
mare:flex mare:sm:hidden mare:items-center mare:justify-between mare:gap-3
|
|
28
|
+
mare:px-3 mare:py-2 mare:rounded-input mare:border mare:border-default mare:bg-default
|
|
29
|
+
`, P = "mare:flex-1 mare:text-center mare:truncate mare:tpc-typography-body-s mare:text-default", c = `
|
|
30
|
+
mare:flex mare:items-center mare:justify-center mare:size-8 mare:rounded-full mare:text-default
|
|
31
|
+
mare:hover:bg-hover mare:disabled:opacity-40 mare:disabled:cursor-not-allowed mare:disabled:pointer-events-none
|
|
32
|
+
`;
|
|
33
|
+
function $({ items: t }) {
|
|
34
|
+
return /* @__PURE__ */ m("div", { className: M, children: [
|
|
35
|
+
/* @__PURE__ */ e(a.PrevTrigger, { className: c, children: /* @__PURE__ */ e(b, {}) }),
|
|
36
|
+
/* @__PURE__ */ e(a.Context, { children: (n) => /* @__PURE__ */ m("span", { className: P, children: [
|
|
37
|
+
t[n.value]?.title,
|
|
38
|
+
" · ",
|
|
39
|
+
n.value + 1,
|
|
40
|
+
"/",
|
|
41
|
+
n.count
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ e(a.NextTrigger, { className: c, children: /* @__PURE__ */ e(v, {}) })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
function E({
|
|
47
|
+
items: t,
|
|
48
|
+
step: n,
|
|
49
|
+
defaultStep: o,
|
|
50
|
+
onStepChange: s,
|
|
51
|
+
onStepComplete: i,
|
|
52
|
+
linear: d = !1,
|
|
53
|
+
orientation: p = "horizontal",
|
|
54
|
+
indicatorVariant: u = "default",
|
|
55
|
+
isStepValid: f,
|
|
56
|
+
isStepSkippable: h
|
|
57
|
+
}) {
|
|
58
|
+
const x = z(u);
|
|
59
|
+
return /* @__PURE__ */ m(
|
|
60
|
+
a.Root,
|
|
61
|
+
{
|
|
62
|
+
className: y,
|
|
63
|
+
count: t.length,
|
|
64
|
+
step: n,
|
|
65
|
+
defaultStep: o,
|
|
66
|
+
linear: d,
|
|
67
|
+
orientation: p,
|
|
68
|
+
isStepValid: f,
|
|
69
|
+
isStepSkippable: h,
|
|
70
|
+
onStepChange: (r) => s?.(r.step),
|
|
71
|
+
onStepComplete: i,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ e(a.List, { className: N, children: t.map((r, l) => /* @__PURE__ */ m(
|
|
74
|
+
a.Item,
|
|
75
|
+
{
|
|
76
|
+
index: l,
|
|
77
|
+
className: w,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ m(a.Trigger, { className: j, children: [
|
|
80
|
+
/* @__PURE__ */ e(a.Indicator, { className: x, children: r.icon ? /* @__PURE__ */ e("span", { className: C, children: r.icon }) : /* @__PURE__ */ m(g, { children: [
|
|
81
|
+
/* @__PURE__ */ e("span", { className: I, children: /* @__PURE__ */ e(k, {}) }),
|
|
82
|
+
/* @__PURE__ */ e("span", { className: S, children: l + 1 })
|
|
83
|
+
] }) }),
|
|
84
|
+
/* @__PURE__ */ m("span", { className: L, children: [
|
|
85
|
+
/* @__PURE__ */ e("span", { className: R, children: r.title }),
|
|
86
|
+
r.description && /* @__PURE__ */ e("span", { className: B, children: r.description })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ e(a.Separator, { className: T })
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
l
|
|
93
|
+
)) }),
|
|
94
|
+
/* @__PURE__ */ e($, { items: t }),
|
|
95
|
+
t.map((r, l) => /* @__PURE__ */ e(
|
|
96
|
+
a.Content,
|
|
97
|
+
{
|
|
98
|
+
index: l,
|
|
99
|
+
className: F,
|
|
100
|
+
children: r.content
|
|
101
|
+
},
|
|
102
|
+
l
|
|
103
|
+
))
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
E as S
|
|
110
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
const o = (t) => function(c) {
|
|
3
|
+
return /* @__PURE__ */ s(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "2",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
width: "1em",
|
|
15
|
+
height: "1em",
|
|
16
|
+
...c,
|
|
17
|
+
children: t.map((n) => /* @__PURE__ */ s(
|
|
18
|
+
"path",
|
|
19
|
+
{
|
|
20
|
+
d: n
|
|
21
|
+
},
|
|
22
|
+
n
|
|
23
|
+
))
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}, h = o(["M6 9l6 6 6-6"]), M = o(["M15 18l-6-6 6-6"]), l = o(["M9 18l6-6-6-6"]), i = o(["M11 17l-5-5 5-5", "M18 17l-5-5 5-5"]), I = o(["M6 17l5-5-5-5", "M13 17l5-5-5-5"]), v = o(["M5 12l5 5L20 7"]), C = o([
|
|
27
|
+
"M8 2v4M16 2v4",
|
|
28
|
+
"M3 8h18",
|
|
29
|
+
"M4 4h16a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z"
|
|
30
|
+
]), e = o(["M6 6l12 12", "M18 6L6 18"]), d = e, g = o(["M5 12h14"]), u = o([
|
|
31
|
+
"M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14z",
|
|
32
|
+
"M20 20l-5-5"
|
|
33
|
+
]);
|
|
34
|
+
export {
|
|
35
|
+
h as C,
|
|
36
|
+
g as M,
|
|
37
|
+
u as S,
|
|
38
|
+
v as a,
|
|
39
|
+
e as b,
|
|
40
|
+
i as c,
|
|
41
|
+
M as d,
|
|
42
|
+
l as e,
|
|
43
|
+
I as f,
|
|
44
|
+
d as g,
|
|
45
|
+
C as h
|
|
46
|
+
};
|
package/dist/shared/icons.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
2
|
export declare const ChevronDownIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
3
|
+
export declare const ChevronUpIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
4
|
+
export declare const ChevronLeftIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
5
|
+
export declare const ChevronRightIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
6
|
+
export declare const ChevronsLeftIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
7
|
+
export declare const ChevronsRightIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
3
8
|
export declare const CheckIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
9
|
+
export declare const CalendarIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
4
10
|
export declare const ClearIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
5
11
|
export declare const CloseIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
6
12
|
export declare const MinusIcon: (properties: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Tiny `matchMedia` subscription — no dependency, mirrors the Vue DS's
|
|
2
|
+
* useScreenWidth for the one thing components here actually need: whether
|
|
3
|
+
* we're at/above Tailwind's default `sm` breakpoint (640px). */
|
|
4
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
5
|
+
export declare const SM_BREAKPOINT_QUERY = "(min-width: 640px)";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SnackbarController, SnackbarConfig, SnackbarProperties } from './Snackbar.types';
|
|
2
|
+
export declare function createSnackbar(config?: SnackbarConfig): SnackbarController;
|
|
3
|
+
export declare function Snackbar({ controller, portalContainer }: SnackbarProperties): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { SnackbarSeverity, SnackbarPlacement } from '@tpc-development/mare-ui-components-core/snackbar';
|
|
3
|
+
export type { SnackbarSeverity, SnackbarPlacement, } from '@tpc-development/mare-ui-components-core/snackbar';
|
|
4
|
+
/** The payload for `controller.show()`/`.update()`. Framework-shaped on
|
|
5
|
+
* purpose (ReactNode `detail`/`leading`) — this is why it lives in the
|
|
6
|
+
* adapter, not in core alongside `SnackbarSeverity`/`SnackbarPlacement`. */
|
|
7
|
+
export interface SnackbarShowOptions {
|
|
8
|
+
/** @default 'contrast' */
|
|
9
|
+
severity?: SnackbarSeverity;
|
|
10
|
+
detail: ReactNode;
|
|
11
|
+
/** Icon or image shown before the detail text. Mutually exclusive with
|
|
12
|
+
* nothing in particular — it's just whatever `ReactNode` you pass. */
|
|
13
|
+
leading?: ReactNode;
|
|
14
|
+
/** @default 3000, and never resolves lower than that. */
|
|
15
|
+
life?: number;
|
|
16
|
+
/** Progress bar filling over `life`, indicating time until auto-dismiss. @default false */
|
|
17
|
+
progressBar?: boolean;
|
|
18
|
+
action?: {
|
|
19
|
+
label: string;
|
|
20
|
+
onClick: () => void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Returned by `createSnackbar()`. Mirrors the legacy `useToast()` service —
|
|
24
|
+
* mount ONE `<Snackbar controller={controller} />` per controller, then push
|
|
25
|
+
* messages into it from anywhere via `controller.show(...)`. */
|
|
26
|
+
export interface SnackbarController {
|
|
27
|
+
/** Pushes a new message, returns its id. */
|
|
28
|
+
show(options: SnackbarShowOptions): string;
|
|
29
|
+
/** Dismisses one message by id, or every message in this controller if omitted. */
|
|
30
|
+
dismiss(id?: string): void;
|
|
31
|
+
update(id: string, options: Partial<SnackbarShowOptions>): void;
|
|
32
|
+
}
|
|
33
|
+
export interface SnackbarConfig {
|
|
34
|
+
/** @default 'bottom-center' */
|
|
35
|
+
placement?: SnackbarPlacement;
|
|
36
|
+
}
|
|
37
|
+
export interface SnackbarProperties {
|
|
38
|
+
controller: SnackbarController;
|
|
39
|
+
/** Where the toast stack portals to. Override if your app scopes
|
|
40
|
+
* `data-theme` to a sub-tree rather than the document root. */
|
|
41
|
+
portalContainer?: RefObject<HTMLElement | null>;
|
|
42
|
+
}
|