@fanvue/ui 3.52.0 → 3.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs +4 -2
  2. package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs.map +1 -1
  3. package/dist/cjs/components/Autocomplete/Autocomplete.cjs +34 -10
  4. package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
  5. package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs +13 -1
  6. package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs.map +1 -1
  7. package/dist/cjs/components/Badge/Badge.cjs +7 -6
  8. package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
  9. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +2 -2
  10. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
  11. package/dist/cjs/components/Button/Button.cjs +2 -1
  12. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  13. package/dist/cjs/components/Card/Card.cjs +6 -3
  14. package/dist/cjs/components/Card/Card.cjs.map +1 -1
  15. package/dist/cjs/components/Chart/ChartCard.cjs +2 -1
  16. package/dist/cjs/components/Chart/ChartCard.cjs.map +1 -1
  17. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs +1 -1
  18. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs.map +1 -1
  19. package/dist/cjs/components/ChatInput/ChatInput.cjs +2 -2
  20. package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
  21. package/dist/cjs/components/ChatMessage/ChatMessage.cjs +4 -2
  22. package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
  23. package/dist/cjs/components/Chip/Chip.cjs +10 -9
  24. package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
  25. package/dist/cjs/components/CreatorCard/CreatorCard.cjs +3 -5
  26. package/dist/cjs/components/CreatorCard/CreatorCard.cjs.map +1 -1
  27. package/dist/cjs/components/CreatorCover/CreatorCover.cjs +11 -7
  28. package/dist/cjs/components/CreatorCover/CreatorCover.cjs.map +1 -1
  29. package/dist/cjs/components/DatePicker/DatePicker.cjs +37 -16
  30. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  31. package/dist/cjs/components/DatePicker/DateRangePanel.cjs +143 -0
  32. package/dist/cjs/components/DatePicker/DateRangePanel.cjs.map +1 -0
  33. package/dist/cjs/components/DatePicker/DateRangePicker.cjs +33 -0
  34. package/dist/cjs/components/DatePicker/DateRangePicker.cjs.map +1 -0
  35. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +33 -10
  36. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
  37. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +2 -1
  38. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -1
  39. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +18 -13
  40. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
  41. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +56 -40
  42. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
  43. package/dist/cjs/components/FilterMenu/FilterMenu.cjs +45 -0
  44. package/dist/cjs/components/FilterMenu/FilterMenu.cjs.map +1 -0
  45. package/dist/cjs/components/IconButton/IconButton.cjs +7 -3
  46. package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
  47. package/dist/cjs/components/Icons/MenuRowIcon.cjs +9 -2
  48. package/dist/cjs/components/Icons/MenuRowIcon.cjs.map +1 -1
  49. package/dist/cjs/components/Icons/ReorganiseIcon.cjs +65 -0
  50. package/dist/cjs/components/Icons/ReorganiseIcon.cjs.map +1 -0
  51. package/dist/cjs/components/Icons/VerifiedIcon.cjs +9 -15
  52. package/dist/cjs/components/Icons/VerifiedIcon.cjs.map +1 -1
  53. package/dist/cjs/components/Pagination/Pagination.cjs +3 -2
  54. package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
  55. package/dist/cjs/components/PhoneField/PhoneField.cjs +21 -17
  56. package/dist/cjs/components/PhoneField/PhoneField.cjs.map +1 -1
  57. package/dist/cjs/components/Popover/Popover.cjs +69 -0
  58. package/dist/cjs/components/Popover/Popover.cjs.map +1 -0
  59. package/dist/cjs/components/Select/Select.cjs +49 -12
  60. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  61. package/dist/cjs/components/Slider/SliderThumb.cjs +3 -2
  62. package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -1
  63. package/dist/cjs/components/Snackbar/Snackbar.cjs +1 -1
  64. package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
  65. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  66. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  67. package/dist/cjs/components/Table/Table.cjs +104 -38
  68. package/dist/cjs/components/Table/Table.cjs.map +1 -1
  69. package/dist/cjs/components/Table/TableToolbarSearchFilters.cjs +152 -0
  70. package/dist/cjs/components/Table/TableToolbarSearchFilters.cjs.map +1 -0
  71. package/dist/cjs/components/Table/useFittingCount.cjs +51 -0
  72. package/dist/cjs/components/Table/useFittingCount.cjs.map +1 -0
  73. package/dist/cjs/components/Tag/Tag.cjs +99 -0
  74. package/dist/cjs/components/Tag/Tag.cjs.map +1 -0
  75. package/dist/cjs/components/TextArea/TextArea.cjs +5 -4
  76. package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
  77. package/dist/cjs/components/TextField/TextField.cjs +30 -15
  78. package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
  79. package/dist/cjs/date-picker.cjs +4 -0
  80. package/dist/cjs/date-picker.cjs.map +1 -1
  81. package/dist/cjs/index.cjs +12 -0
  82. package/dist/cjs/index.cjs.map +1 -1
  83. package/dist/cjs/utils/floatingContentSurface.cjs +8 -0
  84. package/dist/cjs/utils/floatingContentSurface.cjs.map +1 -0
  85. package/dist/cjs/utils/inputFieldClasses.cjs +8 -0
  86. package/dist/cjs/utils/inputFieldClasses.cjs.map +1 -0
  87. package/dist/cjs/utils/pointerCapture.cjs +20 -0
  88. package/dist/cjs/utils/pointerCapture.cjs.map +1 -0
  89. package/dist/cjs/utils/useDragToDismiss.cjs +3 -2
  90. package/dist/cjs/utils/useDragToDismiss.cjs.map +1 -1
  91. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs +2 -1
  92. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs.map +1 -1
  93. package/dist/components/AudioPlayer/AudioPlayer.mjs +4 -2
  94. package/dist/components/AudioPlayer/AudioPlayer.mjs.map +1 -1
  95. package/dist/components/Autocomplete/Autocomplete.mjs +34 -10
  96. package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
  97. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +13 -1
  98. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -1
  99. package/dist/components/Badge/Badge.mjs +7 -6
  100. package/dist/components/Badge/Badge.mjs.map +1 -1
  101. package/dist/components/BottomNavigation/BottomNavigation.mjs +2 -2
  102. package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
  103. package/dist/components/Button/Button.mjs +2 -1
  104. package/dist/components/Button/Button.mjs.map +1 -1
  105. package/dist/components/Card/Card.mjs +6 -3
  106. package/dist/components/Card/Card.mjs.map +1 -1
  107. package/dist/components/Chart/ChartCard.mjs +2 -1
  108. package/dist/components/Chart/ChartCard.mjs.map +1 -1
  109. package/dist/components/Chart/ChartLoadingOverlay.mjs +1 -1
  110. package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -1
  111. package/dist/components/ChatInput/ChatInput.mjs +2 -2
  112. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  113. package/dist/components/ChatMessage/ChatMessage.mjs +4 -2
  114. package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
  115. package/dist/components/Chip/Chip.mjs +10 -9
  116. package/dist/components/Chip/Chip.mjs.map +1 -1
  117. package/dist/components/CreatorCard/CreatorCard.mjs +3 -5
  118. package/dist/components/CreatorCard/CreatorCard.mjs.map +1 -1
  119. package/dist/components/CreatorCover/CreatorCover.mjs +11 -7
  120. package/dist/components/CreatorCover/CreatorCover.mjs.map +1 -1
  121. package/dist/components/DatePicker/DatePicker.mjs +39 -18
  122. package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
  123. package/dist/components/DatePicker/DateRangePanel.mjs +126 -0
  124. package/dist/components/DatePicker/DateRangePanel.mjs.map +1 -0
  125. package/dist/components/DatePicker/DateRangePicker.mjs +33 -0
  126. package/dist/components/DatePicker/DateRangePicker.mjs.map +1 -0
  127. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +33 -10
  128. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
  129. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +2 -1
  130. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -1
  131. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +18 -13
  132. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
  133. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +56 -40
  134. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
  135. package/dist/components/FilterMenu/FilterMenu.mjs +28 -0
  136. package/dist/components/FilterMenu/FilterMenu.mjs.map +1 -0
  137. package/dist/components/IconButton/IconButton.mjs +7 -3
  138. package/dist/components/IconButton/IconButton.mjs.map +1 -1
  139. package/dist/components/Icons/MenuRowIcon.mjs +9 -2
  140. package/dist/components/Icons/MenuRowIcon.mjs.map +1 -1
  141. package/dist/components/Icons/ReorganiseIcon.mjs +48 -0
  142. package/dist/components/Icons/ReorganiseIcon.mjs.map +1 -0
  143. package/dist/components/Icons/VerifiedIcon.mjs +9 -15
  144. package/dist/components/Icons/VerifiedIcon.mjs.map +1 -1
  145. package/dist/components/Pagination/Pagination.mjs +3 -2
  146. package/dist/components/Pagination/Pagination.mjs.map +1 -1
  147. package/dist/components/PhoneField/PhoneField.mjs +21 -17
  148. package/dist/components/PhoneField/PhoneField.mjs.map +1 -1
  149. package/dist/components/Popover/Popover.mjs +51 -0
  150. package/dist/components/Popover/Popover.mjs.map +1 -0
  151. package/dist/components/Select/Select.mjs +49 -12
  152. package/dist/components/Select/Select.mjs.map +1 -1
  153. package/dist/components/Slider/SliderThumb.mjs +3 -2
  154. package/dist/components/Slider/SliderThumb.mjs.map +1 -1
  155. package/dist/components/Snackbar/Snackbar.mjs +1 -1
  156. package/dist/components/Snackbar/Snackbar.mjs.map +1 -1
  157. package/dist/components/Switch/Switch.mjs +1 -1
  158. package/dist/components/Switch/Switch.mjs.map +1 -1
  159. package/dist/components/Table/Table.mjs +104 -38
  160. package/dist/components/Table/Table.mjs.map +1 -1
  161. package/dist/components/Table/TableToolbarSearchFilters.mjs +135 -0
  162. package/dist/components/Table/TableToolbarSearchFilters.mjs.map +1 -0
  163. package/dist/components/Table/useFittingCount.mjs +34 -0
  164. package/dist/components/Table/useFittingCount.mjs.map +1 -0
  165. package/dist/components/Tag/Tag.mjs +82 -0
  166. package/dist/components/Tag/Tag.mjs.map +1 -0
  167. package/dist/components/TextArea/TextArea.mjs +5 -4
  168. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  169. package/dist/components/TextField/TextField.mjs +30 -15
  170. package/dist/components/TextField/TextField.mjs.map +1 -1
  171. package/dist/date-picker.d.ts +109 -0
  172. package/dist/date-picker.mjs +5 -1
  173. package/dist/date-picker.mjs.map +1 -1
  174. package/dist/index.d.ts +317 -20
  175. package/dist/index.mjs +12 -0
  176. package/dist/index.mjs.map +1 -1
  177. package/dist/styles/base.css +51 -4
  178. package/dist/styles/theme.css +1217 -1
  179. package/dist/utils/floatingContentSurface.mjs +8 -0
  180. package/dist/utils/floatingContentSurface.mjs.map +1 -0
  181. package/dist/utils/inputFieldClasses.mjs +8 -0
  182. package/dist/utils/inputFieldClasses.mjs.map +1 -0
  183. package/dist/utils/pointerCapture.mjs +20 -0
  184. package/dist/utils/pointerCapture.mjs.map +1 -0
  185. package/dist/utils/useDragToDismiss.mjs +3 -2
  186. package/dist/utils/useDragToDismiss.mjs.map +1 -1
  187. package/dist/utils/useSuppressClickAfterDrag.mjs +2 -1
  188. package/dist/utils/useSuppressClickAfterDrag.mjs.map +1 -1
  189. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.mjs","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountVariant } from \"../Count/Count\";\n\n/** Visual variant of the chip. */\nexport type ChipVariant = \"rounded\" | \"square\" | \"dark\";\n/** Height of the chip in pixels. */\nexport type ChipSize = \"32\" | \"36\" | \"40\";\n/** Height of the notification badge in pixels. */\nexport type ChipNotificationSize = \"16\" | \"20\";\n\nexport interface ChipProps extends React.HTMLAttributes<HTMLElement> {\n /** Visual variant of the chip. @default \"rounded\" */\n variant?: ChipVariant;\n /** Height of the chip in pixels. @default \"32\" */\n size?: ChipSize;\n /** Whether the chip is in a selected (pressed) state. @default false */\n selected?: boolean;\n /** Whether the chip is disabled. @default false */\n disabled?: boolean;\n /** Whether to show a coloured status dot at the leading edge. @default false */\n leftDot?: boolean;\n /**\n * Whether the chip uses a dashed border for add/create affordances.\n * When `selected`, it becomes a subtle filled state with a solid border.\n * Has no effect when `variant=\"dark\"`.\n * @default false\n */\n dotted?: boolean;\n /**\n * Draws the unselected state as a 1px `buttons-chip-default` outline over a\n * transparent background instead of filling with that same token. This is the\n * Figma `V2 Insights Chips` treatment, used where chips sit over a chart and a\n * row of solid fills would compete with the plotted series. The selected state\n * is unaffected — it stays filled — as are the `dark` and `dotted` variants.\n * @default false\n */\n outlined?: boolean;\n /** Icon element displayed before the label. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed after the label. */\n rightIcon?: React.ReactNode;\n /** Notification badge content (e.g. `\"99+\"`). Passed as a string for i18n support. */\n notificationLabel?: string;\n /** Numeric value for the notification badge. Uses the `Count` component for overflow formatting. Takes precedence over `notificationLabel` when both are provided. */\n notificationCount?: number;\n /** Maximum value before the badge shows overflow (e.g. `\"9+\"`). Only applies when `notificationCount` is set. @default 99 */\n notificationMax?: number;\n /** Colour variant of the notification badge. @default \"brand\" */\n notificationVariant?: CountVariant;\n /**\n * Height of the notification badge. `\"20\"` is the V2 Notification Count, a\n * rounded square; `\"16\"` is a circle for dense rows such as page tab chips.\n * @default \"20\"\n */\n notificationSize?: ChipNotificationSize;\n /** Click handler — when provided, the chip renders as a `<button>` for accessibility. */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Merge props onto a child element instead of rendering a wrapper. @default false */\n asChild?: boolean;\n}\n\n/**\n * A compact element for filters, tags, or toggleable actions. When an `onClick`\n * handler is provided, the chip renders as an interactive `<button>` with\n * `aria-pressed` support.\n *\n * @example\n * ```tsx\n * <Chip selected onClick={toggle}>Music</Chip>\n * ```\n */\nexport const Chip = React.forwardRef<HTMLButtonElement, ChipProps>(\n (\n {\n className,\n variant = \"rounded\",\n size = \"32\",\n selected = false,\n disabled = false,\n leftDot = false,\n dotted = false,\n outlined = false,\n leftIcon,\n rightIcon,\n notificationLabel,\n notificationCount,\n notificationMax,\n notificationVariant = \"brand\",\n notificationSize = \"20\",\n onClick,\n asChild = false,\n children,\n ...props\n },\n ref,\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Variant-heavy UI component\n ) => {\n const isInteractive = !!onClick && !asChild;\n const Comp = asChild ? Slot : isInteractive ? \"button\" : \"span\";\n const isDark = variant === \"dark\";\n // Precedence between the three treatments, named once rather than re-derived per\n // rule: `dark` owns its own palette, `dotted` wins over `outlined`, and what is\n // left is the normal chip, either filled or outlined.\n const isDotted = !isDark && dotted;\n const isSolid = !isDark && !dotted && !outlined;\n const isOutlined = !isDark && !dotted && outlined;\n\n // The dashed border is drawn as an SVG so the dash length matches the design\n // spec (8/8 for the 40px square, 6/6 otherwise). CSS `border-dashed` only\n // renders browser-default dash lengths, which are too short. The stroke colour\n // is driven by `currentColor`, and `group-hover`/`group-active` react to the\n // chip's interactive states. Rendered only in the default (non-`asChild`) path.\n const showDottedBorder = isDotted && !selected && !asChild;\n const dottedBorder = showDottedBorder ? (\n <svg\n aria-hidden=\"true\"\n className={cn(\n // `-1px` spans the reserved transparent border rather than the padding box\n // inside it, so the dash lands on the same ring as the solid border it\n // becomes when selected.\n \"pointer-events-none absolute -top-px -left-px h-[calc(100%+2px)] w-[calc(100%+2px)] overflow-visible\",\n disabled ? \"text-buttons-chip-disabled\" : \"text-buttons-chip-dotted-default\",\n isInteractive &&\n !disabled &&\n \"group-hover:text-buttons-chip-dotted-hover-stroke group-active:text-buttons-chip-dotted-hover-stroke\",\n )}\n >\n <rect\n x=\"0.5\"\n y=\"0.5\"\n rx={variant === \"square\" ? 7.5 : size === \"40\" ? 19.5 : size === \"36\" ? 17.5 : 15.5}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1\"\n strokeDasharray={variant === \"square\" && size === \"40\" ? \"8 8\" : \"6 6\"}\n style={{ width: \"calc(100% - 1px)\", height: \"calc(100% - 1px)\" }}\n />\n </svg>\n ) : null;\n\n return (\n <Comp\n ref={ref}\n data-testid=\"chip\"\n className={cn(\n \"relative inline-flex min-w-0 items-center justify-center whitespace-nowrap motion-safe:transition-colors motion-safe:duration-150\",\n // Shape\n variant === \"square\" ? \"rounded-xs\" : \"rounded-full\",\n // Size (32px uses 12px text, 40px uses 14px text per the design spec)\n size === \"32\" && \"typography-description-12px-semibold h-8 min-w-12 py-1\",\n size === \"36\" && \"typography-body-small-14px-semibold h-9 min-w-14 py-2\",\n size === \"40\" && \"typography-body-small-14px-semibold h-10 min-w-14 py-2.5\",\n // Variant colors\n isDark && \"bg-neutral-alphas-600 text-content-always-white\",\n (isSolid || isOutlined) &&\n selected &&\n \"bg-buttons-chip-active text-content-primary-inverted\",\n // Active + dotted is a subtle filled state with a solid (non-dashed) border.\n isDotted &&\n selected &&\n \"border border-border-primary border-solid bg-inputs-inputs-primary text-content-primary\",\n isSolid && !selected && \"bg-buttons-chip-default text-content-primary\",\n // Outlined: the same token as a 1px stroke rather than a fill. The border\n // is declared in BOTH states and only changes colour, going transparent\n // once selected. It cannot be dropped on selection: `border-box` constrains\n // only explicitly sized axes, and a chip's width is intrinsic, so losing the\n // border would narrow the chip by 2px and reflow the whole row on every\n // click. Height is safe either way because `h-8` is explicit.\n isOutlined && \"border border-solid\",\n isOutlined &&\n !selected &&\n \"border-buttons-chip-default bg-transparent text-content-primary\",\n isOutlined && selected && \"border-transparent\",\n // Dotted (non-selected): the dashed border is drawn via SVG (`dottedBorder`).\n // `group` lets that SVG react to hover/active. `asChild` keeps a CSS dashed\n // border fallback since the SVG is only rendered in the default path.\n isDotted && !selected && \"bg-transparent text-content-primary\",\n isDotted && !selected && !asChild && \"group\",\n // The SVG path draws no CSS border, so selecting one used to add 1px and\n // widen the chip by 2px, shifting the row on every toggle. Reserving a\n // transparent border also puts the dash on the same ring as the solid\n // border it becomes. The `asChild` path already has a real border below.\n isDotted && !selected && !asChild && \"border border-transparent border-solid\",\n isDotted &&\n !selected &&\n asChild &&\n (disabled\n ? \"border border-buttons-chip-disabled border-dashed\"\n : \"border border-buttons-chip-dotted-default border-dashed\"),\n // Interactive\n isInteractive && !disabled && \"cursor-pointer\",\n isInteractive && !disabled && isSolid && !selected && \"hover:bg-buttons-chip-hover\",\n // Outlined darkens its stroke rather than filling. `buttons-chip-hover` is\n // the one-step darkening for chips, but as a fill it is 20% over a 10%\n // stroke, so it swallows the outline the variant exists to show. Moved onto\n // the border, over `interaction-hover`, the atomic hover surface.\n isInteractive &&\n !disabled &&\n isOutlined &&\n !selected &&\n \"hover:border-buttons-chip-hover hover:bg-interaction-hover\",\n isInteractive &&\n !disabled &&\n isDotted &&\n !selected &&\n \"hover:bg-neutral-alphas-50 active:bg-neutral-alphas-50\",\n // Focus\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled\n disabled && isDark && \"pointer-events-none opacity-50\",\n disabled && !isDark && \"pointer-events-none text-content-disabled\",\n // Solid (non-dotted) disabled chips get a muted fill; dotted ones stay\n // transparent with their dashed border (drawn via SVG).\n disabled && (isSolid || (isOutlined && selected)) && \"bg-buttons-chip-disabled\",\n // Unselected outlined greys only its stroke. Selected is already filled, so\n // it takes the muted fill above and keeps `border-transparent` for its width.\n disabled && isOutlined && !selected && \"border-buttons-chip-disabled\",\n className,\n )}\n {...(isInteractive && {\n type: \"button\" as const,\n disabled,\n \"aria-pressed\": selected,\n onClick,\n })}\n {...(!isInteractive && disabled && { \"aria-disabled\": true })}\n {...(selected && { \"data-selected\": \"\" })}\n {...props}\n >\n {asChild ? (\n <Slottable>{children}</Slottable>\n ) : (\n <>\n {dottedBorder}\n <span className=\"flex min-w-0 items-center gap-0.5 overflow-hidden px-3\">\n {leftDot && (\n <span className=\"size-2 shrink-0 rounded-full bg-current\" aria-hidden=\"true\" />\n )}\n {leftIcon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n {rightIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </span>\n {(notificationCount != null || notificationLabel) && (\n <Count\n variant={notificationVariant}\n size={notificationSize === \"16\" ? \"24\" : \"32\"}\n className={cn(\n // V2 Notification Count: 20px high/min-width, caption 12,\n // 4px horizontal and 2px vertical padding, rounded-md.\n notificationSize === \"20\" && \"absolute top-[-4px] rounded-md px-1 py-0.5\",\n notificationSize === \"16\" && \"absolute top-[-6px] rounded-full\",\n // Anchor the leading edge so wider values grow away from the label.\n size === \"40\" && \"left-[calc(100%_-_16px)]\",\n size === \"36\" && \"left-[calc(100%_-_14px)]\",\n size === \"32\" && \"left-[calc(100%_-_11px)]\",\n )}\n value={notificationCount ?? 0}\n max={notificationMax}\n >\n {notificationCount == null ? notificationLabel : undefined}\n </Count>\n )}\n </>\n )}\n </Comp>\n );\n },\n);\n\nChip.displayName = \"Chip\";\n"],"names":[],"mappings":";;;;;;AAyEO,MAAM,OAAO,MAAM;AAAA,EACxB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QAEG;AACH,UAAM,gBAAgB,CAAC,CAAC,WAAW,CAAC;AACpC,UAAM,OAAO,UAAU,OAAO,gBAAgB,WAAW;AACzD,UAAM,SAAS,YAAY;AAI3B,UAAM,WAAW,CAAC,UAAU;AAC5B,UAAM,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;AACvC,UAAM,aAAa,CAAC,UAAU,CAAC,UAAU;AAOzC,UAAM,mBAAmB,YAAY,CAAC,YAAY,CAAC;AACnD,UAAM,eAAe,mBACnB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,eAAY;AAAA,QACZ,WAAW;AAAA;AAAA;AAAA;AAAA,UAIT;AAAA,UACA,WAAW,+BAA+B;AAAA,UAC1C,iBACE,CAAC,YACD;AAAA,QAAA;AAAA,QAGJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,IAAI,YAAY,WAAW,MAAM,SAAS,OAAO,OAAO,SAAS,OAAO,OAAO;AAAA,YAC/E,MAAK;AAAA,YACL,QAAO;AAAA,YACP,aAAY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Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountVariant } from \"../Count/Count\";\n\n/** Visual variant of the chip. */\nexport type ChipVariant = \"rounded\" | \"square\" | \"dark\";\n/** Height of the chip in pixels. */\nexport type ChipSize = \"32\" | \"36\" | \"40\";\n/** Height of the notification badge in pixels. */\nexport type ChipNotificationSize = \"16\" | \"20\";\n\nexport interface ChipProps extends React.HTMLAttributes<HTMLElement> {\n /** Visual variant of the chip. @default \"rounded\" */\n variant?: ChipVariant;\n /** Height of the chip in pixels. @default \"32\" */\n size?: ChipSize;\n /** Whether the chip is in a selected (pressed) state. @default false */\n selected?: boolean;\n /** Whether the chip is disabled. @default false */\n disabled?: boolean;\n /** Whether to show a coloured status dot at the leading edge. @default false */\n leftDot?: boolean;\n /**\n * Whether the chip uses a dashed border for add/create affordances.\n * When `selected`, it becomes a subtle filled state with a solid border.\n * Has no effect when `variant=\"dark\"`.\n * @default false\n */\n dotted?: boolean;\n /**\n * Draws the unselected state as a 1px `neutral-alphas-100` outline over a\n * transparent background instead of the solid chip fill. This is the\n * Figma `V2 Insights Chips` treatment, used where chips sit over a chart and a\n * row of solid fills would compete with the plotted series. The selected state\n * is unaffected — it stays filled — as are the `dark` and `dotted` variants.\n * @default false\n */\n outlined?: boolean;\n /** Icon element displayed before the label. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed after the label. */\n rightIcon?: React.ReactNode;\n /** Notification badge content (e.g. `\"99+\"`). Passed as a string for i18n support. */\n notificationLabel?: string;\n /** Numeric value for the notification badge. Uses the `Count` component for overflow formatting. Takes precedence over `notificationLabel` when both are provided. */\n notificationCount?: number;\n /** Maximum value before the badge shows overflow (e.g. `\"9+\"`). Only applies when `notificationCount` is set. @default 99 */\n notificationMax?: number;\n /** Colour variant of the notification badge. @default \"brand\" */\n notificationVariant?: CountVariant;\n /**\n * Height of the notification badge. `\"20\"` is the V2 Notification Count, a\n * rounded square; `\"16\"` is a circle for dense rows such as page tab chips.\n * @default \"20\"\n */\n notificationSize?: ChipNotificationSize;\n /** Click handler — when provided, the chip renders as a `<button>` for accessibility. */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Merge props onto a child element instead of rendering a wrapper. @default false */\n asChild?: boolean;\n}\n\n/**\n * A compact element for filters, tags, or toggleable actions. When an `onClick`\n * handler is provided, the chip renders as an interactive `<button>` with\n * `aria-pressed` support.\n *\n * @example\n * ```tsx\n * <Chip selected onClick={toggle}>Music</Chip>\n * ```\n */\nexport const Chip = React.forwardRef<HTMLButtonElement, ChipProps>(\n (\n {\n className,\n variant = \"rounded\",\n size = \"32\",\n selected = false,\n disabled = false,\n leftDot = false,\n dotted = false,\n outlined = false,\n leftIcon,\n rightIcon,\n notificationLabel,\n notificationCount,\n notificationMax,\n notificationVariant = \"brand\",\n notificationSize = \"20\",\n onClick,\n asChild = false,\n children,\n ...props\n },\n ref,\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Variant-heavy UI component\n ) => {\n const isInteractive = !!onClick && !asChild;\n const Comp = asChild ? Slot : isInteractive ? \"button\" : \"span\";\n const isDark = variant === \"dark\";\n // Precedence between the three treatments, named once rather than re-derived per\n // rule: `dark` owns its own palette, `dotted` wins over `outlined`, and what is\n // left is the normal chip, either filled or outlined.\n const isDotted = !isDark && dotted;\n const isSolid = !isDark && !dotted && !outlined;\n const isOutlined = !isDark && !dotted && outlined;\n\n // The dashed border is drawn as an SVG so the dash length matches the design\n // spec (8/8 for the 40px square, 6/6 otherwise). CSS `border-dashed` only\n // renders browser-default dash lengths, which are too short. The stroke colour\n // is driven by `currentColor`, and `group-hover`/`group-active` react to the\n // chip's interactive states. Rendered only in the default (non-`asChild`) path.\n const showDottedBorder = isDotted && !selected && !asChild;\n const dottedBorder = showDottedBorder ? (\n <svg\n aria-hidden=\"true\"\n className={cn(\n // `-1px` spans the reserved transparent border rather than the padding box\n // inside it, so the dash lands on the same ring as the solid border it\n // becomes when selected.\n \"pointer-events-none absolute -top-px -left-px h-[calc(100%+2px)] w-[calc(100%+2px)] overflow-visible\",\n disabled ? \"text-buttons-chip-disabled\" : \"text-buttons-chip-dotted-default\",\n isInteractive &&\n !disabled &&\n \"group-hover:text-buttons-chip-dotted-hover-stroke group-active:text-buttons-chip-dotted-hover-stroke\",\n )}\n >\n <rect\n x=\"0.5\"\n y=\"0.5\"\n rx={variant === \"square\" ? 7.5 : size === \"40\" ? 19.5 : size === \"36\" ? 17.5 : 15.5}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1\"\n strokeDasharray={variant === \"square\" && size === \"40\" ? \"8 8\" : \"6 6\"}\n style={{ width: \"calc(100% - 1px)\", height: \"calc(100% - 1px)\" }}\n />\n </svg>\n ) : null;\n\n return (\n <Comp\n ref={ref}\n data-testid=\"chip\"\n className={cn(\n \"relative inline-flex min-w-0 items-center justify-center whitespace-nowrap motion-safe:transition-colors motion-safe:duration-150\",\n // Shape\n variant === \"square\" ? \"rounded-xs\" : \"rounded-full\",\n // Size (32px uses 12px text, 40px uses 14px text per the design spec)\n size === \"32\" && \"typography-description-12px-semibold h-8 min-w-12 py-1\",\n size === \"36\" && \"typography-body-small-14px-semibold h-9 min-w-14 py-2\",\n size === \"40\" && \"typography-body-small-14px-semibold h-10 min-w-14 py-2.5\",\n // Variant colors\n isDark && \"bg-neutral-alphas-600 text-content-always-white\",\n (isSolid || isOutlined) &&\n selected &&\n \"bg-buttons-chip-active text-content-primary-inverted\",\n // Active + dotted is a subtle filled state with a solid (non-dashed) border.\n isDotted &&\n selected &&\n \"border border-border-primary border-solid bg-inputs-inputs-primary text-content-primary\",\n isSolid && !selected && \"bg-buttons-chip-default text-content-primary\",\n // Outlined: a 1px stroke rather than a fill. Strokes stay at 10%, a step above\n // the chip fill, because a thin line at the 5% fill weight disappears. The border\n // is declared in BOTH states and only changes colour, going transparent\n // once selected. It cannot be dropped on selection: `border-box` constrains\n // only explicitly sized axes, and a chip's width is intrinsic, so losing the\n // border would narrow the chip by 2px and reflow the whole row on every\n // click. Height is safe either way because `h-8` is explicit.\n isOutlined && \"border border-solid\",\n isOutlined &&\n !selected &&\n \"border-neutral-alphas-100 bg-transparent text-content-primary\",\n isOutlined && selected && \"border-transparent\",\n // Dotted (non-selected): the dashed border is drawn via SVG (`dottedBorder`).\n // `group` lets that SVG react to hover/active. `asChild` keeps a CSS dashed\n // border fallback since the SVG is only rendered in the default path.\n isDotted && !selected && \"bg-transparent text-content-primary\",\n isDotted && !selected && !asChild && \"group\",\n // The SVG path draws no CSS border, so selecting one used to add 1px and\n // widen the chip by 2px, shifting the row on every toggle. Reserving a\n // transparent border also puts the dash on the same ring as the solid\n // border it becomes. The `asChild` path already has a real border below.\n isDotted && !selected && !asChild && \"border border-transparent border-solid\",\n isDotted &&\n !selected &&\n asChild &&\n (disabled\n ? \"border border-buttons-chip-disabled border-dashed\"\n : \"border border-buttons-chip-dotted-default border-dashed\"),\n // Interactive\n isInteractive && !disabled && \"cursor-pointer\",\n isInteractive && !disabled && isSolid && !selected && \"hover:bg-buttons-chip-hover\",\n // Outlined darkens its stroke (10% to 20%) rather than filling, so the\n // outline the variant exists to show stays visible, over\n // `interaction-hover`, the atomic hover surface.\n isInteractive &&\n !disabled &&\n isOutlined &&\n !selected &&\n \"hover:border-neutral-alphas-200 hover:bg-interaction-hover\",\n isInteractive &&\n !disabled &&\n isDotted &&\n !selected &&\n \"hover:bg-neutral-alphas-50 active:bg-neutral-alphas-50\",\n // Focus\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled\n disabled && isDark && \"pointer-events-none opacity-50\",\n disabled && !isDark && \"pointer-events-none text-content-disabled\",\n // Solid (non-dotted) disabled chips get a muted fill; dotted ones stay\n // transparent with their dashed border (drawn via SVG). Under the v2 palette the\n // fill matches the 5% resting chip, so a disabled chip never reads heavier.\n disabled &&\n (isSolid || (isOutlined && selected)) &&\n \"bg-buttons-chip-disabled theme-v2:bg-buttons-chip-default\",\n // Unselected outlined greys only its stroke. Selected is already filled, so\n // it takes the muted fill above and keeps `border-transparent` for its width.\n disabled && isOutlined && !selected && \"border-buttons-chip-disabled\",\n className,\n )}\n {...(isInteractive && {\n type: \"button\" as const,\n disabled,\n \"aria-pressed\": selected,\n onClick,\n })}\n {...(!isInteractive && disabled && { \"aria-disabled\": true })}\n {...(selected && { \"data-selected\": \"\" })}\n {...props}\n >\n {asChild ? (\n <Slottable>{children}</Slottable>\n ) : (\n <>\n {dottedBorder}\n <span className=\"flex min-w-0 items-center gap-0.5 overflow-hidden px-3\">\n {leftDot && (\n <span className=\"size-2 shrink-0 rounded-full bg-current\" aria-hidden=\"true\" />\n )}\n {leftIcon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n {rightIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </span>\n {(notificationCount != null || notificationLabel) && (\n <Count\n variant={notificationVariant}\n size={notificationSize === \"16\" ? \"24\" : \"32\"}\n className={cn(\n // V2 Notification Count: 20px high/min-width, caption 12,\n // 4px horizontal and 2px vertical padding, rounded-md.\n notificationSize === \"20\" && \"absolute top-[-4px] rounded-md px-1 py-0.5\",\n notificationSize === \"16\" && \"absolute top-[-6px] rounded-full\",\n // Anchor the leading edge so wider values grow away from the label.\n size === \"40\" && \"left-[calc(100%_-_16px)]\",\n size === \"36\" && \"left-[calc(100%_-_14px)]\",\n size === \"32\" && \"left-[calc(100%_-_11px)]\",\n )}\n value={notificationCount ?? 0}\n max={notificationMax}\n >\n {notificationCount == null ? notificationLabel : undefined}\n </Count>\n )}\n </>\n )}\n </Comp>\n );\n },\n);\n\nChip.displayName = \"Chip\";\n"],"names":[],"mappings":";;;;;;AAyEO,MAAM,OAAO,MAAM;AAAA,EACxB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAA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AAAA,YAAA,WACC,oBAAC,QAAA,EAAK,WAAU,2CAA0C,eAAY,QAAO;AAAA,YAE9E,YACC,oBAAC,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,UAAA,UACH;AAAA,YAEF,oBAAC,QAAA,EAAK,WAAU,oBAAoB,SAAA,CAAS;AAAA,YAC5C,aACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,eAAY;AAAA,gBAEX,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,WACE,qBAAqB,QAAQ,sBAC7B;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,MAAM,qBAAqB,OAAO,OAAO;AAAA,cACzC,WAAW;AAAA;AAAA;AAAA,gBAGT,qBAAqB,QAAQ;AAAA,gBAC7B,qBAAqB,QAAQ;AAAA;AAAA,gBAE7B,SAAS,QAAQ;AAAA,gBACjB,SAAS,QAAQ;AAAA,gBACjB,SAAS,QAAQ;AAAA,cAAA;AAAA,cAEnB,OAAO,qBAAqB;AAAA,cAC5B,KAAK;AAAA,cAEJ,UAAA,qBAAqB,OAAO,oBAAoB;AAAA,YAAA;AAAA,UAAA;AAAA,QACnD,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,KAAK,cAAc;"}
