@handijitcom/ui 3.3.1 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -0
- package/build/chat.css +1 -1
- package/build/components/AppShell/Nav.cjs +1 -1
- package/build/components/AppShell/Nav.cjs.map +1 -1
- package/build/components/AppShell/Nav.d.cts +8 -1
- package/build/components/AppShell/Nav.d.ts +8 -1
- package/build/components/AppShell/Nav.js +127 -112
- package/build/components/AppShell/Nav.js.map +1 -1
- package/build/components/AppShell/style.css +1 -1
- package/build/components/AppliedFilters/index.cjs +2 -0
- package/build/components/AppliedFilters/index.cjs.map +1 -0
- package/build/components/AppliedFilters/index.d.cts +33 -0
- package/build/components/AppliedFilters/index.d.ts +33 -0
- package/build/components/AppliedFilters/index.js +85 -0
- package/build/components/AppliedFilters/index.js.map +1 -0
- package/build/components/AppliedFilters/style.css +1 -0
- package/build/components/BrandLockup/index.cjs +2 -0
- package/build/components/BrandLockup/index.cjs.map +1 -0
- package/build/components/BrandLockup/index.d.cts +29 -0
- package/build/components/BrandLockup/index.d.ts +29 -0
- package/build/components/BrandLockup/index.js +41 -0
- package/build/components/BrandLockup/index.js.map +1 -0
- package/build/components/BrandLockup/style.css +1 -0
- package/build/components/Carousel/index.cjs +1 -1
- package/build/components/Carousel/index.cjs.map +1 -1
- package/build/components/Carousel/index.d.cts +9 -0
- package/build/components/Carousel/index.d.ts +9 -0
- package/build/components/Carousel/index.js +65 -60
- package/build/components/Carousel/index.js.map +1 -1
- package/build/components/Carousel/style.css +1 -1
- package/build/components/CodeText/CodeTextCopy.cjs +2 -0
- package/build/components/CodeText/CodeTextCopy.cjs.map +1 -0
- package/build/components/CodeText/CodeTextCopy.d.cts +11 -0
- package/build/components/CodeText/CodeTextCopy.d.ts +11 -0
- package/build/components/CodeText/CodeTextCopy.js +41 -0
- package/build/components/CodeText/CodeTextCopy.js.map +1 -0
- package/build/components/CodeText/index.cjs +2 -0
- package/build/components/CodeText/index.cjs.map +1 -0
- package/build/components/CodeText/index.d.cts +26 -0
- package/build/components/CodeText/index.d.ts +26 -0
- package/build/components/CodeText/index.js +39 -0
- package/build/components/CodeText/index.js.map +1 -0
- package/build/components/CodeText/style.css +1 -0
- package/build/components/Combobox/index.cjs +1 -1
- package/build/components/Combobox/index.cjs.map +1 -1
- package/build/components/Combobox/index.js +147 -146
- package/build/components/Combobox/index.js.map +1 -1
- package/build/components/Combobox/style.css +1 -1
- package/build/components/CompareTray/index.cjs +2 -0
- package/build/components/CompareTray/index.cjs.map +1 -0
- package/build/components/CompareTray/index.d.cts +44 -0
- package/build/components/CompareTray/index.d.ts +44 -0
- package/build/components/CompareTray/index.js +94 -0
- package/build/components/CompareTray/index.js.map +1 -0
- package/build/components/CompareTray/style.css +1 -0
- package/build/components/DataTable/index.cjs +1 -1
- package/build/components/DataTable/index.cjs.map +1 -1
- package/build/components/DataTable/index.d.cts +12 -0
- package/build/components/DataTable/index.d.ts +12 -0
- package/build/components/DataTable/index.js +120 -122
- package/build/components/DataTable/index.js.map +1 -1
- package/build/components/DataTable/style.css +1 -1
- package/build/components/Eyebrow/style.css +1 -1
- package/build/components/FacetSection/index.cjs +2 -0
- package/build/components/FacetSection/index.cjs.map +1 -0
- package/build/components/FacetSection/index.d.cts +75 -0
- package/build/components/FacetSection/index.d.ts +75 -0
- package/build/components/FacetSection/index.js +199 -0
- package/build/components/FacetSection/index.js.map +1 -0
- package/build/components/FacetSection/style.css +1 -0
- package/build/components/FacetSidebar/index.cjs +2 -0
- package/build/components/FacetSidebar/index.cjs.map +1 -0
- package/build/components/FacetSidebar/index.d.cts +35 -0
- package/build/components/FacetSidebar/index.d.ts +35 -0
- package/build/components/FacetSidebar/index.js +110 -0
- package/build/components/FacetSidebar/index.js.map +1 -0
- package/build/components/FacetSidebar/style.css +1 -0
- package/build/components/FilterToolbar/index.cjs +2 -0
- package/build/components/FilterToolbar/index.cjs.map +1 -0
- package/build/components/FilterToolbar/index.d.cts +55 -0
- package/build/components/FilterToolbar/index.d.ts +55 -0
- package/build/components/FilterToolbar/index.js +149 -0
- package/build/components/FilterToolbar/index.js.map +1 -0
- package/build/components/FilterToolbar/style.css +1 -0
- package/build/components/Gallery/index.cjs +1 -1
- package/build/components/Gallery/index.cjs.map +1 -1
- package/build/components/Gallery/index.d.cts +8 -1
- package/build/components/Gallery/index.d.ts +8 -1
- package/build/components/Gallery/index.js +146 -138
- package/build/components/Gallery/index.js.map +1 -1
- package/build/components/Gallery/style.css +1 -1
- package/build/components/MegaMenu/index.cjs +2 -0
- package/build/components/MegaMenu/index.cjs.map +1 -0
- package/build/components/MegaMenu/index.d.cts +67 -0
- package/build/components/MegaMenu/index.d.ts +67 -0
- package/build/components/MegaMenu/index.js +220 -0
- package/build/components/MegaMenu/index.js.map +1 -0
- package/build/components/MegaMenu/style.css +1 -0
- package/build/components/MoneyInput/index.cjs +1 -1
- package/build/components/MoneyInput/index.cjs.map +1 -1
- package/build/components/MoneyInput/index.js +10 -10
- package/build/components/MoneyInput/index.js.map +1 -1
- package/build/components/NotificationCenter/style.css +1 -1
- package/build/components/PageHeader/style.css +1 -1
- package/build/components/Popover/style.css +1 -1
- package/build/components/ProductCarousel/index.cjs +2 -0
- package/build/components/ProductCarousel/index.cjs.map +1 -0
- package/build/components/ProductCarousel/index.d.cts +35 -0
- package/build/components/ProductCarousel/index.d.ts +35 -0
- package/build/components/ProductCarousel/index.js +86 -0
- package/build/components/ProductCarousel/index.js.map +1 -0
- package/build/components/ProductCarousel/style.css +1 -0
- package/build/components/Radio/index.cjs +1 -1
- package/build/components/Radio/index.cjs.map +1 -1
- package/build/components/Radio/index.js +10 -10
- package/build/components/Radio/index.js.map +1 -1
- package/build/components/SectionHeader/index.cjs +1 -1
- package/build/components/SectionHeader/index.cjs.map +1 -1
- package/build/components/SectionHeader/index.js +4 -4
- package/build/components/SectionHeader/index.js.map +1 -1
- package/build/components/SectionHeader/style.css +1 -1
- package/build/components/SegmentedControl/index.cjs +1 -1
- package/build/components/SegmentedControl/index.cjs.map +1 -1
- package/build/components/SegmentedControl/index.js +23 -23
- package/build/components/SegmentedControl/index.js.map +1 -1
- package/build/components/Select/index.cjs +1 -1
- package/build/components/Select/index.cjs.map +1 -1
- package/build/components/Select/index.js +37 -37
- package/build/components/Select/index.js.map +1 -1
- package/build/components/Select/style.css +1 -1
- package/build/components/Skeleton/index.cjs +1 -1
- package/build/components/Skeleton/index.cjs.map +1 -1
- package/build/components/Skeleton/index.js +16 -16
- package/build/components/Skeleton/index.js.map +1 -1
- package/build/components/SortableList/index.cjs +2 -0
- package/build/components/SortableList/index.cjs.map +1 -0
- package/build/components/SortableList/index.d.cts +37 -0
- package/build/components/SortableList/index.d.ts +37 -0
- package/build/components/SortableList/index.js +159 -0
- package/build/components/SortableList/index.js.map +1 -0
- package/build/components/SortableList/style.css +1 -0
- package/build/components/Steps/index.cjs +1 -1
- package/build/components/Steps/index.cjs.map +1 -1
- package/build/components/Steps/index.d.cts +6 -0
- package/build/components/Steps/index.d.ts +6 -0
- package/build/components/Steps/index.js +37 -35
- package/build/components/Steps/index.js.map +1 -1
- package/build/components/Steps/style.css +1 -1
- package/build/components/StickyActionBar/index.cjs +2 -0
- package/build/components/StickyActionBar/index.cjs.map +1 -0
- package/build/components/StickyActionBar/index.d.cts +29 -0
- package/build/components/StickyActionBar/index.d.ts +29 -0
- package/build/components/StickyActionBar/index.js +57 -0
- package/build/components/StickyActionBar/index.js.map +1 -0
- package/build/components/StickyActionBar/style.css +1 -0
- package/build/components/Table/index.cjs +1 -1
- package/build/components/Table/index.cjs.map +1 -1
- package/build/components/Table/index.d.cts +6 -0
- package/build/components/Table/index.d.ts +6 -0
- package/build/components/Table/index.js +34 -32
- package/build/components/Table/index.js.map +1 -1
- package/build/components/Table/style.css +1 -1
- package/build/helpers/carousel.helper.cjs +2 -0
- package/build/helpers/carousel.helper.cjs.map +1 -0
- package/build/helpers/carousel.helper.d.cts +11 -0
- package/build/helpers/carousel.helper.d.ts +11 -0
- package/build/helpers/carousel.helper.js +10 -0
- package/build/helpers/carousel.helper.js.map +1 -0
- package/build/helpers/facet.helper.cjs +2 -0
- package/build/helpers/facet.helper.cjs.map +1 -0
- package/build/helpers/facet.helper.d.cts +6 -0
- package/build/helpers/facet.helper.d.ts +6 -0
- package/build/helpers/facet.helper.js +5 -0
- package/build/helpers/facet.helper.js.map +1 -0
- package/build/helpers/focus.helper.cjs +1 -1
- package/build/helpers/focus.helper.cjs.map +1 -1
- package/build/helpers/focus.helper.d.cts +2 -0
- package/build/helpers/focus.helper.d.ts +2 -0
- package/build/helpers/focus.helper.js +1 -0
- package/build/helpers/focus.helper.js.map +1 -1
- package/build/helpers/sortable.helper.cjs +2 -0
- package/build/helpers/sortable.helper.cjs.map +1 -0
- package/build/helpers/sortable.helper.d.cts +19 -0
- package/build/helpers/sortable.helper.d.ts +19 -0
- package/build/helpers/sortable.helper.js +20 -0
- package/build/helpers/sortable.helper.js.map +1 -0
- package/build/helpers/sticky-bar.helper.cjs +2 -0
- package/build/helpers/sticky-bar.helper.cjs.map +1 -0
- package/build/helpers/sticky-bar.helper.d.cts +6 -0
- package/build/helpers/sticky-bar.helper.d.ts +6 -0
- package/build/helpers/sticky-bar.helper.js +8 -0
- package/build/helpers/sticky-bar.helper.js.map +1 -0
- package/build/hooks/useRemovalFocus.cjs +2 -0
- package/build/hooks/useRemovalFocus.cjs.map +1 -0
- package/build/hooks/useRemovalFocus.d.cts +13 -0
- package/build/hooks/useRemovalFocus.d.ts +13 -0
- package/build/hooks/useRemovalFocus.js +21 -0
- package/build/hooks/useRemovalFocus.js.map +1 -0
- package/build/index.cjs +1 -1
- package/build/index.d.cts +13 -2
- package/build/index.d.ts +13 -2
- package/build/index.js +115 -93
- package/build/index.js.map +1 -1
- package/build/scss/_mixins.scss +3 -1
- package/build/styles.css +38 -14
- package/build/types/sortable.type.d.cts +12 -0
- package/build/types/sortable.type.d.ts +12 -0
- package/build/types/theme.type.d.cts +95 -0
- package/build/types/theme.type.d.ts +95 -0
- package/build/types/types/theme.type.d.cts +95 -0
- package/build/types/types/theme.type.d.ts +95 -0
- package/package.json +111 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/SortableList/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type KeyboardEvent,\n memo,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { GripVertical } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { moveItem, nearestIndex } from '../../helpers/sortable.helper';\nimport useAnnounce from '../../hooks/useAnnounce';\nimport { useUi } from '../../theme/context';\nimport type { SortableItemState } from '../../types/sortable.type';\nimport type { Formatter } from '../../types/theme.type';\n\nimport styles from './index.module.scss';\n\n/*\n * `SortableItemState` is what `renderItem` RECEIVES, not a prop: its `moveTo` is a function the list\n * hands out, so it lives with the other argument shapes (`types/`), away from the props' naming rules.\n */\nexport type { SortableItemState } from '../../types/sortable.type';\n\nexport type SortableListLabels = {\n instructions: string;\n handle: Formatter<[item: string]>;\n grabbed: Formatter<[item: string, position: number, total: number]>;\n moved: Formatter<[item: string, position: number, total: number]>;\n dropped: Formatter<[item: string, position: number, total: number]>;\n cancelled: Formatter<[item: string]>;\n};\n\ntype Props<T> = {\n items: T[];\n getKey: (item: T) => string;\n /** The item's name in the handle's label and the announcements (\"Ön yüz görseli\"). */\n getLabel: (item: T) => string;\n /** The new order, once a move is dropped; never called while dragging. */\n onReorder: (items: T[]) => void;\n renderItem: (item: T, state: SortableItemState) => ReactNode;\n /** The list's accessible name (\"Ürün görselleri\"). */\n label: string;\n /** `list` a column · `grid` a wrapping row of tiles (image order). */\n layout?: 'list' | 'grid';\n isDisabled?: boolean;\n labels?: Partial<SortableListLabels>;\n className?: string;\n testId?: string;\n};\n\ntype Drag = { key: string; mode: 'keyboard' | 'pointer'; from: number };\n\nconst KEY_STEP: Record<string, number> = {\n ArrowUp: -1,\n ArrowLeft: -1,\n ArrowDown: 1,\n ArrowRight: 1,\n};\n\n/**\n * A reorderable list (3.4) — image order and cover choice, a column order — moved by pointer drag\n * or by the keyboard on each item's handle (Space grabs, arrows move, Space drops, Escape cancels),\n * with every step announced. No library: the arithmetic is `helpers/sortable.helper.ts`.\n */\nconst SortableList = <T,>({\n items,\n getKey,\n getLabel,\n onReorder,\n renderItem,\n label,\n layout = 'list',\n isDisabled,\n labels: labelProps,\n className,\n testId,\n}: Props<T>) => {\n const { labels: config } = useUi();\n const text = config?.sortableList;\n const announce = useAnnounce();\n const instructionsId = useId();\n\n const [draft, setDraft] = useState<T[] | null>(null);\n const [drag, setDrag] = useState<Drag | null>(null);\n const draftRef = useRef<T[] | null>(null);\n const dragRef = useRef<Drag | null>(null);\n const itemRefs = useRef(new Map<string, HTMLLIElement>());\n const handleRefs = useRef(new Map<string, HTMLButtonElement>());\n\n const order = draft ?? items;\n const total = order.length;\n\n const format = <TArgs extends unknown[]>(\n key: Exclude<keyof SortableListLabels, 'instructions'>,\n ...args: TArgs\n ): string =>\n resolveFormatter(\n `SortableList.labels.${key}`,\n (labelProps?.[key] ?? text?.[key]) as Formatter<TArgs> | undefined,\n ...args,\n );\n\n const updateDraft = (next: T[] | null) => {\n draftRef.current = next;\n setDraft(next);\n };\n\n const startDrag = (next: Drag) => {\n dragRef.current = next;\n setDrag(next);\n updateDraft([...items]);\n };\n\n /* Ends a drag: drops (commit) or puts the order back (cancel). */\n const finish = (commit: boolean) => {\n const current = dragRef.current;\n const next = draftRef.current ?? items;\n dragRef.current = null;\n setDrag(null);\n updateDraft(null);\n /* A second pointer event can arrive before the listeners are gone. */\n if (!current) return;\n\n const position = next.findIndex(item => getKey(item) === current.key);\n const item = next[position];\n if (!commit) announce(format('cancelled', getLabel(item)), 'assertive');\n else if (position !== current.from) {\n onReorder(next);\n announce(format('dropped', getLabel(item), position + 1, next.length), 'assertive');\n }\n };\n /* The window listeners live across renders; they call the latest `finish`. */\n const finishRef = useRef(finish);\n finishRef.current = finish;\n\n /* A moved node loses focus in the browser: the keyboard drag puts it back on the handle. */\n useLayoutEffect(() => {\n if (drag?.mode === 'keyboard') handleRefs.current.get(drag.key)?.focus();\n }, [drag, draft]);\n\n /* Pointer drag: the window follows the pointer, so leaving the handle does not end the drag. */\n useEffect(() => {\n if (drag?.mode !== 'pointer') return;\n\n const handleMove = (event: PointerEvent) => {\n const current = draftRef.current;\n if (!current) return;\n\n /* Every item of the drawn order has its node: the draft is what is drawn. */\n const rects = current.map(item =>\n (itemRefs.current.get(getKey(item)) as HTMLLIElement).getBoundingClientRect(),\n );\n const target = nearestIndex(rects, event.clientX, event.clientY);\n const position = current.findIndex(item => getKey(item) === drag.key);\n if (target === -1 || target === position) return;\n\n const next = moveItem(current, position, target);\n draftRef.current = next;\n setDraft(next);\n };\n const handleUp = () => finishRef.current(true);\n const handleCancel = () => finishRef.current(false);\n const handleKey = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') finishRef.current(false);\n };\n\n window.addEventListener('pointermove', handleMove);\n window.addEventListener('pointerup', handleUp);\n window.addEventListener('pointercancel', handleCancel);\n window.addEventListener('keydown', handleKey);\n\n return () => {\n window.removeEventListener('pointermove', handleMove);\n window.removeEventListener('pointerup', handleUp);\n window.removeEventListener('pointercancel', handleCancel);\n window.removeEventListener('keydown', handleKey);\n };\n }, [drag, getKey]);\n\n const startPointer = (\n event: ReactPointerEvent<HTMLButtonElement>,\n key: string,\n index: number,\n ) => {\n if (event.button !== 0 || drag) return;\n /* No text selection and no page scroll under the finger while dragging. */\n event.preventDefault();\n startDrag({ key, mode: 'pointer', from: index });\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>, item: T, index: number) => {\n const key = getKey(item);\n const isGrabbed = drag?.key === key && drag.mode === 'keyboard';\n\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n if (isGrabbed) {\n finish(true);\n return;\n }\n if (drag) return;\n startDrag({ key, mode: 'keyboard', from: index });\n announce(format('grabbed', getLabel(item), index + 1, items.length), 'assertive');\n return;\n }\n\n if (!isGrabbed) return;\n\n if (event.key === 'Escape') {\n event.preventDefault();\n finish(false);\n return;\n }\n if (event.key === 'Tab') {\n finish(true);\n return;\n }\n\n const target =\n event.key === 'Home'\n ? 0\n : event.key === 'End'\n ? total - 1\n : event.key in KEY_STEP\n ? index + KEY_STEP[event.key]\n : null;\n if (target === null) return;\n\n event.preventDefault();\n const clamped = Math.max(0, Math.min(total - 1, target));\n if (clamped === index) return;\n\n updateDraft(moveItem(order, index, clamped));\n announce(format('moved', getLabel(item), clamped + 1, total), 'assertive');\n };\n\n const moveTo = (index: number, target: number) => {\n const clamped = Math.max(0, Math.min(items.length - 1, target));\n if (drag || clamped === index) return;\n\n const next = moveItem(items, index, clamped);\n onReorder(next);\n announce(format('dropped', getLabel(items[index]), clamped + 1, next.length), 'assertive');\n };\n\n const instructions = resolveLabel(\n 'SortableList.labels.instructions',\n labelProps?.instructions,\n text?.instructions,\n );\n\n return (\n <>\n <ul\n className={cx(\n styles.list,\n styles[`list--${layout}`],\n drag && styles['list--active'],\n className,\n )}\n aria-label={label}\n data-testid={testId}\n >\n {order.map((item, index) => {\n const key = getKey(item);\n const isDragging = drag?.key === key;\n\n const handle = (\n <button\n ref={node => {\n if (node) handleRefs.current.set(key, node);\n else handleRefs.current.delete(key);\n }}\n type=\"button\"\n className={styles.handle}\n aria-label={format('handle', getLabel(item))}\n aria-describedby={instructionsId}\n aria-pressed={isDragging && drag.mode === 'keyboard'}\n disabled={isDisabled}\n onKeyDown={event => handleKeyDown(event, item, index)}\n onPointerDown={event => startPointer(event, key, index)}\n >\n <GripVertical aria-hidden />\n </button>\n );\n\n return (\n <li\n key={key}\n ref={node => {\n if (node) itemRefs.current.set(key, node);\n else itemRefs.current.delete(key);\n }}\n className={cx(styles.item, isDragging && styles['item--dragging'])}\n >\n {renderItem(item, {\n index,\n isDragging,\n handle,\n moveTo: target => moveTo(index, target),\n })}\n </li>\n );\n })}\n </ul>\n <span id={instructionsId} hidden>\n {instructions}\n </span>\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(SortableList, 'SortableList'),\n) as typeof SortableList;\n"],"names":["KEY_STEP","SortableList","items","getKey","getLabel","onReorder","renderItem","label","layout","isDisabled","labelProps","className","testId","config","useUi","text","announce","useAnnounce","instructionsId","useId","draft","setDraft","useState","drag","setDrag","draftRef","useRef","dragRef","itemRefs","handleRefs","order","total","format","key","args","resolveFormatter","updateDraft","next","startDrag","finish","commit","current","position","item","finishRef","useLayoutEffect","_a","useEffect","handleMove","event","rects","target","nearestIndex","moveItem","handleUp","handleCancel","handleKey","startPointer","index","handleKeyDown","isGrabbed","clamped","moveTo","instructions","resolveLabel","jsxs","Fragment","jsx","cx","styles","isDragging","handle","node","GripVertical","memo","named"],"mappings":";;;;;;;;;;;AA6DA,MAAMA,IAAmC;AAAA,EACvC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AACd,GAOMC,KAAe,CAAK;AAAA,EACxB,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,YAAAC;AAAA,EACA,QAAQC;AAAA,EACR,WAAAC;AAAA,EACA,QAAAC;AACF,MAAgB;AACd,QAAM,EAAE,QAAQC,EAAA,IAAWC,GAAA,GACrBC,IAAOF,KAAA,gBAAAA,EAAQ,cACfG,IAAWC,GAAA,GACXC,IAAiBC,GAAA,GAEjB,CAACC,GAAOC,CAAQ,IAAIC,EAAqB,IAAI,GAC7C,CAACC,GAAMC,CAAO,IAAIF,EAAsB,IAAI,GAC5CG,IAAWC,EAAmB,IAAI,GAClCC,IAAUD,EAAoB,IAAI,GAClCE,IAA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gBAAAS,EAACM,IAAA,EAAa,eAAW,GAAA,CAAC;AAAA,YAAA;AAAA,UAAA;AAI9B,iBACE,gBAAAN;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,KAAK,CAAAK,MAAQ;AACX,gBAAIA,IAAM5C,EAAS,QAAQ,IAAIK,GAAKuC,CAAI,IACnC5C,EAAS,QAAQ,OAAOK,CAAG;AAAA,cAClC;AAAA,cACA,WAAWmC,EAAGC,EAAO,MAAMC,KAAcD,EAAO,gBAAgB,CAAC;AAAA,cAEhE,YAAW1B,GAAM;AAAA,gBAChB,OAAAe;AAAA,gBACA,YAAAY;AAAA,gBACA,QAAAC;AAAA,gBACA,QAAQ,CAAApB,MAAUW,EAAOJ,GAAOP,CAAM;AAAA,cAAA,CACvC;AAAA,YAAA;AAAA,YAZIlB;AAAA,UAAA;AAAA,QAeX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEF,QAAA,EAAK,IAAIf,GAAgB,QAAM,IAC7B,UAAA6C,EAAA,CACH;AAAA,EAAA,GACF;AAEJ,GAEAL,KAA6B,gBAAAgB;AAAA,EACb,gBAAAC,GAAM1E,IAAc,cAAc;AAClD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer ui{.ui-list-1KyzN{margin:0;padding:0;list-style:none}.ui-list--list-BtuYQ{display:flex;flex-direction:column;gap:var(--hd-space-2)}.ui-list--grid-6UfQL{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--ui-sortable-tile, 120px),1fr));gap:var(--hd-space-3)}.ui-list--active-YMeRz{-webkit-user-select:none;user-select:none}.ui-item-pNT71{position:relative;min-width:0;border-radius:var(--hd-radius-md);transition:box-shadow var(--hd-duration-fast) var(--hd-ease-standard)}.ui-item--dragging-F0gl0{z-index:var(--hd-z-raised);box-shadow:var(--hd-shadow-2)}@media (prefers-reduced-motion: reduce){.ui-item-pNT71{transition:none}}.ui-handle-X6q4J{position:relative}.ui-handle-X6q4J:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:max(100%,44px);height:max(100%,44px)}.ui-handle-X6q4J{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:var(--hd-radius-sm);color:var(--hd-text-2);font-size:16px;cursor:grab;touch-action:none;background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-handle-X6q4J:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-handle-X6q4J: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-handle-X6q4J{transition:none}.ui-handle-X6q4J:active:not(:disabled):not([aria-disabled=true]){translate:none}}.ui-handle-X6q4J: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--dragging-F0gl0 .ui-handle-X6q4J{cursor:grabbing}.ui-handle-X6q4J[aria-pressed=true]{background-color:var(--hd-primary-soft);color:var(--hd-primary-text)}.ui-handle-X6q4J:disabled{cursor:not-allowed;color:var(--hd-text-3)}@media (forced-colors: active){.ui-handle-X6q4J:disabled{color:GrayText}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),x=require("react"),N=require("react-bootstrap-icons"),p=require("../../helpers/class-name.helper.cjs"),q=require("../../helpers/component.helper.cjs"),g=require("../../helpers/label.helper.cjs"),v=require("../../theme/context.cjs"),e={default:{"steps":"ui-steps-ntge1","steps--horizontal":"ui-steps--horizontal-O-mkx","steps--vertical":"ui-steps--vertical-agfwo","steps--static":"ui-steps--static-t9EED","steps__label":"ui-steps__label-NSeFM","steps__item":"ui-steps__item-GrU1x","steps__button":"ui-steps__button-XBsnS","steps__marker":"ui-steps__marker-g-GLE","steps__item--done":"ui-steps__item--done-mvOuN","steps__item--current":"ui-steps__item--current-Qzlal","steps__text":"ui-steps__text-Mkpkh","steps__description":"ui-steps__description-bQuNT","steps__status":"ui-steps__status-wWJfP","steps--mobile-row":"ui-steps--mobile-row-urJcY"}},y=(r,a)=>r<a?"done":r===a?"current":"upcoming",m={done:"completed",current:"current",upcoming:"upcoming"},T=({steps:r,currentIndex:a,onStepClick:l,label:_,orientation:u="horizontal",mobileLayout:f="stack",className:h,testId:b})=>{const{labels:c}=v.useUi();return s.jsx("ol",{className:p.cx(e.default.steps,e.default[`steps--${u}`],u==="horizontal"&&f==="row"&&e.default["steps--mobile-row"],a===void 0&&e.default["steps--static"],h),"aria-label":_,"data-testid":b,children:r.map((n,o)=>{var d;const t=a===void 0?void 0:y(o,a),j=!!l&&t==="done",i=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.default.steps__marker,"aria-hidden":!0,children:t==="done"?s.jsx(N.CheckLg,{}):o+1}),s.jsxs("span",{className:e.default.steps__text,children:[s.jsx("span",{className:e.default.steps__label,children:n.label}),n.description&&s.jsx("span",{className:e.default.steps__description,children:n.description})]}),t&&s.jsx("span",{className:e.default.steps__status,children:g.resolveLabel(`Steps.${m[t]}`,(d=c==null?void 0:c.steps)==null?void 0:d[m[t]])})]});return s.jsx("li",{className:p.cx(e.default.steps__item,t&&e.default[`steps__item--${t}`]),"aria-current":t==="current"?"step":void 0,children:j?s.jsx("button",{type:"button",className:e.default.steps__button,onClick:()=>l==null?void 0:l(o),children:i}):s.jsx("span",{className:e.default.steps__button,children:i})},n.id)})})},$=x.memo(q.named(T,"Steps"));exports.default=$;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Steps/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { CheckLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\n\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\nexport type StepItem = {\n id: string;\n label: string;\n /** Etiketin altındaki bir cümlelik açıklama. */\n description?: ReactNode;\n};\n\ntype Props = {\n steps: StepItem[];\n /** Bulunulan adımın DİZİNİ (0 tabanlı). */\n currentIndex?: number;\n /** Bir adıma dönülebiliyorsa verilir. */\n onStepClick?: (index: number) => void;\n /** Akışın erişilebilir adı (\"Ödeme adımları\"). */\n label: string;\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n testId?: string;\n};\n\n/** Bir adımın durumu — üçü de görsel olarak AYRI çizilir. */\nconst statusOf = (index: number, currentIndex: number): 'done' | 'current' | 'upcoming' => {\n if (index < currentIndex) return 'done';\n if (index === currentIndex) return 'current';\n return 'upcoming';\n};\n\n/*\n * ⚠ DURUM METNI SR-ONLY ve SAGLAYICIDAN gelir; gorsel isaret (tik, dolu daire) ekran okuyucuya\n * hicbir sey soylemiyor.\n */\nconst STATUS_KEY: Record<'done' | 'current' | 'upcoming', 'completed' | 'current' | 'upcoming'> = {\n done: 'completed',\n current: 'current',\n upcoming: 'upcoming',\n};\n\n/** Adım göstergesi (stepper) — çok adımlı akışta NEREDE olunduğu. */\nconst Steps: FC<Props> = ({\n steps,\n currentIndex,\n onStepClick,\n label,\n orientation = 'horizontal',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n\n return (\n <ol\n className={cx(\n styles.steps,\n styles[`steps--${orientation}`],\n currentIndex === undefined && styles['steps--static'],\n className,\n )}\n aria-label={label}\n data-testid={testId}\n >\n {steps.map((step, index) => {\n /* Statik listede durum kavrami YOK — hicbir adim \"bulunulan\" degil. */\n const status = currentIndex === undefined ? undefined : statusOf(index, currentIndex);\n /* Ileri atlamak YOK: atlanan adimin verisi toplanmadan devam edilemez. */\n const isClickable = Boolean(onStepClick) && status === 'done';\n\n const body = (\n <>\n <span className={styles.steps__marker} aria-hidden>\n {status === 'done' ? <CheckLg /> : index + 1}\n </span>\n\n <span className={styles.steps__text}>\n <span className={styles.steps__label}>{step.label}</span>\n {step.description && (\n <span className={styles.steps__description}>{step.description}</span>\n )}\n </span>\n\n {/* Durum METIN olarak da okunur: gorsel isaret ekran okuyucuya\n gecmiyor ve `aria-current` yalnizca bulunulan adimi soyluyor. */}\n {status && (\n <span className={styles.steps__status}>\n {resolveLabel(`Steps.${STATUS_KEY[status]}`, labels?.steps?.[STATUS_KEY[status]])}\n </span>\n )}\n </>\n );\n\n return (\n <li\n key={step.id}\n className={cx(styles.steps__item, status && styles[`steps__item--${status}`])}\n aria-current={status === 'current' ? 'step' : undefined}\n >\n {isClickable ? (\n <button\n type=\"button\"\n className={styles.steps__button}\n onClick={() => onStepClick?.(index)}\n >\n {body}\n </button>\n ) : (\n <span className={styles.steps__button}>{body}</span>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Steps, 'Steps')) as typeof Steps;\n"],"names":["statusOf","index","currentIndex","STATUS_KEY","Steps","steps","onStepClick","label","orientation","className","testId","labels","useUi","jsx","cx","styles","step","status","isClickable","body","jsxs","Fragment","CheckLg","_a","memo","named"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Steps/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { CheckLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\n\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\nexport type StepItem = {\n id: string;\n label: string;\n /** Etiketin altındaki bir cümlelik açıklama. */\n description?: ReactNode;\n};\n\ntype Props = {\n steps: StepItem[];\n /** Bulunulan adımın DİZİNİ (0 tabanlı). */\n currentIndex?: number;\n /** Bir adıma dönülebiliyorsa verilir. */\n onStepClick?: (index: number) => void;\n /** Akışın erişilebilir adı (\"Ödeme adımları\"). */\n label: string;\n orientation?: 'horizontal' | 'vertical';\n /**\n * A horizontal stepper on a phone (3.4): `stack` lists the steps under each other (default);\n * `row` keeps them on one line — numbered markers joined by lines, only the current step's label\n * written (the others are still read). A checkout's \"Cart → Delivery → Payment → Done\".\n */\n mobileLayout?: 'stack' | 'row';\n className?: string;\n testId?: string;\n};\n\n/** Bir adımın durumu — üçü de görsel olarak AYRI çizilir. */\nconst statusOf = (index: number, currentIndex: number): 'done' | 'current' | 'upcoming' => {\n if (index < currentIndex) return 'done';\n if (index === currentIndex) return 'current';\n return 'upcoming';\n};\n\n/*\n * ⚠ DURUM METNI SR-ONLY ve SAGLAYICIDAN gelir; gorsel isaret (tik, dolu daire) ekran okuyucuya\n * hicbir sey soylemiyor.\n */\nconst STATUS_KEY: Record<'done' | 'current' | 'upcoming', 'completed' | 'current' | 'upcoming'> = {\n done: 'completed',\n current: 'current',\n upcoming: 'upcoming',\n};\n\n/** Adım göstergesi (stepper) — çok adımlı akışta NEREDE olunduğu. */\nconst Steps: FC<Props> = ({\n steps,\n currentIndex,\n onStepClick,\n label,\n orientation = 'horizontal',\n mobileLayout = 'stack',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n\n return (\n <ol\n className={cx(\n styles.steps,\n styles[`steps--${orientation}`],\n orientation === 'horizontal' && mobileLayout === 'row' && styles['steps--mobile-row'],\n currentIndex === undefined && styles['steps--static'],\n className,\n )}\n aria-label={label}\n data-testid={testId}\n >\n {steps.map((step, index) => {\n /* Statik listede durum kavrami YOK — hicbir adim \"bulunulan\" degil. */\n const status = currentIndex === undefined ? undefined : statusOf(index, currentIndex);\n /* Ileri atlamak YOK: atlanan adimin verisi toplanmadan devam edilemez. */\n const isClickable = Boolean(onStepClick) && status === 'done';\n\n const body = (\n <>\n <span className={styles.steps__marker} aria-hidden>\n {status === 'done' ? <CheckLg /> : index + 1}\n </span>\n\n <span className={styles.steps__text}>\n <span className={styles.steps__label}>{step.label}</span>\n {step.description && (\n <span className={styles.steps__description}>{step.description}</span>\n )}\n </span>\n\n {/* Durum METIN olarak da okunur: gorsel isaret ekran okuyucuya\n gecmiyor ve `aria-current` yalnizca bulunulan adimi soyluyor. */}\n {status && (\n <span className={styles.steps__status}>\n {resolveLabel(`Steps.${STATUS_KEY[status]}`, labels?.steps?.[STATUS_KEY[status]])}\n </span>\n )}\n </>\n );\n\n return (\n <li\n key={step.id}\n className={cx(styles.steps__item, status && styles[`steps__item--${status}`])}\n aria-current={status === 'current' ? 'step' : undefined}\n >\n {isClickable ? (\n <button\n type=\"button\"\n className={styles.steps__button}\n onClick={() => onStepClick?.(index)}\n >\n {body}\n </button>\n ) : (\n <span className={styles.steps__button}>{body}</span>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Steps, 'Steps')) as typeof Steps;\n"],"names":["statusOf","index","currentIndex","STATUS_KEY","Steps","steps","onStepClick","label","orientation","mobileLayout","className","testId","labels","useUi","jsx","cx","styles","step","status","isClickable","body","jsxs","Fragment","CheckLg","_a","memo","named"],"mappings":"2aAwCMA,EAAW,CAACC,EAAeC,IAC3BD,EAAQC,EAAqB,OAC7BD,IAAUC,EAAqB,UAC5B,WAOHC,EAA4F,CAChG,KAAM,YACN,QAAS,UACT,SAAU,UACZ,EAGMC,EAAmB,CAAC,CACxB,MAAAC,EACA,aAAAH,EACA,YAAAI,EACA,MAAAC,EACA,YAAAC,EAAc,aACd,aAAAC,EAAe,QACf,UAAAC,EACA,OAAAC,CACF,IAAM,CACJ,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EAEnB,OACEC,EAAAA,IAAC,KAAA,CACC,UAAWC,EAAAA,GACTC,EAAAA,QAAO,MACPA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AE5B,SAAAmB,CAAA,CAAA,EAGHN,EAAAA,IAAC,OAAA,CAAK,UAAWE,EAAAA,QAAO,cAAgB,SAAAI,CAAA,CAAK,CAAA,EAb1CH,EAAK,EAAA,CAiBhB,CAAC,CAAA,CAAA,CAGP,EAEAhB,EAA6BwB,OAAmBC,EAAAA,MAAMtB,EAAO,OAAO,CAAC"}
|
|
@@ -14,6 +14,12 @@ type Props = {
|
|
|
14
14
|
/** Akışın erişilebilir adı ("Ödeme adımları"). */
|
|
15
15
|
label: string;
|
|
16
16
|
orientation?: 'horizontal' | 'vertical';
|
|
17
|
+
/**
|
|
18
|
+
* A horizontal stepper on a phone (3.4): `stack` lists the steps under each other (default);
|
|
19
|
+
* `row` keeps them on one line — numbered markers joined by lines, only the current step's label
|
|
20
|
+
* written (the others are still read). A checkout's "Cart → Delivery → Payment → Done".
|
|
21
|
+
*/
|
|
22
|
+
mobileLayout?: 'stack' | 'row';
|
|
17
23
|
className?: string;
|
|
18
24
|
testId?: string;
|
|
19
25
|
};
|
|
@@ -14,6 +14,12 @@ type Props = {
|
|
|
14
14
|
/** Akışın erişilebilir adı ("Ödeme adımları"). */
|
|
15
15
|
label: string;
|
|
16
16
|
orientation?: 'horizontal' | 'vertical';
|
|
17
|
+
/**
|
|
18
|
+
* A horizontal stepper on a phone (3.4): `stack` lists the steps under each other (default);
|
|
19
|
+
* `row` keeps them on one line — numbered markers joined by lines, only the current step's label
|
|
20
|
+
* written (the others are still read). A checkout's "Cart → Delivery → Payment → Done".
|
|
21
|
+
*/
|
|
22
|
+
mobileLayout?: 'stack' | 'row';
|
|
17
23
|
className?: string;
|
|
18
24
|
testId?: string;
|
|
19
25
|
};
|
|
@@ -1,69 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { CheckLg as
|
|
5
|
-
import { cx as
|
|
6
|
-
import { named as
|
|
7
|
-
import { resolveLabel as
|
|
8
|
-
import { useUi as
|
|
9
|
-
const s = {"steps":"ui-steps-ntge1","steps--horizontal":"ui-steps--horizontal-O-mkx","steps--vertical":"ui-steps--vertical-agfwo","steps--static":"ui-steps--static-t9EED","steps__label":"ui-steps__label-NSeFM","steps__item":"ui-steps__item-GrU1x","steps__button":"ui-steps__button-XBsnS","steps__marker":"ui-steps__marker-g-GLE","steps__item--done":"ui-steps__item--done-mvOuN","steps__item--current":"ui-steps__item--current-Qzlal","steps__text":"ui-steps__text-Mkpkh","steps__description":"ui-steps__description-bQuNT","steps__status":"ui-steps__status-wWJfP"};
|
|
10
|
-
const
|
|
2
|
+
import { jsx as t, jsxs as d, Fragment as v } from "react/jsx-runtime";
|
|
3
|
+
import { memo as y } from "react";
|
|
4
|
+
import { CheckLg as $ } from "react-bootstrap-icons";
|
|
5
|
+
import { cx as u } from "../../helpers/class-name.helper.js";
|
|
6
|
+
import { named as j } from "../../helpers/component.helper.js";
|
|
7
|
+
import { resolveLabel as w } from "../../helpers/label.helper.js";
|
|
8
|
+
import { useUi as z } from "../../theme/context.js";
|
|
9
|
+
const s = {"steps":"ui-steps-ntge1","steps--horizontal":"ui-steps--horizontal-O-mkx","steps--vertical":"ui-steps--vertical-agfwo","steps--static":"ui-steps--static-t9EED","steps__label":"ui-steps__label-NSeFM","steps__item":"ui-steps__item-GrU1x","steps__button":"ui-steps__button-XBsnS","steps__marker":"ui-steps__marker-g-GLE","steps__item--done":"ui-steps__item--done-mvOuN","steps__item--current":"ui-steps__item--current-Qzlal","steps__text":"ui-steps__text-Mkpkh","steps__description":"ui-steps__description-bQuNT","steps__status":"ui-steps__status-wWJfP","steps--mobile-row":"ui-steps--mobile-row-urJcY"};
|
|
10
|
+
const L = (o, r) => o < r ? "done" : o === r ? "current" : "upcoming", _ = {
|
|
11
11
|
done: "completed",
|
|
12
12
|
current: "current",
|
|
13
13
|
upcoming: "upcoming"
|
|
14
|
-
},
|
|
15
|
-
steps:
|
|
14
|
+
}, T = ({
|
|
15
|
+
steps: o,
|
|
16
16
|
currentIndex: r,
|
|
17
|
-
onStepClick:
|
|
18
|
-
label:
|
|
19
|
-
orientation:
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
onStepClick: a,
|
|
18
|
+
label: h,
|
|
19
|
+
orientation: m = "horizontal",
|
|
20
|
+
mobileLayout: f = "stack",
|
|
21
|
+
className: b,
|
|
22
|
+
testId: N
|
|
22
23
|
}) => {
|
|
23
|
-
const { labels: n } =
|
|
24
|
+
const { labels: n } = z();
|
|
24
25
|
return /* @__PURE__ */ t(
|
|
25
26
|
"ol",
|
|
26
27
|
{
|
|
27
|
-
className:
|
|
28
|
+
className: u(
|
|
28
29
|
s.steps,
|
|
29
|
-
s[`steps--${
|
|
30
|
+
s[`steps--${m}`],
|
|
31
|
+
m === "horizontal" && f === "row" && s["steps--mobile-row"],
|
|
30
32
|
r === void 0 && s["steps--static"],
|
|
31
|
-
|
|
33
|
+
b
|
|
32
34
|
),
|
|
33
|
-
"aria-label":
|
|
34
|
-
"data-testid":
|
|
35
|
-
children:
|
|
36
|
-
var
|
|
37
|
-
const e = r === void 0 ? void 0 :
|
|
38
|
-
/* @__PURE__ */ t("span", { className: s.steps__marker, "aria-hidden": !0, children: e === "done" ? /* @__PURE__ */ t(
|
|
39
|
-
/* @__PURE__ */
|
|
35
|
+
"aria-label": h,
|
|
36
|
+
"data-testid": N,
|
|
37
|
+
children: o.map((i, c) => {
|
|
38
|
+
var l;
|
|
39
|
+
const e = r === void 0 ? void 0 : L(c, r), g = !!a && e === "done", p = /* @__PURE__ */ d(v, { children: [
|
|
40
|
+
/* @__PURE__ */ t("span", { className: s.steps__marker, "aria-hidden": !0, children: e === "done" ? /* @__PURE__ */ t($, {}) : c + 1 }),
|
|
41
|
+
/* @__PURE__ */ d("span", { className: s.steps__text, children: [
|
|
40
42
|
/* @__PURE__ */ t("span", { className: s.steps__label, children: i.label }),
|
|
41
43
|
i.description && /* @__PURE__ */ t("span", { className: s.steps__description, children: i.description })
|
|
42
44
|
] }),
|
|
43
|
-
e && /* @__PURE__ */ t("span", { className: s.steps__status, children:
|
|
45
|
+
e && /* @__PURE__ */ t("span", { className: s.steps__status, children: w(`Steps.${_[e]}`, (l = n == null ? void 0 : n.steps) == null ? void 0 : l[_[e]]) })
|
|
44
46
|
] });
|
|
45
47
|
return /* @__PURE__ */ t(
|
|
46
48
|
"li",
|
|
47
49
|
{
|
|
48
|
-
className:
|
|
50
|
+
className: u(s.steps__item, e && s[`steps__item--${e}`]),
|
|
49
51
|
"aria-current": e === "current" ? "step" : void 0,
|
|
50
|
-
children:
|
|
52
|
+
children: g ? /* @__PURE__ */ t(
|
|
51
53
|
"button",
|
|
52
54
|
{
|
|
53
55
|
type: "button",
|
|
54
56
|
className: s.steps__button,
|
|
55
|
-
onClick: () =>
|
|
56
|
-
children:
|
|
57
|
+
onClick: () => a == null ? void 0 : a(c),
|
|
58
|
+
children: p
|
|
57
59
|
}
|
|
58
|
-
) : /* @__PURE__ */ t("span", { className: s.steps__button, children:
|
|
60
|
+
) : /* @__PURE__ */ t("span", { className: s.steps__button, children: p })
|
|
59
61
|
},
|
|
60
62
|
i.id
|
|
61
63
|
);
|
|
62
64
|
})
|
|
63
65
|
}
|
|
64
66
|
);
|
|
65
|
-
},
|
|
67
|
+
}, k = /* @__PURE__ */ y(/* @__PURE__ */ j(T, "Steps"));
|
|
66
68
|
export {
|
|
67
|
-
|
|
69
|
+
k as default
|
|
68
70
|
};
|
|
69
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Steps/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { CheckLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\n\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\nexport type StepItem = {\n id: string;\n label: string;\n /** Etiketin altındaki bir cümlelik açıklama. */\n description?: ReactNode;\n};\n\ntype Props = {\n steps: StepItem[];\n /** Bulunulan adımın DİZİNİ (0 tabanlı). */\n currentIndex?: number;\n /** Bir adıma dönülebiliyorsa verilir. */\n onStepClick?: (index: number) => void;\n /** Akışın erişilebilir adı (\"Ödeme adımları\"). */\n label: string;\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n testId?: string;\n};\n\n/** Bir adımın durumu — üçü de görsel olarak AYRI çizilir. */\nconst statusOf = (index: number, currentIndex: number): 'done' | 'current' | 'upcoming' => {\n if (index < currentIndex) return 'done';\n if (index === currentIndex) return 'current';\n return 'upcoming';\n};\n\n/*\n * ⚠ DURUM METNI SR-ONLY ve SAGLAYICIDAN gelir; gorsel isaret (tik, dolu daire) ekran okuyucuya\n * hicbir sey soylemiyor.\n */\nconst STATUS_KEY: Record<'done' | 'current' | 'upcoming', 'completed' | 'current' | 'upcoming'> = {\n done: 'completed',\n current: 'current',\n upcoming: 'upcoming',\n};\n\n/** Adım göstergesi (stepper) — çok adımlı akışta NEREDE olunduğu. */\nconst Steps: FC<Props> = ({\n steps,\n currentIndex,\n onStepClick,\n label,\n orientation = 'horizontal',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n\n return (\n <ol\n className={cx(\n styles.steps,\n styles[`steps--${orientation}`],\n currentIndex === undefined && styles['steps--static'],\n className,\n )}\n aria-label={label}\n data-testid={testId}\n >\n {steps.map((step, index) => {\n /* Statik listede durum kavrami YOK — hicbir adim \"bulunulan\" degil. */\n const status = currentIndex === undefined ? undefined : statusOf(index, currentIndex);\n /* Ileri atlamak YOK: atlanan adimin verisi toplanmadan devam edilemez. */\n const isClickable = Boolean(onStepClick) && status === 'done';\n\n const body = (\n <>\n <span className={styles.steps__marker} aria-hidden>\n {status === 'done' ? <CheckLg /> : index + 1}\n </span>\n\n <span className={styles.steps__text}>\n <span className={styles.steps__label}>{step.label}</span>\n {step.description && (\n <span className={styles.steps__description}>{step.description}</span>\n )}\n </span>\n\n {/* Durum METIN olarak da okunur: gorsel isaret ekran okuyucuya\n gecmiyor ve `aria-current` yalnizca bulunulan adimi soyluyor. */}\n {status && (\n <span className={styles.steps__status}>\n {resolveLabel(`Steps.${STATUS_KEY[status]}`, labels?.steps?.[STATUS_KEY[status]])}\n </span>\n )}\n </>\n );\n\n return (\n <li\n key={step.id}\n className={cx(styles.steps__item, status && styles[`steps__item--${status}`])}\n aria-current={status === 'current' ? 'step' : undefined}\n >\n {isClickable ? (\n <button\n type=\"button\"\n className={styles.steps__button}\n onClick={() => onStepClick?.(index)}\n >\n {body}\n </button>\n ) : (\n <span className={styles.steps__button}>{body}</span>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Steps, 'Steps')) as typeof Steps;\n"],"names":["statusOf","index","currentIndex","STATUS_KEY","Steps","steps","onStepClick","label","orientation","className","testId","labels","useUi","jsx","cx","styles","step","status","isClickable","body","jsxs","Fragment","CheckLg","_a","memo","named"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Steps/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { CheckLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\n\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\nexport type StepItem = {\n id: string;\n label: string;\n /** Etiketin altındaki bir cümlelik açıklama. */\n description?: ReactNode;\n};\n\ntype Props = {\n steps: StepItem[];\n /** Bulunulan adımın DİZİNİ (0 tabanlı). */\n currentIndex?: number;\n /** Bir adıma dönülebiliyorsa verilir. */\n onStepClick?: (index: number) => void;\n /** Akışın erişilebilir adı (\"Ödeme adımları\"). */\n label: string;\n orientation?: 'horizontal' | 'vertical';\n /**\n * A horizontal stepper on a phone (3.4): `stack` lists the steps under each other (default);\n * `row` keeps them on one line — numbered markers joined by lines, only the current step's label\n * written (the others are still read). A checkout's \"Cart → Delivery → Payment → Done\".\n */\n mobileLayout?: 'stack' | 'row';\n className?: string;\n testId?: string;\n};\n\n/** Bir adımın durumu — üçü de görsel olarak AYRI çizilir. */\nconst statusOf = (index: number, currentIndex: number): 'done' | 'current' | 'upcoming' => {\n if (index < currentIndex) return 'done';\n if (index === currentIndex) return 'current';\n return 'upcoming';\n};\n\n/*\n * ⚠ DURUM METNI SR-ONLY ve SAGLAYICIDAN gelir; gorsel isaret (tik, dolu daire) ekran okuyucuya\n * hicbir sey soylemiyor.\n */\nconst STATUS_KEY: Record<'done' | 'current' | 'upcoming', 'completed' | 'current' | 'upcoming'> = {\n done: 'completed',\n current: 'current',\n upcoming: 'upcoming',\n};\n\n/** Adım göstergesi (stepper) — çok adımlı akışta NEREDE olunduğu. */\nconst Steps: FC<Props> = ({\n steps,\n currentIndex,\n onStepClick,\n label,\n orientation = 'horizontal',\n mobileLayout = 'stack',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n\n return (\n <ol\n className={cx(\n styles.steps,\n styles[`steps--${orientation}`],\n orientation === 'horizontal' && mobileLayout === 'row' && styles['steps--mobile-row'],\n currentIndex === undefined && styles['steps--static'],\n className,\n )}\n aria-label={label}\n data-testid={testId}\n >\n {steps.map((step, index) => {\n /* Statik listede durum kavrami YOK — hicbir adim \"bulunulan\" degil. */\n const status = currentIndex === undefined ? undefined : statusOf(index, currentIndex);\n /* Ileri atlamak YOK: atlanan adimin verisi toplanmadan devam edilemez. */\n const isClickable = Boolean(onStepClick) && status === 'done';\n\n const body = (\n <>\n <span className={styles.steps__marker} aria-hidden>\n {status === 'done' ? <CheckLg /> : index + 1}\n </span>\n\n <span className={styles.steps__text}>\n <span className={styles.steps__label}>{step.label}</span>\n {step.description && (\n <span className={styles.steps__description}>{step.description}</span>\n )}\n </span>\n\n {/* Durum METIN olarak da okunur: gorsel isaret ekran okuyucuya\n gecmiyor ve `aria-current` yalnizca bulunulan adimi soyluyor. */}\n {status && (\n <span className={styles.steps__status}>\n {resolveLabel(`Steps.${STATUS_KEY[status]}`, labels?.steps?.[STATUS_KEY[status]])}\n </span>\n )}\n </>\n );\n\n return (\n <li\n key={step.id}\n className={cx(styles.steps__item, status && styles[`steps__item--${status}`])}\n aria-current={status === 'current' ? 'step' : undefined}\n >\n {isClickable ? (\n <button\n type=\"button\"\n className={styles.steps__button}\n onClick={() => onStepClick?.(index)}\n >\n {body}\n </button>\n ) : (\n <span className={styles.steps__button}>{body}</span>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Steps, 'Steps')) as typeof Steps;\n"],"names":["statusOf","index","currentIndex","STATUS_KEY","Steps","steps","onStepClick","label","orientation","mobileLayout","className","testId","labels","useUi","jsx","cx","styles","step","status","isClickable","body","jsxs","Fragment","CheckLg","_a","memo","named"],"mappings":";;;;;;;;;AAwCA,MAAMA,IAAW,CAACC,GAAeC,MAC3BD,IAAQC,IAAqB,SAC7BD,MAAUC,IAAqB,YAC5B,YAOHC,IAA4F;AAAA,EAChG,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,GAGMC,IAAmB,CAAC;AAAA,EACxB,OAAAC;AAAA,EACA,cAAAH;AAAA,EACA,aAAAI;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AAEnB,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTC,EAAO;AAAA,QACPA,EAAO,UAAUR,CAAW,EAAE;AAAA,QAC9BA,MAAgB,gBAAgBC,MAAiB,SAASO,EAAO,mBAAmB;AAAA,QACpFd,MAAiB,UAAac,EAAO,eAAe;AAAA,QACpDN;AAAA,MAAA;A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AAWE,EAAO,eAAgB,UAAAI,EAAA,CAAK;AAAA,UAAA;AAAA,UAb1CH,EAAK;AAAA,QAAA;AAAA,MAiBhB,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP,GAEAhB,IAA6B,gBAAAwB,EAAmB,gBAAAC,EAAMtB,GAAO,OAAO,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-steps-ntge1{display:flex;margin:0;padding:0;list-style:none}.ui-steps--horizontal-O-mkx{flex-direction:row;gap:var(--hd-space-2)}@media (max-width: 640px){.ui-steps--horizontal-O-mkx{flex-direction:column;gap:var(--hd-space-1)}}.ui-steps--vertical-agfwo{flex-direction:column;gap:var(--hd-space-1)}.ui-steps--static-t9EED .ui-steps__label-NSeFM{white-space:normal;overflow:visible;text-overflow:clip;color:var(--hd-text)}.ui-steps__item-GrU1x{display:flex;flex:1;min-width:0}.ui-steps--horizontal-O-mkx .ui-steps__item-GrU1x:not(:last-child):after{content:"";align-self:center;flex:1;height:1px;margin-inline:var(--hd-space-2);background-color:var(--hd-border)}@media (max-width: 640px){.ui-steps--horizontal-O-mkx .ui-steps__item-GrU1x:not(:last-child):after{display:none}}.ui-steps__button-XBsnS{display:flex;align-items:center;gap:var(--hd-space-3);flex:0 1 auto;min-width:0;padding:var(--hd-space-2);border:none;border-radius:var(--hd-radius-sm);background:none;text-align:start;font-family:var(--hd-font-body);color:inherit}button.ui-steps__button-XBsnS{background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}button.ui-steps__button-XBsnS:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}button.ui-steps__button-XBsnS: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){button.ui-steps__button-XBsnS{transition:none}button.ui-steps__button-XBsnS:active:not(:disabled):not([aria-disabled=true]){translate:none}}button.ui-steps__button-XBsnS{cursor:pointer}button.ui-steps__button-XBsnS:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -1px)}.ui-steps__marker-g-GLE{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:28px;height:28px;border-radius:var(--hd-radius-pill);border:1px solid var(--hd-border-strong);background-color:var(--hd-bg-surface);color:var(--hd-text-2);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);font-variant-numeric:tabular-nums}.ui-steps__item--done-mvOuN .ui-steps__marker-g-GLE{background-color:var(--hd-primary);border-color:var(--hd-primary);color:var(--hd-on-primary)}.ui-steps__item--current-Qzlal .ui-steps__marker-g-GLE{border-color:var(--hd-primary);box-shadow:inset 0 0 0 1px var(--hd-primary);color:var(--hd-text)}@media (forced-colors: active){.ui-steps__item--done-mvOuN .ui-steps__marker-g-GLE,.ui-steps__item--current-Qzlal .ui-steps__marker-g-GLE{background-color:Highlight;color:HighlightText;forced-color-adjust:none}}.ui-steps__text-Mkpkh{display:flex;flex-direction:column;gap:2px;min-width:0}.ui-steps__label-NSeFM{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-medium);color:var(--hd-text-2)}.ui-steps__item--current-Qzlal .ui-steps__label-NSeFM{color:var(--hd-text);font-weight:var(--hd-font-weight-semibold)}.ui-steps__item--done-mvOuN .ui-steps__label-NSeFM{color:var(--hd-text)}.ui-steps__description-bQuNT{font-size:var(--hd-type-caption-size);color:var(--hd-text-3)}.ui-steps__status-wWJfP{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
|
|
1
|
+
@layer ui{.ui-steps-ntge1{display:flex;margin:0;padding:0;list-style:none}.ui-steps--horizontal-O-mkx{flex-direction:row;gap:var(--hd-space-2)}@media (max-width: 640px){.ui-steps--horizontal-O-mkx{flex-direction:column;gap:var(--hd-space-1)}}.ui-steps--vertical-agfwo{flex-direction:column;gap:var(--hd-space-1)}.ui-steps--static-t9EED .ui-steps__label-NSeFM{white-space:normal;overflow:visible;text-overflow:clip;color:var(--hd-text)}.ui-steps__item-GrU1x{display:flex;flex:1;min-width:0}.ui-steps--horizontal-O-mkx .ui-steps__item-GrU1x:not(:last-child):after{content:"";align-self:center;flex:1;height:1px;margin-inline:var(--hd-space-2);background-color:var(--hd-border)}@media (max-width: 640px){.ui-steps--horizontal-O-mkx .ui-steps__item-GrU1x:not(:last-child):after{display:none}}.ui-steps__button-XBsnS{display:flex;align-items:center;gap:var(--hd-space-3);flex:0 1 auto;min-width:0;padding:var(--hd-space-2);border:none;border-radius:var(--hd-radius-sm);background:none;text-align:start;font-family:var(--hd-font-body);color:inherit}button.ui-steps__button-XBsnS{background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}button.ui-steps__button-XBsnS:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}button.ui-steps__button-XBsnS: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){button.ui-steps__button-XBsnS{transition:none}button.ui-steps__button-XBsnS:active:not(:disabled):not([aria-disabled=true]){translate:none}}button.ui-steps__button-XBsnS{cursor:pointer}button.ui-steps__button-XBsnS:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -1px)}.ui-steps__marker-g-GLE{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:28px;height:28px;border-radius:var(--hd-radius-pill);border:1px solid var(--hd-border-strong);background-color:var(--hd-bg-surface);color:var(--hd-text-2);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);font-variant-numeric:tabular-nums}.ui-steps__item--done-mvOuN .ui-steps__marker-g-GLE{background-color:var(--hd-primary);border-color:var(--hd-primary);color:var(--hd-on-primary)}.ui-steps__item--current-Qzlal .ui-steps__marker-g-GLE{border-color:var(--hd-primary);box-shadow:inset 0 0 0 1px var(--hd-primary);color:var(--hd-text)}@media (forced-colors: active){.ui-steps__item--done-mvOuN .ui-steps__marker-g-GLE,.ui-steps__item--current-Qzlal .ui-steps__marker-g-GLE{background-color:Highlight;color:HighlightText;forced-color-adjust:none}}.ui-steps__text-Mkpkh{display:flex;flex-direction:column;gap:2px;min-width:0}.ui-steps__label-NSeFM{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-medium);color:var(--hd-text-2)}.ui-steps__item--current-Qzlal .ui-steps__label-NSeFM{color:var(--hd-text);font-weight:var(--hd-font-weight-semibold)}.ui-steps__item--done-mvOuN .ui-steps__label-NSeFM{color:var(--hd-text)}.ui-steps__description-bQuNT{font-size:var(--hd-type-caption-size);color:var(--hd-text-3)}.ui-steps__status-wWJfP{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}@media (max-width: 640px){.ui-steps--mobile-row-urJcY{flex-direction:row;gap:0}.ui-steps--mobile-row-urJcY .ui-steps__item-GrU1x:not(:last-child):after{display:block;margin-inline:2px}.ui-steps--mobile-row-urJcY .ui-steps__button-XBsnS{position:relative;gap:var(--hd-space-1);padding:var(--hd-space-1)}.ui-steps--mobile-row-urJcY .ui-steps__item-GrU1x:not(.ui-steps__item--current-Qzlal) .ui-steps__text-Mkpkh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-steps--mobile-row-urJcY .ui-steps__item-GrU1x:not(.ui-steps__item--current-Qzlal){flex:1 1 auto}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),r=require("react"),P=require("../../helpers/class-name.helper.cjs"),S=require("../../helpers/component.helper.cjs"),j=require("../../helpers/sticky-bar.helper.cjs"),n={default:{"bar":"ui-bar-4FBqD","bar--visible":"ui-bar--visible-gOy7F","bar__inner":"ui-bar__inner-kaIz0","bar__info":"ui-bar__info-XAOtF","bar__actions":"ui-bar__actions-ewCWa"}},d="--ui-sticky-bar-height",q=({children:_,info:m,label:v,targetRef:i,targetId:a,isVisible:l,onVisibilityChange:f,className:y,testId:p})=>{const b=r.useRef(null),[h,x]=r.useState(!1),c=r.useRef(f);c.current=f;const e=l??h;return r.useEffect(()=>{if(l!==void 0||typeof IntersectionObserver>"u")return;const s=(i==null?void 0:i.current)??(a?document.getElementById(a):null);if(!s)return;const t=new IntersectionObserver(([o])=>x(j.isScrolledPast(o)));return t.observe(s),()=>t.disconnect()},[l,i,a]),r.useEffect(()=>{var o;const s=b.current;s.toggleAttribute("inert",!e);const t=document.documentElement;return e?t.style.setProperty(d,`${s.offsetHeight}px`):t.style.removeProperty(d),(o=c.current)==null||o.call(c,e),()=>{t.style.removeProperty(d)}},[e]),u.jsx("div",{ref:b,role:"region","aria-label":v,"aria-hidden":!e,className:P.cx(n.default.bar,e&&n.default["bar--visible"],y),"data-testid":p,children:u.jsxs("div",{className:n.default.bar__inner,children:[m&&u.jsx("div",{className:n.default.bar__info,children:m}),u.jsx("div",{className:n.default.bar__actions,children:_})]})})},E=r.memo(S.named(q,"StickyActionBar"));exports.default=E;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/StickyActionBar/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, type ReactNode, type RefObject, useEffect, useRef, useState } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { isScrolledPast } from '../../helpers/sticky-bar.helper';\n\nimport styles from './index.module.scss';\n\n/** The custom property the bar writes on `<html>` while shown: its height, for what floats above it. */\nconst STICKY_BAR_HEIGHT_PROPERTY = '--ui-sticky-bar-height';\n\ntype Props = {\n /** The actions (the add-to-cart button). */\n children: ReactNode;\n /** What they are about, at the start: the product's name and price. */\n info?: ReactNode;\n /** The region's accessible name (\"Sepete ekle\"). */\n label: string;\n /**\n * The element the bar stands in for (the buy box): once it is scrolled past, the bar appears.\n * Watched with an `IntersectionObserver`; without one (server, old browser) the bar stays hidden.\n */\n targetRef?: RefObject<Element | null>;\n /** The same target by `id`, when the bar lives in another component than the target. */\n targetId?: string;\n /** Controlled visibility: overrides the observer. */\n isVisible?: boolean;\n onVisibilityChange?: (isVisible: boolean) => void;\n className?: string;\n testId?: string;\n};\n\n/**\n * A bar that keeps the page's main action in reach (3.4): an edge-to-edge bottom bar on a phone, a\n * docked bar centred at the bottom on a wide screen. It slides in once its target has been\n * scrolled past and writes its height to `--ui-sticky-bar-height` (a `CompareTray` sits above it).\n */\nconst StickyActionBar = ({\n children,\n info,\n label,\n targetRef,\n targetId,\n isVisible: controlledVisible,\n onVisibilityChange,\n className,\n testId,\n}: Props) => {\n const barRef = useRef<HTMLDivElement>(null);\n const [isPast, setIsPast] = useState(false);\n const callbackRef = useRef(onVisibilityChange);\n callbackRef.current = onVisibilityChange;\n\n const isVisible = controlledVisible ?? isPast;\n\n useEffect(() => {\n if (controlledVisible !== undefined || typeof IntersectionObserver === 'undefined') return;\n\n const target = targetRef?.current ?? (targetId ? document.getElementById(targetId) : null);\n if (!target) return;\n\n const observer = new IntersectionObserver(([entry]) => setIsPast(isScrolledPast(entry)));\n observer.observe(target);\n\n return () => observer.disconnect();\n }, [controlledVisible, targetRef, targetId]);\n\n /* Hidden, the bar is out of the tab order and the accessibility tree, but kept for the slide. */\n useEffect(() => {\n const bar = barRef.current as HTMLDivElement;\n bar.toggleAttribute('inert', !isVisible);\n const root = document.documentElement;\n if (isVisible) root.style.setProperty(STICKY_BAR_HEIGHT_PROPERTY, `${bar.offsetHeight}px`);\n else root.style.removeProperty(STICKY_BAR_HEIGHT_PROPERTY);\n callbackRef.current?.(isVisible);\n\n return () => {\n root.style.removeProperty(STICKY_BAR_HEIGHT_PROPERTY);\n };\n }, [isVisible]);\n\n return (\n <div\n ref={barRef}\n role=\"region\"\n aria-label={label}\n aria-hidden={!isVisible}\n className={cx(styles.bar, isVisible && styles['bar--visible'], className)}\n data-testid={testId}\n >\n <div className={styles.bar__inner}>\n {info && <div className={styles.bar__info}>{info}</div>}\n <div className={styles.bar__actions}>{children}</div>\n </div>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(StickyActionBar, 'StickyActionBar'),\n) as typeof StickyActionBar;\n"],"names":["STICKY_BAR_HEIGHT_PROPERTY","StickyActionBar","children","info","label","targetRef","targetId","controlledVisible","onVisibilityChange","className","testId","barRef","useRef","isPast","setIsPast","useState","callbackRef","isVisible","useEffect","target","observer","entry","isScrolledPast","bar","root","_a","jsx","cx","styles","jsxs","index","memo","named"],"mappings":"wWAUMA,EAA6B,yBA4B7BC,EAAkB,CAAC,CACvB,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,UAAAC,EACA,SAAAC,EACA,UAAWC,EACX,mBAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,MAAMC,EAASC,EAAAA,OAAuB,IAAI,EACpC,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EACpCC,EAAcJ,EAAAA,OAAOJ,CAAkB,EAC7CQ,EAAY,QAAUR,EAEtB,MAAMS,EAAYV,GAAqBM,EAEvCK,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAIX,IAAsB,QAAa,OAAO,qBAAyB,IAAa,OAEpF,MAAMY,GAASd,GAAA,YAAAA,EAAW,WAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACrF,GAAI,CAACa,EAAQ,OAEb,MAAMC,EAAW,IAAI,qBAAqB,CAAC,CAACC,CAAK,IAAMP,EAAUQ,EAAAA,eAAeD,CAAK,CAAC,CAAC,EACvF,OAAAD,EAAS,QAAQD,CAAM,EAEhB,IAAMC,EAAS,WAAA,CACxB,EAAG,CAACb,EAAmBF,EAAWC,CAAQ,CAAC,EAG3CY,EAAAA,UAAU,IAAM,OACd,MAAMK,EAAMZ,EAAO,QACnBY,EAAI,gBAAgB,QAAS,CAACN,CAAS,EACvC,MAAMO,EAAO,SAAS,gBACtB,OAAIP,IAAgB,MAAM,YAAYjB,EAA4B,GAAGuB,EAAI,YAAY,IAAI,EACpFC,EAAK,MAAM,eAAexB,CAA0B,GACzDyB,EAAAT,EAAY,UAAZ,MAAAS,EAAA,KAAAT,EAAsBC,GAEf,IAAM,CACXO,EAAK,MAAM,eAAexB,CAA0B,CACtD,CACF,EAAG,CAACiB,CAAS,CAAC,EAGZS,EAAAA,IAAC,MAAA,CACC,IAAKf,EACL,KAAK,SACL,aAAYP,EACZ,cAAa,CAACa,EACd,UAAWU,EAAAA,GAAGC,EAAAA,QAAO,IAAKX,GAAaW,UAAO,cAAc,EAAGnB,CAAS,EACxE,cAAaC,EAEb,SAAAmB,EAAAA,KAAC,MAAA,CAAI,UAAWD,EAAAA,QAAO,WACpB,SAAA,CAAAzB,GAAQuB,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,UAAY,SAAAzB,EAAK,EACjDuB,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,aAAe,SAAA1B,CAAA,CAAS,CAAA,CAAA,CACjD,CAAA,CAAA,CAGN,EAEA4B,EAA6BC,EAAAA,KACbC,EAAAA,MAAM/B,EAAiB,iBAAiB,CACxD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** The actions (the add-to-cart button). */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** What they are about, at the start: the product's name and price. */
|
|
6
|
+
info?: ReactNode;
|
|
7
|
+
/** The region's accessible name ("Sepete ekle"). */
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The element the bar stands in for (the buy box): once it is scrolled past, the bar appears.
|
|
11
|
+
* Watched with an `IntersectionObserver`; without one (server, old browser) the bar stays hidden.
|
|
12
|
+
*/
|
|
13
|
+
targetRef?: RefObject<Element | null>;
|
|
14
|
+
/** The same target by `id`, when the bar lives in another component than the target. */
|
|
15
|
+
targetId?: string;
|
|
16
|
+
/** Controlled visibility: overrides the observer. */
|
|
17
|
+
isVisible?: boolean;
|
|
18
|
+
onVisibilityChange?: (isVisible: boolean) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
testId?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A bar that keeps the page's main action in reach (3.4): an edge-to-edge bottom bar on a phone, a
|
|
24
|
+
* docked bar centred at the bottom on a wide screen. It slides in once its target has been
|
|
25
|
+
* scrolled past and writes its height to `--ui-sticky-bar-height` (a `CompareTray` sits above it).
|
|
26
|
+
*/
|
|
27
|
+
declare const StickyActionBar: ({ children, info, label, targetRef, targetId, isVisible: controlledVisible, onVisibilityChange, className, testId, }: Props) => import("react").JSX.Element;
|
|
28
|
+
declare const _default: typeof StickyActionBar;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** The actions (the add-to-cart button). */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** What they are about, at the start: the product's name and price. */
|
|
6
|
+
info?: ReactNode;
|
|
7
|
+
/** The region's accessible name ("Sepete ekle"). */
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The element the bar stands in for (the buy box): once it is scrolled past, the bar appears.
|
|
11
|
+
* Watched with an `IntersectionObserver`; without one (server, old browser) the bar stays hidden.
|
|
12
|
+
*/
|
|
13
|
+
targetRef?: RefObject<Element | null>;
|
|
14
|
+
/** The same target by `id`, when the bar lives in another component than the target. */
|
|
15
|
+
targetId?: string;
|
|
16
|
+
/** Controlled visibility: overrides the observer. */
|
|
17
|
+
isVisible?: boolean;
|
|
18
|
+
onVisibilityChange?: (isVisible: boolean) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
testId?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A bar that keeps the page's main action in reach (3.4): an edge-to-edge bottom bar on a phone, a
|
|
24
|
+
* docked bar centred at the bottom on a wide screen. It slides in once its target has been
|
|
25
|
+
* scrolled past and writes its height to `--ui-sticky-bar-height` (a `CompareTray` sits above it).
|
|
26
|
+
*/
|
|
27
|
+
declare const StickyActionBar: ({ children, info, label, targetRef, targetId, isVisible: controlledVisible, onVisibilityChange, className, testId, }: Props) => import("react").JSX.Element;
|
|
28
|
+
declare const _default: typeof StickyActionBar;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as E } from "react/jsx-runtime";
|
|
3
|
+
import { memo as S, useRef as b, useState as A, useEffect as p } from "react";
|
|
4
|
+
import { cx as B } from "../../helpers/class-name.helper.js";
|
|
5
|
+
import { named as I } from "../../helpers/component.helper.js";
|
|
6
|
+
import { isScrolledPast as N } from "../../helpers/sticky-bar.helper.js";
|
|
7
|
+
const s = {"bar":"ui-bar-4FBqD","bar--visible":"ui-bar--visible-gOy7F","bar__inner":"ui-bar__inner-kaIz0","bar__info":"ui-bar__info-XAOtF","bar__actions":"ui-bar__actions-ewCWa"};
|
|
8
|
+
const u = "--ui-sticky-bar-height", H = ({
|
|
9
|
+
children: v,
|
|
10
|
+
info: l,
|
|
11
|
+
label: y,
|
|
12
|
+
targetRef: n,
|
|
13
|
+
targetId: c,
|
|
14
|
+
isVisible: m,
|
|
15
|
+
onVisibilityChange: d,
|
|
16
|
+
className: _,
|
|
17
|
+
testId: P
|
|
18
|
+
}) => {
|
|
19
|
+
const f = b(null), [h, x] = A(!1), o = b(d);
|
|
20
|
+
o.current = d;
|
|
21
|
+
const e = m ?? h;
|
|
22
|
+
return p(() => {
|
|
23
|
+
if (m !== void 0 || typeof IntersectionObserver > "u") return;
|
|
24
|
+
const t = (n == null ? void 0 : n.current) ?? (c ? document.getElementById(c) : null);
|
|
25
|
+
if (!t) return;
|
|
26
|
+
const r = new IntersectionObserver(([i]) => x(N(i)));
|
|
27
|
+
return r.observe(t), () => r.disconnect();
|
|
28
|
+
}, [m, n, c]), p(() => {
|
|
29
|
+
var i;
|
|
30
|
+
const t = f.current;
|
|
31
|
+
t.toggleAttribute("inert", !e);
|
|
32
|
+
const r = document.documentElement;
|
|
33
|
+
return e ? r.style.setProperty(u, `${t.offsetHeight}px`) : r.style.removeProperty(u), (i = o.current) == null || i.call(o, e), () => {
|
|
34
|
+
r.style.removeProperty(u);
|
|
35
|
+
};
|
|
36
|
+
}, [e]), /* @__PURE__ */ a(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
ref: f,
|
|
40
|
+
role: "region",
|
|
41
|
+
"aria-label": y,
|
|
42
|
+
"aria-hidden": !e,
|
|
43
|
+
className: B(s.bar, e && s["bar--visible"], _),
|
|
44
|
+
"data-testid": P,
|
|
45
|
+
children: /* @__PURE__ */ E("div", { className: s.bar__inner, children: [
|
|
46
|
+
l && /* @__PURE__ */ a("div", { className: s.bar__info, children: l }),
|
|
47
|
+
/* @__PURE__ */ a("div", { className: s.bar__actions, children: v })
|
|
48
|
+
] })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}, G = /* @__PURE__ */ S(
|
|
52
|
+
/* @__PURE__ */ I(H, "StickyActionBar")
|
|
53
|
+
);
|
|
54
|
+
export {
|
|
55
|
+
G as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/StickyActionBar/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, type ReactNode, type RefObject, useEffect, useRef, useState } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { isScrolledPast } from '../../helpers/sticky-bar.helper';\n\nimport styles from './index.module.scss';\n\n/** The custom property the bar writes on `<html>` while shown: its height, for what floats above it. */\nconst STICKY_BAR_HEIGHT_PROPERTY = '--ui-sticky-bar-height';\n\ntype Props = {\n /** The actions (the add-to-cart button). */\n children: ReactNode;\n /** What they are about, at the start: the product's name and price. */\n info?: ReactNode;\n /** The region's accessible name (\"Sepete ekle\"). */\n label: string;\n /**\n * The element the bar stands in for (the buy box): once it is scrolled past, the bar appears.\n * Watched with an `IntersectionObserver`; without one (server, old browser) the bar stays hidden.\n */\n targetRef?: RefObject<Element | null>;\n /** The same target by `id`, when the bar lives in another component than the target. */\n targetId?: string;\n /** Controlled visibility: overrides the observer. */\n isVisible?: boolean;\n onVisibilityChange?: (isVisible: boolean) => void;\n className?: string;\n testId?: string;\n};\n\n/**\n * A bar that keeps the page's main action in reach (3.4): an edge-to-edge bottom bar on a phone, a\n * docked bar centred at the bottom on a wide screen. It slides in once its target has been\n * scrolled past and writes its height to `--ui-sticky-bar-height` (a `CompareTray` sits above it).\n */\nconst StickyActionBar = ({\n children,\n info,\n label,\n targetRef,\n targetId,\n isVisible: controlledVisible,\n onVisibilityChange,\n className,\n testId,\n}: Props) => {\n const barRef = useRef<HTMLDivElement>(null);\n const [isPast, setIsPast] = useState(false);\n const callbackRef = useRef(onVisibilityChange);\n callbackRef.current = onVisibilityChange;\n\n const isVisible = controlledVisible ?? isPast;\n\n useEffect(() => {\n if (controlledVisible !== undefined || typeof IntersectionObserver === 'undefined') return;\n\n const target = targetRef?.current ?? (targetId ? document.getElementById(targetId) : null);\n if (!target) return;\n\n const observer = new IntersectionObserver(([entry]) => setIsPast(isScrolledPast(entry)));\n observer.observe(target);\n\n return () => observer.disconnect();\n }, [controlledVisible, targetRef, targetId]);\n\n /* Hidden, the bar is out of the tab order and the accessibility tree, but kept for the slide. */\n useEffect(() => {\n const bar = barRef.current as HTMLDivElement;\n bar.toggleAttribute('inert', !isVisible);\n const root = document.documentElement;\n if (isVisible) root.style.setProperty(STICKY_BAR_HEIGHT_PROPERTY, `${bar.offsetHeight}px`);\n else root.style.removeProperty(STICKY_BAR_HEIGHT_PROPERTY);\n callbackRef.current?.(isVisible);\n\n return () => {\n root.style.removeProperty(STICKY_BAR_HEIGHT_PROPERTY);\n };\n }, [isVisible]);\n\n return (\n <div\n ref={barRef}\n role=\"region\"\n aria-label={label}\n aria-hidden={!isVisible}\n className={cx(styles.bar, isVisible && styles['bar--visible'], className)}\n data-testid={testId}\n >\n <div className={styles.bar__inner}>\n {info && <div className={styles.bar__info}>{info}</div>}\n <div className={styles.bar__actions}>{children}</div>\n </div>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(StickyActionBar, 'StickyActionBar'),\n) as typeof StickyActionBar;\n"],"names":["STICKY_BAR_HEIGHT_PROPERTY","StickyActionBar","children","info","label","targetRef","targetId","controlledVisible","onVisibilityChange","className","testId","barRef","useRef","isPast","setIsPast","useState","callbackRef","isVisible","useEffect","target","observer","entry","isScrolledPast","bar","root","_a","jsx","cx","styles","jsxs","index","memo","named"],"mappings":";;;;;;;AAUA,MAAMA,IAA6B,0BA4B7BC,IAAkB,CAAC;AAAA,EACvB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAWC;AAAA,EACX,oBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAa;AACX,QAAMC,IAASC,EAAuB,IAAI,GACpC,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcJ,EAAOJ,CAAkB;AAC7C,EAAAQ,EAAY,UAAUR;AAEtB,QAAMS,IAAYV,KAAqBM;AAEvC,SAAAK,EAAU,M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N,GAEA4B,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAM/B,GAAiB,iBAAiB;AACxD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer ui{.ui-bar-4FBqD{position:fixed;inset-inline:0;bottom:0;z-index:var(--hd-z-sticky);padding-inline:var(--hd-space-4);padding-bottom:var(--hd-space-4);pointer-events:none;translate:0 calc(100% + var(--hd-space-4));transition:translate var(--hd-duration-base) var(--hd-ease-standard)}@media (max-width: 640px){.ui-bar-4FBqD{padding:0}}@media (prefers-reduced-motion: reduce){.ui-bar-4FBqD{transition:none}}@media print{.ui-bar-4FBqD{display:none}}.ui-bar--visible-gOy7F{translate:0 0}.ui-bar__inner-kaIz0{display:flex;align-items:center;gap:var(--hd-space-4);max-width:880px;margin-inline:auto;padding:var(--hd-space-3) var(--hd-space-4);border:1px solid var(--hd-border);border-radius:var(--hd-radius-lg);background-color:var(--hd-bg-overlay);box-shadow:var(--hd-shadow-3);pointer-events:auto}@media (max-width: 640px){.ui-bar__inner-kaIz0{max-width:none;border-width:1px 0 0;border-radius:0;box-shadow:0 -12px 32px -12px rgb(var(--hd-shadow-color)/calc(var(--hd-shadow-alpha) * 2));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)))}}.ui-bar__info-XAOtF{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}.ui-bar__actions-ewCWa{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;margin-inline-start:auto}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("react/jsx-runtime"),t=require("react"),f=require("../../helpers/class-name.helper.cjs"),x=require("../../helpers/component.helper.cjs"),e={default:{"scroller":"ui-scroller-EtDmS","scroller--frame":"ui-scroller--frame-84zz6","table":"ui-table-uCv4q","table--compact":"ui-table--compact-4KCVl","table--regular":"ui-table--regular-hsA3-","table--spacious":"ui-table--spacious-BBUX-","table--sticky-head":"ui-table--sticky-head-FO2L4","table--row-hover":"ui-table--row-hover--MAoe","table--spec":"ui-table--spec-SWfJm"}},S=x.named(t.memo(({hasFrame:a=!0,label:c,className:n,children:s,...u})=>{const o=t.useRef(null),[r,m]=t.useState(!1);return t.useEffect(()=>{const l=o.current;if(!l||typeof ResizeObserver>"u")return;const d=()=>m(l.scrollWidth>l.clientWidth+1);d();const i=new ResizeObserver(d);i.observe(l);for(const v of l.children)i.observe(v);return()=>i.disconnect()},[s]),b.jsx("div",{ref:o,tabIndex:r?0:void 0,role:r?"region":void 0,"aria-label":r?c:void 0,className:f.cx(e.default.scroller,a&&e.default["scroller--frame"],n),...u,children:s})}),"TableScroller"),h=({density:a="regular",hasStickyHead:c,hasRowHover:n,variant:s="default",className:u,children:o,...r})=>b.jsx("table",{className:f.cx(e.default.table,e.default[`table--${a}`],c&&e.default["table--sticky-head"],n&&e.default["table--row-hover"],s==="spec"&&e.default["table--spec"],u),...r,children:o}),p=t.memo(h);exports.TableScroller=S;exports.default=p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type HTMLAttributes,\n memo,\n type TableHTMLAttributes,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\n\nimport styles from './index.module.scss';\n\ntype ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n /** Çerçeve (hairline + yarıçap + yüzey). */\n hasFrame?: boolean;\n /**\n * Kaydırma bölgesinin erişilebilir adı (\"Sipariş kalemleri\").\n * ⚠ ZORUNLU değil ama VERİLMELİ: kutu klavyeyle odaklanabilir bir `region` ve adsız bir bölge\n * ekran okuyucuda yalnızca \"bölge\" diye okunur\n */\n label?: string;\n};\n\n/**\n * Tablo kaydırma kutusu — \"tablo kendi kutusunda kayar, sayfa asla yatay kaymaz\" kuralının tek\n * uygulaması.\n */\nexport const TableScroller: FC<ScrollerProps> = /*#__PURE__*/ named(\n /*#__PURE__*/ memo(({ hasFrame = true, label, className, children, ...rest }) => {\n const ref = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n\n /*\n * Kutu `overflow: auto` taşıyor ve klavye kullanıcısı odaklanamadığı bir kutuyu KAYDIRAMAZ\n * (WCAG 2.1.1) — o yüzden kaydırılabilirken ikisi de ZORUNLU.\n * ⚠ `tabIndex` + `role` YALNIZCA GERÇEKTEN KAYABİLEN kutuda.\n */\n useEffect(() => {\n const node = ref.current;\n /* `ScrollArea` ile aynı koruma: jsdom `ResizeObserver` sağlamıyor. */\n if (!node || typeof ResizeObserver === 'undefined') return;\n\n const measure = () => setIsScrollable(node.scrollWidth > node.clientWidth + 1);\n\n measure();\n\n /* İçerik DE kutu DA değişebiliyor: ikisi de izleniyor. */\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n for (const child of node.children) observer.observe(child);\n\n return () => observer.disconnect();\n }, [children]);\n\n return (\n <div\n ref={ref}\n tabIndex={isScrollable ? 0 : undefined}\n role={isScrollable ? 'region' : undefined}\n aria-label={isScrollable ? label : undefined}\n className={cx(styles.scroller, hasFrame && styles['scroller--frame'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n }),\n 'TableScroller',\n);\n\ntype Props = TableHTMLAttributes<HTMLTableElement> &\n Partial<{\n /** Hücre dolgusu. */\n density: 'compact' | 'regular' | 'spacious';\n /** Başlık satırı `$surface-2` zeminle kutunun içinde YAPIŞKAN kalır. */\n hasStickyHead: boolean;\n /** Satır hover zemini: çok sütunlu tabloda göz satırını kaybediyor. */\n hasRowHover: boolean;\n }>;\n\n/** Temel tablo — hairline satır ayrımı, `$surface-2` başlık, yoğunluk ölçeği. */\nconst Table: FC<Props> = ({\n density = 'regular',\n hasStickyHead,\n hasRowHover,\n className,\n children,\n ...rest\n}) => (\n <table\n className={cx(\n styles.table,\n styles[`table--${density}`],\n hasStickyHead && styles['table--sticky-head'],\n hasRowHover && styles['table--row-hover'],\n className,\n )}\n {...rest}\n >\n {children}\n </table>\n);\n\nexport default /*#__PURE__*/ memo(Table) as typeof Table;\n"],"names":["TableScroller","named","memo","hasFrame","label","className","children","rest","ref","useRef","isScrollable","setIsScrollable","useState","useEffect","node","measure","observer","child","jsx","cx","styles","Table","density","hasStickyHead","hasRowHover","index"],"mappings":"uTA+BaA,EAAiDC,EAAAA,MAC9CC,OAAK,CAAC,CAAE,SAAAC,EAAW,GAAM,MAAAC,EAAO,UAAAC,EAAW,SAAAC,EAAU,GAAGC,KAAW,CAC/E,MAAMC,EAAMC,EAAAA,OAAuB,IAAI,EACjC,CAACC,EAAcC,CAAe,EAAIC,EAAAA,SAAS,EAAK,EAOtDC,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAON,EAAI,QAEjB,GAAI,CAACM,GAAQ,OAAO,eAAmB,IAAa,OAEpD,MAAMC,EAAU,IAAMJ,EAAgBG,EAAK,YAAcA,EAAK,YAAc,CAAC,EAE7EC,EAAA,EAGA,MAAMC,EAAW,IAAI,eAAeD,CAAO,EAC3CC,EAAS,QAAQF,CAAI,EACrB,UAAWG,KAASH,EAAK,SAAUE,EAAS,QAAQC,CAAK,EAEzD,MAAO,IAAMD,EAAS,WAAA,CACxB,EAAG,CAACV,CAAQ,CAAC,EAGXY,EAAAA,IAAC,MAAA,CACC,IAAAV,EACA,SAAUE,EAAe,EAAI,OAC7B,KAAMA,EAAe,SAAW,OAChC,aAAYA,EAAeN,EAAQ,OACnC,UAAWe,EAAAA,GAAGC,EAAAA,QAAO,SAAUjB,GAAYiB,UAAO,iBAAiB,EAAGf,CAAS,EAC9E,GAAGE,EAEH,SAAAD,CAAA,CAAA,CAGP,CAAC,EACD,eACF,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type HTMLAttributes,\n memo,\n type TableHTMLAttributes,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\n\nimport styles from './index.module.scss';\n\ntype ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n /** Çerçeve (hairline + yarıçap + yüzey). */\n hasFrame?: boolean;\n /**\n * Kaydırma bölgesinin erişilebilir adı (\"Sipariş kalemleri\").\n * ⚠ ZORUNLU değil ama VERİLMELİ: kutu klavyeyle odaklanabilir bir `region` ve adsız bir bölge\n * ekran okuyucuda yalnızca \"bölge\" diye okunur\n */\n label?: string;\n};\n\n/**\n * Tablo kaydırma kutusu — \"tablo kendi kutusunda kayar, sayfa asla yatay kaymaz\" kuralının tek\n * uygulaması.\n */\nexport const TableScroller: FC<ScrollerProps> = /*#__PURE__*/ named(\n /*#__PURE__*/ memo(({ hasFrame = true, label, className, children, ...rest }) => {\n const ref = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n\n /*\n * Kutu `overflow: auto` taşıyor ve klavye kullanıcısı odaklanamadığı bir kutuyu KAYDIRAMAZ\n * (WCAG 2.1.1) — o yüzden kaydırılabilirken ikisi de ZORUNLU.\n * ⚠ `tabIndex` + `role` YALNIZCA GERÇEKTEN KAYABİLEN kutuda.\n */\n useEffect(() => {\n const node = ref.current;\n /* `ScrollArea` ile aynı koruma: jsdom `ResizeObserver` sağlamıyor. */\n if (!node || typeof ResizeObserver === 'undefined') return;\n\n const measure = () => setIsScrollable(node.scrollWidth > node.clientWidth + 1);\n\n measure();\n\n /* İçerik DE kutu DA değişebiliyor: ikisi de izleniyor. */\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n for (const child of node.children) observer.observe(child);\n\n return () => observer.disconnect();\n }, [children]);\n\n return (\n <div\n ref={ref}\n tabIndex={isScrollable ? 0 : undefined}\n role={isScrollable ? 'region' : undefined}\n aria-label={isScrollable ? label : undefined}\n className={cx(styles.scroller, hasFrame && styles['scroller--frame'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n }),\n 'TableScroller',\n);\n\ntype Props = TableHTMLAttributes<HTMLTableElement> &\n Partial<{\n /** Hücre dolgusu. */\n density: 'compact' | 'regular' | 'spacious';\n /** Başlık satırı `$surface-2` zeminle kutunun içinde YAPIŞKAN kalır. */\n hasStickyHead: boolean;\n /** Satır hover zemini: çok sütunlu tabloda göz satırını kaybediyor. */\n hasRowHover: boolean;\n /**\n * `spec` (3.4): a key → value table of technical specifications. Each row is a\n * `<th scope=\"row\">` key in the secondary colour over 40% of the width (its own width on a\n * phone) and a value in the mono family with tabular figures.\n */\n variant: 'default' | 'spec';\n }>;\n\n/** Temel tablo — hairline satır ayrımı, `$surface-2` başlık, yoğunluk ölçeği. */\nconst Table: FC<Props> = ({\n density = 'regular',\n hasStickyHead,\n hasRowHover,\n variant = 'default',\n className,\n children,\n ...rest\n}) => (\n <table\n className={cx(\n styles.table,\n styles[`table--${density}`],\n hasStickyHead && styles['table--sticky-head'],\n hasRowHover && styles['table--row-hover'],\n variant === 'spec' && styles['table--spec'],\n className,\n )}\n {...rest}\n >\n {children}\n </table>\n);\n\nexport default /*#__PURE__*/ memo(Table) as typeof Table;\n"],"names":["TableScroller","named","memo","hasFrame","label","className","children","rest","ref","useRef","isScrollable","setIsScrollable","useState","useEffect","node","measure","observer","child","jsx","cx","styles","Table","density","hasStickyHead","hasRowHover","variant","index"],"mappings":"uTA+BaA,EAAiDC,EAAAA,MAC9CC,OAAK,CAAC,CAAE,SAAAC,EAAW,GAAM,MAAAC,EAAO,UAAAC,EAAW,SAAAC,E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
21
21
|
hasStickyHead: boolean;
|
|
22
22
|
/** Satır hover zemini: çok sütunlu tabloda göz satırını kaybediyor. */
|
|
23
23
|
hasRowHover: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* `spec` (3.4): a key → value table of technical specifications. Each row is a
|
|
26
|
+
* `<th scope="row">` key in the secondary colour over 40% of the width (its own width on a
|
|
27
|
+
* phone) and a value in the mono family with tabular figures.
|
|
28
|
+
*/
|
|
29
|
+
variant: 'default' | 'spec';
|
|
24
30
|
}>;
|
|
25
31
|
/** Temel tablo — hairline satır ayrımı, `$surface-2` başlık, yoğunluk ölçeği. */
|
|
26
32
|
declare const Table: FC<Props>;
|
|
@@ -21,6 +21,12 @@ type Props = TableHTMLAttributes<HTMLTableElement> & Partial<{
|
|
|
21
21
|
hasStickyHead: boolean;
|
|
22
22
|
/** Satır hover zemini: çok sütunlu tabloda göz satırını kaybediyor. */
|
|
23
23
|
hasRowHover: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* `spec` (3.4): a key → value table of technical specifications. Each row is a
|
|
26
|
+
* `<th scope="row">` key in the secondary colour over 40% of the width (its own width on a
|
|
27
|
+
* phone) and a value in the mono family with tabular figures.
|
|
28
|
+
*/
|
|
29
|
+
variant: 'default' | 'spec';
|
|
24
30
|
}>;
|
|
25
31
|
/** Temel tablo — hairline satır ayrımı, `$surface-2` başlık, yoğunluk ölçeği. */
|
|
26
32
|
declare const Table: FC<Props>;
|