@behavioral-agentic-design-system/core 0.45.0 → 0.47.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/package.json +17 -3
- package/scripts/a11y-lint.cjs +78 -15
- package/scripts/bads-sync.mjs +1 -1
- package/scripts/build-tokens.cjs +122 -7
- package/scripts/check-dark-contrast.mjs +204 -0
- package/scripts/check-flush-edges.mjs +245 -0
- package/scripts/design-system-advisory/README.md +239 -0
- package/scripts/design-system-advisory/check-copy-punctuation.mjs +44 -0
- package/scripts/design-system-advisory/check-even-padding.mjs +35 -0
- package/scripts/design-system-advisory/check-hand-built-button.mjs +46 -0
- package/scripts/design-system-advisory/check-html-nesting.mjs +51 -0
- package/scripts/design-system-advisory/check-icon-sizing.mjs +79 -0
- package/scripts/design-system-advisory/check-label-case.mjs +92 -0
- package/scripts/design-system-advisory/check-native-form-controls.mjs +53 -0
- package/scripts/design-system-advisory/check-radius.mjs +56 -0
- package/scripts/design-system-advisory/check-raw-values.mjs +61 -0
- package/scripts/design-system-advisory/check-small-text.mjs +72 -0
- package/scripts/design-system-advisory/check-tap-target.mjs +70 -0
- package/scripts/design-system-advisory/defaults.mjs +90 -0
- package/scripts/design-system-advisory/fixtures/clean.tsx.fixture +12 -0
- package/scripts/design-system-advisory/fixtures/violations.tsx.fixture +19 -0
- package/scripts/design-system-advisory/lib.mjs +255 -0
- package/scripts/design-system-advisory/run.mjs +189 -0
- package/scripts/design-system-advisory/workflow.yml +82 -0
- package/scripts/lib/copy-strings.mjs +146 -0
- package/scripts/lib/dark-contrast.mjs +120 -0
- package/scripts/lib/flush-edges.mjs +294 -0
- package/scripts/lib/lab-lint.mjs +62 -0
- package/scripts/lib/mount-page.mjs +25 -0
- package/scripts/lib/source-scan.mjs +173 -0
- package/scripts/lib/tells.mjs +240 -2
- package/scripts/lint-arbitrary-tokens.mjs +47 -0
- package/scripts/lint-component-token-refs.mjs +63 -0
- package/scripts/lint-content-hierarchy.mjs +114 -0
- package/scripts/lint-control-baseline.mjs +72 -0
- package/scripts/lint-copy-punctuation.mjs +60 -0
- package/scripts/lint-even-padding.mjs +58 -0
- package/scripts/lint-label-case.mjs +219 -0
- package/scripts/lint-microanimation.mjs +2 -2
- package/scripts/lint-proximity.mjs +181 -0
- package/scripts/lint-slop.mjs +1 -1
- package/scripts/lint-spacing-scale.mjs +78 -0
- package/scripts/lint-target-size.cjs +132 -0
- package/scripts/lint-token-primitives.mjs +307 -0
- package/scripts/size-audit.cjs +2 -2
- package/scripts/ux-tells.mjs +8 -6
- package/scripts/wcag-audit.cjs +25 -4
- package/src/api/layers/file.ts +2 -0
- package/src/api/site-auth.ts +14 -2
- package/src/app/preview/components/page.tsx +94 -14
- package/src/app/preview/sticker-sheet/page.tsx +329 -0
- package/src/app/preview/sticker-sheet/specimens.tsx +296 -0
- package/src/app/shell.tsx +4 -3
- package/src/components/Foundations/Colors.stories.tsx +119 -8
- package/src/components/home-tab.tsx +6 -1
- package/src/components/onboarding-wizard.tsx +1 -1
- package/src/components/ui/avatar.tsx +4 -0
- package/src/components/ui/chart.tsx +134 -42
- package/src/components/ui/checkbox-group.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +1 -0
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/date-picker.tsx +2 -0
- package/src/components/ui/date-range-picker.tsx +4 -0
- package/src/components/ui/file-upload.tsx +21 -2
- package/src/components/ui/heatmap.tsx +3 -1
- package/src/components/ui/input-group.tsx +5 -2
- package/src/components/ui/multi-select.tsx +1 -0
- package/src/components/ui/radio-group.tsx +2 -2
- package/src/components/ui/sparkline.tsx +33 -4
- package/src/components/ui/spinner.tsx +23 -4
- package/src/components/ui/table.tsx +9 -0
- package/src/components/ui/week-picker.tsx +0 -12
- package/src/data/component-added.json +8 -0
- package/src/data/docs-index.ts +22 -1
- package/src/data/history.json +161 -161
- package/src/data/sticker-sheet.json +9244 -0
- package/src/docs-trace-globs.json +1 -0
- package/src/lib/chart-motion.ts +41 -0
- package/src/lib/get-icon-color.ts +1 -1
- package/src/stories/Accordion.stories.tsx +7 -0
- package/src/stories/ActionBar.stories.tsx +5 -0
- package/src/stories/Affix.stories.tsx +4 -0
- package/src/stories/AiBadge.stories.tsx +9 -7
- package/src/stories/Alert.stories.tsx +13 -0
- package/src/stories/AlertDialog.stories.tsx +4 -0
- package/src/stories/Anchor.stories.tsx +5 -0
- package/src/stories/AngleSlider.stories.tsx +6 -3
- package/src/stories/AspectRatio.stories.tsx +4 -0
- package/src/stories/Autocomplete.stories.tsx +6 -0
- package/src/stories/Avatar.stories.tsx +10 -0
- package/src/stories/Badge.stories.tsx +14 -6
- package/src/stories/Blockquote.stories.tsx +6 -0
- package/src/stories/BottomNavigation.stories.tsx +4 -0
- package/src/stories/Breadcrumb.stories.tsx +3 -0
- package/src/stories/Burger.stories.tsx +1 -0
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ButtonGroup.stories.tsx +9 -0
- package/src/stories/Calendar.stories.tsx +3 -0
- package/src/stories/Card.stories.tsx +4 -0
- package/src/stories/Carousel.stories.tsx +6 -0
- package/src/stories/Cascader.stories.tsx +4 -0
- package/src/stories/Chart.stories.tsx +46 -1
- package/src/stories/ChatBubble.stories.tsx +8 -2
- package/src/stories/ChatMarker.stories.tsx +1 -0
- package/src/stories/Checkbox.stories.tsx +40 -0
- package/src/stories/CheckboxCard.stories.tsx +8 -0
- package/src/stories/CheckboxGroup.stories.tsx +19 -0
- package/src/stories/Chip.stories.tsx +10 -19
- package/src/stories/CircularProgress.stories.tsx +13 -27
- package/src/stories/Clipboard.stories.tsx +6 -0
- package/src/stories/CloseButton.stories.tsx +6 -4
- package/src/stories/Code.stories.tsx +8 -1
- package/src/stories/Collapsible.stories.tsx +2 -0
- package/src/stories/ColorPicker.stories.tsx +6 -0
- package/src/stories/ColorSwatch.stories.tsx +1 -0
- package/src/stories/Combobox.stories.tsx +9 -0
- package/src/stories/Command.stories.tsx +2 -0
- package/src/stories/Container.stories.tsx +8 -0
- package/src/stories/ContextMenu.stories.tsx +9 -0
- package/src/stories/CopyButton.stories.tsx +12 -36
- package/src/stories/DataList.stories.tsx +8 -0
- package/src/stories/DataTable.stories.tsx +9 -0
- package/src/stories/DateField.stories.tsx +7 -0
- package/src/stories/DatePicker.stories.tsx +34 -0
- package/src/stories/DateRangePicker.stories.tsx +32 -0
- package/src/stories/Dialog.stories.tsx +8 -0
- package/src/stories/Drawer.stories.tsx +6 -0
- package/src/stories/DropdownMenu.stories.tsx +2 -0
- package/src/stories/Editable.stories.tsx +10 -0
- package/src/stories/EmptyState.stories.tsx +9 -0
- package/src/stories/Field.stories.tsx +7 -0
- package/src/stories/Fieldset.stories.tsx +8 -0
- package/src/stories/FileButton.stories.tsx +4 -0
- package/src/stories/FileUpload.stories.tsx +16 -17
- package/src/stories/FloatLabel.stories.tsx +3 -8
- package/src/stories/FloatingActionButton.stories.tsx +10 -0
- package/src/stories/FloatingIndicator.stories.tsx +4 -0
- package/src/stories/FloatingPanel.stories.tsx +6 -0
- package/src/stories/FocusTrap.stories.tsx +5 -0
- package/src/stories/FormatByte.stories.tsx +6 -0
- package/src/stories/FormatDate.stories.tsx +8 -0
- package/src/stories/FormatNumber.stories.tsx +9 -0
- package/src/stories/Heatmap.stories.tsx +11 -0
- package/src/stories/Highlight.stories.tsx +6 -0
- package/src/stories/HoverCard.stories.tsx +4 -0
- package/src/stories/Image.stories.tsx +9 -0
- package/src/stories/Indicator.stories.tsx +19 -0
- package/src/stories/Input.stories.tsx +7 -0
- package/src/stories/InputClearButton.stories.tsx +3 -0
- package/src/stories/InputGroup.stories.tsx +40 -0
- package/src/stories/Kbd.stories.tsx +7 -1
- package/src/stories/KeyboardShortcut.stories.tsx +2 -0
- package/src/stories/Label.stories.tsx +2 -0
- package/src/stories/Link.stories.tsx +9 -0
- package/src/stories/List.stories.tsx +8 -0
- package/src/stories/Listbox.stories.tsx +1 -0
- package/src/stories/LoadingDots.stories.tsx +5 -3
- package/src/stories/LoadingOverlay.stories.tsx +5 -1
- package/src/stories/Mark.stories.tsx +5 -0
- package/src/stories/Marquee.stories.tsx +4 -0
- package/src/stories/Masonry.stories.tsx +5 -0
- package/src/stories/Menubar.stories.tsx +3 -0
- package/src/stories/Meter.stories.tsx +11 -17
- package/src/stories/MonthPicker.stories.tsx +5 -1
- package/src/stories/MotionToggle.stories.tsx +1 -0
- package/src/stories/MultiSelect.stories.tsx +9 -0
- package/src/stories/NativeSelect.stories.tsx +1 -0
- package/src/stories/NavLink.stories.tsx +7 -0
- package/src/stories/NavigationMenu.stories.tsx +5 -0
- package/src/stories/NavigationRail.stories.tsx +10 -0
- package/src/stories/Notification.stories.tsx +13 -34
- package/src/stories/NumberInput.stories.tsx +8 -1
- package/src/stories/Overlay.stories.tsx +5 -1
- package/src/stories/Pagination.stories.tsx +8 -0
- package/src/stories/PasswordInput.stories.tsx +2 -0
- package/src/stories/PinInput.stories.tsx +9 -2
- package/src/stories/Popover.stories.tsx +2 -0
- package/src/stories/Progress.stories.tsx +6 -1
- package/src/stories/Prose.stories.tsx +8 -0
- package/src/stories/QrCode.stories.tsx +2 -0
- package/src/stories/Questionnaire.stories.tsx +7 -0
- package/src/stories/RadioGroup.stories.tsx +40 -0
- package/src/stories/RatingGroup.stories.tsx +8 -4
- package/src/stories/Resizable.stories.tsx +4 -2
- package/src/stories/Result.stories.tsx +3 -0
- package/src/stories/Reveal.stories.tsx +2 -0
- package/src/stories/RollingNumber.stories.tsx +5 -0
- package/src/stories/ScrollArea.stories.tsx +3 -1
- package/src/stories/SearchInput.stories.tsx +8 -6
- package/src/stories/SegmentedControl.stories.tsx +11 -0
- package/src/stories/Select.stories.tsx +7 -0
- package/src/stories/Separator.stories.tsx +6 -0
- package/src/stories/Sheet.stories.tsx +5 -0
- package/src/stories/Sidebar.stories.tsx +40 -1
- package/src/stories/SimpleGrid.stories.tsx +5 -0
- package/src/stories/Skeleton.stories.tsx +8 -0
- package/src/stories/SkeletonTable.stories.tsx +6 -5
- package/src/stories/SkipLink.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +2 -1
- package/src/stories/Sonner.stories.tsx +7 -0
- package/src/stories/Sparkline.stories.tsx +14 -1
- package/src/stories/Spinner.stories.tsx +20 -10
- package/src/stories/Spoiler.stories.tsx +5 -0
- package/src/stories/Squircle.stories.tsx +7 -0
- package/src/stories/Stack.stories.tsx +7 -0
- package/src/stories/StatusBadge.stories.tsx +12 -6
- package/src/stories/Stepper.stories.tsx +5 -0
- package/src/stories/Switch.stories.tsx +4 -0
- package/src/stories/Table.stories.tsx +10 -1
- package/src/stories/Tabs.stories.tsx +8 -0
- package/src/stories/Tag.stories.tsx +13 -5
- package/src/stories/TagsInput.stories.tsx +13 -0
- package/src/stories/Text.stories.tsx +12 -0
- package/src/stories/Textarea.stories.tsx +9 -0
- package/src/stories/ThemeIcon.stories.tsx +6 -3
- package/src/stories/TimePicker.stories.tsx +2 -0
- package/src/stories/Timeline.stories.tsx +12 -0
- package/src/stories/Timer.stories.tsx +4 -0
- package/src/stories/Toggle.stories.tsx +7 -5
- package/src/stories/ToggleGroup.stories.tsx +5 -0
- package/src/stories/ToggleTip.stories.tsx +4 -0
- package/src/stories/Toolbar.stories.tsx +6 -0
- package/src/stories/Tooltip.stories.tsx +3 -0
- package/src/stories/Tour.stories.tsx +3 -0
- package/src/stories/TransferList.stories.tsx +3 -0
- package/src/stories/TreeSelect.stories.tsx +4 -0
- package/src/stories/TreeView.stories.tsx +5 -0
- package/src/stories/TypingIndicator.stories.tsx +4 -0
- package/src/stories/VisuallyHidden.stories.tsx +3 -0
- package/src/stories/Watermark.stories.tsx +6 -0
- package/src/stories/WeekPicker.stories.tsx +4 -1
- package/src/stories/WordRotate.stories.tsx +5 -0
- package/src/stories/YearPicker.stories.tsx +5 -11
- package/src/styles.css +50 -2
- package/src/tokens.json +4 -4
- package/LICENSE +0 -21
|
@@ -5,6 +5,7 @@ import * as RechartsPrimitive from "recharts"
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "../../lib/utils"
|
|
7
7
|
import { useReducedMotion } from "../../hooks/use-reduced-motion"
|
|
8
|
+
import { readChartMotion, type ChartMotion } from "../../lib/chart-motion"
|
|
8
9
|
|
|
9
10
|
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
10
11
|
const THEMES = { light: "", dark: ".dark" } as const
|
|
@@ -51,34 +52,74 @@ const ANIMATED_RECHARTS_COMPONENTS = new Set<React.ElementType>([
|
|
|
51
52
|
RechartsPrimitive.Scatter,
|
|
52
53
|
])
|
|
53
54
|
|
|
55
|
+
// Series that draw in along their path. ChartContainer gives them the
|
|
56
|
+
// token-derived draw timing (lib/chart-motion.ts) unless the consumer set
|
|
57
|
+
// their own.
|
|
58
|
+
const DRAWN_RECHARTS_COMPONENTS = new Set<React.ElementType>([
|
|
59
|
+
RechartsPrimitive.Line,
|
|
60
|
+
RechartsPrimitive.Area,
|
|
61
|
+
RechartsPrimitive.Radar,
|
|
62
|
+
])
|
|
63
|
+
|
|
54
64
|
function injectAnimationDefault(
|
|
55
65
|
node: React.ReactNode,
|
|
56
|
-
animate: boolean
|
|
66
|
+
animate: boolean,
|
|
67
|
+
motion: ChartMotion | null,
|
|
68
|
+
drawEnds: number[]
|
|
57
69
|
): React.ReactNode {
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
70
|
+
// animate=false: force isAnimationActive={false} on every animated
|
|
71
|
+
// primitive. animate=true: give drawn series the token-derived duration and
|
|
72
|
+
// easing (unless the consumer set their own) and record when each one
|
|
73
|
+
// finishes drawing, so the point dots can wait for it.
|
|
62
74
|
if (Array.isArray(node)) {
|
|
63
75
|
return node.map((child, i) => (
|
|
64
|
-
<React.Fragment key={i}>
|
|
76
|
+
<React.Fragment key={i}>
|
|
77
|
+
{injectAnimationDefault(child, animate, motion, drawEnds)}
|
|
78
|
+
</React.Fragment>
|
|
65
79
|
))
|
|
66
80
|
}
|
|
67
81
|
if (!React.isValidElement(node)) return node
|
|
68
82
|
const element = node as React.ReactElement<any>
|
|
69
83
|
const props = element.props || {}
|
|
70
|
-
const
|
|
71
|
-
element.type as React.ElementType
|
|
72
|
-
)
|
|
73
|
-
const needsDefault =
|
|
74
|
-
isAnimated && props.isAnimationActive === undefined
|
|
75
|
-
const hasChildren = props.children !== undefined
|
|
76
|
-
if (!needsDefault && !hasChildren) return element
|
|
84
|
+
const type = element.type as React.ElementType
|
|
77
85
|
const nextProps: Record<string, unknown> = {}
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
if (!animate) {
|
|
87
|
+
if (
|
|
88
|
+
ANIMATED_RECHARTS_COMPONENTS.has(type) &&
|
|
89
|
+
props.isAnimationActive === undefined
|
|
90
|
+
) {
|
|
91
|
+
nextProps.isAnimationActive = false
|
|
92
|
+
}
|
|
93
|
+
} else if (DRAWN_RECHARTS_COMPONENTS.has(type) && props.isAnimationActive !== false) {
|
|
94
|
+
const duration =
|
|
95
|
+
typeof props.animationDuration === "number"
|
|
96
|
+
? props.animationDuration
|
|
97
|
+
: motion?.drawMs
|
|
98
|
+
if (props.animationDuration === undefined && motion) {
|
|
99
|
+
nextProps.animationDuration = motion.drawMs
|
|
100
|
+
}
|
|
101
|
+
if (props.animationEasing === undefined && motion) {
|
|
102
|
+
nextProps.animationEasing = motion.drawEasing
|
|
103
|
+
}
|
|
104
|
+
// Only Line dots need holding back: Recharts mounts them at their final
|
|
105
|
+
// positions while the stroke is still drawing. Area dots sit inside the
|
|
106
|
+
// area's reveal clip and Radar dots ride the growing polygon, so both
|
|
107
|
+
// already arrive with their series.
|
|
108
|
+
if (type === RechartsPrimitive.Line && typeof duration === "number") {
|
|
109
|
+
const begin =
|
|
110
|
+
typeof props.animationBegin === "number" ? props.animationBegin : 0
|
|
111
|
+
drawEnds.push(begin + duration)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (props.children !== undefined) {
|
|
115
|
+
nextProps.children = injectAnimationDefault(
|
|
116
|
+
props.children,
|
|
117
|
+
animate,
|
|
118
|
+
motion,
|
|
119
|
+
drawEnds
|
|
120
|
+
)
|
|
81
121
|
}
|
|
122
|
+
if (Object.keys(nextProps).length === 0) return element
|
|
82
123
|
return React.cloneElement(element, nextProps)
|
|
83
124
|
}
|
|
84
125
|
|
|
@@ -118,10 +159,12 @@ function ChartContainer({
|
|
|
118
159
|
// width AND height. The wrapping div still SSRs so layout is reserved.
|
|
119
160
|
const containerRef = React.useRef<HTMLDivElement | null>(null)
|
|
120
161
|
const [hasSize, setHasSize] = React.useState(false)
|
|
162
|
+
const [motion, setMotion] = React.useState<ChartMotion | null>(null)
|
|
121
163
|
|
|
122
164
|
React.useEffect(() => {
|
|
123
165
|
const el = containerRef.current
|
|
124
166
|
if (!el) return
|
|
167
|
+
setMotion(readChartMotion(el))
|
|
125
168
|
const observer = new ResizeObserver((entries) => {
|
|
126
169
|
for (const entry of entries) {
|
|
127
170
|
const { width, height } = entry.contentRect
|
|
@@ -139,10 +182,23 @@ function ChartContainer({
|
|
|
139
182
|
// Recursively default isAnimationActive={false} on every animated Recharts
|
|
140
183
|
// child. Consumers can override per-element by passing the prop explicitly,
|
|
141
184
|
// or opt the whole tree back in via the `animate` prop on the container.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
185
|
+
// The same walk hands drawn series their token-derived timing and reports
|
|
186
|
+
// when the last one finishes drawing; the dots fade in after that, never
|
|
187
|
+
// ahead of the stroke.
|
|
188
|
+
const { safeChildren, dotDelayMs } = React.useMemo(() => {
|
|
189
|
+
const drawEnds: number[] = []
|
|
190
|
+
const next = injectAnimationDefault(
|
|
191
|
+
children,
|
|
192
|
+
effectiveAnimate,
|
|
193
|
+
motion,
|
|
194
|
+
drawEnds
|
|
195
|
+
) as typeof children
|
|
196
|
+
return {
|
|
197
|
+
safeChildren: next,
|
|
198
|
+
dotDelayMs:
|
|
199
|
+
effectiveAnimate && drawEnds.length ? Math.max(...drawEnds) : null,
|
|
200
|
+
}
|
|
201
|
+
}, [children, effectiveAnimate, motion])
|
|
146
202
|
|
|
147
203
|
return (
|
|
148
204
|
<ChartContext.Provider value={{ config }}>
|
|
@@ -162,8 +218,8 @@ function ChartContainer({
|
|
|
162
218
|
style={style}
|
|
163
219
|
{...props}
|
|
164
220
|
>
|
|
165
|
-
<ChartStyle id={chartId} config={config} />
|
|
166
|
-
{hasSize ? (
|
|
221
|
+
<ChartStyle id={chartId} config={config} dotDelayMs={dotDelayMs} />
|
|
222
|
+
{hasSize && motion ? (
|
|
167
223
|
<RechartsPrimitive.ResponsiveContainer width="100%" height="100%">
|
|
168
224
|
{safeChildren}
|
|
169
225
|
</RechartsPrimitive.ResponsiveContainer>
|
|
@@ -173,12 +229,56 @@ function ChartContainer({
|
|
|
173
229
|
)
|
|
174
230
|
}
|
|
175
231
|
|
|
176
|
-
|
|
232
|
+
// Line point dots (`<Line dot>`) render at their final positions the moment a
|
|
233
|
+
// series mounts, while the stroke takes the whole draw to reach them. Left
|
|
234
|
+
// alone they pop in all at once, ahead of the line. Hold them at
|
|
235
|
+
// opacity 0 until the last series has finished drawing (dotDelayMs, from
|
|
236
|
+
// ChartContainer), then fade them in over --duration-slow / --ease-out.
|
|
237
|
+
// Scoped to the line dot group so the hover activeDot (rendered in
|
|
238
|
+
// .recharts-active-dot) is never delayed, and Area / Radar dots (which
|
|
239
|
+
// already arrive with their series) are left alone. No rule at all when the chart is not
|
|
240
|
+
// animating, and none under prefers-reduced-motion: the global reduced-motion
|
|
241
|
+
// rule shortens animation-duration but not animation-delay.
|
|
242
|
+
const CHART_DOT_SELECTOR = [".recharts-line-dots .recharts-dot"]
|
|
243
|
+
|
|
244
|
+
function chartDotEntranceCss(id: string, dotDelayMs: number | null) {
|
|
245
|
+
if (dotDelayMs === null) return ""
|
|
246
|
+
const selector = CHART_DOT_SELECTOR.map(
|
|
247
|
+
(dots) => `[data-chart=${id}] ${dots}`
|
|
248
|
+
).join(",\n")
|
|
249
|
+
return `
|
|
250
|
+
@keyframes chart-dot-fade-in {
|
|
251
|
+
0% {
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
100% {
|
|
255
|
+
opacity: 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
260
|
+
${selector} {
|
|
261
|
+
animation: chart-dot-fade-in var(--duration-slow) var(--ease-out) ${Math.round(dotDelayMs)}ms both;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
`
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const ChartStyle = ({
|
|
268
|
+
id,
|
|
269
|
+
config,
|
|
270
|
+
dotDelayMs = null,
|
|
271
|
+
}: {
|
|
272
|
+
id: string
|
|
273
|
+
config: ChartConfig
|
|
274
|
+
dotDelayMs?: number | null
|
|
275
|
+
}) => {
|
|
177
276
|
const colorConfig = Object.entries(config).filter(
|
|
178
277
|
([, config]) => config.theme || config.color
|
|
179
278
|
)
|
|
279
|
+
const dotCss = chartDotEntranceCss(id, dotDelayMs)
|
|
180
280
|
|
|
181
|
-
if (!colorConfig.length) {
|
|
281
|
+
if (!colorConfig.length && !dotCss) {
|
|
182
282
|
return null
|
|
183
283
|
}
|
|
184
284
|
|
|
@@ -188,19 +288,12 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
|
188
288
|
// per-instance generated CSS, and the values written ARE tokens.
|
|
189
289
|
<style
|
|
190
290
|
dangerouslySetInnerHTML={{
|
|
191
|
-
__html:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
opacity: 1;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
${Object.entries(THEMES)
|
|
202
|
-
.map(
|
|
203
|
-
([theme, prefix]) => `
|
|
291
|
+
__html: `${dotCss}
|
|
292
|
+
${
|
|
293
|
+
colorConfig.length
|
|
294
|
+
? Object.entries(THEMES)
|
|
295
|
+
.map(
|
|
296
|
+
([theme, prefix]) => `
|
|
204
297
|
${prefix} [data-chart=${id}] {
|
|
205
298
|
${colorConfig
|
|
206
299
|
.map(([key, itemConfig]) => {
|
|
@@ -211,12 +304,11 @@ ${colorConfig
|
|
|
211
304
|
})
|
|
212
305
|
.join("\n")}
|
|
213
306
|
}
|
|
214
|
-
${prefix} [data-chart=${id}] .recharts-dot {
|
|
215
|
-
animation: chart-dot-fade-in 400ms ease-out 800ms both;
|
|
216
|
-
}
|
|
217
307
|
`
|
|
218
|
-
|
|
219
|
-
|
|
308
|
+
)
|
|
309
|
+
.join("\n")
|
|
310
|
+
: ""
|
|
311
|
+
}
|
|
220
312
|
`,
|
|
221
313
|
}}
|
|
222
314
|
/>
|
|
@@ -45,7 +45,7 @@ function Checkbox({
|
|
|
45
45
|
// the checkbox. It's absolutely positioned, so it adds zero layout
|
|
46
46
|
// (respects the no-jump / layout-stability principle) and never touches
|
|
47
47
|
// a neighbor's flow. Focus ring stays on the visible box.
|
|
48
|
-
"peer relative inline-flex shrink-0 items-center justify-center border-2 border-muted-foreground/60 bg-
|
|
48
|
+
"peer relative inline-flex shrink-0 items-center justify-center border-2 border-muted-foreground/60 bg-background dark:data-[state=unchecked]:bg-input/30 leading-none shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none before:absolute before:left-1/2 before:top-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
|
|
49
49
|
SIZE_CLASSES[size].box,
|
|
50
50
|
className
|
|
51
51
|
)}
|
|
@@ -54,6 +54,7 @@ function Combobox({
|
|
|
54
54
|
options,
|
|
55
55
|
value,
|
|
56
56
|
onValueChange,
|
|
57
|
+
// copy-ok: this default is quoted in the component registry and generated docs; change them together.
|
|
57
58
|
placeholder = "Select option...",
|
|
58
59
|
searchPlaceholder = "Search...",
|
|
59
60
|
emptyText = "No results found.",
|
|
@@ -161,6 +161,10 @@ function DateRangePicker({
|
|
|
161
161
|
mode="range"
|
|
162
162
|
selected={selectedRange as DateRange | undefined}
|
|
163
163
|
onSelect={handleSelect}
|
|
164
|
+
// Open on the selected range, not today's month. Without this a
|
|
165
|
+
// picker holding Jun 1 to Jun 15 opened on the current month with
|
|
166
|
+
// neither end of the range in view.
|
|
167
|
+
defaultMonth={selectedRange?.from}
|
|
164
168
|
startMonth={fromDate}
|
|
165
169
|
endMonth={toDate}
|
|
166
170
|
disabled={[
|
|
@@ -42,7 +42,7 @@ export interface FileUploadProps extends VariantProps<typeof fileUploadZoneVaria
|
|
|
42
42
|
accept?: string;
|
|
43
43
|
/** Allow selecting more than one file */
|
|
44
44
|
multiple?: boolean;
|
|
45
|
-
/** Maximum file size in bytes.
|
|
45
|
+
/** Maximum file size in bytes. Larger files are rejected, and the rejection is announced to screen readers. */
|
|
46
46
|
maxSize?: number;
|
|
47
47
|
disabled?: boolean;
|
|
48
48
|
className?: string;
|
|
@@ -87,6 +87,8 @@ function FileUpload({
|
|
|
87
87
|
const files = isControlled ? value : localFiles;
|
|
88
88
|
|
|
89
89
|
const [dragState, setDragState] = React.useState<"idle" | "dragging" | "rejected">("idle");
|
|
90
|
+
// Spoken by the live region below. The red drop zone is visual only, and it clears after two seconds.
|
|
91
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
90
92
|
const dragCounterRef = React.useRef(0);
|
|
91
93
|
const rejectTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
92
94
|
|
|
@@ -104,11 +106,22 @@ function FileUpload({
|
|
|
104
106
|
if (maxSize !== undefined && f.size > maxSize) return false;
|
|
105
107
|
return true;
|
|
106
108
|
});
|
|
107
|
-
|
|
109
|
+
const rejected = arr.length - valid.length;
|
|
110
|
+
if (rejected > 0) {
|
|
108
111
|
clearTimeout(rejectTimerRef.current);
|
|
109
112
|
setDragState("rejected");
|
|
110
113
|
rejectTimerRef.current = setTimeout(() => setDragState("idle"), 2000);
|
|
111
114
|
}
|
|
115
|
+
const added = multiple ? valid.length : Math.min(valid.length, 1);
|
|
116
|
+
const plural = (n: number) => `${n} file${n === 1 ? "" : "s"}`;
|
|
117
|
+
setAnnouncement(
|
|
118
|
+
[
|
|
119
|
+
added > 0 ? `${plural(added)} added.` : "",
|
|
120
|
+
rejected > 0 ? `${plural(rejected)} not added: wrong type or too large.` : "",
|
|
121
|
+
]
|
|
122
|
+
.filter(Boolean)
|
|
123
|
+
.join(" ")
|
|
124
|
+
);
|
|
112
125
|
if (valid.length === 0) return;
|
|
113
126
|
const next = multiple ? [...files, ...valid] : valid.slice(0, 1);
|
|
114
127
|
if (!isControlled) setLocalFiles(next);
|
|
@@ -153,6 +166,7 @@ function FileUpload({
|
|
|
153
166
|
|
|
154
167
|
const removeFile = (index: number) => {
|
|
155
168
|
const next = files.filter((_, i) => i !== index);
|
|
169
|
+
setAnnouncement(`${files[index]?.name ?? "File"} removed.`);
|
|
156
170
|
if (!isControlled) setLocalFiles(next);
|
|
157
171
|
onChange?.(next);
|
|
158
172
|
};
|
|
@@ -230,6 +244,11 @@ function FileUpload({
|
|
|
230
244
|
</div>
|
|
231
245
|
</label>
|
|
232
246
|
|
|
247
|
+
{/* Announces additions, rejections and removals; the visual states alone reach no one using a screen reader. */}
|
|
248
|
+
<div role="status" aria-live="polite" className="sr-only">
|
|
249
|
+
{announcement}
|
|
250
|
+
</div>
|
|
251
|
+
|
|
233
252
|
{/* ── file list ── */}
|
|
234
253
|
{files.length > 0 && (
|
|
235
254
|
<ul data-slot="file-upload-list" className="space-y-2">
|
|
@@ -147,7 +147,9 @@ function Heatmap({
|
|
|
147
147
|
aria-label={label}
|
|
148
148
|
tabIndex={0}
|
|
149
149
|
className={cn(
|
|
150
|
-
|
|
150
|
+
// `relative` matters: each cell holds a screen-reader-only span (position: absolute). Without a positioned
|
|
151
|
+
// scroll container those spans escape its clipping and stretch the whole page sideways.
|
|
152
|
+
"relative inline-flex max-w-full flex-col gap-3 overflow-x-auto rounded-md outline-none",
|
|
151
153
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
152
154
|
className
|
|
153
155
|
)}
|
|
@@ -16,7 +16,10 @@ import { Button } from "./button";
|
|
|
16
16
|
const inputGroupVariants = cva(
|
|
17
17
|
[
|
|
18
18
|
"flex items-center overflow-hidden",
|
|
19
|
-
|
|
19
|
+
// dark:bg-input/30 lives on the group, not the <input>: on the input it
|
|
20
|
+
// tinted only the text box and left the addons and button untinted, which
|
|
21
|
+
// read as a lighter block floating inside the field in dark mode.
|
|
22
|
+
"rounded-md border border-input bg-transparent shadow-xs dark:bg-input/30",
|
|
20
23
|
"transition-[color,box-shadow]",
|
|
21
24
|
"focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50",
|
|
22
25
|
// Scope disabled styling to the hosted INPUT — has-[:disabled] matched any
|
|
@@ -102,7 +105,7 @@ function InputGroupInput({
|
|
|
102
105
|
className={cn(
|
|
103
106
|
"min-w-0 flex-1 bg-transparent outline-none",
|
|
104
107
|
"placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground",
|
|
105
|
-
"disabled:cursor-not-allowed
|
|
108
|
+
"disabled:cursor-not-allowed",
|
|
106
109
|
inputPaddingBySize[size],
|
|
107
110
|
// Collapse the doubled inner edge next to an addon: the addon already
|
|
108
111
|
// carries the group's horizontal rhythm (its outer padding), so the
|
|
@@ -49,6 +49,7 @@ function MultiSelect({
|
|
|
49
49
|
options,
|
|
50
50
|
value = [],
|
|
51
51
|
onValueChange,
|
|
52
|
+
// copy-ok: this default is quoted in the component registry and generated docs; change them together.
|
|
52
53
|
placeholder = "Select options...",
|
|
53
54
|
searchPlaceholder = "Search...",
|
|
54
55
|
emptyText = "No results found.",
|
|
@@ -19,7 +19,7 @@ function RadioGroup({
|
|
|
19
19
|
className={cn(
|
|
20
20
|
orientation === "horizontal"
|
|
21
21
|
? "flex flex-row flex-wrap gap-x-6 gap-y-3"
|
|
22
|
-
: "grid gap-3",
|
|
22
|
+
: "grid grid-cols-1 gap-3",
|
|
23
23
|
className
|
|
24
24
|
)}
|
|
25
25
|
{...props}
|
|
@@ -28,7 +28,7 @@ function RadioGroup({
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const radioGroupItemVariants = cva(
|
|
31
|
-
"aspect-square shrink-0 rounded-full border-2 border-muted-foreground/60 bg-
|
|
31
|
+
"aspect-square shrink-0 rounded-full border-2 border-muted-foreground/60 bg-background dark:data-[state=unchecked]:bg-input/30 text-primary shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 data-[state=checked]:bg-primary data-[state=checked]:border-primary",
|
|
32
32
|
{
|
|
33
33
|
variants: {
|
|
34
34
|
size: {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { cn } from "../../lib/utils"
|
|
15
15
|
import { useReducedMotion } from "../../hooks/use-reduced-motion"
|
|
16
|
+
import { readChartMotion, type ChartMotion } from "../../lib/chart-motion"
|
|
16
17
|
|
|
17
18
|
export interface SparklineProps extends React.ComponentProps<"span"> {
|
|
18
19
|
/**
|
|
@@ -85,10 +86,14 @@ function Sparkline({
|
|
|
85
86
|
// ResizeObserver gate — same pattern as ChartContainer.
|
|
86
87
|
const containerRef = React.useRef<HTMLSpanElement | null>(null)
|
|
87
88
|
const [hasSize, setHasSize] = React.useState(false)
|
|
89
|
+
// Draw timing from the BADS motion tokens (see lib/chart-motion.ts), read
|
|
90
|
+
// once the span is mounted.
|
|
91
|
+
const [motion, setMotion] = React.useState<ChartMotion | null>(null)
|
|
88
92
|
|
|
89
93
|
React.useEffect(() => {
|
|
90
94
|
const el = containerRef.current
|
|
91
95
|
if (!el) return
|
|
96
|
+
setMotion(readChartMotion(el))
|
|
92
97
|
const observer = new ResizeObserver((entries) => {
|
|
93
98
|
for (const entry of entries) {
|
|
94
99
|
const { width, height: h } = entry.contentRect
|
|
@@ -114,8 +119,23 @@ function Sparkline({
|
|
|
114
119
|
const padding = max === min ? 1 : (max - min) * 0.1
|
|
115
120
|
const domain: [number, number] = [min - padding, max + padding]
|
|
116
121
|
|
|
117
|
-
// Last-point dot: rendered via Recharts' customized dot prop.
|
|
122
|
+
// Last-point dot: rendered via Recharts' customized dot prop. For
|
|
123
|
+
// type="line" Recharts mounts it at its final position straight away while
|
|
124
|
+
// the stroke takes the whole draw to reach the right edge, so on its own the
|
|
125
|
+
// dot lands well before the line does. Hold it until the draw has finished,
|
|
126
|
+
// then fade it in over --duration-slow / --ease-out. type="area" needs
|
|
127
|
+
// nothing: the dot sits inside the area's left-to-right reveal clip and
|
|
128
|
+
// arrives with it. No delay or fade when not animating (reduced motion).
|
|
118
129
|
const lastIndex = data.length - 1
|
|
130
|
+
const dotEntrance: React.CSSProperties | undefined =
|
|
131
|
+
animate && motion && type === "line"
|
|
132
|
+
? {
|
|
133
|
+
animationDuration: "var(--duration-slow)",
|
|
134
|
+
animationTimingFunction: "var(--ease-out)",
|
|
135
|
+
animationDelay: `${motion.drawMs}ms`,
|
|
136
|
+
animationFillMode: "both",
|
|
137
|
+
}
|
|
138
|
+
: undefined
|
|
119
139
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
140
|
const renderDot = withDot
|
|
121
141
|
? (dotProps: any) => {
|
|
@@ -129,6 +149,8 @@ function Sparkline({
|
|
|
129
149
|
fill={color}
|
|
130
150
|
stroke="var(--color-background, #fff)"
|
|
131
151
|
strokeWidth={1.5}
|
|
152
|
+
className={dotEntrance ? "animate-in fade-in-0" : undefined}
|
|
153
|
+
style={dotEntrance}
|
|
132
154
|
/>
|
|
133
155
|
)
|
|
134
156
|
}
|
|
@@ -141,8 +163,15 @@ function Sparkline({
|
|
|
141
163
|
strokeWidth: 1.5,
|
|
142
164
|
dot: renderDot,
|
|
143
165
|
isAnimationActive: animate,
|
|
166
|
+
animationDuration: motion?.drawMs,
|
|
167
|
+
animationEasing: motion?.drawEasing as "ease-in-out" | undefined,
|
|
144
168
|
} as const
|
|
145
169
|
|
|
170
|
+
// The last-point dot (r=3 plus a 1.5 stroke) sits on the plot edge; give it
|
|
171
|
+
// room so it is not clipped by the chart surface.
|
|
172
|
+
const inset = withDot ? 5 : 2
|
|
173
|
+
const margin = { top: inset, right: inset, bottom: inset, left: 2 }
|
|
174
|
+
|
|
146
175
|
return (
|
|
147
176
|
<span
|
|
148
177
|
ref={containerRef}
|
|
@@ -153,12 +182,12 @@ function Sparkline({
|
|
|
153
182
|
style={{ height }}
|
|
154
183
|
{...props}
|
|
155
184
|
>
|
|
156
|
-
{hasSize ? (
|
|
185
|
+
{hasSize && motion ? (
|
|
157
186
|
<ResponsiveContainer width="100%" height="100%">
|
|
158
187
|
{type === "area" ? (
|
|
159
188
|
<AreaChart
|
|
160
189
|
data={chartData}
|
|
161
|
-
margin={
|
|
190
|
+
margin={margin}
|
|
162
191
|
>
|
|
163
192
|
<defs>
|
|
164
193
|
<linearGradient id={gradientId} x1="0" y1="0" x2="0" y2="1">
|
|
@@ -183,7 +212,7 @@ function Sparkline({
|
|
|
183
212
|
) : (
|
|
184
213
|
<LineChart
|
|
185
214
|
data={chartData}
|
|
186
|
-
margin={
|
|
215
|
+
margin={margin}
|
|
187
216
|
>
|
|
188
217
|
<YAxis domain={domain} hide yAxisId={0} />
|
|
189
218
|
<Line {...commonLineProps} yAxisId={0} />
|
|
@@ -2,7 +2,14 @@ import * as React from "react"
|
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
3
|
import { cn } from "../../lib/utils"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// The ring is drawn in currentColor. `default` sets no color of its own, so
|
|
6
|
+
// the spinner takes the color of the text around it: inside a primary Button
|
|
7
|
+
// it is primary-foreground, inside muted copy it is muted. It used to force
|
|
8
|
+
// text-foreground on the <svg>, which drew a light ring on a light primary
|
|
9
|
+
// button in dark mode (and a dark ring on a dark one in light mode).
|
|
10
|
+
// The variant color is applied to the outer span, so a `className` color
|
|
11
|
+
// (e.g. text-primary-foreground) overrides it instead of being ignored.
|
|
12
|
+
const spinnerVariants = cva("", {
|
|
6
13
|
variants: {
|
|
7
14
|
size: {
|
|
8
15
|
xs: "size-4",
|
|
@@ -11,7 +18,7 @@ const spinnerVariants = cva("animate-spin", {
|
|
|
11
18
|
lg: "size-8",
|
|
12
19
|
},
|
|
13
20
|
variant: {
|
|
14
|
-
default: "
|
|
21
|
+
default: "",
|
|
15
22
|
muted: "text-muted-foreground",
|
|
16
23
|
primary: "text-primary",
|
|
17
24
|
},
|
|
@@ -22,6 +29,14 @@ const spinnerVariants = cva("animate-spin", {
|
|
|
22
29
|
},
|
|
23
30
|
})
|
|
24
31
|
|
|
32
|
+
// Color lives on the outer span (see the note above spinnerVariants), kept
|
|
33
|
+
// apart from the size classes so the span never picks up a size of its own.
|
|
34
|
+
const spinnerColor = {
|
|
35
|
+
default: "",
|
|
36
|
+
muted: "text-muted-foreground",
|
|
37
|
+
primary: "text-primary",
|
|
38
|
+
} as const
|
|
39
|
+
|
|
25
40
|
type SpinnerProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
26
41
|
VariantProps<typeof spinnerVariants> & {
|
|
27
42
|
label?: string
|
|
@@ -39,11 +54,15 @@ function Spinner({
|
|
|
39
54
|
data-slot="spinner"
|
|
40
55
|
role="status"
|
|
41
56
|
aria-label={label}
|
|
42
|
-
className={cn(
|
|
57
|
+
className={cn(
|
|
58
|
+
"inline-flex items-center justify-center",
|
|
59
|
+
spinnerColor[variant ?? "default"],
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
43
62
|
{...props}
|
|
44
63
|
>
|
|
45
64
|
<svg
|
|
46
|
-
className={spinnerVariants({ size, variant })}
|
|
65
|
+
className={cn("animate-spin", spinnerVariants({ size, variant: "default" }))}
|
|
47
66
|
xmlns="http://www.w3.org/2000/svg"
|
|
48
67
|
fill="none"
|
|
49
68
|
viewBox="0 0 24 24"
|
|
@@ -31,9 +31,18 @@ interface TableProps extends React.ComponentProps<"table"> {
|
|
|
31
31
|
|
|
32
32
|
function Table({ className, wrapperClassName, wrapperStyle, striped = false, bordered = false, compact = false, ...props }: TableProps) {
|
|
33
33
|
const variants = React.useMemo(() => ({ striped, bordered, compact }), [striped, bordered, compact])
|
|
34
|
+
// The scroll container is a focusable region. A focusable region with no role and no name is announced as nothing
|
|
35
|
+
// in particular, so when the table is labelled the container carries the same name as a region (WCAG 1.4.10: a
|
|
36
|
+
// table may scroll sideways, but only inside a region a keyboard or screen reader user can find).
|
|
37
|
+
const label = props["aria-label"]
|
|
38
|
+
const labelledBy = props["aria-labelledby"]
|
|
39
|
+
const named = Boolean(label || labelledBy)
|
|
34
40
|
return (
|
|
35
41
|
<TableVariantContext.Provider value={variants}>
|
|
36
42
|
<div data-slot="table-container" tabIndex={0}
|
|
43
|
+
role={named ? "region" : undefined}
|
|
44
|
+
aria-label={label}
|
|
45
|
+
aria-labelledby={labelledBy}
|
|
37
46
|
className={cn(
|
|
38
47
|
"relative w-full overflow-x-auto [scrollbar-width:thin] [scrollbar-color:theme(colors.border)_transparent]",
|
|
39
48
|
bordered && "rounded-md border",
|
|
@@ -76,18 +76,6 @@ function isoWeekYear(d: Date): number {
|
|
|
76
76
|
return thursday.getFullYear()
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/** Returns the number of ISO weeks in a given year (52 or 53). */
|
|
80
|
-
function isoWeeksInYear(year: number): number {
|
|
81
|
-
// A year has 53 ISO weeks if Jan 1 is Thursday, or if it's a leap year
|
|
82
|
-
// whose Jan 1 is Wednesday.
|
|
83
|
-
const jan1 = new Date(year, 0, 1).getDay() // 0=Sun
|
|
84
|
-
return jan1 === 4 || (jan1 === 3 && isLeapYear(year)) ? 53 : 52
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function isLeapYear(year: number): boolean {
|
|
88
|
-
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0
|
|
89
|
-
}
|
|
90
|
-
|
|
91
79
|
/** Number of days in a given month (0-indexed). */
|
|
92
80
|
function daysInMonth(year: number, month: number): number {
|
|
93
81
|
return new Date(year, month + 1, 0).getDate()
|
|
@@ -954,5 +954,13 @@
|
|
|
954
954
|
"OTPInput": {
|
|
955
955
|
"date": "2026-10-19",
|
|
956
956
|
"kind": "primitive"
|
|
957
|
+
},
|
|
958
|
+
"ChangePasswordCard": {
|
|
959
|
+
"date": "2026-09-19",
|
|
960
|
+
"kind": "composition"
|
|
961
|
+
},
|
|
962
|
+
"ReviewCard": {
|
|
963
|
+
"date": "2026-11-03",
|
|
964
|
+
"kind": "composition"
|
|
957
965
|
}
|
|
958
966
|
}
|