@jirawatpyk/aura-react 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,198 @@
1
+ 'use client';
2
+ import * as React from "react";
3
+ import { useStrings, useAuraLocale } from "./locale.js";
4
+ import { cx, useMaybeControlled, uid } from "./internal.js";
5
+ import { Icon } from "./Icon.js";
6
+ const h = React.createElement;
7
+ const Card = React.forwardRef(function Card2(props, ref) {
8
+ var creative = props.variant === "creative";
9
+ return h(
10
+ props.as || "section",
11
+ {
12
+ ref,
13
+ className: cx("aura-card", creative && "aura-card--creative", props.interactive && "is-interactive", props.className),
14
+ "aria-labelledby": props.title && props.titleId ? props.titleId : void 0
15
+ },
16
+ props.title || props.actions ? h(
17
+ "div",
18
+ { className: "aura-card__head" },
19
+ h(
20
+ "div",
21
+ { className: "aura-card__heading" },
22
+ props.title ? h("h" + (props.headingLevel || 3), { className: "aura-card__title", id: props.titleId }, props.title) : null,
23
+ props.description ? h("p", { className: "aura-card__desc" }, props.description) : null
24
+ ),
25
+ props.actions ? h("div", { className: "aura-card__actions" }, props.actions) : null
26
+ ) : null,
27
+ props.children ? h("div", { className: "aura-card__body" }, props.children) : null,
28
+ props.footer ? h("div", { className: "aura-card__foot" }, props.footer) : null
29
+ );
30
+ });
31
+ const Tabs = React.forwardRef(function Tabs2(props, ref) {
32
+ var items = props.tabs || [], base = uid();
33
+ var st = useMaybeControlled(props.value, props.defaultValue || items[0] && items[0].id, props.onChange);
34
+ var refs = React.useRef({});
35
+ var current = items.filter(function(t) {
36
+ return t.id === st[0];
37
+ })[0] || items[0];
38
+ function go(i) {
39
+ var enabled = items.filter(function(t2) {
40
+ return !t2.disabled;
41
+ });
42
+ var t = enabled[(i + enabled.length) % enabled.length];
43
+ st[1](t.id);
44
+ if (refs.current[t.id]) refs.current[t.id].focus();
45
+ }
46
+ return h(
47
+ "div",
48
+ { ref, className: cx("aura-tabs", props.className) },
49
+ h(
50
+ "div",
51
+ {
52
+ role: "tablist",
53
+ "aria-label": props.label,
54
+ className: "aura-tabs__list",
55
+ onKeyDown: function(e) {
56
+ var enabled = items.filter(function(t) {
57
+ return !t.disabled;
58
+ }), i = enabled.indexOf(current);
59
+ if (e.key === "ArrowRight") {
60
+ e.preventDefault();
61
+ go(i + 1);
62
+ } else if (e.key === "ArrowLeft") {
63
+ e.preventDefault();
64
+ go(i - 1);
65
+ } else if (e.key === "Home") {
66
+ e.preventDefault();
67
+ go(0);
68
+ } else if (e.key === "End") {
69
+ e.preventDefault();
70
+ go(enabled.length - 1);
71
+ }
72
+ }
73
+ },
74
+ items.map(function(t) {
75
+ var on = current && t.id === current.id;
76
+ return h(
77
+ "button",
78
+ {
79
+ key: t.id,
80
+ type: "button",
81
+ role: "tab",
82
+ id: base + "-tab-" + t.id,
83
+ "aria-selected": on,
84
+ "aria-controls": base + "-panel-" + t.id,
85
+ tabIndex: on ? 0 : -1,
86
+ disabled: t.disabled,
87
+ ref: function(el) {
88
+ refs.current[t.id] = el;
89
+ },
90
+ className: cx("aura-tab", on && "is-active"),
91
+ onClick: function() {
92
+ st[1](t.id);
93
+ }
94
+ },
95
+ t.icon ? h(Icon, { name: t.icon }) : null,
96
+ t.label,
97
+ t.count != null ? h("span", { className: "aura-tab__count" }, t.count) : null
98
+ );
99
+ })
100
+ ),
101
+ current && current.content !== void 0 ? h("div", {
102
+ role: "tabpanel",
103
+ id: base + "-panel-" + current.id,
104
+ "aria-labelledby": base + "-tab-" + current.id,
105
+ tabIndex: 0,
106
+ className: "aura-tabs__panel"
107
+ }, current.content) : null
108
+ );
109
+ });
110
+ const SideNav = React.forwardRef(function SideNav2(props, ref) {
111
+ var t = useStrings();
112
+ var st = useMaybeControlled(props.value, props.defaultValue, props.onChange);
113
+ function item(it) {
114
+ var on = st[0] === it.id;
115
+ var inner = [
116
+ it.icon ? h(Icon, { key: "i", name: it.icon }) : null,
117
+ h("span", { key: "l", className: "aura-nav__label" }, it.label),
118
+ it.count != null ? h("span", { key: "c", className: "aura-nav__count" }, it.count) : null
119
+ ];
120
+ var common = {
121
+ className: cx("aura-nav__item", on && "is-active"),
122
+ "aria-current": on ? "page" : void 0,
123
+ onClick: function(e) {
124
+ if (!it.href) e.preventDefault();
125
+ st[1](it.id);
126
+ }
127
+ };
128
+ return h("li", { key: it.id }, it.href ? h("a", Object.assign({ href: it.href }, common), inner) : h("button", Object.assign({ type: "button" }, common), inner));
129
+ }
130
+ return h(
131
+ "nav",
132
+ { ref, className: cx("aura-nav", props.className), "aria-label": props.label || t.mainNav },
133
+ props.header ? h("div", { className: "aura-nav__header" }, props.header) : null,
134
+ h(
135
+ "div",
136
+ { className: "aura-nav__scroll" },
137
+ (props.sections || [{ items: props.items || [] }]).map(function(s, i) {
138
+ return h(
139
+ "div",
140
+ { key: i, className: "aura-nav__section" },
141
+ s.title ? h("p", { className: "aura-nav__title" }, s.title) : null,
142
+ h("ul", { className: "aura-nav__list" }, s.items.map(item))
143
+ );
144
+ })
145
+ ),
146
+ props.footer ? h("div", { className: "aura-nav__footer" }, props.footer) : null
147
+ );
148
+ });
149
+ const Breadcrumb = React.forwardRef(function Breadcrumb2(props, ref) {
150
+ var t = useStrings();
151
+ var items = props.items || [];
152
+ return h(
153
+ "nav",
154
+ { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) },
155
+ h("ol", null, items.map(function(it, i) {
156
+ var last = i === items.length - 1;
157
+ return h(
158
+ "li",
159
+ { key: i },
160
+ last ? h("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? h("a", { href: it.href, onClick: it.onClick }, it.label) : h("button", { type: "button", onClick: it.onClick }, it.label),
161
+ last ? null : h(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" })
162
+ );
163
+ }))
164
+ );
165
+ });
166
+ var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
167
+ function initials(name) {
168
+ var parts = String(name || "?").trim().split(/\s+/);
169
+ return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
170
+ }
171
+ const Avatar = React.forwardRef(function Avatar2(props, ref) {
172
+ var size = props.size || "md", errState = React.useState(false);
173
+ var hash = 0;
174
+ String(props.name || "").split("").forEach(function(ch) {
175
+ hash = hash * 31 + ch.charCodeAt(0) >>> 0;
176
+ });
177
+ var tone = AVATAR_TONES[hash % AVATAR_TONES.length];
178
+ return h(
179
+ "span",
180
+ {
181
+ ref,
182
+ className: cx("aura-avatar", "aura-avatar--" + size, "aura-avatar--" + tone, props.className),
183
+ role: "img",
184
+ "aria-label": props.name + (props.status ? ", " + props.status : "")
185
+ },
186
+ props.src && !errState[0] ? h("img", { src: props.src, alt: "", onError: function() {
187
+ errState[1](true);
188
+ } }) : h("span", { "aria-hidden": true }, initials(props.name)),
189
+ props.status === "online" ? h("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
190
+ );
191
+ });
192
+ export {
193
+ Avatar,
194
+ Breadcrumb,
195
+ Card,
196
+ SideNav,
197
+ Tabs
198
+ };
@@ -0,0 +1,114 @@
1
+ 'use client';
2
+ import * as React from "react";
3
+ import { useStrings, useAuraLocale } from "./locale.js";
4
+ import { cx } from "./internal.js";
5
+ import { IconButton } from "./IconButton.js";
6
+ import { Drawer } from "./Dialog.js";
7
+ const h = React.createElement;
8
+ var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
9
+ var ORDER = ["base", "sm", "md", "lg", "xl"];
10
+ function useBreakpoint() {
11
+ return React.useSyncExternalStore(subscribe, current, function() {
12
+ return "lg";
13
+ });
14
+ }
15
+ function current() {
16
+ var w = window.innerWidth, bp = "base";
17
+ ORDER.slice(1).forEach(function(k) {
18
+ if (w >= breakpoints[k]) bp = k;
19
+ });
20
+ return bp;
21
+ }
22
+ function subscribe(cb) {
23
+ window.addEventListener("resize", cb);
24
+ return function() {
25
+ window.removeEventListener("resize", cb);
26
+ };
27
+ }
28
+ function useResponsive(value) {
29
+ var bp = useBreakpoint();
30
+ if (value == null || typeof value !== "object") return value;
31
+ for (var i = ORDER.indexOf(bp); i >= 0; i--) if (value[ORDER[i]] !== void 0) return value[ORDER[i]];
32
+ return void 0;
33
+ }
34
+ function respVars(prefix, value, map) {
35
+ var style = {};
36
+ if (value == null) return style;
37
+ if (typeof value !== "object") value = { base: value };
38
+ var cur;
39
+ ORDER.forEach(function(k) {
40
+ if (value[k] !== void 0) cur = map ? map(value[k]) : value[k];
41
+ if (cur !== void 0) style["--" + prefix + "-" + k] = cur;
42
+ });
43
+ return style;
44
+ }
45
+ var space = function(v) {
46
+ return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
47
+ };
48
+ const Stack = React.forwardRef(function Stack2(props, ref) {
49
+ var style = Object.assign(
50
+ {},
51
+ respVars("aura-stack-dir", props.direction || "column"),
52
+ respVars("aura-stack-gap", props.gap == null ? 4 : props.gap, space),
53
+ respVars("aura-stack-align", props.align || "stretch"),
54
+ props.justify ? { justifyContent: props.justify } : null,
55
+ props.wrap ? { flexWrap: "wrap" } : null,
56
+ props.style
57
+ );
58
+ return h(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
59
+ });
60
+ const Grid = React.forwardRef(function Grid2(props, ref) {
61
+ var style = Object.assign(
62
+ {},
63
+ respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
64
+ props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
65
+ props.style
66
+ );
67
+ return h(props.as || "div", { ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style }, props.children);
68
+ });
69
+ const Container = React.forwardRef(function Container2(props, ref) {
70
+ return h(props.as || "div", { ref, className: cx("aura-container", props.size === "narrow" && "is-narrow", props.className), style: props.style }, props.children);
71
+ });
72
+ const AppShell = React.forwardRef(function AppShell2(props, ref) {
73
+ var t = useStrings();
74
+ var bp = useBreakpoint();
75
+ var compact = bp === "base" || bp === "sm" || bp === "md";
76
+ var st = React.useState(false), open = st[0], setOpen = st[1];
77
+ React.useEffect(function() {
78
+ if (!compact) setOpen(false);
79
+ }, [compact]);
80
+ var nav = props.nav && React.isValidElement(props.nav) && compact ? React.cloneElement(props.nav, { onChange: function(id) {
81
+ if (props.nav.props.onChange) props.nav.props.onChange(id);
82
+ setOpen(false);
83
+ }, className: cx(props.nav.props.className, "is-in-drawer") }) : props.nav;
84
+ return h(
85
+ "div",
86
+ { ref, className: cx("aura-shell", compact && "is-compact", props.className) },
87
+ !compact ? h("div", { className: "aura-shell__nav" }, nav) : null,
88
+ compact ? h(Drawer, { open, onClose: function() {
89
+ setOpen(false);
90
+ }, side: "left", size: "nav", "aria-label": props.navLabel || t.navigation, dismissible: true }, nav) : null,
91
+ h(
92
+ "div",
93
+ { className: "aura-shell__main" },
94
+ props.header || compact ? h(
95
+ "header",
96
+ { className: "aura-shell__bar" },
97
+ compact ? h(IconButton, { icon: "menu", label: props.menuLabel || t.openNav, size: "md", onClick: function() {
98
+ setOpen(true);
99
+ }, "aria-expanded": open }) : null,
100
+ h("div", { className: "aura-shell__bar-content" }, props.header)
101
+ ) : null,
102
+ h("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)
103
+ )
104
+ );
105
+ });
106
+ export {
107
+ AppShell,
108
+ Container,
109
+ Grid,
110
+ Stack,
111
+ breakpoints,
112
+ useBreakpoint,
113
+ useResponsive
114
+ };
@@ -0,0 +1,204 @@
1
+ 'use client';
2
+ import * as React from "react";
3
+ const h = React.createElement;
4
+ var n = function(x) {
5
+ return Number(x).toLocaleString("en");
6
+ };
7
+ var STRINGS = {
8
+ en: {
9
+ close: "Close",
10
+ dismiss: "Dismiss",
11
+ dismissToast: "Dismiss notification",
12
+ notifications: "Notifications",
13
+ mainNav: "Main",
14
+ breadcrumb: "Breadcrumb",
15
+ navigation: "Navigation",
16
+ openNav: "Open navigation",
17
+ searching: "Searching\u2026",
18
+ noMatches: "No matches",
19
+ clear: function(what) {
20
+ return "Clear " + (what || "selection");
21
+ },
22
+ keepTyping: function(total) {
23
+ return "Keep typing to narrow " + n(total) + " options";
24
+ },
25
+ sortAsc: "Sort ascending",
26
+ sortDesc: "Sort descending",
27
+ pin: "Pin to left",
28
+ unpin: "Unpin column",
29
+ moveLeft: "Move left",
30
+ moveRight: "Move right",
31
+ hideColumn: "Hide column",
32
+ resetColumns: "Reset columns",
33
+ selectRows: "Select rows",
34
+ selectAllRows: "Select all rows",
35
+ deselectAllRows: "Deselect all rows",
36
+ selectAll: "Select all",
37
+ selectRow: function(k) {
38
+ return "Select " + k;
39
+ },
40
+ selectedCount: function(c) {
41
+ return n(c) + " selected";
42
+ },
43
+ pinned: "Pinned",
44
+ columnOptions: function(label) {
45
+ return label + " column options";
46
+ },
47
+ column: function(label) {
48
+ return label ? label + " column" : "Column";
49
+ },
50
+ columns: "Columns",
51
+ showHideColumns: "Show or hide columns",
52
+ empty: "Nothing here yet",
53
+ loading: "Loading\u2026",
54
+ loadingRows: "Loading rows",
55
+ range: function(a, b, total) {
56
+ return a + "\u2013" + b + " of " + n(total);
57
+ },
58
+ page: function(p, total) {
59
+ return "Page " + p + " of " + total;
60
+ },
61
+ prevPage: "Previous page",
62
+ nextPage: "Next page",
63
+ rowCount: function(c) {
64
+ return n(c) + " rows";
65
+ },
66
+ actions: "Actions",
67
+ optional: "optional",
68
+ timePlaceholder: "hh:mm",
69
+ timeInvalid: "Type a time like 09:30",
70
+ timeOutOfRange: function(a, b) {
71
+ return "Choose a time between " + a + " and " + b;
72
+ },
73
+ dropFiles: "Drag files here or",
74
+ browse: "Choose files",
75
+ browseOne: "Choose a file",
76
+ remove: function(n2) {
77
+ return "Remove " + n2;
78
+ },
79
+ fileTooBig: function(max) {
80
+ return "Larger than " + max;
81
+ },
82
+ fileWrongType: "This file type isn\u2019t accepted",
83
+ tooManyFiles: function(n2) {
84
+ return "Up to " + n2 + " files";
85
+ },
86
+ uploading: "Uploading\u2026",
87
+ images: "Images",
88
+ pagination: "Pagination",
89
+ pageN: function(p) {
90
+ return "Page " + p;
91
+ },
92
+ accepts: function(list, max) {
93
+ return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
94
+ }
95
+ },
96
+ th: {
97
+ close: "\u0E1B\u0E34\u0E14",
98
+ dismiss: "\u0E1B\u0E34\u0E14",
99
+ dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
100
+ notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
101
+ mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
102
+ breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
103
+ navigation: "\u0E40\u0E21\u0E19\u0E39",
104
+ openNav: "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
105
+ searching: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
106
+ noMatches: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
107
+ clear: function(what) {
108
+ return "\u0E25\u0E49\u0E32\u0E07" + (what || "\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01");
109
+ },
110
+ keepTyping: function(total) {
111
+ return "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E01\u0E23\u0E2D\u0E07\u0E08\u0E32\u0E01 " + n(total) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
112
+ },
113
+ sortAsc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",
114
+ sortDesc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",
115
+ pin: "\u0E15\u0E23\u0E36\u0E07\u0E44\u0E27\u0E49\u0E0B\u0E49\u0E32\u0E22",
116
+ unpin: "\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
117
+ moveLeft: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E0B\u0E49\u0E32\u0E22",
118
+ moveRight: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E02\u0E27\u0E32",
119
+ hideColumn: "\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
120
+ resetColumns: "\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
121
+ selectRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",
122
+ selectAllRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
123
+ deselectAllRows: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
124
+ selectAll: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
125
+ selectRow: function(k) {
126
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + k;
127
+ },
128
+ selectedCount: function(c) {
129
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + n(c) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
130
+ },
131
+ pinned: "\u0E15\u0E23\u0E36\u0E07\u0E2D\u0E22\u0E39\u0E48",
132
+ columnOptions: function(label) {
133
+ return "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label;
134
+ },
135
+ column: function(label) {
136
+ return label ? "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label : "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C";
137
+ },
138
+ columns: "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
139
+ showHideColumns: "\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
140
+ empty: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
141
+ loading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",
142
+ loadingRows: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
143
+ range: function(a, b, total) {
144
+ return a + "\u2013" + b + " \u0E08\u0E32\u0E01 " + n(total);
145
+ },
146
+ page: function(p, total) {
147
+ return "\u0E2B\u0E19\u0E49\u0E32 " + p + " / " + total;
148
+ },
149
+ prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
150
+ nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
151
+ rowCount: function(c) {
152
+ return n(c) + " \u0E41\u0E16\u0E27";
153
+ },
154
+ actions: "\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E01\u0E32\u0E23",
155
+ optional: "\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A",
156
+ timePlaceholder: "\u0E0A\u0E0A:\u0E19\u0E19",
157
+ timeInvalid: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A 09:30",
158
+ timeOutOfRange: function(a, b) {
159
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07 " + a + "\u2013" + b + " \u0E19.";
160
+ },
161
+ dropFiles: "\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E27\u0E32\u0E07 \u0E2B\u0E23\u0E37\u0E2D",
162
+ browse: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
163
+ browseOne: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
164
+ remove: function(n2) {
165
+ return "\u0E25\u0E1A " + n2;
166
+ },
167
+ fileTooBig: function(max) {
168
+ return "\u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19 " + max;
169
+ },
170
+ fileWrongType: "\u0E44\u0E21\u0E48\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E44\u0E1F\u0E25\u0E4C\u0E0A\u0E19\u0E34\u0E14\u0E19\u0E35\u0E49",
171
+ tooManyFiles: function(n2) {
172
+ return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
173
+ },
174
+ uploading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u2026",
175
+ images: "\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E",
176
+ pagination: "\u0E40\u0E25\u0E02\u0E2B\u0E19\u0E49\u0E32",
177
+ pageN: function(p) {
178
+ return "\u0E2B\u0E19\u0E49\u0E32 " + p;
179
+ },
180
+ accepts: function(list, max) {
181
+ return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
182
+ }
183
+ }
184
+ };
185
+ var LocaleContext = React.createContext(null);
186
+ function AuraProvider(props) {
187
+ var value = React.useMemo(function() {
188
+ var base = STRINGS[props.locale] || STRINGS.en;
189
+ return { locale: props.locale || "en", calendar: props.calendar, strings: props.strings ? Object.assign({}, base, props.strings) : base };
190
+ }, [props.locale, props.calendar, props.strings]);
191
+ return h(LocaleContext.Provider, { value }, props.children);
192
+ }
193
+ function useAuraLocale() {
194
+ return React.useContext(LocaleContext) || { locale: null, calendar: null, strings: STRINGS.en };
195
+ }
196
+ function useStrings() {
197
+ return useAuraLocale().strings;
198
+ }
199
+ export {
200
+ AuraProvider,
201
+ STRINGS,
202
+ useAuraLocale,
203
+ useStrings
204
+ };
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import * as React from "react";
3
+ import { FOCUSABLE, useMounted } from "./internal.js";
4
+ function useModal(open, ref, opts) {
5
+ var mounted = useMounted();
6
+ var prev = React.useRef(null);
7
+ var o = opts || {};
8
+ React.useEffect(function() {
9
+ if (!open || !mounted) return;
10
+ prev.current = document.activeElement;
11
+ var body = document.body, overflow = body.style.overflow;
12
+ body.style.overflow = "hidden";
13
+ var el = ref.current;
14
+ var target = el && (el.querySelector("[data-autofocus]") || el.querySelector(o.bodySelector + " " + FOCUSABLE) || el.querySelector(o.footSelector + " " + FOCUSABLE) || el);
15
+ if (target && o.autoFocus !== false) target.focus();
16
+ return function() {
17
+ body.style.overflow = overflow;
18
+ if (prev.current && prev.current.focus) prev.current.focus();
19
+ };
20
+ }, [open, mounted]);
21
+ function onKeyDown(e) {
22
+ if (e.key === "Escape") {
23
+ e.stopPropagation();
24
+ if (o.onEscape) o.onEscape();
25
+ return;
26
+ }
27
+ if (e.key !== "Tab" || !ref.current) return;
28
+ var list = Array.prototype.slice.call(ref.current.querySelectorAll(FOCUSABLE));
29
+ if (!list.length) {
30
+ e.preventDefault();
31
+ return;
32
+ }
33
+ var first = list[0], last = list[list.length - 1];
34
+ if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
35
+ e.preventDefault();
36
+ last.focus();
37
+ } else if (!e.shiftKey && document.activeElement === last) {
38
+ e.preventDefault();
39
+ first.focus();
40
+ }
41
+ }
42
+ return { ready: open && mounted, onKeyDown };
43
+ }
44
+ export {
45
+ useModal
46
+ };