@@ -42,16 +42,14 @@ const CreatorCard = React.forwardRef(
42
42
  ] }),
43
43
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-2.5 p-3", children: [
44
44
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
45
- /* @__PURE__ */ jsx(
45
+ avatar ? /* @__PURE__ */ jsx(
46
46
  Avatar,
47
47
  {
48
48
  size: 32,
49
- src: avatar?.src,
50
- alt: avatar?.alt ?? (typeof name === "string" ? name : void 0),
51
- fallback: avatar?.fallback,
49
+ alt: avatar.alt ?? (typeof name === "string" ? name : void 0),
52
50
  ...avatar
53
51
  }
54
- ),
52
+ ) : null,
55
53
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
56
54
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [
57
55
  /* @__PURE__ */ jsx("p", { className: "typography-body-small-14px-semibold m-0 truncate text-content-primary", children: name }),
@@ -1 +1 @@
1
- {"version":3,"file":"CreatorCard.mjs","sources":["../../../src/components/CreatorCard/CreatorCard.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Avatar } from \"../Avatar/Avatar\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { Pill, type PillProps } from \"../Pill/Pill\";\n\nexport interface CreatorCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"content\"> {\n /** Decorative banner media rendered at the top of the card. */\n background: React.ReactNode;\n /**\n * Props forwarded to a {@link Pill} overlaid on the top-left of the banner.\n * Pass the label as `children`. Omit to hide the pill.\n */\n pill?: PillProps;\n /** Avatar props forwarded to the inner {@link Avatar}. */\n avatar?: React.ComponentPropsWithoutRef<typeof Avatar>;\n /** Creator display name shown next to the avatar. */\n name: React.ReactNode;\n /** When `true`, renders a verified badge after the name. @default false */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n /** Optional secondary line shown under the name (e.g. post count). */\n tagline?: React.ReactNode;\n /**\n * Optional content shown under the creator details (e.g. the subscription\n * price). It wraps by default; pass a `truncate` element to keep it on one line.\n */\n content?: React.ReactNode;\n /**\n * Action element rendered full-width at the bottom of the card (e.g. a\n * `Button` with `fullWidth` for subscribing to the creator).\n */\n action?: React.ReactNode;\n}\n\n/**\n * A card suggesting a creator, with a banner image, an optional {@link Pill},\n * the creator's avatar, name and tagline, free-form content such as a price,\n * and an optional action.\n *\n * The card has no fixed width or corner radius: set both through `className`\n * (e.g. `className=\"w-40 rounded-md\"`). The banner keeps a 10:11 ratio at any\n * width.\n *\n * @example\n * ```tsx\n * <CreatorCard\n * className=\"w-40 rounded-md\"\n * background={<img src=\"/banner.jpg\" alt=\"\" />}\n * pill={{ variant: \"contrast\", children: \"Popular this week\" }}\n * avatar={{ src: \"/avatar.jpg\", fallback: \"JD\" }}\n * name=\"Jane Doe\"\n * verified\n * tagline=\"412 posts\"\n * content={<span className=\"block truncate\">$9.99 / month</span>}\n * action={<Button variant=\"primary\" size=\"32\" fullWidth>Subscribe</Button>}\n * />\n * ```\n */\nexport const CreatorCard = React.forwardRef<HTMLDivElement, CreatorCardProps>(\n (\n {\n className,\n background,\n pill,\n avatar,\n name,\n verified = false,\n verifiedLabel = \"Verified\",\n tagline,\n content,\n action,\n ...props\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"relative isolate flex flex-col overflow-hidden bg-surface-primary\",\n className,\n )}\n {...props}\n >\n <div className=\"relative aspect-10/11 w-full shrink-0 overflow-hidden\">\n <div className=\"pointer-events-none absolute inset-0 select-none *:h-full *:w-full [&>img]:object-cover [&>video]:object-cover\">\n {background}\n </div>\n {pill ? (\n <Pill\n variant=\"contrast\"\n {...pill}\n className={cn(\"absolute top-2 left-2 max-w-[calc(100%-1rem)]\", pill.className)}\n />\n ) : null}\n </div>\n <div className=\"flex min-w-0 flex-col gap-2.5 p-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <Avatar\n size={32}\n src={avatar?.src}\n alt={avatar?.alt ?? (typeof name === \"string\" ? name : undefined)}\n fallback={avatar?.fallback}\n {...avatar}\n />\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-center gap-1\">\n <p className=\"typography-body-small-14px-semibold m-0 truncate text-content-primary\">\n {name}\n </p>\n {verified ? (\n <span\n role=\"img\"\n aria-label={verifiedLabel}\n className=\"inline-flex shrink-0 text-content-primary\"\n >\n <VerifiedIcon size={16} filled />\n </span>\n ) : null}\n </div>\n {tagline ? (\n <p className=\"typography-body-small-14px-regular m-0 truncate text-content-secondary\">\n {tagline}\n </p>\n ) : null}\n </div>\n </div>\n {content ? (\n <div className=\"typography-body-small-14px-semibold min-w-0 text-content-primary\">\n {content}\n </div>\n ) : null}\n {action ? <div className=\"flex w-full\">{action}</div> : null}\n </div>\n </div>\n );\n },\n);\n\nCreatorCard.displayName = \"CreatorCard\";\n"],"names":[],"mappings":";;;;;;;AA4DO,MAAM,cAAc,MAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,qBAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,YAAA,oBAAC,OAAA,EAAI,WAAU,kHACZ,UAAA,YACH;AAAA,YACC,OACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACP,GAAG;AAAA,gBACJ,WAAW,GAAG,iDAAiD,KAAK,SAAS;AAAA,cAAA;AAAA,YAAA,IAE7E;AAAA,UAAA,GACN;AAAA,UACA,qBAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,YAAA,qBAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,cAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAM;AAAA,kBACN,KAAK,QAAQ;AAAA,kBACb,KAAK,QAAQ,QAAQ,OAAO,SAAS,WAAW,OAAO;AAAA,kBACvD,UAAU,QAAQ;AAAA,kBACjB,GAAG;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEN,qBAAC,OAAA,EAAI,WAAU,gCACb,UAAA;AAAA,gBAAA,qBAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,kBAAA,oBAAC,KAAA,EAAE,WAAU,yEACV,UAAA,MACH;AAAA,kBACC,WACC;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,cAAY;AAAA,sBACZ,WAAU;AAAA,sBAEV,UAAA,oBAAC,cAAA,EAAa,MAAM,IAAI,QAAM,KAAA,CAAC;AAAA,oBAAA;AAAA,kBAAA,IAE/B;AAAA,gBAAA,GACN;AAAA,gBACC,UACC,oBAAC,KAAA,EAAE,WAAU,0EACV,mBACH,IACE;AAAA,cAAA,EAAA,CACN;AAAA,YAAA,GACF;AAAA,YACC,UACC,oBAAC,OAAA,EAAI,WAAU,oEACZ,mBACH,IACE;AAAA,YACH,SAAS,oBAAC,OAAA,EAAI,WAAU,eAAe,kBAAO,IAAS;AAAA,UAAA,EAAA,CAC1D;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"CreatorCard.mjs","sources":["../../../src/components/CreatorCard/CreatorCard.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Avatar } from \"../Avatar/Avatar\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { Pill, type PillProps } from \"../Pill/Pill\";\n\nexport interface CreatorCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"content\"> {\n /** Decorative banner media rendered at the top of the card. */\n background: React.ReactNode;\n /**\n * Props forwarded to a {@link Pill} overlaid on the top-left of the banner.\n * Pass the label as `children`. Omit to hide the pill.\n */\n pill?: PillProps;\n /**\n * Props forwarded to the inner {@link Avatar}. Omit to hide the avatar, so the\n * name and tagline align with the card's left edge.\n */\n avatar?: React.ComponentPropsWithoutRef<typeof Avatar>;\n /** Creator display name, shown next to the avatar when there is one. */\n name: React.ReactNode;\n /** When `true`, renders a verified badge after the name. @default false */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n /** Optional secondary line shown under the name (e.g. post count). */\n tagline?: React.ReactNode;\n /**\n * Optional content shown under the creator details (e.g. the subscription\n * price). It wraps by default; pass a `truncate` element to keep it on one line.\n */\n content?: React.ReactNode;\n /**\n * Action element rendered full-width at the bottom of the card (e.g. a\n * `Button` with `fullWidth` for subscribing to the creator).\n */\n action?: React.ReactNode;\n}\n\n/**\n * A card suggesting a creator, with a banner image, an optional {@link Pill},\n * the creator's avatar, name and tagline, free-form content such as a price,\n * and an optional action.\n *\n * The card has no fixed width or corner radius: set both through `className`\n * (e.g. `className=\"w-40 rounded-md\"`). The banner keeps a 10:11 ratio at any\n * width.\n *\n * @example\n * ```tsx\n * <CreatorCard\n * className=\"w-40 rounded-md\"\n * background={<img src=\"/banner.jpg\" alt=\"\" />}\n * pill={{ variant: \"contrast\", children: \"Popular this week\" }}\n * avatar={{ src: \"/avatar.jpg\", fallback: \"JD\" }}\n * name=\"Jane Doe\"\n * verified\n * tagline=\"412 posts\"\n * content={<span className=\"block truncate\">$9.99 / month</span>}\n * action={<Button variant=\"primary\" size=\"32\" fullWidth>Subscribe</Button>}\n * />\n * ```\n */\nexport const CreatorCard = React.forwardRef<HTMLDivElement, CreatorCardProps>(\n (\n {\n className,\n background,\n pill,\n avatar,\n name,\n verified = false,\n verifiedLabel = \"Verified\",\n tagline,\n content,\n action,\n ...props\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"relative isolate flex flex-col overflow-hidden bg-surface-primary\",\n className,\n )}\n {...props}\n >\n <div className=\"relative aspect-10/11 w-full shrink-0 overflow-hidden\">\n <div className=\"pointer-events-none absolute inset-0 select-none *:h-full *:w-full [&>img]:object-cover [&>video]:object-cover\">\n {background}\n </div>\n {pill ? (\n <Pill\n variant=\"contrast\"\n {...pill}\n className={cn(\"absolute top-2 left-2 max-w-[calc(100%-1rem)]\", pill.className)}\n />\n ) : null}\n </div>\n <div className=\"flex min-w-0 flex-col gap-2.5 p-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {avatar ? (\n <Avatar\n size={32}\n alt={avatar.alt ?? (typeof name === \"string\" ? name : undefined)}\n {...avatar}\n />\n ) : null}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-center gap-1\">\n <p className=\"typography-body-small-14px-semibold m-0 truncate text-content-primary\">\n {name}\n </p>\n {verified ? (\n <span\n role=\"img\"\n aria-label={verifiedLabel}\n className=\"inline-flex shrink-0 text-content-primary\"\n >\n <VerifiedIcon size={16} filled />\n </span>\n ) : null}\n </div>\n {tagline ? (\n <p className=\"typography-body-small-14px-regular m-0 truncate text-content-secondary\">\n {tagline}\n </p>\n ) : null}\n </div>\n </div>\n {content ? (\n <div className=\"typography-body-small-14px-semibold min-w-0 text-content-primary\">\n {content}\n </div>\n ) : null}\n {action ? <div className=\"flex w-full\">{action}</div> : null}\n </div>\n </div>\n );\n },\n);\n\nCreatorCard.displayName = \"CreatorCard\";\n"],"names":[],"mappings":";;;;;;;AA+DO,MAAM,cAAc,MAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,qBAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,YAAA,oBAAC,OAAA,EAAI,WAAU,kHACZ,UAAA,YACH;AAAA,YACC,OACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACP,GAAG;AAAA,gBACJ,WAAW,GAAG,iDAAiD,KAAK,SAAS;AAAA,cAAA;AAAA,YAAA,IAE7E;AAAA,UAAA,GACN;AAAA,UACA,qBAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,YAAA,qBAAC,OAAA,EAAI,WAAU,mCACZ,UAAA;AAAA,cAAA,SACC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAM;AAAA,kBACN,KAAK,OAAO,QAAQ,OAAO,SAAS,WAAW,OAAO;AAAA,kBACrD,GAAG;AAAA,gBAAA;AAAA,cAAA,IAEJ;AAAA,cACJ,qBAAC,OAAA,EAAI,WAAU,gCACb,UAAA;AAAA,gBAAA,qBAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,kBAAA,oBAAC,KAAA,EAAE,WAAU,yEACV,UAAA,MACH;AAAA,kBACC,WACC;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,cAAY;AAAA,sBACZ,WAAU;AAAA,sBAEV,UAAA,oBAAC,cAAA,EAAa,MAAM,IAAI,QAAM,KAAA,CAAC;AAAA,oBAAA;AAAA,kBAAA,IAE/B;AAAA,gBAAA,GACN;AAAA,gBACC,UACC,oBAAC,KAAA,EAAE,WAAU,0EACV,mBACH,IACE;AAAA,cAAA,EAAA,CACN;AAAA,YAAA,GACF;AAAA,YACC,UACC,oBAAC,OAAA,EAAI,WAAU,oEACZ,mBACH,IACE;AAAA,YACH,SAAS,oBAAC,OAAA,EAAI,WAAU,eAAe,kBAAO,IAAS;AAAA,UAAA,EAAA,CAC1D;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
@@ -16,10 +16,7 @@ const CreatorCover = React.forwardRef(
16
16
  ref,
17
17
  "aria-labelledby": headingId,
18
18
  "data-testid": "creator-cover",
19
- className: cn(
20
- "relative isolate w-full overflow-hidden bg-white dark:bg-background-primary",
21
- className
22
- ),
19
+ className: cn("relative isolate w-full overflow-hidden bg-background-primary", className),
23
20
  ...props,
24
21
  children: [
25
22
  /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 -z-10", children: [
@@ -32,8 +29,8 @@ const CreatorCover = React.forwardRef(
32
29
  className: "size-full scale-110 object-cover blur-3xl"
33
30
  }
34
31
  ),
35
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-linear-to-b from-white/30 to-white/15 dark:from-background-primary/30 dark:to-background-primary/15" }),
36
- /* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 bottom-0 h-1/3 bg-linear-to-b from-transparent to-white dark:to-background-primary" })
32
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-linear-to-b from-background-primary/30 to-background-primary/15" }),
33
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 bottom-0 h-1/3 bg-linear-to-b from-transparent to-background-primary" })
37
34
  ] }),
38
35
  /* @__PURE__ */ jsxs("div", { className: cn("mx-auto flex max-w-90 flex-col items-center gap-4 px-4 pt-17 pb-16"), children: [
39
36
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
@@ -49,7 +46,14 @@ const CreatorCover = React.forwardRef(
49
46
  renderedTag ? /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2", children: renderedTag }) : null
50
47
  ] }),
51
48
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 pt-4 text-center", children: [
52
- /* @__PURE__ */ jsx("h2", { id: headingId, className: "typography-header-heading-md m-0 text-white", children: name }),
49
+ /* @__PURE__ */ jsx(
50
+ "h2",
51
+ {
52
+ id: headingId,
53
+ className: "typography-header-heading-md m-0 text-content-always-white",
54
+ children: name
55
+ }
56
+ ),
53
57
  tagline ? /* @__PURE__ */ jsx("p", { className: "typography-badge-badgecaps m-0 text-brand-primary-default uppercase", children: tagline }) : null
54
58
  ] }),
