pixelize-design-library 2.4.2-beta.57 → 2.4.2-beta.59

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 (152) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/COMPONENT-GOTCHAS.md +88 -2
  3. package/DESIGN-GUIDE.md +27 -4
  4. package/dist/Components/AppSwitcher/AppSwitcher.js +5 -1
  5. package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +2 -0
  6. package/dist/Components/AppSwitcher/AppSwitcherProps.js +7 -4
  7. package/dist/Components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  8. package/dist/Components/Breadcrumbs/Breadcrumbs.js +33 -10
  9. package/dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts +16 -2
  10. package/dist/Components/Card/Card.d.ts +3 -1
  11. package/dist/Components/Card/Card.js +12 -2
  12. package/dist/Components/Card/CardProps.d.ts +5 -1
  13. package/dist/Components/Commerce/commerceTypes.d.ts +5 -0
  14. package/dist/Components/Editor/Editor.js +50 -2
  15. package/dist/Components/Editor/EditorFieldBar.d.ts +15 -0
  16. package/dist/Components/Editor/EditorFieldBar.js +19 -0
  17. package/dist/Components/Editor/EditorProps.d.ts +74 -1
  18. package/dist/Components/Editor/MakeDynamicDialog.d.ts +12 -0
  19. package/dist/Components/Editor/MakeDynamicDialog.js +59 -0
  20. package/dist/Components/Editor/editorLabels.d.ts +4 -0
  21. package/dist/Components/Editor/editorLabels.js +24 -0
  22. package/dist/Components/Editor/editorTokenStyles.d.ts +28 -0
  23. package/dist/Components/Editor/editorTokenStyles.js +30 -0
  24. package/dist/Components/Editor/editorTokens.d.ts +26 -0
  25. package/dist/Components/Editor/editorTokens.js +134 -0
  26. package/dist/Components/Editor/useEditorBridge.d.ts +40 -0
  27. package/dist/Components/Editor/useEditorBridge.js +141 -0
  28. package/dist/Components/Kbd/Kbd.d.ts +6 -0
  29. package/dist/Components/Kbd/Kbd.js +33 -0
  30. package/dist/Components/Kbd/KbdProps.d.ts +17 -0
  31. package/dist/Components/Kbd/KbdProps.js +2 -0
  32. package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +4 -0
  33. package/dist/Components/LauncherTrigger/LauncherTrigger.js +41 -0
  34. package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +16 -0
  35. package/dist/Components/LauncherTrigger/LauncherTriggerProps.js +2 -0
  36. package/dist/Components/MediaGallery/MediaGallery.js +1 -1
  37. package/dist/Components/NavLauncher/NavLauncher.d.ts +3 -0
  38. package/dist/Components/NavLauncher/NavLauncher.js +395 -0
  39. package/dist/Components/NavLauncher/NavLauncherProps.d.ts +187 -0
  40. package/dist/Components/NavLauncher/NavLauncherProps.js +2 -0
  41. package/dist/Components/NavLauncher/NewTabLink.d.ts +3 -0
  42. package/dist/Components/NavLauncher/NewTabLink.js +14 -0
  43. package/dist/Components/NavLauncher/PinToggle.d.ts +3 -0
  44. package/dist/Components/NavLauncher/PinToggle.js +21 -0
  45. package/dist/Components/NavLauncher/launcherParts.d.ts +93 -0
  46. package/dist/Components/NavLauncher/launcherParts.js +130 -0
  47. package/dist/Components/NavLauncher/match.d.ts +53 -0
  48. package/dist/Components/NavLauncher/match.js +178 -0
  49. package/dist/Components/NavLauncher/revealStyles.d.ts +4 -0
  50. package/dist/Components/NavLauncher/revealStyles.js +19 -0
  51. package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
  52. package/dist/Components/NavigationBar/NavigationBar.js +2 -2
  53. package/dist/Components/NavigationBar/NavigationBarProps.d.ts +2 -0
  54. package/dist/Components/PageHeader/PageHeader.d.ts +1 -1
  55. package/dist/Components/PageHeader/PageHeader.js +9 -2
  56. package/dist/Components/PageHeader/PageHeaderProps.d.ts +8 -0
  57. package/dist/Components/PdfViewer/PdfViewer.d.ts +21 -4
  58. package/dist/Components/PdfViewer/PdfViewer.js +124 -3
  59. package/dist/Components/ProductCard/ProductCard.js +8 -3
  60. package/dist/Components/ProductCard/ProductCardMedia.js +3 -3
  61. package/dist/Components/ProductCard/QuickAddSheet.js +2 -2
  62. package/dist/Components/ProductCard/cardMetrics.d.ts +1 -0
  63. package/dist/Components/ProductCard/cardMetrics.js +3 -2
  64. package/dist/Components/ProductDetails/ProductDetails.d.ts +1 -1
  65. package/dist/Components/ProductDetails/ProductDetails.js +6 -5
  66. package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +2 -0
  67. package/dist/Components/Search/Search.js +2 -1
  68. package/dist/Components/SideBar/SecondaryBar.js +4 -3
  69. package/dist/Components/SideBar/SideBar.d.ts +1 -1
  70. package/dist/Components/SideBar/SideBar.js +30 -9
  71. package/dist/Components/SideBar/SideBarProps.d.ts +32 -0
  72. package/dist/Components/SideBar/components/MenuItemBox.d.ts +6 -0
  73. package/dist/Components/SideBar/components/MenuItemBox.js +8 -4
  74. package/dist/Components/SideBar/components/MenuPopoverContent.js +3 -2
  75. package/dist/Components/SideBar/components/OtherApps.js +2 -1
  76. package/dist/Components/SideBar/components/PinnedSection.d.ts +17 -0
  77. package/dist/Components/SideBar/components/PinnedSection.js +98 -0
  78. package/dist/Components/SideBar/sidebarFocus.d.ts +23 -0
  79. package/dist/Components/SideBar/sidebarFocus.js +20 -0
  80. package/dist/Components/StageProgress/StageProgress.js +2 -2
  81. package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
  82. package/dist/Components/StageProgress/StepperStage.js +5 -2
  83. package/dist/Components/WizardDialog/WizardDialog.d.ts +9 -0
  84. package/dist/Components/WizardDialog/WizardDialog.js +102 -0
  85. package/dist/Components/WizardDialog/WizardDialogProps.d.ts +48 -0
  86. package/dist/Components/WizardDialog/WizardDialogProps.js +2 -0
  87. package/dist/Components/WizardDialog/useWizardFlow.d.ts +22 -0
  88. package/dist/Components/WizardDialog/useWizardFlow.js +47 -0
  89. package/dist/Components/WizardDialog/wizardSteps.d.ts +31 -0
  90. package/dist/Components/WizardDialog/wizardSteps.js +40 -0
  91. package/dist/Hooks/useMatchMedia.d.ts +2 -0
  92. package/dist/Hooks/useMatchMedia.js +36 -0
  93. package/dist/Theme/chakra/motion.js +2 -16
  94. package/dist/Utils/price.js +11 -6
  95. package/dist/esm/Components/AppSwitcher/AppSwitcher.js +2 -1
  96. package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +5 -3
  97. package/dist/esm/Components/Breadcrumbs/Breadcrumbs.js +35 -12
  98. package/dist/esm/Components/Card/Card.js +12 -2
  99. package/dist/esm/Components/Editor/Editor.js +48 -3
  100. package/dist/esm/Components/Editor/EditorFieldBar.js +13 -0
  101. package/dist/esm/Components/Editor/MakeDynamicDialog.js +20 -0
  102. package/dist/esm/Components/Editor/editorLabels.js +20 -0
  103. package/dist/esm/Components/Editor/editorTokenStyles.js +25 -0
  104. package/dist/esm/Components/Editor/editorTokens.js +121 -0
  105. package/dist/esm/Components/Editor/useEditorBridge.js +138 -0
  106. package/dist/esm/Components/Kbd/Kbd.js +28 -0
  107. package/dist/esm/Components/Kbd/KbdProps.js +1 -0
  108. package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +37 -0
  109. package/dist/esm/Components/LauncherTrigger/LauncherTriggerProps.js +1 -0
  110. package/dist/esm/Components/MediaGallery/MediaGallery.js +1 -1
  111. package/dist/esm/Components/NavLauncher/NavLauncher.js +356 -0
  112. package/dist/esm/Components/NavLauncher/NavLauncherProps.js +1 -0
  113. package/dist/esm/Components/NavLauncher/NewTabLink.js +11 -0
  114. package/dist/esm/Components/NavLauncher/PinToggle.js +18 -0
  115. package/dist/esm/Components/NavLauncher/launcherParts.js +110 -0
  116. package/dist/esm/Components/NavLauncher/match.js +172 -0
  117. package/dist/esm/Components/NavLauncher/revealStyles.js +15 -0
  118. package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
  119. package/dist/esm/Components/PageHeader/PageHeader.js +9 -2
  120. package/dist/esm/Components/PdfViewer/PdfViewer.js +123 -2
  121. package/dist/esm/Components/ProductCard/ProductCard.js +9 -4
  122. package/dist/esm/Components/ProductCard/ProductCardMedia.js +3 -3
  123. package/dist/esm/Components/ProductCard/QuickAddSheet.js +2 -2
  124. package/dist/esm/Components/ProductCard/cardMetrics.js +2 -1
  125. package/dist/esm/Components/ProductDetails/ProductDetails.js +6 -5
  126. package/dist/esm/Components/Search/Search.js +3 -2
  127. package/dist/esm/Components/SideBar/SecondaryBar.js +4 -3
  128. package/dist/esm/Components/SideBar/SideBar.js +31 -10
  129. package/dist/esm/Components/SideBar/components/MenuItemBox.js +4 -2
  130. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +3 -2
  131. package/dist/esm/Components/SideBar/components/OtherApps.js +2 -1
  132. package/dist/esm/Components/SideBar/components/PinnedSection.js +92 -0
  133. package/dist/esm/Components/SideBar/sidebarFocus.js +15 -0
  134. package/dist/esm/Components/StageProgress/StageProgress.js +2 -2
  135. package/dist/esm/Components/StageProgress/StepperStage.js +5 -2
  136. package/dist/esm/Components/WizardDialog/WizardDialog.js +58 -0
  137. package/dist/esm/Components/WizardDialog/WizardDialogProps.js +1 -0
  138. package/dist/esm/Components/WizardDialog/useWizardFlow.js +44 -0
  139. package/dist/esm/Components/WizardDialog/wizardSteps.js +35 -0
  140. package/dist/esm/Hooks/useMatchMedia.js +32 -0
  141. package/dist/esm/Theme/chakra/motion.js +2 -16
  142. package/dist/esm/Utils/price.js +11 -6
  143. package/dist/esm/index.js +7 -0
  144. package/dist/index.d.ts +19 -4
  145. package/dist/index.js +21 -1
  146. package/package.json +1 -1
  147. package/dist/Components/MediaGallery/useMatchMedia.d.ts +0 -2
  148. package/dist/Components/MediaGallery/useMatchMedia.js +0 -20
  149. package/dist/Components/ProductCard/useMinWidth.d.ts +0 -2
  150. package/dist/Components/ProductCard/useMinWidth.js +0 -20
  151. package/dist/esm/Components/MediaGallery/useMatchMedia.js +0 -16
  152. package/dist/esm/Components/ProductCard/useMinWidth.js +0 -16
