@warmio/ui 1.4.0 → 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.
Files changed (51) hide show
  1. package/LICENSES/fluid-functionalism.txt +24 -0
  2. package/README.md +23 -14
  3. package/dist/badge.js +2 -2
  4. package/dist/button.js +4 -1
  5. package/dist/chunks/chunk-A2PN77YE.js +42 -0
  6. package/dist/chunks/chunk-DHV2A22F.js +240 -0
  7. package/dist/chunks/chunk-DOOSH3V6.js +72 -0
  8. package/dist/chunks/chunk-EIEA5RJJ.js +97 -0
  9. package/dist/chunks/chunk-FKGHMPVW.js +875 -0
  10. package/dist/chunks/chunk-K36HD5J5.js +133 -0
  11. package/dist/chunks/chunk-L6L3GVGM.js +130 -0
  12. package/dist/chunks/chunk-MGX6ZL6Q.js +224 -0
  13. package/dist/chunks/chunk-MVUHHKBL.js +492 -0
  14. package/dist/chunks/chunk-PJUNSOJK.js +116 -0
  15. package/dist/chunks/chunk-RVVHR7RY.js +0 -0
  16. package/dist/chunks/chunk-U7D32UN3.js +0 -0
  17. package/dist/chunks/chunk-W24JGQWM.js +65 -0
  18. package/dist/dropdown-menu.js +4 -3
  19. package/dist/entries/badge.css +178 -0
  20. package/dist/entries/button.css +422 -0
  21. package/dist/entries/dropdown-menu.css +167 -0
  22. package/dist/entries/index.css +2789 -0
  23. package/dist/entries/logo.css +147 -0
  24. package/dist/entries/product-header.css +88 -0
  25. package/dist/entries/sheet.css +666 -0
  26. package/dist/entries/sidebar.css +2108 -0
  27. package/dist/entries/text.css +97 -0
  28. package/dist/index.js +17 -13
  29. package/dist/logo.js +2 -2
  30. package/dist/product-header.js +2 -2
  31. package/dist/product-header.types.d.ts +3 -2
  32. package/dist/sheet.js +5 -3
  33. package/dist/sidebar.css +129 -0
  34. package/dist/sidebar.js +7 -3
  35. package/dist/text.css +121 -0
  36. package/dist/text.js +2 -2
  37. package/package.json +15 -5
  38. package/types/badge.d.ts +10 -2
  39. package/types/button.d.ts +65 -9
  40. package/types/sidebar.d.ts +10 -2
  41. package/types/text.d.ts +10 -2
  42. package/dist/chunks/chunk-4RQCHKAW.js +0 -105
  43. package/dist/chunks/chunk-FW2EHGRK.js +0 -748
  44. package/dist/chunks/chunk-GKEYV2XW.js +0 -10
  45. package/dist/chunks/chunk-HDCV4ACN.js +0 -469
  46. package/dist/chunks/chunk-ICC7GQXS.js +0 -74
  47. package/dist/chunks/chunk-KN6WVLCR.js +0 -261
  48. package/dist/chunks/chunk-MIMC4M6W.js +0 -86
  49. package/dist/chunks/chunk-PBWF6BDE.js +0 -88
  50. package/dist/chunks/chunk-VIB7OX7D.js +0 -10
  51. package/dist/chunks/chunk-YTDMREDR.js +0 -201