55
59
  action ? /* @__PURE__ */ jsx("div", { className: "w-full pt-2", children: action }) : null
@@ -1 +1 @@
1
- {"version":3,"file":"CreatorCover.mjs","sources":["../../../src/components/CreatorCover/CreatorCover.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Pill } from \"../Pill/Pill\";\n\n/** Slot that accepts a string (rendered as default styling) or a node for full control. */\nexport type CreatorCoverSlot = string | React.ReactNode;\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0;\n}\n\nexport interface CreatorCoverProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** URL of the creator image displayed in the centre card. Also used as the blurred backdrop unless `backgroundSrc` is provided. */\n imageSrc: string;\n /** Alt text for the centre cover image. @default \"\" */\n imageAlt?: string;\n /** Override URL used for the blurred background image. @default `imageSrc` */\n backgroundSrc?: string;\n /** Creator's name, rendered as the heading. */\n name: string;\n /** Smaller subtitle below the name (e.g. \"GLOBAL POPSTAR\"). Rendered uppercase in the brand colour. */\n tagline?: string;\n /**\n * Status label rendered as a pill overlapping the bottom of the cover image (e.g. \"New Joiner\").\n * Strings render with default green pill styling; pass a node for custom markup.\n */\n tag?: CreatorCoverSlot;\n /**\n * Primary call to action displayed below the title.\n */\n action?: React.ReactNode;\n /** When `true`, fades the bottom of the component to transparent and increases bottom padding to 64px. @default false */\n fadeBottom?: boolean;\n}\n\n/**\n * A creator profile hero with a stylised blurred backdrop, central cover image,\n * status pill, name, tagline, and primary call to action.\n *\n * @example\n * ```tsx\n * <CreatorCover\n * imageSrc=\"/creator.jpg\"\n * imageAlt=\"Jane Doe\"\n * name=\"JANE DOE\"\n * tagline=\"GLOBAL POPSTAR\"\n * tag=\"New Joiner\"\n * action={<Button variant=\"brand\" size=\"48\" fullWidth>Join for free for 7 days</Button>}\n * />\n * ```\n */\nexport const CreatorCover = React.forwardRef<HTMLElement, CreatorCoverProps>(\n (\n { className, imageSrc, imageAlt = \"\", backgroundSrc, name, tagline, tag, action, ...props },\n ref,\n ) => {\n const headingId = React.useId();\n\n const renderedTag = isNonEmptyString(tag) ? <Pill variant=\"brand\">{tag}</Pill> : tag;\n\n return (\n <section\n ref={ref}\n aria-labelledby={headingId}\n data-testid=\"creator-cover\"\n className={cn(\n \"relative isolate w-full overflow-hidden bg-white dark:bg-background-primary\",\n className,\n )}\n {...props}\n >\n <div className=\"absolute inset-0 -z-10\">\n <img\n src={backgroundSrc ?? imageSrc}\n alt=\"\"\n loading=\"lazy\"\n className=\"size-full scale-110 object-cover blur-3xl\"\n />\n <div className=\"absolute inset-0 bg-linear-to-b from-white/30 to-white/15 dark:from-background-primary/30 dark:to-background-primary/15\" />\n <div className=\"absolute inset-x-0 bottom-0 h-1/3 bg-linear-to-b from-transparent to-white dark:to-background-primary\" />\n </div>\n <div className={cn(\"mx-auto flex max-w-90 flex-col items-center gap-4 px-4 pt-17 pb-16\")}>\n <div className=\"relative\">\n <img\n src={imageSrc}\n alt={imageAlt}\n loading=\"lazy\"\n className=\"block h-55 w-37.5 rounded-lg object-cover\"\n />\n {renderedTag ? (\n <div className=\"absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2\">\n {renderedTag}\n </div>\n ) : null}\n </div>\n <div className=\"flex flex-col items-center gap-1 pt-4 text-center\">\n <h2 id={headingId} className=\"typography-header-heading-md m-0 text-white\">\n {name}\n </h2>\n {tagline ? (\n <p className=\"typography-badge-badgecaps m-0 text-brand-primary-default uppercase\">\n {tagline}\n </p>\n ) : null}\n </div>\n {action ? <div className=\"w-full pt-2\">{action}</div> : null}\n </div>\n </section>\n );\n },\n);\n\nCreatorCover.displayName = \"CreatorCover\";\n"],"names":[],"mappings":";;;;;AAOA,SAAS,iBAAiB,OAAiC;AACzD,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS;AACrD;AA0CO,MAAM,eAAe,MAAM;AAAA,EAChC,CACE,EAAE,WAAW,UAAU,WAAW,IAAI,eAAe,MAAM,SAAS,KAAK,QAAQ,GAAG,MAAA,GACpF,QACG;AACH,UAAM,YAAY,MAAM,MAAA;AAExB,UAAM,cAAc,iBAAiB,GAAG,wBAAK,MAAA,EAAK,SAAQ,SAAS,UAAA,IAAA,CAAI,IAAU;AAEjF,WACE;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* as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Pill } from \"../Pill/Pill\";\n\n/** Slot that accepts a string (rendered as default styling) or a node for full control. */\nexport type CreatorCoverSlot = string | React.ReactNode;\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0;\n}\n\nexport interface CreatorCoverProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** URL of the creator image displayed in the centre card. Also used as the blurred backdrop unless `backgroundSrc` is provided. */\n imageSrc: string;\n /** Alt text for the centre cover image. @default \"\" */\n imageAlt?: string;\n /** Override URL used for the blurred background image. @default `imageSrc` */\n backgroundSrc?: string;\n /** Creator's name, rendered as the heading. */\n name: string;\n /** Smaller subtitle below the name (e.g. \"GLOBAL POPSTAR\"). Rendered uppercase in the brand colour. */\n tagline?: string;\n /**\n * Status label rendered as a pill overlapping the bottom of the cover image (e.g. \"New Joiner\").\n * Strings render with default green pill styling; pass a node for custom markup.\n */\n tag?: CreatorCoverSlot;\n /**\n * Primary call to action displayed below the title.\n */\n action?: React.ReactNode;\n /** When `true`, fades the bottom of the component to transparent and increases bottom padding to 64px. @default false */\n fadeBottom?: boolean;\n}\n\n/**\n * A creator profile hero with a stylised blurred backdrop, central cover image,\n * status pill, name, tagline, and primary call to action.\n *\n * @example\n * ```tsx\n * <CreatorCover\n * imageSrc=\"/creator.jpg\"\n * imageAlt=\"Jane Doe\"\n * name=\"JANE DOE\"\n * tagline=\"GLOBAL POPSTAR\"\n * tag=\"New Joiner\"\n * action={<Button variant=\"brand\" size=\"48\" fullWidth>Join for free for 7 days</Button>}\n * />\n * ```\n */\nexport const CreatorCover = React.forwardRef<HTMLElement, CreatorCoverProps>(\n (\n { className, imageSrc, imageAlt = \"\", backgroundSrc, name, tagline, tag, action, ...props },\n ref,\n ) => {\n const headingId = React.useId();\n\n const renderedTag = isNonEmptyString(tag) ? <Pill variant=\"brand\">{tag}</Pill> : tag;\n\n return (\n <section\n ref={ref}\n aria-labelledby={headingId}\n data-testid=\"creator-cover\"\n className={cn(\"relative isolate w-full overflow-hidden bg-background-primary\", className)}\n {...props}\n >\n <div className=\"absolute inset-0 -z-10\">\n <img\n src={backgroundSrc ?? imageSrc}\n alt=\"\"\n loading=\"lazy\"\n className=\"size-full scale-110 object-cover blur-3xl\"\n />\n <div className=\"absolute inset-0 bg-linear-to-b from-background-primary/30 to-background-primary/15\" />\n <div className=\"absolute inset-x-0 bottom-0 h-1/3 bg-linear-to-b from-transparent to-background-primary\" />\n </div>\n <div className={cn(\"mx-auto flex max-w-90 flex-col items-center gap-4 px-4 pt-17 pb-16\")}>\n <div className=\"relative\">\n <img\n src={imageSrc}\n alt={imageAlt}\n loading=\"lazy\"\n className=\"block h-55 w-37.5 rounded-lg object-cover\"\n />\n {renderedTag ? (\n <div className=\"absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2\">\n {renderedTag}\n </div>\n ) : null}\n </div>\n <div className=\"flex flex-col items-center gap-1 pt-4 text-center\">\n <h2\n id={headingId}\n className=\"typography-header-heading-md m-0 text-content-always-white\"\n >\n {name}\n </h2>\n {tagline ? (\n <p className=\"typography-badge-badgecaps m-0 text-brand-primary-default uppercase\">\n {tagline}\n </p>\n ) : null}\n </div>\n {action ? <div className=\"w-full pt-2\">{action}</div> : null}\n </div>\n </section>\n );\n },\n);\n\nCreatorCover.displayName = \"CreatorCover\";\n"],"names":[],"mappings":";;;;;AAOA,SAAS,iBAAiB,OAAiC;AACzD,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS;AACrD;AA0CO,MAAM,eAAe,MAAM;AAAA,EAChC,CACE,EAAE,WAAW,UAAU,WAAW,IAAI,eAAe,MAAM,SAAS,KAAK,QAAQ,GAAG,MAAA,GACpF,QACG;AACH,UAAM,YAAY,MAAM,MAAA;AAExB,UAAM,cAAc,iBAAiB,GAAG,wBAAK,MAAA,EAAK,SAAQ,SAAS,UAAA,IAAA,CAAI,IAAU;AAEjF,WACE;AAAA,MAAC;AAAA,MAAA;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";
3
- import { forwardRef, useRef, useEffect } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { forwardRef, createContext, useRef, useContext, useEffect } from "react";
4
4
  import { DayPicker } from "react-day-picker";
