@handijitcom/ui 2.0.1 → 3.1.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 (173) hide show
  1. package/README.md +202 -71
  2. package/build/calendar.cjs +1 -1
  3. package/build/calendar.cjs.map +1 -1
  4. package/build/calendar.css +1 -1
  5. package/build/calendar.js +109 -111
  6. package/build/calendar.js.map +1 -1
  7. package/build/chat.cjs +1 -1
  8. package/build/chat.cjs.map +1 -1
  9. package/build/chat.css +1 -1
  10. package/build/chat.js +2 -2
  11. package/build/chat.js.map +1 -1
  12. package/build/components/Alert/style.css +1 -1
  13. package/build/components/Avatar/index.cjs.map +1 -1
  14. package/build/components/Avatar/index.d.cts +1 -1
  15. package/build/components/Avatar/index.d.ts +1 -1
  16. package/build/components/Avatar/index.js.map +1 -1
  17. package/build/components/Avatar/style.css +1 -1
  18. package/build/components/Badge/index.cjs +1 -1
  19. package/build/components/Badge/index.cjs.map +1 -1
  20. package/build/components/Badge/index.d.cts +4 -2
  21. package/build/components/Badge/index.d.ts +4 -2
  22. package/build/components/Badge/index.js +1 -1
  23. package/build/components/Badge/index.js.map +1 -1
  24. package/build/components/Badge/style.css +1 -1
  25. package/build/components/BrandSurface/index.cjs +2 -0
  26. package/build/components/BrandSurface/index.cjs.map +1 -0
  27. package/build/components/BrandSurface/index.d.cts +46 -0
  28. package/build/components/BrandSurface/index.d.ts +46 -0
  29. package/build/components/BrandSurface/index.js +128 -0
  30. package/build/components/BrandSurface/index.js.map +1 -0
  31. package/build/components/BrandSurface/style.css +1 -0
  32. package/build/components/BulkPasteInput/index.cjs +2 -0
  33. package/build/components/BulkPasteInput/index.cjs.map +1 -0
  34. package/build/components/BulkPasteInput/index.d.cts +26 -0
  35. package/build/components/BulkPasteInput/index.d.ts +26 -0
  36. package/build/components/BulkPasteInput/index.js +80 -0
  37. package/build/components/BulkPasteInput/index.js.map +1 -0
  38. package/build/components/BulkPasteInput/style.css +1 -0
  39. package/build/components/Button/index.cjs +1 -1
  40. package/build/components/Button/index.js +1 -1
  41. package/build/components/Button/style.css +1 -1
  42. package/build/components/Checkbox/index.cjs +1 -1
  43. package/build/components/Checkbox/index.cjs.map +1 -1
  44. package/build/components/Checkbox/index.js +6 -6
  45. package/build/components/Checkbox/index.js.map +1 -1
  46. package/build/components/CodeBadge/style.css +1 -1
  47. package/build/components/CopyField/style.css +1 -1
  48. package/build/components/DataTable/context.cjs +2 -0
  49. package/build/components/DataTable/context.cjs.map +1 -0
  50. package/build/components/DataTable/context.d.cts +17 -0
  51. package/build/components/DataTable/context.d.ts +17 -0
  52. package/build/components/DataTable/context.js +7 -0
  53. package/build/components/DataTable/context.js.map +1 -0
  54. package/build/components/DataTable/index.cjs +1 -1
  55. package/build/components/DataTable/index.cjs.map +1 -1
  56. package/build/components/DataTable/index.d.cts +46 -5
  57. package/build/components/DataTable/index.d.ts +46 -5
  58. package/build/components/DataTable/index.js +236 -93
  59. package/build/components/DataTable/index.js.map +1 -1
  60. package/build/components/DataTable/style.css +1 -1
  61. package/build/components/DataTableColumnMenu/index.cjs +2 -0
  62. package/build/components/DataTableColumnMenu/index.cjs.map +1 -0
  63. package/build/components/DataTableColumnMenu/index.d.cts +13 -0
  64. package/build/components/DataTableColumnMenu/index.d.ts +13 -0
  65. package/build/components/DataTableColumnMenu/index.js +69 -0
  66. package/build/components/DataTableColumnMenu/index.js.map +1 -0
  67. package/build/components/DataTableColumnMenu/style.css +1 -0
  68. package/build/components/Eyebrow/index.cjs.map +1 -1
  69. package/build/components/Eyebrow/index.d.cts +1 -1
  70. package/build/components/Eyebrow/index.d.ts +1 -1
  71. package/build/components/Eyebrow/index.js.map +1 -1
  72. package/build/components/Eyebrow/style.css +1 -1
  73. package/build/components/Gallery/index.cjs +2 -0
  74. package/build/components/Gallery/index.cjs.map +1 -0
  75. package/build/components/Gallery/index.d.cts +56 -0
  76. package/build/components/Gallery/index.d.ts +56 -0
  77. package/build/components/Gallery/index.js +253 -0
  78. package/build/components/Gallery/index.js.map +1 -0
  79. package/build/components/Gallery/style.css +1 -0
  80. package/build/components/Modal/style.css +1 -1
  81. package/build/components/NotificationCenter/index.cjs +2 -0
  82. package/build/components/NotificationCenter/index.cjs.map +1 -0
  83. package/build/components/NotificationCenter/index.d.cts +45 -0
  84. package/build/components/NotificationCenter/index.d.ts +45 -0
  85. package/build/components/NotificationCenter/index.js +124 -0
  86. package/build/components/NotificationCenter/index.js.map +1 -0
  87. package/build/components/NotificationCenter/style.css +1 -0
  88. package/build/components/Popover/index.cjs +1 -1
  89. package/build/components/Popover/index.cjs.map +1 -1
  90. package/build/components/Popover/index.js +16 -16
  91. package/build/components/Popover/index.js.map +1 -1
  92. package/build/components/Progress/index.cjs +1 -1
  93. package/build/components/Progress/index.cjs.map +1 -1
  94. package/build/components/Progress/index.d.cts +2 -2
  95. package/build/components/Progress/index.d.ts +2 -2
  96. package/build/components/Progress/index.js +1 -1
  97. package/build/components/Progress/index.js.map +1 -1
  98. package/build/components/Progress/style.css +1 -1
  99. package/build/components/Rating/style.css +1 -1
  100. package/build/components/RatingInput/style.css +1 -1
  101. package/build/components/Stat/style.css +1 -1
  102. package/build/components/StatStrip/index.cjs +1 -1
  103. package/build/components/StatStrip/index.cjs.map +1 -1
  104. package/build/components/StatStrip/index.d.cts +3 -3
  105. package/build/components/StatStrip/index.d.ts +3 -3
  106. package/build/components/StatStrip/index.js +1 -1
  107. package/build/components/StatStrip/index.js.map +1 -1
  108. package/build/components/StatStrip/style.css +1 -1
  109. package/build/components/StatusDot/index.cjs +1 -1
  110. package/build/components/StatusDot/index.cjs.map +1 -1
  111. package/build/components/StatusDot/index.d.cts +5 -3
  112. package/build/components/StatusDot/index.d.ts +5 -3
  113. package/build/components/StatusDot/index.js +1 -1
  114. package/build/components/StatusDot/index.js.map +1 -1
  115. package/build/components/StatusDot/style.css +1 -1
  116. package/build/components/TagInput/style.css +1 -1
  117. package/build/components/Textarea/style.css +1 -1
  118. package/build/components/Timeline/style.css +1 -1
  119. package/build/components/Toast/style.css +1 -1
  120. package/build/components/TreeSelect/index.cjs +2 -0
  121. package/build/components/TreeSelect/index.cjs.map +1 -0
  122. package/build/components/TreeSelect/index.d.cts +40 -0
  123. package/build/components/TreeSelect/index.d.ts +40 -0
  124. package/build/components/TreeSelect/index.js +175 -0
  125. package/build/components/TreeSelect/index.js.map +1 -0
  126. package/build/components/TreeSelect/style.css +1 -0
  127. package/build/design/index.cjs +84 -178
  128. package/build/design/index.cjs.map +1 -1
  129. package/build/design/index.d.cts +72 -63
  130. package/build/design/index.d.mts +72 -63
  131. package/build/design/index.mjs +84 -178
  132. package/build/design/index.mjs.map +1 -1
  133. package/build/design/index.umd.cjs +1 -1
  134. package/build/design/index.umd.cjs.map +1 -1
  135. package/build/design/tokens.css +62 -177
  136. package/build/design/tokens.json +66 -168
  137. package/build/design/tokens.scss +48 -178
  138. package/build/enums/ui-variant.enum.cjs +1 -1
  139. package/build/enums/ui-variant.enum.cjs.map +1 -1
  140. package/build/enums/ui-variant.enum.d.cts +2 -2
  141. package/build/enums/ui-variant.enum.d.ts +2 -2
  142. package/build/enums/ui-variant.enum.js +1 -1
  143. package/build/enums/ui-variant.enum.js.map +1 -1
  144. package/build/helpers/bulk-paste.helper.cjs +2 -0
  145. package/build/helpers/bulk-paste.helper.cjs.map +1 -0
  146. package/build/helpers/bulk-paste.helper.d.cts +38 -0
  147. package/build/helpers/bulk-paste.helper.d.ts +38 -0
  148. package/build/helpers/bulk-paste.helper.js +37 -0
  149. package/build/helpers/bulk-paste.helper.js.map +1 -0
  150. package/build/index.cjs +1 -1
  151. package/build/index.d.cts +8 -2
  152. package/build/index.d.ts +8 -2
  153. package/build/index.js +122 -110
  154. package/build/index.js.map +1 -1
  155. package/build/scss/_mixins.scss +8 -10
  156. package/build/scss/_variables.scss +19 -39
  157. package/build/styles.css +31 -21
  158. package/build/types/calendar/Calendar/index.d.cts +1 -1
  159. package/build/types/calendar/Calendar/index.d.ts +1 -1
  160. package/build/types/calendar/core/types.d.cts +3 -2
  161. package/build/types/calendar/core/types.d.ts +3 -2
  162. package/build/types/theme.type.d.cts +54 -0
  163. package/build/types/theme.type.d.ts +54 -0
  164. package/build/types/types/theme.type.d.cts +54 -0
  165. package/build/types/types/theme.type.d.ts +54 -0
  166. package/package.json +61 -11
  167. package/build/components/Band/index.cjs +0 -2
  168. package/build/components/Band/index.cjs.map +0 -1
  169. package/build/components/Band/index.d.cts +0 -45
  170. package/build/components/Band/index.d.ts +0 -45
  171. package/build/components/Band/index.js +0 -126
  172. package/build/components/Band/index.js.map +0 -1
  173. package/build/components/Band/style.css +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Gallery/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type KeyboardEvent,\n memo,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n ArrowsFullscreen,\n ChevronLeft,\n ChevronRight,\n XLg,\n ZoomIn,\n ZoomOut,\n} from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { captureFocus, isTopModal, pushModal } from '../../helpers/focus.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport useScrollLock from '../../hooks/useScrollLock';\nimport { useUi } from '../../theme/context';\nimport type { Formatter } from '../../types/theme.type';\nimport IconButton from '../IconButton';\n\nimport styles from './index.module.scss';\n\nexport type GalleryImage = {\n src: string;\n /** What the image shows (\"Fren balatası, ön yüz\"). */\n alt: string;\n /** A smaller file for the thumbnail; `src` when omitted. */\n thumbnailSrc?: string;\n width?: number;\n height?: number;\n};\n\n/** Where an image is drawn: the adapter picks sizes and priority from it. */\nexport type GalleryImageVariant = 'main' | 'thumbnail' | 'fullscreen';\n\n/** What `renderImage` receives. `className` MUST reach the element: zoom is drawn through it. */\nexport type GalleryRenderImageProps = {\n src: string;\n alt: string;\n className: string;\n variant: GalleryImageVariant;\n /** The image's position in `images`. */\n index: number;\n width?: number;\n height?: number;\n};\n\nexport type GalleryLabels = {\n thumbnails: string;\n thumbnail: Formatter<[index: number, total: number]>;\n previous: string;\n next: string;\n fullscreen: string;\n zoomIn: string;\n zoomOut: string;\n close: string;\n};\n\ntype Props = {\n images: GalleryImage[];\n /** The gallery's accessible name (\"Ürün görselleri\"); also the full-screen view's name. */\n label: string;\n /**\n * Draws one image — the platform's own component (`next/image`, a cached Electron loader). A\n * plain `<img>` when omitted.\n */\n renderImage?: (props: GalleryRenderImageProps) => ReactNode;\n /** Controlled index of the shown image; uncontrolled when omitted. */\n index?: number;\n onIndexChange?: (index: number) => void;\n /** Magnifies the main image under a mouse pointer and lets the full-screen view zoom (default). */\n hasZoom?: boolean;\n labels?: Partial<GalleryLabels>;\n className?: string;\n testId?: string;\n};\n\n/* A horizontal drag this long (px) is a swipe, not a tap. */\nconst SWIPE_DISTANCE = 40;\n\nconst defaultRenderImage = ({\n src,\n alt,\n className,\n width,\n height,\n variant,\n}: GalleryRenderImageProps) => (\n <img\n src={src}\n alt={alt}\n className={className}\n width={width}\n height={height}\n loading={variant === 'thumbnail' ? 'lazy' : undefined}\n decoding=\"async\"\n draggable={false}\n />\n);\n\n/** Writes the zoom origin as custom properties: no re-render on every pointer move. */\nconst setZoomOrigin = (element: HTMLElement, clientX: number, clientY: number) => {\n const rect = element.getBoundingClientRect();\n const x = rect.width > 0 ? ((clientX - rect.left) / rect.width) * 100 : 50;\n const y = rect.height > 0 ? ((clientY - rect.top) / rect.height) * 100 : 50;\n element.style.setProperty('--ui-gallery-zoom-x', `${x}%`);\n element.style.setProperty('--ui-gallery-zoom-y', `${y}%`);\n};\n\n/** Product gallery: main image, thumbnails, hover zoom and a full-screen view (3.1). */\nconst Gallery = ({\n images,\n label,\n renderImage = defaultRenderImage,\n index: controlledIndex,\n onIndexChange,\n hasZoom = true,\n labels: labelProps,\n className,\n testId,\n}: Props) => {\n const { labels: config } = useUi();\n const [innerIndex, setInnerIndex] = useState(0);\n const [isFullscreen, setIsFullscreen] = useState(false);\n const [isZoomed, setIsZoomed] = useState(false);\n const dialogRef = useRef<HTMLDialogElement>(null);\n const thumbsRef = useRef<HTMLUListElement>(null);\n const swipeRef = useRef<{ x: number; y: number } | null>(null);\n /* A swipe ends with a click on the same element: that click must not open the viewer. */\n const didSwipeRef = useRef(false);\n\n const total = images.length;\n const current = Math.max(0, Math.min(controlledIndex ?? innerIndex, total - 1));\n\n const text = {\n thumbnails: resolveLabel(\n 'Gallery.labels.thumbnails',\n labelProps?.thumbnails,\n config?.gallery?.thumbnails,\n ),\n previous: resolveLabel(\n 'Gallery.labels.previous',\n labelProps?.previous,\n config?.gallery?.previous,\n ),\n next: resolveLabel('Gallery.labels.next', labelProps?.next, config?.gallery?.next),\n fullscreen: resolveLabel(\n 'Gallery.labels.fullscreen',\n labelProps?.fullscreen,\n config?.gallery?.fullscreen,\n ),\n };\n\n const select = useCallback(\n (next: number) => {\n const wrapped = (next + total) % total;\n if (controlledIndex === undefined) setInnerIndex(wrapped);\n setIsZoomed(false);\n onIndexChange?.(wrapped);\n },\n [controlledIndex, onIndexChange, total],\n );\n\n const close = useCallback(() => {\n setIsFullscreen(false);\n setIsZoomed(false);\n }, []);\n\n /* The viewer is a modal `<dialog>`, opened and closed like `Modal`. */\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!isFullscreen || !dialog) return;\n\n const restoreFocus = captureFocus();\n if (!dialog.open) dialog.showModal();\n const { token, pop } = pushModal();\n\n const handleCancel = (event: Event) => {\n event.preventDefault();\n if (isTopModal(token)) close();\n };\n dialog.addEventListener('cancel', handleCancel);\n\n return () => {\n dialog.removeEventListener('cancel', handleCancel);\n if (dialog.open) dialog.close();\n pop();\n restoreFocus();\n };\n }, [isFullscreen, close]);\n\n useScrollLock(isFullscreen);\n\n if (total === 0) return null;\n\n const image = images[current];\n const hasMany = total > 1;\n\n const handleArrowKeys = (event: KeyboardEvent<HTMLElement>, moveFocus = false) => {\n const target: Record<string, number> = {\n ArrowRight: current + 1,\n ArrowLeft: current - 1,\n Home: 0,\n End: total - 1,\n };\n if (!hasMany || !(event.key in target)) return;\n\n event.preventDefault();\n const next = (target[event.key] + total) % total;\n select(next);\n if (moveFocus) thumbsRef.current?.querySelectorAll('button')[next]?.focus();\n };\n\n const handlePointerDown = (event: PointerEvent<HTMLElement>) => {\n didSwipeRef.current = false;\n swipeRef.current = isZoomed ? null : { x: event.clientX, y: event.clientY };\n };\n\n const handlePointerUp = (event: PointerEvent<HTMLElement>) => {\n const start = swipeRef.current;\n swipeRef.current = null;\n if (!start || !hasMany) return;\n\n const dx = event.clientX - start.x;\n const dy = event.clientY - start.y;\n if (Math.abs(dx) < SWIPE_DISTANCE || Math.abs(dx) < Math.abs(dy)) return;\n\n didSwipeRef.current = true;\n select(current + (dx < 0 ? 1 : -1));\n };\n\n const handleStageMove = (event: PointerEvent<HTMLElement>) => {\n if (hasZoom && event.pointerType === 'mouse')\n setZoomOrigin(event.currentTarget, event.clientX, event.clientY);\n };\n\n const openViewer = () => {\n if (didSwipeRef.current) return;\n setIsFullscreen(true);\n };\n\n const toggleZoomAt = (event: MouseEvent<HTMLElement>) => {\n if (!hasZoom || didSwipeRef.current) return;\n setZoomOrigin(event.currentTarget, event.clientX, event.clientY);\n setIsZoomed(zoomed => !zoomed);\n };\n\n const handleViewerMove = (event: PointerEvent<HTMLElement>) => {\n if (isZoomed) setZoomOrigin(event.currentTarget, event.clientX, event.clientY);\n };\n\n const imageProps = (variant: GalleryImageVariant, className: string) => ({\n src: image.src,\n alt: image.alt,\n className,\n variant,\n index: current,\n width: image.width,\n height: image.height,\n });\n\n const arrows = hasMany && (\n <>\n <IconButton\n icon={<ChevronLeft aria-hidden className={styles.arrowIcon} />}\n label={text.previous}\n variant=\"secondary\"\n size=\"sm\"\n className={cx(styles.arrow, styles['arrow--previous'])}\n onClick={() => select(current - 1)}\n />\n <IconButton\n icon={<ChevronRight aria-hidden className={styles.arrowIcon} />}\n label={text.next}\n variant=\"secondary\"\n size=\"sm\"\n className={cx(styles.arrow, styles['arrow--next'])}\n onClick={() => select(current + 1)}\n />\n </>\n );\n\n return (\n <section className={cx(styles.gallery, className)} aria-label={label} data-testid={testId}>\n <div\n className={cx(styles.stage, hasZoom && styles['stage--zoom'])}\n onPointerMove={handleStageMove}\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onKeyDown={event => handleArrowKeys(event)}\n >\n <button type=\"button\" className={styles.stage__open} onClick={openViewer}>\n {renderImage(imageProps('main', styles.image))}\n <span className={styles.srOnly}>{text.fullscreen}</span>\n <ArrowsFullscreen aria-hidden className={styles.stage__hint} />\n </button>\n {arrows}\n </div>\n\n {hasMany && (\n <ul ref={thumbsRef} className={styles.thumbs} aria-label={text.thumbnails}>\n {images.map((item, position) => (\n <li key={`${item.src}-${position}`}>\n <button\n type=\"button\"\n className={styles.thumb}\n aria-current={position === current || undefined}\n aria-label={resolveFormatter(\n 'Gallery.labels.thumbnail',\n labelProps?.thumbnail ?? config?.gallery?.thumbnail,\n position + 1,\n total,\n )}\n tabIndex={position === current ? 0 : -1}\n onClick={() => select(position)}\n onKeyDown={event => handleArrowKeys(event, true)}\n >\n {renderImage({\n src: item.thumbnailSrc ?? item.src,\n alt: '',\n className: styles.thumb__image,\n variant: 'thumbnail',\n index: position,\n width: item.width,\n height: item.height,\n })}\n </button>\n </li>\n ))}\n </ul>\n )}\n\n <dialog\n ref={dialogRef}\n className={styles.viewer}\n aria-label={label}\n onKeyDown={event => handleArrowKeys(event)}\n >\n {isFullscreen && (\n <>\n <div className={styles.viewer__bar}>\n <span className={styles.viewer__count} aria-live=\"polite\">\n {current + 1} / {total}\n </span>\n {hasZoom && (\n <IconButton\n icon={isZoomed ? <ZoomOut aria-hidden /> : <ZoomIn aria-hidden />}\n label={\n isZoomed\n ? resolveLabel(\n 'Gallery.labels.zoomOut',\n labelProps?.zoomOut,\n config?.gallery?.zoomOut,\n )\n : resolveLabel(\n 'Gallery.labels.zoomIn',\n labelProps?.zoomIn,\n config?.gallery?.zoomIn,\n )\n }\n variant=\"secondary\"\n onClick={() => setIsZoomed(zoomed => !zoomed)}\n />\n )}\n <IconButton\n icon={<XLg aria-hidden />}\n label={resolveLabel('Gallery.labels.close', labelProps?.close, config?.close)}\n variant=\"secondary\"\n onClick={close}\n />\n </div>\n <div\n className={cx(styles.viewer__stage, isZoomed && styles['viewer__stage--zoomed'])}\n onClick={toggleZoomAt}\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onPointerMove={handleViewerMove}\n >\n {renderImage(imageProps('fullscreen', styles.viewer__image))}\n </div>\n {arrows}\n </>\n )}\n </dialog>\n </section>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Gallery, 'Gallery')) as typeof Gallery;\n"],"names":["SWIPE_DISTANCE","defaultRenderImage","src","alt","className","width","height","variant","jsx","setZoomOrigin","element","clientX","clientY","rect","x","y","Gallery","images","label","renderImage","controlledIndex","onIndexChange","hasZoom","labelProps","testId","config","useUi","innerIndex","setInnerIndex","useState","isFullscreen","setIsFullscreen","isZoomed","setIsZoomed","dialogRef","useRef","thumbsRef","swipeRef","didSwipeRef","total","current","text","resolveLabel","_a","_b","_c","_d","select","useCallback","next","wrapped","close","useEffect","dialog","restoreFocus","captureFocus","token","pop","pushModal","handleCancel","event","isTopModal","useScrollLock","image","hasMany","handleArrowKeys","moveFocus","target","handlePointerDown","handlePointerUp","start","dx","dy","handleStageMove","openViewer","toggleZoomAt","zoomed","handleViewerMove","imageProps","arrows","jsxs","Fragment","IconButton","ChevronLeft","styles","cx","ChevronRight","ArrowsFullscreen","item","position","resolveFormatter","ZoomOut","ZoomIn","_e","_f","XLg","index","memo","named"],"mappings":";;;;;;;;;;;;AAyFA,MAAMA,KAAiB,IAEjBC,KAAqB,CAAC;AAAA,EAC1B,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AA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AAAA,mBACZuE,IAAArE,KAAA,gBAAAA,EAAQ,YAAR,gBAAAqE,EAAiB;AAAA,gBAAA;AAAA,gBAGzB,SAAQ;AAAA,gBACR,SAAS,MAAM7D,EAAY,CAAA2C,MAAU,CAACA,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,YAGhD,gBAAApE;AAAA,cAAC0E;AAAA,cAAA;AAAA,gBACC,MAAM,gBAAA1E,EAACuF,IAAA,EAAI,eAAW,GAAA,CAAC;AAAA,gBACvB,OAAOrD,EAAa,wBAAwBnB,KAAA,gBAAAA,EAAY,OAAOE,KAAA,gBAAAA,EAAQ,KAAK;AAAA,gBAC5E,SAAQ;AAAA,gBACR,SAAS0B;AAAA,cAAA;AAAA,YAAA;AAAA,UACX,GACF;AAAA,UACA,gBAAA3C;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW6E,EAAGD,EAAO,eAAepD,KAAYoD,EAAO,uBAAuB,CAAC;AAAA,cAC/E,SAAST;AAAA,cACT,eAAeP;AAAA,cACf,aAAaC;AAAA,cACb,eAAeQ;AAAA,cAEd,UAAA1D,EAAY2D,EAAW,cAAcM,EAAO,aAAa,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,UAE5DL;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ,GAEAiB,KAA6B,gBAAAC,GAAmB,gBAAAC,GAAMlF,IAAS,SAAS,CAAC;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-gallery-kHzW5{display:flex;flex-direction:column;gap:var(--hd-space-3);min-width:0}.ui-srOnly-yZqYR{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-stage-rg2mL{position:relative;overflow:hidden;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-surface)}.ui-stage__open-O-WpB{display:block;position:relative;width:100%;padding:0;border:none;background:none;cursor:zoom-in;aspect-ratio:var(--ui-gallery-ratio, 1)}.ui-stage__open-O-WpB:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-stage__hint-yvk-Q{position:absolute;inset-block-end:var(--hd-space-3);inset-inline-end:var(--hd-space-3);padding:var(--hd-space-1);border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-overlay);color:var(--hd-text-2);font-size:18px;box-sizing:content-box}.ui-image-eMyVt{display:block;width:100%;height:100%;object-fit:contain;transform-origin:var(--ui-gallery-zoom-x, 50%) var(--ui-gallery-zoom-y, 50%);transition:transform var(--hd-duration-fast) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-image-eMyVt{transition:none}}@media (hover: hover) and (pointer: fine){.ui-stage--zoom-gCoIw:hover .ui-image-eMyVt{transform:scale(var(--ui-gallery-zoom, 2))}}.ui-arrow-HMm6V{position:absolute;inset-block-start:50%;translate:0 -50%}.ui-arrow--previous-iynhU{inset-inline-start:var(--hd-space-2)}.ui-arrow--next-xShor{inset-inline-end:var(--hd-space-2)}[dir=rtl] .ui-arrowIcon--GW5Q{transform:scaleX(-1)}.ui-thumbs-fquXS{display:flex;gap:var(--hd-space-2);position:relative;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;padding-block:var(--hd-space-1) var(--hd-space-3);scrollbar-width:none;-ms-overflow-style:none}.ui-thumbs-fquXS::-webkit-scrollbar{display:none}.ui-thumbs-fquXS>*{scroll-snap-align:start;flex-shrink:0}.ui-thumbs-fquXS{margin:0;padding-inline:0;list-style:none}.ui-thumb-Upsix{display:block;width:var(--ui-gallery-thumb, 64px);height:var(--ui-gallery-thumb, 64px);padding:0;overflow:hidden;border:1px solid var(--hd-border);border-radius:var(--hd-radius-sm);background-color:var(--hd-bg-surface);cursor:pointer}.ui-thumb-Upsix:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}.ui-thumb-Upsix[aria-current=true]{border-color:var(--hd-primary);box-shadow:0 0 0 1px var(--hd-primary)}.ui-thumb__image-9VWiM{display:block;width:100%;height:100%;object-fit:cover}.ui-viewer-mAIN4{width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:none;background-color:var(--hd-bg-page);color:var(--hd-text);overflow:hidden;opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-viewer-mAIN4[open]{opacity:1}@starting-style{.ui-viewer-mAIN4[open]{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-viewer-mAIN4{transition:none}}.ui-viewer-mAIN4::backdrop{opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-viewer-mAIN4[open]::backdrop{opacity:1}@starting-style{.ui-viewer-mAIN4[open]::backdrop{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-viewer-mAIN4::backdrop{transition:none}}.ui-viewer-mAIN4::backdrop{background-color:var(--hd-scrim)}.ui-viewer-mAIN4[open]{display:flex;flex-direction:column}.ui-viewer-mAIN4 .ui-arrow-HMm6V{position:fixed}.ui-viewer__bar-8DJT1{display:flex;align-items:center;gap:var(--hd-space-2);padding-left:max(var(--hd-space-3),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-3),env(safe-area-inset-right,0px));justify-content:flex-end;padding-block:var(--hd-space-3);flex-shrink:0}.ui-viewer__count--vw9Q{margin-inline-end:auto;font-size:var(--hd-type-small-size);color:var(--hd-text-2);font-variant-numeric:tabular-nums}.ui-viewer__stage-YmCnh{flex:1;min-height:0;position:relative;overflow:hidden;cursor:zoom-in;touch-action:pan-y}.ui-viewer__stage--zoomed-ktQdi{cursor:zoom-out;touch-action:none}.ui-viewer__stage--zoomed-ktQdi .ui-viewer__image-hHATa{transform:scale(var(--ui-gallery-zoom, 2))}.ui-viewer__image-hHATa{display:block;width:100%;height:100%;object-fit:contain;-webkit-user-select:none;user-select:none;transform-origin:var(--ui-gallery-zoom-x, 50%) var(--ui-gallery-zoom-y, 50%);transition:transform var(--hd-duration-fast) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-viewer__image-hHATa{transition:none}}}
