@ankhorage/zora 28.5.0 → 28.5.1

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 (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/features/color/ColorPicker.js +27 -1
  4. package/dist/features/color/ColorPicker.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/features/color/ColorPicker.layout.test.tsx +60 -0
  7. package/src/features/color/ColorPicker.tsx +31 -1
  8. package/web-dist/chunks/{Accordion-x4yhr2wm.js → Accordion-23k6n6zk.js} +1 -1
  9. package/web-dist/chunks/{Accordion-7knb9jk2.js → Accordion-2yat0x6x.js} +2 -1
  10. package/web-dist/chunks/{Accordion-8jw8g2aq.js → Accordion-554f42yj.js} +21 -2
  11. package/web-dist/chunks/{Accordion-be2yhfqz.js → Accordion-5z75befg.js} +12 -4
  12. package/web-dist/chunks/{Accordion-sbdgq8d5.js → Accordion-7nn4r909.js} +15 -8
  13. package/web-dist/chunks/{Accordion-skdtw2er.js → Accordion-7v6mrp8n.js} +2 -2
  14. package/web-dist/chunks/{Accordion-d9sd2vs7.js → Accordion-a5fsrv3x.js} +5 -4
  15. package/web-dist/chunks/{Accordion-kzjq1snp.js → Accordion-d5sz8vaq.js} +1 -1
  16. package/web-dist/chunks/{Accordion-a4dmyntn.js → Accordion-ktscjwa2.js} +1 -1
  17. package/web-dist/chunks/{Accordion-9gk4scdz.js → Accordion-sj1n06dw.js} +1 -1
  18. package/web-dist/components/app-bar/AppBar.js +5 -5
  19. package/web-dist/components/app-header/AppHeader.js +5 -5
  20. package/web-dist/components/color-hue-scale/ColorHueScale.js +4 -4
  21. package/web-dist/components/color-picker/ColorPicker.js +4 -4
  22. package/web-dist/components/color-tone/ColorTone.js +4 -4
  23. package/web-dist/components/color-wheel/ColorWheel.js +4 -4
  24. package/web-dist/components/data-table/DataTable.js +4 -4
  25. package/web-dist/components/date-picker/DatePicker.js +2 -2
  26. package/web-dist/components/dialog/Dialog.js +3 -3
  27. package/web-dist/components/popover/Popover.js +2 -2
  28. package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
  29. package/web-dist/components/reader/Reader.js +6 -6
  30. package/web-dist/components/select/Select.js +3 -3
  31. package/web-dist/components/time-picker/TimePicker.js +2 -2
  32. package/web-dist/components/toast/Toast.js +3 -3
  33. package/web-dist/components/toast-provider/ToastProvider.js +3 -3
  34. package/web-dist/components/uploader/Uploader.js +3 -3
  35. package/web-dist/manifest.json +62 -62
  36. package/web-dist/runtime/ZoraProvider.js +81 -52
@@ -9,8 +9,9 @@ import {
9
9
  sortOverlayEntries,
10
10
  OverlayStackContext,
11
11
  OverlayStackActionsContext,
12
+ OverlayEntryContext,
12
13
  createOverlayEntry
13
- } from "../chunks/Accordion-sbdgq8d5.js";
14
+ } from "../chunks/Accordion-7nn4r909.js";
14
15
  import {
15
16
  useFontRuntime,
16
17
  zoraDefaultTheme,
@@ -24,7 +25,7 @@ import {
24
25
  } from "../chunks/Accordion-9d38cgqj.js";
25
26
  import {
26
27
  ToastProvider3
27
- } from "../chunks/Accordion-a4dmyntn.js";
28
+ } from "../chunks/Accordion-ktscjwa2.js";
28
29
  import"../chunks/Accordion-pdjhezmz.js";
29
30
  import"../chunks/Accordion-9b4bsxwe.js";
30
31
  import"../chunks/Accordion-eqvdv7tt.js";
