@clicktap/ui 1.2.1 → 2.0.4

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 (47) hide show
  1. package/components/Accordion/Accordion.d.ts +76 -2
  2. package/components/Accordion/Accordion.js +1 -1
  3. package/components/Accordion/index.d.ts +2 -3
  4. package/components/Accordion/index.js +1 -1
  5. package/components/Badge/Badge.js +1 -1
  6. package/components/Badge/Badge.types.d.ts +27 -2
  7. package/components/Badge/index.js +1 -1
  8. package/components/Collapsible/Collapsible.js +1 -1
  9. package/components/Collection/CollectionFilters/CollectionFilters.js +1 -1
  10. package/components/Collection/CollectionFilters/index.js +1 -1
  11. package/components/Collection/CollectionToolbar/CollectionToolbar.js +1 -1
  12. package/components/Collection/ProductCardSwatches/ProductCardSwatches.js +1 -1
  13. package/components/Collection/index.js +1 -1
  14. package/components/ContextMenu/ContextMenu.js +1 -1
  15. package/components/DialogTrigger/DialogTrigger.d.ts +18 -10
  16. package/components/DialogTrigger/DialogTrigger.js +1 -1
  17. package/components/DialogTrigger/index.js +1 -1
  18. package/components/Drawer/Drawer.js +1 -1
  19. package/components/Menu/Menu.js +1 -1
  20. package/components/Meter/Meter.js +1 -1
  21. package/components/NumberTicker/DigitResolver.js +1 -1
  22. package/components/NumberTicker/NumberTicker.js +1 -1
  23. package/components/Pagination/Pagination.d.ts +27 -2
  24. package/components/Pagination/Pagination.js +1 -1
  25. package/components/Pagination/index.js +1 -1
  26. package/components/Progressbar/LinearProgressbar.js +1 -1
  27. package/components/Tabs/Tab.js +1 -1
  28. package/components/Tooltip/Tooltip.d.ts +9 -1
  29. package/components/Tooltip/Tooltip.js +1 -1
  30. package/components/Tooltip/Tooltip.types.d.ts +21 -2
  31. package/components/Tooltip/index.js +1 -1
  32. package/components/UploadImage/UploadImage.js +1 -1
  33. package/docs/migrations/2026/08/ui-2026-08-21-graphql-client-string-documents.md +45 -0
  34. package/docs/migrations/2026/08/ui-2026-08-21-graphql-peer-covered.md +26 -0
  35. package/docs/migrations/2026/08/ui-2026-08-21-heroui-removed.md +54 -0
  36. package/docs/migrations/2026/08/ui-2026-08-21-lazymotion-m-components.md +54 -0
  37. package/docs/migrations/2026/08/ui-2026-08-21-modal-triggers-wired-explicitly.md +43 -0
  38. package/docs/migrations/2026/08/ui-2026-08-21-next-image-fallback-keeps-fill.md +38 -0
  39. package/docs/migrations/2026/08/ui-2026-08-22-accordion-divider-between-items.md +30 -0
  40. package/docs/migrations/2026/08/ui-2026-08-22-accordion-divider-class-ownership.md +14 -0
  41. package/docs/migrations/2026/08/ui-2026-08-22-collection-accessibility-fixes.md +28 -0
  42. package/docs/migrations/2026/08/ui-2026-08-22-react-aria-moves-as-one-version-set.md +46 -0
  43. package/docs/migrations/index.json +101 -0
  44. package/next/Image.js +1 -1
  45. package/package.json +10 -38
  46. package/utils/createAuthAwareGraphqlClient.d.ts +104 -16
  47. package/utils/createAuthAwareGraphqlClient.js +1 -56
@@ -1,4 +1,78 @@
1
- import { AccordionProps } from '@heroui/accordion';
2
- export declare function Accordion({ children, variant, isCompact, className, itemClasses, ...props }: AccordionProps): import("react/jsx-runtime").JSX.Element;
1
+ import { ComponentType, ReactNode } from 'react';
2
+ /**
3
+ * Native accordion on react-aria-components Disclosure (CTAP-1383).
4
+ *
5
+ * Previously a styled wrapper around @heroui/accordion — the ONLY
6
+ * initially-rendered @heroui consumer (the PLP filter sidebar), which pulled
7
+ * the whole @heroui system + theme (~25 KiB gz) into every page's initial JS.
8
+ * react-aria-components is already this library's base, so the rewrite costs
9
+ * nothing new. API-compatible with the call sites this repo uses:
10
+ * selectionMode / defaultSelectedKeys ("all" included), per-item title,
11
+ * subtitle, startContent, indicator (component, receives nothing, rotates on
12
+ * open), classNames slots, showDivider (an <hr> between items — consumers
13
+ * hide it with [&_hr]:hidden), onPress, and the `data-open` attribute on
14
+ * heading/trigger/indicator that consumers style with data-[open=true]:.
15
+ * Height animates with the CSS grid-rows trick — no animation runtime.
16
+ */
17
+ type ItemSlotClassNames = {
18
+ base?: string;
19
+ heading?: string;
20
+ trigger?: string;
21
+ titleWrapper?: string;
22
+ title?: string;
23
+ subtitle?: string;
24
+ startContent?: string;
25
+ content?: string;
26
+ indicator?: string;
27
+ };
28
+ /** What an indicator component receives — heroui's contract, kept. */
29
+ export type AccordionItemIndicatorProps = {
30
+ isOpen?: boolean;
31
+ };
32
+ export type AccordionItemProps = {
33
+ children?: ReactNode;
34
+ title?: ReactNode;
35
+ subtitle?: ReactNode;
36
+ startContent?: ReactNode;
37
+ indicator?: ComponentType<AccordionItemIndicatorProps> | ReactNode;
38
+ hideIndicator?: boolean;
39
+ disableIndicatorAnimation?: boolean;
40
+ isDisabled?: boolean;
41
+ textValue?: string;
42
+ 'aria-label'?: string;
43
+ classNames?: ItemSlotClassNames;
44
+ onPress?: () => void;
45
+ };
46
+ export type AccordionProps = {
47
+ children?: ReactNode;
48
+ selectionMode?: 'single' | 'multiple';
49
+ defaultSelectedKeys?: 'all' | Iterable<string>;
50
+ /** heroui alias for defaultSelectedKeys. */
51
+ defaultExpandedKeys?: 'all' | Iterable<string>;
52
+ /** Controlled expanded keys. */
53
+ selectedKeys?: 'all' | Iterable<string>;
54
+ onSelectionChange?: (keys: Set<string>) => void;
55
+ disallowEmptySelection?: boolean;
56
+ keepContentMounted?: boolean;
57
+ /** Hide every item's indicator (heroui group-level prop). */
58
+ hideIndicator?: boolean;
59
+ showDivider?: boolean;
60
+ dividerProps?: {
61
+ className?: string;
62
+ };
63
+ /** Accepted for heroui compatibility; not rendered. */
64
+ title?: ReactNode;
65
+ variant?: 'light' | 'bordered' | 'shadow' | 'splitted';
66
+ isCompact?: boolean;
67
+ className?: string;
68
+ itemClasses?: ItemSlotClassNames;
69
+ };
70
+ /**
71
+ * Configuration carrier — never rendered directly; {@link Accordion} reads
72
+ * its props off the element. Mirrors the heroui usage pattern so call sites
73
+ * did not change.
74
+ */
75
+ export declare function AccordionItem(_props: AccordionItemProps): null;
76
+ export declare function Accordion({ children, selectionMode, defaultSelectedKeys, defaultExpandedKeys, selectedKeys, onSelectionChange, disallowEmptySelection, hideIndicator: groupHideIndicator, showDivider, dividerProps, variant, isCompact, className, itemClasses, }: AccordionProps): import("react/jsx-runtime").JSX.Element;
3
77
  export default Accordion;