@@ -1 +1 @@
1
- @layer ui{.ui-modal-3IDi9{border:none;padding:0;background:none;color:var(--hd-text);max-width:min(92vw,560px);width:100%;max-height:90dvh}.ui-modal--sm-A7WsS{max-width:min(92vw,440px)}.ui-modal--lg-z99Em{max-width:min(92vw,880px)}.ui-modal--xl-g3d6F{max-width:min(94vw,1040px)}.ui-modal-3IDi9{opacity:0;translate:0 6px;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-modal-3IDi9[open]{opacity:1;translate:0 0}@starting-style{.ui-modal-3IDi9[open]{opacity:0;translate:0 6px}}@media (prefers-reduced-motion: reduce){.ui-modal-3IDi9{transition:none}}.ui-modal-3IDi9::backdrop{opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-modal-3IDi9[open]::backdrop{opacity:1}@starting-style{.ui-modal-3IDi9[open]::backdrop{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-modal-3IDi9::backdrop{transition:none}}.ui-modal-3IDi9:focus-visible{outline:none}.ui-modal-3IDi9:focus-visible .ui-modal__panel--qLSz{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-modal-3IDi9::backdrop{background-color:var(--hd-scrim);-webkit-backdrop-filter:blur(var(--ui-scrim-blur, 3px));backdrop-filter:blur(var(--ui-scrim-blur, 3px))}@media (max-width: 640px){.ui-modal-3IDi9,.ui-modal--sm-A7WsS,.ui-modal--lg-z99Em,.ui-modal--xl-g3d6F{max-width:none;width:100%;max-height:calc(92dvh - env(safe-area-inset-top,0px));margin:auto 0 0;margin-bottom:max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px))}.ui-modal-3IDi9:not([open]),.ui-modal-3IDi9[open]{opacity:0;translate:0 100%;transition:opacity var(--hd-duration-base) var(--hd-ease-standard),translate var(--hd-duration-base) var(--hd-ease-standard),overlay var(--hd-duration-base) allow-discrete,display var(--hd-duration-base) allow-discrete}.ui-modal-3IDi9:not([open])[open],.ui-modal-3IDi9[open][open]{opacity:1;translate:0 0}@starting-style{.ui-modal-3IDi9:not([open])[open],.ui-modal-3IDi9[open][open]{opacity:0;translate:0 100%}}}@media (max-width: 640px) and (prefers-reduced-motion: reduce){.ui-modal-3IDi9:not([open]),.ui-modal-3IDi9[open]{transition:none}}.ui-modal__panel--qLSz{display:flex;flex-direction:column;max-height:90dvh;background-color:var(--hd-bg-overlay);border:1px solid var(--hd-border);border-radius:var(--hd-radius-lg);box-shadow:var(--hd-shadow-3);overflow:hidden}@media (max-width: 640px){.ui-modal__panel--qLSz{max-height:92dvh;border-radius:var(--hd-radius-lg) var(--hd-radius-lg) 0 0;border-bottom:none}}.ui-modal__header-meWm6{display:flex;align-items:flex-start;gap:var(--hd-space-3);padding:var(--hd-space-4) var(--hd-space-5);border-bottom:1px solid var(--hd-border);flex-shrink:0}@media (max-width: 640px){.ui-modal__header-meWm6{padding:var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px))}}.ui-modal__icon-df2dd{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;flex-shrink:0;border-radius:var(--hd-radius-sm);font-size:24px}.ui-modal__icon--neutral-QSL7c{background-color:var(--hd-bg-raised);border:1px solid var(--hd-border);color:var(--hd-text-2)}.ui-modal__icon--danger-6V90a{background-color:var(--hd-danger-bg);border:1px solid var(--hd-danger-line);color:var(--hd-danger-fg)}.ui-modal__icon--warning-a--FX{background-color:var(--hd-warning-bg);border:1px solid var(--hd-warning-line);color:var(--hd-warning-fg)}.ui-modal__icon--success-YWxZs{background-color:var(--hd-success-bg);border:1px solid var(--hd-success-line);color:var(--hd-success-fg)}.ui-modal__icon--info-WRLah{background-color:var(--hd-info-bg);border:1px solid var(--hd-info-line);color:var(--hd-info-fg)}.ui-modal__heading-PwDS8{display:flex;flex-direction:column;gap:var(--hd-space-1);flex:1;min-width:0;padding-top:2px}.ui-modal__title-80Sh6{font-family:var(--hd-font-display);font-size:var(--hd-type-h4-size);font-weight:var(--hd-type-h4-weight);font-stretch:var(--hd-type-h4-stretch);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--hd-type-h4-letter-spacing);color:var(--hd-text);margin:0;text-wrap:balance}.ui-modal__description-fsCHI{font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2);margin:0;max-width:68ch}.ui-modal__close-vFPbw{flex-shrink:0;margin-top:-2px}.ui-modal__body-PDF12{padding:var(--hd-space-5);position:relative;overflow-y:auto;flex:1;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-modal__body-PDF12::-webkit-scrollbar{width:8px;height:8px}.ui-modal__body-PDF12::-webkit-scrollbar-track{background:transparent}.ui-modal__body-PDF12::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-modal__body-PDF12::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}@media (max-width: 640px){.ui-modal__body-PDF12{padding:var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px))}.ui-modal__body-PDF12:last-child{padding-bottom:max(var(--hd-space-4),env(safe-area-inset-bottom,0px) - max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px)))}}.ui-modal__footer-CCCkx{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);justify-content:flex-end;padding:var(--hd-space-4) var(--hd-space-5);border-top:1px solid var(--hd-border);background-color:var(--hd-bg-raised);flex-shrink:0}@media (max-width: 640px){.ui-modal__footer-CCCkx{padding:var(--hd-space-3) var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px));padding-bottom:max(var(--hd-space-3),env(safe-area-inset-bottom,0px) - max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px)));flex-direction:column-reverse}.ui-modal__footer-CCCkx>*{width:100%}}}
1
+ @layer ui{.ui-modal-3IDi9{border:none;padding:0;background:none;color:var(--hd-text);max-width:min(92vw,560px);width:100%;max-height:90dvh}.ui-modal--sm-A7WsS{max-width:min(92vw,440px)}.ui-modal--lg-z99Em{max-width:min(92vw,880px)}.ui-modal--xl-g3d6F{max-width:min(94vw,1040px)}.ui-modal-3IDi9{opacity:0;translate:0 6px;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-modal-3IDi9[open]{opacity:1;translate:0 0}@starting-style{.ui-modal-3IDi9[open]{opacity:0;translate:0 6px}}@media (prefers-reduced-motion: reduce){.ui-modal-3IDi9{transition:none}}.ui-modal-3IDi9::backdrop{opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-modal-3IDi9[open]::backdrop{opacity:1}@starting-style{.ui-modal-3IDi9[open]::backdrop{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-modal-3IDi9::backdrop{transition:none}}.ui-modal-3IDi9:focus-visible{outline:none}.ui-modal-3IDi9:focus-visible .ui-modal__panel--qLSz{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-modal-3IDi9::backdrop{background-color:var(--hd-scrim);-webkit-backdrop-filter:blur(var(--ui-scrim-blur, 3px));backdrop-filter:blur(var(--ui-scrim-blur, 3px))}@media (max-width: 640px){.ui-modal-3IDi9,.ui-modal--sm-A7WsS,.ui-modal--lg-z99Em,.ui-modal--xl-g3d6F{max-width:none;width:100%;max-height:calc(92dvh - env(safe-area-inset-top,0px));margin:auto 0 0;margin-bottom:max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px))}.ui-modal-3IDi9:not([open]),.ui-modal-3IDi9[open]{opacity:0;translate:0 100%;transition:opacity var(--hd-duration-base) var(--hd-ease-standard),translate var(--hd-duration-base) var(--hd-ease-standard),overlay var(--hd-duration-base) allow-discrete,display var(--hd-duration-base) allow-discrete}.ui-modal-3IDi9:not([open])[open],.ui-modal-3IDi9[open][open]{opacity:1;translate:0 0}@starting-style{.ui-modal-3IDi9:not([open])[open],.ui-modal-3IDi9[open][open]{opacity:0;translate:0 100%}}}@media (max-width: 640px) and (prefers-reduced-motion: reduce){.ui-modal-3IDi9:not([open]),.ui-modal-3IDi9[open]{transition:none}}.ui-modal__panel--qLSz{display:flex;flex-direction:column;max-height:90dvh;background-color:var(--hd-bg-overlay);border:1px solid var(--hd-border);border-radius:var(--hd-radius-lg);box-shadow:var(--hd-shadow-3);overflow:hidden}@media (max-width: 640px){.ui-modal__panel--qLSz{max-height:92dvh;border-radius:var(--hd-radius-lg) var(--hd-radius-lg) 0 0;border-bottom:none}}.ui-modal__header-meWm6{display:flex;align-items:flex-start;gap:var(--hd-space-3);padding:var(--hd-space-4) var(--hd-space-5);border-bottom:1px solid var(--hd-border);flex-shrink:0}@media (max-width: 640px){.ui-modal__header-meWm6{padding:var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px))}}.ui-modal__icon-df2dd{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;flex-shrink:0;border-radius:var(--hd-radius-sm);font-size:24px}.ui-modal__icon--neutral-QSL7c{background-color:var(--hd-bg-raised);border:1px solid var(--hd-border);color:var(--hd-text-2)}.ui-modal__icon--danger-6V90a{background-color:var(--hd-danger-bg);border:1px solid var(--hd-danger-line);color:var(--hd-danger-fg)}.ui-modal__icon--warning-a--FX{background-color:var(--hd-bg-raised);border:1px solid var(--hd-border-strong);color:var(--hd-text)}.ui-modal__icon--success-YWxZs,.ui-modal__icon--info-WRLah{background-color:var(--hd-info-bg);border:1px solid var(--hd-info-line);color:var(--hd-info-fg)}.ui-modal__heading-PwDS8{display:flex;flex-direction:column;gap:var(--hd-space-1);flex:1;min-width:0;padding-top:2px}.ui-modal__title-80Sh6{font-family:var(--hd-font-display);font-size:var(--hd-type-h4-size);font-weight:var(--hd-type-h4-weight);font-stretch:var(--hd-type-h4-stretch);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--hd-type-h4-letter-spacing);color:var(--hd-text);margin:0;text-wrap:balance}.ui-modal__description-fsCHI{font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2);margin:0;max-width:68ch}.ui-modal__close-vFPbw{flex-shrink:0;margin-top:-2px}.ui-modal__body-PDF12{padding:var(--hd-space-5);position:relative;overflow-y:auto;flex:1;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-modal__body-PDF12::-webkit-scrollbar{width:8px;height:8px}.ui-modal__body-PDF12::-webkit-scrollbar-track{background:transparent}.ui-modal__body-PDF12::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-modal__body-PDF12::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}@media (max-width: 640px){.ui-modal__body-PDF12{padding:var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px))}.ui-modal__body-PDF12:last-child{padding-bottom:max(var(--hd-space-4),env(safe-area-inset-bottom,0px) - max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px)))}}.ui-modal__footer-CCCkx{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);justify-content:flex-end;padding:var(--hd-space-4) var(--hd-space-5);border-top:1px solid var(--hd-border);background-color:var(--hd-bg-raised);flex-shrink:0}@media (max-width: 640px){.ui-modal__footer-CCCkx{padding:var(--hd-space-3) var(--hd-space-4);padding-left:max(var(--hd-space-4),env(safe-area-inset-left,0px));padding-right:max(var(--hd-space-4),env(safe-area-inset-right,0px));padding-bottom:max(var(--hd-space-3),env(safe-area-inset-bottom,0px) - max(env(safe-area-inset-bottom,0px),var(--ui-sheet-inset-bottom, 0px)));flex-direction:column-reverse}.ui-modal__footer-CCCkx>*{width:100%}}}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),k=require("react"),N=require("react-bootstrap-icons"),S=require("../../enums/ui-size.enum.cjs"),B=require("../../enums/ui-variant.enum.cjs"),j=require("../../helpers/class-name.helper.cjs"),D=require("../../helpers/component.helper.cjs"),d=require("../../helpers/label.helper.cjs"),M=require("../../theme/context.cjs"),A=require("../Button/index.cjs"),C=require("../IconButton/index.cjs"),O=require("../Popover/index.cjs"),a={default:{"panel":"ui-panel-5SyKG","srOnly":"ui-srOnly-RIBgB","bell":"ui-bell-eoWEW","badge":"ui-badge-f-M5o","header":"ui-header-XVQsI","heading":"ui-heading-coSaJ","list":"ui-list-qhaa9","day":"ui-day-q8cob","items":"ui-items-Cy4JF","item":"ui-item-Gx5xM","item__main":"ui-item__main-YzJ2w","item__main--button":"ui-item__main--button-0gQh7","item--unread":"ui-item--unread-LYQ9H","title":"ui-title-vMVcE","icon":"ui-icon-xOfOg","body":"ui-body-xDRoI","description":"ui-description-SuXFu","time":"ui-time-k0R6i","empty":"ui-empty-WTfI4","empty__icon":"ui-empty__icon-03css"}},q=99,h=n=>`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`,z=n=>{const o=new Map,x=n.map(s=>({item:s,date:new Date(s.date)})).sort((s,c)=>c.date.getTime()-s.date.getTime());for(const s of x){const c=h(s.date),f=o.get(c)??{key:c,date:s.date,items:[]};f.items.push(s),o.set(c,f)}return[...o.values()]},T=({items:n,onItemSelect:o,onMarkRead:x,onMarkAllRead:s,isOpen:c,onOpenChange:f,formatDay:b,formatTime:p,labels:L,className:$,testId:F})=>{const{labels:u}=M.useUi(),R=k.useId(),m=n.filter(t=>!t.isRead).length,r={...u==null?void 0:u.notificationCenter,...L},g=d.resolveLabel("NotificationCenter.labels.title",r.title),y=u==null?void 0:u.locale,w=t=>{const l=new Date,i=new Date(l.getFullYear(),l.getMonth(),l.getDate()-1);return h(t)===h(l)?d.resolveLabel("NotificationCenter.labels.today",r.today):h(t)===h(i)?d.resolveLabel("NotificationCenter.labels.yesterday",r.yesterday):(b==null?void 0:b(t))??new Intl.DateTimeFormat(y,{day:"numeric",month:"long",year:"numeric"}).format(t)},I=t=>(p==null?void 0:p(t))??new Intl.DateTimeFormat(y,{hour:"2-digit",minute:"2-digit"}).format(t),_=(t,l)=>e.jsxs(e.Fragment,{children:[t.icon&&e.jsx("span",{"aria-hidden":!0,className:a.default.icon,children:t.icon}),e.jsxs("span",{className:a.default.body,children:[e.jsxs("span",{className:a.default.title,children:[!t.isRead&&e.jsxs("span",{className:a.default.srOnly,children:[d.resolveLabel("NotificationCenter.labels.unread",r.unread),":"," "]}),t.title]}),t.description&&e.jsx("span",{className:a.default.description,children:t.description}),e.jsx("time",{className:a.default.time,dateTime:l.toISOString(),children:I(l)})]})]});return e.jsxs(O.default,{label:g,align:"end",isOpen:c,onOpenChange:f,className:j.cx(a.default.panel,$),testId:F,trigger:e.jsx(C.default,{icon:e.jsxs("span",{className:a.default.bell,children:[e.jsx(N.BellFill,{"aria-hidden":!0}),m>0&&e.jsx("span",{"aria-hidden":!0,className:a.default.badge,children:m>q?`${q}+`:m})]}),label:d.resolveFormatter("NotificationCenter.labels.trigger",r.trigger,m)}),children:[e.jsxs("div",{className:a.default.header,children:[e.jsx("p",{className:a.default.heading,children:g}),m>0&&s&&e.jsx(A.default,{variant:B.default.GHOST,size:S.default.SMALL,onClick:s,children:d.resolveLabel("NotificationCenter.labels.markAllRead",r.markAllRead)})]}),n.length===0?e.jsxs("p",{className:a.default.empty,children:[e.jsx(N.BellFill,{"aria-hidden":!0,className:a.default.empty__icon}),d.resolveLabel("NotificationCenter.labels.empty",r.empty)]}):e.jsx("div",{className:a.default.list,children:z(n).map(t=>{const l=`${R}-${t.key}`;return e.jsxs("div",{role:"group","aria-labelledby":l,children:[e.jsx("p",{id:l,className:a.default.day,children:w(t.date)}),e.jsx("ul",{className:a.default.items,children:t.items.map(({item:i,date:v})=>e.jsxs("li",{className:j.cx(a.default.item,!i.isRead&&a.default["item--unread"]),children:[o?e.jsx("button",{type:"button",className:j.cx(a.default.item__main,a.default["item__main--button"]),onClick:()=>o(i),children:_(i,v)}):e.jsx("div",{className:a.default.item__main,children:_(i,v)}),!i.isRead&&x&&e.jsx(C.default,{icon:e.jsx(N.Check2,{"aria-hidden":!0}),label:d.resolveLabel("NotificationCenter.labels.markRead",r.markRead),size:"sm",onClick:()=>x(i)})]},i.id))})]},t.key)})})]})},G=k.memo(D.named(T,"NotificationCenter"));exports.default=G;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/NotificationCenter/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, type ReactNode, useId } from 'react';\n\nimport { BellFill, Check2 } from 'react-bootstrap-icons';\n\nimport UISize from '../../enums/ui-size.enum';\nimport UIVariant from '../../enums/ui-variant.enum';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport type { Formatter } from '../../types/theme.type';\nimport Button from '../Button';\nimport IconButton from '../IconButton';\nimport Popover from '../Popover';\n\nimport styles from './index.module.scss';\n\nexport type NotificationItem = {\n id: string;\n title: string;\n description?: ReactNode;\n /** When it happened: a `Date`, an ISO string or epoch milliseconds. */\n date: Date | string | number;\n isRead?: boolean;\n /** A leading icon (the kind of notification). */\n icon?: ReactNode;\n};\n\nexport type NotificationCenterLabels = {\n trigger: Formatter<[unread: number]>;\n title: string;\n markAllRead: string;\n markRead: string;\n empty: string;\n unread: string;\n today: string;\n yesterday: string;\n};\n\ntype Props = {\n items: NotificationItem[];\n /** A notification was opened. Without it the rows are plain text. */\n onItemSelect?: (item: NotificationItem) => void;\n /** Shows a \"mark read\" button on each unread notification. */\n onMarkRead?: (item: NotificationItem) => void;\n /** Shows \"mark all read\" while something is unread. */\n onMarkAllRead?: () => void;\n /** Controlled panel; uncontrolled when omitted. */\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n /** Heading of a day older than yesterday; the day and month in `labels.locale` by default. */\n formatDay?: (date: Date) => string;\n /** Time of one notification; hours and minutes in `labels.locale` by default. */\n formatTime?: (date: Date) => string;\n labels?: Partial<NotificationCenterLabels>;\n className?: string;\n testId?: string;\n};\n\n/* Above this the badge reads \"99+\": a wider badge would cover the bell. */\nconst BADGE_MAX = 99;\n\nconst dayKey = (date: Date): string => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n\ntype DayGroup = { key: string; date: Date; items: { item: NotificationItem; date: Date }[] };\n\n/** Newest first, one group per local calendar day. */\nconst groupByDay = (items: NotificationItem[]): DayGroup[] => {\n const groups = new Map<string, DayGroup>();\n const dated = items\n .map(item => ({ item, date: new Date(item.date) }))\n .sort((a, b) => b.date.getTime() - a.date.getTime());\n\n for (const entry of dated) {\n const key = dayKey(entry.date);\n const group = groups.get(key) ?? { key, date: entry.date, items: [] };\n group.items.push(entry);\n groups.set(key, group);\n }\n\n return [...groups.values()];\n};\n\n/** Bell with an unread badge and a panel of notifications grouped by day (3.1). Presentational. */\nconst NotificationCenter = ({\n items,\n onItemSelect,\n onMarkRead,\n onMarkAllRead,\n isOpen,\n onOpenChange,\n formatDay,\n formatTime,\n labels: labelProps,\n className,\n testId,\n}: Props) => {\n const { labels: config } = useUi();\n const baseId = useId();\n const unread = items.filter(item => !item.isRead).length;\n const text = { ...config?.notificationCenter, ...labelProps };\n\n const title = resolveLabel('NotificationCenter.labels.title', text.title);\n const locale = config?.locale;\n\n const dayHeading = (date: Date): string => {\n const today = new Date();\n const yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);\n if (dayKey(date) === dayKey(today))\n return resolveLabel('NotificationCenter.labels.today', text.today);\n if (dayKey(date) === dayKey(yesterday))\n return resolveLabel('NotificationCenter.labels.yesterday', text.yesterday);\n\n return (\n formatDay?.(date) ??\n new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' }).format(\n date,\n )\n );\n };\n\n const time = (date: Date): string =>\n formatTime?.(date) ??\n new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date);\n\n const renderContent = (item: NotificationItem, date: Date) => (\n <>\n {item.icon && (\n <span aria-hidden className={styles.icon}>\n {item.icon}\n </span>\n )}\n <span className={styles.body}>\n <span className={styles.title}>\n {!item.isRead && (\n <span className={styles.srOnly}>\n {resolveLabel('NotificationCenter.labels.unread', text.unread)}:{' '}\n </span>\n )}\n {item.title}\n </span>\n {item.description && <span className={styles.description}>{item.description}</span>}\n <time className={styles.time} dateTime={date.toISOString()}>\n {time(date)}\n </time>\n </span>\n </>\n );\n\n return (\n <Popover\n label={title}\n align=\"end\"\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n className={cx(styles.panel, className)}\n testId={testId}\n trigger={\n <IconButton\n icon={\n <span className={styles.bell}>\n <BellFill aria-hidden />\n {unread > 0 && (\n <span aria-hidden className={styles.badge}>\n {unread > BADGE_MAX ? `${BADGE_MAX}+` : unread}\n </span>\n )}\n </span>\n }\n label={resolveFormatter('NotificationCenter.labels.trigger', text.trigger, unread)}\n />\n }\n >\n <div className={styles.header}>\n <p className={styles.heading}>{title}</p>\n {unread > 0 && onMarkAllRead && (\n <Button variant={UIVariant.GHOST} size={UISize.SMALL} onClick={onMarkAllRead}>\n {resolveLabel('NotificationCenter.labels.markAllRead', text.markAllRead)}\n </Button>\n )}\n </div>\n\n {items.length === 0 ? (\n <p className={styles.empty}>\n <BellFill aria-hidden className={styles.empty__icon} />\n {resolveLabel('NotificationCenter.labels.empty', text.empty)}\n </p>\n ) : (\n <div className={styles.list}>\n {groupByDay(items).map(group => {\n const headingId = `${baseId}-${group.key}`;\n\n return (\n <div key={group.key} role=\"group\" aria-labelledby={headingId}>\n <p id={headingId} className={styles.day}>\n {dayHeading(group.date)}\n </p>\n <ul className={styles.items}>\n {group.items.map(({ item, date }) => (\n <li\n key={item.id}\n className={cx(styles.item, !item.isRead && styles['item--unread'])}\n >\n {onItemSelect ? (\n <button\n type=\"button\"\n className={cx(styles.item__main, styles['item__main--button'])}\n onClick={() => onItemSelect(item)}\n >\n {renderContent(item, date)}\n </button>\n ) : (\n <div className={styles.item__main}>{renderContent(item, date)}</div>\n )}\n {!item.isRead && onMarkRead && (\n <IconButton\n icon={<Check2 aria-hidden />}\n label={resolveLabel('NotificationCenter.labels.markRead', text.markRead)}\n size=\"sm\"\n onClick={() => onMarkRead(item)}\n />\n )}\n </li>\n ))}\n </ul>\n </div>\n );\n })}\n </div>\n )}\n </Popover>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(NotificationCenter, 'NotificationCenter'),\n) as typeof NotificationCenter;\n"],"names":["BADGE_MAX","dayKey","date","groupByDay","items","groups","dated","item","a","b","entry","key","group","NotificationCenter","onItemSelect","onMarkRead","onMarkAllRead","isOpen","onOpenChange","formatDay","formatTime","labelProps","className","testId","config","useUi","baseId","useId","unread","text","title","resolveLabel","locale","dayHeading","today","yesterday","time","renderContent","jsxs","Fragment","styles","jsx","Popover","cx","IconButton","BellFill","resolveFormatter","Button","UIVariant","UISize","headingId","Check2","index","memo","named"],"mappings":"0mBA6DMA,EAAY,GAEZC,EAAUC,GAAuB,GAAGA,EAAK,YAAA,CAAa,IAAIA,EAAK,SAAA,CAAU,IAAIA,EAAK,SAAS,GAK3FC,EAAcC,GAA0C,CAC5D,MAAMC,MAAa,IACbC,EAAQF,EACX,IAAIG,IAAS,CAAE,KAAAA,EAAM,KAAM,IAAI,KAAKA,EAAK,IAAI,CAAA,EAAI,EACjD,KAAK,CAACC,EAAGC,IAAMA,EAAE,KAAK,UAAYD,EAAE,KAAK,QAAA,CAAS,EAErD,UAAWE,KAASJ,EAAO,CACzB,MAAMK,EAAMV,EAAOS,EAAM,IAAI,EACvBE,EAAQP,EAAO,IAAIM,CAAG,GAAK,CAAE,IAAAA,EAAK,KAAMD,EAAM,KAAM,MAAO,CAAA,CAAC,EAClEE,EAAM,MAAM,KAAKF,CAAK,EACtBL,EAAO,IAAIM,EAAKC,CAAK,CACvB,CAEA,MAAO,CAAC,GAAGP,EAAO,QAAQ,CAC5B,EAGMQ,EAAqB,CAAC,CAC1B,MAAAT,EACA,aAAAU,EACA,WAAAC,EACA,cAAAC,EACA,OAAAC,EACA,aAAAC,EACA,UAAAC,EACA,WAAAC,EACA,OAAQC,EACR,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,KAAM,CAAE,OAAQC,CAAA,EAAWC,QAAA,EACrBC,EAASC,EAAAA,MAAA,EACTC,EAASxB,EAAM,UAAe,CAACG,EAAK,MAAM,EAAE,OAC5CsB,EAAO,CAAE,GAAGL,GAAA,YAAAA,EAAQ,mBAAoB,GAAGH,CAAA,EAE3CS,EAAQC,EAAAA,aAAa,kCAAmCF,EAAK,KAAK,EAClEG,EAASR,GAAA,YAAAA,EAAQ,OAEjBS,EAAc/B,GAAuB,CACzC,MAAMgC,MAAY,K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id: string;
5
+ title: string;
6
+ description?: ReactNode;
7
+ /** When it happened: a `Date`, an ISO string or epoch milliseconds. */
8
+ date: Date | string | number;
9
+ isRead?: boolean;
10
+ /** A leading icon (the kind of notification). */
11
+ icon?: ReactNode;
12
+ };
13
+ export type NotificationCenterLabels = {
14
+ trigger: Formatter<[unread: number]>;
15
+ title: string;
16
+ markAllRead: string;
17
+ markRead: string;
18
+ empty: string;
19
+ unread: string;
20
+ today: string;
21
+ yesterday: string;
22
+ };
23
+ type Props = {
24
+ items: NotificationItem[];
25
+ /** A notification was opened. Without it the rows are plain text. */
26
+ onItemSelect?: (item: NotificationItem) => void;
27
+ /** Shows a "mark read" button on each unread notification. */
28
+ onMarkRead?: (item: NotificationItem) => void;
29
+ /** Shows "mark all read" while something is unread. */
30
+ onMarkAllRead?: () => void;
31
+ /** Controlled panel; uncontrolled when omitted. */
32
+ isOpen?: boolean;
33
+ onOpenChange?: (isOpen: boolean) => void;
34
+ /** Heading of a day older than yesterday; the day and month in `labels.locale` by default. */
35
+ formatDay?: (date: Date) => string;
36
+ /** Time of one notification; hours and minutes in `labels.locale` by default. */
37
+ formatTime?: (date: Date) => string;
38
+ labels?: Partial<NotificationCenterLabels>;
39
+ className?: string;
40
+ testId?: string;
41
+ };
42
+ /** Bell with an unread badge and a panel of notifications grouped by day (3.1). Presentational. */
43
+ declare const NotificationCenter: ({ items, onItemSelect, onMarkRead, onMarkAllRead, isOpen, onOpenChange, formatDay, formatTime, labels: labelProps, className, testId, }: Props) => import("react").JSX.Element;
44
+ declare const _default: typeof NotificationCenter;
45
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import { ReactNode } from 'react';
2
+ import { Formatter } from '../../types/theme.type.js';
3
+ export type NotificationItem = {
4
+ id: string;
5
+ title: string;
6
+ description?: ReactNode;
7
+ /** When it happened: a `Date`, an ISO string or epoch milliseconds. */
8
+ date: Date | string | number;
9
+ isRead?: boolean;
10
+ /** A leading icon (the kind of notification). */
11
+ icon?: ReactNode;
12
+ };
13
+ export type NotificationCenterLabels = {
14
+ trigger: Formatter<[unread: number]>;
15
+ title: string;
16
+ markAllRead: string;
17
+ markRead: string;
18
+ empty: string;
19
+ unread: string;
20
+ today: string;
21
+ yesterday: string;
22
+ };
23
+ type Props = {
24
+ items: NotificationItem[];
25
+ /** A notification was opened. Without it the rows are plain text. */
26
+ onItemSelect?: (item: NotificationItem) => void;
27
+ /** Shows a "mark read" button on each unread notification. */
28
+ onMarkRead?: (item: NotificationItem) => void;
29
+ /** Shows "mark all read" while something is unread. */
30
+ onMarkAllRead?: () => void;
31
+ /** Controlled panel; uncontrolled when omitted. */
32
+ isOpen?: boolean;
33
+ onOpenChange?: (isOpen: boolean) => void;
34
+ /** Heading of a day older than yesterday; the day and month in `labels.locale` by default. */
35
+ formatDay?: (date: Date) => string;
36
+ /** Time of one notification; hours and minutes in `labels.locale` by default. */
37
+ formatTime?: (date: Date) => string;
38
+ labels?: Partial<NotificationCenterLabels>;
39
+ className?: string;
40
+ testId?: string;
41
+ };
42
+ /** Bell with an unread badge and a panel of notifications grouped by day (3.1). Presentational. */
43
+ declare const NotificationCenter: ({ items, onItemSelect, onMarkRead, onMarkAllRead, isOpen, onOpenChange, formatDay, formatTime, labels: labelProps, className, testId, }: Props) => import("react").JSX.Element;
44
+ declare const _default: typeof NotificationCenter;
45
+ export default _default;
@@ -0,0 +1,124 @@
1
+ "use client";
2
+ import { jsxs as r, jsx as n, Fragment as S } from "react/jsx-runtime";
3
+ import { memo as z, useId as L } from "react";
4
+ import { BellFill as I, Check2 as M } from "react-bootstrap-icons";
5
+ import O from "../../enums/ui-size.enum.js";
6
+ import U from "../../enums/ui-variant.enum.js";
7
+ import { cx as f } from "../../helpers/class-name.helper.js";
8
+ import { named as j } from "../../helpers/component.helper.js";
9
+ import { resolveLabel as d, resolveFormatter as G } from "../../helpers/label.helper.js";
10
+ import { useUi as H } from "../../theme/context.js";
11
+ import T from "../Button/index.js";
12
+ import F from "../IconButton/index.js";
13
+ import Y from "../Popover/index.js";
14
+ const t = {"panel":"ui-panel-5SyKG","srOnly":"ui-srOnly-RIBgB","bell":"ui-bell-eoWEW","badge":"ui-badge-f-M5o","header":"ui-header-XVQsI","heading":"ui-heading-coSaJ","list":"ui-list-qhaa9","day":"ui-day-q8cob","items":"ui-items-Cy4JF","item":"ui-item-Gx5xM","item__main":"ui-item__main-YzJ2w","item__main--button":"ui-item__main--button-0gQh7","item--unread":"ui-item--unread-LYQ9H","title":"ui-title-vMVcE","icon":"ui-icon-xOfOg","body":"ui-body-xDRoI","description":"ui-description-SuXFu","time":"ui-time-k0R6i","empty":"ui-empty-WTfI4","empty__icon":"ui-empty__icon-03css"};
15
+ const w = 99, u = (l) => `${l.getFullYear()}-${l.getMonth()}-${l.getDate()}`, E = (l) => {
16
+ const m = /* @__PURE__ */ new Map(), N = l.map((a) => ({ item: a, date: new Date(a.date) })).sort((a, c) => c.date.getTime() - a.date.getTime());
17
+ for (const a of N) {
18
+ const c = u(a.date), y = m.get(c) ?? { key: c, date: a.date, items: [] };
19
+ y.items.push(a), m.set(c, y);
20
+ }
21
+ return [...m.values()];
22
+ }, K = ({
23
+ items: l,
24
+ onItemSelect: m,
25
+ onMarkRead: N,
26
+ onMarkAllRead: a,
27
+ isOpen: c,
28
+ onOpenChange: y,
29
+ formatDay: g,
30
+ formatTime: b,
31
+ labels: x,
32
+ className: R,
33
+ testId: $
34
+ }) => {
35
+ const { labels: p } = H(), B = L(), h = l.filter((e) => !e.isRead).length, o = { ...p == null ? void 0 : p.notificationCenter, ...x }, C = d("NotificationCenter.labels.title", o.title), k = p == null ? void 0 : p.locale, D = (e) => {
36
+ const i = /* @__PURE__ */ new Date(), s = new Date(i.getFullYear(), i.getMonth(), i.getDate() - 1);
37
+ return u(e) === u(i) ? d("NotificationCenter.labels.today", o.today) : u(e) === u(s) ? d("NotificationCenter.labels.yesterday", o.yesterday) : (g == null ? void 0 : g(e)) ?? new Intl.DateTimeFormat(k, { day: "numeric", month: "long", year: "numeric" }).format(
38
+ e
39
+ );
40
+ }, A = (e) => (b == null ? void 0 : b(e)) ?? new Intl.DateTimeFormat(k, { hour: "2-digit", minute: "2-digit" }).format(e), v = (e, i) => /* @__PURE__ */ r(S, { children: [
41
+ e.icon && /* @__PURE__ */ n("span", { "aria-hidden": !0, className: t.icon, children: e.icon }),
42
+ /* @__PURE__ */ r("span", { className: t.body, children: [
43
+ /* @__PURE__ */ r("span", { className: t.title, children: [
44
+ !e.isRead && /* @__PURE__ */ r("span", { className: t.srOnly, children: [
45
+ d("NotificationCenter.labels.unread", o.unread),
46
+ ":",
47
+ " "
48
+ ] }),
49
+ e.title
50
+ ] }),
51
+ e.description && /* @__PURE__ */ n("span", { className: t.description, children: e.description }),
52
+ /* @__PURE__ */ n("time", { className: t.time, dateTime: i.toISOString(), children: A(i) })
53
+ ] })
54
+ ] });
55
+ return /* @__PURE__ */ r(
56
+ Y,
57
+ {
58
+ label: C,
59
+ align: "end",
60
+ isOpen: c,
61
+ onOpenChange: y,
62
+ className: f(t.panel, R),
63
+ testId: $,
64
+ trigger: /* @__PURE__ */ n(
65
+ F,
66
+ {
67
+ icon: /* @__PURE__ */ r("span", { className: t.bell, children: [
68
+ /* @__PURE__ */ n(I, { "aria-hidden": !0 }),
69
+ h > 0 && /* @__PURE__ */ n("span", { "aria-hidden": !0, className: t.badge, children: h > w ? `${w}+` : h })
70
+ ] }),
71
+ label: G("NotificationCenter.labels.trigger", o.trigger, h)
72
+ }
73
+ ),
74
+ children: [
75
+ /* @__PURE__ */ r("div", { className: t.header, children: [
76
+ /* @__PURE__ */ n("p", { className: t.heading, children: C }),
77
+ h > 0 && a && /* @__PURE__ */ n(T, { variant: U.GHOST, size: O.SMALL, onClick: a, children: d("NotificationCenter.labels.markAllRead", o.markAllRead) })
78
+ ] }),
79
+ l.length === 0 ? /* @__PURE__ */ r("p", { className: t.empty, children: [
80
+ /* @__PURE__ */ n(I, { "aria-hidden": !0, className: t.empty__icon }),
81
+ d("NotificationCenter.labels.empty", o.empty)
82
+ ] }) : /* @__PURE__ */ n("div", { className: t.list, children: E(l).map((e) => {
83
+ const i = `${B}-${e.key}`;
84
+ return /* @__PURE__ */ r("div", { role: "group", "aria-labelledby": i, children: [
85
+ /* @__PURE__ */ n("p", { id: i, className: t.day, children: D(e.date) }),
86
+ /* @__PURE__ */ n("ul", { className: t.items, children: e.items.map(({ item: s, date: _ }) => /* @__PURE__ */ r(
87
+ "li",
88
+ {
89
+ className: f(t.item, !s.isRead && t["item--unread"]),
90
+ children: [
91
+ m ? /* @__PURE__ */ n(
92
+ "button",
93
+ {
94
+ type: "button",
95
+ className: f(t.item__main, t["item__main--button"]),
96
+ onClick: () => m(s),
97
+ children: v(s, _)
98
+ }
99
+ ) : /* @__PURE__ */ n("div", { className: t.item__main, children: v(s, _) }),
100
+ !s.isRead && N && /* @__PURE__ */ n(
101
+ F,
102
+ {
103
+ icon: /* @__PURE__ */ n(M, { "aria-hidden": !0 }),
104
+ label: d("NotificationCenter.labels.markRead", o.markRead),
105
+ size: "sm",
106
+ onClick: () => N(s)
107
+ }
108
+ )
109
+ ]
110
+ },
111
+ s.id
112
+ )) })
113
+ ] }, e.key);
114
+ }) })
115
+ ]
116
+ }
117
+ );
118
+ }, re = /* @__PURE__ */ z(
119
+ /* @__PURE__ */ j(K, "NotificationCenter")
120
+ );
121
+ export {
122
+ re as default
123
+ };
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/NotificationCenter/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, type ReactNode, useId } from 'react';\n\nimport { BellFill, Check2 } from 'react-bootstrap-icons';\n\nimport UISize from '../../enums/ui-size.enum';\nimport UIVariant from '../../enums/ui-variant.enum';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport type { Formatter } from '../../types/theme.type';\nimport Button from '../Button';\nimport IconButton from '../IconButton';\nimport Popover from '../Popover';\n\nimport styles from './index.module.scss';\n\nexport type NotificationItem = {\n id: string;\n title: string;\n description?: ReactNode;\n /** When it happened: a `Date`, an ISO string or epoch milliseconds. */\n date: Date | string | number;\n isRead?: boolean;\n /** A leading icon (the kind of notification). */\n icon?: ReactNode;\n};\n\nexport type NotificationCenterLabels = {\n trigger: Formatter<[unread: number]>;\n title: string;\n markAllRead: string;\n markRead: string;\n empty: string;\n unread: string;\n today: string;\n yesterday: string;\n};\n\ntype Props = {\n items: NotificationItem[];\n /** A notification was opened. Without it the rows are plain text. */\n onItemSelect?: (item: NotificationItem) => void;\n /** Shows a \"mark read\" button on each unread notification. */\n onMarkRead?: (item: NotificationItem) => void;\n /** Shows \"mark all read\" while something is unread. */\n onMarkAllRead?: () => void;\n /** Controlled panel; uncontrolled when omitted. */\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n /** Heading of a day older than yesterday; the day and month in `labels.locale` by default. */\n formatDay?: (date: Date) => string;\n /** Time of one notification; hours and minutes in `labels.locale` by default. */\n formatTime?: (date: Date) => string;\n labels?: Partial<NotificationCenterLabels>;\n className?: string;\n testId?: string;\n};\n\n/* Above this the badge reads \"99+\": a wider badge would cover the bell. */\nconst BADGE_MAX = 99;\n\nconst dayKey = (date: Date): string => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n\ntype DayGroup = { key: string; date: Date; items: { item: NotificationItem; date: Date }[] };\n\n/** Newest first, one group per local calendar day. */\nconst groupByDay = (items: NotificationItem[]): DayGroup[] => {\n const groups = new Map<string, DayGroup>();\n const dated = items\n .map(item => ({ item, date: new Date(item.date) }))\n .sort((a, b) => b.date.getTime() - a.date.getTime());\n\n for (const entry of dated) {\n const key = dayKey(entry.date);\n const group = groups.get(key) ?? { key, date: entry.date, items: [] };\n group.items.push(entry);\n groups.set(key, group);\n }\n\n return [...groups.values()];\n};\n\n/** Bell with an unread badge and a panel of notifications grouped by day (3.1). Presentational. */\nconst NotificationCenter = ({\n items,\n onItemSelect,\n onMarkRead,\n onMarkAllRead,\n isOpen,\n onOpenChange,\n formatDay,\n formatTime,\n labels: labelProps,\n className,\n testId,\n}: Props) => {\n const { labels: config } = useUi();\n const baseId = useId();\n const unread = items.filter(item => !item.isRead).length;\n const text = { ...config?.notificationCenter, ...labelProps };\n\n const title = resolveLabel('NotificationCenter.labels.title', text.title);\n const locale = config?.locale;\n\n const dayHeading = (date: Date): string => {\n const today = new Date();\n const yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);\n if (dayKey(date) === dayKey(today))\n return resolveLabel('NotificationCenter.labels.today', text.today);\n if (dayKey(date) === dayKey(yesterday))\n return resolveLabel('NotificationCenter.labels.yesterday', text.yesterday);\n\n return (\n formatDay?.(date) ??\n new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' }).format(\n date,\n )\n );\n };\n\n const time = (date: Date): string =>\n formatTime?.(date) ??\n new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date);\n\n const renderContent = (item: NotificationItem, date: Date) => (\n <>\n {item.icon && (\n <span aria-hidden className={styles.icon}>\n {item.icon}\n </span>\n )}\n <span className={styles.body}>\n <span className={styles.title}>\n {!item.isRead && (\n <span className={styles.srOnly}>\n {resolveLabel('NotificationCenter.labels.unread', text.unread)}:{' '}\n </span>\n )}\n {item.title}\n </span>\n {item.description && <span className={styles.description}>{item.description}</span>}\n <time className={styles.time} dateTime={date.toISOString()}>\n {time(date)}\n </time>\n </span>\n </>\n );\n\n return (\n <Popover\n label={title}\n align=\"end\"\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n className={cx(styles.panel, className)}\n testId={testId}\n trigger={\n <IconButton\n icon={\n <span className={styles.bell}>\n <BellFill aria-hidden />\n {unread > 0 && (\n <span aria-hidden className={styles.badge}>\n {unread > BADGE_MAX ? `${BADGE_MAX}+` : unread}\n </span>\n )}\n </span>\n }\n label={resolveFormatter('NotificationCenter.labels.trigger', text.trigger, unread)}\n />\n }\n >\n <div className={styles.header}>\n <p className={styles.heading}>{title}</p>\n {unread > 0 && onMarkAllRead && (\n <Button variant={UIVariant.GHOST} size={UISize.SMALL} onClick={onMarkAllRead}>\n {resolveLabel('NotificationCenter.labels.markAllRead', text.markAllRead)}\n </Button>\n )}\n </div>\n\n {items.length === 0 ? (\n <p className={styles.empty}>\n <BellFill aria-hidden className={styles.empty__icon} />\n {resolveLabel('NotificationCenter.labels.empty', text.empty)}\n </p>\n ) : (\n <div className={styles.list}>\n {groupByDay(items).map(group => {\n const headingId = `${baseId}-${group.key}`;\n\n return (\n <div key={group.key} role=\"group\" aria-labelledby={headingId}>\n <p id={headingId} className={styles.day}>\n {dayHeading(group.date)}\n </p>\n <ul className={styles.items}>\n {group.items.map(({ item, date }) => (\n <li\n key={item.id}\n className={cx(styles.item, !item.isRead && styles['item--unread'])}\n >\n {onItemSelect ? (\n <button\n type=\"button\"\n className={cx(styles.item__main, styles['item__main--button'])}\n onClick={() => onItemSelect(item)}\n >\n {renderContent(item, date)}\n </button>\n ) : (\n <div className={styles.item__main}>{renderContent(item, date)}</div>\n )}\n {!item.isRead && onMarkRead && (\n <IconButton\n icon={<Check2 aria-hidden />}\n label={resolveLabel('NotificationCenter.labels.markRead', text.markRead)}\n size=\"sm\"\n onClick={() => onMarkRead(item)}\n />\n )}\n </li>\n ))}\n </ul>\n </div>\n );\n })}\n </div>\n )}\n </Popover>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(NotificationCenter, 'NotificationCenter'),\n) as typeof NotificationCenter;\n"],"names":["BADGE_MAX","dayKey","date","groupByDay","items","groups","dated","item","b","entry","key","group","NotificationCenter","onItemSelect","onMarkRead","onMarkAllRead","isOpen","onOpenChange","formatDay","formatTime","labelProps","className","testId","config","useUi","baseId","useId","unread","text","title","resolveLabel","locale","dayHeading","today","yesterday","time","renderContent","jsxs","Fragment","styles","jsx","Popover","cx","IconButton","BellFill","resolveFormatter","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AAA,YAAA,CAuBb,EAAA,CACH;AAAA,UAAA,EAAA,GA/BQI,EAAM,GAgChB;AAAA,QAEJ,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,GAEAwC,KAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAMzC,GAAoB,oBAAoB;AAC9D;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-panel-5SyKG{width:min(360px,100vw - var(--hd-space-6))}.ui-srOnly-RIBgB{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-bell-eoWEW{position:relative;display:inline-flex}.ui-badge-f-M5o{position:absolute;inset-block-start:-6px;inset-inline-end:-8px;min-width:16px;height:16px;padding-inline:4px;border-radius:var(--hd-radius-pill);background-color:var(--hd-primary);color:var(--hd-on-primary);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);line-height:16px;text-align:center;font-variant-numeric:tabular-nums;box-sizing:border-box}@media (forced-colors: active){.ui-badge-f-M5o{border:1px solid CanvasText}}.ui-header-XVQsI{display:flex;align-items:center;gap:var(--hd-space-2);justify-content:space-between;padding-block-end:var(--hd-space-2);border-bottom:1px solid var(--hd-border)}.ui-heading-coSaJ{font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:normal;color:var(--hd-text);margin:0}.ui-list-qhaa9{position:relative;max-height:min(420px,60dvh);overflow-y:auto;margin-inline:calc(-1 * var(--hd-space-3));padding-inline:var(--hd-space-3);scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-list-qhaa9::-webkit-scrollbar{width:8px;height:8px}.ui-list-qhaa9::-webkit-scrollbar-track{background:transparent}.ui-list-qhaa9::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-list-qhaa9::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-day-q8cob{font-family:var(--hd-font-body);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);letter-spacing:.045em;text-transform:uppercase;color:var(--hd-text-2);margin:0;padding-block:var(--hd-space-3) var(--hd-space-1)}.ui-items-Cy4JF{margin:0;padding:0;list-style:none}.ui-item-Gx5xM{display:flex;align-items:flex-start;gap:var(--hd-space-1);border-radius:var(--hd-radius-sm)}.ui-item__main-YzJ2w{display:flex;align-items:flex-start;gap:var(--hd-space-2);flex:1;min-width:0;padding:var(--hd-space-2);border-radius:var(--hd-radius-sm);color:var(--hd-text);text-align:start}.ui-item__main--button-0gQh7{border:none;background:none;font:inherit;cursor:pointer;background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-item__main--button-0gQh7:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-item__main--button-0gQh7:active:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 14%,transparent);translate:0 1px}@media (prefers-reduced-motion: reduce){.ui-item__main--button-0gQh7{transition:none}.ui-item__main--button-0gQh7:active:not(:disabled):not([aria-disabled=true]){translate:none}}.ui-item__main--button-0gQh7:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-item--unread-LYQ9H .ui-title-vMVcE{font-weight:var(--hd-font-weight-semibold)}.ui-item--unread-LYQ9H .ui-title-vMVcE:before{content:"";display:inline-block;width:8px;height:8px;margin-inline-end:var(--hd-space-2);border-radius:var(--hd-radius-pill);background-color:var(--hd-primary);vertical-align:middle}@media (forced-colors: active){.ui-item--unread-LYQ9H .ui-title-vMVcE:before{background-color:CanvasText}}.ui-icon-xOfOg{display:inline-flex;flex-shrink:0;padding-block-start:2px;color:var(--hd-text-2);font-size:18px}.ui-body-xDRoI{display:flex;flex-direction:column;gap:var(--hd-space-1);min-width:0}.ui-title-vMVcE{font-size:var(--hd-type-small-size);line-height:var(--hd-type-h4-line-height)}.ui-description-SuXFu{font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2)}.ui-time-k0R6i{font-size:var(--hd-type-caption-size);color:var(--hd-text-3)}.ui-empty-WTfI4{display:flex;flex-direction:column;gap:var(--hd-space-2);align-items:center;margin:0;padding:var(--hd-space-6) var(--hd-space-3);text-align:center;font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2)}.ui-empty__icon-03css{font-size:24px;color:var(--hd-text-3)}}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("react/jsx-runtime"),n=require("react"),N=require("react-dom"),B=require("../../helpers/class-name.helper.cjs"),O=require("../../helpers/component.helper.cjs"),U=require("../../hooks/useDismissOnEscape.cjs"),p=require("../../helpers/focus.helper.cjs"),V=require("../../hooks/usePortalSurface.cjs"),W=require("../../hooks/usePositioning.cjs"),_={default:{"popover":"ui-popover-VxgiK","popover--top":"ui-popover--top-OUYwo","popover--bottom":"ui-popover--bottom-Q1K4X","popover--left":"ui-popover--left-9Rsjx","popover--right":"ui-popover--right-0TJeo"}},$=({trigger:v,children:g,label:k,side:w="bottom",align:K="start",isOpen:q,onOpenChange:l,initialFocus:P,className:T,testId:j})=>{const R=n.useId(),c=n.useRef(null),i=n.useRef(null),b=n.useRef(!1),y=n.useRef(!1),[S,F]=n.useState(!1),E=q!==void 0,s=E?q:S,f=W.default(c,i,{side:w,align:K,isOpen:s}),d=V.default(s,c,i),o=n.useCallback(e=>{E||F(e),l==null||l(e)},[E,l]);n.useEffect(()=>{if(!s)return;b.current=!1,y.current=!1;const e=p.captureFocus(),t=i.current;return()=>{const r=document.activeElement;(!r||r===document.body||t!=null&&t.contains(r))&&e()}},[s]);const D=f.isPositioned;n.useEffect(()=>{if(!s||!D||b.current)return;const e=i.current;e&&(b.current=!0,e.contains(document.activeElement)||p.focusInitial(e,P))},[s,D,P]);const L=n.useCallback(()=>o(!1),[o]);U.default(s,L),n.useEffect(()=>{if(!s)return;const e=t=>{var u,a;const r=t.target;(u=i.current)!=null&&u.contains(r)||(a=c.current)!=null&&a.contains(r)||o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s,o]);const A=e=>{if(e.key!=="Tab"||e.defaultPrevented)return;const t=e.currentTarget,r=document.activeElement,u=p.focusableWithin(t),a=e.shiftKey?u[0]:u.at(-1),M=a===void 0||r===a||e.shiftKey&&r===t,m=c.current;if(!M||!m)return;e.preventDefault(),y.current=!0,o(!1),(e.shiftKey?m:p.nextFocusableAfter(m,t)??m).focus()};if(!n.isValidElement(v))return null;const h=v.props,I=n.cloneElement(v,{ref:c,"aria-expanded":s,"aria-haspopup":"dialog","aria-controls":s?R:void 0,onClick:e=>{var t;(t=h.onClick)==null||t.call(h,e),o(!s)}});return x.jsxs(x.Fragment,{children:[I,s&&d.container&&N.createPortal(x.jsx("div",{ref:i,id:R,...d.attributes,role:"dialog","aria-label":k,className:B.cx(_.default.popover,_.default[`popover--${f.side}`],T),style:{...f.style,...d.style,visibility:f.isPositioned?"visible":"hidden"},"data-testid":j,onKeyDown:A,onBlur:e=>{var r;const t=e.relatedTarget;!t||y.current||e.currentTarget.contains(t)||(r=c.current)!=null&&r.contains(t)||t.closest('[role="listbox"],[role="menu"],[role="dialog"]')||o(!1)},children:g}),d.container)]})},z=n.memo(O.named($,"Popover"));exports.default=z;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("react/jsx-runtime"),n=require("react"),N=require("react-dom"),$=require("../../helpers/class-name.helper.cjs"),B=require("../../helpers/component.helper.cjs"),O=require("../../hooks/useDismissOnEscape.cjs"),p=require("../../helpers/focus.helper.cjs"),U=require("../../hooks/usePortalSurface.cjs"),V=require("../../hooks/usePositioning.cjs"),_={default:{"popover":"ui-popover-VxgiK","popover--top":"ui-popover--top-OUYwo","popover--bottom":"ui-popover--bottom-Q1K4X","popover--left":"ui-popover--left-9Rsjx","popover--right":"ui-popover--right-0TJeo"}},W=({trigger:v,children:g,label:k,side:w="bottom",align:K="start",isOpen:q,onOpenChange:l,initialFocus:x,className:T,testId:j})=>{const R=n.useId(),c=n.useRef(null),i=n.useRef(null),b=n.useRef(!1),y=n.useRef(!1),[S,F]=n.useState(!1),E=q!==void 0,r=E?q:S,f=V.default(c,i,{side:w,align:K,isOpen:r}),d=U.default(r,c,i),o=n.useCallback(e=>{E||F(e),l==null||l(e)},[E,l]);n.useEffect(()=>{if(!r)return;b.current=!1,y.current=!1;const e=p.captureFocus(),t=i.current;return()=>{const s=document.activeElement;(!s||s===document.body||t!=null&&t.contains(s))&&e()}},[r]);const D=f.isPositioned;n.useEffect(()=>{if(!r||!D||b.current)return;const e=i.current;e&&(b.current=!0,e.contains(document.activeElement)||p.focusInitial(e,x))},[r,D,x]);const L=n.useCallback(()=>o(!1),[o]);O.default(r,L),n.useEffect(()=>{if(!r)return;const e=t=>{var u,a;const s=t.target;(u=i.current)!=null&&u.contains(s)||(a=c.current)!=null&&a.contains(s)||o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,o]);const A=e=>{if(e.key!=="Tab"||e.defaultPrevented)return;const t=e.currentTarget,s=document.activeElement,u=p.focusableWithin(t),a=e.shiftKey?u[0]:u.at(-1),M=a===void 0||s===a||e.shiftKey&&s===t,m=c.current;if(!M||!m)return;e.preventDefault(),y.current=!0,o(!1),(e.shiftKey?m:p.nextFocusableAfter(m,t)??m).focus()};if(!n.isValidElement(v))return null;const h=v.props,I=n.cloneElement(v,{ref:c,"aria-expanded":r,"aria-haspopup":"dialog","aria-controls":r?R:void 0,onClick:e=>{var t;(t=h.onClick)==null||t.call(h,e),o(!r)}});return P.jsxs(P.Fragment,{children:[I,r&&d.container&&N.createPortal(P.jsx("div",{ref:i,id:R,...d.attributes,role:"dialog","aria-label":k,className:$.cx(_.default.popover,_.default[`popover--${f.side}`],T),style:{...f.style,...d.style,visibility:f.isPositioned?"visible":"hidden"},"data-testid":j,onKeyDown:A,onBlur:e=>{var s;const t=e.relatedTarget;!t||y.current||e.currentTarget.contains(t)||(s=c.current)!=null&&s.contains(t)||t.closest('[role="listbox"],[role="menu"],[role="dialog"]')||o(!1)},children:g}),d.container)]})},z=n.memo(B.named(W,"Popover"));exports.default=z;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n cloneElement,\n isValidElement,\n type KeyboardEvent,\n memo,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport {\n captureFocus,\n type FocusTarget,\n focusableWithin,\n focusInitial,\n nextFocusableAfter,\n} from '../../helpers/focus.helper';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionAlign, PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Tetikleyici. */\n trigger: ReactElement;\n children: ReactNode;\n /** Yüzeyin erişilebilir adı. */\n label: string;\n side?: PositionSide;\n align?: PositionAlign;\n /** Kontrollü kullanım. */\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Açılınca odaklanacak öğe (yüzeyin içinde). Verilmezse `data-ui-autofocus` taşıyan öğe, o da\n * yoksa ilk odaklanabilir öğe.\n */\n initialFocus?: FocusTarget;\n className?: string;\n testId?: string;\n};\n\n/** Popover — eylem taşıyabilen, odaklanabilir yüzey. */\nconst Popover = ({\n trigger,\n children,\n label,\n side = 'bottom',\n align = 'start',\n isOpen: controlledOpen,\n onOpenChange,\n initialFocus,\n className,\n testId,\n}: Props) => {\n const id = useId();\n const anchorRef = useRef<HTMLElement>(null);\n const surfaceRef = useRef<HTMLDivElement>(null);\n /* Bu acilista ilk odak verildi mi: yeniden konumlanma (kaydirma, boyut) odagi tekrar CALMAZ. */\n const hasFocusedRef = useRef(false);\n /* `Tab` ile cikis kapanisi ZATEN bildirdi: ardindan gelen `blur` ikinci kez bildirmez. */\n const isLeavingRef = useRef(false);\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : uncontrolledOpen;\n\n const positioning = usePositioning(anchorRef, surfaceRef, { side, align, isOpen });\n\n const portal = usePortalSurface(isOpen, anchorRef, surfaceRef);\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n /*\n * KAPANISTA odak TETIKLEYICIYE doner — ama yalnizca odak yuzeyle birlikte DUSTUYSE (`<body>`) ya da\n * hala icerdeyse. Kullanici `Tab` ile ya da bir alana tiklayarak baska bir yere gectiyse odak orada\n * kalir; eskiden tetikleyiciye geri cekiliyordu.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n hasFocusedRef.current = false;\n isLeavingRef.current = false;\n const restore = captureFocus();\n const surface = surfaceRef.current;\n\n return () => {\n const active = document.activeElement;\n if (!active || active === document.body || surface?.contains(active)) restore();\n };\n }, [isOpen]);\n\n /*\n * ACILIS odagi yuzey KONUMLANDIKTAN SONRA verilir. Yuzey olculene kadar `visibility: hidden`\n * cizilir ve gizli bir ogeye `focus()` tarayicida sessizce yok sayilir: odak tetikleyicide kaliyor,\n * klavye kullanicisi panele hic giremiyordu (masaüstü programi iki `requestAnimationFrame` ile\n * atlatiyordu). jsdom gorunurluk denetlemedigi icin bunu yalnizca tarayici testi gorur.\n */\n const isPositioned = positioning.isPositioned;\n useEffect(() => {\n if (!isOpen || !isPositioned || hasFocusedRef.current) return;\n\n const surface = surfaceRef.current;\n if (!surface) return;\n\n hasFocusedRef.current = true;\n if (!surface.contains(document.activeElement)) focusInitial(surface, initialFocus);\n }, [isOpen, isPositioned, initialFocus]);\n\n const close = useCallback(() => setOpen(false), [setOpen]);\n useDismissOnEscape(isOpen, close);\n\n /*\n * DISARI tiklama da belge duzeyinde: odak yuzeyin icinde olmayabilir (fareyle acilmis bir\n * popover).\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.MouseEvent) => {\n const target = event.target as Node;\n if (surfaceRef.current?.contains(target)) return;\n if (anchorRef.current?.contains(target)) return;\n setOpen(false);\n };\n\n /* `mousedown`: `click` beklerken kullanici surukleyerek secim yaparsa yuzey kapanmiyordu. */\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => document.removeEventListener('mousedown', handlePointerDown);\n }, [isOpen, setOpen]);\n\n /*\n * `Tab` SINIRDA: yuzey `<body>`nin sonuna portallanmis, tarayicinin kendi sirasi odagi sayfanin\n * disina atiyordu. Son ogeden `Tab` tetikleyiciden SONRAKI durağa, ilk ogeden `Shift+Tab`\n * tetikleyiciye gider; ikisinde de yuzey kapanir (kipsel olmayan yuzeyde odak tuzagi yok).\n */\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Tab' || event.defaultPrevented) return;\n\n const surface = event.currentTarget;\n const active = document.activeElement;\n const focusable = focusableWithin(surface);\n const edge = event.shiftKey ? focusable[0] : focusable.at(-1);\n /* Odak yuzeyin KENDISINDEYSE (odaklanabilir ogesi olmayan panel) geri yon de sinirdir. */\n const isAtEdge =\n edge === undefined || active === edge || (event.shiftKey && active === surface);\n const anchor = anchorRef.current;\n if (!isAtEdge || !anchor) return;\n\n event.preventDefault();\n isLeavingRef.current = true;\n setOpen(false);\n const next = event.shiftKey ? anchor : (nextFocusableAfter(anchor, surface) ?? anchor);\n next.focus();\n };\n\n if (!isValidElement(trigger)) return null;\n\n const triggerProps = trigger.props as Record<string, unknown>;\n\n const anchor = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: anchorRef,\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'dialog',\n 'aria-controls': isOpen ? id : undefined,\n onClick: (event: React.MouseEvent) => {\n (triggerProps.onClick as ((event: React.MouseEvent) => void) | undefined)?.(event);\n setOpen(!isOpen);\n },\n });\n\n return (\n <>\n {anchor}\n\n {isOpen &&\n portal.container &&\n createPortal(\n <div\n ref={surfaceRef}\n id={id}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n /*\n * `role=\"dialog\"` ama `aria-modal` YOK: yuzey kipsel degil ve `aria-modal=\"true\"`\n * yazmak ekran okuyucuya sayfanin geri kalaninin erisilemez oldugunu…\n */\n role=\"dialog\"\n aria-label={label}\n className={cx(styles.popover, styles[`popover--${positioning.side}`], className)}\n style={{\n ...positioning.style,\n ...portal.style,\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n data-testid={testId}\n onKeyDown={handleKeyDown}\n /*\n * Odak yuzeyin DISINA ciktiginda kapanir: kipsel olmayan bir yuzeyde odagi hapsetmek\n * kullaniciyi sayfadan koparirdi.\n * ⚠ AMA \"DISI\" DOM AGACIYLA OLCULEMEZ.\n */\n onBlur={event => {\n const next = event.relatedTarget as HTMLElement | null;\n if (!next || isLeavingRef.current) return;\n if (event.currentTarget.contains(next)) return;\n if (anchorRef.current?.contains(next)) return;\n\n /*\n * Bu yuzeyden PORTALLANMIS bir katman mi? `Menu`/`Select`/ `Combobox` panelleri\n * `aria-controls`/`id` zinciriyle degil, acildiklari an odagi tasiyarak…\n */\n if (next.closest('[role=\"listbox\"],[role=\"menu\"],[role=\"dialog\"]')) return;\n\n setOpen(false);\n }}\n >\n {children}\n </div>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Popover, 'Popover')) as typeof Popover;\n"],"names":["Popover","trigger","children","label","side","align","controlledOpen","onOpenChange","initialFocus","className","testId","id","useId","anchorRef","useRef","surfaceRef","hasFocusedRef","isLeavingRef","uncontrolledOpen","setUncontrolledOpen","useState","isControlled","isOpen","positioning","usePositioning","portal","usePortalSurface","setOpen","useCallback","next","useEffect","restore","captureFocus","surface","active","isPositioned","focusInitial","close","useDismissOnEscape","handlePointerDown","event","target","_a","_b","handleKeyDown","focusable","focusableWithin","edge","isAtEdge","anchor","nextFocusableAfter","isValidElement","triggerProps","cloneElement","jsxs","Fragment","createPortal","jsx","cx","styles","index","memo","named"],"mappings":"ogBAqDMA,EAAU,CAAC,CACf,QAAAC,EACA,SAAAC,EACA,MAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,QACR,OAAQC,EACR,aAAAC,EACA,aAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,MAAMC,EAAKC,EAAAA,MAAA,EACLC,EAAYC,EAAAA,OAAoB,IAAI,EACpCC,EAAaD,EAAAA,OAAuB,IAAI,EAExCE,EAAgBF,EAAAA,OAAO,EAAK,EAE5BG,EAAeH,EAAAA,OAAO,EAAK,EAE3B,CAACI,EAAkBC,CAAmB,EAAIC,EAAAA,SAAS,EAAK,EACxDC,EAAef,IAAmB,OAClCgB,EAASD,EAAef,EAAiBY,EAEzCK,EAAcC,EAAAA,QAAeX,EAAWE,EAAY,CAAE,KAAAX,EAAM,MAAAC,EAAO,OAAAiB,EAAQ,EAE3EG,EAASC,EAAAA,QAAiBJ,EAAQT,EAAWE,CAAU,EAEvDY,EAAUC,EAAAA,YACbC,GAAkB,CACZR,GAAcF,EAAoBU,CAAI,EAC3CtB,GAAA,MAAAA,EAAesB,EACjB,EACA,CAACR,EAAcd,CAAY,CAAA,EAQ7BuB,EAAAA,UAAU,IAAM,CACd,GAAI,CAACR,EAAQ,OAEbN,EAAc,QAAU,GACxBC,EAAa,QAA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D,EAAS,SAAS,CAAC"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n cloneElement,\n isValidElement,\n type KeyboardEvent,\n memo,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport {\n captureFocus,\n type FocusTarget,\n focusableWithin,\n focusInitial,\n nextFocusableAfter,\n} from '../../helpers/focus.helper';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionAlign, PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Tetikleyici. */\n trigger: ReactElement;\n children: ReactNode;\n /** Yüzeyin erişilebilir adı. */\n label: string;\n side?: PositionSide;\n align?: PositionAlign;\n /** Kontrollü kullanım. */\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Açılınca odaklanacak öğe (yüzeyin içinde). Verilmezse `data-ui-autofocus` taşıyan öğe, o da\n * yoksa ilk odaklanabilir öğe.\n */\n initialFocus?: FocusTarget;\n className?: string;\n testId?: string;\n};\n\n/** Popover — eylem taşıyabilen, odaklanabilir yüzey. */\nconst Popover = ({\n trigger,\n children,\n label,\n side = 'bottom',\n align = 'start',\n isOpen: controlledOpen,\n onOpenChange,\n initialFocus,\n className,\n testId,\n}: Props) => {\n const id = useId();\n const anchorRef = useRef<HTMLElement>(null);\n const surfaceRef = useRef<HTMLDivElement>(null);\n /* Bu acilista ilk odak verildi mi: yeniden konumlanma (kaydirma, boyut) odagi tekrar CALMAZ. */\n const hasFocusedRef = useRef(false);\n /* `Tab` ile cikis kapanisi ZATEN bildirdi: ardindan gelen `blur` ikinci kez bildirmez. */\n const isLeavingRef = useRef(false);\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : uncontrolledOpen;\n\n const positioning = usePositioning(anchorRef, surfaceRef, { side, align, isOpen });\n\n const portal = usePortalSurface(isOpen, anchorRef, surfaceRef);\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n /*\n * KAPANISTA odak TETIKLEYICIYE doner — ama yalnizca odak yuzeyle birlikte DUSTUYSE (`<body>`) ya da\n * hala icerdeyse. Kullanici `Tab` ile ya da bir alana tiklayarak baska bir yere gectiyse odak orada\n * kalir; eskiden tetikleyiciye geri cekiliyordu.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n hasFocusedRef.current = false;\n isLeavingRef.current = false;\n const restore = captureFocus();\n const surface = surfaceRef.current;\n\n return () => {\n const active = document.activeElement;\n if (!active || active === document.body || surface?.contains(active)) restore();\n };\n }, [isOpen]);\n\n /*\n * ACILIS odagi yuzey KONUMLANDIKTAN SONRA verilir. Yuzey olculene kadar `visibility: hidden`\n * cizilir ve gizli bir ogeye `focus()` tarayicida sessizce yok sayilir: odak tetikleyicide kaliyor,\n * klavye kullanicisi panele hic giremiyordu (masaüstü programi iki `requestAnimationFrame` ile\n * atlatiyordu). jsdom gorunurluk denetlemedigi icin bunu yalnizca tarayici testi gorur.\n */\n const isPositioned = positioning.isPositioned;\n useEffect(() => {\n if (!isOpen || !isPositioned || hasFocusedRef.current) return;\n\n const surface = surfaceRef.current;\n if (!surface) return;\n\n hasFocusedRef.current = true;\n if (!surface.contains(document.activeElement)) focusInitial(surface, initialFocus);\n }, [isOpen, isPositioned, initialFocus]);\n\n const close = useCallback(() => setOpen(false), [setOpen]);\n useDismissOnEscape(isOpen, close);\n\n /*\n * DISARI tiklama da belge duzeyinde: odak yuzeyin icinde olmayabilir (fareyle acilmis bir\n * popover).\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.MouseEvent) => {\n const target = event.target as Node;\n if (surfaceRef.current?.contains(target)) return;\n if (anchorRef.current?.contains(target)) return;\n setOpen(false);\n };\n\n /* `mousedown`: `click` beklerken kullanici surukleyerek secim yaparsa yuzey kapanmiyordu. */\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => document.removeEventListener('mousedown', handlePointerDown);\n }, [isOpen, setOpen]);\n\n /*\n * `Tab` SINIRDA: yuzey `<body>`nin sonuna portallanmis, tarayicinin kendi sirasi odagi sayfanin\n * disina atiyordu. Son ogeden `Tab` tetikleyiciden SONRAKI durağa, ilk ogeden `Shift+Tab`\n * tetikleyiciye gider; ikisinde de yuzey kapanir (kipsel olmayan yuzeyde odak tuzagi yok).\n */\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Tab' || event.defaultPrevented) return;\n\n const surface = event.currentTarget;\n const active = document.activeElement;\n const focusable = focusableWithin(surface);\n const edge = event.shiftKey ? focusable[0] : focusable.at(-1);\n /* Odak yuzeyin KENDISINDEYSE (odaklanabilir ogesi olmayan panel) geri yon de sinirdir. */\n const isAtEdge =\n edge === undefined || active === edge || (event.shiftKey && active === surface);\n const anchor = anchorRef.current;\n if (!isAtEdge || !anchor) return;\n\n event.preventDefault();\n isLeavingRef.current = true;\n setOpen(false);\n const next = event.shiftKey ? anchor : (nextFocusableAfter(anchor, surface) ?? anchor);\n next.focus();\n };\n\n if (!isValidElement(trigger)) return null;\n\n const triggerProps = trigger.props as Record<string, unknown>;\n\n const anchor = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: anchorRef,\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'dialog',\n 'aria-controls': isOpen ? id : undefined,\n onClick: (event: React.MouseEvent) => {\n (triggerProps.onClick as ((event: React.MouseEvent) => void) | undefined)?.(event);\n setOpen(!isOpen);\n },\n });\n\n return (\n <>\n {anchor}\n\n {isOpen &&\n portal.container &&\n createPortal(\n <div\n ref={surfaceRef}\n id={id}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n /*\n * `role=\"dialog\"` ama `aria-modal` YOK: yuzey kipsel degil ve `aria-modal=\"true\"`\n * yazmak ekran okuyucuya sayfanin geri kalaninin erisilemez oldugunu…\n */\n role=\"dialog\"\n aria-label={label}\n className={cx(styles.popover, styles[`popover--${positioning.side}`], className)}\n style={{\n ...positioning.style,\n ...portal.style,\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n data-testid={testId}\n onKeyDown={handleKeyDown}\n /*\n * Odak yuzeyin DISINA ciktiginda kapanir: kipsel olmayan bir yuzeyde odagi hapsetmek\n * kullaniciyi sayfadan koparirdi.\n * ⚠ AMA \"DISI\" DOM AGACIYLA OLCULEMEZ.\n */\n onBlur={event => {\n const next = event.relatedTarget as HTMLElement | null;\n if (!next || isLeavingRef.current) return;\n if (event.currentTarget.contains(next)) return;\n if (anchorRef.current?.contains(next)) return;\n\n /*\n * Bu yuzeyden PORTALLANMIS bir katman mi? `Menu`/`Select`/ `Combobox` panelleri\n * `aria-controls`/`id` zinciriyle degil, acildiklari an odagi tasiyarak…\n */\n if (next.closest('[role=\"listbox\"],[role=\"menu\"],[role=\"dialog\"]')) return;\n\n setOpen(false);\n }}\n >\n {children}\n </div>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Popover, 'Popover')) as typeof Popover;\n"],"names":["Popover","trigger","children","label","side","align","controlledOpen","onOpenChange","initialFocus","className","testId","id","useId","anchorRef","useRef","surfaceRef","hasFocusedRef","isLeavingRef","uncontrolledOpen","setUncontrolledOpen","useState","isControlled","isOpen","positioning","usePositioning","portal","usePortalSurface","setOpen","useCallback","next","useEffect","restore","captureFocus","surface","active","isPositioned","focusInitial","close","useDismissOnEscape","handlePointerDown","event","target","_a","_b","handleKeyDown","focusable","focusableWithin","edge","isAtEdge","anchor","nextFocusableAfter","isValidElement","triggerProps","cloneElement","jsxs","Fragment","createPortal","jsx","cx","styles","memo","named"],"mappings":"ogBAqDMA,EAAU,CAAC,CACf,QAAAC,EACA,SAAAC,EACA,MAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,QACR,OAAQC,EACR,aAAAC,EACA,aAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,MAAMC,EAAKC,EAAAA,MAAA,EACLC,EAAYC,EAAAA,OAAoB,IAAI,EACpCC,EAAaD,EAAAA,OAAuB,IAAI,EAExCE,EAAgBF,EAAAA,OAAO,EAAK,EAE5BG,EAAeH,EAAAA,OAAO,EAAK,EAE3B,CAACI,EAAkBC,CAAmB,EAAIC,EAAAA,SAAS,EAAK,EACxDC,EAAef,IAAmB,OAClCgB,EAASD,EAAef,EAAiBY,EAEzCK,EAAcC,EAAAA,QAAeX,EAAWE,EAAY,CAAE,KAAAX,EAAM,MAAAC,EAAO,OAAAiB,EAAQ,EAE3EG,EAASC,EAAAA,QAAiBJ,EAAQT,EAAWE,CAAU,EAEvDY,EAAUC,EAAAA,YACbC,GAAkB,CACZR,GAAcF,EAAoBU,CAAI,EAC3CtB,GAAA,MAAAA,EAAesB,EACjB,EACA,CAACR,EAAcd,CAAY,CAAA,EAQ7BuB,EAAAA,UAAU,IAAM,CACd,GAAI,CAACR,EAAQ,OAEbN,EAAc,QAAU,GACxBC,EAAa,QAAU,GACvB,MAAMc,EAAUC,EAAAA,aAAA,EACVC,EAAUlB,EAAW,QAE3B,MAAO,IAAM,CACX,MAAMmB,EAAS,SAAS,eACpB,CAACA,GAAUA,IAAW,SAAS,MAAQD,GAAA,MAAAA,EAAS,SAASC,KAASH,EAAA,CACxE,CACF,EAAG,CAACT,CAAM,CAAC,EAQX,MAAMa,EAAeZ,EAAY,aACjCO,EAAAA,UAAU,IAAM,CACd,GAAI,CAACR,GAAU,CAACa,GAAgBnB,EAAc,QAAS,OAEvD,MAAMiB,EAAUlB,EAAW,QACtBkB,I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gBAAiBS,EACjB,gBAAiB,SACjB,gBAAiBA,EAASX,EAAK,OAC/B,QAAU6B,GAA4B,QACnCE,EAAAU,EAAa,UAAb,MAAAV,EAAA,KAAAU,EAA2EZ,GAC5Eb,EAAQ,CAACL,CAAM,CACjB,CAAA,CACD,EAED,OACEgC,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAN,EAEA3B,GACCG,EAAO,WACP+B,EAAAA,aACEC,EAAAA,IAAC,MAAA,CACC,IAAK1C,EACL,GAAAJ,EAEC,GAAGc,EAAO,WAKX,KAAK,SACL,aAAYtB,EACZ,UAAWuD,EAAAA,GAAGC,UAAO,QAASA,EAAAA,QAAO,YAAYpC,EAAY,IAAI,EAAE,EAAGd,CAAS,EAC/E,MAAO,CACL,GAAGc,EAAY,MACf,GAAGE,EAAO,MACV,WAAYF,EAAY,aAAe,UAAY,QAAA,EAErD,cAAab,EACb,UAAWkC,EAMX,OAAQJ,GAAS,OACf,MAAMX,EAAOW,EAAM,cACf,CAACX,GAAQZ,EAAa,SACtBuB,EAAM,cAAc,SAASX,CAAI,IACjCa,EAAA7B,EAAU,UAAV,MAAA6B,EAAmB,SAASb,IAM5BA,EAAK,QAAQ,gDAAgD,GAEjEF,EAAQ,EAAK,CACf,EAEC,SAAAzB,CAAA,CAAA,EAEHuB,EAAO,SAAA,CACT,EACJ,CAEJ,EAEAzB,EAA6B4D,OAAmBC,EAAAA,MAAM7D,EAAS,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsxs as V, Fragment as W, jsx as $ } from "react/jsx-runtime";
3
- import { memo as q, useId as z, useRef as m, useState as G, useCallback as K, useEffect as E, isValidElement as H, cloneElement as J } from "react";
2
+ import { jsxs as U, Fragment as V, jsx as W } from "react/jsx-runtime";
3
+ import { memo as q, useId as z, useRef as m, useState as G, useCallback as K, useEffect as P, isValidElement as H, cloneElement as J } from "react";
4
4
  import { createPortal as M } from "react-dom";
