@seekbuddy/dsh-ui 0.0.0-stage → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +22 -0
  3. package/README.md +175 -2
  4. package/README.zh.md +176 -0
  5. package/THIRD_PARTY_NOTICES.md +42 -0
  6. package/UPSTREAM.md +56 -0
  7. package/dist/blocks.js +1582 -0
  8. package/dist/chunks/chunk-23KOEBWJ.js +104 -0
  9. package/dist/chunks/chunk-3HCOU44R.js +697 -0
  10. package/dist/chunks/chunk-5JXG4BHW.js +31 -0
  11. package/dist/chunks/chunk-5XDVPALS.js +61 -0
  12. package/dist/chunks/chunk-AY44MQMD.js +3052 -0
  13. package/dist/chunks/chunk-B3EEK7A2.js +408 -0
  14. package/dist/chunks/chunk-CEBTQO6W.js +24 -0
  15. package/dist/chunks/chunk-CI73NXA5.js +202 -0
  16. package/dist/chunks/chunk-CTQPGUZP.js +22 -0
  17. package/dist/chunks/chunk-F352IICS.js +57 -0
  18. package/dist/chunks/chunk-IOBKTEKP.js +144 -0
  19. package/dist/chunks/chunk-KETGFAOH.js +66 -0
  20. package/dist/chunks/chunk-LA3QDZYN.js +2777 -0
  21. package/dist/chunks/chunk-NE62SYOZ.js +89 -0
  22. package/dist/chunks/chunk-OQPH36OI.js +754 -0
  23. package/dist/chunks/chunk-QJKAQ6PO.js +155 -0
  24. package/dist/chunks/chunk-R6AUJQ3G.js +129 -0
  25. package/dist/chunks/chunk-RNVSCTW7.js +24 -0
  26. package/dist/chunks/chunk-RZOP2PFC.js +152 -0
  27. package/dist/chunks/chunk-TQU54HSM.js +112 -0
  28. package/dist/chunks/chunk-TUK6UGXM.js +36 -0
  29. package/dist/chunks/chunk-TZ7HRE6D.js +328 -0
  30. package/dist/chunks/chunk-VIH56PDF.js +57 -0
  31. package/dist/chunks/chunk-WUL523OW.js +27 -0
  32. package/dist/chunks/chunk-XX6MSZLS.js +261 -0
  33. package/dist/chunks/chunk-ZA47FP7C.js +7 -0
  34. package/dist/chunks/chunk-ZZNL5PWF.js +170 -0
  35. package/dist/icons.js +803 -0
  36. package/dist/index.js +1182 -0
  37. package/dist/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  38. package/dist/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  39. package/dist/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  40. package/dist/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  41. package/dist/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  42. package/dist/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  43. package/dist/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  44. package/dist/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  45. package/dist/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  46. package/dist/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  47. package/dist/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  48. package/dist/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  49. package/dist/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  50. package/dist/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  51. package/dist/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  52. package/dist/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  53. package/dist/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  54. package/dist/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  55. package/dist/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  56. package/dist/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  57. package/dist/katex.css +1 -0
  58. package/dist/katex.css.d.ts +2 -0
  59. package/dist/markdown.js +148 -0
  60. package/dist/meta.json +6876 -0
  61. package/dist/root-inputs.json +67 -0
  62. package/dist/seekbuddy-card.js +7 -0
  63. package/dist/seekbuddy-empty.js +8 -0
  64. package/dist/seekbuddy-internal/DangerButton.js +7 -0
  65. package/dist/seekbuddy-internal/Mark.js +7 -0
  66. package/dist/seekbuddy-internal/Message.js +10 -0
  67. package/dist/seekbuddy-internal/Pagination.js +9 -0
  68. package/dist/seekbuddy-internal/StatusBadge.js +7 -0
  69. package/dist/seekbuddy-internal/SubtleButton.js +7 -0
  70. package/dist/seekbuddy-internal/Switch.js +7 -0
  71. package/dist/seekbuddy-internal/Upload.js +7 -0
  72. package/dist/seekbuddy-internal/date/Calendar.js +8 -0
  73. package/dist/seekbuddy-internal/date/DatePicker.js +9 -0
  74. package/dist/seekbuddy-internal/date/DateRangePicker.js +9 -0
  75. package/dist/seekbuddy-internal/date/TimePicker.js +8 -0
  76. package/dist/seekbuddy-internal/date/fields.js +16 -0
  77. package/dist/seekbuddy-internal/qr/QrCode.js +7 -0
  78. package/dist/seekbuddy-spinner.js +7 -0
  79. package/dist/seekbuddy-tabs.js +7 -0
  80. package/dist/seekbuddy-timeline.js +8 -0
  81. package/dist/seekbuddy.js +89 -0
  82. package/dist/theme-bootstrap.js +13 -0
  83. package/dist/theme.js +37 -0
  84. package/dist/tokens.css +934 -0
  85. package/dist/tokens.css.d.ts +2 -0
  86. package/dist/types/Button.d.ts +18 -0
  87. package/dist/types/Checkbox.d.ts +19 -0
  88. package/dist/types/CodeFileIcon.d.ts +11 -0
  89. package/dist/types/CodeToolbar.d.ts +29 -0
  90. package/dist/types/ConfigField.d.ts +32 -0
  91. package/dist/types/ConnectionIndicator.d.ts +25 -0
  92. package/dist/types/DiffBlock.d.ts +51 -0
  93. package/dist/types/DisclosureRow.d.ts +35 -0
  94. package/dist/types/FileTypeIcon.d.ts +42 -0
  95. package/dist/types/FoldToggle.d.ts +19 -0
  96. package/dist/types/HoverCard.d.ts +36 -0
  97. package/dist/types/ImageLightbox.d.ts +26 -0
  98. package/dist/types/ImagePreview.d.ts +11 -0
  99. package/dist/types/Input.d.ts +11 -0
  100. package/dist/types/JsonTree.d.ts +58 -0
  101. package/dist/types/LinkIcon.d.ts +33 -0
  102. package/dist/types/Menu.d.ts +142 -0
  103. package/dist/types/MenuGroup.d.ts +21 -0
  104. package/dist/types/MenuSurface.d.ts +15 -0
  105. package/dist/types/Modal.d.ts +43 -0
  106. package/dist/types/PermissionIcon.d.ts +38 -0
  107. package/dist/types/Pill.d.ts +12 -0
  108. package/dist/types/ReadBlock.d.ts +47 -0
  109. package/dist/types/ReferenceIcon.d.ts +20 -0
  110. package/dist/types/RiskConfirmation.d.ts +19 -0
  111. package/dist/types/SearchBlock.d.ts +71 -0
  112. package/dist/types/SegmentedControl.d.ts +34 -0
  113. package/dist/types/SegmentedTabs.d.ts +25 -0
  114. package/dist/types/ShortcutKeys.d.ts +10 -0
  115. package/dist/types/SiteGlyph.d.ts +24 -0
  116. package/dist/types/StateDot.d.ts +19 -0
  117. package/dist/types/Switch.d.ts +19 -0
  118. package/dist/types/Tag.d.ts +31 -0
  119. package/dist/types/TerminalBlock.d.ts +77 -0
  120. package/dist/types/TextShimmer.d.ts +22 -0
  121. package/dist/types/Toast.d.ts +48 -0
  122. package/dist/types/Tooltip.d.ts +63 -0
  123. package/dist/types/WebBlock.d.ts +60 -0
  124. package/dist/types/ansi.d.ts +16 -0
  125. package/dist/types/blocks.d.ts +19 -0
  126. package/dist/types/clipboard.d.ts +8 -0
  127. package/dist/types/code-file-icon-artwork.d.ts +53 -0
  128. package/dist/types/code-file-types.d.ts +29 -0
  129. package/dist/types/code-highlighting.d.ts +11 -0
  130. package/dist/types/css-modules.d.ts +6 -0
  131. package/dist/types/darwin-desktop.d.ts +8 -0
  132. package/dist/types/file-size.d.ts +7 -0
  133. package/dist/types/focus.d.ts +8 -0
  134. package/dist/types/guide-artwork.d.ts +14 -0
  135. package/dist/types/head-tail-cap.d.ts +22 -0
  136. package/dist/types/icons/index.d.ts +384 -0
  137. package/dist/types/icons/props.d.ts +8 -0
  138. package/dist/types/icons/shared-artwork.d.ts +42 -0
  139. package/dist/types/icons.d.ts +6 -0
  140. package/dist/types/index.d.ts +53 -0
  141. package/dist/types/input-modality.d.ts +18 -0
  142. package/dist/types/keyboard-composition.d.ts +10 -0
  143. package/dist/types/markdown/CodeBlock.d.ts +34 -0
  144. package/dist/types/markdown/JsonBlock.d.ts +7 -0
  145. package/dist/types/markdown/MarkdownDelegate.d.ts +45 -0
  146. package/dist/types/markdown/MarkdownText.d.ts +47 -0
  147. package/dist/types/markdown/cjkFriendlyStrong.d.ts +8 -0
  148. package/dist/types/markdown/file-link.d.ts +12 -0
  149. package/dist/types/markdown/highlight.d.ts +147 -0
  150. package/dist/types/markdown/incremental.d.ts +79 -0
  151. package/dist/types/markdown/katex.d.ts +18 -0
  152. package/dist/types/markdown/local-image-syntax.d.ts +9 -0
  153. package/dist/types/markdown/mathCompatibility.d.ts +10 -0
  154. package/dist/types/markdown/parse.d.ts +24 -0
  155. package/dist/types/markdown/plain-text.d.ts +21 -0
  156. package/dist/types/markdown/render.d.ts +140 -0
  157. package/dist/types/markdown/useViewportHighlighting.d.ts +10 -0
  158. package/dist/types/markdown.d.ts +9 -0
  159. package/dist/types/overlay-top-margin.d.ts +7 -0
  160. package/dist/types/plugin-artwork.d.ts +16 -0
  161. package/dist/types/pointer-grace.d.ts +21 -0
  162. package/dist/types/rank-by-name.d.ts +21 -0
  163. package/dist/types/relative-time.d.ts +22 -0
  164. package/dist/types/seekbuddy/Card.d.ts +28 -0
  165. package/dist/types/seekbuddy/DangerButton.d.ts +31 -0
  166. package/dist/types/seekbuddy/Empty.d.ts +34 -0
  167. package/dist/types/seekbuddy/Mark.d.ts +27 -0
  168. package/dist/types/seekbuddy/Message.d.ts +52 -0
  169. package/dist/types/seekbuddy/Pagination.d.ts +66 -0
  170. package/dist/types/seekbuddy/Spinner.d.ts +20 -0
  171. package/dist/types/seekbuddy/StatusBadge.d.ts +33 -0
  172. package/dist/types/seekbuddy/SubtleButton.d.ts +30 -0
  173. package/dist/types/seekbuddy/Switch.d.ts +36 -0
  174. package/dist/types/seekbuddy/Tabs.d.ts +49 -0
  175. package/dist/types/seekbuddy/Timeline.d.ts +42 -0
  176. package/dist/types/seekbuddy/Upload.d.ts +101 -0
  177. package/dist/types/seekbuddy/date/Calendar.d.ts +94 -0
  178. package/dist/types/seekbuddy/date/DatePicker.d.ts +29 -0
  179. package/dist/types/seekbuddy/date/DateRangePicker.d.ts +41 -0
  180. package/dist/types/seekbuddy/date/TimePicker.d.ts +35 -0
  181. package/dist/types/seekbuddy/date/date.d.ts +79 -0
  182. package/dist/types/seekbuddy/date/fields.d.ts +45 -0
  183. package/dist/types/seekbuddy/index.d.ts +49 -0
  184. package/dist/types/seekbuddy/qr/QrCode.d.ts +37 -0
  185. package/dist/types/seekbuddy/qr/qr.d.ts +38 -0
  186. package/dist/types/theme-bootstrap.d.ts +3 -0
  187. package/dist/types/theme-core.d.ts +14 -0
  188. package/dist/types/theme.d.ts +4 -0
  189. package/dist/types/use-copy-feedback.d.ts +13 -0
  190. package/dist/types/useAnchoredMaxHeight.d.ts +13 -0
  191. package/dist/types/useAnchoredPosition.d.ts +35 -0
  192. package/dist/types/useDismissOnOutsidePointer.d.ts +10 -0
  193. package/dist/types/useModalLayer.d.ts +26 -0
  194. package/dist/types/user-text.d.ts +36 -0
  195. package/package.json +151 -4