@@ -0,0 +1,172 @@
1
+ const normalize = (text) => text.toLocaleLowerCase().normalize("NFKD");
2
+ function score(label, haystack, tokens) {
3
+ if (!tokens.every((t) => haystack.includes(t)))
4
+ return null;
5
+ const l = normalize(label);
6
+ const q = tokens.join(" ");
7
+ if (l === q)
8
+ return 0;
9
+ if (l.startsWith(q))
10
+ return 1;
11
+ if (l.split(/\s+/).some((w) => w.startsWith(tokens[0])))
12
+ return 2;
13
+ return l.includes(tokens[0]) ? 3 : 4;
14
+ }
15
+ function rank(rows, text, tokens) {
16
+ return rows
17
+ .map((row, index) => ({
18
+ row,
19
+ index,
20
+ s: score(row.label, normalize(text(row)), tokens),
21
+ }))
22
+ .filter((r) => r.s !== null)
23
+ .sort((a, b) => a.s - b.s || a.index - b.index)
24
+ .map((r) => r.row);
25
+ }
26
+ export function flattenScreens(sections) {
27
+ var _a, _b, _c;
28
+ const seen = new Set();
29
+ const out = [];
30
+ for (const section of sections) {
31
+ for (const module of section.modules) {
32
+ for (const screen of module.screens) {
33
+ if (seen.has(screen.id))
34
+ continue;
35
+ seen.add(screen.id);
36
+ out.push({
37
+ id: `screen:${screen.id}`,
38
+ screenId: screen.id,
39
+ label: screen.label,
40
+ context: screen.label === module.label ? section.label : module.label,
41
+ icon: (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon,
42
+ badge: screen.badge,
43
+ href: screen.href,
44
+ keywords: [module.label, ...((_b = module.keywords) !== null && _b !== void 0 ? _b : []), ...((_c = screen.keywords) !== null && _c !== void 0 ? _c : [])].join(" "),
45
+ });
46
+ }
47
+ }
48
+ }
49
+ return out;
50
+ }
51
+ export function searchLauncher(input) {
52
+ var _a, _b;
53
+ const tokens = normalize(input.query).split(/\s+/).filter(Boolean);
54
+ if (tokens.length === 0)
55
+ return [];
56
+ const screens = flattenScreens(input.sections);
57
+ const actions = rank(((_a = input.actions) !== null && _a !== void 0 ? _a : []).map((a) => ({ ...a, id: `action:${a.id}` })), (a) => { var _a, _b; return `${a.label} ${(_a = a.context) !== null && _a !== void 0 ? _a : ""} ${(_b = a.keywords) !== null && _b !== void 0 ? _b : ""}`; }, tokens);
58
+ const groups = [
59
+ { id: "actions", label: input.actionsLabel, items: actions },
60
+ {
61
+ id: "screens",
62
+ label: input.screensLabel,
63
+ items: rank(screens, (s) => { var _a; return `${s.label} ${(_a = s.context) !== null && _a !== void 0 ? _a : ""} ${s.keywords}`; }, tokens),
64
+ },
65
+ ...((_b = input.extraResults) !== null && _b !== void 0 ? _b : []).map((g) => ({
66
+ id: g.id,
67
+ label: g.label,
68
+ items: g.items.map((i) => ({ ...i, id: `${g.id}:${i.id}` })),
69
+ })),
70
+ ];
71
+ return groups.filter((g) => g.items.length > 0);
72
+ }
73
+ function matchNameOrKeyword(label, keywords, tokens) {
74
+ const name = normalize(label);
75
+ if (tokens.every((t) => name.includes(t)))
76
+ return {};
77
+ const terms = keywords.map(normalize);
78
+ const all = `${name} ${terms.join(" ")}`;
79
+ if (!tokens.every((t) => all.includes(t)))
80
+ return null;
81
+ const hit = keywords.find((_, i) => tokens.some((t) => terms[i].includes(t)));
82
+ return { keyword: hit !== null && hit !== void 0 ? hit : keywords[0] };
83
+ }
84
+ /** Search that keeps the sections: per section, matching modules, each followed by its matching screens. */
85
+ export function searchLauncherSections(input) {
86
+ var _a, _b, _c, _d, _e, _f;
87
+ const tokens = normalize(input.query).split(/\s+/).filter(Boolean);
88
+ if (tokens.length === 0)
89
+ return { sections: [], groups: [] };
90
+ const seen = new Set();
91
+ const sections = [];
92
+ for (const section of input.sections) {
93
+ const items = [];
94
+ for (const module of section.modules) {
95
+ const moduleHit = matchNameOrKeyword(module.label, (_a = module.keywords) !== null && _a !== void 0 ? _a : [], tokens);
96
+ if (moduleHit) {
97
+ items.push({
98
+ id: `module:${module.id}`,
99
+ kind: "module",
100
+ label: module.label,
101
+ keywordHint: moduleHit.keyword,
102
+ icon: module.icon,
103
+ badge: module.badge,
104
+ isNew: module.isNew,
105
+ href: module.href,
106
+ screenId: (_b = module.screens[0]) === null || _b === void 0 ? void 0 : _b.id,
107
+ });
108
+ }
109
+ for (const screen of module.screens) {
110
+ if (screen.label === module.label || seen.has(screen.id))
111
+ continue;
112
+ if (!matchNameOrKeyword(screen.label, (_c = screen.keywords) !== null && _c !== void 0 ? _c : [], tokens))
113
+ continue;
114
+ seen.add(screen.id);
115
+ items.push({
116
+ id: `screen:${screen.id}`,
117
+ kind: "screen",
118
+ label: screen.label,
119
+ context: module.label,
120
+ icon: (_d = screen.icon) !== null && _d !== void 0 ? _d : module.icon,
121
+ badge: screen.badge,
122
+ href: screen.href,
123
+ });
124
+ }
125
+ }
126
+ if (items.length > 0)
127
+ sections.push({ id: section.id, label: section.label, items });
128
+ }
129
+ const actions = rank(((_e = input.actions) !== null && _e !== void 0 ? _e : []).map((a) => ({ ...a, id: `action:${a.id}` })), (a) => { var _a, _b; return `${a.label} ${(_a = a.context) !== null && _a !== void 0 ? _a : ""} ${(_b = a.keywords) !== null && _b !== void 0 ? _b : ""}`; }, tokens);
130
+ const groups = [
131
+ { id: "actions", label: input.actionsLabel, items: actions },
132
+ ...((_f = input.extraResults) !== null && _f !== void 0 ? _f : []).map((g) => ({
133
+ id: g.id,
134
+ label: g.label,
135
+ items: g.items.map((i) => ({ ...i, id: `${g.id}:${i.id}` })),
136
+ })),
137
+ ].filter((g) => g.items.length > 0);
138
+ return { sections, groups };
139
+ }
140
+ /** Splits `text` so every case-insensitive occurrence of a query token is its own matched segment. */
141
+ export function highlightSegments(text, query) {
142
+ const lower = text.toLocaleLowerCase();
143
+ const tokens = query.toLocaleLowerCase().split(/\s+/).filter(Boolean);
144
+ if (tokens.length === 0 || lower.length !== text.length)
145
+ return [{ text, isMatch: false }];
146
+ const ranges = [];
147
+ for (const token of tokens) {
148
+ for (let at = lower.indexOf(token); at !== -1; at = lower.indexOf(token, at + token.length)) {
149
+ ranges.push([at, at + token.length]);
150
+ }
151
+ }
152
+ ranges.sort((a, b) => a[0] - b[0]);
153
+ const merged = [];
154
+ for (const range of ranges) {
155
+ const last = merged[merged.length - 1];
156
+ if (last && range[0] <= last[1])
157
+ last[1] = Math.max(last[1], range[1]);
158
+ else
159
+ merged.push([...range]);
160
+ }
161
+ const out = [];
162
+ let cursor = 0;
163
+ for (const [start, end] of merged) {
164
+ if (start > cursor)
165
+ out.push({ text: text.slice(cursor, start), isMatch: false });
166
+ out.push({ text: text.slice(start, end), isMatch: true });
167
+ cursor = end;
168
+ }
169
+ if (cursor < text.length)
170
+ out.push({ text: text.slice(cursor), isMatch: false });
171
+ return out.length ? out : [{ text, isMatch: false }];
172
+ }
@@ -0,0 +1,15 @@
1
+ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
2
+ import { reducedMotionSx } from "../../Theme/chakra/motion.js";
3
+ /** Shows a row affordance on row hover, row focus-within or its own keyboard focus, and always on touch. */
4
+ export const revealStyles = (colors) => {
5
+ const ring = focusVisibleStyles(colors);
6
+ return {
7
+ ...ring,
8
+ _focusVisible: { ...ring._focusVisible, opacity: 1 },
9
+ _groupHover: { opacity: 1 },
10
+ _groupFocusWithin: { opacity: 1 },
11
+ "[data-reveal=true] &": { opacity: 1 },
12
+ "@media (hover: none)": { opacity: 1 },
13
+ ...reducedMotionSx(),
14
+ };
15
+ };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Button, Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Stack, Text, } from "@chakra-ui/react";
3
3
  import Avatar from "../Avatar/Avatar.js";