5
5
  import { cx as O } from "../../helpers/class-name.helper.js";
6
6
  import { named as Q } from "../../helpers/component.helper.js";
@@ -15,19 +15,19 @@ const ot = ({
15
15
  label: T,
16
16
  side: g = "bottom",
17
17
  align: F = "start",
18
- isOpen: P,
18
+ isOpen: x,
19
19
  onOpenChange: u,
20
20
  initialFocus: h,
21
21
  className: L,
22
22
  testId: j
23
23
  }) => {
24
- const w = z(), s = m(null), i = m(null), v = m(!1), b = m(!1), [A, I] = G(!1), y = P !== void 0, o = y ? P : A, l = et(s, i, { side: g, align: F, isOpen: o }), f = tt(o, s, i), n = K(
24
+ const w = z(), s = m(null), i = m(null), v = m(!1), b = m(!1), [A, I] = G(!1), y = x !== void 0, o = y ? x : A, l = et(s, i, { side: g, align: F, isOpen: o }), f = tt(o, s, i), n = K(
25
25
  (t) => {
26
26
  y || I(t), u == null || u(t);
27
27
  },
28
28
  [y, u]
29
29
  );
30
- E(() => {
30
+ P(() => {
31
31
  if (!o) return;
32
32
  v.current = !1, b.current = !1;
33
33
  const t = Z(), e = i.current;
@@ -37,13 +37,13 @@ const ot = ({
37
37
  };
38
38
  }, [o]);
39
39
  const D = l.isPositioned;
40
- E(() => {
40
+ P(() => {
41
41
  if (!o || !D || v.current) return;
42
42
  const t = i.current;
43
43
  t && (v.current = !0, t.contains(document.activeElement) || Y(t, h));
44
44
  }, [o, D, h]);
45
45
  const S = K(() => n(!1), [n]);
46
- X(o, S), E(() => {
46
+ X(o, S), P(() => {
47
47
  if (!o) return;
48
48
  const t = (e) => {
49
49
  var c, a;
@@ -52,27 +52,27 @@ const ot = ({
52
52
  };
53
53
  return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
54
54
  }, [o, n]);
55
- const B = (t) => {
55
+ const $ = (t) => {
56
56
  if (t.key !== "Tab" || t.defaultPrevented) return;
57
- const e = t.currentTarget, r = document.activeElement, c = _(e), a = t.shiftKey ? c[0] : c.at(-1), U = a === void 0 || r === a || t.shiftKey && r === e, d = s.current;
58
- if (!U || !d) return;
57
+ const e = t.currentTarget, r = document.activeElement, c = _(e), a = t.shiftKey ? c[0] : c.at(-1), N = a === void 0 || r === a || t.shiftKey && r === e, d = s.current;
58
+ if (!N || !d) return;
59
59
  t.preventDefault(), b.current = !0, n(!1), (t.shiftKey ? d : C(d, e) ?? d).focus();
60
60
  };
61
61
  if (!H(p)) return null;
62
- const x = p.props, N = J(p, {
62
+ const E = p.props, B = J(p, {
63
63
  ref: s,
64
64
  "aria-expanded": o,
65
65
  "aria-haspopup": "dialog",
66
66
  "aria-controls": o ? w : void 0,
67
67
  onClick: (t) => {
68
68
  var e;
69
- (e = x.onClick) == null || e.call(x, t), n(!o);
69
+ (e = E.onClick) == null || e.call(E, t), n(!o);
70
70
  }
71
71
  });
72
- return /* @__PURE__ */ V(W, { children: [
73
- N,
72
+ return /* @__PURE__ */ U(V, { children: [
73
+ B,
74
74
  o && f.container && M(
75
- /* @__PURE__ */ $(
75
+ /* @__PURE__ */ W(
76
76
  "div",
77
77
  {
78
78
  ref: i,
@@ -87,7 +87,7 @@ const ot = ({
87
87
  visibility: l.isPositioned ? "visible" : "hidden"
88
88
  },
89
89
  "data-testid": j,
90
- onKeyDown: B,
90
+ onKeyDown: $,
91
91
  onBlur: (t) => {
92
92
  var r;
93
93
  const e = t.relatedTarget;