@@ -0,0 +1,261 @@
1
+ import {
2
+ addDays,
3
+ addMonths,
4
+ addMonthsToDate,
5
+ compareIso,
6
+ isInRange,
7
+ isOutsideBounds,
8
+ monthGrid,
9
+ monthOf,
10
+ monthTitle,
11
+ normalizeRange,
12
+ todayIso,
13
+ weekOffset,
14
+ weekdayNames
15
+ } from "./chunk-RZOP2PFC.js";
16
+
17
+ // src/seekbuddy/date/Calendar.tsx
18
+ import clsx from "clsx";
19
+ import { Button } from "@seekbuddy/dsh-ui";
20
+ import { IconChevronLeftOutlineRegular, IconChevronRightOutlineRegular } from "@seekbuddy/dsh-ui/icons";
21
+ import { useEffect, useId, useRef, useState } from "react";
22
+
23
+ // .build/css/seekbuddy/date/Calendar.module.mjs
24
+ var id = "@seekbuddy/dsh-ui/seekbuddy/date/Calendar.module.css";
25
+ if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id + '"]')) {
26
+ const element = document.createElement("style");
27
+ element.setAttribute("data-dsh-ui-primitives", id);
28
+ element.textContent = "._2W6iWW_calendar{--calendar-cell:32px;--calendar-gap:2px;color:var(--dsw-alias-label-primary);gap:24px;display:inline-grid}._2W6iWW_twoMonths{grid-auto-flow:column}._2W6iWW_month{gap:8px;display:grid}._2W6iWW_header{justify-content:space-between;align-items:center;gap:4px;min-height:28px;display:flex}._2W6iWW_navGroup{gap:2px;display:inline-flex}._2W6iWW_nav{width:28px;color:var(--dsw-alias-label-secondary);padding:0}._2W6iWW_nav:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._2W6iWW_nav:focus-visible{outline-offset:1px;outline-style:solid}._2W6iWW_double{align-items:center;display:inline-flex}._2W6iWW_double>:last-child{margin-left:-8px}._2W6iWW_title{text-align:center;font:var(--dsw-font-s-strong-14);flex:1}._2W6iWW_grid{border-collapse:separate;border-spacing:var(--calendar-gap);margin:calc(var(--calendar-gap) * -1)}._2W6iWW_weekday{width:var(--calendar-cell);height:24px;color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xxs-12);text-align:center;padding:0;font-weight:400}._2W6iWW_cell{padding:0}._2W6iWW_day{width:var(--calendar-cell);height:var(--calendar-cell);border-radius:var(--dsw-radius-sm);color:inherit;cursor:pointer;font:var(--dsw-font-xs-13);font-variant-numeric:tabular-nums;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:inline-flex}._2W6iWW_day:hover:not(._2W6iWW_disabled):not(._2W6iWW_selected){background:var(--dsw-alias-interactive-bg-hover)}._2W6iWW_day:active:not(._2W6iWW_disabled):not(._2W6iWW_selected){background:var(--dsw-alias-interactive-bg-active)}._2W6iWW_day:focus-visible{outline-offset:1px;outline-style:solid}._2W6iWW_outside{color:var(--dsw-alias-label-dimmed)}._2W6iWW_today{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}._2W6iWW_selected{color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-primary-fill)}._2W6iWW_selected:hover{background:var(--dsw-alias-button-primary-hover)}._2W6iWW_disabled{color:var(--dsw-alias-label-dimmed);cursor:not-allowed;text-decoration:line-through}._2W6iWW_range ._2W6iWW_grid{border-spacing:0 var(--calendar-gap)}._2W6iWW_range ._2W6iWW_day{border-radius:0}._2W6iWW_range ._2W6iWW_day:not([data-range]):not([data-range-preview]){border-radius:var(--dsw-radius-sm)}._2W6iWW_day[data-range=middle]{background:var(--dsw-alias-interactive-bg-hover)}._2W6iWW_day[data-range=start],._2W6iWW_day[data-range-preview=start]{border-radius:var(--dsw-radius-sm) 0 0 var(--dsw-radius-sm)}._2W6iWW_day[data-range=end],._2W6iWW_day[data-range-preview=end]{border-radius:0 var(--dsw-radius-sm) var(--dsw-radius-sm) 0}._2W6iWW_day[data-range=single],._2W6iWW_day[data-range-preview=single]{border-radius:var(--dsw-radius-sm)}._2W6iWW_day[data-range-preview]{background:var(--dsw-alias-interactive-bg-hover)}._2W6iWW_range ._2W6iWW_selected:hover{background:var(--dsw-alias-button-primary-hover)}";
29
+ document.head.appendChild(element);
30
+ }
31
+ var Calendar_module_default = { "selected": "_2W6iWW_selected", "today": "_2W6iWW_today", "title": "_2W6iWW_title", "navGroup": "_2W6iWW_navGroup", "disabled": "_2W6iWW_disabled", "header": "_2W6iWW_header", "range": "_2W6iWW_range", "cell": "_2W6iWW_cell", "grid": "_2W6iWW_grid", "weekday": "_2W6iWW_weekday", "month": "_2W6iWW_month", "double": "_2W6iWW_double", "outside": "_2W6iWW_outside", "twoMonths": "_2W6iWW_twoMonths", "nav": "_2W6iWW_nav", "day": "_2W6iWW_day", "calendar": "_2W6iWW_calendar" };
32
+
33
+ // src/seekbuddy/date/Calendar.tsx
34
+ import { jsx, jsxs } from "react/jsx-runtime";
35
+ var DAY_KEYS = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 };
36
+ function rangePosition(date, range) {
37
+ if (!isInRange(date, range)) return void 0;
38
+ if (range.start === range.end) return "single";
39
+ if (date === range.start) return "start";
40
+ if (date === range.end) return "end";
41
+ return "middle";
42
+ }
43
+ function Calendar(props) {
44
+ const {
45
+ month,
46
+ onMonthChange,
47
+ numberOfMonths = props.mode === "range" ? 2 : 1,
48
+ min,
49
+ max,
50
+ isDateDisabled,
51
+ locale,
52
+ weekStart = 1,
53
+ today: todayProp,
54
+ labels,
55
+ autoFocus = false,
56
+ className
57
+ } = props;
58
+ const idBase = useId();
59
+ const [today] = useState(() => todayProp ?? todayIso());
60
+ const resolvedToday = todayProp ?? today;
61
+ const single = props.mode === "single" ? props.value : null;
62
+ const rangeStart = props.mode === "range" ? props.value?.start ?? null : null;
63
+ const rangeEnd = props.mode === "range" ? props.value?.end ?? null : null;
64
+ const committed = rangeStart !== null && rangeEnd !== null ? { start: rangeStart, end: rangeEnd } : null;
65
+ const drafting = props.mode === "range" && rangeStart !== null && rangeEnd === null;
66
+ const anchor = props.mode === "single" ? single : rangeStart;
67
+ const [monthState, setMonthState] = useState(() => monthOf(anchor ?? resolvedToday));
68
+ const [seenAnchor, setSeenAnchor] = useState(anchor);
69
+ if (anchor !== seenAnchor) {
70
+ setSeenAnchor(anchor);
71
+ if (anchor !== null) {
72
+ const anchorMonth = monthOf(anchor);
73
+ const visibleUntil = addMonths(monthState, numberOfMonths - 1);
74
+ if (compareIso(anchorMonth, monthState) < 0 || compareIso(anchorMonth, visibleUntil) > 0) {
75
+ setMonthState(anchorMonth);
76
+ }
77
+ }
78
+ }
79
+ const firstMonth = month ?? monthState;
80
+ const lastMonth = addMonths(firstMonth, numberOfMonths - 1);
81
+ const showMonth = (next) => {
82
+ if (month === void 0) setMonthState(next);
83
+ onMonthChange?.(next);
84
+ };
85
+ const [focused, setFocused] = useState(null);
86
+ const pendingFocus = useRef(null);
87
+ const pendingAutoFocus = useRef(autoFocus);
88
+ const cellRefs = useRef(/* @__PURE__ */ new Map());
89
+ const [hovered, setHovered] = useState(null);
90
+ const [focusedCell, setFocusedCell] = useState(null);
91
+ const previewTarget = drafting ? hovered ?? focusedCell : null;
92
+ const preview = previewTarget !== null && rangeStart !== null && previewTarget !== rangeStart ? normalizeRange(rangeStart, previewTarget) : null;
93
+ const isDisabled = (date) => isOutsideBounds(date, min, max) || (isDateDisabled?.(date) ?? false);
94
+ const inView = (date) => {
95
+ const m = monthOf(date);
96
+ return compareIso(m, firstMonth) >= 0 && compareIso(m, lastMonth) <= 0;
97
+ };
98
+ const months = [];
99
+ for (let index = 0; index < numberOfMonths; index += 1) {
100
+ const current2 = addMonths(firstMonth, index);
101
+ months.push({
102
+ month: current2,
103
+ title: monthTitle(locale, current2),
104
+ titleId: `${idBase}-title-${index}`,
105
+ cells: monthGrid(current2, weekStart)
106
+ });
107
+ }
108
+ let tabStop = null;
109
+ if (focused !== null && inView(focused)) tabStop = focused;
110
+ else if (anchor !== null && inView(anchor)) tabStop = anchor;
111
+ else if (inView(resolvedToday)) tabStop = resolvedToday;
112
+ else {
113
+ outer: for (const visible of months) {
114
+ for (const date of visible.cells) {
115
+ if (monthOf(date) === visible.month && !isDisabled(date)) {
116
+ tabStop = date;
117
+ break outer;
118
+ }
119
+ }
120
+ }
121
+ }
122
+ useEffect(() => {
123
+ const target = pendingAutoFocus.current ? tabStop : pendingFocus.current;
124
+ pendingAutoFocus.current = false;
125
+ pendingFocus.current = null;
126
+ if (target !== null) cellRefs.current.get(target)?.focus();
127
+ });
128
+ const moveFocus = (next) => {
129
+ setFocused(next);
130
+ pendingFocus.current = next;
131
+ if (compareIso(monthOf(next), firstMonth) < 0) showMonth(monthOf(next));
132
+ else if (compareIso(monthOf(next), lastMonth) > 0) showMonth(addMonths(monthOf(next), -(numberOfMonths - 1)));
133
+ };
134
+ const onGridKeyDown = (event) => {
135
+ const origin = event.target.dataset["date"];
136
+ if (origin === void 0) return;
137
+ let next;
138
+ const days = DAY_KEYS[event.key];
139
+ if (days !== void 0) next = addDays(origin, days);
140
+ else if (event.key === "Home") next = addDays(origin, -weekOffset(origin, weekStart));
141
+ else if (event.key === "End") next = addDays(origin, 6 - weekOffset(origin, weekStart));
142
+ else if (event.key === "PageUp") next = addMonthsToDate(origin, event.shiftKey ? -12 : -1);
143
+ else if (event.key === "PageDown") next = addMonthsToDate(origin, event.shiftKey ? 12 : 1);
144
+ else return;
145
+ event.preventDefault();
146
+ moveFocus(next);
147
+ };
148
+ const current = props;
149
+ const pick = (date) => {
150
+ if (isDisabled(date)) return;
151
+ setFocused(date);
152
+ if (!inView(date)) {
153
+ pendingFocus.current = date;
154
+ showMonth(monthOf(date));
155
+ }
156
+ if (current.mode === "single") current.onChange(date);
157
+ else if (drafting && rangeStart !== null) {
158
+ setHovered(null);
159
+ current.onChange(normalizeRange(rangeStart, date));
160
+ } else current.onChange({ start: date, end: null });
161
+ };
162
+ const weekdaysShort = weekdayNames(locale, weekStart, "short");
163
+ const weekdaysLong = weekdayNames(locale, weekStart, "long");
164
+ const twoMonths = numberOfMonths === 2;
165
+ const nav = (label, onClick, icon, double) => {
166
+ const Chevron = icon === "prev" ? IconChevronLeftOutlineRegular : IconChevronRightOutlineRegular;
167
+ return /* @__PURE__ */ jsx(
168
+ Button,
169
+ {
170
+ variant: "ghost",
171
+ size: "sm",
172
+ className: Calendar_module_default.nav,
173
+ "aria-label": label,
174
+ onClick,
175
+ icon: double ? /* @__PURE__ */ jsxs("span", { className: Calendar_module_default.double, "aria-hidden": "true", children: [
176
+ /* @__PURE__ */ jsx(Chevron, {}),
177
+ /* @__PURE__ */ jsx(Chevron, {})
178
+ ] }) : /* @__PURE__ */ jsx(Chevron, {})
179
+ }
180
+ );
181
+ };
182
+ const renderMonth = (visible, index) => /* @__PURE__ */ jsxs("div", { className: Calendar_module_default.month, children: [
183
+ /* @__PURE__ */ jsxs("div", { className: Calendar_module_default.header, children: [
184
+ twoMonths ? index === 0 && nav(labels.previousMonth, () => showMonth(addMonths(firstMonth, -1)), "prev", false) : /* @__PURE__ */ jsxs("span", { className: Calendar_module_default.navGroup, children: [
185
+ nav(labels.previousYear, () => showMonth(addMonths(firstMonth, -12)), "prev", true),
186
+ nav(labels.previousMonth, () => showMonth(addMonths(firstMonth, -1)), "prev", false)
187
+ ] }),
188
+ /* @__PURE__ */ jsx("span", { id: visible.titleId, className: Calendar_module_default.title, "aria-live": "polite", children: visible.title }),
189
+ twoMonths ? index === numberOfMonths - 1 && nav(labels.nextMonth, () => showMonth(addMonths(firstMonth, 1)), "next", false) : /* @__PURE__ */ jsxs("span", { className: Calendar_module_default.navGroup, children: [
190
+ nav(labels.nextMonth, () => showMonth(addMonths(firstMonth, 1)), "next", false),
191
+ nav(labels.nextYear, () => showMonth(addMonths(firstMonth, 12)), "next", true)
192
+ ] })
193
+ ] }),
194
+ /* @__PURE__ */ jsxs("table", { role: "grid", "aria-labelledby": visible.titleId, className: Calendar_module_default.grid, onKeyDown: onGridKeyDown, children: [
195
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdaysShort.map((name, column) => /* @__PURE__ */ jsx("th", { scope: "col", abbr: weekdaysLong[column], className: Calendar_module_default.weekday, children: name }, name)) }) }),
196
+ /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 6 }, (_, row) => /* @__PURE__ */ jsx("tr", { children: visible.cells.slice(row * 7, row * 7 + 7).map((date) => {
197
+ const outside = monthOf(date) !== visible.month;
198
+ const state = {
199
+ selected: props.mode === "single" ? single === date : date === rangeStart || date === rangeEnd,
200
+ today: date === resolvedToday,
201
+ disabled: isDisabled(date),
202
+ inRange: committed !== null && isInRange(date, committed)
203
+ };
204
+ const position = !outside && committed !== null ? rangePosition(date, committed) : void 0;
205
+ const previewPosition = !outside && preview !== null && date !== rangeStart ? rangePosition(date, preview) : void 0;
206
+ return /* @__PURE__ */ jsx(
207
+ "td",
208
+ {
209
+ role: "gridcell",
210
+ "aria-selected": state.selected,
211
+ "aria-disabled": state.disabled || void 0,
212
+ className: Calendar_module_default.cell,
213
+ children: /* @__PURE__ */ jsx(
214
+ "button",
215
+ {
216
+ type: "button",
217
+ ref: (node) => {
218
+ if (outside) return;
219
+ if (node === null) cellRefs.current.delete(date);
220
+ else cellRefs.current.set(date, node);
221
+ },
222
+ tabIndex: !outside && date === tabStop ? 0 : -1,
223
+ "aria-label": labels.dayLabel(date, state),
224
+ "aria-disabled": state.disabled || void 0,
225
+ "data-date": date,
226
+ "data-outside": outside || void 0,
227
+ "data-range": position,
228
+ "data-range-preview": previewPosition,
229
+ className: clsx(
230
+ Calendar_module_default.day,
231
+ state.selected && !outside && Calendar_module_default.selected,
232
+ state.today && Calendar_module_default.today,
233
+ outside && Calendar_module_default.outside,
234
+ state.disabled && Calendar_module_default.disabled
235
+ ),
236
+ onClick: () => pick(date),
237
+ onPointerEnter: drafting ? () => setHovered(date) : void 0,
238
+ onFocus: props.mode === "range" ? () => setFocusedCell(date) : void 0,
239
+ onBlur: props.mode === "range" ? () => setFocusedCell(null) : void 0,
240
+ children: Number(date.slice(-2))
241
+ }
242
+ )
243
+ },
244
+ date
245
+ );
246
+ }) }, row)) })
247
+ ] })
248
+ ] }, index);
249
+ return /* @__PURE__ */ jsx(
250
+ "div",
251
+ {
252
+ className: clsx(Calendar_module_default.calendar, twoMonths && Calendar_module_default.twoMonths, props.mode === "range" && Calendar_module_default.range, className),
253
+ onPointerLeave: drafting ? () => setHovered(null) : void 0,
254
+ children: months.map(renderMonth)
255
+ }
256
+ );
257
+ }
258
+
259
+ export {
260
+ Calendar
261
+ };
@@ -0,0 +1,7 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ export {
6
+ __publicField
7
+ };
@@ -0,0 +1,170 @@
1
+ import {
2
+ Spinner
3
+ } from "./chunk-WUL523OW.js";
4
+
5
+ // src/seekbuddy/Message.tsx
6
+ import clsx from "clsx";
7
+ import { createContext, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
8
+ import { createPortal } from "react-dom";
9
+ import { IconCheckOutlineRegular, IconCloseOutlineRegular, IconWarningOutlineRegular } from "@seekbuddy/dsh-ui/icons";
10
+
11
+ // .build/css/seekbuddy/Message.module.mjs
12
+ var id = "@seekbuddy/dsh-ui/seekbuddy/Message.module.css";
13
+ if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id + '"]')) {
14
+ const element = document.createElement("style");
15
+ element.setAttribute("data-dsh-ui-primitives", id);
16
+ element.textContent = ".Hl-94G_stack{z-index:1100;pointer-events:none;flex-direction:column;align-items:center;gap:8px;max-width:min(560px,100vw - 48px);display:flex;position:fixed;top:120px;left:50%;transform:translate(-50%)}.Hl-94G_message{box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-button-contrast-fill);max-width:100%;color:var(--dsw-alias-label-primary-inverted);font:var(--dsw-font-s-14);box-shadow:var(--dsw-shadow-lv3);align-items:center;gap:10px;padding:12px 16px;animation:.16s ease-out Hl-94G_seekbuddy-message-in;display:flex}.Hl-94G_leaving{animation:1s forwards Hl-94G_seekbuddy-message-out}.Hl-94G_icon{flex:none;place-items:center;display:grid}.Hl-94G_content{min-width:0}.Hl-94G_success .Hl-94G_icon{color:var(--dsw-alias-state-success-primary)}.Hl-94G_error .Hl-94G_icon{color:var(--dsw-alias-state-error-primary)}.Hl-94G_warning .Hl-94G_icon{color:var(--dsw-alias-state-warn-label)}@keyframes Hl-94G_seekbuddy-message-in{0%{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}@keyframes Hl-94G_seekbuddy-message-out{to{opacity:0}}@media (prefers-reduced-motion:reduce){.Hl-94G_message{animation:none}.Hl-94G_leaving{animation:1s forwards Hl-94G_seekbuddy-message-out}}";
17
+ document.head.appendChild(element);
18
+ }
19
+ var Message_module_default = { "warning": "Hl-94G_warning", "error": "Hl-94G_error", "seekbuddy-message-out": "Hl-94G_seekbuddy-message-out", "icon": "Hl-94G_icon", "seekbuddy-message-in": "Hl-94G_seekbuddy-message-in", "leaving": "Hl-94G_leaving", "message": "Hl-94G_message", "content": "Hl-94G_content", "success": "Hl-94G_success", "stack": "Hl-94G_stack" };
20
+
21
+ // src/seekbuddy/Message.tsx
22
+ import { jsx, jsxs } from "react/jsx-runtime";
23
+ var FADE_MS = 1e3;
24
+ var DEFAULT_DURATION = 3;
25
+ var MessageContext = createContext(null);
26
+ function MessageProvider({ top = 120, maxCount = 3, children }) {
27
+ const prefix = useId();
28
+ const sequence = useRef(0);
29
+ const store = useRef([]);
30
+ const [entries, setEntries] = useState([]);
31
+ const autoTimers = useRef(/* @__PURE__ */ new Map());
32
+ const leaveTimers = useRef(/* @__PURE__ */ new Map());
33
+ const settings = useRef({ maxCount });
34
+ settings.current.maxCount = maxCount;
35
+ useEffect(() => {
36
+ const auto = autoTimers.current;
37
+ const leave = leaveTimers.current;
38
+ return () => {
39
+ for (const timer of auto.values()) clearTimeout(timer);
40
+ for (const timer of leave.values()) clearTimeout(timer);
41
+ auto.clear();
42
+ leave.clear();
43
+ };
44
+ }, []);
45
+ const api = useMemo(() => {
46
+ const sync = () => setEntries(store.current.slice());
47
+ const clearTimers = (id2) => {
48
+ const auto = autoTimers.current.get(id2);
49
+ if (auto !== void 0) clearTimeout(auto);
50
+ autoTimers.current.delete(id2);
51
+ const leave = leaveTimers.current.get(id2);
52
+ if (leave !== void 0) clearTimeout(leave);
53
+ leaveTimers.current.delete(id2);
54
+ };
55
+ const close = (id2) => {
56
+ const entry = store.current.find((item) => item.id === id2);
57
+ if (entry === void 0 || entry.leaving) return;
58
+ clearTimers(id2);
59
+ entry.leaving = true;
60
+ sync();
61
+ leaveTimers.current.set(
62
+ id2,
63
+ setTimeout(() => {
64
+ leaveTimers.current.delete(id2);
65
+ store.current = store.current.filter((item) => item.id !== id2);
66
+ sync();
67
+ entry.onClose?.();
68
+ }, FADE_MS)
69
+ );
70
+ };
71
+ const open = (options) => {
72
+ const type = options.type ?? "info";
73
+ sequence.current += 1;
74
+ const id2 = options.key ?? `${prefix}-${sequence.current}`;
75
+ const duration = options.duration ?? (type === "loading" ? 0 : DEFAULT_DURATION);
76
+ clearTimers(id2);
77
+ const entry = {
78
+ id: id2,
79
+ type,
80
+ content: options.content,
81
+ icon: options.icon,
82
+ onClose: options.onClose,
83
+ leaving: false
84
+ };
85
+ const index = store.current.findIndex((item) => item.id === id2);
86
+ if (index === -1) store.current = [...store.current, entry];
87
+ else store.current = store.current.map((item, position) => position === index ? entry : item);
88
+ const live = store.current.filter((item) => !item.leaving);
89
+ for (const stale of live.slice(0, Math.max(0, live.length - settings.current.maxCount))) close(stale.id);
90
+ sync();
91
+ if (duration > 0)
92
+ autoTimers.current.set(
93
+ id2,
94
+ setTimeout(() => close(id2), duration * 1e3)
95
+ );
96
+ return () => close(id2);
97
+ };
98
+ const shorthand = (type) => (content, duration) => open({ type, content, duration });
99
+ return {
100
+ open,
101
+ success: shorthand("success"),
102
+ info: shorthand("info"),
103
+ warning: shorthand("warning"),
104
+ error: shorthand("error"),
105
+ loading: shorthand("loading"),
106
+ destroy: (key) => {
107
+ if (key !== void 0) close(key);
108
+ else for (const entry of store.current) close(entry.id);
109
+ }
110
+ };
111
+ }, [prefix]);
112
+ return /* @__PURE__ */ jsxs(MessageContext.Provider, { value: api, children: [
113
+ children,
114
+ entries.length > 0 && typeof document !== "undefined" ? createPortal(
115
+ /* @__PURE__ */ jsx("div", { className: Message_module_default.stack, style: { top }, children: entries.map((entry) => /* @__PURE__ */ jsxs(
116
+ "div",
117
+ {
118
+ className: clsx(Message_module_default.message, Message_module_default[entry.type], entry.leaving && Message_module_default.leaving),
119
+ role: entry.type === "error" ? "alert" : "status",
120
+ "data-type": entry.type,
121
+ children: [
122
+ /* @__PURE__ */ jsx("span", { className: Message_module_default.icon, "aria-hidden": "true", children: entry.icon === void 0 ? defaultIcon(entry.type) : entry.icon }),
123
+ /* @__PURE__ */ jsx("span", { className: Message_module_default.content, children: entry.content })
124
+ ]
125
+ },
126
+ entry.id
127
+ )) }),
128
+ document.body
129
+ ) : null
130
+ ] });
131
+ }
132
+ function useMessage() {
133
+ const api = useContext(MessageContext);
134
+ if (api === null) throw new Error("useMessage() must be called inside a <MessageProvider>");
135
+ return api;
136
+ }
137
+ function defaultIcon(type) {
138
+ if (type === "success") return /* @__PURE__ */ jsx(IconCheckOutlineRegular, {});
139
+ if (type === "error") return /* @__PURE__ */ jsx(IconCloseOutlineRegular, {});
140
+ if (type === "warning") return /* @__PURE__ */ jsx(IconWarningOutlineRegular, { size: 14 });
141
+ if (type === "loading") return /* @__PURE__ */ jsx(Spinner, { size: "sm" });
142
+ return /* @__PURE__ */ jsx(InfoGlyph, {});
143
+ }
144
+ function InfoGlyph() {
145
+ return /* @__PURE__ */ jsxs(
146
+ "svg",
147
+ {
148
+ width: 16,
149
+ height: 16,
150
+ viewBox: "0 0 24 24",
151
+ fill: "none",
152
+ stroke: "currentColor",
153
+ strokeWidth: "2",
154
+ strokeLinecap: "round",
155
+ strokeLinejoin: "round",
156
+ "aria-hidden": "true",
157
+ focusable: "false",
158
+ children: [
159
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
160
+ /* @__PURE__ */ jsx("path", { d: "M12 11v5" }),
161
+ /* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
162
+ ]
163
+ }
164
+ );
165
+ }
166
+
167
+ export {
168
+ MessageProvider,
169
+ useMessage
170
+ };