@jirawatpyk/aura-react 4.7.2 → 4.8.0
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 +1 -1
- package/dist/aura.bundle.js +451 -379
- package/dist/cjs/index.cjs +451 -379
- package/dist/esm/Accordion.js +66 -0
- package/dist/esm/Alert.js +31 -0
- package/dist/esm/AppShell.js +55 -0
- package/dist/esm/Avatar.js +39 -0
- package/dist/esm/Badge.js +26 -0
- package/dist/esm/Breadcrumb.js +16 -0
- package/dist/esm/Card.js +26 -0
- package/dist/esm/Combobox.js +1 -1
- package/dist/esm/Container.js +18 -0
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/EmptyState.js +22 -0
- package/dist/esm/Field.js +46 -0
- package/dist/esm/FileUpload.js +1 -1
- package/dist/esm/Grid.js +21 -0
- package/dist/esm/Pagination.js +94 -0
- package/dist/esm/Popover.js +131 -0
- package/dist/esm/Progress.js +40 -0
- package/dist/esm/RadioGroup.js +46 -0
- package/dist/esm/Select.js +48 -0
- package/dist/esm/SideNav.js +36 -0
- package/dist/esm/Skeleton.js +29 -0
- package/dist/esm/Stack.js +20 -0
- package/dist/esm/Switch.js +30 -0
- package/dist/esm/Tabs.js +89 -0
- package/dist/esm/Tag.js +42 -0
- package/dist/esm/TextField.js +39 -0
- package/dist/esm/Textarea.js +38 -0
- package/dist/esm/TimePicker.js +1 -1
- package/dist/esm/Toaster.js +124 -0
- package/dist/esm/Tooltip.js +80 -0
- package/dist/esm/index.js +27 -5
- package/dist/esm/internal.js +5 -0
- package/dist/esm/responsive.js +50 -0
- package/dist/index.d.ts +8 -8
- package/package.json +1 -1
- package/dist/esm/extra.js +0 -412
- package/dist/esm/feedback.js +0 -220
- package/dist/esm/forms.js +0 -212
- package/dist/esm/layout.js +0 -183
- package/dist/esm/layout2.js +0 -138
- /package/dist/esm/{overlay.js → useModal.js} +0 -0
package/dist/esm/layout2.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useStrings } 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
|
-
const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
9
|
-
const 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
|
-
let 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
|
-
const bp = useBreakpoint();
|
|
30
|
-
if (value == null || typeof value !== "object") return value;
|
|
31
|
-
const map = value;
|
|
32
|
-
for (let i = ORDER.indexOf(bp); i >= 0; i--) if (map[ORDER[i]] !== void 0) return map[ORDER[i]];
|
|
33
|
-
return void 0;
|
|
34
|
-
}
|
|
35
|
-
function respVars(prefix, value, map) {
|
|
36
|
-
const style = {};
|
|
37
|
-
if (value == null) return style;
|
|
38
|
-
if (typeof value !== "object") value = { base: value };
|
|
39
|
-
let byBp = value, cur;
|
|
40
|
-
ORDER.forEach(function(k) {
|
|
41
|
-
if (byBp[k] !== void 0) cur = map ? map(byBp[k]) : byBp[k];
|
|
42
|
-
if (cur !== void 0) style["--" + prefix + "-" + k] = cur;
|
|
43
|
-
});
|
|
44
|
-
return style;
|
|
45
|
-
}
|
|
46
|
-
const space = function(v) {
|
|
47
|
-
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
48
|
-
};
|
|
49
|
-
const Stack = React.forwardRef(function Stack2(props, ref) {
|
|
50
|
-
const style = Object.assign(
|
|
51
|
-
{},
|
|
52
|
-
respVars("aura-stack-dir", props.direction || "column"),
|
|
53
|
-
respVars("aura-stack-gap", props.gap == null ? 4 : props.gap, space),
|
|
54
|
-
respVars("aura-stack-align", props.align || "stretch"),
|
|
55
|
-
props.justify ? { justifyContent: props.justify } : null,
|
|
56
|
-
props.wrap ? { flexWrap: "wrap" } : null,
|
|
57
|
-
props.style
|
|
58
|
-
);
|
|
59
|
-
return h(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
|
|
60
|
-
});
|
|
61
|
-
const Grid = React.forwardRef(function Grid2(props, ref) {
|
|
62
|
-
const style = Object.assign(
|
|
63
|
-
{},
|
|
64
|
-
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
65
|
-
props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
|
|
66
|
-
props.style
|
|
67
|
-
);
|
|
68
|
-
return h(
|
|
69
|
-
props.as || "div",
|
|
70
|
-
{ ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style },
|
|
71
|
-
props.children
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
const Container = React.forwardRef(function Container2(props, ref) {
|
|
75
|
-
return h(
|
|
76
|
-
props.as || "div",
|
|
77
|
-
{
|
|
78
|
-
ref,
|
|
79
|
-
className: cx("aura-container", props.size === "narrow" && "is-narrow", props.className),
|
|
80
|
-
style: props.style
|
|
81
|
-
},
|
|
82
|
-
props.children
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
const AppShell = React.forwardRef(function AppShell2(props, ref) {
|
|
86
|
-
const t = useStrings();
|
|
87
|
-
const bp = useBreakpoint();
|
|
88
|
-
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
89
|
-
const st = React.useState(false), open = st[0], setOpen = st[1];
|
|
90
|
-
React.useEffect(
|
|
91
|
-
function() {
|
|
92
|
-
if (!compact) setOpen(false);
|
|
93
|
-
},
|
|
94
|
-
[compact]
|
|
95
|
-
);
|
|
96
|
-
const navEl = props.nav;
|
|
97
|
-
const nav = props.nav && React.isValidElement(props.nav) && compact ? React.cloneElement(navEl, {
|
|
98
|
-
onChange: function(id) {
|
|
99
|
-
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
100
|
-
setOpen(false);
|
|
101
|
-
},
|
|
102
|
-
className: cx(navEl.props.className, "is-in-drawer")
|
|
103
|
-
}) : props.nav;
|
|
104
|
-
return /* @__PURE__ */ React.createElement("div", { ref, className: cx("aura-shell", compact && "is-compact", props.className) }, !compact ? /* @__PURE__ */ React.createElement("div", { className: "aura-shell__nav" }, nav) : null, compact ? /* @__PURE__ */ React.createElement(
|
|
105
|
-
Drawer,
|
|
106
|
-
{
|
|
107
|
-
open,
|
|
108
|
-
onClose: function() {
|
|
109
|
-
setOpen(false);
|
|
110
|
-
},
|
|
111
|
-
side: "left",
|
|
112
|
-
size: "nav",
|
|
113
|
-
"aria-label": props.navLabel || t.navigation,
|
|
114
|
-
dismissible: true
|
|
115
|
-
},
|
|
116
|
-
nav
|
|
117
|
-
) : null, /* @__PURE__ */ React.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React.createElement(
|
|
118
|
-
IconButton,
|
|
119
|
-
{
|
|
120
|
-
icon: "menu",
|
|
121
|
-
label: props.menuLabel || t.openNav,
|
|
122
|
-
size: "md",
|
|
123
|
-
onClick: function() {
|
|
124
|
-
setOpen(true);
|
|
125
|
-
},
|
|
126
|
-
"aria-expanded": open
|
|
127
|
-
}
|
|
128
|
-
) : null, /* @__PURE__ */ React.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)));
|
|
129
|
-
});
|
|
130
|
-
export {
|
|
131
|
-
AppShell,
|
|
132
|
-
Container,
|
|
133
|
-
Grid,
|
|
134
|
-
Stack,
|
|
135
|
-
breakpoints,
|
|
136
|
-
useBreakpoint,
|
|
137
|
-
useResponsive
|
|
138
|
-
};
|
|
File without changes
|