@@ -0,0 +1,133 @@
1
+ // ../ui/src/lib/fluid-overlay.tsx
2
+ import * as React from "react";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+
5
+ // ../ui/src/hooks/use-reduced-motion.ts
6
+ import { useSyncExternalStore } from "react";
7
+ var mediaWindow;
8
+ var mediaQuery;
9
+ function getMediaQuery() {
10
+ const currentWindow = globalThis.window;
11
+ if (!currentWindow?.matchMedia) return void 0;
12
+ if (currentWindow !== mediaWindow) {
13
+ mediaWindow = currentWindow;
14
+ mediaQuery = currentWindow.matchMedia("(prefers-reduced-motion: reduce)");
15
+ }
16
+ return mediaQuery;
17
+ }
18
+ function subscribe(onChange) {
19
+ const query = getMediaQuery();
20
+ query?.addEventListener("change", onChange);
21
+ return () => query?.removeEventListener("change", onChange);
22
+ }
23
+ function getSnapshot() {
24
+ return getMediaQuery()?.matches ?? true;
25
+ }
26
+ function getServerSnapshot() {
27
+ return true;
28
+ }
29
+ function useReducedMotion() {
30
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
31
+ }
32
+
33
+ // ../ui/src/lib/motion.ts
34
+ var MOTION_DURATION_MS = 240;
35
+ var MOTION_DURATION_S = MOTION_DURATION_MS / 1e3;
36
+ var MOTION_ENTRANCE_DURATION_MS = 240;
37
+ var MOTION_ENTRANCE_DURATION_S = MOTION_ENTRANCE_DURATION_MS / 1e3;
38
+ var MOTION_HOVER_DURATION_MS = 80;
39
+ var MOTION_HOVER_DURATION_S = MOTION_HOVER_DURATION_MS / 1e3;
40
+ var FLUID_SPRING = {
41
+ fast: { type: "spring", duration: 0.08, bounce: 0 },
42
+ moderate: { type: "spring", duration: 0.16, bounce: 0 },
43
+ slow: { type: "spring", duration: 0.24, bounce: 0 }
44
+ };
45
+ var FLUID_EASING = "cubic-bezier(0.23, 1, 0.32, 1)";
46
+ var FLUID_EXIT = {
47
+ fast: { duration: 0.06 },
48
+ moderate: { duration: 0.12 },
49
+ slow: { duration: 0.16 }
50
+ };
51
+
52
+ // ../ui/src/lib/fluid-overlay.tsx
53
+ var RESPONSIVE_SHEET_QUERY = "(min-width: 64rem)";
54
+ function resolvePhysicalSide(side, element) {
55
+ if (side === "responsive") {
56
+ return globalThis.matchMedia?.(RESPONSIVE_SHEET_QUERY)?.matches ? "right" : "bottom";
57
+ }
58
+ if (side !== "inline-start" && side !== "inline-end") return side;
59
+ const rtl = getComputedStyle(element).direction === "rtl";
60
+ return side === "inline-start" !== rtl ? "left" : "right";
61
+ }
62
+ function getClosedTransform(motion, side, element) {
63
+ if (motion === "backdrop" || motion === "fade") return void 0;
64
+ if (motion === "menu") return "scaleY(0.96)";
65
+ if (motion === "dialog") return "scale(0.97)";
66
+ if (motion === "ios-dialog") return "translateY(16px)";
67
+ const physicalSide = resolvePhysicalSide(side, element);
68
+ const distance = motion === "sheet" ? "2.5rem" : "4px";
69
+ const negative = motion === "sheet" ? physicalSide === "top" || physicalSide === "left" : physicalSide === "bottom" || physicalSide === "right";
70
+ const axis = physicalSide === "top" || physicalSide === "bottom" ? "Y" : "X";
71
+ const scale = motion === "popover" ? " scale(0.97)" : "";
72
+ return `translate${axis}(${negative ? "-" : ""}${distance})${scale}`;
73
+ }
74
+ function hasNativeAnimation(element) {
75
+ return typeof element.animate === "function";
76
+ }
77
+ function FluidOverlay({
78
+ props,
79
+ state,
80
+ render,
81
+ motion,
82
+ side = "bottom",
83
+ tier
84
+ }) {
85
+ const elementRef = React.useRef(null);
86
+ const reducedMotion = useReducedMotion();
87
+ const open = state.open && state.transitionStatus !== "ending";
88
+ const instant = Boolean(state.instant) || motion === "tooltip" && !open;
89
+ React.useLayoutEffect(() => {
90
+ const element = elementRef.current;
91
+ if (!element) return;
92
+ const closedTransform = getClosedTransform(motion, side, element);
93
+ const opacity = open ? 1 : 0;
94
+ const settle = () => {
95
+ element.style.opacity = String(opacity);
96
+ if (closedTransform) element.style.transform = open ? "none" : closedTransform;
97
+ };
98
+ if (reducedMotion || instant || !hasNativeAnimation(element) || element.getClientRects().length === 0) {
99
+ settle();
100
+ return;
101
+ }
102
+ const openFrame = closedTransform ? { opacity: 1, transform: "none" } : { opacity: 1 };
103
+ const closedFrame = closedTransform ? { opacity: 0, transform: closedTransform } : { opacity: 0 };
104
+ const animation = element.animate(open ? [closedFrame, openFrame] : [openFrame, closedFrame], {
105
+ duration: (open ? FLUID_SPRING[tier].duration : FLUID_EXIT[tier].duration) * 1e3,
106
+ easing: FLUID_EASING,
107
+ fill: "both"
108
+ });
109
+ const handleFinish = () => {
110
+ settle();
111
+ animation.cancel();
112
+ };
113
+ animation.addEventListener("finish", handleFinish);
114
+ return () => {
115
+ animation.removeEventListener("finish", handleFinish);
116
+ settle();
117
+ animation.cancel();
118
+ };
119
+ }, [instant, motion, open, reducedMotion, side, tier]);
120
+ return useRender({
121
+ defaultTagName: "div",
122
+ ref: elementRef,
123
+ // oxlint-disable-next-line anti-slop/no-runtime-typeof -- Base UI render is documented as an element-or-function union.
124
+ render: typeof render === "function" ? (renderProps) => render(renderProps, state) : render,
125
+ props: { ...props }
126
+ });
127
+ }
128
+
129
+ export {
130
+ useReducedMotion,
131
+ FLUID_SPRING,
132
+ FluidOverlay
133
+ };
@@ -0,0 +1,130 @@
1
+ // ../ui/src/warmio/button/button.tsx
2
+ import * as React from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ var presentationToPrivateSize = {
5
+ assistantIcon: "icon-xs",
6
+ assistantRoundIcon: "icon-round",
7
+ cardTitle: "default",
8
+ composerIcon: "icon-sm",
9
+ default: "default",
10
+ headerAction: "icon-xs",
11
+ compact: "sm",
12
+ controlPeer: "default",
13
+ editPill: "sm",
14
+ hero: "lg",
15
+ menuOption: "option",
16
+ promptCategory: "default",
17
+ promptOption: "option",
18
+ sidebarIcon: "icon",
19
+ tableHeader: "default",
20
+ tableHeaderLink: "default",
21
+ threadMore: "icon-xs",
22
+ threadNew: "sm",
23
+ touch: "default"
24
+ };
25
+ var presentationAliases = {
26
+ controlPeer: "default",
27
+ menuOption: "promptOption",
28
+ touch: "default"
29
+ };
30
+ function resolvePresentation(presentation) {
31
+ return presentationAliases[presentation] ?? presentation;
32
+ }
33
+ function resolveButton(presentation, size) {
34
+ const privateSize = presentationToPrivateSize[presentation];
35
+ const resolvedSize = size ?? (privateSize === "lg" ? "jumbo" : privateSize === "sm" ? "compact" : privateSize === "icon" || privateSize === "icon-round" || privateSize === "icon-sm" || privateSize === "icon-xs" ? "icon" : "default");
36
+ return { resolvedSize, explicitSize: size ? resolvedSize : void 0 };
37
+ }
38
+ function withArrow(variant, children) {
39
+ if (variant !== "arrow") return children;
40
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ children,
42
+ /* @__PURE__ */ jsxs(
43
+ "svg",
44
+ {
45
+ "aria-hidden": "true",
46
+ "data-icon": "inline-end",
47
+ width: "16",
48
+ height: "16",
49
+ viewBox: "0 0 24 24",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: "2",
53
+ strokeLinecap: "round",
54
+ strokeLinejoin: "round",
55
+ children: [
56
+ /* @__PURE__ */ jsx("path", { d: "M7 7h10v10" }),
57
+ /* @__PURE__ */ jsx("path", { d: "M7 17L17 7" })
58
+ ]
59
+ }
60
+ )
61
+ ] });
62
+ }
63
+ var Button = React.forwardRef(function Button2({
64
+ children,
65
+ className: _className,
66
+ presentation = "default",
67
+ render: _render,
68
+ size,
69
+ style: _style,
70
+ type,
71
+ variant = "default",
72
+ width,
73
+ asChild: _asChild,
74
+ ...props
75
+ }, ref) {
76
+ const { resolvedSize, explicitSize } = resolveButton(presentation, size);
77
+ return /* @__PURE__ */ jsx(
78
+ "button",
79
+ {
80
+ ...props,
81
+ ref,
82
+ type: type ?? "button",
83
+ "data-warm-button": "",
84
+ "data-slot": "button",
85
+ "data-presentation": resolvePresentation(presentation),
86
+ "data-variant": variant,
87
+ "data-size": resolvedSize,
88
+ "data-explicit-size": explicitSize,
89
+ "data-width": width,
90
+ children: withArrow(variant, children)
91
+ }
92
+ );
93
+ });
94
+ Button.displayName = "WarmButton";
95
+ var ButtonLink = React.forwardRef(function ButtonLink2({
96
+ children,
97
+ className: _className,
98
+ disabled: _disabled,
99
+ presentation = "default",
100
+ render: _render,
101
+ size,
102
+ style: _style,
103
+ variant = "default",
104
+ width,
105
+ asChild: _asChild,
106
+ ...props
107
+ }, ref) {
108
+ const { resolvedSize, explicitSize } = resolveButton(presentation, size);
109
+ return /* @__PURE__ */ jsx(
110
+ "a",
111
+ {
112
+ ...props,
113
+ ref,
114
+ "data-warm-button": "",
115
+ "data-slot": "button",
116
+ "data-presentation": resolvePresentation(presentation),
117
+ "data-variant": variant,
118
+ "data-size": resolvedSize,
119
+ "data-explicit-size": explicitSize,
120
+ "data-width": width,
121
+ children: withArrow(variant, children)
122
+ }
123
+ );
124
+ });
125
+ ButtonLink.displayName = "WarmButtonLink";
126
+
127
+ export {
128
+ Button,
129
+ ButtonLink
130
+ };
@@ -0,0 +1,224 @@
1
+ import {
2
+ FluidMenuHighlights
3
+ } from "./chunk-DHV2A22F.js";
4
+ import {
5
+ FluidOverlay
6
+ } from "./chunk-K36HD5J5.js";
7
+
8
+ // ../ui/src/warmio/dropdown-menu/dropdown-menu.tsx
9
+ import * as React from "react";
10
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
11
+ import { CheckIcon } from "lucide-react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function DropdownMenu(props) {
14
+ return /* @__PURE__ */ jsx(MenuPrimitive.Root, { ...props });
15
+ }
16
+ function DropdownMenuTrigger({
17
+ asChild = false,
18
+ children,
19
+ render,
20
+ className: _className,
21
+ style: _style,
22
+ ...props
23
+ }) {
24
+ const resolvedRender = render ?? (asChild && React.isValidElement(children) ? children : void 0);
25
+ return /* @__PURE__ */ jsx(MenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", render: resolvedRender, ...props, children: resolvedRender ? void 0 : children });
26
+ }
27
+ function DropdownMenuContent({
28
+ align = "start",
29
+ alignOffset = 0,
30
+ side = "bottom",
31
+ sideOffset = 4,
32
+ portal = true,
33
+ size = "default",
34
+ spacing = "default",
35
+ children,
36
+ ref,
37
+ className: _className,
38
+ style: _style,
39
+ ...props
40
+ }) {
41
+ const content = /* @__PURE__ */ jsx(
42
+ MenuPrimitive.Positioner,
43
+ {
44
+ align,
45
+ alignOffset,
46
+ side,
47
+ sideOffset,
48
+ "data-slot": "dropdown-menu-positioner",
49
+ children: /* @__PURE__ */ jsxs(
50
+ MenuPrimitive.Popup,
51
+ {
52
+ ref,
53
+ "data-slot": "dropdown-menu-content",
54
+ "data-fluid-menu": "menu",
55
+ "data-size": size,
56
+ "data-spacing": spacing,
57
+ render: (popupProps, state) => /* @__PURE__ */ jsx(FluidOverlay, { props: popupProps, state, motion: "menu", tier: "fast" }),
58
+ ...props,
59
+ children: [
60
+ children,
61
+ /* @__PURE__ */ jsx(FluidMenuHighlights, { kind: "menu" })
62
+ ]
63
+ }
64
+ )
65
+ }
66
+ );
67
+ return portal ? /* @__PURE__ */ jsx(MenuPrimitive.Portal, { children: content }) : content;
68
+ }
69
+ function DropdownMenuGroup({
70
+ className: _className,
71
+ style: _style,
72
+ ...props
73
+ }) {
74
+ return /* @__PURE__ */ jsx(MenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
75
+ }
76
+ function DropdownMenuItem({
77
+ className: _className,
78
+ inset,
79
+ variant = "default",
80
+ ref,
81
+ style: _style,
82
+ ...props
83
+ }) {
84
+ return /* @__PURE__ */ jsx(
85
+ MenuPrimitive.Item,
86
+ {
87
+ ref,
88
+ "data-slot": "dropdown-menu-item",
89
+ "data-inset": inset,
90
+ "data-variant": variant,
91
+ ...props
92
+ }
93
+ );
94
+ }
95
+ function DropdownMenuLinkItem({
96
+ className: _className,
97
+ children,
98
+ href,
99
+ inset,
100
+ variant = "default",
101
+ ref,
102
+ style: _style,
103
+ ...props
104
+ }) {
105
+ return /* @__PURE__ */ jsx(
106
+ MenuPrimitive.Item,
107
+ {
108
+ ref,
109
+ "data-slot": "dropdown-menu-item",
110
+ "data-inset": inset,
111
+ "data-variant": variant,
112
+ render: /* @__PURE__ */ jsx("a", { href, children }),
113
+ ...props
114
+ }
115
+ );
116
+ }
117
+ function DropdownMenuCheckboxItem({
118
+ children,
119
+ checked,
120
+ inset,
121
+ className: _className,
122
+ ref,
123
+ style: _style,
124
+ onCheckedChange,
125
+ ...props
126
+ }) {
127
+ const handleCheckedChange = (nextChecked, eventDetails) => {
128
+ onCheckedChange?.(nextChecked, eventDetails);
129
+ };
130
+ return /* @__PURE__ */ jsxs(
131
+ MenuPrimitive.CheckboxItem,
132
+ {
133
+ ref,
134
+ "data-slot": "dropdown-menu-checkbox-item",
135
+ "data-inset": inset,
136
+ checked,
137
+ onCheckedChange: handleCheckedChange,
138
+ ...props,
139
+ children: [
140
+ /* @__PURE__ */ jsx("span", { "data-slot": "dropdown-menu-checkbox-item-indicator", children: /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }) }),
141
+ children
142
+ ]
143
+ }
144
+ );
145
+ }
146
+ function DropdownMenuRadioGroup({
147
+ className: _className,
148
+ onValueChange,
149
+ style: _style,
150
+ ...props
151
+ }) {
152
+ const handleValueChange = (value, eventDetails) => {
153
+ onValueChange?.(value, eventDetails);
154
+ };
155
+ return /* @__PURE__ */ jsx(
156
+ MenuPrimitive.RadioGroup,
157
+ {
158
+ "data-slot": "dropdown-menu-radio-group",
159
+ onValueChange: handleValueChange,
160
+ ...props
161
+ }
162
+ );
163
+ }
164
+ function DropdownMenuRadioItem({
165
+ children,
166
+ inset,
167
+ className: _className,
168
+ ref,
169
+ style: _style,
170
+ ...props
171
+ }) {
172
+ return /* @__PURE__ */ jsxs(
173
+ MenuPrimitive.RadioItem,
174
+ {
175
+ ref,
176
+ "data-slot": "dropdown-menu-radio-item",
177
+ "data-inset": inset,
178
+ ...props,
179
+ children: [
180
+ /* @__PURE__ */ jsx("span", { "data-slot": "dropdown-menu-radio-item-indicator", children: /* @__PURE__ */ jsx(MenuPrimitive.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }) }),
181
+ children
182
+ ]
183
+ }
184
+ );
185
+ }
186
+ function DropdownMenuLabel({
187
+ className: _className,
188
+ inset,
189
+ ref,
190
+ style: _style,
191
+ ...props
192
+ }) {
193
+ return /* @__PURE__ */ jsx(
194
+ MenuPrimitive.GroupLabel,
195
+ {
196
+ ref,
197
+ "data-slot": "dropdown-menu-label",
198
+ "data-inset": inset,
199
+ ...props
200
+ }
201
+ );
202
+ }
203
+ function DropdownMenuSeparator({
204
+ className: _className,
205
+ ref,
206
+ style: _style,
207
+ ...props
208
+ }) {
209
+ return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { ref, "data-slot": "dropdown-menu-separator", ...props });
210
+ }
211
+
212
+ export {
213
+ DropdownMenu,
214
+ DropdownMenuTrigger,
215
+ DropdownMenuContent,
216
+ DropdownMenuGroup,
217
+ DropdownMenuItem,
218
+ DropdownMenuLinkItem,
219
+ DropdownMenuCheckboxItem,
220
+ DropdownMenuRadioGroup,
221
+ DropdownMenuRadioItem,
222
+ DropdownMenuLabel,
223
+ DropdownMenuSeparator
224
+ };