4
4
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
@@ -10,7 +10,7 @@ import PersonChip from "../PersonChip/PersonChip.js";
10
10
  import { CircleArrowLeft, LogOut, PanelLeftClose, PanelRightClose, } from "lucide-react";
11
11
  // Roomy enough to hover without aiming: the glyph is only 1.25rem.
12
12
  const SIDEBAR_TOGGLE_HIT = "2.5rem";
13
- export default function NavBar({ userAvathar, userName, userRole, navMenu, moreIcon, handleNavOnClick, handleLogout, logoutText, navigationBarText, sideBarToggole, onSideBarToggole, forceSideBarToggle = false, onSideBarPeek, }) {
13
+ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreIcon, handleNavOnClick, handleLogout, logoutText, navigationBarText, sideBarToggole, onSideBarToggole, forceSideBarToggle = false, onSideBarPeek, leading, }) {
14
14
  const theme = useCustomTheme();
15
15
  const rowBackgrounds = listRowBackgrounds(theme.colors);
16
16
  const menuHoverBg = rowBackgrounds.active;
@@ -46,7 +46,7 @@ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreI
46
46
  _focus: { bg: menuHoverBg },
47
47
  _active: { bg: rowBackgrounds.selectedActive },
48
48
  };
49
- return (_jsx(Box, { bg: theme.colors.backgroundColor.light, px: 4, borderBottom: "1px solid", borderColor: theme.colors.boxborder[200], children: _jsxs(Flex, { h: 16, alignItems: "center", justifyContent: "space-between", children: [_jsxs(Box, { display: "flex", gap: 1.5, alignItems: "center", children: [_jsx(Box, { as: "button", type: "button", onClick: () => onSideBarToggole === null || onSideBarToggole === void 0 ? void 0 : onSideBarToggole(), onMouseEnter: onSideBarPeek, onFocus: onSideBarPeek, "aria-label": sideBarToggole ? "Close navigation menu" : "Open navigation menu", "aria-expanded": !!sideBarToggole, ...iconButtonStyle, display: forceSideBarToggle ? "flex" : { base: "flex", lg: "none" }, w: SIDEBAR_TOGGLE_HIT, h: SIDEBAR_TOGGLE_HIT, children: sideBarToggole ? (_jsx(PanelLeftClose, { size: "1.25rem" })) : (_jsx(PanelRightClose, { size: "1.25rem" })) }), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) && (_jsx(Box, { ...iconButtonStyle, as: "button", type: "button", "aria-label": "Go back", display: "flex", onClick: () => { var _a; return (_a = navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) === null || _a === void 0 ? void 0 : _a.call(navigationBarText); }, children: _jsx(CircleArrowLeft, { size: "1.25rem", color: theme.colors.text[500] }) })), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text) && (_jsx(Text, { color: accentTextOnCanvas(theme.colors.secondary, theme.colors.backgroundColor.light), fontSize: "1.25rem", fontWeight: 600, fontFamily: "open-sans, sans-serif", letterSpacing: "-0.013rem", children: navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text }))] }), _jsx(Flex, { minW: 0, flexShrink: 1, children: _jsxs(Stack, { direction: "row", alignItems: "center", spacing: 4, minW: 0, children: [moreIcon && (_jsx(Box, { display: "flex", alignItems: "center", minW: 0, children: moreIcon })), _jsxs(Menu, { children: [_jsx(MenuButton, { as: Button, rounded: "full", variant: "link", cursor: "pointer", minW: 0, flexShrink: 0, children: _jsx(Avatar, { size: "sm", name: userName, src: userAvathar }) }), _jsx(MenuList, { alignItems: "center", zIndex: 5, p: 0, py: "0.375rem",
49
+ return (_jsx(Box, { bg: theme.colors.backgroundColor.light, px: 4, borderBottom: "1px solid", borderColor: theme.colors.boxborder[200], children: _jsxs(Flex, { h: 16, alignItems: "center", justifyContent: "space-between", children: [_jsxs(Box, { display: "flex", gap: 1.5, alignItems: "center", children: [_jsx(Box, { as: "button", type: "button", onClick: () => onSideBarToggole === null || onSideBarToggole === void 0 ? void 0 : onSideBarToggole(), onMouseEnter: onSideBarPeek, onFocus: onSideBarPeek, "aria-label": sideBarToggole ? "Close navigation menu" : "Open navigation menu", "aria-expanded": !!sideBarToggole, ...iconButtonStyle, display: forceSideBarToggle ? "flex" : { base: "flex", lg: "none" }, w: SIDEBAR_TOGGLE_HIT, h: SIDEBAR_TOGGLE_HIT, children: sideBarToggole ? (_jsx(PanelLeftClose, { size: "1.25rem" })) : (_jsx(PanelRightClose, { size: "1.25rem" })) }), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) && (_jsx(Box, { ...iconButtonStyle, as: "button", type: "button", "aria-label": "Go back", display: "flex", onClick: () => { var _a; return (_a = navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) === null || _a === void 0 ? void 0 : _a.call(navigationBarText); }, children: _jsx(CircleArrowLeft, { size: "1.25rem", color: theme.colors.text[500] }) })), leading && (_jsxs(_Fragment, { children: [leading, _jsx(Box, { as: "span", "aria-hidden": "true", mx: 2, w: "1px", h: "1.625rem", bg: theme.colors.boxborder[200] })] })), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text) && (_jsx(Text, { color: accentTextOnCanvas(theme.colors.secondary, theme.colors.backgroundColor.light), fontSize: "1.25rem", fontWeight: 600, fontFamily: "open-sans, sans-serif", letterSpacing: "-0.013rem", children: navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text }))] }), _jsx(Flex, { minW: 0, flexShrink: 1, children: _jsxs(Stack, { direction: "row", alignItems: "center", spacing: 4, minW: 0, children: [moreIcon && (_jsx(Box, { display: "flex", alignItems: "center", minW: 0, children: moreIcon })), _jsxs(Menu, { children: [_jsx(MenuButton, { as: Button, rounded: "full", variant: "link", cursor: "pointer", minW: 0, flexShrink: 0, children: _jsx(Avatar, { size: "sm", name: userName, src: userAvathar }) }), _jsx(MenuList, { alignItems: "center", zIndex: 5, p: 0, py: "0.375rem",
50
50
  // Without a cap one long title stretches the whole dropdown; titles truncate instead.
51
51
  maxW: "18rem", bg: theme.colors.surfaceRaised,
52
52
  // NOTE: Chakra's MenuItem inherits --menu-bg hardcoded to #fff via dead _dark — set it or items stay white.
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Flex, Heading, Text } from "@chakra-ui/react";
3
3
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
4
+ const TITLE_STYLES = {
5
+ md: { fontSize: "lg", fontWeight: 600, letterSpacing: "-0.01em" },
6
+ lg: { fontSize: "2xl", fontWeight: 700, letterSpacing: "-0.02em", lineHeight: 1.2 },
7
+ xl: { fontSize: { base: "2xl", md: "3xl" }, fontWeight: 700, letterSpacing: "-0.025em", lineHeight: 1.2 },
8
+ };
4
9
  /** Page header: h1 title, muted subtitle, right-aligned actions that wrap under on narrow screens. */
5
- const PageHeader = ({ title, subtitle, actions, breadcrumbs, leading, titleAddon, meta, tabs, "data-testid": testId, }) => {
10
+ const PageHeader = ({ title, subtitle, actions, breadcrumbs, leading, titleAddon, meta, tabs, titleSize = "md", actionsLayout = "auto", "data-testid": testId, }) => {
6
11
  const { colors } = useCustomTheme();
7
- return (_jsxs(Flex, { direction: "column", gap: 3, "data-testid": testId, children: [breadcrumbs && (_jsx(Box, { fontSize: "sm", color: colors.textMuted, sx: { "[aria-current=page]": { color: colors.text[800] } }, children: breadcrumbs })), _jsxs(Flex, { justify: "space-between", align: { base: "flex-start", md: "center" }, direction: { base: "column", md: "row" }, gap: 3, children: [_jsxs(Flex, { gap: 3, align: "center", minW: 0, children: [leading && _jsx(Box, { flexShrink: 0, children: leading }), _jsxs(Box, { minW: 0, children: [_jsxs(Flex, { align: "center", gap: 2, wrap: "wrap", children: [_jsx(Heading, { as: "h1", fontSize: "lg", fontWeight: 600, letterSpacing: "-0.01em", color: colors.header[900], children: title }), titleAddon] }), subtitle && (_jsx(Text, { mt: 0.5, fontSize: "sm", color: colors.textMuted, children: subtitle })), meta && (_jsx(Flex, { mt: 1, columnGap: 4, rowGap: 1, wrap: "wrap", align: "center", fontSize: "xs", color: colors.textMuted, children: meta }))] })] }), actions && (_jsx(Flex, { gap: 2, wrap: "wrap", align: "center", flexShrink: 0, children: actions }))] }), tabs && _jsx(Box, { children: tabs })] }));
12
+ const wraps = actionsLayout === "auto";
13
+ const stacked = actionsLayout === "stacked";
14
+ return (_jsxs(Flex, { direction: "column", gap: 3, "data-testid": testId, children: [breadcrumbs && (_jsx(Box, { fontSize: "sm", color: colors.textMuted, sx: { "[aria-current=page]": { color: colors.text[800] } }, children: breadcrumbs })), _jsxs(Flex, { justify: "space-between", align: stacked ? "flex-start" : { base: "flex-start", md: "center" }, direction: stacked ? "column" : { base: "column", md: "row" }, wrap: wraps ? "wrap" : "nowrap", gap: 3, children: [_jsxs(Flex, { gap: 3, align: "center", minW: 0, flex: wraps ? { base: "0 1 auto", md: "1 1 16rem" } : undefined, children: [leading && _jsx(Box, { flexShrink: 0, children: leading }), _jsxs(Box, { minW: 0, children: [_jsxs(Flex, { align: "center", gap: 2, wrap: "wrap", children: [_jsx(Heading, { as: "h1", ...TITLE_STYLES[titleSize], color: colors.header[900], children: title }), titleAddon] }), subtitle && (_jsx(Text, { mt: 0.5, fontSize: "sm", color: colors.textMuted, children: subtitle })), meta && (_jsx(Flex, { mt: 1, columnGap: 4, rowGap: 1, wrap: "wrap", align: "center", fontSize: "xs", color: colors.textMuted, children: meta }))] })] }), actions && (_jsx(Flex, { gap: 2, wrap: "wrap", align: "center", flexShrink: wraps ? undefined : 0, children: actions }))] }), tabs && _jsx(Box, { children: tabs })] }));
8
15
  };
9
16
  export default PageHeader;
@@ -1,16 +1,137 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
2
3
  import { Box, Flex, Text } from "@chakra-ui/react";
3
4
  import { Download, ExternalLink, FileText } from "lucide-react";
4
5
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
5
6
  import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
6
7
  import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
8
+ import Button from "../Button/Button.js";
9
+ import Skeletons from "../Skeletons/Skeletons.js";
7
10
  import ToolTip from "../ToolTip/ToolTip.js";
11
+ const DEFAULT_LABELS = {
12
+ open: "Open in new tab",
13
+ download: "Download",
14
+ unsupported: "This browser can't display PDFs inline. Open or download the file instead.",
15
+ failed: "The document could not be loaded.",
16
+ };
17
+ const canEmbedPdf = () => typeof navigator === "undefined" || navigator.pdfViewerEnabled !== false;
18
+ const asPdf = (blob) => (blob.type ? blob : new Blob([blob], { type: "application/pdf" }));
8
19
  /** Always-inline PDF embed panel (never a modal) — for a modal previewer of images/video/other too, use FilePreview. */
9
- const PdfViewer = ({ pdfUrl, fileName = "Document.pdf", height = "480px", showToolbar = true, borderRadius = "xl", }) => {
20
+ const PdfViewer = ({ pdfUrl, getBlob, fileName = "Document.pdf", height = "480px", showToolbar = true, borderRadius = "xl", fallback, onLoad, onError, labels, "data-testid": testId, }) => {
10
21
  const theme = useCustomTheme();
22
+ const text = { ...DEFAULT_LABELS, ...labels };
11
23
  const toolbarSurface = theme.colors.background[50];
12
24
  const iconHoverInk = accentTextOnCanvas(theme.colors.primary, toolbarSurface);
13
25
  const iconHoverBg = listRowBackgrounds(theme.colors).active;
14
- return (_jsxs(Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], children: [showToolbar && (_jsxs(Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.background[50], children: [_jsxs(Flex, { align: "center", gap: 2, minW: 0, children: [_jsx(FileText, { size: 18, color: theme.colors.accentText }), _jsx(Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), _jsxs(Flex, { align: "center", gap: 1, children: [_jsx(ToolTip, { label: "Open in new tab", placement: "top", children: _jsx(Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": `Open ${fileName} in a new tab`, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: _jsx(ExternalLink, { size: 16 }) }) }), _jsx(ToolTip, { label: "Download", placement: "top", children: _jsx(Box, { as: "a", href: pdfUrl, download: fileName, "aria-label": `Download ${fileName}`, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: _jsx(Download, { size: 16 }) }) })] })] })), _jsx(Box, { as: "embed", src: pdfUrl, type: "application/pdf", width: "100%", height: height, display: "block" })] }));
26
+ const supported = canEmbedPdf();
27
+ const isBlobMode = Boolean(getBlob);
28
+ const getBlobRef = useRef(getBlob);
29
+ const onLoadRef = useRef(onLoad);
30
+ const onErrorRef = useRef(onError);
31
+ getBlobRef.current = getBlob;
32
+ onLoadRef.current = onLoad;
33
+ onErrorRef.current = onError;
34
+ const [status, setStatus] = useState(isBlobMode && supported ? "loading" : "idle");
35
+ const [objectUrl, setObjectUrl] = useState(null);
36
+ const tempUrls = useRef([]);
37
+ useEffect(() => {
38
+ var _a;
39
+ if (!isBlobMode || !supported)
40
+ return undefined;
41
+ let cancelled = false;
42
+ let created = null;
43
+ setStatus("loading");
44
+ setObjectUrl(null);
45
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
46
+ var _a;
47
+ if (cancelled)
48
+ return;
49
+ created = URL.createObjectURL(asPdf(blob));
50
+ setObjectUrl(created);
51
+ setStatus("ready");
52
+ (_a = onLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadRef);
53
+ }, (error) => {
54
+ var _a;
55
+ if (cancelled)
56
+ return;
57
+ setStatus("error");
58
+ (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
59
+ });
60
+ return () => {
61
+ cancelled = true;
62
+ if (created)
63
+ URL.revokeObjectURL(created);
64
+ };
65
+ }, [isBlobMode, supported]);
66
+ useEffect(() => () => {
67
+ tempUrls.current.forEach((url) => URL.revokeObjectURL(url));
68
+ tempUrls.current = [];
69
+ }, []);
70
+ const makeTempUrl = useCallback((blob) => {
71
+ const url = URL.createObjectURL(asPdf(blob));
72
+ tempUrls.current.push(url);
73
+ return url;
74
+ }, []);
75
+ const openBlob = () => {
76
+ var _a;
77
+ if (objectUrl) {
78
+ window.open(objectUrl, "_blank", "noopener");
79
+ return;
80
+ }
81
+ const tab = window.open("", "_blank");
82
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
83
+ const url = makeTempUrl(blob);
84
+ if (tab)
85
+ tab.location.href = url;
86
+ else
87
+ window.location.assign(url);
88
+ }, (error) => {
89
+ var _a;
90
+ tab === null || tab === void 0 ? void 0 : tab.close();
91
+ (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
92
+ });
93
+ };
94
+ const downloadBlob = () => {
95
+ var _a;
96
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
97
+ const link = document.createElement("a");
98
+ link.href = makeTempUrl(blob);
99
+ link.download = fileName;
100
+ document.body.appendChild(link);
101
+ link.click();
102
+ link.remove();
103
+ }, (error) => { var _a; return (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error); });
104
+ };
105
+ const toolbarLabel = (kind) => {
106
+ if (labels === null || labels === void 0 ? void 0 : labels[kind])
107
+ return `${labels[kind]} ${fileName}`;
108
+ return kind === "open" ? `Open ${fileName} in a new tab` : `Download ${fileName}`;
109
+ };
110
+ const actionStyle = {
111
+ p: 2,
112
+ borderRadius: "lg",
113
+ color: theme.colors.gray[600],
114
+ _hover: { bg: iconHoverBg, color: iconHoverInk },
115
+ };
116
+ const openAction = isBlobMode ? (_jsx(Box, { as: "button", type: "button", onClick: openBlob, "aria-label": toolbarLabel("open"), ...actionStyle, children: _jsx(ExternalLink, { size: 16, "aria-hidden": "true" }) })) : (_jsx(Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": toolbarLabel("open"), ...actionStyle, children: _jsx(ExternalLink, { size: 16, "aria-hidden": "true" }) }));
117
+ const downloadAction = isBlobMode && !objectUrl ? (_jsx(Box, { as: "button", type: "button", onClick: downloadBlob, "aria-label": toolbarLabel("download"), ...actionStyle, children: _jsx(Download, { size: 16, "aria-hidden": "true" }) })) : (_jsx(Box, { as: "a", href: objectUrl !== null && objectUrl !== void 0 ? objectUrl : pdfUrl, download: fileName, "aria-label": toolbarLabel("download"), ...actionStyle, children: _jsx(Download, { size: 16, "aria-hidden": "true" }) }));
118
+ const showFallback = !supported || status === "error";
119
+ const isLoading = isBlobMode && supported && status === "loading";
120
+ const renderFallback = () => {
121
+ if (fallback !== undefined)
122
+ return fallback;
123
+ return (_jsxs(Flex, { direction: "column", align: "flex-start", gap: 3, p: 4, "data-testid": "pdf-fallback", children: [_jsx(Text, { role: "status", fontSize: "sm", color: theme.colors.textMuted, children: supported ? text.failed : text.unsupported }), !showToolbar && (_jsxs(Flex, { gap: 2, wrap: "wrap", children: [_jsx(Button, { variant: "outline", colorScheme: "gray", leftIcon: _jsx(ExternalLink, { size: 16, "aria-hidden": "true" }), label: text.open, onClick: isBlobMode ? openBlob : () => window.open(pdfUrl, "_blank", "noopener"), "data-testid": "pdf-open" }), _jsx(Button, { variant: "outline", colorScheme: "gray", leftIcon: _jsx(Download, { size: 16, "aria-hidden": "true" }), label: text.download, onClick: isBlobMode ? downloadBlob : directDownload(pdfUrl, fileName), "data-testid": "pdf-download" })] }))] }));
124
+ };
125
+ return (_jsxs(Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], "data-testid": testId, children: [showToolbar && (_jsxs(Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.background[50], children: [_jsxs(Flex, { align: "center", gap: 2, minW: 0, children: [_jsx(FileText, { size: 18, color: theme.colors.accentText, "aria-hidden": "true" }), _jsx(Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), _jsxs(Flex, { align: "center", gap: 1, children: [_jsx(ToolTip, { label: text.open, placement: "top", children: openAction }), _jsx(ToolTip, { label: text.download, placement: "top", children: downloadAction })] })] })), showFallback ? (renderFallback()) : isLoading ? (_jsx(Box, { "aria-busy": "true", "data-testid": "pdf-loading", children: _jsx(Skeletons, { type: "skeleton", height: height, width: "100%", borderRadius: "0" }) })) : (_jsx(Box, { as: "embed", src: objectUrl !== null && objectUrl !== void 0 ? objectUrl : pdfUrl, type: "application/pdf", title: fileName, onLoad: isBlobMode ? undefined : () => { var _a; return (_a = onLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadRef); }, width: "100%", height: height, display: "block" }))] }));
126
+ };
127
+ const directDownload = (url, fileName) => () => {
128
+ if (!url)
129
+ return;
130
+ const link = document.createElement("a");
131
+ link.href = url;
132
+ link.download = fileName;
133
+ document.body.appendChild(link);
134
+ link.click();
135
+ link.remove();
15
136
  };
16
137
  export default PdfViewer;
@@ -13,7 +13,8 @@ import StockStatus from "../StockStatus/StockStatus.js";
13
13
  import WishlistToggle from "../WishlistToggle/WishlistToggle.js";
14
14
  import { optionInk } from "../OptionChip/optionInk.js";
15
15
  import { DEFAULT_LABELS } from "./cardLabels.js";
16
- import { DENSITY, FINE_POINTER, MEDIA_RADIUS, TITLE_LINES } from "./cardMetrics.js";
16
+ import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
17
+ import { DENSITY, FINE_POINTER, FINE_POINTER_QUERY, MEDIA_RADIUS, TITLE_LINES } from "./cardMetrics.js";
17
18
  import { DEFAULT_SWATCH_LIMIT, deriveAction, framesFor, lowStockCount, rangeOf, soleVariantOf, swatchAxisOf, valueSoldOut, variantsFor, isSoldOut, } from "./productCardModel.js";
18
19
  import ProductCardAction from "./ProductCardAction.js";
19
20
  import ProductCardMedia from "./ProductCardMedia.js";
@@ -30,6 +31,7 @@ const ProductCard = (props) => {
30
31
  const reduced = usePrefersReducedMotion();
31
32
  const titleId = useId();
32
33
  const [sheetOpen, setSheetOpen] = useState(false);
34
+ const [sheetMounted, setSheetMounted] = useState(false);
33
35
  const [picked, setPicked] = useState(null);
34
36
  const [previewed, setPreviewed] = useState(null);
35
37
  const [innerQuantity, setInnerQuantity] = useState(0);
@@ -66,8 +68,10 @@ const ProductCard = (props) => {
66
68
  const press = () => {
67
69
  if (action === "notify")
68
70
  onNotify === null || onNotify === void 0 ? void 0 : onNotify();
69
- else if (action === "options")
71
+ else if (action === "options") {
72
+ setSheetMounted(true);
70
73
  setSheetOpen(true);
74
+ }
71
75
  else
72
76
  add();
73
77
  };
@@ -84,7 +88,8 @@ const ProductCard = (props) => {
84
88
  const slotted = horizontal ? (_jsx(Box, { "data-control": true, position: "relative", zIndex: 2, children: actions })) : (_jsx(Box, { "data-control": true, position: "absolute", right: m.actionInset, bottom: m.actionInset, zIndex: 2, children: actions }));
85
89
  const control = actions ? slotted : defaultControl;
86
90
  const wishlist = (_jsx(WishlistToggle, { variant: horizontal ? "soft" : "glass", size: "md", label: copy.save(title), selected: wishlisted, onSelectedChange: onWishlistChange }));
87
- const hoverFrame = previewed === null ? frames[1] : undefined;
91
+ const canHover = useMatchMedia(FINE_POINTER_QUERY, true);
92
+ const hoverFrame = previewed === null && canHover ? frames[1] : undefined;
88
93
  const pressable = interactive && !reduced;
89
94
  const ink = optionInk(colors).selected;
90
95
  const metaLine = meta !== null && meta !== void 0 ? meta : (left !== undefined ? _jsx(StockStatus, { status: "low-stock", count: left, size: "sm" }) : null);
@@ -105,7 +110,7 @@ const ProductCard = (props) => {
105
110
  outline: "none",
106
111
  "&::after": { content: '""', position: "absolute", inset: 0, zIndex: 1, borderRadius: MEDIA_RADIUS },
107
112
  "&:focus-visible::after": focusVisibleRing(colors),
108
- }, children: title })) : (title) }), selected ? _jsx(VisuallyHidden, { children: copy.selected }) : null, rating !== undefined && rating > 0 ? (_jsx(Rating, { value: rating, count: ratingCount, size: "xs", compactCount: true })) : horizontal ? null : (_jsx(Box, { minH: "1rem", "aria-hidden": true })), _jsx(PriceBlock, { size: m.price, price: price, mrp: soldOut ? undefined : mrp, priceRange: range, unitPrice: unitPrice, currency: currency, locale: locale }), soldOut ? _jsx(StockStatus, { status: "out-of-stock", message: copy.soldOut, size: "sm" }) : null, metaLine, swatchAxis && activeId ? (_jsx(ProductCardSwatches, { axis: swatchAxis, limit: swatchLimit, dot: m.dot, activeId: activeId, soldOutIds: soldOutValues, labels: copy, onPreview: setPreviewed, onPick: setPicked })) : null, horizontal ? (_jsxs(Flex, { "data-control": true, position: "relative", zIndex: 2, mt: "auto", pt: 2, align: "center", justify: "space-between", gap: 1, children: [wishlist, control] })) : null] }), action === "options" ? (_jsx(QuickAddSheet, { isOpen: sheetOpen, onClose: () => setSheetOpen(false), title: title, brand: brand, media: frames[0], axes: axes, variants: variants, defaultSelection: swatchAxis && picked ? { [swatchAxis.id]: picked } : undefined, currency: currency, locale: locale, presentation: quickAddPresentation, drawerContentProps: quickAddDrawerProps, onConfirm: (variant, count) => {
113
+ }, children: title })) : (title) }), selected ? _jsx(VisuallyHidden, { children: copy.selected }) : null, rating !== undefined && rating > 0 ? (_jsx(Rating, { value: rating, count: ratingCount, size: "xs", compactCount: true })) : horizontal ? null : (_jsx(Box, { minH: "1rem", "aria-hidden": true })), _jsx(PriceBlock, { size: m.price, price: price, mrp: soldOut ? undefined : mrp, priceRange: range, unitPrice: unitPrice, currency: currency, locale: locale }), soldOut ? _jsx(StockStatus, { status: "out-of-stock", message: copy.soldOut, size: "sm" }) : null, metaLine, swatchAxis && activeId ? (_jsx(ProductCardSwatches, { axis: swatchAxis, limit: swatchLimit, dot: m.dot, activeId: activeId, soldOutIds: soldOutValues, labels: copy, onPreview: setPreviewed, onPick: setPicked })) : null, horizontal ? (_jsxs(Flex, { "data-control": true, position: "relative", zIndex: 2, mt: "auto", pt: 2, align: "center", justify: "space-between", gap: 1, children: [wishlist, control] })) : null] }), action === "options" && sheetMounted ? (_jsx(QuickAddSheet, { isOpen: sheetOpen, onClose: () => setSheetOpen(false), title: title, brand: brand, media: frames[0], axes: axes, variants: variants, defaultSelection: swatchAxis && picked ? { [swatchAxis.id]: picked } : undefined, currency: currency, locale: locale, presentation: quickAddPresentation, drawerContentProps: quickAddDrawerProps, onConfirm: (variant, count) => {
109
114
  onAdd === null || onAdd === void 0 ? void 0 : onAdd(variant.id, count);
110
115
  setSheetOpen(false);
111
116
  } })) : null] }));
@@ -7,7 +7,7 @@ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
7
7
  import { reducedMotionSx } from "../../Theme/chakra/motion.js";
8
8
  import { CSS_RATIO, MEDIA_RADIUS } from "./cardMetrics.js";
9
9
  const DIMMED_OPACITY = 0.6;
10
- const Frame = ({ src, alt, fallbackText, quiet = false }) => {
10
+ const Frame = ({ src, srcSet, sizes, alt, fallbackText, quiet = false }) => {
11
11
  const { colors } = useCustomTheme();
12
12
  const ref = useRef(null);
13
13
  const [loaded, setLoaded] = useState(false);
@@ -22,12 +22,12 @@ const Frame = ({ src, alt, fallbackText, quiet = false }) => {
22
22
  return null;
23
23
  return (_jsxs(Box, { role: "img", "aria-label": alt, position: "absolute", inset: 0, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 1.5, color: colors.textMuted, bg: colors.background[100], children: [_jsx(ImageOff, { size: 24, "aria-hidden": true }), fallbackText ? (_jsx(Text, { as: "span", fontSize: "xs", fontWeight: 500, children: fallbackText })) : null] }));
24
24
  }
25
- return (_jsx(Box, { as: "img", ref: ref, src: src, alt: alt, loading: "lazy", decoding: "async", draggable: false, onLoad: () => setLoaded(true), onError: () => setFailed(true), position: "absolute", inset: 0, w: "100%", h: "100%", objectFit: "cover", display: "block", opacity: loaded ? 1 : 0, transition: transitionFor(["opacity"]), sx: reducedMotionSx() }));
25
+ return (_jsx(Box, { as: "img", ref: ref, src: src, srcSet: srcSet, sizes: sizes, alt: alt, loading: "lazy", decoding: "async", draggable: false, onLoad: () => setLoaded(true), onError: () => setFailed(true), position: "absolute", inset: 0, w: "100%", h: "100%", objectFit: "cover", display: "block", opacity: loaded ? 1 : 0, transition: transitionFor(["opacity"]), sx: reducedMotionSx() }));
26
26
  };
27
27
  /** Tonal media well: cover-fitted primary frame, optional hover frame, broken-image tile; overlays are children. */
28
28
  const ProductCardMedia = ({ primary, hover, title, alt, aspectRatio, dimmed, selected, fallbackText, width, children, }) => {
29
29
  var _a, _b;
30
30
  const { colors } = useCustomTheme();
31
- return (_jsxs(Box, { "data-media": true, "data-ratio": aspectRatio, position: "relative", flexShrink: 0, w: width !== null && width !== void 0 ? width : "100%", sx: { aspectRatio: CSS_RATIO[aspectRatio] }, borderRadius: MEDIA_RADIUS, overflow: "hidden", bg: colors.background[100], boxShadow: selected ? `0 0 0 2px ${colors.header[900]}` : "none", transition: transitionFor(["box-shadow"]), children: [_jsx(Box, { "data-primary": true, position: "absolute", inset: 0, opacity: dimmed ? DIMMED_OPACITY : 1, transition: transitionFor(["transform", "opacity"], "base"), sx: reducedMotionSx(), children: primary ? (_jsx(Frame, { src: primary.src, alt: (_b = (_a = primary.alt) !== null && _a !== void 0 ? _a : alt) !== null && _b !== void 0 ? _b : title, fallbackText: fallbackText }, primary.src)) : (_jsx(Frame, { src: "", alt: alt !== null && alt !== void 0 ? alt : title, fallbackText: fallbackText }, "none")) }), hover ? (_jsx(Box, { "data-hover-frame": true, "aria-hidden": true, position: "absolute", inset: 0, opacity: 0, pointerEvents: "none", transition: transitionFor(["opacity"], "base"), sx: reducedMotionSx(), children: _jsx(Frame, { src: hover.src, alt: "", quiet: true }, hover.src) })) : null, children] }));
31
+ return (_jsxs(Box, { "data-media": true, "data-ratio": aspectRatio, position: "relative", flexShrink: 0, w: width !== null && width !== void 0 ? width : "100%", sx: { aspectRatio: CSS_RATIO[aspectRatio] }, borderRadius: MEDIA_RADIUS, overflow: "hidden", bg: colors.background[100], boxShadow: selected ? `0 0 0 2px ${colors.header[900]}` : "none", transition: transitionFor(["box-shadow"]), children: [_jsx(Box, { "data-primary": true, position: "absolute", inset: 0, opacity: dimmed ? DIMMED_OPACITY : 1, transition: transitionFor(["transform", "opacity"], "base"), sx: reducedMotionSx(), children: primary ? (_jsx(Frame, { src: primary.src, srcSet: primary.srcSet, sizes: primary.sizes, alt: (_b = (_a = primary.alt) !== null && _a !== void 0 ? _a : alt) !== null && _b !== void 0 ? _b : title, fallbackText: fallbackText }, primary.src)) : (_jsx(Frame, { src: "", alt: alt !== null && alt !== void 0 ? alt : title, fallbackText: fallbackText }, "none")) }), hover ? (_jsx(Box, { "data-hover-frame": true, "aria-hidden": true, position: "absolute", inset: 0, opacity: 0, pointerEvents: "none", transition: transitionFor(["opacity"], "base"), sx: reducedMotionSx(), children: _jsx(Frame, { src: hover.src, srcSet: hover.srcSet, sizes: hover.sizes, alt: "", quiet: true }, hover.src) })) : null, children] }));
32
32
  };
33
33
  export default ProductCardMedia;
@@ -11,7 +11,7 @@ import QuantityStepper from "../QuantityStepper/QuantityStepper.js";
11
11
  import VariantSelector from "../VariantSelector/VariantSelector.js";
12
12
  import { findVariant } from "../Commerce/commerceVariants.js";
13
13
  import { rangeOf, firstMissingAxis } from "./productCardModel.js";
14
- import { useMinWidth } from "./useMinWidth.js";
14
+ import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
15
15
  const DEFAULT_LABELS = {
16
16
  heading: "Choose options",
17
17
  quantity: "Quantity",
@@ -24,7 +24,7 @@ const DESKTOP_QUERY = "(min-width: 48em)";
24
24
  const QuickAddSheet = ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation = "auto", drawerContentProps, labels, currency, locale, "data-testid": testId, }) => {
25
25
  var _a, _b, _c;
26
26
  const { colors } = useCustomTheme();
27
- const desktop = useMinWidth(DESKTOP_QUERY);
27
+ const desktop = useMatchMedia(DESKTOP_QUERY);
28
28
  const copy = { ...DEFAULT_LABELS, ...labels };
29
29
  const [selection, setSelection] = useState(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
30
30
  const [quantity, setQuantity] = useState(1);
@@ -49,4 +49,5 @@ export const CSS_RATIO = {
49
49
  };
50
50
  export const MEDIA_RADIUS = "1rem";
51
51
  export const TITLE_LINES = 2;
52
- export const FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
52
+ export const FINE_POINTER_QUERY = "(hover: hover) and (pointer: fine)";
53
+ export const FINE_POINTER = `@media ${FINE_POINTER_QUERY}`;
@@ -11,7 +11,7 @@ import Button from "../Button/Button.js";
11
11
  import Skeletons from "../Skeletons/Skeletons.js";
12
12
  import MediaGallery from "../MediaGallery/MediaGallery.js";
13
13
  import { useContainerWidth } from "../Commerce/useContainerWidth.js";
14
- import { useMatchMedia } from "../MediaGallery/useMatchMedia.js";
14
+ import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
15
15
  import ProductBadges from "../ProductBadges/ProductBadges.js";
16
16
  import Rating from "../Rating/Rating.js";
17
17
  import PriceBlock from "../PriceBlock/PriceBlock.js";
@@ -59,7 +59,7 @@ const scrollToNode = (node, reduced) => {
59
59
  }
60
60
  };
61
61
  /** Product page that wires one selection to price, stock, gallery frames and the primary action; every region has a slot. */
62
- const ProductDetails = ({ product, selection: selectionProp, defaultSelection, onSelectionChange, quantity: quantityProp, defaultQuantity = 1, onQuantityChange, maxQuantity = DEFAULT_MAX_QUANTITY, onAddToBag, onBuyNow, onNotify, onGoToBag, addedDuration = DEFAULT_ADDED_MS, wishlisted, defaultWishlisted, onWishlistChange, onShare, offers, offersProps, trustItems, pincode, sizeGuide, onGuideClick, reviews, ratingBreakdown, reviewsProps, onWriteReview, detailSectionsProps, care, breadcrumbs, layout = "auto", mediaSlot, metaSlot, infoSlot, belowFold, relatedSlot, isLoading = false, labels: labelOverrides, currency, locale, "data-testid": testId, }) => {
62
+ const ProductDetails = ({ product, selection: selectionProp, defaultSelection, onSelectionChange, quantity: quantityProp, defaultQuantity = 1, onQuantityChange, maxQuantity = DEFAULT_MAX_QUANTITY, onAddToBag, onBuyNow, onNotify, onGoToBag, addedDuration = DEFAULT_ADDED_MS, wishlisted, defaultWishlisted, onWishlistChange, onShare, offers, offersProps, trustItems, pincode, sizeGuide, onGuideClick, reviews, ratingBreakdown, reviewsProps, onWriteReview, detailSectionsProps, care, breadcrumbs, layout = "auto", size, mediaSlot, metaSlot, infoSlot, belowFold, relatedSlot, isLoading = false, labels: labelOverrides, currency, locale, "data-testid": testId, }) => {
63
63
  var _a, _b, _c, _d, _e, _f, _g, _h;
64
64
  const { colors } = useCustomTheme();
65
65
  const reduced = usePrefersReducedMotion();
@@ -70,6 +70,7 @@ const ProductDetails = ({ product, selection: selectionProp, defaultSelection, o
70
70
  const containerWidth = useContainerWidth(rootRef);
71
71
  const wide = useMatchMedia(DESKTOP_QUERY, false);
72
72
  const desktop = layout === "auto" ? (containerWidth === undefined ? wide : containerWidth >= DESKTOP_MIN_WIDTH) : layout === "desktop";
73
+ const controlSize = size !== null && size !== void 0 ? size : (desktop ? "md" : "lg");
73
74
  const variants = useMemo(() => resolveVariants(product), [product]);
74
75
  const axes = useMemo(() => withGuide(product.axes, sizeGuide), [product.axes, sizeGuide]);
75
76
  const [innerSelection, setInnerSelection] = useState(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
@@ -201,11 +202,11 @@ const ProductDetails = ({ product, selection: selectionProp, defaultSelection, o
201
202
  const showReviews = reviews !== undefined || product.ratingCount !== undefined;
202
203
  const sectionGap = desktop ? 18 : 10;
203
204
  const gutter = desktop ? 6 : 4;
204
- const wishlist = (_jsx(WishlistToggle, { selected: wishlisted, defaultSelected: defaultWishlisted, onSelectedChange: onWishlistChange, size: desktop ? "lg" : "md", variant: desktop ? "soft" : "glass", label: labels.wishlistSave }));
205
+ const wishlist = (_jsx(WishlistToggle, { selected: wishlisted, defaultSelected: defaultWishlisted, onSelectedChange: onWishlistChange, size: desktop ? controlSize : "md", variant: desktop ? "soft" : "glass", label: labels.wishlistSave }));
205
206
  const badgeSlot = product.badges && product.badges.length > 0 ? _jsx(ProductBadges, { badges: product.badges, max: 2, variant: "glass", size: "md" }) : undefined;
206
207
  const gallery = mediaSlot !== null && mediaSlot !== void 0 ? mediaSlot : (_jsx(MediaGallery, { media: product.media, layout: desktop ? "thumbs-left" : "swipe", aspectRatio: "4/5", activeMediaIds: activeIds, sticky: desktop, stickyTop: 24, badges: badgeSlot, actions: desktop ? undefined : wishlist, isLoading: isLoading, "aria-label": product.title }));
207
- const primaryButton = (_jsx(Button, { size: desktop ? "md" : "lg", width: "100%", variant: notifyMode ? "outline" : "solid", label: primaryLabel, leftIcon: bag === "added" ? _jsx(Check, { size: 18, "aria-hidden": true }) : notifyMode ? _jsx(BellRing, { size: 18, "aria-hidden": true }) : undefined, isLoading: bag === "adding", onClick: notifyMode ? handleNotify : handleAdd, fontWeight: 600 }));
208
- const buyPanel = isLoading ? (_jsxs(Flex, { direction: "column", gap: 4, "aria-busy": "true", children: [_jsx(Skeletons, { type: "skeleton", height: "1rem", width: "30%" }), _jsx(Skeletons, { type: "skeleton", height: "2rem", width: "90%" }), _jsx(Skeletons, { type: "skeleton", height: "2.5rem", width: "45%" }), _jsx(Skeletons, { type: "skeleton", height: "3rem", width: "100%" }), _jsx(Skeletons, { type: "skeleton", height: "3rem", width: "100%" })] })) : (_jsxs(Flex, { direction: "column", gap: 6, children: [_jsxs(Flex, { direction: "column", gap: 2, children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: 3, minH: product.brand || onShare ? "2.75rem" : undefined, children: [product.brand ? (_jsx(Text, { as: "span", fontSize: "sm", fontWeight: 600, color: colors.textMuted, children: product.brand })) : (_jsx("span", {})), onShare ? (_jsx(Box, { as: "button", type: "button", "aria-label": labels.share, onClick: onShare, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: "2.75rem", mr: "-0.625rem", borderRadius: "full", color: colors.header[900], transition: transitionFor(["background-color"]), _hover: { bg: colors.background[100] }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: _jsx(Share2, { size: 20, "aria-hidden": true }) })) : null] }), _jsx(Text, { as: "h1", fontSize: desktop ? "1.75rem" : "1.375rem", lineHeight: 1.25, fontWeight: 700, letterSpacing: "-0.02em", color: colors.header[900], children: product.title }), product.rating !== undefined && showReviews ? (_jsx(Box, { as: "button", type: "button", onClick: jumpToReviews, "aria-label": labels.jumpToReviews(ratingText), alignSelf: "flex-start", display: "inline-flex", alignItems: "center", minH: "2.75rem", borderRadius: "md", sx: { ...focusVisibleStyles(colors) }, children: _jsx(Rating, { value: product.rating, count: product.ratingCount, size: "sm", "aria-label": ratingText, locale: locale }) })) : product.rating !== undefined ? (_jsx(Rating, { value: product.rating, count: product.ratingCount, size: "sm", locale: locale })) : null] }), _jsxs(Flex, { direction: "column", gap: 2, children: [_jsx(PriceBlock, { size: "lg", price: price, mrp: mrp, priceRange: showRange ? range : undefined, showSavings: true, taxNote: labels.taxNote, unitPrice: packUnitPrice(product, selection, price), ...fmt }), state ? _jsx(StockStatus, { status: state, count: variant === null || variant === void 0 ? void 0 : variant.stock }) : null, metaSlot] }), offers && offers.length > 0 ? _jsx(OffersList, { offers: offers, ...offersProps }) : null, axes.length > 0 ? (_jsx(Box, { ref: selectorRef, children: _jsx(VariantSelector, { axes: axes, variants: variants, value: selection, onValueChange: handleSelection, error: showSelectError && !complete ? selectPrompt : undefined, showSelectedLabel: true, showLowStock: true, onGuideClick: onGuideClick }) })) : null, _jsxs(Flex, { direction: "column", gap: 3, ref: ctaRef, children: [_jsxs(Flex, { align: "center", gap: 3, children: [showStepper ? (_jsx(QuantityStepper, { size: desktop ? "md" : "lg", value: quantity, onValueChange: handleQuantity, min: 1, max: ceiling, itemLabel: product.title })) : null, _jsx(Box, { flex: 1, minW: 0, children: primaryButton }), desktop ? wishlist : null] }), showBuyNow ? _jsx(Button, { size: desktop ? "md" : "lg", width: "100%", variant: "outline", label: labels.buyNow, onClick: handleBuyNow }) : null, addFailed ? (_jsxs(Flex, { role: "alert", align: "center", gap: 1.5, color: colors.semanticText.error, fontSize: "sm", fontWeight: 600, children: [_jsx(CircleAlert, { size: 14, "aria-hidden": true }), _jsx(Text, { as: "span", children: labels.addFailed })] })) : null] }), pincode ? _jsx(PincodeChecker, { ...pincode }) : null, trustItems && trustItems.length > 0 ? _jsx(TrustBadges, { items: trustItems, layout: desktop ? "grid" : "row" }) : null, infoSlot] }));
208
+ const primaryButton = (_jsx(Button, { size: controlSize, width: "100%", variant: notifyMode ? "outline" : "solid", label: primaryLabel, leftIcon: bag === "added" ? _jsx(Check, { size: 18, "aria-hidden": true }) : notifyMode ? _jsx(BellRing, { size: 18, "aria-hidden": true }) : undefined, isLoading: bag === "adding", onClick: notifyMode ? handleNotify : handleAdd, fontWeight: 600 }));
209
+ const buyPanel = isLoading ? (_jsxs(Flex, { direction: "column", gap: 4, "aria-busy": "true", children: [_jsx(Skeletons, { type: "skeleton", height: "1rem", width: "30%" }), _jsx(Skeletons, { type: "skeleton", height: "2rem", width: "90%" }), _jsx(Skeletons, { type: "skeleton", height: "2.5rem", width: "45%" }), _jsx(Skeletons, { type: "skeleton", height: "3rem", width: "100%" }), _jsx(Skeletons, { type: "skeleton", height: "3rem", width: "100%" })] })) : (_jsxs(Flex, { direction: "column", gap: 6, children: [_jsxs(Flex, { direction: "column", gap: 2, children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: 3, minH: product.brand || onShare ? "2.75rem" : undefined, children: [product.brand ? (_jsx(Text, { as: "span", fontSize: "sm", fontWeight: 600, color: colors.textMuted, children: product.brand })) : (_jsx("span", {})), onShare ? (_jsx(Box, { as: "button", type: "button", "aria-label": labels.share, onClick: onShare, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: "2.75rem", mr: "-0.625rem", borderRadius: "full", color: colors.header[900], transition: transitionFor(["background-color"]), _hover: { bg: colors.background[100] }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: _jsx(Share2, { size: 20, "aria-hidden": true }) })) : null] }), _jsx(Text, { as: "h1", fontSize: desktop ? "1.75rem" : "1.375rem", lineHeight: 1.25, fontWeight: 700, letterSpacing: "-0.02em", color: colors.header[900], children: product.title }), product.rating !== undefined && showReviews ? (_jsx(Box, { as: "button", type: "button", onClick: jumpToReviews, "aria-label": labels.jumpToReviews(ratingText), alignSelf: "flex-start", display: "inline-flex", alignItems: "center", minH: "2.75rem", borderRadius: "md", sx: { ...focusVisibleStyles(colors) }, children: _jsx(Rating, { value: product.rating, count: product.ratingCount, size: "sm", "aria-label": ratingText, locale: locale }) })) : product.rating !== undefined ? (_jsx(Rating, { value: product.rating, count: product.ratingCount, size: "sm", locale: locale })) : null] }), _jsxs(Flex, { direction: "column", gap: 2, children: [_jsx(PriceBlock, { size: "lg", price: price, mrp: mrp, priceRange: showRange ? range : undefined, showSavings: true, taxNote: labels.taxNote, unitPrice: packUnitPrice(product, selection, price), ...fmt }), state ? _jsx(StockStatus, { status: state, count: variant === null || variant === void 0 ? void 0 : variant.stock }) : null, metaSlot] }), offers && offers.length > 0 ? _jsx(OffersList, { offers: offers, ...offersProps }) : null, axes.length > 0 ? (_jsx(Box, { ref: selectorRef, children: _jsx(VariantSelector, { axes: axes, variants: variants, value: selection, onValueChange: handleSelection, error: showSelectError && !complete ? selectPrompt : undefined, showSelectedLabel: true, showLowStock: true, onGuideClick: onGuideClick }) })) : null, _jsxs(Flex, { direction: "column", gap: 3, ref: ctaRef, children: [_jsxs(Flex, { align: "center", gap: 3, children: [showStepper ? (_jsx(QuantityStepper, { size: controlSize, value: quantity, onValueChange: handleQuantity, min: 1, max: ceiling, itemLabel: product.title })) : null, _jsx(Box, { flex: 1, minW: 0, children: primaryButton }), desktop ? wishlist : null] }), showBuyNow ? _jsx(Button, { size: controlSize, width: "100%", variant: "outline", label: labels.buyNow, onClick: handleBuyNow }) : null, addFailed ? (_jsxs(Flex, { role: "alert", align: "center", gap: 1.5, color: colors.semanticText.error, fontSize: "sm", fontWeight: 600, children: [_jsx(CircleAlert, { size: 14, "aria-hidden": true }), _jsx(Text, { as: "span", children: labels.addFailed })] })) : null] }), pincode ? _jsx(PincodeChecker, { ...pincode }) : null, trustItems && trustItems.length > 0 ? _jsx(TrustBadges, { items: trustItems, layout: desktop ? "grid" : "row" }) : null, infoSlot] }));
209
210
  return (_jsxs(Box, { ref: rootRef, "data-testid": testId, "data-layout": desktop ? "desktop" : "mobile", w: "100%", maxW: "82rem", mx: "auto", px: desktop ? 6 : 0, children: [_jsx(VisuallyHidden, { role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }), breadcrumbs ? _jsx(Box, { px: desktop ? 0 : gutter, py: 3, children: breadcrumbs }) : null, _jsxs(Flex, { direction: desktop ? "row" : "column", align: desktop ? "flex-start" : "stretch", gap: desktop ? 12 : 5, children: [_jsx(Box, { flex: desktop ? "1.63 1 0" : undefined, minW: 0, w: desktop ? undefined : "100%", children: gallery }), _jsx(Box, { flex: desktop ? "1 1 0" : undefined, minW: 0, px: desktop ? 0 : gutter, children: buyPanel })] }), !isLoading ? (_jsxs(Flex, { direction: "column", gap: sectionGap, mt: sectionGap, px: desktop ? 0 : gutter, children: [_jsx(DetailSections, { description: product.description, highlights: product.highlights, specs: product.specs, care: care, shipping: product.returnsNote, legal: hasLegal
210
211
  ? {
211
212
  netQuantity: product.netQuantity,
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useEffect, useRef } from "react";
3
- import { Input, InputGroup, InputLeftElement, InputRightElement, Icon, IconButton, Kbd, FormControl, useMergeRefs, } from "@chakra-ui/react";
3
+ import { Input, InputGroup, InputLeftElement, InputRightElement, Icon, IconButton, FormControl, useMergeRefs, } from "@chakra-ui/react";
4
4
  import { Search as SearchIconComponent, X } from "lucide-react";
5
+ import Kbd from "../Kbd/Kbd.js";
5
6
  import { TextLabel } from "../Common/FormLabel.js";
6
7
  import FieldMessage from "../Common/FieldMessage.js";
7
8
  import { useFieldIds } from "../Common/useFieldIds.js";
@@ -44,6 +45,6 @@ const Search = forwardRef(function Search({ placeholder = "Search...", onSearch,
44
45
  ps: spec.height,
45
46
  pe: rightPadding,
46
47
  ...reducedMotionSx(),
47
- } }), (showClear || showHint) && (_jsxs(InputRightElement, { h: spec.height, w: "auto", pe: spec.paddingX, gap: 1, children: [showClear && (_jsx(IconButton, { "aria-label": "Clear search", icon: _jsx(X, { size: spec.iconSize }), variant: "ghost", size: "xs", h: clearSize, minW: clearSize, color: theme.colors.textMuted, onClick: handleClear, sx: focusVisibleStyles(theme.colors) })), showHint && (_jsx(Kbd, { "aria-hidden": true, fontSize: "0.6875rem", fontWeight: 500, color: theme.colors.textMuted, bg: theme.colors.backgroundColor.subtle, borderColor: theme.colors.boxborder[200], whiteSpace: "nowrap", children: shortcut }))] }))] }), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
48
+ } }), (showClear || showHint) && (_jsxs(InputRightElement, { h: spec.height, w: "auto", pe: spec.paddingX, gap: 1, children: [showClear && (_jsx(IconButton, { "aria-label": "Clear search", icon: _jsx(X, { size: spec.iconSize }), variant: "ghost", size: "xs", h: clearSize, minW: clearSize, color: theme.colors.textMuted, onClick: handleClear, sx: focusVisibleStyles(theme.colors) })), showHint && (_jsx("span", { "aria-hidden": true, children: _jsx(Kbd, { size: "xs", children: shortcut }) }))] }))] }), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
48
49
  });
49
50
  export default Search;