@warmio/ui 1.5.2 → 2.0.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 +18 -13
- package/dist/badge.js +2 -2
- package/dist/button.js +4 -1
- package/dist/chunks/chunk-A2PN77YE.js +42 -0
- package/dist/chunks/{chunk-F74Y4WRX.js → chunk-DHV2A22F.js} +14 -13
- package/dist/chunks/chunk-DOOSH3V6.js +72 -0
- package/dist/chunks/chunk-EIEA5RJJ.js +97 -0
- package/dist/chunks/{chunk-HQTC542T.js → chunk-FKGHMPVW.js} +141 -345
- package/dist/chunks/{chunk-JXSJTIX7.js → chunk-K36HD5J5.js} +4 -4
- package/dist/chunks/{chunk-GY4XJ6EX.js → chunk-L6L3GVGM.js} +2 -1
- package/dist/chunks/{chunk-2CO2BZLI.js → chunk-MGX6ZL6Q.js} +9 -53
- package/dist/chunks/{chunk-B47G2BJV.js → chunk-MVUHHKBL.js} +37 -79
- package/dist/chunks/chunk-PJUNSOJK.js +116 -0
- package/dist/chunks/chunk-RVVHR7RY.js +0 -0
- package/dist/chunks/chunk-U7D32UN3.js +0 -0
- package/dist/chunks/chunk-W24JGQWM.js +65 -0
- package/dist/dropdown-menu.js +4 -5
- package/dist/entries/badge.css +178 -0
- package/dist/entries/button.css +422 -0
- package/dist/entries/dropdown-menu.css +167 -0
- package/dist/entries/index.css +2789 -0
- package/dist/entries/logo.css +147 -0
- package/dist/entries/product-header.css +88 -0
- package/dist/entries/sheet.css +666 -0
- package/dist/entries/sidebar.css +2108 -0
- package/dist/entries/text.css +97 -0
- package/dist/index.js +17 -15
- package/dist/logo.js +2 -2
- package/dist/product-header.js +2 -2
- package/dist/sheet.js +5 -4
- package/dist/sidebar.css +129 -0
- package/dist/sidebar.js +7 -5
- package/dist/text.css +121 -0
- package/dist/text.js +2 -2
- package/package.json +12 -4
- package/types/button.d.ts +65 -9
- package/types/sidebar.d.ts +9 -2
- package/types/text.d.ts +8 -2
- package/dist/chunks/chunk-3AVFUXCV.js +0 -76
- package/dist/chunks/chunk-6V6K5G72.js +0 -80
- package/dist/chunks/chunk-A2NLFM6R.js +0 -227
- package/dist/chunks/chunk-IK5RHPN3.js +0 -93
- package/dist/chunks/chunk-OU7YQUU2.js +0 -84
- package/dist/chunks/chunk-VIB7OX7D.js +0 -10
package/README.md
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
# `@warmio/ui`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
the
|
|
3
|
+
The next package version is `@warmio/ui@2.0.0` with the exact
|
|
4
|
+
`@warmio/design@2.0.0` CSS/primitive contract. Import `@warmio/design/globals.css` once.
|
|
5
|
+
If you use the responsive Sidebar, also import `@warmio/ui/sidebar.css` once.
|
|
6
|
+
Component entrypoints import their compiled CSS. Existing consumers can still import
|
|
7
|
+
`@warmio/ui/text.css` for the shared Text and StackedDisplay recipes; that explicit import
|
|
8
|
+
is optional when your bundler handles CSS imports from JavaScript.
|
|
9
|
+
`Text` allows `size="large"` on `variant="body"` for the approved 18px body size; heading
|
|
10
|
+
text may use the existing 24px display size. Other text roles use their recipe size.
|
|
11
|
+
Add the package's compiled files to Tailwind's source detection:
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
@import '@warmio/design/globals.css';
|
|
15
|
+
@import '@warmio/ui/sidebar.css';
|
|
16
|
+
@import '@warmio/ui/text.css';
|
|
17
|
+
@source '../node_modules/@warmio/ui/dist';
|
|
18
|
+
```
|
|
6
19
|
|
|
7
20
|
## Why these files are separate
|
|
8
21
|
|
|
@@ -10,18 +23,10 @@ Independently deployed Warm products cannot import runtime code from the private
|
|
|
10
23
|
workspace, so `libraries/public-ui/` must be a standalone public package rather than another private
|
|
11
24
|
workspace entry point. `tools/tasks/check-ui-package.mjs` is a dedicated package-boundary check
|
|
12
25
|
because the existing application checks do not build, pack, and inspect a public npm tarball.
|
|
13
|
-
`.github/workflows/publish-ui.yml` is separate from application deployment workflows so npm trusted
|
|
14
|
-
publishing can bind credentials to one reviewable package-release boundary without granting an app
|
|
15
|
-
deployment permission to publish packages.
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
@import '@warmio/design/globals.css';
|
|
19
|
-
@source '../node_modules/@warmio/ui/dist';
|
|
20
|
-
```
|
|
21
26
|
|
|
22
|
-
The `
|
|
27
|
+
The `2.0.0` public UI surface keeps the Warm badge, Text and `StackedDisplay`, DropdownMenu,
|
|
23
28
|
Sheet, the complete responsive Sidebar family, and the `ProductHeader` composition. `Button`,
|
|
24
|
-
`ButtonLink`, `Logo`, and `WarmLogoIcon` are directly owned by `@warmio/design@
|
|
29
|
+
`ButtonLink`, `Logo`, and `WarmLogoIcon` are directly owned by `@warmio/design@2.0.0` and are
|
|
25
30
|
re-exported through UI where applicable. `ProductHeader` owns the responsive frame,
|
|
26
31
|
breadcrumb/title semantics, leading slot, action slot, and optional portal targets used by Warm
|
|
27
32
|
product shells. Styling is sealed: use documented semantic properties and layout wrappers, never
|
package/dist/badge.js
CHANGED
package/dist/button.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// ../ui/src/warmio/badge/badge.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function Badge({
|
|
4
|
+
tone,
|
|
5
|
+
size = "default",
|
|
6
|
+
textSize = "caption",
|
|
7
|
+
shape = "pill",
|
|
8
|
+
surface = "default",
|
|
9
|
+
placement = "inline",
|
|
10
|
+
emphasis = "subtle",
|
|
11
|
+
width = "auto",
|
|
12
|
+
truncate = false,
|
|
13
|
+
numeric = false,
|
|
14
|
+
children,
|
|
15
|
+
id,
|
|
16
|
+
"aria-label": ariaLabel
|
|
17
|
+
}) {
|
|
18
|
+
const resolvedTone = tone ?? "default";
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"span",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "badge",
|
|
23
|
+
"data-tone": resolvedTone,
|
|
24
|
+
"data-shape": shape,
|
|
25
|
+
"data-surface": surface,
|
|
26
|
+
"data-placement": placement,
|
|
27
|
+
"data-size": size,
|
|
28
|
+
"data-text-size": textSize,
|
|
29
|
+
"data-emphasis": emphasis,
|
|
30
|
+
"data-width": width,
|
|
31
|
+
"data-truncate": truncate ? "true" : void 0,
|
|
32
|
+
"data-numeric": numeric ? "true" : void 0,
|
|
33
|
+
id,
|
|
34
|
+
"aria-label": ariaLabel,
|
|
35
|
+
children: truncate ? /* @__PURE__ */ jsx("span", { "data-slot": "badge-label", children }) : children
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Badge
|
|
42
|
+
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FLUID_SPRING,
|
|
3
3
|
useReducedMotion
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
cn
|
|
7
|
-
} from "./chunk-VIB7OX7D.js";
|
|
4
|
+
} from "./chunk-K36HD5J5.js";
|
|
8
5
|
|
|
9
6
|
// ../ui/src/lib/fluid-menu-highlight.tsx
|
|
10
7
|
import * as React from "react";
|
|
@@ -22,6 +19,9 @@ function sameHighlights(previous, next) {
|
|
|
22
19
|
return other && item.key === other.key && item.element === other.element && item.left === other.left && item.top === other.top && item.width === other.width && item.height === other.height && item.selected === other.selected && item.destructive === other.destructive;
|
|
23
20
|
});
|
|
24
21
|
}
|
|
22
|
+
function ancestorScale(visualSize, layoutSize) {
|
|
23
|
+
return visualSize > 0 && layoutSize > 0 ? visualSize / layoutSize : 1;
|
|
24
|
+
}
|
|
25
25
|
function MenuHighlight({ target, kind }) {
|
|
26
26
|
const reduceMotion = useReducedMotion();
|
|
27
27
|
const previousElement = React.useRef(target.element);
|
|
@@ -37,10 +37,9 @@ function MenuHighlight({ target, kind }) {
|
|
|
37
37
|
"aria-hidden": "true",
|
|
38
38
|
role: "presentation",
|
|
39
39
|
"data-slot": "fluid-menu-highlight",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
),
|
|
40
|
+
"data-kind": kind,
|
|
41
|
+
"data-selected": target.selected ? "true" : void 0,
|
|
42
|
+
"data-destructive": target.destructive ? "true" : void 0,
|
|
44
43
|
initial: false,
|
|
45
44
|
style: reduceMotion ? {
|
|
46
45
|
left: target.left,
|
|
@@ -96,13 +95,15 @@ function FluidMenuHighlights({ kind }) {
|
|
|
96
95
|
const add = (element, key, isSelected) => {
|
|
97
96
|
const containerRect = container.getBoundingClientRect();
|
|
98
97
|
const elementRect = element.getBoundingClientRect();
|
|
98
|
+
const scaleX = ancestorScale(containerRect.width, container.offsetWidth);
|
|
99
|
+
const scaleY = ancestorScale(containerRect.height, container.offsetHeight);
|
|
99
100
|
targets.push({
|
|
100
101
|
key,
|
|
101
102
|
element,
|
|
102
|
-
left: elementRect.left - containerRect.left + container.scrollLeft,
|
|
103
|
-
top: elementRect.top - containerRect.top + container.scrollTop,
|
|
104
|
-
width: elementRect.width,
|
|
105
|
-
height: elementRect.height,
|
|
103
|
+
left: (elementRect.left - containerRect.left) / scaleX + container.scrollLeft,
|
|
104
|
+
top: (elementRect.top - containerRect.top) / scaleY + container.scrollTop,
|
|
105
|
+
width: elementRect.width / scaleX,
|
|
106
|
+
height: elementRect.height / scaleY,
|
|
106
107
|
selected: isSelected,
|
|
107
108
|
destructive: element.dataset["variant"] === "destructive"
|
|
108
109
|
});
|
|
@@ -110,7 +111,7 @@ function FluidMenuHighlights({ kind }) {
|
|
|
110
111
|
if (kind === "sidebar") {
|
|
111
112
|
const selectedItem = selected[0];
|
|
112
113
|
const hoverItem = active ?? selectedItem;
|
|
113
|
-
if (hoverItem) add(hoverItem, "hover", false);
|
|
114
|
+
if (hoverItem && hoverItem !== selectedItem) add(hoverItem, "hover", false);
|
|
114
115
|
if (selectedItem) add(selectedItem, "sidebar", true);
|
|
115
116
|
} else {
|
|
116
117
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// ../ui/src/warmio/product-header/product-header.tsx
|
|
2
|
+
import { Fragment, memo } from "react";
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function getTitleSegments(pageTitle, productName) {
|
|
6
|
+
return pageTitle?.split(">").reduce((segments, rawSegment) => {
|
|
7
|
+
const segment = rawSegment.trim();
|
|
8
|
+
if (!segment || segments.length === 0 && segment === productName) return segments;
|
|
9
|
+
segments.push(segment);
|
|
10
|
+
return segments;
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
13
|
+
function ProductHeaderBreadcrumb({
|
|
14
|
+
pageTitle,
|
|
15
|
+
productName = "Warm",
|
|
16
|
+
homeHref
|
|
17
|
+
}) {
|
|
18
|
+
const titleSegments = getTitleSegments(pageTitle, productName);
|
|
19
|
+
const productNameNode = homeHref ? /* @__PURE__ */ jsx("a", { "data-slot": "product-header-title", href: homeHref, children: productName }) : /* @__PURE__ */ jsx("span", { "data-slot": "product-header-title", children: productName });
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
21
|
+
productNameNode,
|
|
22
|
+
titleSegments?.map((segment, index) => {
|
|
23
|
+
const isLast = index === titleSegments.length - 1;
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(ChevronRight, { "data-slot": "product-header-separator" }),
|
|
26
|
+
isLast ? /* @__PURE__ */ jsx("h1", { "data-slot": "product-header-title", "aria-current": "page", children: segment }) : /* @__PURE__ */ jsx("span", { "data-slot": "product-header-title", children: segment })
|
|
27
|
+
] }, `${segment}-${index}`);
|
|
28
|
+
})
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
var ProductHeader = memo(function ProductHeader2({
|
|
32
|
+
actions,
|
|
33
|
+
actionsTargetRef,
|
|
34
|
+
desktopShell = false,
|
|
35
|
+
hideBreadcrumb = false,
|
|
36
|
+
homeHref,
|
|
37
|
+
leading,
|
|
38
|
+
pageTitle,
|
|
39
|
+
productName,
|
|
40
|
+
titleTargetRef,
|
|
41
|
+
visibility = "desktop"
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
"header",
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "product-header",
|
|
47
|
+
"data-visibility": visibility,
|
|
48
|
+
"data-desktop-shell": desktopShell ? "" : void 0,
|
|
49
|
+
"data-tauri-drag-region": desktopShell ? "deep" : void 0,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxs("div", { ref: titleTargetRef, "data-slot": "product-header-titles", children: [
|
|
52
|
+
leading,
|
|
53
|
+
hideBreadcrumb ? null : /* @__PURE__ */ jsx("div", { "data-page-chrome-fallback": true, "data-slot": "product-header-fallback", children: /* @__PURE__ */ jsx(
|
|
54
|
+
ProductHeaderBreadcrumb,
|
|
55
|
+
{
|
|
56
|
+
...pageTitle !== void 0 ? { pageTitle } : {},
|
|
57
|
+
...productName !== void 0 ? { productName } : {},
|
|
58
|
+
...homeHref !== void 0 ? { homeHref } : {}
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ jsx("div", { ref: actionsTargetRef, "data-slot": "product-header-actions", children: actions ? /* @__PURE__ */ jsx("div", { "data-page-chrome-fallback": true, "data-slot": "product-header-fallback", children: actions }) : null })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
ProductHeader.displayName = "ProductHeader";
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
ProductHeaderBreadcrumb,
|
|
71
|
+
ProductHeader
|
|
72
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FluidOverlay
|
|
3
|
+
} from "./chunk-K36HD5J5.js";
|
|
4
|
+
|
|
5
|
+
// ../ui/src/components/sheet.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var SheetCloseSlotContext = React.createContext(null);
|
|
10
|
+
function Sheet(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { ...props });
|
|
12
|
+
}
|
|
13
|
+
function SheetTrigger({ asChild = false, children, render, ...props }) {
|
|
14
|
+
const resolvedRender = render ?? (asChild && React.isValidElement(children) ? children : void 0);
|
|
15
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", render: resolvedRender, ...props, children: resolvedRender ? void 0 : children });
|
|
16
|
+
}
|
|
17
|
+
function SheetClose({ asChild = false, children, render, ...props }) {
|
|
18
|
+
const resolvedRender = render ?? (asChild && React.isValidElement(children) ? children : void 0);
|
|
19
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", render: resolvedRender, ...props, children: resolvedRender ? void 0 : children });
|
|
20
|
+
}
|
|
21
|
+
function SheetPortal({ ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
23
|
+
}
|
|
24
|
+
function SheetOverlay({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
SheetPrimitive.Backdrop,
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "sheet-overlay",
|
|
29
|
+
className,
|
|
30
|
+
...props,
|
|
31
|
+
render: (props2, state) => /* @__PURE__ */ jsx(FluidOverlay, { props: props2, state, motion: "backdrop", tier: "moderate" })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function SheetContent({
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
side = "responsive",
|
|
39
|
+
showCloseButton = true,
|
|
40
|
+
closeButton,
|
|
41
|
+
overlayClassName,
|
|
42
|
+
render,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
const closeSlot = showCloseButton && closeButton ? /* @__PURE__ */ jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", render: closeButton }) : null;
|
|
46
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(SheetOverlay, { className: overlayClassName }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
SheetPrimitive.Popup,
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "sheet-content",
|
|
52
|
+
"data-side": side,
|
|
53
|
+
className,
|
|
54
|
+
...props,
|
|
55
|
+
render: (props2, state) => /* @__PURE__ */ jsx(
|
|
56
|
+
FluidOverlay,
|
|
57
|
+
{
|
|
58
|
+
props: props2,
|
|
59
|
+
state,
|
|
60
|
+
render,
|
|
61
|
+
motion: "sheet",
|
|
62
|
+
side,
|
|
63
|
+
tier: "moderate"
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
children: /* @__PURE__ */ jsx(SheetCloseSlotContext.Provider, { value: closeSlot, children })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function SheetHeader({ className, children, ...props }) {
|
|
72
|
+
const closeButton = React.useContext(SheetCloseSlotContext);
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "sheet-header", className, ...props, children: [
|
|
74
|
+
children,
|
|
75
|
+
closeButton
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
function SheetFooter({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "sheet-footer", className, ...props });
|
|
80
|
+
}
|
|
81
|
+
function SheetTitle({ className, ...props }) {
|
|
82
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Title, { "data-slot": "sheet-title", className, ...props });
|
|
83
|
+
}
|
|
84
|
+
function SheetDescription({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className, ...props });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
Sheet,
|
|
90
|
+
SheetTrigger,
|
|
91
|
+
SheetClose,
|
|
92
|
+
SheetContent,
|
|
93
|
+
SheetHeader,
|
|
94
|
+
SheetFooter,
|
|
95
|
+
SheetTitle,
|
|
96
|
+
SheetDescription
|
|
97
|
+
};
|