4
78
  export declare function AccordionItemArrow(): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as d}from"react/jsx-runtime";import{Accordion as u}from"@heroui/accordion";import{cn as r}from"../../utils/cn.js";import{DownArrow as i}from"../Icon/DownArrow.js";function a({children:n,variant:o,isCompact:t,className:l,itemClasses:e,...b}){return d(u,{variant:o,isCompact:t,dividerProps:{className:r("my-2 border-solid border-border-subtle",o==="shadow"&&"border-border")},className:r("px-0",o==="bordered"&&["px-4 py-4 rounded-xl border-2 border-border-subtle"],o==="shadow"&&["px-4 py-4 rounded-xl bg-surface-subtle shadow-slate-200 border border-border-subtle"],l),itemClasses:{base:r("w-full py-2",'data-[disabled="true"]:pointer-events-none data-[disabled="true"]:opacity-50',o==="bordered"&&["rounded-xl py-0"],o==="splitted"&&["flex flex-col bg-surface-subtle rounded-xl border border-border-subtle"],t&&"py-0",e?.base),trigger:r("w-full h-full flex items-center gap-3 py-0 appearance-none cursor-pointer select-none","focus-visible:outline-2 focus-visible:outline focus-visible:outline-slate-100","bg-transparent text-inherit",t&&["py-2"],e?.trigger),title:r("text-xl font-semibold",t&&"text-base",e?.title),subtitle:r("text-base",t&&"text-sm",e?.subtitle),titleWrapper:r("text-left",e?.titleWrapper),startContent:r("shrink-0",e?.startContent),content:r([t?"py-1":"py-2"],e?.content),indicator:e?.indicator,heading:e?.heading},...b,children:n})}function x(){return d(i,{className:"w-4 h-4"})}export{a as Accordion,x as AccordionItemArrow,a as default};