5
5
  import { cn } from "../../utils/cn.mjs";
6
6
  import { Button } from "../Button/Button.mjs";
7
7
  import { ChevronLeftIcon } from "../Icons/ChevronLeftIcon.mjs";
8
8
  import { ChevronRightIcon } from "../Icons/ChevronRightIcon.mjs";
9
+ const DatePickerSizeContext = createContext("40");
9
10
  function Day({ day, modifiers, className, ...divProps }) {
10
11
  const { range_start, range_end, range_middle } = modifiers;
11
12
  const isSingleDayRange = range_start && range_end;
@@ -15,9 +16,9 @@ function Day({ day, modifiers, className, ...divProps }) {
15
16
  {
16
17
  className: cn(
17
18
  className,
18
- inRange && "bg-inputs-calendar-range",
19
- inRange && range_start && "rounded-l-sm",
20
- inRange && range_end && "rounded-r-sm"
19
+ inRange && "before:absolute before:inset-x-0 before:inset-y-0.5 before:bg-inputs-calendar-range first:before:left-0.5 first:before:rounded-l-sm last:before:right-0.5 last:before:rounded-r-sm",
20
+ inRange && range_start && "before:left-0.5 before:rounded-l-sm",
21
+ inRange && range_end && "before:right-0.5 before:rounded-r-sm"
21
22
  ),
22
23
  ...divProps
23
24
  }
@@ -25,6 +26,7 @@ function Day({ day, modifiers, className, ...divProps }) {
25
26
  }
26
27
  function DayButton({ day, modifiers, className, ...buttonProps }) {
27
28
  const ref = useRef(null);
29
+ const size = useContext(DatePickerSizeContext);
28
30
  useEffect(() => {
29
31
  if (modifiers.focused) ref.current?.focus();
30
32
  }, [modifiers.focused]);
@@ -35,11 +37,14 @@ function DayButton({ day, modifiers, className, ...buttonProps }) {
35
37
  ref,
36
38
  type: "button",
37
39
  className: cn(
38
- "relative z-10 inline-flex size-10 cursor-pointer items-center justify-center rounded-sm text-content-primary",
40
+ "relative z-10 inline-flex cursor-pointer items-center justify-center rounded-sm text-content-primary",
39
41
  "transition-colors hover:bg-inputs-calendar-range not-disabled:active:bg-inputs-calendar-range",
40
42
  "focus-visible:shadow-focus-ring focus-visible:outline-none",
41
43
  "disabled:cursor-not-allowed",
42
- isSelected ? "typography-body-small-14px-semibold" : "typography-body-small-14px-regular",
44
+ size === "40" && "size-10",
45
+ size === "32" && "size-8",
46
+ size === "40" && (isSelected ? "typography-body-small-14px-semibold" : "typography-body-small-14px-regular"),
47
+ size === "32" && (isSelected ? "typography-description-12px-semibold" : "typography-description-12px-regular"),
43
48
  modifiers.today && !isSelected && "bg-inputs-calendar-today ring-1 ring-inputs-calendar-today-stroke hover:bg-inputs-calendar-today",
44
49
  isSelected && "bg-inputs-calendar-selected text-content-primary-inverted hover:bg-inputs-calendar-selected",
45
50
  modifiers.range_middle && "bg-transparent hover:bg-transparent",
@@ -53,6 +58,7 @@ function DayButton({ day, modifiers, className, ...buttonProps }) {
53
58
  const DatePicker = forwardRef(
54
59
  ({
55
60
  variant = "single",
61
+ size = "40",
56
62
  onApply,
57
63
  onCancel,
58
64
  cancelLabel = "Cancel",
@@ -64,6 +70,11 @@ const DatePicker = forwardRef(
64
70
  }, ref) => {
65
71
  const numberOfMonths = variant === "double" ? 2 : 1;
66
72
  const isMulti = numberOfMonths > 1;
73
+ const isCompact = size === "32";
74
+ const navButtonClassName = cn(
75
+ "pointer-events-auto inline-flex cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default theme-v2:disabled:bg-buttons-secondary-default disabled:text-content-disabled [&>svg]:size-4",
76
+ isCompact ? "size-6" : "size-8"
77
+ );
67
78
  const resolvedDayPickerProps = (() => {
68
79
  if (dayPickerProps.mode !== "range") return dayPickerProps;
69
80
  const { selected, onSelect } = dayPickerProps;
@@ -87,12 +98,13 @@ const DatePicker = forwardRef(
87
98
  }
88
99
  };
89
100
  })();
90
- return /* @__PURE__ */ jsxs(
101
+ return /* @__PURE__ */ jsx(DatePickerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxs(
91
102
  "div",
92
103
  {
93
104
  ref,
94
105
  className: cn(
95
- "inline-flex flex-col rounded-xl border border-modal-stroke bg-modal-background p-6 shadow-blur-menu backdrop-blur-sm",
106
+ "inline-flex flex-col rounded-xl border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-sm",
107
+ isCompact ? "p-4" : "p-6",
96
108
  className
97
109
  ),
98
110
  children: [
@@ -109,14 +121,23 @@ const DatePicker = forwardRef(
109
121
  root: "w-full",
110
122
  months: cn("relative flex", isMulti && "gap-6"),
111
123
  month: "flex flex-1 flex-col",
112
- month_caption: "mb-4 flex h-8 items-center justify-center",
113
- caption_label: "typography-body-default-16px-regular text-content-primary",
124
+ month_caption: cn(
125
+ "flex items-center justify-center",
126
+ isCompact ? "mb-2 h-6" : "mb-4 h-8"
127
+ ),
128
+ caption_label: cn(
129
+ "text-content-primary",
130
+ isCompact ? "typography-body-small-14px-regular" : "typography-body-default-16px-regular"
131
+ ),
114
132
  nav: "absolute inset-x-0 top-0 z-20 flex justify-between",
115
- button_previous: "pointer-events-auto inline-flex size-8 cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default disabled:text-content-disabled [&>svg]:size-4",
116
- button_next: "pointer-events-auto inline-flex size-8 cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default disabled:text-content-disabled [&>svg]:size-4",
133
+ button_previous: navButtonClassName,
134
+ button_next: navButtonClassName,
117
135
  month_grid: "w-full",
118
136
  weekdays: "flex",
119
- weekday: "flex h-[30px] w-10 flex-1 items-center justify-center typography-body-small-14px-regular text-content-secondary",
137
+ weekday: cn(
138
+ "flex flex-1 items-center justify-center text-content-secondary",
139
+ isCompact ? "typography-description-12px-regular h-6 w-8" : "typography-body-small-14px-regular h-7.5 w-10"
140
+ ),
120
141
  week: "flex",
121
142
  day: "relative flex flex-1 items-center justify-center p-0.5",
122
143
  hidden: "hidden"
@@ -137,13 +158,13 @@ const DatePicker = forwardRef(
137
158
  ...resolvedDayPickerProps
138
159
  }
139
160
  ),
140
- showFooter && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 pt-6", children: [
141
- /* @__PURE__ */ jsx(Button, { variant: "outline", size: "40", className: "flex-1", onClick: onCancel, children: cancelLabel }),
142
- /* @__PURE__ */ jsx(Button, { variant: "primary", size: "40", className: "flex-1", onClick: onApply, children: applyLabel })
161
+ showFooter && /* @__PURE__ */ jsxs("div", { className: cn("flex gap-2", isCompact ? "pt-4" : "pt-6"), children: [
162
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size, className: "flex-1", onClick: onCancel, children: cancelLabel }),
163
+ /* @__PURE__ */ jsx(Button, { variant: "primary", size, className: "flex-1", onClick: onApply, children: applyLabel })
143
164
  ] })
144
165
  ]
145
166
  }
146
- );
167
+ ) });
147
168
  }
148
169
  );
149
170
  DatePicker.displayName = "DatePicker";
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.mjs","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef } from \"react\";\nimport {\n type ChevronProps,\n type DateRange,\n type DayButtonProps,\n DayPicker,\n type DayPickerProps,\n type DayProps,\n type Modifiers,\n type MonthGridProps,\n type WeekdayProps,\n type WeekdaysProps,\n type WeekProps,\n type WeeksProps,\n} from \"react-day-picker\";\nimport { cn } from \"../../utils/cn\";\nimport type { OmitDistributed } from \"../../utils/types\";\nimport { Button } from \"../Button/Button\";\nimport { ChevronLeftIcon } from \"../Icons/ChevronLeftIcon\";\nimport { ChevronRightIcon } from \"../Icons/ChevronRightIcon\";\n\nexport type { DateRange }; // Needed by consumers when passing props\n\n/** Layout variant — single or side-by-side month display. */\nexport type DatePickerVariant = \"single\" | \"double\";\n\n/** Props specific to the DatePicker wrapper (not inherited from react-day-picker). */\nexport interface DatePickerOwnProps {\n /** Display one month or two side-by-side. @default \"single\" */\n variant?: DatePickerVariant;\n /** Callback fired when the Apply button is clicked. */\n onApply?: () => void;\n /** Callback fired when the Cancel button is clicked. */\n onCancel?: () => void;\n /** Label for the cancel button. @default \"Cancel\" */\n cancelLabel?: string;\n /** Label for the apply button. @default \"Apply\" */\n applyLabel?: string;\n /** Whether to render the cancel / apply footer buttons. @default true */\n showFooter?: boolean;\n /** Additional CSS class name for the outer container. */\n className?: string;\n}\n\nfunction Day({ day, modifiers, className, ...divProps }: DayProps) {\n const { range_start, range_end, range_middle } = modifiers;\n const isSingleDayRange = range_start && range_end;\n const inRange = (range_start || range_end || range_middle) && !isSingleDayRange;\n\n return (\n <div\n className={cn(\n className,\n inRange && \"bg-inputs-calendar-range\",\n inRange && range_start && \"rounded-l-sm\",\n inRange && range_end && \"rounded-r-sm\",\n )}\n {...divProps}\n />\n );\n}\n\nfunction DayButton({ day, modifiers, className, ...buttonProps }: DayButtonProps) {\n const ref = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n const isSelected = modifiers.selected && !modifiers.range_middle;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"relative z-10 inline-flex size-10 cursor-pointer items-center justify-center rounded-sm text-content-primary\",\n \"transition-colors hover:bg-inputs-calendar-range not-disabled:active:bg-inputs-calendar-range\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"disabled:cursor-not-allowed\",\n isSelected ? \"typography-body-small-14px-semibold\" : \"typography-body-small-14px-regular\",\n modifiers.today &&\n !isSelected &&\n \"bg-inputs-calendar-today ring-1 ring-inputs-calendar-today-stroke hover:bg-inputs-calendar-today\",\n isSelected &&\n \"bg-inputs-calendar-selected text-content-primary-inverted hover:bg-inputs-calendar-selected\",\n modifiers.range_middle && \"bg-transparent hover:bg-transparent\",\n modifiers.disabled &&\n \"bg-inputs-calendar-disabled text-content-disabled hover:bg-inputs-calendar-disabled\",\n modifiers.outside && \"pointer-events-none text-content-disabled\",\n )}\n {...buttonProps}\n />\n );\n}\n\n/** Combined props — own DatePicker options plus all react-day-picker props (except `numberOfMonths`). */\nexport type DatePickerProps = DatePickerOwnProps &\n OmitDistributed<DayPickerProps, \"numberOfMonths\">;\n\n/**\n * A calendar date picker supporting single-date and date-range selection with\n * optional side-by-side month display and footer action buttons.\n *\n * Built on top of [react-day-picker](https://react-day-picker.js.org/) — all\n * `DayPickerProps` (except `numberOfMonths`) are forwarded.\n *\n * @example\n * ```tsx\n * <DatePicker\n * mode=\"range\"\n * variant=\"double\"\n * selected={range}\n * onSelect={setRange}\n * onApply={save}\n * onCancel={close}\n * />\n * ```\n */\nexport const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(\n (\n {\n variant = \"single\",\n onApply,\n onCancel,\n cancelLabel = \"Cancel\",\n applyLabel = \"Apply\",\n showFooter = true,\n className,\n formatters,\n ...dayPickerProps\n },\n ref,\n ) => {\n const numberOfMonths = variant === \"double\" ? 2 : 1;\n const isMulti = numberOfMonths > 1;\n\n // Wrap onSelect for range mode: when clicking inside a complete range,\n // move the nearest boundary instead of always resetting the end date.\n const resolvedDayPickerProps = (() => {\n if (dayPickerProps.mode !== \"range\") return dayPickerProps;\n\n const { selected, onSelect } = dayPickerProps as {\n selected?: DateRange;\n onSelect?: (\n range: DateRange | undefined,\n triggerDate: Date,\n modifiers: Modifiers,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n };\n\n if (!onSelect || !selected?.from || !selected?.to) return dayPickerProps;\n\n const { from, to } = selected;\n\n return {\n ...dayPickerProps,\n onSelect: (\n range: DateRange | undefined,\n triggerDate: Date,\n modifiers: Modifiers,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => {\n const clickedTime = triggerDate.getTime();\n const fromTime = from.getTime();\n const toTime = to.getTime();\n\n if (clickedTime > fromTime && clickedTime < toTime) {\n if (clickedTime - fromTime <= toTime - clickedTime) {\n onSelect({ from: triggerDate, to }, triggerDate, modifiers, e);\n } else {\n onSelect({ from, to: triggerDate }, triggerDate, modifiers, e);\n }\n return;\n }\n\n onSelect(range, triggerDate, modifiers, e);\n },\n } as typeof dayPickerProps;\n })();\n\n return (\n <div\n ref={ref}\n className={cn(\n \"inline-flex flex-col rounded-xl border border-modal-stroke bg-modal-background p-6 shadow-blur-menu backdrop-blur-sm\",\n className,\n )}\n >\n <DayPicker\n showOutsideDays\n numberOfMonths={numberOfMonths}\n formatters={{\n formatCaption: (date: Date) =>\n date.toLocaleDateString(\"en-US\", { month: \"long\", year: \"numeric\" }),\n ...formatters,\n }}\n classNames={{\n root: \"w-full\",\n months: cn(\"relative flex\", isMulti && \"gap-6\"),\n month: \"flex flex-1 flex-col\",\n month_caption: \"mb-4 flex h-8 items-center justify-center\",\n caption_label: \"typography-body-default-16px-regular text-content-primary\",\n nav: \"absolute inset-x-0 top-0 z-20 flex justify-between\",\n button_previous:\n \"pointer-events-auto inline-flex size-8 cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default disabled:text-content-disabled [&>svg]:size-4\",\n button_next:\n \"pointer-events-auto inline-flex size-8 cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default disabled:text-content-disabled [&>svg]:size-4\",\n month_grid: \"w-full\",\n weekdays: \"flex\",\n weekday:\n \"flex h-[30px] w-10 flex-1 items-center justify-center typography-body-small-14px-regular text-content-secondary\",\n week: \"flex\",\n day: \"relative flex flex-1 items-center justify-center p-0.5\",\n hidden: \"hidden\",\n }}\n components={{\n /**\n * !NOTE: We're unable to use semantic elements for the grid due to rdp, as such we've disabled the a11y lint rules for these elements in biome.json.\n */\n Chevron: ({ orientation }: ChevronProps) =>\n orientation === \"left\" ? <ChevronLeftIcon /> : <ChevronRightIcon />,\n MonthGrid: (props: MonthGridProps) => <div role=\"grid\" {...props} />,\n Weekdays: (props: WeekdaysProps) => <div role=\"row\" {...props} />,\n Weekday: (props: WeekdayProps) => <div role=\"columnheader\" {...props} />,\n Weeks: (props: WeeksProps) => <div role=\"rowgroup\" {...props} />,\n Week: ({ week, ...props }: WeekProps) => <div role=\"row\" {...props} />,\n Day,\n DayButton,\n }}\n {...resolvedDayPickerProps}\n />\n\n {showFooter && (\n <div className=\"flex gap-2 pt-6\">\n <Button variant=\"outline\" size=\"40\" className=\"flex-1\" onClick={onCancel}>\n {cancelLabel}\n </Button>\n <Button variant=\"primary\" size=\"40\" className=\"flex-1\" onClick={onApply}>\n {applyLabel}\n </Button>\n </div>\n )}\n </div>\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":[],"mappings":";;;;;;;;AA4CA,SAAS,IAAI,EAAE,KAAK,WAAW,WAAW,GAAG,YAAsB;AACjE,QAAM,EAAE,aAAa,WAAW,aAAA,IAAiB;AACjD,QAAM,mBAAmB,eAAe;AACxC,QAAM,WAAW,eAAe,aAAa,iBAAiB,CAAC;AAE/D,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,WAAW;AAAA,QACX,WAAW,eAAe;AAAA,QAC1B,WAAW,aAAa;AAAA,MAAA;AAAA,MAEzB,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAAS,UAAU,EAAE,KAAK,WAAW,WAAW,GAAG,eAA+B;AAChF,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,UAAU,QAAS,KAAI,SAAS,MAAA;AAAA,EACtC,GAAG,CAAC,UAAU,OAAO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GAAG,MAAA,CAAO;AAAA,gBACpE;AAAA,gBACA;AAAA,cAAA;AAAA,cAED,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,UAGL,cACC,qBAAC,OAAA,EAAI,WAAU,mBACb,UAAA;AAAA,YAAA,oBAAC,QAAA,EAAO,SAAQ,WAAU,MAAK,MAAK,WAAU,UAAS,SAAS,UAC7D,UAAA,YAAA,CACH;AAAA,YACA,oBAAC,QAAA,EAAO,SAAQ,WAAU,MAAK,MAAK,WAAU,UAAS,SAAS,SAC7D,UAAA,WAAA,CACH;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,WAAW,cAAc;"}
1
+ {"version":3,"file":"DatePicker.mjs","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { createContext, forwardRef, useContext, useEffect, useRef } from \"react\";\nimport {\n type ChevronProps,\n type DateRange,\n type DayButtonProps,\n DayPicker,\n type DayPickerProps,\n type DayProps,\n type Modifiers,\n type MonthGridProps,\n type WeekdayProps,\n type WeekdaysProps,\n type WeekProps,\n type WeeksProps,\n} from \"react-day-picker\";\nimport { cn } from \"../../utils/cn\";\nimport type { OmitDistributed } from \"../../utils/types\";\nimport { Button } from \"../Button/Button\";\nimport { ChevronLeftIcon } from \"../Icons/ChevronLeftIcon\";\nimport { ChevronRightIcon } from \"../Icons/ChevronRightIcon\";\n\nexport type { DateRange }; // Needed by consumers when passing props\n\n/** Layout variant — single or side-by-side month display. */\nexport type DatePickerVariant = \"single\" | \"double\";\n\n/** Day button size in pixels. It also scales the navigation, caption, padding and footer buttons. */\nexport type DatePickerSize = \"40\" | \"32\";\n\n/** Props specific to the DatePicker wrapper (not inherited from react-day-picker). */\nexport interface DatePickerOwnProps {\n /** Display one month or two side-by-side. @default \"single\" */\n variant?: DatePickerVariant;\n /**\n * Day button size in pixels. It also scales the navigation, caption, padding and footer buttons.\n * Use `\"32\"` for compact surfaces such as toolbar popovers.\n * @default \"40\"\n */\n size?: DatePickerSize;\n /** Callback fired when the Apply button is clicked. */\n onApply?: () => void;\n /** Callback fired when the Cancel button is clicked. */\n onCancel?: () => void;\n /** Label for the cancel button. @default \"Cancel\" */\n cancelLabel?: string;\n /** Label for the apply button. @default \"Apply\" */\n applyLabel?: string;\n /** Whether to render the cancel / apply footer buttons. @default true */\n showFooter?: boolean;\n /** Additional CSS class name for the outer container. */\n className?: string;\n}\n\nconst DatePickerSizeContext = createContext<DatePickerSize>(\"40\");\n\nfunction Day({ day, modifiers, className, ...divProps }: DayProps) {\n const { range_start, range_end, range_middle } = modifiers;\n const isSingleDayRange = range_start && range_end;\n const inRange = (range_start || range_end || range_middle) && !isSingleDayRange;\n\n return (\n <div\n className={cn(\n className,\n inRange &&\n \"before:absolute before:inset-x-0 before:inset-y-0.5 before:bg-inputs-calendar-range first:before:left-0.5 first:before:rounded-l-sm last:before:right-0.5 last:before:rounded-r-sm\",\n inRange && range_start && \"before:left-0.5 before:rounded-l-sm\",\n inRange && range_end && \"before:right-0.5 before:rounded-r-sm\",\n )}\n {...divProps}\n />\n );\n}\n\nfunction DayButton({ day, modifiers, className, ...buttonProps }: DayButtonProps) {\n const ref = useRef<HTMLButtonElement>(null);\n const size = useContext(DatePickerSizeContext);\n\n useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n const isSelected = modifiers.selected && !modifiers.range_middle;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"relative z-10 inline-flex cursor-pointer items-center justify-center rounded-sm text-content-primary\",\n \"transition-colors hover:bg-inputs-calendar-range not-disabled:active:bg-inputs-calendar-range\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"disabled:cursor-not-allowed\",\n size === \"40\" && \"size-10\",\n size === \"32\" && \"size-8\",\n size === \"40\" &&\n (isSelected\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-small-14px-regular\"),\n size === \"32\" &&\n (isSelected\n ? \"typography-description-12px-semibold\"\n : \"typography-description-12px-regular\"),\n modifiers.today &&\n !isSelected &&\n \"bg-inputs-calendar-today ring-1 ring-inputs-calendar-today-stroke hover:bg-inputs-calendar-today\",\n isSelected &&\n \"bg-inputs-calendar-selected text-content-primary-inverted hover:bg-inputs-calendar-selected\",\n modifiers.range_middle && \"bg-transparent hover:bg-transparent\",\n modifiers.disabled &&\n \"bg-inputs-calendar-disabled text-content-disabled hover:bg-inputs-calendar-disabled\",\n modifiers.outside && \"pointer-events-none text-content-disabled\",\n )}\n {...buttonProps}\n />\n );\n}\n\n/** Combined props — own DatePicker options plus all react-day-picker props (except `numberOfMonths`). */\nexport type DatePickerProps = DatePickerOwnProps &\n OmitDistributed<DayPickerProps, \"numberOfMonths\">;\n\n/**\n * A calendar date picker supporting single-date and date-range selection with\n * optional side-by-side month display and footer action buttons.\n *\n * Built on top of [react-day-picker](https://react-day-picker.js.org/) — all\n * `DayPickerProps` (except `numberOfMonths`) are forwarded.\n *\n * @example\n * ```tsx\n * <DatePicker\n * mode=\"range\"\n * variant=\"double\"\n * selected={range}\n * onSelect={setRange}\n * onApply={save}\n * onCancel={close}\n * />\n * ```\n */\nexport const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(\n (\n {\n variant = \"single\",\n size = \"40\",\n onApply,\n onCancel,\n cancelLabel = \"Cancel\",\n applyLabel = \"Apply\",\n showFooter = true,\n className,\n formatters,\n ...dayPickerProps\n },\n ref,\n ) => {\n const numberOfMonths = variant === \"double\" ? 2 : 1;\n const isMulti = numberOfMonths > 1;\n const isCompact = size === \"32\";\n const navButtonClassName = cn(\n \"pointer-events-auto inline-flex cursor-pointer items-center justify-center rounded-full bg-buttons-secondary-default text-content-primary transition-colors hover:bg-buttons-secondary-hover focus-visible:shadow-focus-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-buttons-disabled-default theme-v2:disabled:bg-buttons-secondary-default disabled:text-content-disabled [&>svg]:size-4\",\n isCompact ? \"size-6\" : \"size-8\",\n );\n\n // Wrap onSelect for range mode: when clicking inside a complete range,\n // move the nearest boundary instead of always resetting the end date.\n const resolvedDayPickerProps = (() => {\n if (dayPickerProps.mode !== \"range\") return dayPickerProps;\n\n const { selected, onSelect } = dayPickerProps as {\n selected?: DateRange;\n onSelect?: (\n range: DateRange | undefined,\n triggerDate: Date,\n modifiers: Modifiers,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n };\n\n if (!onSelect || !selected?.from || !selected?.to) return dayPickerProps;\n\n const { from, to } = selected;\n\n return {\n ...dayPickerProps,\n onSelect: (\n range: DateRange | undefined,\n triggerDate: Date,\n modifiers: Modifiers,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => {\n const clickedTime = triggerDate.getTime();\n const fromTime = from.getTime();\n const toTime = to.getTime();\n\n if (clickedTime > fromTime && clickedTime < toTime) {\n if (clickedTime - fromTime <= toTime - clickedTime) {\n onSelect({ from: triggerDate, to }, triggerDate, modifiers, e);\n } else {\n onSelect({ from, to: triggerDate }, triggerDate, modifiers, e);\n }\n return;\n }\n\n onSelect(range, triggerDate, modifiers, e);\n },\n } as typeof dayPickerProps;\n })();\n\n return (\n <DatePickerSizeContext.Provider value={size}>\n <div\n ref={ref}\n className={cn(\n \"inline-flex flex-col rounded-xl border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-sm\",\n isCompact ? \"p-4\" : \"p-6\",\n className,\n )}\n >\n <DayPicker\n showOutsideDays\n numberOfMonths={numberOfMonths}\n formatters={{\n formatCaption: (date: Date) =>\n date.toLocaleDateString(\"en-US\", { month: \"long\", year: \"numeric\" }),\n ...formatters,\n }}\n classNames={{\n root: \"w-full\",\n months: cn(\"relative flex\", isMulti && \"gap-6\"),\n month: \"flex flex-1 flex-col\",\n month_caption: cn(\n \"flex items-center justify-center\",\n isCompact ? \"mb-2 h-6\" : \"mb-4 h-8\",\n ),\n caption_label: cn(\n \"text-content-primary\",\n isCompact\n ? \"typography-body-small-14px-regular\"\n : \"typography-body-default-16px-regular\",\n ),\n nav: \"absolute inset-x-0 top-0 z-20 flex justify-between\",\n button_previous: navButtonClassName,\n button_next: navButtonClassName,\n month_grid: \"w-full\",\n weekdays: \"flex\",\n weekday: cn(\n \"flex flex-1 items-center justify-center text-content-secondary\",\n isCompact\n ? \"typography-description-12px-regular h-6 w-8\"\n : \"typography-body-small-14px-regular h-7.5 w-10\",\n ),\n week: \"flex\",\n day: \"relative flex flex-1 items-center justify-center p-0.5\",\n hidden: \"hidden\",\n }}\n components={{\n /**\n * !NOTE: We're unable to use semantic elements for the grid due to rdp, as such we've disabled the a11y lint rules for these elements in biome.json.\n */\n Chevron: ({ orientation }: ChevronProps) =>\n orientation === \"left\" ? <ChevronLeftIcon /> : <ChevronRightIcon />,\n MonthGrid: (props: MonthGridProps) => <div role=\"grid\" {...props} />,\n Weekdays: (props: WeekdaysProps) => <div role=\"row\" {...props} />,\n Weekday: (props: WeekdayProps) => <div role=\"columnheader\" {...props} />,\n Weeks: (props: WeeksProps) => <div role=\"rowgroup\" {...props} />,\n Week: ({ week, ...props }: WeekProps) => <div role=\"row\" {...props} />,\n Day,\n DayButton,\n }}\n {...resolvedDayPickerProps}\n />\n\n {showFooter && (\n <div className={cn(\"flex gap-2\", isCompact ? \"pt-4\" : \"pt-6\")}>\n <Button variant=\"outline\" size={size} className=\"flex-1\" onClick={onCancel}>\n {cancelLabel}\n </Button>\n <Button variant=\"primary\" size={size} className=\"flex-1\" onClick={onApply}>\n {applyLabel}\n </Button>\n </div>\n )}\n </div>\n </DatePickerSizeContext.Provider>\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":[],"mappings":";;;;;;;;AAqDA,MAAM,wBAAwB,cAA8B,IAAI;AAEhE,SAAS,IAAI,EAAE,KAAK,WAAW,WAAW,GAAG,YAAsB;AACjE,QAAM,EAAE,aAAa,WAAW,aAAA,IAAiB;AACjD,QAAM,mBAAmB,eAAe;AACxC,QAAM,WAAW,eAAe,aAAa,iBAAiB,CAAC;AAE/D,SAC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AA,GAGN;AAAA,EAEJ;AACF;AAEA,WAAW,cAAc;"}
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
4
+ import { forwardRef, useState, useRef } from "react";
5
+ import { cn } from "../../utils/cn.mjs";
6
+ import { Button } from "../Button/Button.mjs";
7
+ import { CheckIcon } from "../Icons/CheckIcon.mjs";
8
+ import { RadioGroup } from "../RadioGroup/RadioGroup.mjs";
9
+ import { DatePicker } from "./DatePicker.mjs";
10
+ const CUSTOM_ROW_VALUE = "__custom-range__";
11
+ const ROW_CLASS_NAME = [
12
+ "typography-body-small-14px-regular flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-3 py-1.5 text-start text-content-primary outline-none",
13
+ "hover:bg-interaction-hover focus-visible:bg-interaction-hover",
14
+ "data-[state=checked]:bg-menu-item-selected data-[state=checked]:font-semibold data-[state=checked]:hover:bg-interaction-hover data-[state=checked]:focus-visible:bg-interaction-hover",
15
+ "theme-v2:data-[state=checked]:text-content-primary-inverted theme-v2:data-[state=checked]:hover:bg-menu-item-selected-hover theme-v2:data-[state=checked]:focus-visible:bg-menu-item-selected-hover"
16
+ ].join(" ");
17
+ const ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
18
+ function DateRangeRow({ value, onClick, children }) {
19
+ return /* @__PURE__ */ jsxs(RadioGroupPrimitive.Item, { value, onClick, className: ROW_CLASS_NAME, children: [
20
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children }),
21
+ /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4 shrink-0" }) })
22
+ ] });
23
+ }
24
+ const DateRangePanel = forwardRef(
25
+ ({
26
+ presets,
27
+ customRangeLabel,
28
+ value,
29
+ onValueChange,
30
+ applyLabel = "Apply",
31
+ cancelLabel = "Cancel",
32
+ onCancel,
33
+ calendarProps,
34
+ "aria-label": ariaLabel,
35
+ className
36
+ }, ref) => {
37
+ const appliedRange = value.type === "custom" ? value.range : void 0;
38
+ const [showCalendar, setShowCalendar] = useState(false);
39
+ const [draft, setDraft] = useState(appliedRange);
40
+ const arrowKeyDown = useRef(false);
41
+ const openCalendar = () => {
42
+ setDraft(appliedRange);
43
+ setShowCalendar(true);
44
+ };
45
+ const pickRow = (rowValue) => {
46
+ if (rowValue === CUSTOM_ROW_VALUE) openCalendar();
47
+ else onValueChange({ type: "preset", presetId: rowValue });
48
+ };
49
+ const apply = () => {
50
+ if (draft?.from && draft.to) {
51
+ onValueChange({ type: "custom", range: { from: draft.from, to: draft.to } });
52
+ }
53
+ };
54
+ const cancel = () => {
55
+ setDraft(void 0);
56
+ setShowCalendar(false);
57
+ onCancel?.();
58
+ };
59
+ if (showCalendar) {
60
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("flex flex-col", className), children: [
61
+ /* @__PURE__ */ jsx(
62
+ DatePicker,
63
+ {
64
+ mode: "range",
65
+ variant: "single",
66
+ size: "32",
67
+ showFooter: false,
68
+ defaultMonth: appliedRange?.from,
69
+ selected: draft,
70
+ onSelect: setDraft,
71
+ className: "rounded-none border-0 bg-transparent p-0 shadow-none backdrop-blur-none",
72
+ ...calendarProps
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 pt-4", children: [
76
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "32", onClick: cancel, children: cancelLabel }),
77
+ /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ variant: "primary",
81
+ size: "32",
82
+ disabled: !draft?.from || !draft.to,
83
+ onClick: apply,
84
+ children: applyLabel
85
+ }
86
+ )
87
+ ] })
88
+ ] });
89
+ }
90
+ const rowClick = (rowValue) => () => {
91
+ if (!arrowKeyDown.current) pickRow(rowValue);
92
+ };
93
+ return /* @__PURE__ */ jsxs(
94
+ RadioGroup,
95
+ {
96
+ ref,
97
+ "aria-label": ariaLabel,
98
+ value: value.type === "preset" ? value.presetId : customRangeLabel === void 0 ? "" : CUSTOM_ROW_VALUE,
99
+ className: cn("flex min-w-48 flex-col gap-0.5", className),
100
+ onKeyDown: (event) => {
101
+ if (ARROW_KEYS.has(event.key)) arrowKeyDown.current = true;
102
+ const row = event.target instanceof HTMLElement ? event.target.closest("[role=radio]") : null;
103
+ if (event.key === "Enter" && row instanceof HTMLButtonElement) pickRow(row.value);
104
+ },
105
+ onKeyUp: () => {
106
+ arrowKeyDown.current = false;
107
+ },
108
+ onBlur: (event) => {
109
+ if (!event.currentTarget.contains(event.relatedTarget)) arrowKeyDown.current = false;
110
+ },
111
+ children: [
112
+ presets.map((preset) => /* @__PURE__ */ jsx(DateRangeRow, { value: preset.id, onClick: rowClick(preset.id), children: preset.label }, preset.id)),
113
+ customRangeLabel !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
114
+ /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "my-1 h-px bg-neutral-alphas-200" }),
115
+ /* @__PURE__ */ jsx(DateRangeRow, { value: CUSTOM_ROW_VALUE, onClick: rowClick(CUSTOM_ROW_VALUE), children: customRangeLabel })
116
+ ] })
117
+ ]
118
+ }
119
+ );
120
+ }
121
+ );
122
+ DateRangePanel.displayName = "DateRangePanel";
123
+ export {
124
+ DateRangePanel
125
+ };
126
+ //# sourceMappingURL=DateRangePanel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateRangePanel.mjs","sources":["../../../src/components/DatePicker/DateRangePanel.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { forwardRef, useRef, useState } from \"react\";\nimport type { DateRange, DayPickerProps } from \"react-day-picker\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { RadioGroup } from \"../RadioGroup/RadioGroup\";\nimport { DatePicker } from \"./DatePicker\";\n\n/** A named preset the caller maps to a date range. The kit does no date maths. */\nexport interface DateRangePreset {\n /** Stable identifier emitted in `{ type: \"preset\", presetId }`. */\n id: string;\n /** Visible, already translated label. */\n label: string;\n}\n\n/** The applied selection: one of the caller's presets, or an explicit custom range. */\nexport type DateRangeValue =\n | { type: \"preset\"; presetId: string }\n | { type: \"custom\"; range: { from: Date; to: Date } };\n\n/** Calendar options forwarded to the custom range calendar. */\nexport type DateRangeCalendarProps = Pick<\n DayPickerProps,\n \"disabled\" | \"startMonth\" | \"endMonth\" | \"weekStartsOn\" | \"locale\"\n>;\n\n/** Props for {@link DateRangePanel}. */\nexport interface DateRangePanelProps {\n /** Preset rows, in display order. */\n presets: readonly DateRangePreset[];\n /** Label of the last row, which opens the calendar. Omit to offer presets only. Translated by the caller. */\n customRangeLabel?: string;\n /** The applied selection. A custom value checks the Custom range row. Picking that row opens the calendar on the applied range. */\n value: DateRangeValue;\n /**\n * Called with `{ type: \"preset\", presetId }` as soon as a preset row is picked by click, Space or\n * Enter, including the current one, and with `{ type: \"custom\", range }` when Apply is clicked.\n * Arrow keys move focus without calling it.\n */\n onValueChange: (value: DateRangeValue) => void;\n /** Label of the Apply button. @default \"Apply\" */\n applyLabel?: string;\n /** Label of the Cancel button. @default \"Cancel\" */\n cancelLabel?: string;\n /** Called after Cancel drops the draft range and the panel returns to the preset list. */\n onCancel?: () => void;\n /** Bounds, locale and first weekday for the calendar. */\n calendarProps?: DateRangeCalendarProps;\n /** Accessible name of the preset list. Translated by the caller. */\n \"aria-label\": string;\n /** Additional CSS class name for the root element. */\n className?: string;\n}\n\nconst CUSTOM_ROW_VALUE = \"__custom-range__\";\nconst ROW_CLASS_NAME = [\n \"typography-body-small-14px-regular flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-3 py-1.5 text-start text-content-primary outline-none\",\n \"hover:bg-interaction-hover focus-visible:bg-interaction-hover\",\n \"data-[state=checked]:bg-menu-item-selected data-[state=checked]:font-semibold data-[state=checked]:hover:bg-interaction-hover data-[state=checked]:focus-visible:bg-interaction-hover\",\n \"theme-v2:data-[state=checked]:text-content-primary-inverted theme-v2:data-[state=checked]:hover:bg-menu-item-selected-hover theme-v2:data-[state=checked]:focus-visible:bg-menu-item-selected-hover\",\n].join(\" \");\n\nconst ARROW_KEYS = new Set([\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"]);\n\ninterface DateRangeRowProps {\n value: string;\n onClick: () => void;\n children: string;\n}\n\nfunction DateRangeRow({ value, onClick, children }: DateRangeRowProps) {\n return (\n <RadioGroupPrimitive.Item value={value} onClick={onClick} className={ROW_CLASS_NAME}>\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n <RadioGroupPrimitive.Indicator>\n <CheckIcon className=\"size-4 shrink-0\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n}\n\n/**\n * A list of date range presets, with a \"Custom range\" row that swaps to a one-month calendar when\n * `customRangeLabel` is given. A pointer click, Space or Enter on a row picks it. A preset applies\n * at once, and a custom range applies on Apply, with Cancel returning to the list. It always opens\n * on the list, even when a custom range is applied, so a preset stays reachable. The arrow keys\n * only move focus between rows and never pick one, so a keyboard user can reach a row without\n * applying it. It renders no popover, so it can sit inside a popover or a phone sheet. The caller\n * maps preset ids to dates.\n *\n * @example\n * ```tsx\n * <DateRangePanel\n * aria-label=\"Date range\"\n * presets={[{ id: \"7d\", label: \"Last 7 days\" }]}\n * customRangeLabel=\"Custom range\"\n * value={value}\n * onValueChange={setValue}\n * />\n * ```\n */\nexport const DateRangePanel = forwardRef<HTMLDivElement, DateRangePanelProps>(\n (\n {\n presets,\n customRangeLabel,\n value,\n onValueChange,\n applyLabel = \"Apply\",\n cancelLabel = \"Cancel\",\n onCancel,\n calendarProps,\n \"aria-label\": ariaLabel,\n className,\n },\n ref,\n ) => {\n const appliedRange = value.type === \"custom\" ? value.range : undefined;\n const [showCalendar, setShowCalendar] = useState(false);\n const [draft, setDraft] = useState<DateRange | undefined>(appliedRange);\n const arrowKeyDown = useRef(false);\n\n const openCalendar = () => {\n setDraft(appliedRange);\n setShowCalendar(true);\n };\n\n const pickRow = (rowValue: string) => {\n if (rowValue === CUSTOM_ROW_VALUE) openCalendar();\n else onValueChange({ type: \"preset\", presetId: rowValue });\n };\n\n const apply = () => {\n if (draft?.from && draft.to) {\n onValueChange({ type: \"custom\", range: { from: draft.from, to: draft.to } });\n }\n };\n\n const cancel = () => {\n setDraft(undefined);\n setShowCalendar(false);\n onCancel?.();\n };\n\n if (showCalendar) {\n return (\n <div ref={ref} className={cn(\"flex flex-col\", className)}>\n <DatePicker\n mode=\"range\"\n variant=\"single\"\n size=\"32\"\n showFooter={false}\n defaultMonth={appliedRange?.from}\n selected={draft}\n onSelect={setDraft}\n className=\"rounded-none border-0 bg-transparent p-0 shadow-none backdrop-blur-none\"\n {...calendarProps}\n />\n <div className=\"grid grid-cols-2 gap-2 pt-4\">\n <Button variant=\"outline\" size=\"32\" onClick={cancel}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n size=\"32\"\n disabled={!draft?.from || !draft.to}\n onClick={apply}\n >\n {applyLabel}\n </Button>\n </div>\n </div>\n );\n }\n\n const rowClick = (rowValue: string) => () => {\n if (!arrowKeyDown.current) pickRow(rowValue);\n };\n\n return (\n <RadioGroup\n ref={ref}\n aria-label={ariaLabel}\n value={\n value.type === \"preset\"\n ? value.presetId\n : customRangeLabel === undefined\n ? \"\"\n : CUSTOM_ROW_VALUE\n }\n className={cn(\"flex min-w-48 flex-col gap-0.5\", className)}\n onKeyDown={(event) => {\n if (ARROW_KEYS.has(event.key)) arrowKeyDown.current = true;\n const row =\n event.target instanceof HTMLElement ? event.target.closest(\"[role=radio]\") : null;\n if (event.key === \"Enter\" && row instanceof HTMLButtonElement) pickRow(row.value);\n }}\n onKeyUp={() => {\n arrowKeyDown.current = false;\n }}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) arrowKeyDown.current = false;\n }}\n >\n {presets.map((preset) => (\n <DateRangeRow key={preset.id} value={preset.id} onClick={rowClick(preset.id)}>\n {preset.label}\n </DateRangeRow>\n ))}\n {customRangeLabel !== undefined && (\n <>\n <div aria-hidden className=\"my-1 h-px bg-neutral-alphas-200\" />\n <DateRangeRow value={CUSTOM_ROW_VALUE} onClick={rowClick(CUSTOM_ROW_VALUE)}>\n {customRangeLabel}\n </DateRangeRow>\n </>\n )}\n </RadioGroup>\n );\n },\n);\n\nDateRangePanel.displayName = \"DateRangePanel\";\n"],"names":[],"mappings":";;;;;;;;;AAwDA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG;AAEV,MAAM,iCAAiB,IAAI,CAAC,WAAW,aAAa,aAAa,YAAY,CAAC;AAQ9E,SAAS,aAAa,EAAE,OAAO,SAAS,YAA+B;AACrE,8BACG,oBAAoB,MAApB,EAAyB,OAAc,SAAkB,WAAW,gBACnE,UAAA;AAAA,IAAA,oBAAC,QAAA,EAAK,WAAU,2BAA2B,SAAA,CAAS;AAAA,IACpD,oBAAC,oBAAoB,WAApB,EACC,8BAAC,WAAA,EAAU,WAAU,mBAAkB,EAAA,CACzC;AAAA,EAAA,GACF;AAEJ;AAsBO,MAAM,iBAAiB;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,EAAA,GAEF,QACG;AACH,UAAM,eAAe,MAAM,SAAS,WAAW,MAAM,QAAQ;AAC7D,UAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,UAAM,CAAC,OAAO,QAAQ,IAAI,SAAgC,YAAY;AACtE,UAAM,eAAe,OAAO,KAAK;AAEjC,UAAM,eAAe,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