@umami/react-zen 0.218.0 → 0.220.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/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
35
35
  }
36
36
  var objectIs = "function" === typeof Object.is ? Object.is : is2;
37
37
  var useState18 = React5.useState;
38
- var useEffect12 = React5.useEffect;
38
+ var useEffect13 = React5.useEffect;
39
39
  var useLayoutEffect3 = React5.useLayoutEffect;
40
40
  var useDebugValue = React5.useDebugValue;
41
41
  function useSyncExternalStore$2(subscribe, getSnapshot) {
@@ -48,7 +48,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
48
48
  },
49
49
  [subscribe, value, getSnapshot]
50
50
  );
51
- useEffect12(
51
+ useEffect13(
52
52
  function() {
53
53
  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
54
54
  return subscribe(function() {
@@ -109,7 +109,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
109
109
  },
110
110
  [subscribe, value, getSnapshot]
111
111
  );
112
- useEffect12(
112
+ useEffect13(
113
113
  function() {
114
114
  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
115
115
  return subscribe(function() {
@@ -135,7 +135,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
135
135
  return getSnapshot();
136
136
  }
137
137
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
138
- var React5 = __import_react2, objectIs = "function" === typeof Object.is ? Object.is : is2, useState18 = React5.useState, useEffect12 = React5.useEffect, useLayoutEffect3 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
138
+ var React5 = __import_react2, objectIs = "function" === typeof Object.is ? Object.is : is2, useState18 = React5.useState, useEffect13 = React5.useEffect, useLayoutEffect3 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
139
139
  exports.useSyncExternalStore = void 0 !== React5.useSyncExternalStore ? React5.useSyncExternalStore : shim;
140
140
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
141
141
  })();
@@ -30900,6 +30900,77 @@ var letterSpacingMap = {
30900
30900
  wider: "tracking-wider",
30901
30901
  widest: "tracking-widest"
30902
30902
  };
30903
+ var lineHeightMap = {
30904
+ none: "leading-none",
30905
+ tight: "leading-tight",
30906
+ snug: "leading-snug",
30907
+ normal: "leading-normal",
30908
+ relaxed: "leading-relaxed",
30909
+ loose: "leading-loose",
30910
+ "3": "leading-3",
30911
+ "4": "leading-4",
30912
+ "5": "leading-5",
30913
+ "6": "leading-6",
30914
+ "7": "leading-7",
30915
+ "8": "leading-8",
30916
+ "9": "leading-9",
30917
+ "10": "leading-10"
30918
+ };
30919
+ var whitespaceMap = {
30920
+ normal: "whitespace-normal",
30921
+ nowrap: "whitespace-nowrap",
30922
+ pre: "whitespace-pre",
30923
+ "pre-line": "whitespace-pre-line",
30924
+ "pre-wrap": "whitespace-pre-wrap",
30925
+ "break-spaces": "whitespace-break-spaces"
30926
+ };
30927
+ var wordBreakMap = {
30928
+ normal: "break-normal",
30929
+ words: "break-words",
30930
+ all: "break-all",
30931
+ keep: "break-keep"
30932
+ };
30933
+ var verticalAlignMap = {
30934
+ baseline: "align-baseline",
30935
+ top: "align-top",
30936
+ middle: "align-middle",
30937
+ bottom: "align-bottom",
30938
+ "text-top": "align-text-top",
30939
+ "text-bottom": "align-text-bottom",
30940
+ sub: "align-sub",
30941
+ super: "align-super"
30942
+ };
30943
+ var textDecorationStyleMap = {
30944
+ solid: "decoration-solid",
30945
+ double: "decoration-double",
30946
+ dotted: "decoration-dotted",
30947
+ dashed: "decoration-dashed",
30948
+ wavy: "decoration-wavy"
30949
+ };
30950
+ var textIndentMap = {
30951
+ "0": "indent-0",
30952
+ px: "indent-px",
30953
+ "0.5": "indent-0.5",
30954
+ "1": "indent-1",
30955
+ "1.5": "indent-1.5",
30956
+ "2": "indent-2",
30957
+ "2.5": "indent-2.5",
30958
+ "3": "indent-3",
30959
+ "3.5": "indent-3.5",
30960
+ "4": "indent-4",
30961
+ "5": "indent-5",
30962
+ "6": "indent-6",
30963
+ "7": "indent-7",
30964
+ "8": "indent-8",
30965
+ "9": "indent-9",
30966
+ "10": "indent-10",
30967
+ "11": "indent-11",
30968
+ "12": "indent-12",
30969
+ "14": "indent-14",
30970
+ "16": "indent-16",
30971
+ "20": "indent-20",
30972
+ "24": "indent-24"
30973
+ };
30903
30974
  var gridAutoFlowMap = {
30904
30975
  row: "grid-flow-row",
30905
30976
  column: "grid-flow-col",
@@ -30907,6 +30978,38 @@ var gridAutoFlowMap = {
30907
30978
  "row-dense": "grid-flow-row-dense",
30908
30979
  "column-dense": "grid-flow-col-dense"
30909
30980
  };
30981
+ var gridColumnsMap = {
30982
+ "1": "grid-cols-1",
30983
+ "2": "grid-cols-2",
30984
+ "3": "grid-cols-3",
30985
+ "4": "grid-cols-4",
30986
+ "5": "grid-cols-5",
30987
+ "6": "grid-cols-6",
30988
+ "7": "grid-cols-7",
30989
+ "8": "grid-cols-8",
30990
+ "9": "grid-cols-9",
30991
+ "10": "grid-cols-10",
30992
+ "11": "grid-cols-11",
30993
+ "12": "grid-cols-12",
30994
+ none: "grid-cols-none",
30995
+ subgrid: "grid-cols-subgrid"
30996
+ };
30997
+ var gridRowsMap = {
30998
+ "1": "grid-rows-1",
30999
+ "2": "grid-rows-2",
31000
+ "3": "grid-rows-3",
31001
+ "4": "grid-rows-4",
31002
+ "5": "grid-rows-5",
31003
+ "6": "grid-rows-6",
31004
+ "7": "grid-rows-7",
31005
+ "8": "grid-rows-8",
31006
+ "9": "grid-rows-9",
31007
+ "10": "grid-rows-10",
31008
+ "11": "grid-rows-11",
31009
+ "12": "grid-rows-12",
31010
+ none: "grid-rows-none",
31011
+ subgrid: "grid-rows-subgrid"
31012
+ };
30910
31013
  var borderMap = {
30911
31014
  true: "border border-edge",
30912
31015
  none: "border-0",
@@ -31043,9 +31146,33 @@ function mapTextTransform(value) {
31043
31146
  function mapLetterSpacing(value) {
31044
31147
  return mapResponsive(value, (v) => letterSpacingMap[v]);
31045
31148
  }
31149
+ function mapLineHeight(value) {
31150
+ return mapResponsive(value, (v) => lineHeightMap[v]);
31151
+ }
31152
+ function mapWhitespace(value) {
31153
+ return mapResponsive(value, (v) => whitespaceMap[v]);
31154
+ }
31155
+ function mapWordBreak(value) {
31156
+ return mapResponsive(value, (v) => wordBreakMap[v]);
31157
+ }
31158
+ function mapVerticalAlign(value) {
31159
+ return mapResponsive(value, (v) => verticalAlignMap[v]);
31160
+ }
31161
+ function mapTextDecorationStyle(value) {
31162
+ return mapResponsive(value, (v) => textDecorationStyleMap[v]);
31163
+ }
31164
+ function mapTextIndent(value) {
31165
+ return mapResponsive(value, (v) => textIndentMap[v]);
31166
+ }
31046
31167
  function mapGridAutoFlow(value) {
31047
31168
  return mapResponsive(value, (v) => gridAutoFlowMap[v]);
31048
31169
  }
31170
+ function mapGridColumns(value) {
31171
+ return mapResponsive(value, (v) => gridColumnsMap[v]);
31172
+ }
31173
+ function mapGridRows(value) {
31174
+ return mapResponsive(value, (v) => gridRowsMap[v]);
31175
+ }
31049
31176
  function mapBorder(value) {
31050
31177
  return mapResponsive(value, (v) => borderMap[String(v)]);
31051
31178
  }
@@ -31413,15 +31540,22 @@ import { jsx as jsx3 } from "react/jsx-runtime";
31413
31540
  function Text({
31414
31541
  color,
31415
31542
  size = "base",
31416
- spacing,
31417
31543
  weight,
31418
31544
  align,
31545
+ spacing,
31546
+ lineHeight,
31419
31547
  wrap,
31548
+ whitespace,
31549
+ wordBreak,
31420
31550
  transform,
31551
+ indent,
31552
+ verticalAlign,
31421
31553
  truncate,
31422
31554
  italic,
31423
31555
  underline,
31424
31556
  strikethrough,
31557
+ decorationStyle,
31558
+ decorationColor,
31425
31559
  as = "span",
31426
31560
  render,
31427
31561
  className,
@@ -31430,19 +31564,27 @@ function Text({
31430
31564
  }) {
31431
31565
  const Component = as;
31432
31566
  const colorStr = color === true ? "true" : color;
31567
+ const decorationColorStr = decorationColor === true ? "true" : decorationColor;
31433
31568
  const classes = cn(
31434
31569
  "text-foreground-primary",
31435
31570
  mapFontSize(size),
31436
- mapTextAlign(align),
31437
- mapTextWrap(wrap),
31438
31571
  mapFontWeight(weight),
31572
+ mapTextAlign(align),
31439
31573
  mapLetterSpacing(spacing),
31574
+ mapLineHeight(lineHeight),
31575
+ mapTextWrap(wrap),
31576
+ mapWhitespace(whitespace),
31577
+ mapWordBreak(wordBreak),
31440
31578
  mapTextTransform(transform),
31579
+ mapTextIndent(indent),
31580
+ mapVerticalAlign(verticalAlign),
31441
31581
  mapTextColor(colorStr),
31442
31582
  truncate && "truncate",
31443
31583
  italic && "italic",
31444
31584
  underline && "underline",
31445
31585
  strikethrough && "line-through",
31586
+ mapTextDecorationStyle(decorationStyle),
31587
+ decorationColorStr && `decoration-${decorationColorStr}`,
31446
31588
  className
31447
31589
  );
31448
31590
  const renderProps = {
@@ -32401,6 +32543,12 @@ function Grid({
32401
32543
  children,
32402
32544
  ...props
32403
32545
  }) {
32546
+ const isCustomColumns = typeof columns === "string" && !["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none", "subgrid"].includes(
32547
+ columns
32548
+ );
32549
+ const isCustomRows = typeof rows === "string" && !["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none", "subgrid"].includes(
32550
+ rows
32551
+ );
32404
32552
  const classes = cn(
32405
32553
  mapDisplay(display),
32406
32554
  mapJustifyContent(justifyContent),
@@ -32411,16 +32559,18 @@ function Grid({
32411
32559
  mapGap(gapX, "x"),
32412
32560
  mapGap(gapY, "y"),
32413
32561
  mapGridAutoFlow(autoFlow),
32562
+ !isCustomColumns && mapGridColumns(columns),
32563
+ !isCustomRows && mapGridRows(rows),
32414
32564
  className
32415
32565
  );
32416
32566
  const inlineStyles = {
32417
32567
  ...style,
32418
- ...rows && { gridTemplateRows: rows },
32419
- ...columns && { gridTemplateColumns: columns },
32568
+ ...isCustomColumns && { gridTemplateColumns: columns },
32569
+ ...isCustomRows && { gridTemplateRows: rows },
32420
32570
  ...areas && { gridTemplateAreas: areas }
32421
32571
  };
32422
- const hasInlineStyles = Object.keys(inlineStyles).length > (style ? Object.keys(style).length : 0);
32423
- return /* @__PURE__ */ jsx26(Box, { ...props, className: classes, style: hasInlineStyles || style ? inlineStyles : void 0, children });
32572
+ const hasInlineStyles = isCustomColumns || isCustomRows || areas || style && Object.keys(style).length > 0;
32573
+ return /* @__PURE__ */ jsx26(Box, { ...props, className: classes, style: hasInlineStyles ? inlineStyles : void 0, children });
32424
32574
  }
32425
32575
 
32426
32576
  // src/lib/utils.ts
@@ -32634,14 +32784,27 @@ import { useEffect as useEffect2, useState as useState5 } from "react";
32634
32784
  // src/components/Tooltip.tsx
32635
32785
  import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
32636
32786
  function Tooltip2({ children, className, showArrow, ...props }) {
32637
- return /* @__PURE__ */ jsx31($4e3b923658d69c60$export$28c660c63b792dea, { ...props, className: cn(tooltip(), className), children: /* @__PURE__ */ jsx31(TooltipBubble, { showArrow, children }) });
32638
- }
32639
- function TooltipBubble({ showArrow, children, className, color: _color, ...props }) {
32640
- return /* @__PURE__ */ jsxs15(Box, { ...props, className, children: [
32641
- showArrow && /* @__PURE__ */ jsx31($44f671af83e7d9e0$export$746d02f47f4d381, { className: "fill-surface-inverted", children: /* @__PURE__ */ jsx31("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx31("path", { d: "M0 0 L4 4 L8 0" }) }) }),
32642
- /* @__PURE__ */ jsx31(Box, { children })
32787
+ return /* @__PURE__ */ jsxs15($4e3b923658d69c60$export$28c660c63b792dea, { ...props, className: cn("group", tooltip(), className), children: [
32788
+ showArrow && /* @__PURE__ */ jsx31($44f671af83e7d9e0$export$746d02f47f4d381, { className: "w-2 h-2", children: /* @__PURE__ */ jsx31(
32789
+ "svg",
32790
+ {
32791
+ viewBox: "0 0 8 8",
32792
+ className: cn(
32793
+ "block fill-surface-inverted",
32794
+ "group-data-[placement=bottom]:rotate-180",
32795
+ "group-data-[placement=left]:-rotate-90",
32796
+ "group-data-[placement=right]:rotate-90"
32797
+ ),
32798
+ children: /* @__PURE__ */ jsx31("path", { d: "M0 0 L4 4 L8 0" })
32799
+ }
32800
+ ) }),
32801
+ children,
32802
+ "for"
32643
32803
  ] });
32644
32804
  }
32805
+ function TooltipBubble({ children, className, color: _color, ...props }) {
32806
+ return /* @__PURE__ */ jsx31(Box, { ...props, className, children });
32807
+ }
32645
32808
 
32646
32809
  // src/components/FloatingTooltip.tsx
32647
32810
  import { jsx as jsx32 } from "react/jsx-runtime";
@@ -39776,8 +39939,11 @@ function TabPanel2({ children, className, ...props }) {
39776
39939
  }
39777
39940
 
39778
39941
  // src/components/ThemeButton.tsx
39779
- import { useState as useState17 } from "react";
39942
+ import { useEffect as useEffect12, useRef as useRef7, useState as useState17 } from "react";
39780
39943
  import { jsx as jsx68, jsxs as jsxs42 } from "react/jsx-runtime";
39944
+ function getElement(target) {
39945
+ return "current" in target ? target.current : target;
39946
+ }
39781
39947
  function applyTheme2(element, theme) {
39782
39948
  element.setAttribute("data-theme", theme);
39783
39949
  if (theme === "dark") {
@@ -39794,9 +39960,20 @@ function ThemeButton({
39794
39960
  ...props
39795
39961
  }) {
39796
39962
  const globalTheme = useTheme();
39797
- const [localTheme, setLocalTheme] = useState17("light");
39963
+ const [localTheme, setLocalTheme] = useState17(null);
39964
+ const initializedRef = useRef7(false);
39798
39965
  const isLocal = !!target;
39799
- const theme = isLocal ? localTheme : globalTheme.theme;
39966
+ useEffect12(() => {
39967
+ if (isLocal && target && !initializedRef.current) {
39968
+ const element = getElement(target);
39969
+ if (element) {
39970
+ initializedRef.current = true;
39971
+ setLocalTheme(globalTheme.theme);
39972
+ applyTheme2(element, globalTheme.theme);
39973
+ }
39974
+ }
39975
+ }, [isLocal, target, globalTheme.theme]);
39976
+ const theme = isLocal ? localTheme ?? globalTheme.theme : globalTheme.theme;
39800
39977
  const transitions = useTransition(theme, {
39801
39978
  initial: { opacity: 1 },
39802
39979
  from: {
@@ -39811,8 +39988,8 @@ function ThemeButton({
39811
39988
  });
39812
39989
  function handleClick(e) {
39813
39990
  const newTheme = theme === "light" ? "dark" : "light";
39814
- if (isLocal) {
39815
- const element = "current" in target ? target.current : target;
39991
+ if (isLocal && target) {
39992
+ const element = getElement(target);
39816
39993
  if (element) {
39817
39994
  applyTheme2(element, newTheme);
39818
39995
  setLocalTheme(newTheme);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/react-zen",
3
- "version": "0.218.0",
3
+ "version": "0.220.0",
4
4
  "description": "Modern, minimalist React component library",
5
5
  "homepage": "https://zen.umami.is",
6
6
  "repository": {
package/styles.css CHANGED
@@ -68,6 +68,8 @@
68
68
 
69
69
  [data-theme="dark"],
70
70
  .dark {
71
+ color-scheme: dark;
72
+
71
73
  /* === SURFACES === */
72
74
  --surface-base: oklch(0.205 0 0); /* neutral-900 */
73
75
  --surface-raised: oklch(0.269 0 0); /* neutral-800 */
@@ -119,6 +121,65 @@
119
121
  --status-error-text: oklch(0.936 0.032 17.717); /* red-100 */
120
122
  }
121
123
 
124
+ /* Light theme - for overriding dark parent (must come after dark) */
125
+ [data-theme="light"] {
126
+ color-scheme: light;
127
+
128
+ /* === SURFACES (backgrounds) === */
129
+ --surface-base: #ffffff;
130
+ --surface-raised: oklch(0.985 0 0); /* neutral-50 */
131
+ --surface-sunken: oklch(0.97 0 0); /* neutral-100 */
132
+ --surface-overlay: #ffffff;
133
+ --surface-inverted: oklch(0.205 0 0); /* neutral-900 */
134
+ --surface-disabled: oklch(0.985 0 0); /* neutral-50 */
135
+
136
+ /* === TEXT === */
137
+ --text-primary: oklch(0.205 0 0); /* neutral-900 */
138
+ --text-secondary: oklch(0.439 0 0); /* neutral-600 */
139
+ --text-muted: oklch(0.556 0 0); /* neutral-500 */
140
+ --text-disabled: oklch(0.708 0 0); /* neutral-400 */
141
+ --text-inverted: oklch(0.985 0 0); /* neutral-50 */
142
+ --text-on-primary: #ffffff;
143
+
144
+ /* === BORDERS === */
145
+ --border-default: oklch(0.87 0 0); /* neutral-300 */
146
+ --border-muted: oklch(0.922 0 0); /* neutral-200 */
147
+ --border-strong: oklch(0.708 0 0); /* neutral-400 */
148
+ --border-inverted: oklch(0.205 0 0); /* neutral-900 */
149
+
150
+ /* === INTERACTIVE STATES === */
151
+ --interactive-bg: oklch(0.97 0 0); /* neutral-100 */
152
+ --interactive-bg-hover: oklch(0.922 0 0); /* neutral-200 */
153
+ --interactive-bg-pressed: oklch(0.87 0 0); /* neutral-300 */
154
+ --interactive-bg-selected: oklch(0.205 0 0); /* neutral-900 */
155
+ --interactive-text-selected: #ffffff;
156
+
157
+ /* === FOCUS === */
158
+ --focus-ring: oklch(0.708 0 0); /* neutral-400 */
159
+ --focus-ring-offset: #ffffff;
160
+
161
+ /* === TRACKS (sliders, progress) === */
162
+ --track-bg: oklch(0.922 0 0); /* neutral-200 */
163
+ --track-fill: oklch(0.205 0 0); /* neutral-900 */
164
+
165
+ /* === STATUS COLORS === */
166
+ --status-info: oklch(0.623 0.214 259.815); /* blue-500 */
167
+ --status-info-bg: oklch(0.97 0.014 254.604); /* blue-50 */
168
+ --status-info-text: oklch(0.379 0.146 265.522); /* blue-900 */
169
+
170
+ --status-success: oklch(0.723 0.219 149.579); /* green-500 */
171
+ --status-success-bg: oklch(0.982 0.018 155.826); /* green-50 */
172
+ --status-success-text: oklch(0.393 0.095 152.535); /* green-900 */
173
+
174
+ --status-warning: oklch(0.795 0.184 86.047); /* yellow-500 */
175
+ --status-warning-bg: oklch(0.987 0.026 102.212); /* yellow-50 */
176
+ --status-warning-text: oklch(0.421 0.095 57.708); /* yellow-900 */
177
+
178
+ --status-error: oklch(0.637 0.237 25.331); /* red-500 */
179
+ --status-error-bg: oklch(0.971 0.013 17.38); /* red-50 */
180
+ --status-error-text: oklch(0.396 0.141 25.723); /* red-900 */
181
+ }
182
+
122
183
 
123
184
  /* ./src/components/Dots.css */
124
185
  .zen-dot {