1
+ "use client";import{jsx as e,jsxs as d,Fragment as O}from"react/jsx-runtime";import{Children as V,isValidElement as _,Fragment as $}from"react";import{DisclosureGroup as q,Disclosure as H,Button as J,DisclosurePanel as L}from"react-aria-components";import{cn as r}from"../../utils/cn.js";import{DownArrow as x}from"../Icon/DownArrow.js";function Z(p){return null}function E({children:p,selectionMode:y="single",defaultSelectedKeys:N,defaultExpandedKeys:w,selectedKeys:k,onSelectionChange:A,disallowEmptySelection:I=!1,hideIndicator:v=!1,showDivider:S=!0,dividerProps:D,variant:i,isCompact:s,className:F,itemClasses:n}){const c=V.toArray(p).filter(_),K=c.map((t,l)=>String(t.key??l)),b=t=>t==="all"?K:t?[...t].map(String):void 0,j=b(N??w)??[],P=b(k);return e(q,{allowsMultipleExpanded:y==="multiple",defaultExpandedKeys:j,expandedKeys:P,onExpandedChange:t=>{const l=new Set([...t].map(String));I&&l.size===0||A?.(l)},className:r("px-0",i==="bordered"&&["px-4 py-4 rounded-xl border-2 border-border-subtle"],i==="shadow"&&["px-4 py-4 rounded-xl bg-surface-subtle shadow-slate-200 border border-border-subtle"],F),children:c.map((t,l)=>{const h=String(t.key??l),{title:W,subtitle:f,startContent:m,indicator:u,hideIndicator:z,disableIndicatorAnimation:g,isDisabled:B,classNames:o,onPress:G,children:M}=t.props;return d($,{children:[e(H,{id:h,isDisabled:B,className:r("w-full py-2","data-disabled:pointer-events-none data-disabled:opacity-50",i==="bordered"&&["rounded-xl py-0"],i==="splitted"&&["flex flex-col bg-surface-subtle rounded-xl border border-border-subtle"],s&&"py-0",n?.base,o?.base),children:({isExpanded:a})=>d(O,{children:[e("h2",{"data-open":a||void 0,className:r(n?.heading,o?.heading),children:d(J,{slot:"trigger","data-open":a||void 0,onPress:G,"aria-label":t.props["aria-label"],className:r("w-full h-full flex items-center gap-3 py-0 appearance-none cursor-pointer select-none","border-0 focus-visible:outline-2 focus-visible:outline focus-visible:outline-slate-100","bg-transparent text-inherit",s&&["py-2"],n?.trigger,o?.trigger),children:[m!=null&&e("span",{className:r("shrink-0",n?.startContent,o?.startContent),children:m}),d("span",{className:r("flex-1 text-left",n?.titleWrapper,o?.titleWrapper),children:[e("span",{className:r("block text-xl font-semibold",s&&"text-base",n?.title,o?.title),children:W}),f!=null&&e("span",{className:r("block text-base",s&&"text-sm",n?.subtitle,o?.subtitle),children:f})]}),z||v?null:e("span",{"aria-hidden":"true","data-open":a||void 0,className:r("shrink-0",!g&&"transition-transform duration-200",!g&&a&&"-rotate-180",n?.indicator,o?.indicator),children:typeof u=="function"?e(u,{isOpen:a}):u??e(x,{className:"w-4 h-4"})})]})}),e("div",{className:r("grid transition-[grid-template-rows] duration-200 ease-in-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:e("div",{className:"overflow-hidden min-h-0",children:e(L,{className:r(s?"py-1":"py-2",n?.content,o?.content),children:M})})})]})}),S&&l<c.length-1&&e("hr",{className:r("border-solid border-b-0 border-x-0",D?.className??["my-2 border-border-subtle",i==="shadow"&&"border-border"])})]},h)})})}function C(){return e(x,{className:"w-4 h-4"})}export{E as Accordion,Z as AccordionItem,C as AccordionItemArrow,E as default};
@@ -1,3 +1,2 @@
1
- export { Accordion, AccordionItemArrow } from './Accordion';
2
- export { AccordionItem } from '@heroui/accordion';
3
- export type { AccordionProps } from '@heroui/accordion';
1
+ export { Accordion, AccordionItem, AccordionItemArrow } from './Accordion';
2
+ export type { AccordionProps, AccordionItemProps, AccordionItemIndicatorProps, } from './Accordion';
@@ -1 +1 @@
1
- import{Accordion as i,AccordionItemArrow as p}from"./Accordion.js";import{AccordionItem as A}from"@heroui/accordion";import"react/jsx-runtime";import"../../utils/cn.js";import"../Icon/DownArrow.js";export{i as Accordion,A as AccordionItem,p as AccordionItemArrow};
1
+ import{Accordion as A,AccordionItem as d,AccordionItemArrow as e}from"./Accordion.js";import"react/jsx-runtime";import"react";import"react-aria-components";import"../../utils/cn.js";import"../Icon/DownArrow.js";export{A as Accordion,d as AccordionItem,e as AccordionItemArrow};
@@ -1 +1 @@
1
- "use client";import{jsx as a}from"react/jsx-runtime";import{useId as y}from"react";import{AnimatePresence as V,motion as z}from"framer-motion";import{Badge as C}from"@heroui/badge";import{cn as n}from"../../utils/cn.js";const B={hidden:{opacity:0,scale:0},show:{opacity:1,scale:1}};function P({children:h,isInvisible:l,disableAnimation:d,placement:t="top-right",shape:r="rectangle",className:f,classNames:g,showOutline:b=!1,content:o,isDot:s,isOneChar:x,size:i="md",variant:e="solid",...c}){const m=y(),p=d?{duration:0}:{type:"spring",bounce:.3},_=String(o)?.length===1||x,w={sm:"text-xs",md:"text-sm",lg:"text-sm"},u=_?{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[i]:{sm:"min-w-4 h-4",md:"min-w-5 h-5",lg:"min-w-6 h-6"}[i];return a(C,{...c,size:i,variant:e,isInvisible:l,isDot:s,classNames:{base:n("relative","inline-flex shrink-0",g?.base),badge:n("p-0","border-0","absolute z-10",[t==="top-right"&&r==="rectangle"&&"top-0.5 right-px",t==="top-right"&&r==="circle"&&"top-1 right-1",t==="bottom-right"&&r==="rectangle"&&"bottom-0.5 right-px",t==="bottom-right"&&r==="circle"&&"bottom-1 right-1",t==="top-left"&&r==="rectangle"&&"top-0.5 left-px",t==="top-left"&&r==="circle"&&"top-1 left-1",t==="bottom-left"&&r==="rectangle"&&"bottom-0.5 left-px",t==="bottom-left"&&r==="circle"&&"bottom-1 left-1"],[t==="top-right"&&"translate-x-1/2 -translate-y-1/2",t==="bottom-right"&&"translate-x-1/2 translate-y-1/2",t==="bottom-left"&&"-translate-x-1/2 translate-y-1/2",t==="top-left"&&"-translate-x-1/2 -translate-y-1/2"],g?.badge)},content:a(V,{children:!l&&a(z.span,{layout:!0,variants:B,initial:d?"show":"hidden",transition:p,animate:"show",exit:"hidden",className:n("flex flex-wrap","place-content-center","z-10","box-border","rounded-full","py-0 px-1","font-normal text-fg","select-none","whitespace-normal",e==="faded"?"text-slate-800":"text-white",!o||s?"w-3.5 h-3.5":u,typeof o=="string"&&o.length>1||s?"text-xs":w[i],[e==="solid"&&"bg-surface-inverse-hover",e==="shadow"&&"bg-surface-inverse-hover",e==="flat"&&"bg-surface-inverse-hover/55",e==="faded"&&"bg-white"],[e==="faded"&&"border-2 border-solid border-surface-inverse-hover",b&&e!=="faded"&&"border-2 border-solid border-white"],e==="shadow"&&"shadow-[0_0_0_0_rgba(0,0,0,0),_0_0_0_0_rgba(0,0,0,0),_0_10px_15px_-3px_rgba(30,41,59,0.3),_0_4px_6px_-4px_rgba(30,41,59,0.3)]",f),children:o},`badge-${m}`)}),children:h})}export{P as Badge,P as default};
1
+ "use client";import{jsxs as V,jsx as n}from"react/jsx-runtime";import{useId as v}from"react";import{AnimatePresence as z,m as C}from"framer-motion";import{cn as a}from"../../utils/cn.js";const S={hidden:{opacity:0,scale:0},show:{opacity:1,scale:1}};function P({children:h,isInvisible:f,disableAnimation:l,placement:t="top-right",shape:e="rectangle",className:g,classNames:d,showOutline:c=!1,content:o,isDot:i,isOneChar:x,size:s="md",variant:r="solid",...b}){const m=v(),u=l?{duration:0}:{type:"spring",bounce:.3},w=String(o)?.length===1||x,p={sm:"text-xs",md:"text-sm",lg:"text-sm"},y=w?{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]:{sm:"min-w-4 h-4",md:"min-w-5 h-5",lg:"min-w-6 h-6"}[s];return V("div",{...b,className:a("relative","inline-flex shrink-0",g,d?.base),children:[h,n("span",{className:a("p-0","border-0","absolute z-10","flex",[t==="top-right"&&e==="rectangle"&&"top-0.5 right-px",t==="top-right"&&e==="circle"&&"top-1 right-1",t==="bottom-right"&&e==="rectangle"&&"bottom-0.5 right-px",t==="bottom-right"&&e==="circle"&&"bottom-1 right-1",t==="top-left"&&e==="rectangle"&&"top-0.5 left-px",t==="top-left"&&e==="circle"&&"top-1 left-1",t==="bottom-left"&&e==="rectangle"&&"bottom-0.5 left-px",t==="bottom-left"&&e==="circle"&&"bottom-1 left-1"],[t==="top-right"&&"translate-x-1/2 -translate-y-1/2",t==="bottom-right"&&"translate-x-1/2 translate-y-1/2",t==="bottom-left"&&"-translate-x-1/2 translate-y-1/2",t==="top-left"&&"-translate-x-1/2 -translate-y-1/2"],d?.badge),children:n(z,{children:!f&&n(C.span,{layout:!0,variants:S,initial:l?"show":"hidden",transition:u,animate:"show",exit:"hidden",className:a("flex flex-wrap","place-content-center","z-10","box-border","rounded-full","py-0 px-1","font-normal text-fg","select-none","whitespace-normal",r==="faded"?"text-slate-800":"text-white",!o||i?"w-3.5 h-3.5":y,typeof o=="string"&&o.length>1||i?"text-xs":p[s],[r==="solid"&&"bg-surface-inverse-hover",r==="shadow"&&"bg-surface-inverse-hover",r==="flat"&&"bg-surface-inverse-hover/55",r==="faded"&&"bg-white"],[r==="faded"&&"border-2 border-solid border-surface-inverse-hover",c&&r!=="faded"&&"border-2 border-solid border-white"]),children:!i&&o},`badge-${m}`)})})]})}export{P as Badge,P as default};
@@ -1,2 +1,27 @@
1
- import { BadgeProps as NextBadgeProps } from '@heroui/badge';
2
- export type BadgeProps = Omit<NextBadgeProps, 'color | disableOutline'>;
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Structural props (CTAP-1383): previously `Omit<@heroui/badge Props, ...>`.
4
+ * The heroui component only contributed two wrapper elements while every
5
+ * visual class already lived here — importing it cost the whole @heroui
6
+ * system (~25 KiB gz) in the initial bundle of every page via the header's
7
+ * cart badge. Same prop names and defaults as before.
8
+ */
9
+ export type BadgeProps = Omit<HTMLAttributes<HTMLDivElement>, 'content'> & {
10
+ children?: ReactNode;
11
+ /** Badge content (count, dot, node). */
12
+ content?: ReactNode;
13
+ /** Hide the badge bubble (children stay rendered). */
14
+ isInvisible?: boolean;
15
+ disableAnimation?: boolean;
16
+ placement?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
17
+ shape?: 'rectangle' | 'circle';
18
+ classNames?: {
19
+ base?: string;
20
+ badge?: string;
21
+ };
22
+ showOutline?: boolean;
23
+ isDot?: boolean;
24
+ isOneChar?: boolean;
25
+ size?: 'sm' | 'md' | 'lg';
26
+ variant?: 'solid' | 'shadow' | 'flat' | 'faded';
27
+ };
@@ -1 +1 @@
1
- import{Badge as a}from"./Badge.js";import"react/jsx-runtime";import"react";import"framer-motion";import"@heroui/badge";import"../../utils/cn.js";export{a as Badge};
1
+ import{Badge as e}from"./Badge.js";import"react/jsx-runtime";import"react";import"framer-motion";import"../../utils/cn.js";export{e as Badge};
@@ -1 +1 @@
1
- "use client";import{jsx as r}from"react/jsx-runtime";import{useContext as p}from"react";import{motion as a}from"framer-motion";import{CollapsibleTriggerStateContext as l}from"./CollapsibleTrigger.js";import{cn as m}from"../../utils/cn.js";import"react-aria-components";import"@react-stately/utils";import"@react-aria/interactions";function g({children:i,className:t}){const{isOpen:e,id:o,defaultOpen:n}=p(l);return r(a.div,{className:m("w-full overflow-hidden",t),id:o,variants:{hidden:{height:"0px",opacity:0},visible:{height:"auto",opacity:1}},initial:n?"visible":"hidden",animate:e?"visible":"hidden",transition:{type:"spring",bounce:0},children:i})}export{g as Collapsible,g as default};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{useContext as p}from"react";import{m as a}from"framer-motion";import{CollapsibleTriggerStateContext as l}from"./CollapsibleTrigger.js";import{cn as m}from"../../utils/cn.js";import"react-aria-components";import"@react-stately/utils";import"@react-aria/interactions";function g({children:i,className:t}){const{isOpen:e,id:o,defaultOpen:r}=p(l);return n(a.div,{className:m("w-full overflow-hidden",t),id:o,variants:{hidden:{height:"0px",opacity:0},visible:{height:"auto",opacity:1}},initial:r?"visible":"hidden",animate:e?"visible":"hidden",transition:{type:"spring",bounce:0},children:i})}export{g as Collapsible,g as default};
@@ -1 +1 @@
1
- "use client";import{jsxs as l,Fragment as h,jsx as e}from"react/jsx-runtime";import{useMemo as b,Suspense as x,useState as v}from"react";import{Accordion as g}from"../../Accordion/Accordion.js";import{AccordionItem as w}from"@heroui/accordion";import{Button as f}from"../../Button/Button.js";import"../../../utils/cn.js";import{ModalOverlay as y}from"../../ModalOverlay/ModalOverlay.js";import{Modal as N}from"../../Modal/Modal.js";import{Drawer as k}from"../../Drawer/Drawer.js";import{Cross as C}from"../../Icon/Cross.js";import{CrossSmall as A}from"../../Icon/CrossSmall.js";import{Search as D}from"../../Icon/Search.js";import{FilterRenderer as I}from"../FilterRenderer/FilterRenderer.js";import{mergeFilters as S}from"../../../utils/collection/mergeFilters.js";import{FilterAccordionTitle as j}from"../FilterAccordionTitle/FilterAccordionTitle.js";import{EmptyResults as L}from"../EmptyResults/EmptyResults.js";import"../../Icon/DownArrow.js";import"react-aria-components";import"framer-motion";import"../../../utils/env.js";import"../../../utils/swatch.js";import"../FilterRenderer/Renderer/Option.js";import"../../Checkbox/Checkbox.js";import"../FilterRenderer/Renderer/useOptionFilterToggle.js";import"../FilterRenderer/Renderer/Swatch.js";import"../FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../../Icon/CheckIcon.js";import"../../../utils/color.js";import"../FilterRenderer/Renderer/Swatch/SwatchImage.js";import"../FilterRenderer/Renderer/Swatch/SwatchText.js";import"../FilterRenderer/Renderer/Boolean.js";import"../../RadioGroup/RadioGroup.js";import"../../Radio/Radio.js";import"../FilterRenderer/Renderer/Range.js";function M(){return e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function V({value:a,onChange:r}){const[o,c]=v(a),m=()=>{r(o.trim())};return l("div",{className:"relative",children:[e("input",{type:"search",value:o,onChange:i=>c(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),m())},onBlur:m,placeholder:"Search products...","aria-label":"Search products",autoComplete:"off",className:"w-full h-9 pl-8 pr-8 rounded-md border border-border bg-white text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:border-border-emphasis [&::-webkit-search-cancel-button]:hidden"}),o&&e("button",{type:"button",onClick:()=>{c(""),r("")},"aria-label":"Clear search",className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded-full hover:bg-surface-subtle transition-colors",children:e(A,{})}),e("span",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 [&>svg]:w-full [&>svg]:h-full text-fg-subtle",children:e(D,{})})]})}function pe({availableFilters:a,appliedFilters:r,onFilterChange:o,showMobileFilters:c,setShowMobileFilters:m,searchQuery:s,onSearchChange:n,totalItems:i}){const u=b(()=>S(r,a).filter(t=>t.includeInFilters!==!1),[r,a]),d=n&&e(V,{value:s??"",onChange:n},s),p=()=>u.length>0&&e(g,{selectionMode:"multiple",defaultSelectedKeys:"all",className:"pt-2 mt-3",showDivider:!1,itemClasses:{base:"py-1",title:"text-sm font-medium leading-7",trigger:"py-2 border-b border-gray-200",indicator:'data-[open="true"]:rotate-180',content:"pt-2 pb-3"},children:u.map(t=>e(w,{textValue:t.label,title:e(j,{filter:t,appliedFilters:r,onFilterChange:o}),disableIndicatorAnimation:!0,indicator:M,children:e("div",{className:"pt-2",children:e(I,{filter:t,onFilterChange:o,appliedFilters:r,variant:"sidebar"})})},t.code))});return l(h,{children:[l("div",{className:"hidden lg:flex lg:flex-col lg:basis-[16.5rem] lg:shrink-0",children:[d,p(),r.length>0&&e("button",{type:"button",className:"text-sm text-fg-muted hover:text-slate-700 transition-colors mt-4 mb-8",onClick:()=>o([]),children:"Clear all filters"})]}),e("div",{className:"lg:hidden",children:e(x,{children:e(y,{isOpen:c,onOpenChange:t=>m(t),isDismissable:!0,children:e(N,{children:e(k,{size:"30rem",direction:"left","aria-label":"Filters",className:"p-5",children:({close:t})=>l("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[l("div",{className:"flex items-center w-full justify-between",children:[e("span",{className:"text-xl font-bold text-slate-800",children:"Filters"}),e(f,{variant:"ghost","aria-label":"Close",onPress:()=>t(),className:"justify-start size-auto p-0",children:e(C,{})})]}),l("div",{className:"flex flex-col flex-1 overflow-x-hidden overflow-y-auto [scrollbar-width:none] [-webkit-overflow-scrolling:touch] [&::-webkit-scrollbar]:hidden",children:[d&&e("div",{className:"mt-3",children:d}),p(),i===0&&e(L,{searchQuery:s,hasFilters:r.length>0,onClearFilters:()=>o([]),onClearSearch:s&&n?()=>n(""):void 0})]}),l("div",{className:"shrink-0 pt-3 flex flex-col gap-3 border-t border-gray-200",children:[r.length>0&&e("button",{type:"button",className:"text-sm py-2 text-fg-muted hover:text-slate-700 transition-colors",onClick:()=>o([]),children:"Clear all"}),e(f,{className:"w-full py-6 text-base rounded-xl",variant:"primary",onPress:()=>t(),children:"View Results"})]})]})})})})})})]})}export{pe as CollectionFilters};
1
+ "use client";import{jsxs as o,Fragment as h,jsx as e}from"react/jsx-runtime";import{useMemo as b,Suspense as x,useState as v}from"react";import{Accordion as g,AccordionItem as w}from"../../Accordion/Accordion.js";import{Button as f}from"../../Button/Button.js";import"../../../utils/cn.js";import{ModalOverlay as y}from"../../ModalOverlay/ModalOverlay.js";import{Modal as N}from"../../Modal/Modal.js";import{Drawer as k}from"../../Drawer/Drawer.js";import{Cross as C}from"../../Icon/Cross.js";import{CrossSmall as A}from"../../Icon/CrossSmall.js";import{Search as D}from"../../Icon/Search.js";import{FilterRenderer as I}from"../FilterRenderer/FilterRenderer.js";import{mergeFilters as S}from"../../../utils/collection/mergeFilters.js";import{FilterAccordionTitle as j}from"../FilterAccordionTitle/FilterAccordionTitle.js";import{EmptyResults as L}from"../EmptyResults/EmptyResults.js";import"react-aria-components";import"../../Icon/DownArrow.js";import"framer-motion";import"../../../utils/env.js";import"../../../utils/swatch.js";import"../FilterRenderer/Renderer/Option.js";import"../../Checkbox/Checkbox.js";import"../FilterRenderer/Renderer/useOptionFilterToggle.js";import"../FilterRenderer/Renderer/Swatch.js";import"../FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../../Icon/CheckIcon.js";import"../../../utils/color.js";import"../FilterRenderer/Renderer/Swatch/SwatchImage.js";import"../FilterRenderer/Renderer/Swatch/SwatchText.js";import"../FilterRenderer/Renderer/Boolean.js";import"../../RadioGroup/RadioGroup.js";import"../../Radio/Radio.js";import"../FilterRenderer/Renderer/Range.js";function M(){return e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function V({value:a,onChange:r}){const[l,c]=v(a),m=()=>{r(l.trim())};return o("div",{className:"relative",children:[e("input",{type:"search",value:l,onChange:i=>c(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),m())},onBlur:m,placeholder:"Search products...","aria-label":"Search products",autoComplete:"off",className:"w-full h-9 pl-8 pr-8 rounded-md border border-border bg-white text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:border-border-emphasis [&::-webkit-search-cancel-button]:hidden"}),l&&e("button",{type:"button",onClick:()=>{c(""),r("")},"aria-label":"Clear search",className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded-full hover:bg-surface-subtle transition-colors",children:e(A,{})}),e("span",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 [&>svg]:w-full [&>svg]:h-full text-fg-subtle",children:e(D,{})})]})}function ue({availableFilters:a,appliedFilters:r,onFilterChange:l,showMobileFilters:c,setShowMobileFilters:m,searchQuery:s,onSearchChange:n,totalItems:i}){const u=b(()=>S(r,a).filter(t=>t.includeInFilters!==!1),[r,a]),d=n&&e(V,{value:s??"",onChange:n},s),p=()=>u.length>0&&e(g,{selectionMode:"multiple",defaultSelectedKeys:"all",className:"pt-2 mt-3",showDivider:!1,itemClasses:{base:"py-1",title:"text-sm font-medium leading-7",trigger:"py-2 border-b border-gray-200",indicator:'data-[open="true"]:rotate-180',content:"pt-2 pb-3"},children:u.map(t=>e(w,{textValue:t.label,title:e(j,{filter:t,appliedFilters:r,onFilterChange:l}),disableIndicatorAnimation:!0,indicator:M,children:e("div",{className:"pt-2",children:e(I,{filter:t,onFilterChange:l,appliedFilters:r,variant:"sidebar"})})},t.code))});return o(h,{children:[o("div",{className:"hidden lg:flex lg:flex-col lg:basis-[16.5rem] lg:shrink-0",children:[d,p(),r.length>0&&e("button",{type:"button",className:"text-sm text-fg-muted hover:text-slate-700 transition-colors mt-4 mb-8",onClick:()=>l([]),children:"Clear all filters"})]}),e("div",{className:"lg:hidden",children:e(x,{children:e(y,{isOpen:c,onOpenChange:t=>m(t),isDismissable:!0,children:e(N,{children:e(k,{size:"30rem",direction:"left","aria-label":"Filters",className:"p-5",children:({close:t})=>o("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[o("div",{className:"flex items-center w-full justify-between",children:[e("span",{className:"text-xl font-bold text-slate-800",children:"Filters"}),e(f,{variant:"ghost","aria-label":"Close",onPress:()=>t(),className:"justify-start size-auto p-0",children:e(C,{})})]}),o("div",{className:"flex flex-col flex-1 overflow-x-hidden overflow-y-auto [scrollbar-width:none] [-webkit-overflow-scrolling:touch] [&::-webkit-scrollbar]:hidden",children:[d&&e("div",{className:"mt-3",children:d}),p(),i===0&&e(L,{searchQuery:s,hasFilters:r.length>0,onClearFilters:()=>l([]),onClearSearch:s&&n?()=>n(""):void 0})]}),o("div",{className:"shrink-0 pt-3 flex flex-col gap-3 border-t border-gray-200",children:[r.length>0&&e("button",{type:"button",className:"text-sm py-2 text-fg-muted hover:text-slate-700 transition-colors",onClick:()=>l([]),children:"Clear all"}),e(f,{className:"w-full py-6 text-base rounded-xl",variant:"primary",onPress:()=>t(),children:"View Results"})]})]})})})})})})]})}export{ue as CollectionFilters};
@@ -1 +1 @@
1
- import{CollectionFilters as K}from"./CollectionFilters.js";import"react/jsx-runtime";import"react";import"../../Accordion/Accordion.js";import"@heroui/accordion";import"../../../utils/cn.js";import"../../Icon/DownArrow.js";import"../../Button/Button.js";import"react-aria-components";import"../../ModalOverlay/ModalOverlay.js";import"framer-motion";import"../../Modal/Modal.js";import"../../Drawer/Drawer.js";import"../../Icon/Cross.js";import"../../Icon/CrossSmall.js";import"../../Icon/Search.js";import"../FilterRenderer/FilterRenderer.js";import"../../../utils/env.js";import"../../../utils/swatch.js";import"../FilterRenderer/Renderer/Option.js";import"../../Checkbox/Checkbox.js";import"../FilterRenderer/Renderer/useOptionFilterToggle.js";import"../FilterRenderer/Renderer/Swatch.js";import"../FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../../Icon/CheckIcon.js";import"../../../utils/color.js";import"../FilterRenderer/Renderer/Swatch/SwatchImage.js";import"../FilterRenderer/Renderer/Swatch/SwatchText.js";import"../FilterRenderer/Renderer/Boolean.js";import"../../RadioGroup/RadioGroup.js";import"../../Radio/Radio.js";import"../FilterRenderer/Renderer/Range.js";import"../../../utils/collection/mergeFilters.js";import"../FilterAccordionTitle/FilterAccordionTitle.js";import"../EmptyResults/EmptyResults.js";export{K as CollectionFilters};
1
+ import{CollectionFilters as J}from"./CollectionFilters.js";import"react/jsx-runtime";import"react";import"../../Accordion/Accordion.js";import"react-aria-components";import"../../../utils/cn.js";import"../../Icon/DownArrow.js";import"../../Button/Button.js";import"../../ModalOverlay/ModalOverlay.js";import"framer-motion";import"../../Modal/Modal.js";import"../../Drawer/Drawer.js";import"../../Icon/Cross.js";import"../../Icon/CrossSmall.js";import"../../Icon/Search.js";import"../FilterRenderer/FilterRenderer.js";import"../../../utils/env.js";import"../../../utils/swatch.js";import"../FilterRenderer/Renderer/Option.js";import"../../Checkbox/Checkbox.js";import"../FilterRenderer/Renderer/useOptionFilterToggle.js";import"../FilterRenderer/Renderer/Swatch.js";import"../FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../../Icon/CheckIcon.js";import"../../../utils/color.js";import"../FilterRenderer/Renderer/Swatch/SwatchImage.js";import"../FilterRenderer/Renderer/Swatch/SwatchText.js";import"../FilterRenderer/Renderer/Boolean.js";import"../../RadioGroup/RadioGroup.js";import"../../Radio/Radio.js";import"../FilterRenderer/Renderer/Range.js";import"../../../utils/collection/mergeFilters.js";import"../FilterAccordionTitle/FilterAccordionTitle.js";import"../EmptyResults/EmptyResults.js";export{J as CollectionFilters};
@@ -1 +1 @@
1
- "use client";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{Option as p}from"../../Select/Option.js";import{Select as x}from"../../Select/Select.js";import{Button as h}from"../../Button/Button.js";import"../../../utils/cn.js";import{FilterIcon as d}from"../../Icon/FilterIcon.js";import"react-stately";import"react";import"../../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../../Select/parts.js";import"react-aria-components";import"../../Select/ComboBoxSelect.js";import"../../Loader/Pulse.js";import"../../Select/MultiButtonSelect.js";function D({totalItems:o,startItem:s,endItem:r,setShowMobileFilters:m,availableSortOrders:a,appliedSortOrder:e,onSortChange:n}){const c=[...e?[e]:[],...a];return i("div",{className:"flex flex-col gap-y-5 mb-3",children:[i("div",{className:"flex items-center justify-between lg:justify-end gap-x-2",children:[i(h,{className:"lg:hidden grow-0 shrink-0 basis-auto gap-x-3 px-4",size:"sm",variant:"outline",onPress:()=>m(!0),"aria-details":"show filters",children:[l(d,{className:"w-3 h-3"}),"Filters"]}),l(x,{className:"w-44",selectedKey:e?`${e.code}_${e.direction}`:null,onSelectionChange:n,placeholder:"Sort by",label:"Sort By:",classNames:{input:"text-xs w-44 h-8 min-h-0",value:"text-xs",label:"hidden lg:block text-xs text-gray-600 whitespace-nowrap"},children:c.map(t=>l(p,{textValue:t.label,children:t.label},`${t.code}_${t.direction}`))})]}),o>0&&i("p",{className:"text-sm text-fg-muted",children:["Displaying ",s," - ",r," of ",o," items"]})]})}export{D as CollectionToolbar};
1
+ "use client";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{Option as p}from"../../Select/Option.js";import{Select as x}from"../../Select/Select.js";import{Button as h}from"../../Button/Button.js";import"../../../utils/cn.js";import{FilterIcon as u}from"../../Icon/FilterIcon.js";import"react-stately";import"react";import"../../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../../Select/parts.js";import"react-aria-components";import"../../Select/ComboBoxSelect.js";import"../../Loader/Pulse.js";import"../../Select/MultiButtonSelect.js";function D({totalItems:o,startItem:s,endItem:m,setShowMobileFilters:n,availableSortOrders:r,appliedSortOrder:e,onSortChange:a}){const c=[...e?[e]:[],...r];return i("div",{className:"flex flex-col gap-y-5 mb-3",children:[i("div",{className:"flex items-center justify-between lg:justify-end gap-x-2",children:[i(h,{className:"lg:hidden grow-0 shrink-0 basis-auto gap-x-3 px-4",size:"sm",variant:"outline",onPress:()=>n(!0),children:[l(u,{className:"w-3 h-3"}),"Filters"]}),l(x,{className:"w-44",selectedKey:e?`${e.code}_${e.direction}`:null,onSelectionChange:a,placeholder:"Sort by",label:"Sort By:",classNames:{input:"text-xs w-44 h-8 min-h-0",value:"text-xs",label:"hidden lg:block text-xs text-gray-600 whitespace-nowrap"},children:c.map(t=>l(p,{textValue:t.label,children:t.label},`${t.code}_${t.direction}`))})]}),o>0&&i("p",{className:"text-sm text-fg-muted",children:["Displaying ",s," - ",m," of ",o," items"]})]})}export{D as CollectionToolbar};
@@ -1 +1 @@
1
- "use client";import{jsx as c,jsxs as I,Fragment as R}from"react/jsx-runtime";import{Button as p}from"react-aria-components";import{cn as b}from"../../../utils/cn.js";import{CheckIcon as M}from"../../Icon/CheckIcon.js";import{isDevelopment as x}from"../../../utils/env.js";import{isValidHex as P,isVeryLight as j}from"../../../utils/color.js";import{isSwatchRenderer as y,SwatchRenderer as $,isValidImageUrl as _}from"../../../utils/swatch.js";function L(d){const s=new Map;for(const a of d)if("renderer"in a&&y(a.renderer)&&"options"in a)for(const r of a.options)r.swatch&&s.set(r.id,{...r.swatch,attributeCode:a.code,optionCode:r.code});return s}function T(d){const s=new Set;for(const a of d)if(a.simpleProduct?.saleability?.isSaleable!==!1)for(const r of a.attributes)s.add(`${r.attribute.code}:${r.option.code}`);return s}function V(d,s,a,r){const m=new Set,h=[];for(const l of d)for(const i of l.attributes){const f=s.get(i.option.id);f&&!m.has(i.option.id)&&a.has(i.attribute.code)&&(m.add(i.option.id),h.push({optionId:i.option.id,optionCode:f.optionCode,attributeCode:i.attribute.code,label:i.option.label,swatch:f,image:l.simpleProduct.image??null,isSaleable:r.has(`${i.attribute.code}:${i.option.code}`)}))}return h.sort((l,i)=>l.isSaleable===i.isSaleable?0:l.isSaleable?-1:1),h}function O({variants:d,availableFilters:s,attributeSwatchConfigs:a=[],matchedOptionIds:r,selectedOptionId:m,onSelect:h}){const l=new Map;for(const e of a)e.swatch?.listRenderer&&(x&&!y(e.swatch.listRenderer)&&console.warn(`[Swatch] Unknown listRenderer "${e.swatch.listRenderer}" for attribute "${e.code}" — skipping list swatches`),l.set(e.code,e.swatch.listRenderer));const i=L(s),f=T(d),u=V(d,i,l,f);if(u.length===0)return null;const U=new Set(u.map(e=>e.optionId)),k=r.find(e=>U.has(e)),N=m??k??u[0]?.optionId??null,S=u[0]?l.get(u[0].attributeCode)??null:null;return c("div",{className:"flex flex-row flex-wrap items-center gap-1.5 mt-1.5",children:u.map(e=>{const o=N===e.optionId,w=e.isSaleable?e.label:`${e.label} (out of stock)`;if(S===$.IMAGE)return c(p,{"aria-label":w,className:"cursor-pointer p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>c("span",{className:b("block w-8 aspect-[2.2/1] border bg-contain bg-center bg-no-repeat transition-all duration-150",o?"border-fg ring-1 ring-fg":"border-border-subtle",t&&!o&&"border-border-emphasis"),title:w,style:e.swatch.imageUrl?{backgroundImage:`url(${e.swatch.imageUrl})`}:void 0})},e.optionId);if(S===$.TEXT)return c(p,{"aria-label":w,className:"cursor-pointer p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>c("span",{className:b("inline-flex items-center px-1.5 py-0.5 text-[10px] font-medium border transition-colors duration-150",o?"bg-surface-inverse text-white border-fg":"bg-white text-slate-700 border-border",t&&!o&&"border-slate-500"),children:e.swatch.text??e.label})},e.optionId);const n=_(e.swatch.imageUrl),C=P(e.swatch.hex);if(!n&&!C){if(x){const t=[];e.swatch.hex&&!C&&t.push(`invalid hex "${e.swatch.hex}"`),e.swatch.imageUrl&&!n&&t.push(`invalid imageUrl "${e.swatch.imageUrl}"`),!e.swatch.hex&&!e.swatch.imageUrl&&t.push("missing hex and imageUrl"),console.warn(`[Swatch] Skipping list swatch for attribute "${e.attributeCode}" option "${e.optionCode}" — ${t.join("; ")}`)}return null}x&&e.swatch.imageUrl&&!n&&console.warn(`[Swatch] Falling back to SWATCH (hex) renderer for attribute "${e.attributeCode}" option "${e.optionCode}" — invalid imageUrl "${e.swatch.imageUrl}"`);const g=n?!1:j(e.swatch.hex??null),v=n?{backgroundImage:`url(${e.swatch.imageUrl})`}:{backgroundColor:e.swatch.hex??void 0};return c(p,{"aria-label":w,className:"cursor-pointer size-4 flex items-center justify-center p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>I("span",{className:b("relative inline-flex items-center justify-center size-4 rounded-full transition-all duration-150 overflow-hidden",n&&"bg-cover bg-center",n&&o&&"ring-2 ring-inset ring-white shadow-[0_0_0_2px_#222]",n&&t&&!o&&"ring-1 ring-border-emphasis",!n&&g&&"border border-border"),style:v,children:[!e.isSaleable&&I(R,{children:[c("span",{className:b("absolute top-1/2 left-1/2 w-[141%] h-[1.5px] -translate-x-1/2 -translate-y-1/2 -rotate-45",g?"bg-slate-400":"bg-white drop-shadow-sm",t&&!o&&"opacity-70")}),(o||t)&&c("span",{className:b("absolute top-1/2 left-1/2 w-[141%] h-[1.5px] -translate-x-1/2 -translate-y-1/2 rotate-45",g?"bg-slate-400":"bg-white drop-shadow-sm",t&&!o&&"opacity-70")})]}),!n&&e.isSaleable&&(o||t)&&c(M,{className:b("w-2.5 h-2.5 transition-opacity duration-150",g?"text-fg-subtle":"text-white drop-shadow-sm",t&&!o&&"opacity-70")})]})},e.optionId)})})}export{O as ProductCardSwatches};
1
+ "use client";import{jsx as c,jsxs as I,Fragment as R}from"react/jsx-runtime";import{Button as p}from"react-aria-components";import{cn as b}from"../../../utils/cn.js";import{CheckIcon as M}from"../../Icon/CheckIcon.js";import{isDevelopment as x}from"../../../utils/env.js";import{isValidHex as P,isVeryLight as j}from"../../../utils/color.js";import{isSwatchRenderer as y,SwatchRenderer as $,isValidImageUrl as _}from"../../../utils/swatch.js";function L(d){const s=new Map;for(const a of d)if("renderer"in a&&y(a.renderer)&&"options"in a)for(const r of a.options)r.swatch&&s.set(r.id,{...r.swatch,attributeCode:a.code,optionCode:r.code});return s}function T(d){const s=new Set;for(const a of d)if(a.simpleProduct?.saleability?.isSaleable!==!1)for(const r of a.attributes)s.add(`${r.attribute.code}:${r.option.code}`);return s}function V(d,s,a,r){const m=new Set,h=[];for(const l of d)for(const i of l.attributes){const f=s.get(i.option.id);f&&!m.has(i.option.id)&&a.has(i.attribute.code)&&(m.add(i.option.id),h.push({optionId:i.option.id,optionCode:f.optionCode,attributeCode:i.attribute.code,label:i.option.label,swatch:f,image:l.simpleProduct.image??null,isSaleable:r.has(`${i.attribute.code}:${i.option.code}`)}))}return h.sort((l,i)=>l.isSaleable===i.isSaleable?0:l.isSaleable?-1:1),h}function O({variants:d,availableFilters:s,attributeSwatchConfigs:a=[],matchedOptionIds:r,selectedOptionId:m,onSelect:h}){const l=new Map;for(const e of a)e.swatch?.listRenderer&&(x&&!y(e.swatch.listRenderer)&&console.warn(`[Swatch] Unknown listRenderer "${e.swatch.listRenderer}" for attribute "${e.code}" — skipping list swatches`),l.set(e.code,e.swatch.listRenderer));const i=L(s),f=T(d),u=V(d,i,l,f);if(u.length===0)return null;const U=new Set(u.map(e=>e.optionId)),k=r.find(e=>U.has(e)),N=m??k??u[0]?.optionId??null,S=u[0]?l.get(u[0].attributeCode)??null:null;return c("div",{className:"flex flex-row flex-wrap items-center gap-2 mt-1.5",children:u.map(e=>{const o=N===e.optionId,w=e.isSaleable?e.label:`${e.label} (out of stock)`;if(S===$.IMAGE)return c(p,{"aria-label":w,className:"cursor-pointer p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>c("span",{className:b("block w-8 aspect-[2.2/1] border bg-contain bg-center bg-no-repeat transition-all duration-150",o?"border-fg ring-1 ring-fg":"border-border-subtle",t&&!o&&"border-border-emphasis"),title:w,style:e.swatch.imageUrl?{backgroundImage:`url(${e.swatch.imageUrl})`}:void 0})},e.optionId);if(S===$.TEXT)return c(p,{"aria-label":w,className:"cursor-pointer p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>c("span",{className:b("inline-flex items-center px-1.5 py-0.5 text-[10px] font-medium border transition-colors duration-150",o?"bg-surface-inverse text-white border-fg":"bg-white text-slate-700 border-border",t&&!o&&"border-slate-500"),children:e.swatch.text??e.label})},e.optionId);const n=_(e.swatch.imageUrl),C=P(e.swatch.hex);if(!n&&!C){if(x){const t=[];e.swatch.hex&&!C&&t.push(`invalid hex "${e.swatch.hex}"`),e.swatch.imageUrl&&!n&&t.push(`invalid imageUrl "${e.swatch.imageUrl}"`),!e.swatch.hex&&!e.swatch.imageUrl&&t.push("missing hex and imageUrl"),console.warn(`[Swatch] Skipping list swatch for attribute "${e.attributeCode}" option "${e.optionCode}" — ${t.join("; ")}`)}return null}x&&e.swatch.imageUrl&&!n&&console.warn(`[Swatch] Falling back to SWATCH (hex) renderer for attribute "${e.attributeCode}" option "${e.optionCode}" — invalid imageUrl "${e.swatch.imageUrl}"`);const g=n?!1:j(e.swatch.hex??null),v=n?{backgroundImage:`url(${e.swatch.imageUrl})`}:{backgroundColor:e.swatch.hex??void 0};return c(p,{"aria-label":w,className:"cursor-pointer size-4 flex items-center justify-center p-0",onPress:()=>{h(e.optionId,e.optionCode,e.image,e.attributeCode)},children:({isHovered:t})=>I("span",{className:b("relative inline-flex items-center justify-center size-4 rounded-full transition-all duration-150 overflow-hidden",n&&"bg-cover bg-center",n&&o&&"ring-2 ring-inset ring-white shadow-[0_0_0_2px_#222]",n&&t&&!o&&"ring-1 ring-border-emphasis",!n&&g&&"border border-border"),style:v,children:[!e.isSaleable&&I(R,{children:[c("span",{className:b("absolute top-1/2 left-1/2 w-[141%] h-[1.5px] -translate-x-1/2 -translate-y-1/2 -rotate-45",g?"bg-slate-400":"bg-white drop-shadow-sm",t&&!o&&"opacity-70")}),(o||t)&&c("span",{className:b("absolute top-1/2 left-1/2 w-[141%] h-[1.5px] -translate-x-1/2 -translate-y-1/2 rotate-45",g?"bg-slate-400":"bg-white drop-shadow-sm",t&&!o&&"opacity-70")})]}),!n&&e.isSaleable&&(o||t)&&c(M,{className:b("w-2.5 h-2.5 transition-opacity duration-150",g?"text-fg-subtle":"text-white drop-shadow-sm",t&&!o&&"opacity-70")})]})},e.optionId)})})}export{O as ProductCardSwatches};
@@ -1 +1 @@
1
- import{AttributeDataProvider as U,useAttributeData as V}from"./AttributeDataProvider/AttributeDataProvider.js";import{EmptyResults as X}from"./EmptyResults/EmptyResults.js";import{ProductPrice as Z}from"./ProductPrice/ProductPrice.js";import{FilterRenderer as $}from"./FilterRenderer/FilterRenderer.js";import{CollectionFilterChips as or}from"./CollectionFilterChips/CollectionFilterChips.js";import{FilterAccordionTitle as ir}from"./FilterAccordionTitle/FilterAccordionTitle.js";import{ProductCardSwatches as mr}from"./ProductCardSwatches/ProductCardSwatches.js";import{CollectionFilters as lr}from"./CollectionFilters/CollectionFilters.js";import{CollectionToolbar as fr}from"./CollectionToolbar/CollectionToolbar.js";import"react/jsx-runtime";import"react";import"../../utils/env.js";import"../../utils/swatch.js";import"./FilterRenderer/Renderer/Option.js";import"../Checkbox/Checkbox.js";import"react-aria-components";import"../../utils/cn.js";import"./FilterRenderer/Renderer/useOptionFilterToggle.js";import"./FilterRenderer/Renderer/Swatch.js";import"./FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../Icon/CheckIcon.js";import"../../utils/color.js";import"./FilterRenderer/Renderer/Swatch/SwatchImage.js";import"./FilterRenderer/Renderer/Swatch/SwatchText.js";import"./FilterRenderer/Renderer/Boolean.js";import"../RadioGroup/RadioGroup.js";import"../Radio/Radio.js";import"./FilterRenderer/Renderer/Range.js";import"../Button/Button.js";import"../Icon/CrossSmall.js";import"../../utils/collection/getAppliedFilterChips.js";import"../../utils/collection/removeFilterChip.js";import"../Accordion/Accordion.js";import"@heroui/accordion";import"../Icon/DownArrow.js";import"../ModalOverlay/ModalOverlay.js";import"framer-motion";import"../Modal/Modal.js";import"../Drawer/Drawer.js";import"../Icon/Cross.js";import"../Icon/Search.js";import"../../utils/collection/mergeFilters.js";import"../Select/Option.js";import"react-stately";import"../Select/Select.js";import"../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../Select/parts.js";import"../Select/ComboBoxSelect.js";import"../Loader/Pulse.js";import"../Select/MultiButtonSelect.js";import"../Icon/FilterIcon.js";export{U as AttributeDataProvider,or as CollectionFilterChips,lr as CollectionFilters,fr as CollectionToolbar,X as EmptyResults,ir as FilterAccordionTitle,$ as FilterRenderer,mr as ProductCardSwatches,Z as ProductPrice,V as useAttributeData};
1
+ import{AttributeDataProvider as Q,useAttributeData as U}from"./AttributeDataProvider/AttributeDataProvider.js";import{EmptyResults as W}from"./EmptyResults/EmptyResults.js";import{ProductPrice as Y}from"./ProductPrice/ProductPrice.js";import{FilterRenderer as _}from"./FilterRenderer/FilterRenderer.js";import{CollectionFilterChips as rr}from"./CollectionFilterChips/CollectionFilterChips.js";import{FilterAccordionTitle as tr}from"./FilterAccordionTitle/FilterAccordionTitle.js";import{ProductCardSwatches as pr}from"./ProductCardSwatches/ProductCardSwatches.js";import{CollectionFilters as er}from"./CollectionFilters/CollectionFilters.js";import{CollectionToolbar as cr}from"./CollectionToolbar/CollectionToolbar.js";import"react/jsx-runtime";import"react";import"../../utils/env.js";import"../../utils/swatch.js";import"./FilterRenderer/Renderer/Option.js";import"../Checkbox/Checkbox.js";import"react-aria-components";import"../../utils/cn.js";import"./FilterRenderer/Renderer/useOptionFilterToggle.js";import"./FilterRenderer/Renderer/Swatch.js";import"./FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../Icon/CheckIcon.js";import"../../utils/color.js";import"./FilterRenderer/Renderer/Swatch/SwatchImage.js";import"./FilterRenderer/Renderer/Swatch/SwatchText.js";import"./FilterRenderer/Renderer/Boolean.js";import"../RadioGroup/RadioGroup.js";import"../Radio/Radio.js";import"./FilterRenderer/Renderer/Range.js";import"../Button/Button.js";import"../Icon/CrossSmall.js";import"../../utils/collection/getAppliedFilterChips.js";import"../../utils/collection/removeFilterChip.js";import"../Accordion/Accordion.js";import"../Icon/DownArrow.js";import"../ModalOverlay/ModalOverlay.js";import"framer-motion";import"../Modal/Modal.js";import"../Drawer/Drawer.js";import"../Icon/Cross.js";import"../Icon/Search.js";import"../../utils/collection/mergeFilters.js";import"../Select/Option.js";import"react-stately";import"../Select/Select.js";import"../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../Select/parts.js";import"../Select/ComboBoxSelect.js";import"../Loader/Pulse.js";import"../Select/MultiButtonSelect.js";import"../Icon/FilterIcon.js";export{Q as AttributeDataProvider,rr as CollectionFilterChips,er as CollectionFilters,cr as CollectionToolbar,W as EmptyResults,tr as FilterAccordionTitle,_ as FilterRenderer,pr as ProductCardSwatches,Y as ProductPrice,U as useAttributeData};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Popover as b,Menu as f}from"react-aria-components";import{forwardRef as _}from"react";import{motion as v}from"framer-motion";import{cn as t}from"../../utils/cn.js";const c=_(({style:e,...o},r)=>{const i=typeof e=="function"?e(o):e;return n(b,{...o,ref:r,style:i})});let d=null;function w(){return typeof window>"u"?null:(d||(d=v.create(c)),d)}const s=w();function C({children:e,key:o,onAction:r,setAnimation:i,animation:a="hidden",className:x,classNames:u,...m}){const p=t("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-56","bg-white","border border-solid border-border",x);return s?n(s,{className:p,isExiting:a==="hidden",onAnimationComplete:h=>{i(l=>h==="hidden"&&l==="hidden"?"unmounted":l)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:a,...m,children:n(f,{className:t("outline-none",u?.menu),onAction:r,children:e})},o):n(c,{className:p,...m,children:n(f,{className:t("outline-none",u?.menu),onAction:r,children:e})},o)}export{C as ContextMenu,C as default};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Popover as b,Menu as f}from"react-aria-components";import{forwardRef as _}from"react";import{m as v}from"framer-motion";import{cn as t}from"../../utils/cn.js";const c=_(({style:e,...o},r)=>{const i=typeof e=="function"?e(o):e;return n(b,{...o,ref:r,style:i})});let d=null;function w(){return typeof window>"u"?null:(d||(d=v.create(c)),d)}const s=w();function C({children:e,key:o,onAction:r,setAnimation:i,animation:a="hidden",className:x,classNames:u,...m}){const p=t("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-56","bg-white","border border-solid border-border",x);return s?n(s,{className:p,isExiting:a==="hidden",onAnimationComplete:h=>{i(l=>h==="hidden"&&l==="hidden"?"unmounted":l)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:a,...m,children:n(f,{className:t("outline-none",u?.menu),onAction:r,children:e})},o):n(c,{className:p,...m,children:n(f,{className:t("outline-none",u?.menu),onAction:r,children:e})},o)}export{C as ContextMenu,C as default};
@@ -13,17 +13,25 @@ export declare const useDialogTrigger: () => {
13
13
  onOpenChange: (isOpen: boolean) => void;
14
14
  };
15
15
  /**
16
- * Thin wrapper over react-aria's DialogTrigger, kept as the package's stable import point.
16
+ * The package's stable trigger. Owns an overlay-trigger state, provides it on
17
+ * react-aria's `OverlayTriggerStateContext` (which ModalOverlay — ours and
18
+ * react-aria's — reads), and wires the FIRST child element's `onPress` to
19
+ * toggle it.
17
20
  *
18
- * Deliberately NO module-scoped context here. The previous version mirrored the open state into
19
- * its own `createContext` for the overlay's enter/exit animation — and a module-scoped context
20
- * only works when every consumer resolves the SAME package instance. With two @clicktap/ui copies
21
- * installed (an ordinary pnpm-workspace version skew), the trigger wrote into one context copy
22
- * while the overlay read the other's default, so every trigger-driven modal mounted at
23
- * `opacity: 0` with zero errors (CTAP-1210, reported by noco). The animation state now lives in
24
- * ModalOverlay itself, derived from react-aria's `OverlayTriggerStateContext` — the one context
25
- * that is reliably shared, because everything fails loudly if react-aria-components itself is
26
- * duplicated.
21
+ * Deliberately NOT a wrapper over react-aria-components' DialogTrigger: RAC
22
+ * wires its trigger through `PressResponderContext`, and in this app's
23
+ * production bundles that registration silently never reaches the Button —
24
+ * pure-context triggers render an inert button (no aria attrs applied, press
25
+ * never toggles state; every account modal was dead) while an explicit
26
+ * `onPress` prop on the same Button works everywhere (FilterButton,
27
+ * RegionSelectAction, AddToCart). Until that press-responder failure is
28
+ * root-caused (CTAP-1383 follow-up), this component injects the explicit
29
+ * `onPress` itself, which is the mechanism the rest of the app already
30
+ * proves out.
31
+ *
32
+ * A consumer-supplied `onPress` on the trigger child still runs (chained
33
+ * before the toggle), so controlled usages that mirror open state into their
34
+ * own `isOpen` keep working unchanged.
27
35
  */
28
36
  export declare function DialogTrigger(props: DialogTriggerProps): import("react/jsx-runtime").JSX.Element;
29
37
  export default DialogTrigger;
@@ -1 +1 @@
1
- "use client";import{jsx as r}from"react/jsx-runtime";import{useContext as i}from"react";import{DialogTrigger as n,OverlayTriggerStateContext as o}from"react-aria-components";const m=()=>{const e=i(o);return{animation:e?.isOpen?"visible":"unmounted",setAnimation:()=>{},onOpenChange:t=>e?.setOpen(t)}};function u(e){return r(n,{...e})}export{u as DialogTrigger,u as default,m as useDialogTrigger};
1
+ "use client";import{jsxs as a}from"react/jsx-runtime";import{Children as g,isValidElement as l,cloneElement as m,useContext as u}from"react";import{OverlayTriggerStateContext as n}from"react-aria-components";import{useOverlayTriggerState as c}from"react-stately";const O=()=>{const e=u(n);return{animation:e?.isOpen?"visible":"unmounted",setAnimation:()=>{},onOpenChange:r=>e?.setOpen(r)}};function T(e){const r=c(e),[t,...o]=g.toArray(e.children),i=l(t)?m(t,{onPress:s=>{t.props.onPress?.(s),r.toggle()}}):t;return a(n.Provider,{value:r,children:[i,o]})}export{T as DialogTrigger,T as default,O as useDialogTrigger};
@@ -1 +1 @@
1
- import{DialogTrigger as m,useDialogTrigger as p}from"./DialogTrigger.js";import"react/jsx-runtime";import"react";import"react-aria-components";export{m as DialogTrigger,p as useDialogTrigger};
1
+ import{DialogTrigger as t,useDialogTrigger as e}from"./DialogTrigger.js";import"react/jsx-runtime";import"react";import"react-aria-components";import"react-stately";export{t as DialogTrigger,e as useDialogTrigger};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{forwardRef as u}from"react";import{Dialog as f}from"react-aria-components";import{motion as b}from"framer-motion";import{cn as m}from"../../utils/cn.js";const p={top:{hidden:{y:"-100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},bottom:{hidden:{y:"100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},right:{hidden:{x:"100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}},left:{hidden:{x:"-100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}}},l=u(({style:e,size:t="20rem",...o},r)=>{const a=typeof e=="function"?e(o):{...e,"--drawer-size":`${t}`};return n(f,{...o,ref:r,style:a})});let i=null;function w(){return typeof window>"u"?null:(i||(i=b.create(l)),i)}const d=w();function c({direction:e="right",children:t,className:o,animationVariants:r,...a}){const s={className:m("fixed p-8 bg-white","outline-none focus:outline-none focus-visible:outline-none","border-solid border-border-subtle","max-w-full max-h-[var(--visual-viewport-height)]",e==="top"&&"top-0 left-0 right-0 bottom-auto border-b shadow-[0_8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",e==="right"&&"top-0 left-auto bottom-0 right-0 border-l shadow-[-8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",e==="bottom"&&"bottom-0 left-0 right-0 top-auto border-t shadow-[0_-8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",e==="left"&&"top-0 bottom-0 left-0 right-auto border-r shadow-[8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",o),"data-direction":e,...a};return d?n(d,{variants:r||p[e],...s,children:t}):n(l,{...s,children:t})}export{c as Drawer,c as default};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{forwardRef as u}from"react";import{Dialog as f}from"react-aria-components";import{m as b}from"framer-motion";import{cn as m}from"../../utils/cn.js";const p={top:{hidden:{y:"-100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},bottom:{hidden:{y:"100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},right:{hidden:{x:"100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}},left:{hidden:{x:"-100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}}},l=u(({style:e,size:t="20rem",...o},r)=>{const a=typeof e=="function"?e(o):{...e,"--drawer-size":`${t}`};return n(f,{...o,ref:r,style:a})});let i=null;function w(){return typeof window>"u"?null:(i||(i=b.create(l)),i)}const d=w();function c({direction:e="right",children:t,className:o,animationVariants:r,...a}){const s={className:m("fixed p-8 bg-white","outline-none focus:outline-none focus-visible:outline-none","border-solid border-border-subtle","max-w-full max-h-[var(--visual-viewport-height)]",e==="top"&&"top-0 left-0 right-0 bottom-auto border-b shadow-[0_8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",e==="right"&&"top-0 left-auto bottom-0 right-0 border-l shadow-[-8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",e==="bottom"&&"bottom-0 left-0 right-0 top-auto border-t shadow-[0_-8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",e==="left"&&"top-0 bottom-0 left-0 right-auto border-r shadow-[8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",o),"data-direction":e,...a};return d?n(d,{variants:r||p[e],...s,children:t}):n(l,{...s,children:t})}export{c as Drawer,c as default};