@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.
- package/README.md +202 -71
- package/build/calendar.cjs +1 -1
- package/build/calendar.cjs.map +1 -1
- package/build/calendar.css +1 -1
- package/build/calendar.js +109 -111
- package/build/calendar.js.map +1 -1
- package/build/chat.cjs +1 -1
- package/build/chat.cjs.map +1 -1
- package/build/chat.css +1 -1
- package/build/chat.js +2 -2
- package/build/chat.js.map +1 -1
- package/build/components/Alert/style.css +1 -1
- package/build/components/Avatar/index.cjs.map +1 -1
- package/build/components/Avatar/index.d.cts +1 -1
- package/build/components/Avatar/index.d.ts +1 -1
- package/build/components/Avatar/index.js.map +1 -1
- package/build/components/Avatar/style.css +1 -1
- package/build/components/Badge/index.cjs +1 -1
- package/build/components/Badge/index.cjs.map +1 -1
- package/build/components/Badge/index.d.cts +4 -2
- package/build/components/Badge/index.d.ts +4 -2
- package/build/components/Badge/index.js +1 -1
- package/build/components/Badge/index.js.map +1 -1
- package/build/components/Badge/style.css +1 -1
- package/build/components/BrandSurface/index.cjs +2 -0
- package/build/components/BrandSurface/index.cjs.map +1 -0
- package/build/components/BrandSurface/index.d.cts +46 -0
- package/build/components/BrandSurface/index.d.ts +46 -0
- package/build/components/BrandSurface/index.js +128 -0
- package/build/components/BrandSurface/index.js.map +1 -0
- package/build/components/BrandSurface/style.css +1 -0
- package/build/components/BulkPasteInput/index.cjs +2 -0
- package/build/components/BulkPasteInput/index.cjs.map +1 -0
- package/build/components/BulkPasteInput/index.d.cts +26 -0
- package/build/components/BulkPasteInput/index.d.ts +26 -0
- package/build/components/BulkPasteInput/index.js +80 -0
- package/build/components/BulkPasteInput/index.js.map +1 -0
- package/build/components/BulkPasteInput/style.css +1 -0
- package/build/components/Button/index.cjs +1 -1
- package/build/components/Button/index.js +1 -1
- package/build/components/Button/style.css +1 -1
- package/build/components/Checkbox/index.cjs +1 -1
- package/build/components/Checkbox/index.cjs.map +1 -1
- package/build/components/Checkbox/index.js +6 -6
- package/build/components/Checkbox/index.js.map +1 -1
- package/build/components/CodeBadge/style.css +1 -1
- package/build/components/CopyField/style.css +1 -1
- package/build/components/DataTable/context.cjs +2 -0
- package/build/components/DataTable/context.cjs.map +1 -0
- package/build/components/DataTable/context.d.cts +17 -0
- package/build/components/DataTable/context.d.ts +17 -0
- package/build/components/DataTable/context.js +7 -0
- package/build/components/DataTable/context.js.map +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 +46 -5
- package/build/components/DataTable/index.d.ts +46 -5
- package/build/components/DataTable/index.js +236 -93
- package/build/components/DataTable/index.js.map +1 -1
- package/build/components/DataTable/style.css +1 -1
- package/build/components/DataTableColumnMenu/index.cjs +2 -0
- package/build/components/DataTableColumnMenu/index.cjs.map +1 -0
- package/build/components/DataTableColumnMenu/index.d.cts +13 -0
- package/build/components/DataTableColumnMenu/index.d.ts +13 -0
- package/build/components/DataTableColumnMenu/index.js +69 -0
- package/build/components/DataTableColumnMenu/index.js.map +1 -0
- package/build/components/DataTableColumnMenu/style.css +1 -0
- package/build/components/Eyebrow/index.cjs.map +1 -1
- package/build/components/Eyebrow/index.d.cts +1 -1
- package/build/components/Eyebrow/index.d.ts +1 -1
- package/build/components/Eyebrow/index.js.map +1 -1
- package/build/components/Eyebrow/style.css +1 -1
- package/build/components/Gallery/index.cjs +2 -0
- package/build/components/Gallery/index.cjs.map +1 -0
- package/build/components/Gallery/index.d.cts +56 -0
- package/build/components/Gallery/index.d.ts +56 -0
- package/build/components/Gallery/index.js +253 -0
- package/build/components/Gallery/index.js.map +1 -0
- package/build/components/Gallery/style.css +1 -0
- package/build/components/Modal/style.css +1 -1
- package/build/components/NotificationCenter/index.cjs +2 -0
- package/build/components/NotificationCenter/index.cjs.map +1 -0
- package/build/components/NotificationCenter/index.d.cts +45 -0
- package/build/components/NotificationCenter/index.d.ts +45 -0
- package/build/components/NotificationCenter/index.js +124 -0
- package/build/components/NotificationCenter/index.js.map +1 -0
- package/build/components/NotificationCenter/style.css +1 -0
- package/build/components/Popover/index.cjs +1 -1
- package/build/components/Popover/index.cjs.map +1 -1
- package/build/components/Popover/index.js +16 -16
- package/build/components/Popover/index.js.map +1 -1
- package/build/components/Progress/index.cjs +1 -1
- package/build/components/Progress/index.cjs.map +1 -1
- package/build/components/Progress/index.d.cts +2 -2
- package/build/components/Progress/index.d.ts +2 -2
- package/build/components/Progress/index.js +1 -1
- package/build/components/Progress/index.js.map +1 -1
- package/build/components/Progress/style.css +1 -1
- package/build/components/Rating/style.css +1 -1
- package/build/components/RatingInput/style.css +1 -1
- package/build/components/Stat/style.css +1 -1
- package/build/components/StatStrip/index.cjs +1 -1
- package/build/components/StatStrip/index.cjs.map +1 -1
- package/build/components/StatStrip/index.d.cts +3 -3
- package/build/components/StatStrip/index.d.ts +3 -3
- package/build/components/StatStrip/index.js +1 -1
- package/build/components/StatStrip/index.js.map +1 -1
- package/build/components/StatStrip/style.css +1 -1
- package/build/components/StatusDot/index.cjs +1 -1
- package/build/components/StatusDot/index.cjs.map +1 -1
- package/build/components/StatusDot/index.d.cts +5 -3
- package/build/components/StatusDot/index.d.ts +5 -3
- package/build/components/StatusDot/index.js +1 -1
- package/build/components/StatusDot/index.js.map +1 -1
- package/build/components/StatusDot/style.css +1 -1
- package/build/components/TagInput/style.css +1 -1
- package/build/components/Textarea/style.css +1 -1
- package/build/components/Timeline/style.css +1 -1
- package/build/components/Toast/style.css +1 -1
- package/build/components/TreeSelect/index.cjs +2 -0
- package/build/components/TreeSelect/index.cjs.map +1 -0
- package/build/components/TreeSelect/index.d.cts +40 -0
- package/build/components/TreeSelect/index.d.ts +40 -0
- package/build/components/TreeSelect/index.js +175 -0
- package/build/components/TreeSelect/index.js.map +1 -0
- package/build/components/TreeSelect/style.css +1 -0
- package/build/design/index.cjs +84 -178
- package/build/design/index.cjs.map +1 -1
- package/build/design/index.d.cts +72 -63
- package/build/design/index.d.mts +72 -63
- package/build/design/index.mjs +84 -178
- package/build/design/index.mjs.map +1 -1
- package/build/design/index.umd.cjs +1 -1
- package/build/design/index.umd.cjs.map +1 -1
- package/build/design/tokens.css +62 -177
- package/build/design/tokens.json +66 -168
- package/build/design/tokens.scss +48 -178
- package/build/enums/ui-variant.enum.cjs +1 -1
- package/build/enums/ui-variant.enum.cjs.map +1 -1
- package/build/enums/ui-variant.enum.d.cts +2 -2
- package/build/enums/ui-variant.enum.d.ts +2 -2
- package/build/enums/ui-variant.enum.js +1 -1
- package/build/enums/ui-variant.enum.js.map +1 -1
- package/build/helpers/bulk-paste.helper.cjs +2 -0
- package/build/helpers/bulk-paste.helper.cjs.map +1 -0
- package/build/helpers/bulk-paste.helper.d.cts +38 -0
- package/build/helpers/bulk-paste.helper.d.ts +38 -0
- package/build/helpers/bulk-paste.helper.js +37 -0
- package/build/helpers/bulk-paste.helper.js.map +1 -0
- package/build/index.cjs +1 -1
- package/build/index.d.cts +8 -2
- package/build/index.d.ts +8 -2
- package/build/index.js +122 -110
- package/build/index.js.map +1 -1
- package/build/scss/_mixins.scss +8 -10
- package/build/scss/_variables.scss +19 -39
- package/build/styles.css +31 -21
- package/build/types/calendar/Calendar/index.d.cts +1 -1
- package/build/types/calendar/Calendar/index.d.ts +1 -1
- package/build/types/calendar/core/types.d.cts +3 -2
- package/build/types/calendar/core/types.d.ts +3 -2
- package/build/types/theme.type.d.cts +54 -0
- package/build/types/theme.type.d.ts +54 -0
- package/build/types/types/theme.type.d.cts +54 -0
- package/build/types/types/theme.type.d.ts +54 -0
- package/package.json +61 -11
- package/build/components/Band/index.cjs +0 -2
- package/build/components/Band/index.cjs.map +0 -1
- package/build/components/Band/index.d.cts +0 -45
- package/build/components/Band/index.d.ts +0 -45
- package/build/components/Band/index.js +0 -126
- package/build/components/Band/index.js.map +0 -1
- package/build/components/Band/style.css +0 -1
package/README.md
CHANGED
|
@@ -281,7 +281,40 @@ either. Labels are given **once**, on the provider:
|
|
|
281
281
|
pagination: { label: 'Sayfalar', previous: 'Önceki sayfa', next: 'Sonraki sayfa' },
|
|
282
282
|
quantity: { label: 'Adet', decrease: 'Adeti azalt', increase: 'Adeti artır' },
|
|
283
283
|
range: { min: 'En az', max: 'En çok' },
|
|
284
|
-
dataTable: {
|
|
284
|
+
dataTable: {
|
|
285
|
+
empty: 'Kayıt bulunamadı.',
|
|
286
|
+
loading: 'Yükleniyor…',
|
|
287
|
+
columns: 'Sütunlar',
|
|
288
|
+
moveUp: column => `${column} sütununu öne al`,
|
|
289
|
+
moveDown: column => `${column} sütununu geri al`,
|
|
290
|
+
},
|
|
291
|
+
gallery: {
|
|
292
|
+
thumbnails: 'Görseller',
|
|
293
|
+
thumbnail: (index, total) => `Görsel ${index} / ${total}`,
|
|
294
|
+
previous: 'Önceki görsel',
|
|
295
|
+
next: 'Sonraki görsel',
|
|
296
|
+
fullscreen: 'Tam ekran',
|
|
297
|
+
zoomIn: 'Yakınlaştır',
|
|
298
|
+
zoomOut: 'Uzaklaştır',
|
|
299
|
+
},
|
|
300
|
+
treeSelect: { search: 'Kategori ara', empty: 'Eşleşen kategori yok' },
|
|
301
|
+
notificationCenter: {
|
|
302
|
+
trigger: unread => (unread ? `Bildirimler, ${unread} okunmamış` : 'Bildirimler'),
|
|
303
|
+
title: 'Bildirimler',
|
|
304
|
+
markAllRead: 'Tümünü okundu işaretle',
|
|
305
|
+
markRead: 'Okundu işaretle',
|
|
306
|
+
empty: 'Bildirim yok',
|
|
307
|
+
unread: 'Okunmamış',
|
|
308
|
+
today: 'Bugün',
|
|
309
|
+
yesterday: 'Dün',
|
|
310
|
+
},
|
|
311
|
+
bulkPaste: {
|
|
312
|
+
summary: count => `${count} satır okundu`,
|
|
313
|
+
invalidSummary: count => `${count} satır okunamadı`,
|
|
314
|
+
line: line => `Satır ${line}`,
|
|
315
|
+
missingCode: 'Kod yok',
|
|
316
|
+
invalidQuantity: 'Adet okunamadı',
|
|
317
|
+
},
|
|
285
318
|
copyField: {
|
|
286
319
|
copy: value => `${value} kopyala`,
|
|
287
320
|
copied: value => `${value} kopyalandı`,
|
|
@@ -380,13 +413,13 @@ and changes when an announcement strip appears.
|
|
|
380
413
|
| Group | Components |
|
|
381
414
|
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
382
415
|
| Action | `Button` · `IconButton` · `TextLink` · `Tooltip` · `Menu` · `ContextMenu` · `Popover` |
|
|
383
|
-
| Choice | `Chip` · `ChipGroup` · `SegmentedControl` · `Select` · `Combobox` · `Checkbox` · `Switch` · `Radio` · `RadioCard` · `RangeSlider` · `RatingInput` · `QuantityStepper` · `TableCheckbox`
|
|
384
|
-
| Input | `Input` · `PasswordInput` · `Textarea` · `TagInput` · `DateField` (+ `DateRange`) · `FileUpload` · `Field` · `ScaledInput` · `MoneyInput` · `QuantityInput` · `RateInput` · `PercentInput`
|
|
385
|
-
| Surface | `Card` (+ `CardMedia`, `CardOverlay`, `CardBody`, `CardFooter`) · `SummaryCard` · `Panel` (+ `PanelForm`, `PanelRow`) · `PageHeader` · `SectionHeader` · `Tile` · `Directory` (+ `DirectoryGroup`, `DirectoryRow`, `DirectoryJump`) · `Carousel` · `ScrollArea` · `Disclosure` · `Accordion` · `Tabs`
|
|
386
|
-
| Feedback | `Alert` · `Badge` · `StatusDot` · `CodeBadge` · `Kbd` · `EmptyState` · `Skeleton` (+ `SkeletonCard`, `SkeletonRows`, `SkeletonTable`) · `Spinner` · `Progress` · `Steps` · `Divider` · `Avatar` · `Rating` · `Price` · `Stat` · `CopyField` · `Breadcrumb` · `ToastHub` (+ `ToastPortal`)
|
|
387
|
-
| Brand
|
|
416
|
+
| Choice | `Chip` · `ChipGroup` · `SegmentedControl` · `Select` · `Combobox` · `TreeSelect` · `Checkbox` · `Switch` · `Radio` · `RadioCard` · `RangeSlider` · `RatingInput` · `QuantityStepper` · `TableCheckbox` |
|
|
417
|
+
| Input | `Input` · `PasswordInput` · `Textarea` · `TagInput` · `DateField` (+ `DateRange`) · `FileUpload` · `Field` · `ScaledInput` · `MoneyInput` · `QuantityInput` · `RateInput` · `PercentInput` · `BulkPasteInput` |
|
|
418
|
+
| Surface | `Card` (+ `CardMedia`, `CardOverlay`, `CardBody`, `CardFooter`) · `SummaryCard` · `Panel` (+ `PanelForm`, `PanelRow`) · `PageHeader` · `SectionHeader` · `Tile` · `Directory` (+ `DirectoryGroup`, `DirectoryRow`, `DirectoryJump`) · `Carousel` · `Gallery` · `ScrollArea` · `Disclosure` · `Accordion` · `Tabs` |
|
|
419
|
+
| Feedback | `Alert` · `Badge` · `StatusDot` · `CodeBadge` · `Kbd` · `EmptyState` · `Skeleton` (+ `SkeletonCard`, `SkeletonRows`, `SkeletonTable`) · `Spinner` · `Progress` · `Steps` · `Divider` · `Avatar` · `Rating` · `Price` · `Stat` · `CopyField` · `Breadcrumb` · `ToastHub` (+ `ToastPortal`) · `NotificationCenter` |
|
|
420
|
+
| Brand surface (3.0) | `BrandSurface` (+ `BrandBlueprint`) · `Eyebrow` · `StatStrip` |
|
|
388
421
|
| Modal | `Modal` · `Drawer` · `BottomSheet` · `ConfirmDialog` · `PromptDialog` · `CommandPalette` |
|
|
389
|
-
| Data | `Table` (+ `TableScroller`) · `DataTable` (+ `DataTableRow`) · `FilterBar` (+ `FilterBarField`) · `Pagination` · `Timeline`
|
|
422
|
+
| Data | `Table` (+ `TableScroller`) · `DataTable` (+ `DataTableRow`, `DataTableColumnMenu`) · `FilterBar` (+ `FilterBarField`) · `Pagination` · `Timeline` |
|
|
390
423
|
| Theme and hooks | `UiProvider` · `UiThemeScript` · `useUi` · `useUiTheme` · `useUiTokens` · `useAnnounce` · `useStickToBottom` · `usePositioning` · `useVirtualList` · `useListboxNavigation` · `hasOpenSurface` |
|
|
391
424
|
| Chat, `/chat` | `ChatThread` · `ChatMessage` · `PromptInput` · `PromptSuggestions` · `Prose` · `CodeBlock` · `ReasoningBlock` (+ `ReasoningText`) · `ToolCall` (+ `ToolCallSection`) · `TerminalOutput` · `SourceList` · `Citation` · `MessageActions` · `AppBar` · `ActionList` (+ `ActionListItem`) · `SegmentBar` · `Legend` · `DescriptionList` |
|
|
392
425
|
| Charts, `/charts` | `LineChart` · `AreaChart` · `BarChart` · `ComposedChart` · `PieChart` · `ScatterPlot` · `Heatmap` · `BoxPlot` · `Histogram` · `RadarChart` |
|
|
@@ -394,16 +427,16 @@ and changes when an announcement strip appears.
|
|
|
394
427
|
|
|
395
428
|
### Variants and sizes
|
|
396
429
|
|
|
397
|
-
| `UIVariant` | Use
|
|
398
|
-
| ----------- |
|
|
399
|
-
| `PRIMARY` | the one expected action of the screen: cobalt fill
|
|
400
|
-
| `ACCENT` | the conversion action (download, try, subscribe): coral fill, only that; on the
|
|
401
|
-
| `SECONDARY` | a neutral second action: grey border, body text
|
|
402
|
-
| `OUTLINE` | a cobalt frame: an encouraged navigation that is not the primary action
|
|
403
|
-
| `SOFT` | a neutral fill: a secondary action inside a card
|
|
404
|
-
| `GHOST` | no surface: toolbar and inline secondary actions, in the link colour
|
|
405
|
-
| `DANGER` | a destructive action
|
|
406
|
-
| `
|
|
430
|
+
| `UIVariant` | Use |
|
|
431
|
+
| ----------- | --------------------------------------------------------------------------------------------------- |
|
|
432
|
+
| `PRIMARY` | the one expected action of the screen: cobalt fill |
|
|
433
|
+
| `ACCENT` | the conversion action (download, try, subscribe): coral fill, only that; glows on the brand surface |
|
|
434
|
+
| `SECONDARY` | a neutral second action: grey border, body text |
|
|
435
|
+
| `OUTLINE` | a cobalt frame: an encouraged navigation that is not the primary action |
|
|
436
|
+
| `SOFT` | a neutral fill: a secondary action inside a card |
|
|
437
|
+
| `GHOST` | no surface: toolbar and inline secondary actions, in the link colour |
|
|
438
|
+
| `DANGER` | a destructive action |
|
|
439
|
+
| `ON_BRAND` | a second action on the brand surface (cobalt in both themes): white frame, white label |
|
|
407
440
|
|
|
408
441
|
`UISize`: `XSMALL` 28px · `SMALL` 32px · `MEDIUM` 40px · `LARGE` 48px. Fields
|
|
409
442
|
are 40px with 15px text on desktop and 44px with 16px text on a narrow or touch
|
|
@@ -413,9 +446,11 @@ screen (no iOS zoom, a full touch target).
|
|
|
413
446
|
`danger`. `secondary` and `outline` are drawn exactly like the `Button` variants
|
|
414
447
|
of the same name: the neutral frame and the cobalt frame. (Until 2.1 `outline`
|
|
415
448
|
was the neutral frame; use `secondary` for that look.)
|
|
416
|
-
`Badge tone`: `neutral` · `
|
|
417
|
-
`
|
|
418
|
-
a
|
|
449
|
+
`Badge tone`: `neutral` · `ink` · `info` · `danger`, each as `soft`, `solid` or
|
|
450
|
+
`outline`. The palette has one status hue, red (3.0): a good state is `info`
|
|
451
|
+
(cobalt), one that needs a look `ink` (the emphatic neutral). `StatusDot` and
|
|
452
|
+
`Calendar` tones follow the same names; `Alert`, `Toast` and `Modal` keep
|
|
453
|
+
`success` and `warning`, drawn in cobalt and ink and told apart by their icon.
|
|
419
454
|
|
|
420
455
|
### The number of options picks the element
|
|
421
456
|
|
|
@@ -575,6 +610,98 @@ data contract. `123450` with two decimal places is "1.234,50".
|
|
|
575
610
|
formatters' (`formatMoney`, `formatQuantity` …); `Price` stays a
|
|
576
611
|
display of an already formatted text.
|
|
577
612
|
|
|
613
|
+
### Parts portal components (3.1)
|
|
614
|
+
|
|
615
|
+
Dense data and ordering screens: every one is its own subpath
|
|
616
|
+
(`@handijitcom/ui/gallery`, `/tree-select`, `/notification-center`,
|
|
617
|
+
`/bulk-paste-input`, `/data-table-column-menu`) and works the same in Next and
|
|
618
|
+
Electron.
|
|
619
|
+
|
|
620
|
+
**`DataTable` data mode.** Pass `rows` and a `render` per column instead of
|
|
621
|
+
children; then, all opt-in:
|
|
622
|
+
|
|
623
|
+
```tsx
|
|
624
|
+
<DataTable
|
|
625
|
+
label="Parçalar"
|
|
626
|
+
columns={[
|
|
627
|
+
{ key: 'code', label: 'Kod', isAlwaysVisible: true, render: part => part.code },
|
|
628
|
+
{ key: 'name', label: 'Ad', render: part => part.name },
|
|
629
|
+
]}
|
|
630
|
+
rows={parts}
|
|
631
|
+
getRowKey={part => part.code}
|
|
632
|
+
columnState={columns} // { order: string[]; hidden: string[] }, or uncontrolled
|
|
633
|
+
onColumnStateChange={setColumns} // persist it per user
|
|
634
|
+
columnMenu={<DataTableColumnMenu />} // visibility checkboxes + move up / down
|
|
635
|
+
density="compact" // or 'comfortable' (default)
|
|
636
|
+
onRowActivate={openPart} // ↑ ↓ Home End move, Enter (or a click) activates
|
|
637
|
+
isVirtualized // only the rows in view; fixed `rowHeight` (36 / 48 px)
|
|
638
|
+
hasViewportCap
|
|
639
|
+
/>
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
A virtualized table scrolls in its own box (`hasViewportCap`, or
|
|
643
|
+
`--ui-data-table-max-height`, 480px by default) with a sticky header; its rows
|
|
644
|
+
are `rowHeight` tall and its cells do not wrap. Children mode is unchanged and
|
|
645
|
+
ignores these props.
|
|
646
|
+
|
|
647
|
+
**`DataTableColumnMenu`** (`@handijitcom/ui/data-table-column-menu`) is the
|
|
648
|
+
column menu, a component of its own so that a table without one does not bundle
|
|
649
|
+
`Popover`, `Checkbox` and `IconButton` (`DataTable` alone 2.85 kB gzip, with the
|
|
650
|
+
menu 6.66 kB). Pass it as `columnMenu`; it is drawn in a toolbar above the
|
|
651
|
+
table and edits that table's `columnState`, controlled or not. Its texts come
|
|
652
|
+
from `UiLabels.dataTable` (`columns`, `moveUp`, `moveDown`) or its `labels`
|
|
653
|
+
prop. Outside a data-mode `DataTable` it draws nothing.
|
|
654
|
+
|
|
655
|
+
```tsx
|
|
656
|
+
import DataTable from '@handijitcom/ui/data-table';
|
|
657
|
+
import DataTableColumnMenu from '@handijitcom/ui/data-table-column-menu';
|
|
658
|
+
|
|
659
|
+
<DataTable
|
|
660
|
+
columns={columns}
|
|
661
|
+
rows={parts}
|
|
662
|
+
columnMenu={<DataTableColumnMenu labels={{ columns: 'Görünüm' }} />}
|
|
663
|
+
/>;
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
**`Gallery`** — main image, thumbnails, a hover zoom under a mouse, a
|
|
667
|
+
full-screen view (← → Home End, Escape, swipe, click to zoom).
|
|
668
|
+
`renderImage` is the platform adapter; pass its `className` through:
|
|
669
|
+
|
|
670
|
+
```tsx
|
|
671
|
+
<Gallery
|
|
672
|
+
label="Ürün görselleri"
|
|
673
|
+
images={[{ src, alt: 'Fren balatası, ön', thumbnailSrc, width: 800, height: 800 }]}
|
|
674
|
+
renderImage={({ src, alt, className, variant, width, height }) => (
|
|
675
|
+
<Image
|
|
676
|
+
src={src}
|
|
677
|
+
alt={alt}
|
|
678
|
+
className={className}
|
|
679
|
+
width={width}
|
|
680
|
+
height={height}
|
|
681
|
+
sizes={variant === 'thumbnail' ? '64px' : '(max-width: 768px) 100vw, 50vw'}
|
|
682
|
+
/>
|
|
683
|
+
)}
|
|
684
|
+
/>
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
**`TreeSelect`** — an inline ARIA tree (put it in a `Popover` or a
|
|
688
|
+
`Drawer` for a dropdown): `isMultiple`, `value` / `onChange`, `expanded` /
|
|
689
|
+
`onExpandedChange` (optional), `hasSearch` (matches stay with their ancestors,
|
|
690
|
+
which open). Each node is selected on its own; what a parent's selection
|
|
691
|
+
means is the caller's.
|
|
692
|
+
|
|
693
|
+
**`NotificationCenter`** — bell with an unread badge and a panel grouped by
|
|
694
|
+
day (today, yesterday, then the date in `labels.locale`). Presentational:
|
|
695
|
+
`items`, `onItemSelect`, `onMarkRead`, `onMarkAllRead`, optional `isOpen` /
|
|
696
|
+
`onOpenChange`, `formatDay` / `formatTime`.
|
|
697
|
+
|
|
698
|
+
**`BulkPasteInput`** and **`parseBulkPaste(text, { defaultQuantity, isMergingDuplicates })`**
|
|
699
|
+
— rows `{ code, quantity, line }` and invalid lines `{ line, text, reason }`
|
|
700
|
+
from a spreadsheet copy (tabs), `;`, `,` or space separated lines, or one
|
|
701
|
+
code per line. Quantities follow the data contract's grammar ("1.250" is
|
|
702
|
+
1250, "2,00" is 2, "1,5" is refused). The parser is a plain function: on the
|
|
703
|
+
server import it from `@handijitcom/ui`, not from the client subpath.
|
|
704
|
+
|
|
578
705
|
### TypeScript resolution
|
|
579
706
|
|
|
580
707
|
The declarations resolve under every `moduleResolution`: `bundler`, `node16`
|
|
@@ -586,28 +713,37 @@ the build with `skipLibCheck` off.
|
|
|
586
713
|
|
|
587
714
|
## Decisions the system carries
|
|
588
715
|
|
|
589
|
-
**Cobalt
|
|
590
|
-
primary action, the link, the selection
|
|
591
|
-
conversion button (`UIVariant.ACCENT` on `Button`,
|
|
592
|
-
`IconButton`) and appears nowhere else but the dot of the
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
716
|
+
**Cobalt, coral, ink.** The palette is three colours plus red for danger:
|
|
717
|
+
cobalt is the primary action, the link, the selection, the focus ring and the
|
|
718
|
+
brand surface; coral is the conversion button (`UIVariant.ACCENT` on `Button`,
|
|
719
|
+
`variant="accent"` on `IconButton`) and appears nowhere else but the dot of the
|
|
720
|
+
brand mark and code strings; ink (`#091122`) and its lightness steps are every
|
|
721
|
+
neutral. There is no green, amber, violet, cyan or navy (3.0); a design test
|
|
722
|
+
fails on any other hue. A success is cobalt and a warning ink, each with its
|
|
723
|
+
icon and text. `colour-footprint.test.ts` turns a coral or brand-surface token
|
|
724
|
+
in any other component's stylesheet into a failing test.
|
|
596
725
|
|
|
597
|
-
**The brand
|
|
598
|
-
a sign-in side or a footer
|
|
599
|
-
|
|
726
|
+
**The brand surface (3.0).** `BrandSurface` is the cobalt surface of a hero, a
|
|
727
|
+
closing call, a sign-in side or a footer: `primary` with white on it, the same
|
|
728
|
+
in both themes, needing no edge on either page:
|
|
600
729
|
|
|
601
730
|
```tsx
|
|
602
|
-
import {
|
|
731
|
+
import {
|
|
732
|
+
BrandBlueprint,
|
|
733
|
+
BrandSurface,
|
|
734
|
+
Button,
|
|
735
|
+
Eyebrow,
|
|
736
|
+
StatStrip,
|
|
737
|
+
UIVariant,
|
|
738
|
+
} from '@handijitcom/ui';
|
|
603
739
|
import { logos } from '@handijitcom/ui/design';
|
|
604
740
|
|
|
605
|
-
<
|
|
741
|
+
<BrandSurface
|
|
606
742
|
aria-labelledby="cta-title"
|
|
607
|
-
glow="both" // soft
|
|
608
|
-
dots="end" // the faded dot grid: 'start' · 'end' (default) · 'both' · 'none'
|
|
609
|
-
artwork={<
|
|
610
|
-
footer={<StatStrip variant="
|
|
743
|
+
glow="both" // soft white sheens: 'start' · 'end' · 'both' (default) · 'none'
|
|
744
|
+
dots="end" // the faded white dot grid: 'start' · 'end' (default) · 'both' · 'none'
|
|
745
|
+
artwork={<BrandBlueprint shape={logos.mark} />} // decorative, from the tablet width up
|
|
746
|
+
footer={<StatStrip variant="brand" items={[{ value: '2 saat', label: 'yanıt süresi' }]} />}
|
|
611
747
|
>
|
|
612
748
|
<Eyebrow>Teklif</Eyebrow>
|
|
613
749
|
<h2 id="cta-title">
|
|
@@ -615,25 +751,26 @@ import { logos } from '@handijitcom/ui/design';
|
|
|
615
751
|
{/* .full-stop: color var(--hd-accent) */}
|
|
616
752
|
</h2>
|
|
617
753
|
<Button variant={UIVariant.ACCENT}>Teklif alın</Button>
|
|
618
|
-
<Button variant={UIVariant.
|
|
619
|
-
</
|
|
754
|
+
<Button variant={UIVariant.ON_BRAND}>WhatsApp</Button>
|
|
755
|
+
</BrandSurface>;
|
|
620
756
|
```
|
|
621
757
|
|
|
622
|
-
- The gradient,
|
|
623
|
-
with ids from `useId`; nothing is
|
|
624
|
-
|
|
625
|
-
imagery is dropped and the
|
|
626
|
-
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
758
|
+
- The gradient (cobalt into `brand-surface-deep`), sheens, dot grid and
|
|
759
|
+
blueprint are **inline SVG**, `aria-hidden`, with ids from `useId`; nothing is
|
|
760
|
+
a CSS gradient. The component renders on the server. In forced colours the
|
|
761
|
+
imagery is dropped and the surface is a framed region.
|
|
762
|
+
- **Text on it is white only**: white on cobalt is 5.03:1, and white at 92% is
|
|
763
|
+
already 4.50:1, so there is no secondary text colour; use size and weight.
|
|
764
|
+
The white sheen stays at 6% so that white text over it is still 4.58:1.
|
|
765
|
+
- Inside it every focus ring is white: `BrandSurface` sets the `--ui-ring-color`
|
|
766
|
+
hook that `$focus` reads. `Eyebrow` and the `ACCENT` button read the surface
|
|
767
|
+
from `data-ui-brand-surface` (an application's own surface may carry it too).
|
|
768
|
+
- **Coral once per view as an action:** the surface's one action is the
|
|
769
|
+
`ACCENT` button, which glows softly there (`brand-surface-accent-glow`) and
|
|
770
|
+
nowhere else; coral on cobalt is 1.64:1, so its label (6.15:1) identifies it.
|
|
771
|
+
A second action is `ON_BRAND`. The coral full stop and the mark's dot are the
|
|
772
|
+
brand's punctuation. Opacity lives only in the surface's imagery.
|
|
773
|
+
- `StatStrip` (`page` or `brand`) is a list of value and label facts with thin
|
|
637
774
|
dividers; `Eyebrow` is the mono capital label with its rules (`start` or
|
|
638
775
|
`center`). The text is set in capitals by CSS, so give the page a `lang`.
|
|
639
776
|
|
|
@@ -679,7 +816,7 @@ smaller; an invisible overlay keeps the area.
|
|
|
679
816
|
## Next.js App Router
|
|
680
817
|
|
|
681
818
|
The package draws the `'use client'` boundary **inside itself, per file**:
|
|
682
|
-
components without hooks (`Alert`, `Badge`, `
|
|
819
|
+
components without hooks (`Alert`, `Badge`, `BrandSurface`, `Button`, `Card`, `Chip`,
|
|
683
820
|
`Divider`, `EmptyState`, `IconButton`, `Kbd`, `PageHeader`, `Panel`,
|
|
684
821
|
`Progress`, `SectionHeader`, `Skeleton`, `StatusDot`, `SummaryCard`,
|
|
685
822
|
`TextLink`, `Tile`) render as server components and send no JavaScript; the
|
|
@@ -797,7 +934,7 @@ JSON is re-indented with two spaces (values are kept as text: large numbers are
|
|
|
797
934
|
not rounded) and blank lines at the edges are dropped; other languages keep
|
|
798
935
|
their indentation. More than 30 languages are recognised; an unknown one is
|
|
799
936
|
drawn plain. The token colours are design tokens (keyword `primary-text`,
|
|
800
|
-
string
|
|
937
|
+
string and number `accent-text`, type `text` at medium weight), so they
|
|
801
938
|
follow the theme and stay inside the measured text pairs. For Shiki-grade
|
|
802
939
|
accuracy pass pre-highlighted HTML as `html` (its safety is yours).
|
|
803
940
|
|
|
@@ -864,7 +1001,7 @@ import { Calendar, type CalendarEvent } from '@handijitcom/ui/calendar';
|
|
|
864
1001
|
<Calendar
|
|
865
1002
|
label="Ders planı"
|
|
866
1003
|
days={week} // [{ date: '2026-11-09', label: 'Pazartesi 9 Kasım', shortLabel: 'Pzt 9', isToday, isOff }]
|
|
867
|
-
resources={rooms} // optional: [{ id: 'r1', label: 'Derslik 1', detail: '7 / 8', tone: '
|
|
1004
|
+
resources={rooms} // optional: [{ id: 'r1', label: 'Derslik 1', detail: '7 / 8', tone: 'ink' }]
|
|
868
1005
|
bands={[{ label: 'Sabah', start: '08:00', end: '12:00' }]} // optional, 2.5
|
|
869
1006
|
events={lessons} // [{ id, title, start: '2026-11-09T09:00', end: '2026-11-09T10:30', resourceId, tone, isCancelled, isLocked }]
|
|
870
1007
|
startTime="08:00"
|
|
@@ -898,7 +1035,7 @@ import { Calendar, type CalendarEvent } from '@handijitcom/ui/calendar';
|
|
|
898
1035
|
a day or a week), ⌘/Ctrl ⇧ ↑ ↓ shorten or lengthen it. The new place is
|
|
899
1036
|
announced (`labels.calendar.moved`) and the focus follows the event.
|
|
900
1037
|
- **Resource headers and bands (2.5).** A resource's `detail` is a second
|
|
901
|
-
header line and its `tone` tints the header (Teknik Servis: `
|
|
1038
|
+
header line and its `tone` tints the header (Teknik Servis: `ink` at 80%
|
|
902
1039
|
of the day's capacity — the percentage goes in `detail`, colour is never
|
|
903
1040
|
alone); `renderResource` draws the header instead. `bands` (`CalendarBand`:
|
|
904
1041
|
`{ label, start, end }`, `HH:MM`) draws named stretches of the day ("Sabah",
|
|
@@ -991,10 +1128,10 @@ npm run playground # component gallery → http://localhost:5273
|
|
|
991
1128
|
TypeScript sources exists in the tokens of `src/design`; breakpoints
|
|
992
1129
|
and layers match it; no stylesheet declares an `--hd-*` property or carries
|
|
993
1130
|
a literal colour.
|
|
994
|
-
- **Colour footprint** (`colour-footprint.test.ts`): coral and
|
|
995
|
-
used only by the components on a justified allow-list, and the
|
|
996
|
-
roles
|
|
997
|
-
and
|
|
1131
|
+
- **Colour footprint** (`colour-footprint.test.ts`): coral and brand-surface
|
|
1132
|
+
tokens are used only by the components on a justified allow-list, and the
|
|
1133
|
+
removed roles (turquoise, success, warning, band, slate) cannot come back. A
|
|
1134
|
+
design test fails on any hue outside cobalt, coral and danger red.
|
|
998
1135
|
- **Contrast**: text ≥ 4.5:1, icons and the focus ring ≥ 3:1, measured on the
|
|
999
1136
|
values of the installed design package for every pair a component draws.
|
|
1000
1137
|
- **Accessibility scan** (`__tests__/components/a11y.test.tsx`): every exported
|
|
@@ -1009,9 +1146,10 @@ npm run playground # component gallery → http://localhost:5273
|
|
|
1009
1146
|
dropped name is **breaking** and surfaces as a build error at the consumer's
|
|
1010
1147
|
next install. For a deliberate change: `npm run build`, then
|
|
1011
1148
|
`node scripts/check-api.mjs --update`, and a line in the CHANGELOG.
|
|
1012
|
-
- **Bundle size**: budgets in `.size-limit.js` (main entry
|
|
1013
|
-
|
|
1014
|
-
|
|
1149
|
+
- **Bundle size**: budgets in `.size-limit.js` (whole main entry 53.5 kB,
|
|
1150
|
+
`styles.css` 26 kB gzip; per import, e.g. `DataTable` alone 3 kB, with
|
|
1151
|
+
`DataTableColumnMenu` 7 kB). When `size-limit` turns red, measure what was
|
|
1152
|
+
added before raising a limit.
|
|
1015
1153
|
- **Sub-entry boundary**: `chat` and `charts` import the main entry by PACKAGE
|
|
1016
1154
|
NAME only (`subentry-boundary.test.ts`); a relative path would bundle a
|
|
1017
1155
|
second copy of the provider context and the modal stack.
|
|
@@ -1051,13 +1189,6 @@ on npm yet**; otherwise it skips. A published version gets a `vX.Y.Z` tag and a
|
|
|
1051
1189
|
GitHub Release whose notes are that version's section of `CHANGELOG.md`, so the
|
|
1052
1190
|
section must exist before the push.
|
|
1053
1191
|
|
|
1054
|
-
⚠ **2.0.0 and the old tags.** The 2.x line of the previous package name
|
|
1055
|
-
(`@handijit/ui`) left the tags `v2.0.0`, `v2.1.0`, `v2.1.1` and `v2.2.0` on the
|
|
1056
|
-
origin. The workflow refuses to release onto an existing tag ("Tag v2.0.0
|
|
1057
|
-
already exists"), so before pushing 2.0.0 those four tags are renamed (for
|
|
1058
|
-
example to `handijit-ui-v2.0.0`) or deleted on the origin; otherwise the run
|
|
1059
|
-
fails after `verify`, before `npm publish`.
|
|
1060
|
-
|
|
1061
1192
|
## Design contract
|
|
1062
1193
|
|
|
1063
1194
|
Which element to use when, the surface ladder, colour roles, typography roles,
|
package/build/calendar.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),y=require("react"),me=require("@handijitcom/ui"),L=(...e)=>{let t="";for(const n of e)n&&(t=t===""?n:`${t} ${n}`);return t},we=(e,t)=>Object.assign(e,{displayName:t}),ge=new Set,re=(e,...t)=>{for(const n of t)if(n!==void 0)return n;return process.env.NODE_ENV!=="production"&&!ge.has(e)&&(ge.add(e),console.error(`[@handijitcom/ui] Eksik metin: ${e}. Prop olarak geçin ya da <UiProvider labels={…}> içinde bir kez tanımlayın. Metinsiz bırakılan öğe ekran okuyucuda adsız kalır.`)),""},ve=(e,t,...n)=>t?t(...n):re(e),ke=1440,W=e=>{const[t,n]=e.split(":");return Number(t)*60+Number(n??0)},Q=e=>`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`,F=e=>e.slice(0,10),U=e=>W(e.slice(11,16)),ee=(e,t)=>`${e}T${Q(t)}`,oe=(e,t)=>`${Q(e)}–${Q(t)}`,q=(e,t,n)=>Math.min(Math.max(e,t),n),Me=(e,t)=>`${e}|${t??""}`,je=(e,t)=>t&&t.length>0?e.flatMap((n,r)=>t.map((a,o)=>({index:r*t.length+o,day:n,resource:a,label:`${n.label}, ${a.label}`}))):e.map((n,r)=>({index:r,day:n,label:n.label})),pe=(e,t)=>{const n=F(e.start),r=F(e.end);return n<=t&&(t<r||t===r&&U(e.end)>0)},te=e=>F(e.start)===F(e.end),Ne=e=>{e.sort((o,s)=>o.startMin-s.startMin||s.endMin-o.endMin);let t=[],n=[],r=-1;const a=()=>{for(const o of t)o.lanes=n.length;t=[],n=[]};for(const o of e){o.startMin>=r&&a();const s=n.findIndex(_=>_<=o.startMin);o.lane=s===-1?n.length:s;const l=Math.max(o.endMin,o.startMin+1);n[o.lane]=l,r=Math.max(r,l),t.push(o)}a()},Ce=(e,t,n,r,a)=>{var k;const o=new Map(t.map(f=>{var c;return[Me(f.day.date,(c=f.resource)==null?void 0:c.id),f]})),s=t.some(f=>f.resource),l=t.map(()=>[]),_=(f,c)=>{const p=c.day.date,i=F(f.start)===p?U(f.start):0,m=F(f.end)===p?U(f.end):ke;m<=n||i>=r||l[c.index].push({key:`${f.id}@${c.index}`,event:f,column:c.index,startMin:Math.max(i,n),endMin:Math.min(m,r),lane:0,lanes:1,isMovable:a&&!f.isLocked&&te(f)&&i>=n&&m<=r})};for(const f of e){const c=s?f.resourceId:void 0;if(!(s&&c===void 0)){if(te(f)){const p=o.get(Me(F(f.start),c));p&&_(f,p);continue}for(const p of t)((k=p.resource)==null?void 0:k.id)===c&&pe(f,p.day.date)&&_(f,p)}}for(const f of l)Ne(f);return l},De=(e,t,n)=>{const r=new Map(t.map((s,l)=>[s.date,l])),a=t.map(()=>[]),o=(s,l)=>a[l].push({key:`${s.id}@${l}`,event:s,column:l,startMin:U(s.start),endMin:U(s.end),lane:0,lanes:1,isMovable:n&&!s.isLocked&&te(s)});for(const s of e){if(te(s)){const l=r.get(F(s.start));l!==void 0&&o(s,l);continue}t.forEach((l,_)=>{pe(s,l.date)&&o(s,_)})}for(const s of a)s.sort((l,_)=>l.event.start<_.event.start?-1:l.event.start>_.event.start?1:0);return a},$e=(e,t,n)=>(e??[]).flatMap((r,a)=>{const o=Math.max(W(r.start),t),s=Math.min(W(r.end),n);return s>o?[{key:`${a}`,label:r.label,startMin:o,endMin:s}]:[]}),V=(e,t,n,r,a)=>{if(a.view==="month")return r<0||r>=a.columnCount?void 0:{column:r,startMin:e.startMin,endMin:e.endMin};if(t){const l=Math.min(e.startMin+a.slotMinutes,a.rangeEnd);return{column:e.column,startMin:e.startMin,endMin:q(e.endMin+n,l,a.rangeEnd)}}const o=e.endMin-e.startMin,s=q(e.startMin+n,a.rangeStart,a.rangeEnd-o);return{column:q(r,0,a.columnCount-1),startMin:s,endMin:s+o}},Ee=(e,t,n,r,a)=>{var _;if(t.column===e.column&&t.startMin===e.startMin&&t.endMin===e.endMin)return;const s=n==="time"?r[t.column]:void 0,l=s?s.day.date:a[t.column].date;return{id:e.event.id,start:ee(l,t.startMin),end:ee(l,t.endMin),resourceId:((_=s==null?void 0:s.resource)==null?void 0:_.id)??e.event.resourceId}},Ae=e=>e==="ArrowUp"||e==="ArrowDown"||e==="ArrowLeft"||e==="ArrowRight",Re=(e,t,n)=>{if(n==="ArrowUp"||n==="ArrowDown"){const a=e[t.column],o=a.findIndex(s=>s.key===t.key);return a[o+(n==="ArrowDown"?1:-1)]}const r=n==="ArrowRight"?1:-1;for(let a=t.column+r;a>=0&&a<e.length;a+=r){const o=e[a];if(o.length!==0)return o.reduce((s,l)=>Math.abs(l.startMin-t.startMin)<Math.abs(s.startMin-t.startMin)?l:s)}},Te=(e,t,n,r)=>{const a=t==="ArrowUp"||t==="ArrowDown",o=t==="ArrowDown"||t==="ArrowRight"?1:-1;if(r.view==="month")return n?void 0:V(e,!1,0,e.column+o*(a?7:1),r);if(!(n&&!a))return a?V(e,n,o*r.slotMinutes,e.column,r):V(e,!1,0,e.column+o,r)},Le=4,Z=7,Oe=({bodyRef:e,bounds:t,onDrop:n})=>{const[r,a]=y.useState(null),o=y.useRef(null),s=y.useRef(!1),l=y.useRef({bounds:t,onDrop:n});l.current={bounds:t,onDrop:n};const _=(c,p)=>{var E;const i=(E=e.current)==null?void 0:E.getBoundingClientRect(),{bounds:m}=l.current;if(!i||i.width===0||i.height===0)return;if(m.view==="time"){const R=(m.rangeEnd-m.rangeStart)/i.height,$=(c.clientY-p.y)*R,x=Math.round($/m.slotMinutes)*m.slotMinutes,w=Math.floor((c.clientX-i.left)/i.width*m.columnCount);return V(p.item,p.isResize,x,w,m)}const j=Math.ceil(m.columnCount/Z),C=Math.floor((c.clientX-i.left)/i.width*Z),N=Math.floor((c.clientY-i.top)/i.height*j);if(!(C<0||C>=Z||N<0||N>=j))return V(p.item,!1,0,N*Z+C,m)},k=y.useCallback((c,p,i)=>{var x;if(s.current=!1,p.button!==0||!c.isMovable)return;(x=o.current)==null||x.call(o);const m={item:c,isResize:i,x:p.clientX,y:p.clientY,isStarted:!1},j=()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",R),window.removeEventListener("keydown",$,!0),o.current=null,a(null)},C=()=>{s.current=!0,window.setTimeout(()=>{s.current=!1},0)},N=w=>{const O=Math.hypot(w.clientX-m.x,w.clientY-m.y);if(!m.isStarted&&O<Le)return;m.isStarted=!0;const S=_(w,m);a(S?{key:m.item.key,isResize:m.isResize,target:S}:null)},E=w=>{if(j(),!m.isStarted)return;C();const O=_(w,m);O&&l.current.onDrop(m.item,O)},R=()=>j(),$=w=>{w.key!=="Escape"||!m.isStarted||(w.preventDefault(),w.stopPropagation(),C(),j())};window.addEventListener("pointermove",N),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",R),window.addEventListener("keydown",$,!0),o.current=j},[]);y.useEffect(()=>()=>{var c;return(c=o.current)==null?void 0:c.call(o)},[]);const f=y.useCallback(()=>s.current,[]);return{preview:r,begin:k,isClickSwallowed:f}},Se="ui-calendar-YEgbk",Ke="ui-srOnly-6NUr9",Ie="ui-scroller-IkPuv",Pe="ui-time-DPj2K",Ye="ui-corner-7ggOq",Fe="ui-headers-c6s18",Ue="ui-header-vuk-c",Xe="ui-resource-i6zVF",ze="ui-resource__detail-ssEve",Be="ui-gutter-YjM1s",Ge="ui-gutter__hour-oyYrg",Je="ui-gutter__band-D6P6s",He="ui-band-GkAex",qe="ui-columns-aXu-3",Ve="ui-column-BsLn7",We="ui-event-uQH1A",Qe="ui-event__body-jClWr",Ze="ui-event__time-8Nt0z",et="ui-event__handle-cXUkS",tt="ui-preview-FsJaC",nt="ui-preview__title-GkNhx",st="ui-month-aEknN",rt="ui-weekdays-VJ6EQ",ot="ui-cells-jQJ7X",at="ui-cell-c3itR",ct="ui-cell__day-40ADs",it="ui-cell__more-e3wMw",u={calendar:Se,srOnly:Ke,scroller:Ie,time:Pe,"time--bands":"ui-time--bands-7Kndf",corner:Ye,headers:Fe,header:Ue,resource:Xe,"header--today":"ui-header--today-eLJzT",resource__detail:ze,"resource--primary":"ui-resource--primary--iCwp","resource--neutral":"ui-resource--neutral-cxIaY","resource--success":"ui-resource--success-qhCEv","resource--warning":"ui-resource--warning-GR4eo","resource--danger":"ui-resource--danger-S8dwG","resource--info":"ui-resource--info-hZjna",gutter:Be,gutter__hour:Ge,gutter__band:Je,band:He,"band--alternate":"ui-band--alternate-5aeTI",columns:qe,column:Ve,"column--off":"ui-column--off-4yR85",event:We,"event--primary":"ui-event--primary-ykXcJ","event--neutral":"ui-event--neutral-uTBTX","event--success":"ui-event--success-vosp6","event--warning":"ui-event--warning-scg6H","event--danger":"ui-event--danger-UY-OD","event--info":"ui-event--info-SHlJD","event--time":"ui-event--time-cg0iK","event--month":"ui-event--month-7wAJO","event--movable":"ui-event--movable-1n8nf","event--dragging":"ui-event--dragging-E2r9s","event--cancelled":"ui-event--cancelled-eG-x9",event__body:Qe,event__time:Ze,event__handle:et,preview:tt,preview__title:nt,month:st,weekdays:rt,cells:ot,cell:at,"cell--off":"ui-cell--off-TIR0O","cell--outside":"ui-cell--outside-F23oJ",cell__day:ct,"cell--target":"ui-cell--target-utfa-","cell__day--today":"ui-cell__day--today-2i28S",cell__more:it},lt=(e,t,n)=>({"--ui-calendar-top":`${(e.startMin-t)/n*100}%`,"--ui-calendar-height":`${(e.endMin-e.startMin)/n*100}%`,"--ui-calendar-lane":e.lane,"--ui-calendar-lanes":e.lanes}),ut=({item:e,view:t,isActive:n,isDragSource:r,isResizable:a,rangeStart:o,rangeLength:s,columnLabel:l,cancelledLabel:_,renderEvent:k,handlers:f})=>{const{event:c}=e,p=t==="time"?oe(U(c.start),U(c.end)):Q(U(c.start));return d.jsxs("button",{type:"button",className:L(u.event,u[`event--${t}`],u[`event--${c.tone??"primary"}`],c.isCancelled&&u["event--cancelled"],e.isMovable&&u["event--movable"],r&&u["event--dragging"]),style:t==="time"?lt(e,o,s):void 0,tabIndex:n?0:-1,"data-key":e.key,onPointerDown:i=>f.onPointerDown(e,i,!1),onClick:i=>f.onClick(e,i),onKeyDown:i=>f.onKeyDown(e,i),onFocus:()=>f.onFocus(e),children:[c.isCancelled&&d.jsx("span",{className:u.srOnly,children:`${_}: `}),d.jsx("span",{className:u.event__time,children:p}),d.jsx("span",{className:u.event__body,children:k?k(c):c.title}),d.jsx("span",{className:u.srOnly,children:`, ${l}`}),a&&d.jsx("span",{className:u.event__handle,"aria-hidden":!0,onPointerDown:i=>{i.stopPropagation(),f.onPointerDown(e,i,!0)}})]})},_e=y.memo(ut),dt=7,ht=({days:e,shown:t,hiddenCounts:n,weekdays:r,selectedDate:a,bodyRef:o,activeKey:s,preview:l,cancelledLabel:_,formatMore:k,renderEvent:f,handlers:c,onDaySelect:p})=>d.jsxs("div",{className:u.month,style:{"--ui-calendar-rows":Math.ceil(e.length/dt)},children:[r&&d.jsx("div",{className:u.weekdays,"aria-hidden":!0,children:r.map(i=>d.jsx("span",{children:i},i))}),d.jsx("div",{ref:o,className:u.cells,children:e.map((i,m)=>{const j=n[m],C=i.shortLabel??i.label;return d.jsxs("div",{role:"group","aria-label":i.label,className:L(u.cell,i.isOff&&u["cell--off"],i.isOutside&&u["cell--outside"],(l==null?void 0:l.target.column)===m&&u["cell--target"]),children:[p?d.jsx("button",{type:"button",className:L(u.cell__day,i.isToday&&u["cell__day--today"]),"aria-label":i.label,"aria-current":i.isToday?"date":void 0,"aria-pressed":a===void 0?void 0:i.date===a,onClick:()=>p(i.date),children:C}):d.jsx("span",{className:L(u.cell__day,i.isToday&&u["cell__day--today"]),"aria-hidden":!0,children:C}),t[m].map(N=>d.jsx(_e,{item:N,view:"month",isActive:N.key===s,isDragSource:N.key===(l==null?void 0:l.key),isResizable:!1,rangeStart:0,rangeLength:1,columnLabel:i.label,cancelledLabel:_,renderEvent:f,handlers:c},N.key)),j>0&&(p?d.jsx("button",{type:"button",className:u.cell__more,onClick:()=>p(i.date),children:k(j)}):d.jsx("span",{className:u.cell__more,children:k(j)}))]},i.date)})})]}),ft=({day:e,span:t})=>d.jsx("div",{className:L(u.header,e.isToday&&u["header--today"]),style:{gridColumn:`span ${t}`},"aria-current":e.isToday?"date":void 0,children:e.shortLabel?d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,children:e.shortLabel}),d.jsx("span",{className:u.srOnly,children:e.label})]}):e.label}),mt=({resource:e,renderResource:t})=>d.jsx("div",{className:L(u.resource,e.tone&&u[`resource--${e.tone}`]),"data-tone":e.tone,children:t?t(e):d.jsxs(d.Fragment,{children:[e.label,e.detail&&d.jsx("span",{className:u.resource__detail,children:e.detail})]})}),gt=({label:e,days:t,resources:n,columns:r,bands:a,placed:o,rangeStart:s,rangeEnd:l,slotMinutes:_,bodyRef:k,activeKey:f,preview:c,isEditable:p,cancelledLabel:i,renderEvent:m,renderResource:j,handlers:C,isClickSwallowed:N,onSlotSelect:E,onExternalDrop:R})=>{const $=l-s,x=(n==null?void 0:n.length)??0,w=x>0,O=Array.from({length:Math.floor((l-1)/60)-Math.ceil(s/60)+1},(h,g)=>(Math.ceil(s/60)+g)*60),S=h=>`${h/$*100}%`,K=h=>S(h-s),G=c?o.flat().find(h=>h.key===c.key):void 0,X=(h,g,T)=>{var z;const A=g.getBoundingClientRect(),ne=A.height>0?q((T-A.top)/A.height,0,1):0,P=Math.floor(ne*$/_)*_,Y=q(s+P,s,l-_);return{start:ee(h.day.date,Y),end:ee(h.day.date,Y+_),resourceId:(z=h.resource)==null?void 0:z.id}},I={"--ui-calendar-columns":r.length,"--ui-calendar-hours":$/60,"--ui-calendar-slot-ratio":_/60};return d.jsx("div",{className:u.scroller,...o.some(h=>h.length>0)?{}:{tabIndex:0,role:"region","aria-label":e},children:d.jsxs("div",{className:L(u.time,a.length>0&&u["time--bands"]),style:I,children:[d.jsx("div",{className:u.corner}),d.jsxs("div",{className:u.headers,children:[t.map(h=>d.jsx(ft,{day:h,span:w?x:1},h.date)),w&&r.map(h=>d.jsx(mt,{resource:h.resource,renderResource:j},h.index))]}),d.jsxs("div",{className:u.gutter,"aria-hidden":!0,children:[O.map(h=>d.jsx("span",{className:u.gutter__hour,style:{top:K(h)},children:Q(h)},h)),a.map(h=>d.jsx("span",{className:u.gutter__band,style:{top:K(h.startMin),height:S(h.endMin-h.startMin)},children:h.label},h.key))]}),d.jsx("div",{ref:k,className:u.columns,children:r.map(h=>d.jsxs("div",{role:"group","aria-label":h.label,className:L(u.column,h.day.isOff&&u["column--off"]),onClick:E?g=>{g.target!==g.currentTarget||N()||E(X(h,g.currentTarget,g.clientY))}:void 0,onDragOver:R?g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"}:void 0,onDrop:R?g=>{g.preventDefault(),R({...X(h,g.currentTarget,g.clientY),data:g.dataTransfer.getData("text/plain")})}:void 0,children:[a.map((g,T)=>d.jsx("div",{className:L(u.band,T%2===1&&u["band--alternate"]),style:{top:K(g.startMin),height:S(g.endMin-g.startMin)},"aria-hidden":!0},g.key)),o[h.index].map(g=>d.jsx(_e,{item:g,view:"time",isActive:g.key===f,isDragSource:g.key===(c==null?void 0:c.key),isResizable:p&&g.isMovable,rangeStart:s,rangeLength:$,columnLabel:h.label,cancelledLabel:i,renderEvent:m,handlers:C},g.key)),c&&G&&c.target.column===h.index&&d.jsxs("div",{className:u.preview,style:{"--ui-calendar-top":K(c.target.startMin),"--ui-calendar-height":`${(c.target.endMin-c.target.startMin)/$*100}%`},"aria-hidden":!0,children:[oe(c.target.startMin,c.target.endMin),d.jsx("span",{className:u.preview__title,children:G.event.title})]})]},h.index))})]})})},vt=3,Mt=({label:e,days:t,events:n,view:r="time",resources:a,renderResource:o,bands:s,startTime:l="08:00",endTime:_="20:00",slotMinutes:k=30,weekdays:f,maxEventsPerDay:c=vt,selectedDate:p,onEventChange:i,onEventOpen:m,onSlotSelect:j,onDaySelect:C,onExternalDrop:N,renderEvent:E,className:R,testId:$})=>{var de,he,fe;const{labels:x}=me.useUi(),w=me.useAnnounce(),O=y.useId(),S=y.useRef(null),K=y.useRef(null),[G,X]=y.useState(),I=y.useRef(null),h=!!i,g=W(l),T=W(_),A=y.useMemo(()=>je(t,a),[t,a]),ne=y.useMemo(()=>$e(s,g,T),[s,g,T]),P=y.useMemo(()=>r==="time"?Ce(n,A,g,T,h):De(n,t,h),[r,n,A,t,g,T,h]),Y=y.useMemo(()=>r==="month"?P.map(v=>v.slice(0,c)):P,[r,P,c]),z={view:r,columnCount:r==="time"?A.length:t.length,rangeStart:g,rangeEnd:T,slotMinutes:k},ae=Y.flat(),ce=ae.some(v=>v.key===G)?G:(de=ae[0])==null?void 0:de.key,ye=v=>r==="time"?A[v.column].label:t[v.column].label,J=y.useRef({view:r,columns:A,days:t,onEventChange:i,onEventOpen:m,focusable:Y,bounds:z});J.current={view:r,columns:A,days:t,onEventChange:i,onEventOpen:m,focusable:Y,bounds:z};const se=y.useCallback((v,M)=>{const b=J.current,D=Ee(v,M,b.view,b.columns,b.days);if(!(!D||!b.onEventChange))return b.onEventChange(D),D},[]),H=Oe({bodyRef:K,bounds:z,onDrop:se}),ie=v=>{const b=[...S.current.querySelectorAll("[data-key]")].find(D=>D.dataset.key===v);b==null||b.focus()},le=y.useMemo(()=>({onPointerDown:(v,M,b)=>{I.current=null,J.current.onEventChange&&H.begin(v,M,b)},onClick:(v,M)=>{var b,D;H.isClickSwallowed()||(D=(b=J.current).onEventOpen)==null||D.call(b,v.event.id)},onFocus:v=>X(v.key),onKeyDown:(v,M)=>{if(I.current=null,!Ae(M.key))return;const b=J.current;if(M.metaKey||M.ctrlKey){if(M.preventDefault(),!v.isMovable)return;const B=Te(v,M.key,M.shiftKey,b.bounds);if(!B)return;I.current={key:`${v.event.id}@${B.column}`,before:v.event},se(v,B)||(I.current=null);return}const D=Re(b.focusable,v,M.key);D&&(M.preventDefault(),X(D.key),ie(D.key))}}),[se]);y.useEffect(()=>{var B;const v=I.current;if(!v)return;const M=P.flat().find(xe=>xe.key===v.key),{before:b}=v;M!==void 0&&(M.event.start!==b.start||M.event.end!==b.end||M.event.resourceId!==b.resourceId)&&(I.current=null,X(M.key),ie(M.key),w(ve("Calendar.moved",(B=x==null?void 0:x.calendar)==null?void 0:B.moved,M.event.title,`${ye(M)}, ${oe(M.startMin,M.endMin)}`)))},[n]);const ue=re("Calendar.cancelled",(he=x==null?void 0:x.calendar)==null?void 0:he.cancelled),be=re("Calendar.instructions",(fe=x==null?void 0:x.calendar)==null?void 0:fe.instructions);return d.jsxs("div",{ref:S,className:L(u.calendar,R),role:"group","aria-label":e,"aria-describedby":O,"data-testid":$,children:[d.jsx("span",{id:O,className:u.srOnly,children:be}),r==="time"?d.jsx(gt,{label:e,days:t,resources:a,columns:A,bands:ne,placed:P,rangeStart:g,rangeEnd:T,slotMinutes:k,bodyRef:K,activeKey:ce,preview:H.preview,isEditable:h,cancelledLabel:ue,renderEvent:E,renderResource:o,handlers:le,isClickSwallowed:H.isClickSwallowed,onSlotSelect:j,onExternalDrop:N}):d.jsx(ht,{days:t,shown:Y,hiddenCounts:P.map((v,M)=>v.length-Y[M].length),weekdays:f,selectedDate:p,bodyRef:K,activeKey:ce,preview:H.preview,cancelledLabel:ue,formatMore:v=>{var M;return ve("Calendar.more",(M=x==null?void 0:x.calendar)==null?void 0:M.more,v)},renderEvent:E,handlers:le,onDaySelect:C})]})},pt=y.memo(we(Mt,"Calendar"));exports.Calendar=pt;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),y=require("react"),me=require("@handijitcom/ui"),L=(...e)=>{let t="";for(const n of e)n&&(t=t===""?n:`${t} ${n}`);return t},ke=(e,t)=>Object.assign(e,{displayName:t}),ge=new Set,se=(e,...t)=>{for(const n of t)if(n!==void 0)return n;return process.env.NODE_ENV!=="production"&&!ge.has(e)&&(ge.add(e),console.error(`[@handijitcom/ui] Eksik metin: ${e}. Prop olarak geçin ya da <UiProvider labels={…}> içinde bir kez tanımlayın. Metinsiz bırakılan öğe ekran okuyucuda adsız kalır.`)),""},Me=(e,t,...n)=>t?t(...n):se(e),we=1440,W=e=>{const[t,n]=e.split(":");return Number(t)*60+Number(n??0)},Q=e=>`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`,F=e=>e.slice(0,10),U=e=>W(e.slice(11,16)),ee=(e,t)=>`${e}T${Q(t)}`,oe=(e,t)=>`${Q(e)}–${Q(t)}`,q=(e,t,n)=>Math.min(Math.max(e,t),n),pe=(e,t)=>`${e}|${t??""}`,je=(e,t)=>t&&t.length>0?e.flatMap((n,s)=>t.map((a,o)=>({index:s*t.length+o,day:n,resource:a,label:`${n.label}, ${a.label}`}))):e.map((n,s)=>({index:s,day:n,label:n.label})),ve=(e,t)=>{const n=F(e.start),s=F(e.end);return n<=t&&(t<s||t===s&&U(e.end)>0)},te=e=>F(e.start)===F(e.end),Ne=e=>{e.sort((o,r)=>o.startMin-r.startMin||r.endMin-o.endMin);let t=[],n=[],s=-1;const a=()=>{for(const o of t)o.lanes=n.length;t=[],n=[]};for(const o of e){o.startMin>=s&&a();const r=n.findIndex(_=>_<=o.startMin);o.lane=r===-1?n.length:r;const l=Math.max(o.endMin,o.startMin+1);n[o.lane]=l,s=Math.max(s,l),t.push(o)}a()},Ce=(e,t,n,s,a)=>{var w;const o=new Map(t.map(f=>{var c;return[pe(f.day.date,(c=f.resource)==null?void 0:c.id),f]})),r=t.some(f=>f.resource),l=t.map(()=>[]),_=(f,c)=>{const v=c.day.date,i=F(f.start)===v?U(f.start):0,m=F(f.end)===v?U(f.end):we;m<=n||i>=s||l[c.index].push({key:`${f.id}@${c.index}`,event:f,column:c.index,startMin:Math.max(i,n),endMin:Math.min(m,s),lane:0,lanes:1,isMovable:a&&!f.isLocked&&te(f)&&i>=n&&m<=s})};for(const f of e){const c=r?f.resourceId:void 0;if(!(r&&c===void 0)){if(te(f)){const v=o.get(pe(F(f.start),c));v&&_(f,v);continue}for(const v of t)((w=v.resource)==null?void 0:w.id)===c&&ve(f,v.day.date)&&_(f,v)}}for(const f of l)Ne(f);return l},De=(e,t,n)=>{const s=new Map(t.map((r,l)=>[r.date,l])),a=t.map(()=>[]),o=(r,l)=>a[l].push({key:`${r.id}@${l}`,event:r,column:l,startMin:U(r.start),endMin:U(r.end),lane:0,lanes:1,isMovable:n&&!r.isLocked&&te(r)});for(const r of e){if(te(r)){const l=s.get(F(r.start));l!==void 0&&o(r,l);continue}t.forEach((l,_)=>{ve(r,l.date)&&o(r,_)})}for(const r of a)r.sort((l,_)=>l.event.start<_.event.start?-1:l.event.start>_.event.start?1:0);return a},$e=(e,t,n)=>(e??[]).flatMap((s,a)=>{const o=Math.max(W(s.start),t),r=Math.min(W(s.end),n);return r>o?[{key:`${a}`,label:s.label,startMin:o,endMin:r}]:[]}),V=(e,t,n,s,a)=>{if(a.view==="month")return s<0||s>=a.columnCount?void 0:{column:s,startMin:e.startMin,endMin:e.endMin};if(t){const l=Math.min(e.startMin+a.slotMinutes,a.rangeEnd);return{column:e.column,startMin:e.startMin,endMin:q(e.endMin+n,l,a.rangeEnd)}}const o=e.endMin-e.startMin,r=q(e.startMin+n,a.rangeStart,a.rangeEnd-o);return{column:q(s,0,a.columnCount-1),startMin:r,endMin:r+o}},Ae=(e,t,n,s,a)=>{var _;if(t.column===e.column&&t.startMin===e.startMin&&t.endMin===e.endMin)return;const r=n==="time"?s[t.column]:void 0,l=r?r.day.date:a[t.column].date;return{id:e.event.id,start:ee(l,t.startMin),end:ee(l,t.endMin),resourceId:((_=r==null?void 0:r.resource)==null?void 0:_.id)??e.event.resourceId}},Ee=e=>e==="ArrowUp"||e==="ArrowDown"||e==="ArrowLeft"||e==="ArrowRight",Re=(e,t,n)=>{if(n==="ArrowUp"||n==="ArrowDown"){const a=e[t.column],o=a.findIndex(r=>r.key===t.key);return a[o+(n==="ArrowDown"?1:-1)]}const s=n==="ArrowRight"?1:-1;for(let a=t.column+s;a>=0&&a<e.length;a+=s){const o=e[a];if(o.length!==0)return o.reduce((r,l)=>Math.abs(l.startMin-t.startMin)<Math.abs(r.startMin-t.startMin)?l:r)}},Te=(e,t,n,s)=>{const a=t==="ArrowUp"||t==="ArrowDown",o=t==="ArrowDown"||t==="ArrowRight"?1:-1;if(s.view==="month")return n?void 0:V(e,!1,0,e.column+o*(a?7:1),s);if(!(n&&!a))return a?V(e,n,o*s.slotMinutes,e.column,s):V(e,!1,0,e.column+o,s)},Le=4,Z=7,Oe=({bodyRef:e,bounds:t,onDrop:n})=>{const[s,a]=y.useState(null),o=y.useRef(null),r=y.useRef(!1),l=y.useRef({bounds:t,onDrop:n});l.current={bounds:t,onDrop:n};const _=(c,v)=>{var A;const i=(A=e.current)==null?void 0:A.getBoundingClientRect(),{bounds:m}=l.current;if(!i||i.width===0||i.height===0)return;if(m.view==="time"){const R=(m.rangeEnd-m.rangeStart)/i.height,$=(c.clientY-v.y)*R,x=Math.round($/m.slotMinutes)*m.slotMinutes,k=Math.floor((c.clientX-i.left)/i.width*m.columnCount);return V(v.item,v.isResize,x,k,m)}const j=Math.ceil(m.columnCount/Z),C=Math.floor((c.clientX-i.left)/i.width*Z),N=Math.floor((c.clientY-i.top)/i.height*j);if(!(C<0||C>=Z||N<0||N>=j))return V(v.item,!1,0,N*Z+C,m)},w=y.useCallback((c,v,i)=>{var x;if(r.current=!1,v.button!==0||!c.isMovable)return;(x=o.current)==null||x.call(o);const m={item:c,isResize:i,x:v.clientX,y:v.clientY,isStarted:!1},j=()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",R),window.removeEventListener("keydown",$,!0),o.current=null,a(null)},C=()=>{r.current=!0,window.setTimeout(()=>{r.current=!1},0)},N=k=>{const O=Math.hypot(k.clientX-m.x,k.clientY-m.y);if(!m.isStarted&&O<Le)return;m.isStarted=!0;const S=_(k,m);a(S?{key:m.item.key,isResize:m.isResize,target:S}:null)},A=k=>{if(j(),!m.isStarted)return;C();const O=_(k,m);O&&l.current.onDrop(m.item,O)},R=()=>j(),$=k=>{k.key!=="Escape"||!m.isStarted||(k.preventDefault(),k.stopPropagation(),C(),j())};window.addEventListener("pointermove",N),window.addEventListener("pointerup",A),window.addEventListener("pointercancel",R),window.addEventListener("keydown",$,!0),o.current=j},[]);y.useEffect(()=>()=>{var c;return(c=o.current)==null?void 0:c.call(o)},[]);const f=y.useCallback(()=>r.current,[]);return{preview:s,begin:w,isClickSwallowed:f}},Se="ui-calendar-YEgbk",Ke="ui-srOnly-6NUr9",Ie="ui-scroller-IkPuv",Pe="ui-time-DPj2K",Ye="ui-corner-7ggOq",Fe="ui-headers-c6s18",Ue="ui-header-vuk-c",Xe="ui-resource-i6zVF",ze="ui-resource__detail-ssEve",Be="ui-gutter-YjM1s",Je="ui-gutter__hour-oyYrg",Ge="ui-gutter__band-D6P6s",He="ui-band-GkAex",qe="ui-columns-aXu-3",Ve="ui-column-BsLn7",We="ui-event-uQH1A",Qe="ui-event__body-jClWr",Ze="ui-event__time-8Nt0z",et="ui-event__handle-cXUkS",tt="ui-preview-FsJaC",nt="ui-preview__title-GkNhx",rt="ui-month-aEknN",st="ui-weekdays-VJ6EQ",ot="ui-cells-jQJ7X",at="ui-cell-c3itR",ct="ui-cell__day-40ADs",it="ui-cell__more-e3wMw",u={calendar:Se,srOnly:Ke,scroller:Ie,time:Pe,"time--bands":"ui-time--bands-7Kndf",corner:Ye,headers:Fe,header:Ue,resource:Xe,"header--today":"ui-header--today-eLJzT",resource__detail:ze,"resource--primary":"ui-resource--primary--iCwp","resource--neutral":"ui-resource--neutral-cxIaY","resource--ink":"ui-resource--ink-uNsDF","resource--danger":"ui-resource--danger-S8dwG","resource--info":"ui-resource--info-hZjna",gutter:Be,gutter__hour:Je,gutter__band:Ge,band:He,"band--alternate":"ui-band--alternate-5aeTI",columns:qe,column:Ve,"column--off":"ui-column--off-4yR85",event:We,"event--primary":"ui-event--primary-ykXcJ","event--neutral":"ui-event--neutral-uTBTX","event--ink":"ui-event--ink-bChwl","event--danger":"ui-event--danger-UY-OD","event--info":"ui-event--info-SHlJD","event--time":"ui-event--time-cg0iK","event--month":"ui-event--month-7wAJO","event--movable":"ui-event--movable-1n8nf","event--dragging":"ui-event--dragging-E2r9s","event--cancelled":"ui-event--cancelled-eG-x9",event__body:Qe,event__time:Ze,event__handle:et,preview:tt,preview__title:nt,month:rt,weekdays:st,cells:ot,cell:at,"cell--off":"ui-cell--off-TIR0O","cell--outside":"ui-cell--outside-F23oJ",cell__day:ct,"cell--target":"ui-cell--target-utfa-","cell__day--today":"ui-cell__day--today-2i28S",cell__more:it},lt=(e,t,n)=>({"--ui-calendar-top":`${(e.startMin-t)/n*100}%`,"--ui-calendar-height":`${(e.endMin-e.startMin)/n*100}%`,"--ui-calendar-lane":e.lane,"--ui-calendar-lanes":e.lanes}),ut=({item:e,view:t,isActive:n,isDragSource:s,isResizable:a,rangeStart:o,rangeLength:r,columnLabel:l,cancelledLabel:_,renderEvent:w,handlers:f})=>{const{event:c}=e,v=t==="time"?oe(U(c.start),U(c.end)):Q(U(c.start));return d.jsxs("button",{type:"button",className:L(u.event,u[`event--${t}`],u[`event--${c.tone??"primary"}`],c.isCancelled&&u["event--cancelled"],e.isMovable&&u["event--movable"],s&&u["event--dragging"]),style:t==="time"?lt(e,o,r):void 0,tabIndex:n?0:-1,"data-key":e.key,onPointerDown:i=>f.onPointerDown(e,i,!1),onClick:i=>f.onClick(e,i),onKeyDown:i=>f.onKeyDown(e,i),onFocus:()=>f.onFocus(e),children:[c.isCancelled&&d.jsx("span",{className:u.srOnly,children:`${_}: `}),d.jsx("span",{className:u.event__time,children:v}),d.jsx("span",{className:u.event__body,children:w?w(c):c.title}),d.jsx("span",{className:u.srOnly,children:`, ${l}`}),a&&d.jsx("span",{className:u.event__handle,"aria-hidden":!0,onPointerDown:i=>{i.stopPropagation(),f.onPointerDown(e,i,!0)}})]})},_e=y.memo(ut),dt=7,ht=({days:e,shown:t,hiddenCounts:n,weekdays:s,selectedDate:a,bodyRef:o,activeKey:r,preview:l,cancelledLabel:_,formatMore:w,renderEvent:f,handlers:c,onDaySelect:v})=>d.jsxs("div",{className:u.month,style:{"--ui-calendar-rows":Math.ceil(e.length/dt)},children:[s&&d.jsx("div",{className:u.weekdays,"aria-hidden":!0,children:s.map(i=>d.jsx("span",{children:i},i))}),d.jsx("div",{ref:o,className:u.cells,children:e.map((i,m)=>{const j=n[m],C=i.shortLabel??i.label;return d.jsxs("div",{role:"group","aria-label":i.label,className:L(u.cell,i.isOff&&u["cell--off"],i.isOutside&&u["cell--outside"],(l==null?void 0:l.target.column)===m&&u["cell--target"]),children:[v?d.jsx("button",{type:"button",className:L(u.cell__day,i.isToday&&u["cell__day--today"]),"aria-label":i.label,"aria-current":i.isToday?"date":void 0,"aria-pressed":a===void 0?void 0:i.date===a,onClick:()=>v(i.date),children:C}):d.jsx("span",{className:L(u.cell__day,i.isToday&&u["cell__day--today"]),"aria-hidden":!0,children:C}),t[m].map(N=>d.jsx(_e,{item:N,view:"month",isActive:N.key===r,isDragSource:N.key===(l==null?void 0:l.key),isResizable:!1,rangeStart:0,rangeLength:1,columnLabel:i.label,cancelledLabel:_,renderEvent:f,handlers:c},N.key)),j>0&&(v?d.jsx("button",{type:"button",className:u.cell__more,onClick:()=>v(i.date),children:w(j)}):d.jsx("span",{className:u.cell__more,children:w(j)}))]},i.date)})})]}),ft=({day:e,span:t})=>d.jsx("div",{className:L(u.header,e.isToday&&u["header--today"]),style:{gridColumn:`span ${t}`},"aria-current":e.isToday?"date":void 0,children:e.shortLabel?d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,children:e.shortLabel}),d.jsx("span",{className:u.srOnly,children:e.label})]}):e.label}),mt=({resource:e,renderResource:t})=>d.jsx("div",{className:L(u.resource,e.tone&&u[`resource--${e.tone}`]),"data-tone":e.tone,children:t?t(e):d.jsxs(d.Fragment,{children:[e.label,e.detail&&d.jsx("span",{className:u.resource__detail,children:e.detail})]})}),gt=({label:e,days:t,resources:n,columns:s,bands:a,placed:o,rangeStart:r,rangeEnd:l,slotMinutes:_,bodyRef:w,activeKey:f,preview:c,isEditable:v,cancelledLabel:i,renderEvent:m,renderResource:j,handlers:C,isClickSwallowed:N,onSlotSelect:A,onExternalDrop:R})=>{const $=l-r,x=(n==null?void 0:n.length)??0,k=x>0,O=Array.from({length:Math.floor((l-1)/60)-Math.ceil(r/60)+1},(h,g)=>(Math.ceil(r/60)+g)*60),S=h=>`${h/$*100}%`,K=h=>S(h-r),J=c?o.flat().find(h=>h.key===c.key):void 0,X=(h,g,T)=>{var z;const E=g.getBoundingClientRect(),ne=E.height>0?q((T-E.top)/E.height,0,1):0,P=Math.floor(ne*$/_)*_,Y=q(r+P,r,l-_);return{start:ee(h.day.date,Y),end:ee(h.day.date,Y+_),resourceId:(z=h.resource)==null?void 0:z.id}},I={"--ui-calendar-columns":s.length,"--ui-calendar-hours":$/60,"--ui-calendar-slot-ratio":_/60};return d.jsx("div",{className:u.scroller,...o.some(h=>h.length>0)?{}:{tabIndex:0,role:"region","aria-label":e},children:d.jsxs("div",{className:L(u.time,a.length>0&&u["time--bands"]),style:I,children:[d.jsx("div",{className:u.corner}),d.jsxs("div",{className:u.headers,children:[t.map(h=>d.jsx(ft,{day:h,span:k?x:1},h.date)),k&&s.map(h=>d.jsx(mt,{resource:h.resource,renderResource:j},h.index))]}),d.jsxs("div",{className:u.gutter,"aria-hidden":!0,children:[O.map(h=>d.jsx("span",{className:u.gutter__hour,style:{top:K(h)},children:Q(h)},h)),a.map(h=>d.jsx("span",{className:u.gutter__band,style:{top:K(h.startMin),height:S(h.endMin-h.startMin)},children:h.label},h.key))]}),d.jsx("div",{ref:w,className:u.columns,children:s.map(h=>d.jsxs("div",{role:"group","aria-label":h.label,className:L(u.column,h.day.isOff&&u["column--off"]),onClick:A?g=>{g.target!==g.currentTarget||N()||A(X(h,g.currentTarget,g.clientY))}:void 0,onDragOver:R?g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"}:void 0,onDrop:R?g=>{g.preventDefault(),R({...X(h,g.currentTarget,g.clientY),data:g.dataTransfer.getData("text/plain")})}:void 0,children:[a.map((g,T)=>d.jsx("div",{className:L(u.band,T%2===1&&u["band--alternate"]),style:{top:K(g.startMin),height:S(g.endMin-g.startMin)},"aria-hidden":!0},g.key)),o[h.index].map(g=>d.jsx(_e,{item:g,view:"time",isActive:g.key===f,isDragSource:g.key===(c==null?void 0:c.key),isResizable:v&&g.isMovable,rangeStart:r,rangeLength:$,columnLabel:h.label,cancelledLabel:i,renderEvent:m,handlers:C},g.key)),c&&J&&c.target.column===h.index&&d.jsxs("div",{className:u.preview,style:{"--ui-calendar-top":K(c.target.startMin),"--ui-calendar-height":`${(c.target.endMin-c.target.startMin)/$*100}%`},"aria-hidden":!0,children:[oe(c.target.startMin,c.target.endMin),d.jsx("span",{className:u.preview__title,children:J.event.title})]})]},h.index))})]})})},Mt=3,pt=({label:e,days:t,events:n,view:s="time",resources:a,renderResource:o,bands:r,startTime:l="08:00",endTime:_="20:00",slotMinutes:w=30,weekdays:f,maxEventsPerDay:c=Mt,selectedDate:v,onEventChange:i,onEventOpen:m,onSlotSelect:j,onDaySelect:C,onExternalDrop:N,renderEvent:A,className:R,testId:$})=>{var de,he,fe;const{labels:x}=me.useUi(),k=me.useAnnounce(),O=y.useId(),S=y.useRef(null),K=y.useRef(null),[J,X]=y.useState(),I=y.useRef(null),h=!!i,g=W(l),T=W(_),E=y.useMemo(()=>je(t,a),[t,a]),ne=y.useMemo(()=>$e(r,g,T),[r,g,T]),P=y.useMemo(()=>s==="time"?Ce(n,E,g,T,h):De(n,t,h),[s,n,E,t,g,T,h]),Y=y.useMemo(()=>s==="month"?P.map(M=>M.slice(0,c)):P,[s,P,c]),z={view:s,columnCount:s==="time"?E.length:t.length,rangeStart:g,rangeEnd:T,slotMinutes:w},ae=Y.flat(),ce=ae.some(M=>M.key===J)?J:(de=ae[0])==null?void 0:de.key,ye=M=>s==="time"?E[M.column].label:t[M.column].label,G=y.useRef({view:s,columns:E,days:t,onEventChange:i,onEventOpen:m,focusable:Y,bounds:z});G.current={view:s,columns:E,days:t,onEventChange:i,onEventOpen:m,focusable:Y,bounds:z};const re=y.useCallback((M,p)=>{const b=G.current,D=Ae(M,p,b.view,b.columns,b.days);if(!(!D||!b.onEventChange))return b.onEventChange(D),D},[]),H=Oe({bodyRef:K,bounds:z,onDrop:re}),ie=M=>{const b=[...S.current.querySelectorAll("[data-key]")].find(D=>D.dataset.key===M);b==null||b.focus()},le=y.useMemo(()=>({onPointerDown:(M,p,b)=>{I.current=null,G.current.onEventChange&&H.begin(M,p,b)},onClick:(M,p)=>{var b,D;H.isClickSwallowed()||(D=(b=G.current).onEventOpen)==null||D.call(b,M.event.id)},onFocus:M=>X(M.key),onKeyDown:(M,p)=>{if(I.current=null,!Ee(p.key))return;const b=G.current;if(p.metaKey||p.ctrlKey){if(p.preventDefault(),!M.isMovable)return;const B=Te(M,p.key,p.shiftKey,b.bounds);if(!B)return;I.current={key:`${M.event.id}@${B.column}`,before:M.event},re(M,B)||(I.current=null);return}const D=Re(b.focusable,M,p.key);D&&(p.preventDefault(),X(D.key),ie(D.key))}}),[re]);y.useEffect(()=>{var B;const M=I.current;if(!M)return;const p=P.flat().find(xe=>xe.key===M.key),{before:b}=M;p!==void 0&&(p.event.start!==b.start||p.event.end!==b.end||p.event.resourceId!==b.resourceId)&&(I.current=null,X(p.key),ie(p.key),k(Me("Calendar.moved",(B=x==null?void 0:x.calendar)==null?void 0:B.moved,p.event.title,`${ye(p)}, ${oe(p.startMin,p.endMin)}`)))},[n]);const ue=se("Calendar.cancelled",(he=x==null?void 0:x.calendar)==null?void 0:he.cancelled),be=se("Calendar.instructions",(fe=x==null?void 0:x.calendar)==null?void 0:fe.instructions);return d.jsxs("div",{ref:S,className:L(u.calendar,R),role:"group","aria-label":e,"aria-describedby":O,"data-testid":$,children:[d.jsx("span",{id:O,className:u.srOnly,children:be}),s==="time"?d.jsx(gt,{label:e,days:t,resources:a,columns:E,bands:ne,placed:P,rangeStart:g,rangeEnd:T,slotMinutes:w,bodyRef:K,activeKey:ce,preview:H.preview,isEditable:h,cancelledLabel:ue,renderEvent:A,renderResource:o,handlers:le,isClickSwallowed:H.isClickSwallowed,onSlotSelect:j,onExternalDrop:N}):d.jsx(ht,{days:t,shown:Y,hiddenCounts:P.map((M,p)=>M.length-Y[p].length),weekdays:f,selectedDate:v,bodyRef:K,activeKey:ce,preview:H.preview,cancelledLabel:ue,formatMore:M=>{var p;return Me("Calendar.more",(p=x==null?void 0:x.calendar)==null?void 0:p.more,M)},renderEvent:A,handlers:le,onDaySelect:C})]})},vt=y.memo(ke(pt,"Calendar"));exports.Calendar=vt;
|
|
2
2
|
//# sourceMappingURL=calendar.cjs.map
|