@@ -46,10 +47,9 @@ import {
46
47
  // node_modules/@ankhorage/surface/src/features/theme/adapters/inbound/ThemeProvider.tsx
47
48
  import { useMemo, useState } from "react";
48
49
 
49
- // node_modules/@ankhorage/surface/src/internal/overlay/OverlayProvider.tsx
50
+ // node_modules/@ankhorage/surface/src/internal/overlay/OverlayStackHost.tsx
50
51
  var import_react_native = __toESM(require_cjs(), 1);
51
- import React from "react";
52
- import { jsx, jsxs } from "react/jsx-runtime";
52
+ import { jsx } from "react/jsx-runtime";
53
53
  import { createElement } from "react";
54
54
  var boxNonePointerEvents = resolvePointerEvents("box-none");
55
55
  var styles = import_react_native.StyleSheet.create({
@@ -61,56 +61,85 @@ var styles = import_react_native.StyleSheet.create({
61
61
  top: 0
62
62
  }
63
63
  });
64
- function OverlayProvider({ children }) {
65
- const orderRef = React.useRef(0);
66
- const [overlays, setOverlays] = React.useState([]);
67
- const setOverlay = React.useCallback((id, descriptor) => {
64
+ function OverlayStackHost({ overlays }) {
65
+ return /* @__PURE__ */ jsx(import_react_native.View, {
66
+ ...boxNonePointerEvents.props,
67
+ style: [boxNonePointerEvents.style, styles.fill],
68
+ children: overlays.map((overlay) => /* @__PURE__ */ createElement(import_react_native.View, {
69
+ ...boxNonePointerEvents.props,
70
+ key: overlay.id,
71
+ style: [boxNonePointerEvents.style, styles.fill, overlayZIndex(overlay.zIndex)]
72
+ }, /* @__PURE__ */ jsx(OverlayEntryContext, {
73
+ value: overlay,
74
+ children: overlay.node
75
+ })))
76
+ });
77
+ }
78
+ function overlayZIndex(zIndex) {
79
+ return { zIndex };
80
+ }
81
+
82
+ // node_modules/@ankhorage/surface/src/internal/overlay/useOverlayStackRuntime.ts
83
+ import React2 from "react";
84
+ function useOverlayStackRuntime() {
85
+ const orderRef = React2.useRef(0);
86
+ const [overlays, setOverlays] = React2.useState([]);
87
+ const overlaysRef = React2.useRef([]);
88
+ React2.useEffect(() => {
89
+ overlaysRef.current = overlays;
90
+ }, [overlays]);
91
+ const setOverlay = React2.useCallback((id, descriptor) => {
68
92
  setOverlays((current) => {
69
93
  const existing = current.find((entry) => entry.id === id);
70
94
  const nextEntry = createOverlayEntry(id, existing?.order ?? orderRef.current++, descriptor);
71
- if (!existing) {
72
- return sortOverlayEntries([...current, nextEntry]);
73
- }
74
- return sortOverlayEntries(current.map((entry) => entry.id === id ? nextEntry : entry));
95
+ const next = !existing ? sortOverlayEntries([...current, nextEntry]) : sortOverlayEntries(current.map((entry) => entry.id === id ? nextEntry : entry));
96
+ overlaysRef.current = next;
97
+ return next;
75
98
  });
76
99
  }, []);
77
- const removeOverlay = React.useCallback((id) => {
78
- setOverlays((current) => current.filter((entry) => entry.id !== id));
100
+ const removeOverlay = React2.useCallback((id) => {
101
+ setOverlays((current) => {
102
+ const next = current.filter((entry) => !isOverlayDescendantOf(entry, id, current));
103
+ overlaysRef.current = next;
104
+ return next;
105
+ });
106
+ }, []);
107
+ const dismissTopmost = React2.useCallback(() => {
108
+ const topmost = overlaysRef.current.at(-1);
109
+ topmost?.onDismiss?.();
79
110
  }, []);
80
- const actions = React.useMemo(() => ({
81
- removeOverlay,
82
- setOverlay
83
- }), [removeOverlay, setOverlay]);
84
- const value = React.useMemo(() => ({
85
- overlays,
86
- removeOverlay,
87
- setOverlay
88
- }), [overlays, removeOverlay, setOverlay]);
89
- return /* @__PURE__ */ jsx(OverlayStackActionsContext, {
111
+ const isTopmost = React2.useCallback((id) => overlaysRef.current.at(-1)?.id === id, []);
112
+ const actions = React2.useMemo(() => ({ dismissTopmost, isTopmost, removeOverlay, setOverlay }), [dismissTopmost, isTopmost, removeOverlay, setOverlay]);
113
+ const value = React2.useMemo(() => ({ dismissTopmost, isTopmost, overlays, removeOverlay, setOverlay }), [dismissTopmost, isTopmost, overlays, removeOverlay, setOverlay]);
114
+ return { actions, value };
115
+ }
116
+ function isOverlayDescendantOf(entry, removedId, overlays) {
117
+ if (entry.id === removedId)
118
+ return true;
119
+ const parent = entry.parentId === undefined ? undefined : overlays.find((item) => item.id === entry.parentId);
120
+ return parent === undefined ? false : isOverlayDescendantOf(parent, removedId, overlays);
121
+ }
122
+
123
+ // node_modules/@ankhorage/surface/src/internal/overlay/OverlayProvider.tsx
124
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
125
+ function OverlayProvider({ children }) {
126
+ const { actions, value } = useOverlayStackRuntime();
127
+ return /* @__PURE__ */ jsx2(OverlayStackActionsContext, {
90
128
  value: actions,
91
129
  children: /* @__PURE__ */ jsxs(OverlayStackContext, {
92
130
  value,
93
131
  children: [
94
132
  children,
95
- /* @__PURE__ */ jsx(import_react_native.View, {
96
- ...boxNonePointerEvents.props,
97
- style: [boxNonePointerEvents.style, styles.fill],
98
- children: overlays.map((overlay) => /* @__PURE__ */ createElement(import_react_native.View, {
99
- ...boxNonePointerEvents.props,
100
- key: overlay.id,
101
- style: [boxNonePointerEvents.style, styles.fill, overlayZIndex(overlay.zIndex)]
102
- }, overlay.node))
133
+ /* @__PURE__ */ jsx2(OverlayStackHost, {
134
+ overlays: value.overlays
103
135
  })
104
136
  ]
105
137
  })
106
138
  });
107
139
  }
108
- function overlayZIndex(zIndex) {
109
- return { zIndex };
110
- }
111
140
 
112
141
  // node_modules/@ankhorage/surface/src/features/theme/adapters/inbound/ThemeProvider.tsx
113
- import { jsx as jsx2 } from "react/jsx-runtime";
142
+ import { jsx as jsx3 } from "react/jsx-runtime";
114
143
  function ThemeProvider({
115
144
  children,
116
145
  initialConfig,
@@ -128,10 +157,10 @@ function ThemeProvider({
128
157
  setThemeConfig: (nextConfig) => setConfig((previous) => deepMerge(previous, nextConfig)),
129
158
  setMode
130
159
  }), [mode, theme]);
131
- return /* @__PURE__ */ jsx2(ResponsiveProvider, {
132
- children: /* @__PURE__ */ jsx2(ThemeRuntimeContext, {
160
+ return /* @__PURE__ */ jsx3(ResponsiveProvider, {
161
+ children: /* @__PURE__ */ jsx3(ThemeRuntimeContext, {
133
162
  value,
134
- children: /* @__PURE__ */ jsx2(OverlayProvider, {
163
+ children: /* @__PURE__ */ jsx3(OverlayProvider, {
135
164
  children
136
165
  })
137
166
  })
@@ -139,7 +168,7 @@ function ThemeProvider({
139
168
  }
140
169
 
141
170
  // src/features/theme/adapters/inbound/ZoraProvider.tsx
142
- import React2 from "react";
171
+ import React3 from "react";
143
172
 
144
173
  // src/features/theme/application/use-cases/createZoraThemeConfig.ts
145
174
  function createZoraThemeConfig(theme = zoraDefaultTheme) {
@@ -159,18 +188,18 @@ function createZoraThemeConfig(theme = zoraDefaultTheme) {
159
188
  }
160
189
 
161
190
  // src/features/theme/composition/ZoraRuntimeCapabilities.web.tsx
162
- import { jsx as jsx3 } from "react/jsx-runtime";
191
+ import { jsx as jsx4 } from "react/jsx-runtime";
163
192
  function ZoraRuntimeCapabilities({ children, toast }) {
164
193
  if (!toast)
165
194
  return children;
166
- return /* @__PURE__ */ jsx3(ToastProvider3, {
195
+ return /* @__PURE__ */ jsx4(ToastProvider3, {
167
196
  ...toast === true ? {} : toast,
168
197
  children
169
198
  });
170
199
  }
171
200
 
172
201
  // src/features/theme/adapters/inbound/ZoraProvider.tsx
173
- import { jsx as jsx4 } from "react/jsx-runtime";
202
+ import { jsx as jsx5 } from "react/jsx-runtime";
174
203
  function ZoraProvider({
175
204
  bottomSheet = false,
176
205
  children,
@@ -180,17 +209,17 @@ function ZoraProvider({
180
209
  mode,
181
210
  toast = false
182
211
  }) {
183
- const resolvedConfig = React2.useMemo(() => themeConfig ?? createZoraThemeConfig(theme), [theme, themeConfig]);
184
- const runtimeValue = React2.useMemo(() => ({ themeId: resolvedConfig.id }), [resolvedConfig.id]);
185
- return /* @__PURE__ */ jsx4(ZoraThemeRuntimeContext, {
212
+ const resolvedConfig = React3.useMemo(() => themeConfig ?? createZoraThemeConfig(theme), [theme, themeConfig]);
213
+ const runtimeValue = React3.useMemo(() => ({ themeId: resolvedConfig.id }), [resolvedConfig.id]);
214
+ return /* @__PURE__ */ jsx5(ZoraThemeRuntimeContext, {
186
215
  value: runtimeValue,
187
- children: /* @__PURE__ */ jsx4(ResponsiveProvider, {
188
- children: /* @__PURE__ */ jsx4(ThemeProvider, {
216
+ children: /* @__PURE__ */ jsx5(ResponsiveProvider, {
217
+ children: /* @__PURE__ */ jsx5(ThemeProvider, {
189
218
  initialConfig: resolvedConfig,
190
219
  initialMode: mode ?? initialMode,
191
- children: /* @__PURE__ */ jsx4(ZoraProviderMode, {
220
+ children: /* @__PURE__ */ jsx5(ZoraProviderMode, {
192
221
  mode,
193
- children: /* @__PURE__ */ jsx4(ZoraRuntimeCapabilities, {
222
+ children: /* @__PURE__ */ jsx5(ZoraRuntimeCapabilities, {
194
223
  bottomSheet,
195
224
  toast,
196
225
  children
@@ -202,7 +231,7 @@ function ZoraProvider({
202
231
  }
203
232
  function ZoraProviderMode({ children, mode }) {
204
233
  const runtime = useTheme();
205
- React2.useEffect(() => {
234
+ React3.useEffect(() => {
206
235
  if (mode !== undefined && runtime.mode !== mode)
207
236
  runtime.setMode(mode);
208
237
  }, [mode, runtime]);