@uni-design-system/uni-react 8.3.0 → 8.4.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/CHANGELOG.md +12 -0
- package/README.md +26 -2
- package/dist/cjs/index.cjs +325 -33
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +326 -34
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/layout/box/box.component.d.ts +21 -0
- package/dist/types/components/layout/box/box.component.d.ts.map +1 -0
- package/dist/types/components/layout/box/box.stories.d.ts +11 -0
- package/dist/types/components/layout/box/box.stories.d.ts.map +1 -0
- package/dist/types/components/layout/box/box.styles.d.ts +79 -0
- package/dist/types/components/layout/box/box.styles.d.ts.map +1 -0
- package/dist/types/components/layout/box/index.d.ts +3 -0
- package/dist/types/components/layout/box/index.d.ts.map +1 -0
- package/dist/types/components/layout/center/center.component.d.ts +7 -0
- package/dist/types/components/layout/center/center.component.d.ts.map +1 -0
- package/dist/types/components/layout/center/center.stories.d.ts +7 -0
- package/dist/types/components/layout/center/center.stories.d.ts.map +1 -0
- package/dist/types/components/layout/center/index.d.ts +2 -0
- package/dist/types/components/layout/center/index.d.ts.map +1 -0
- package/dist/types/components/layout/grid/grid-area/grid-area.component.d.ts +11 -0
- package/dist/types/components/layout/grid/grid-area/grid-area.component.d.ts.map +1 -0
- package/dist/types/components/layout/grid/grid-area/index.d.ts +2 -0
- package/dist/types/components/layout/grid/grid-area/index.d.ts.map +1 -0
- package/dist/types/components/layout/grid/grid.component.d.ts +24 -0
- package/dist/types/components/layout/grid/grid.component.d.ts.map +1 -0
- package/dist/types/components/layout/grid/grid.stories.d.ts +7 -0
- package/dist/types/components/layout/grid/grid.stories.d.ts.map +1 -0
- package/dist/types/components/layout/grid/index.d.ts +3 -0
- package/dist/types/components/layout/grid/index.d.ts.map +1 -0
- package/dist/types/components/layout/index.d.ts +7 -0
- package/dist/types/components/layout/index.d.ts.map +1 -0
- package/dist/types/components/layout/layout.spec.d.ts +2 -0
- package/dist/types/components/layout/layout.spec.d.ts.map +1 -0
- package/dist/types/components/layout/row/index.d.ts +2 -0
- package/dist/types/components/layout/row/index.d.ts.map +1 -0
- package/dist/types/components/layout/row/row.component.d.ts +13 -0
- package/dist/types/components/layout/row/row.component.d.ts.map +1 -0
- package/dist/types/components/layout/row/row.stories.d.ts +7 -0
- package/dist/types/components/layout/row/row.stories.d.ts.map +1 -0
- package/dist/types/components/layout/stack/index.d.ts +2 -0
- package/dist/types/components/layout/stack/index.d.ts.map +1 -0
- package/dist/types/components/layout/stack/stack.component.d.ts +13 -0
- package/dist/types/components/layout/stack/stack.component.d.ts.map +1 -0
- package/dist/types/components/layout/stack/stack.stories.d.ts +7 -0
- package/dist/types/components/layout/stack/stack.stories.d.ts.map +1 -0
- package/dist/types/components/layout/wrap/index.d.ts +2 -0
- package/dist/types/components/layout/wrap/index.d.ts.map +1 -0
- package/dist/types/components/layout/wrap/wrap.component.d.ts +7 -0
- package/dist/types/components/layout/wrap/wrap.component.d.ts.map +1 -0
- package/dist/types/components/layout/wrap/wrap.stories.d.ts +7 -0
- package/dist/types/components/layout/wrap/wrap.stories.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/polymorphic/index.d.ts +2 -0
- package/dist/types/core/polymorphic/index.d.ts.map +1 -0
- package/dist/types/core/polymorphic/polymorphic.types.d.ts +27 -0
- package/dist/types/core/polymorphic/polymorphic.types.d.ts.map +1 -0
- package/dist/types/core/theme/index.d.ts +1 -0
- package/dist/types/core/theme/index.d.ts.map +1 -1
- package/dist/types/core/theme/theme.styles.d.ts +52 -0
- package/dist/types/core/theme/theme.styles.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/number.helper.d.ts +2 -0
- package/dist/types/utils/number.helper.d.ts.map +1 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @uni-design-system/uni-react
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`82d1341`](https://github.com/uni-design-system/uni/commit/82d134169997abc2a0f6261e248548e5b3240dcb) Thanks [@gaenglish](https://github.com/gaenglish)! - React layout primitives, at parity with Angular: `Box`, `Stack`, `Row`, `Center`, `Wrap`, `Grid` and `GridArea`. Angular applies layout as an attribute so the element's semantics stay the author's (`<main box-layout>`); React's equivalent is the polymorphic `as` prop — `<Box as="main" padding="md">` — with refs and DOM props forwarded to whatever element it renders.
|
|
8
|
+
|
|
9
|
+
Props, defaults and resolution order are ported one-for-one from `UniBoxComponent`, so the same tokens produce the same CSS in both frameworks: token-driven color pairs, padding, radius, border, shadow, gap and z-index; a number is px and a string is a CSS length for every sizing prop; `dashBorder` draws the SVG dashed outline; `ignoreDir` (default on) still flips flex direction under `dir="rtl"`. `Stack` keeps its `minHeight: fit-content` guard and `Row` its `minWidth: fit-content` — set `minHeight={0}` / `minWidth={0}` to shrink inside a constrained flex parent.
|
|
10
|
+
|
|
11
|
+
Supporting this: `createThemeStyles`/`useThemeStyles` — the React port of the Angular `ThemeService` token → CSS resolvers, method-for-method — and `@emotion/css` (new peer dependency, matching the Angular package) so pseudo-selectors like `:dir(rtl)` resolve in a real class rather than an inline style. A Box that paints a container color now also provides that token to its descendants, so `Text` inside it picks up the matching on-color.
|
|
12
|
+
|
|
13
|
+
## 8.3.1
|
|
14
|
+
|
|
3
15
|
## 8.3.0
|
|
4
16
|
|
|
5
17
|
## 8.2.0
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ The official **React** implementation of the Uni Design System. This library fea
|
|
|
19
19
|
## 📦 Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install @uni-design-system/uni-react @uni-design-system/uni-core
|
|
22
|
+
npm install @uni-design-system/uni-react @uni-design-system/uni-core @emotion/css
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## 🏁 Getting Started
|
|
@@ -39,11 +39,35 @@ export const MyComponent = () => {
|
|
|
39
39
|
};
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## 🧱 Layout
|
|
43
|
+
|
|
44
|
+
Layout is composed from one primitive. `Box` renders any element you name, so the
|
|
45
|
+
semantics stay yours, and `Stack`, `Row`, `Center`, `Wrap` and `Grid` are the same
|
|
46
|
+
Box with presets. Spacing, radius, border, shadow and color props take theme
|
|
47
|
+
tokens; sizing props take a number (px) or a CSS length string.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Grid, GridArea, Row, Stack } from '@uni-design-system/uni-react';
|
|
51
|
+
|
|
52
|
+
<Stack as="main" gap="lg" padding="lg">
|
|
53
|
+
<Row gap="md" justifyContent="space-between">
|
|
54
|
+
<Text role="headline-large">Projects</Text>
|
|
55
|
+
<Button text="New project" />
|
|
56
|
+
</Row>
|
|
57
|
+
|
|
58
|
+
<Grid templateColumns="repeat(3, 1fr)" gap="md">
|
|
59
|
+
<GridArea area="summary" color="surface-variant" padding="md" borderRadius="md">
|
|
60
|
+
<Text>Summary</Text>
|
|
61
|
+
</GridArea>
|
|
62
|
+
</Grid>
|
|
63
|
+
</Stack>;
|
|
64
|
+
```
|
|
65
|
+
|
|
42
66
|
## 🛠️ Architecture Profile
|
|
43
67
|
|
|
44
68
|
- **Framework Support:** React `>=18`
|
|
45
69
|
- **Pre-bundled Internals:** Complex third-party layout engines (like `@dnd-kit` and `framer-motion`) are completely compiled _inside_ this package to simplify your build trees.
|
|
46
|
-
- **Peer Dependencies:** React
|
|
70
|
+
- **Peer Dependencies:** React, `@uni-design-system/uni-core` and `@emotion/css` are kept external to maintain minimal, lightweight bundle weights.
|
|
47
71
|
|
|
48
72
|
```
|
|
49
73
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require$$0 = require("react");
|
|
4
4
|
const uniCore = require("@uni-design-system/uni-core");
|
|
5
5
|
const reactDom = require("react-dom");
|
|
6
|
+
const css = require("@emotion/css");
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
9
|
if (e) {
|
|
@@ -6429,6 +6430,105 @@ function withTheme(Component) {
|
|
|
6429
6430
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...props, theme });
|
|
6430
6431
|
};
|
|
6431
6432
|
}
|
|
6433
|
+
const createLocalStorageManager = (key2) => ({
|
|
6434
|
+
type: "localStorage",
|
|
6435
|
+
get(init) {
|
|
6436
|
+
if (!globalThis?.document) return init;
|
|
6437
|
+
let value;
|
|
6438
|
+
try {
|
|
6439
|
+
value = localStorage.getItem(key2) || init;
|
|
6440
|
+
} catch {
|
|
6441
|
+
}
|
|
6442
|
+
return JSON.parse(value) || init;
|
|
6443
|
+
},
|
|
6444
|
+
set(value) {
|
|
6445
|
+
try {
|
|
6446
|
+
localStorage.setItem(key2, JSON.stringify(value));
|
|
6447
|
+
} catch {
|
|
6448
|
+
}
|
|
6449
|
+
}
|
|
6450
|
+
});
|
|
6451
|
+
const parseCookie = (cookie, key2) => {
|
|
6452
|
+
const match = cookie.match(new RegExp(`(^| )${key2}=([^;]+)`));
|
|
6453
|
+
return match?.[2];
|
|
6454
|
+
};
|
|
6455
|
+
const createCookieStorageManager = (key2, cookie) => ({
|
|
6456
|
+
type: "cookie",
|
|
6457
|
+
get(init) {
|
|
6458
|
+
if (cookie) return parseCookie(cookie, key2);
|
|
6459
|
+
if (!globalThis?.document) return init;
|
|
6460
|
+
return parseCookie(document.cookie, key2) || init;
|
|
6461
|
+
},
|
|
6462
|
+
set(value) {
|
|
6463
|
+
document.cookie = `${key2}=${value}; max-age=31536000; path=/`;
|
|
6464
|
+
}
|
|
6465
|
+
});
|
|
6466
|
+
const safeParseInt = (n) => typeof n === "number" ? n : parseInt(n);
|
|
6467
|
+
function createThemeStyles(theme) {
|
|
6468
|
+
const colors = theme.colors;
|
|
6469
|
+
const spacing = theme.spacing;
|
|
6470
|
+
const radii = theme.radii;
|
|
6471
|
+
const borders = theme.borders;
|
|
6472
|
+
const shadows = theme.shadows;
|
|
6473
|
+
const thicknesses = theme.thicknesses;
|
|
6474
|
+
const getContentColor = (token, useVariant) => useVariant ? colors[`on-${token}-variant`] : colors[`on-${token}`];
|
|
6475
|
+
return {
|
|
6476
|
+
theme,
|
|
6477
|
+
colors,
|
|
6478
|
+
colorPalette: () => colors,
|
|
6479
|
+
getSpacing: (size) => size === "none" ? "none" : spacing[size],
|
|
6480
|
+
getThickness: (thickness) => thicknesses[thickness],
|
|
6481
|
+
getContentColor,
|
|
6482
|
+
/** Background + matching on-color for a container token, as one pair. */
|
|
6483
|
+
colorPair: (token, colorVariant) => {
|
|
6484
|
+
if (!token) return void 0;
|
|
6485
|
+
return { color: getContentColor(token, colorVariant), backgroundColor: colors[token] };
|
|
6486
|
+
},
|
|
6487
|
+
color: (color2) => !color2 ? void 0 : { color: colors[color2] },
|
|
6488
|
+
backgroundColor: (token) => !token ? void 0 : { backgroundColor: colors[token] },
|
|
6489
|
+
backgroundImage: (url) => !url ? void 0 : { backgroundImage: `url(${url})` },
|
|
6490
|
+
borderColor: (borderColor) => ({
|
|
6491
|
+
borderColor: colors[borderColor]
|
|
6492
|
+
}),
|
|
6493
|
+
/** An SVG-drawn dashed outline — CSS `dashed` cannot control dash length. */
|
|
6494
|
+
getDashedBorder: (color2, radius) => {
|
|
6495
|
+
if (!color2) return void 0;
|
|
6496
|
+
const r = radius && radii[radius];
|
|
6497
|
+
const borderRadius = r ? safeParseInt(r) : 0;
|
|
6498
|
+
const strokeColor = colors[color2]?.replace("#", "%23");
|
|
6499
|
+
return {
|
|
6500
|
+
backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${borderRadius}' ry='${borderRadius}' stroke='${strokeColor}' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e")`,
|
|
6501
|
+
borderRadius
|
|
6502
|
+
};
|
|
6503
|
+
},
|
|
6504
|
+
radius: (size) => !size ? void 0 : { borderRadius: radii[size] },
|
|
6505
|
+
getRadiusLeft: (size) => !size ? void 0 : { borderBottomLeftRadius: radii[size], borderTopLeftRadius: radii[size] },
|
|
6506
|
+
getRadiusRight: (size) => !size ? void 0 : { borderBottomRightRadius: radii[size], borderTopRightRadius: radii[size] },
|
|
6507
|
+
getRadiusTop: (size) => !size ? void 0 : { borderTopLeftRadius: radii[size], borderTopRightRadius: radii[size] },
|
|
6508
|
+
getRadiusBottom: (size) => !size ? void 0 : { borderBottomLeftRadius: radii[size], borderBottomRightRadius: radii[size] },
|
|
6509
|
+
padding: (size) => !size ? void 0 : { padding: spacing[size] },
|
|
6510
|
+
horizontalPadding: (size) => !size ? void 0 : { paddingInline: spacing[size] },
|
|
6511
|
+
verticalPadding: (size) => !size ? void 0 : { paddingBlock: spacing[size] },
|
|
6512
|
+
paddingLeft: (size) => !size ? void 0 : { paddingLeft: spacing[size] },
|
|
6513
|
+
paddingRight: (size) => !size ? void 0 : { paddingRight: spacing[size] },
|
|
6514
|
+
paddingTop: (size) => !size ? void 0 : { paddingTop: spacing[size] },
|
|
6515
|
+
paddingBottom: (size) => !size ? void 0 : { paddingBottom: spacing[size] },
|
|
6516
|
+
border: (border) => !border ? void 0 : { border: borders[border] },
|
|
6517
|
+
borderTop: (border) => !border ? void 0 : { borderTop: borders[border] },
|
|
6518
|
+
borderBottom: (border) => !border ? void 0 : { borderBottom: borders[border] },
|
|
6519
|
+
borderLeft: (border) => !border ? void 0 : { borderLeft: borders[border] },
|
|
6520
|
+
borderRight: (border) => !border ? void 0 : { borderRight: borders[border] },
|
|
6521
|
+
boxShadow: (shadow) => !shadow ? void 0 : { boxShadow: shadows[shadow] },
|
|
6522
|
+
gap: (gap) => !gap || gap === "none" ? void 0 : { gap: spacing[gap] },
|
|
6523
|
+
zIndex: (element) => !element ? void 0 : { zIndex: uniCore.Z_INDEX[element] },
|
|
6524
|
+
/** One property, dropped when the value is absent (or falsy, as in Angular). */
|
|
6525
|
+
style: (prop, value) => !value ? void 0 : { [prop]: value }
|
|
6526
|
+
};
|
|
6527
|
+
}
|
|
6528
|
+
function useThemeStyles() {
|
|
6529
|
+
const theme = useTheme();
|
|
6530
|
+
return require$$0.useMemo(() => createThemeStyles(theme), [theme]);
|
|
6531
|
+
}
|
|
6432
6532
|
function Icon({ name, color: color2 = "on-surface", height = 24, width = 24 }) {
|
|
6433
6533
|
if (!name) return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
6434
6534
|
const { colors } = useTheme();
|
|
@@ -19611,6 +19711,217 @@ const SortableList = ({
|
|
|
19611
19711
|
const TextInput = ({ value, onChange }) => {
|
|
19612
19712
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "text", value, onChange }) });
|
|
19613
19713
|
};
|
|
19714
|
+
const BOX_STYLE_PROP_KEYS = [
|
|
19715
|
+
"color",
|
|
19716
|
+
"backgroundColor",
|
|
19717
|
+
"borderRadius",
|
|
19718
|
+
"borderRadiusLeft",
|
|
19719
|
+
"borderRadiusRight",
|
|
19720
|
+
"borderRadiusTop",
|
|
19721
|
+
"borderRadiusBottom",
|
|
19722
|
+
"padding",
|
|
19723
|
+
"paddingHorizontal",
|
|
19724
|
+
"paddingVertical",
|
|
19725
|
+
"paddingLeft",
|
|
19726
|
+
"paddingRight",
|
|
19727
|
+
"paddingTop",
|
|
19728
|
+
"paddingBottom",
|
|
19729
|
+
"border",
|
|
19730
|
+
"borderTop",
|
|
19731
|
+
"borderBottom",
|
|
19732
|
+
"borderLeft",
|
|
19733
|
+
"borderRight",
|
|
19734
|
+
"dashBorder",
|
|
19735
|
+
"alignSelf",
|
|
19736
|
+
"alignItems",
|
|
19737
|
+
"alignContent",
|
|
19738
|
+
"justifyContent",
|
|
19739
|
+
"grow",
|
|
19740
|
+
"display",
|
|
19741
|
+
"position",
|
|
19742
|
+
"inset",
|
|
19743
|
+
"height",
|
|
19744
|
+
"minHeight",
|
|
19745
|
+
"maxHeight",
|
|
19746
|
+
"width",
|
|
19747
|
+
"minWidth",
|
|
19748
|
+
"maxWidth",
|
|
19749
|
+
"ignoreDir",
|
|
19750
|
+
"gridArea",
|
|
19751
|
+
"gridColumn",
|
|
19752
|
+
"gridRow",
|
|
19753
|
+
"overflow",
|
|
19754
|
+
"elevation",
|
|
19755
|
+
"shadow",
|
|
19756
|
+
"gap",
|
|
19757
|
+
"fullWidth",
|
|
19758
|
+
"fullHeight",
|
|
19759
|
+
"flexDirection",
|
|
19760
|
+
"textAlign",
|
|
19761
|
+
"wrapItems",
|
|
19762
|
+
"zIndex"
|
|
19763
|
+
];
|
|
19764
|
+
const STYLE_PROP_SET = new Set(BOX_STYLE_PROP_KEYS);
|
|
19765
|
+
function splitBoxProps(props) {
|
|
19766
|
+
const styleProps = {};
|
|
19767
|
+
const rest = {};
|
|
19768
|
+
for (const key2 of Object.keys(props)) {
|
|
19769
|
+
const target = STYLE_PROP_SET.has(key2) ? styleProps : rest;
|
|
19770
|
+
target[key2] = props[key2];
|
|
19771
|
+
}
|
|
19772
|
+
return [styleProps, rest];
|
|
19773
|
+
}
|
|
19774
|
+
function boxClassName(props, styles) {
|
|
19775
|
+
const { border, dashBorder = false, ignoreDir = true, flexDirection } = props;
|
|
19776
|
+
return css.css([
|
|
19777
|
+
{
|
|
19778
|
+
...styles.colorPair(props.color),
|
|
19779
|
+
...styles.backgroundColor(props.backgroundColor),
|
|
19780
|
+
display: props.alignSelf ? "flex" : "block",
|
|
19781
|
+
position: props.position,
|
|
19782
|
+
inset: props.inset,
|
|
19783
|
+
boxSizing: "border-box",
|
|
19784
|
+
height: props.height,
|
|
19785
|
+
minHeight: props.minHeight,
|
|
19786
|
+
maxHeight: props.maxHeight,
|
|
19787
|
+
width: props.width,
|
|
19788
|
+
minWidth: props.minWidth,
|
|
19789
|
+
maxWidth: props.maxWidth,
|
|
19790
|
+
flexWrap: props.wrapItems,
|
|
19791
|
+
overflow: props.overflow,
|
|
19792
|
+
...styles.padding(props.padding),
|
|
19793
|
+
...styles.horizontalPadding(props.paddingHorizontal),
|
|
19794
|
+
...styles.verticalPadding(props.paddingVertical),
|
|
19795
|
+
...styles.paddingLeft(props.paddingLeft),
|
|
19796
|
+
...styles.paddingRight(props.paddingRight),
|
|
19797
|
+
...styles.paddingTop(props.paddingTop),
|
|
19798
|
+
...styles.paddingBottom(props.paddingBottom),
|
|
19799
|
+
...styles.boxShadow(props.elevation),
|
|
19800
|
+
...styles.boxShadow(props.shadow),
|
|
19801
|
+
...styles.radius(props.borderRadius),
|
|
19802
|
+
...styles.getRadiusLeft(props.borderRadiusLeft),
|
|
19803
|
+
...styles.getRadiusRight(props.borderRadiusRight),
|
|
19804
|
+
...styles.getRadiusTop(props.borderRadiusTop),
|
|
19805
|
+
...styles.getRadiusBottom(props.borderRadiusBottom),
|
|
19806
|
+
...styles.borderTop(props.borderTop),
|
|
19807
|
+
...styles.borderBottom(props.borderBottom),
|
|
19808
|
+
...styles.borderLeft(props.borderLeft),
|
|
19809
|
+
...styles.borderRight(props.borderRight),
|
|
19810
|
+
...styles.gap(props.gap),
|
|
19811
|
+
...styles.style("display", props.display),
|
|
19812
|
+
...styles.style("alignSelf", props.alignSelf),
|
|
19813
|
+
...styles.style("alignItems", props.alignItems),
|
|
19814
|
+
...styles.style("justifyContent", props.justifyContent),
|
|
19815
|
+
...styles.style("alignContent", props.alignContent),
|
|
19816
|
+
...styles.style("flexGrow", props.grow),
|
|
19817
|
+
...styles.style("flexDirection", props.flexDirection),
|
|
19818
|
+
...styles.style("gridArea", props.gridArea),
|
|
19819
|
+
...styles.style("gridColumn", props.gridColumn),
|
|
19820
|
+
...styles.style("gridRow", props.gridRow),
|
|
19821
|
+
...styles.style("textAlign", props.textAlign),
|
|
19822
|
+
...styles.zIndex(props.zIndex)
|
|
19823
|
+
},
|
|
19824
|
+
border && !dashBorder && { ...styles.border(border) },
|
|
19825
|
+
border && dashBorder && { ...styles.getDashedBorder(border, props.borderRadius) },
|
|
19826
|
+
props.fullWidth && { width: "100%" },
|
|
19827
|
+
props.fullHeight && { height: "100%" },
|
|
19828
|
+
ignoreDir && (flexDirection ?? "row") === "row" && {
|
|
19829
|
+
"&:dir(rtl)": { flexDirection: "row-reverse" }
|
|
19830
|
+
},
|
|
19831
|
+
ignoreDir && (flexDirection ?? "row") === "row-reverse" && {
|
|
19832
|
+
"&:dir(rtl)": { flexDirection: "row" }
|
|
19833
|
+
}
|
|
19834
|
+
]);
|
|
19835
|
+
}
|
|
19836
|
+
function useBoxClassName(props) {
|
|
19837
|
+
const styles = useThemeStyles();
|
|
19838
|
+
return boxClassName(props, styles);
|
|
19839
|
+
}
|
|
19840
|
+
const Box = require$$0.forwardRef(function Box2({ as, className: className2, children, ...props }, ref) {
|
|
19841
|
+
const Component = as || "div";
|
|
19842
|
+
const [styleProps, rest] = splitBoxProps(props);
|
|
19843
|
+
const boxClass = useBoxClassName(styleProps);
|
|
19844
|
+
const element = /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ref, className: css.cx(boxClass, className2), ...rest, children });
|
|
19845
|
+
return styleProps.color ? /* @__PURE__ */ jsxRuntimeExports.jsx(ContainerContext.Provider, { value: { colorToken: styleProps.color }, children: element }) : element;
|
|
19846
|
+
});
|
|
19847
|
+
Box.displayName = "Box";
|
|
19848
|
+
const Center = require$$0.forwardRef(function Center2(props, ref) {
|
|
19849
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19850
|
+
Box,
|
|
19851
|
+
{
|
|
19852
|
+
display: "flex",
|
|
19853
|
+
justifyContent: "center",
|
|
19854
|
+
alignItems: "center",
|
|
19855
|
+
...props,
|
|
19856
|
+
ref
|
|
19857
|
+
}
|
|
19858
|
+
);
|
|
19859
|
+
});
|
|
19860
|
+
Center.displayName = "Center";
|
|
19861
|
+
const Grid = require$$0.forwardRef(function Grid2(props, ref) {
|
|
19862
|
+
const {
|
|
19863
|
+
templateAreas,
|
|
19864
|
+
templateColumns,
|
|
19865
|
+
templateRows,
|
|
19866
|
+
outline,
|
|
19867
|
+
outlineColor,
|
|
19868
|
+
className: className2,
|
|
19869
|
+
...boxProps
|
|
19870
|
+
} = props;
|
|
19871
|
+
const styles = useThemeStyles();
|
|
19872
|
+
const gridClass = css.css([
|
|
19873
|
+
templateAreas && { gridTemplateAreas: templateAreas },
|
|
19874
|
+
templateColumns && { gridTemplateColumns: templateColumns },
|
|
19875
|
+
templateRows && { gridTemplateRows: templateRows },
|
|
19876
|
+
outline && { gap: styles.getThickness(outline) },
|
|
19877
|
+
outlineColor && { backgroundColor: styles.colorPalette()[outlineColor] }
|
|
19878
|
+
]);
|
|
19879
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19880
|
+
Box,
|
|
19881
|
+
{
|
|
19882
|
+
display: "grid",
|
|
19883
|
+
...boxProps,
|
|
19884
|
+
className: css.cx(gridClass, className2),
|
|
19885
|
+
ref
|
|
19886
|
+
}
|
|
19887
|
+
);
|
|
19888
|
+
});
|
|
19889
|
+
Grid.displayName = "Grid";
|
|
19890
|
+
const GridArea = require$$0.forwardRef(function GridArea2(props, ref) {
|
|
19891
|
+
const { area, ...boxProps } = props;
|
|
19892
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { gridArea: area, ...boxProps, ref });
|
|
19893
|
+
});
|
|
19894
|
+
GridArea.displayName = "GridArea";
|
|
19895
|
+
const Row = require$$0.forwardRef(function Row2(props, ref) {
|
|
19896
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19897
|
+
Box,
|
|
19898
|
+
{
|
|
19899
|
+
display: "flex",
|
|
19900
|
+
flexDirection: "row",
|
|
19901
|
+
minWidth: "fit-content",
|
|
19902
|
+
...props,
|
|
19903
|
+
ref
|
|
19904
|
+
}
|
|
19905
|
+
);
|
|
19906
|
+
});
|
|
19907
|
+
Row.displayName = "Row";
|
|
19908
|
+
const Stack = require$$0.forwardRef(function Stack2(props, ref) {
|
|
19909
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19910
|
+
Box,
|
|
19911
|
+
{
|
|
19912
|
+
display: "flex",
|
|
19913
|
+
flexDirection: "column",
|
|
19914
|
+
minHeight: "fit-content",
|
|
19915
|
+
...props,
|
|
19916
|
+
ref
|
|
19917
|
+
}
|
|
19918
|
+
);
|
|
19919
|
+
});
|
|
19920
|
+
Stack.displayName = "Stack";
|
|
19921
|
+
const Wrap = require$$0.forwardRef(function Wrap2(props, ref) {
|
|
19922
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", wrapItems: "wrap", ...props, ref });
|
|
19923
|
+
});
|
|
19924
|
+
Wrap.displayName = "Wrap";
|
|
19614
19925
|
const ModalSizes = {
|
|
19615
19926
|
sm: 260,
|
|
19616
19927
|
md: 320,
|
|
@@ -19696,44 +20007,14 @@ const Switch = ({ size = "sm", on = false, onChange }) => {
|
|
|
19696
20007
|
};
|
|
19697
20008
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: switchStyle, className: "switch", "data-isOn": isOn, onClick: toggleSwitch, children: /* @__PURE__ */ jsxRuntimeExports.jsx(motion.div, { style: handleStyle, className: "handle", layout: true, transition: spring2 }) });
|
|
19698
20009
|
};
|
|
19699
|
-
|
|
19700
|
-
type: "localStorage",
|
|
19701
|
-
get(init) {
|
|
19702
|
-
if (!globalThis?.document) return init;
|
|
19703
|
-
let value;
|
|
19704
|
-
try {
|
|
19705
|
-
value = localStorage.getItem(key2) || init;
|
|
19706
|
-
} catch {
|
|
19707
|
-
}
|
|
19708
|
-
return JSON.parse(value) || init;
|
|
19709
|
-
},
|
|
19710
|
-
set(value) {
|
|
19711
|
-
try {
|
|
19712
|
-
localStorage.setItem(key2, JSON.stringify(value));
|
|
19713
|
-
} catch {
|
|
19714
|
-
}
|
|
19715
|
-
}
|
|
19716
|
-
});
|
|
19717
|
-
const parseCookie = (cookie, key2) => {
|
|
19718
|
-
const match = cookie.match(new RegExp(`(^| )${key2}=([^;]+)`));
|
|
19719
|
-
return match?.[2];
|
|
19720
|
-
};
|
|
19721
|
-
const createCookieStorageManager = (key2, cookie) => ({
|
|
19722
|
-
type: "cookie",
|
|
19723
|
-
get(init) {
|
|
19724
|
-
if (cookie) return parseCookie(cookie, key2);
|
|
19725
|
-
if (!globalThis?.document) return init;
|
|
19726
|
-
return parseCookie(document.cookie, key2) || init;
|
|
19727
|
-
},
|
|
19728
|
-
set(value) {
|
|
19729
|
-
document.cookie = `${key2}=${value}; max-age=31536000; path=/`;
|
|
19730
|
-
}
|
|
19731
|
-
});
|
|
20010
|
+
exports.BOX_STYLE_PROP_KEYS = BOX_STYLE_PROP_KEYS;
|
|
19732
20011
|
exports.Background = Background;
|
|
19733
20012
|
exports.BorderStyle = BorderStyle;
|
|
20013
|
+
exports.Box = Box;
|
|
19734
20014
|
exports.BoxShadow = BoxShadow;
|
|
19735
20015
|
exports.Button = Button;
|
|
19736
20016
|
exports.Card = Card;
|
|
20017
|
+
exports.Center = Center;
|
|
19737
20018
|
exports.Collapse = Collapse;
|
|
19738
20019
|
exports.ContainerContext = ContainerContext;
|
|
19739
20020
|
exports.DragHandle = DragHandle;
|
|
@@ -19741,6 +20022,8 @@ exports.Fade = Fade;
|
|
|
19741
20022
|
exports.Flex = Flex;
|
|
19742
20023
|
exports.FlexHorizontalAlignments = FlexHorizontalAlignments;
|
|
19743
20024
|
exports.FlexVerticalAlignments = FlexVerticalAlignments;
|
|
20025
|
+
exports.Grid = Grid;
|
|
20026
|
+
exports.GridArea = GridArea;
|
|
19744
20027
|
exports.Icon = Icon;
|
|
19745
20028
|
exports.IconDictionary = srcExports.IconDictionary;
|
|
19746
20029
|
exports.IconKeys = srcExports.IconKeys;
|
|
@@ -19750,20 +20033,25 @@ exports.LayoutProvider = LayoutProvider;
|
|
|
19750
20033
|
exports.Modal = Modal;
|
|
19751
20034
|
exports.Overlay = Overlay;
|
|
19752
20035
|
exports.Padding = Padding;
|
|
20036
|
+
exports.Row = Row;
|
|
19753
20037
|
exports.Slide = Slide;
|
|
19754
20038
|
exports.SortableItem = SortableItem;
|
|
19755
20039
|
exports.SortableList = SortableList;
|
|
19756
20040
|
exports.SortableOverlay = SortableOverlay;
|
|
20041
|
+
exports.Stack = Stack;
|
|
19757
20042
|
exports.Switch = Switch;
|
|
19758
20043
|
exports.Text = Text;
|
|
19759
20044
|
exports.TextInput = TextInput;
|
|
19760
20045
|
exports.ThemeProvider = ThemeProvider;
|
|
20046
|
+
exports.Wrap = Wrap;
|
|
19761
20047
|
exports.alignBottom = alignBottom;
|
|
19762
20048
|
exports.alignCenter = alignCenter;
|
|
19763
20049
|
exports.alignTop = alignTop;
|
|
20050
|
+
exports.boxClassName = boxClassName;
|
|
19764
20051
|
exports.column = column;
|
|
19765
20052
|
exports.createCookieStorageManager = createCookieStorageManager;
|
|
19766
20053
|
exports.createLocalStorageManager = createLocalStorageManager;
|
|
20054
|
+
exports.createThemeStyles = createThemeStyles;
|
|
19767
20055
|
exports.expand = expand;
|
|
19768
20056
|
exports.fadeConfig = fadeConfig;
|
|
19769
20057
|
exports.fix = fix;
|
|
@@ -19783,11 +20071,15 @@ exports.justifyRight = justifyRight;
|
|
|
19783
20071
|
exports.row = row;
|
|
19784
20072
|
exports.rowFixedItem = rowFixedItem;
|
|
19785
20073
|
exports.rowFlexItem = rowFlexItem;
|
|
20074
|
+
exports.safeParseInt = safeParseInt;
|
|
19786
20075
|
exports.spaceBetween = spaceBetween;
|
|
19787
20076
|
exports.spaceEvenly = spaceEvenly;
|
|
20077
|
+
exports.splitBoxProps = splitBoxProps;
|
|
20078
|
+
exports.useBoxClassName = useBoxClassName;
|
|
19788
20079
|
exports.useLayout = useLayout;
|
|
19789
20080
|
exports.useMedia = useMedia;
|
|
19790
20081
|
exports.useTheme = useTheme;
|
|
20082
|
+
exports.useThemeStyles = useThemeStyles;
|
|
19791
20083
|
exports.useToggle = useToggle;
|
|
19792
20084
|
exports.withTheme = withTheme;
|
|
19793
20085
|
//# sourceMappingURL=index.cjs.map
|