@sixthshift/design-system 0.2.1 → 0.3.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 +135 -28
- package/dist/components/Badge/Badge.d.ts +5 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +5 -3
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/BarChart/BarChart.d.ts +8 -2
- package/dist/components/BarChart/BarChart.d.ts.map +1 -1
- package/dist/components/BarChart/BarChart.js +5 -3
- package/dist/components/BarChart/BarChart.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +17 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +80 -225
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/CalendarView.d.ts +15 -0
- package/dist/components/Calendar/CalendarView.d.ts.map +1 -0
- package/dist/components/Calendar/CalendarView.js +255 -0
- package/dist/components/Calendar/CalendarView.js.map +1 -0
- package/dist/components/Calendar/calendar.types.d.ts +78 -27
- package/dist/components/Calendar/calendar.types.d.ts.map +1 -1
- package/dist/components/Calendar/calendar.types.js +10 -3
- package/dist/components/Calendar/calendar.types.js.map +1 -1
- package/dist/components/Calendar/index.d.ts +16 -2
- package/dist/components/Calendar/index.d.ts.map +1 -1
- package/dist/components/Calendar/index.js +15 -1
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/ColorDot/ColorDot.d.ts +9 -3
- package/dist/components/ColorDot/ColorDot.d.ts.map +1 -1
- package/dist/components/ColorDot/ColorDot.js +5 -3
- package/dist/components/ColorDot/ColorDot.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +65 -10
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DatePicker/datepicker.types.d.ts +34 -36
- package/dist/components/DatePicker/datepicker.types.d.ts.map +1 -1
- package/dist/components/DatePicker/datepicker.types.js +5 -3
- package/dist/components/DatePicker/datepicker.types.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +10 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +8 -0
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +3 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +17 -21
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts +20 -20
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts.map +1 -1
- package/dist/components/DateRangePicker/daterangepicker.types.js +6 -0
- package/dist/components/DateRangePicker/daterangepicker.types.js.map +1 -1
- package/dist/components/DateRangePicker/index.d.ts +8 -1
- package/dist/components/DateRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateRangePicker/index.js +6 -0
- package/dist/components/DateRangePicker/index.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +30 -12
- package/dist/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/DateTimePicker/datetimepicker.types.d.ts +20 -17
- package/dist/components/DateTimePicker/datetimepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimePicker/datetimepicker.types.js +10 -0
- package/dist/components/DateTimePicker/datetimepicker.types.js.map +1 -1
- package/dist/components/DateTimePicker/index.d.ts +8 -1
- package/dist/components/DateTimePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimePicker/index.js +6 -0
- package/dist/components/DateTimePicker/index.js.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +3 -3
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +41 -20
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts +22 -18
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.js +8 -0
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.js.map +1 -1
- package/dist/components/DateTimeRangePicker/index.d.ts +8 -0
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/index.js +7 -0
- package/dist/components/DateTimeRangePicker/index.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +16 -5
- package/dist/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyState.js +5 -3
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Field/Field.d.ts +3 -3
- package/dist/components/Field/Field.d.ts.map +1 -1
- package/dist/components/Field/Field.js +6 -4
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/LineChart/LineChart.d.ts +18 -2
- package/dist/components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/components/LineChart/LineChart.js +5 -3
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +2 -4
- package/dist/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown/Markdown.js +3 -2
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Message/Message.d.ts.map +1 -1
- package/dist/components/Message/Message.js +16 -1
- package/dist/components/Message/Message.js.map +1 -1
- package/dist/components/MetricList/MetricList.d.ts +3 -3
- package/dist/components/MetricList/MetricList.d.ts.map +1 -1
- package/dist/components/MetricList/MetricList.js +5 -3
- package/dist/components/MetricList/MetricList.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +24 -5
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +16 -6
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/components/ModalContext.d.ts +14 -0
- package/dist/components/Modal/components/ModalContext.d.ts.map +1 -1
- package/dist/components/Modal/components/ModalContext.js.map +1 -1
- package/dist/components/Modal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/Modal/components/ModalHeader.js +13 -2
- package/dist/components/Modal/components/ModalHeader.js.map +1 -1
- package/dist/components/NavBottom/NavBottom.d.ts +2 -1
- package/dist/components/NavBottom/NavBottom.d.ts.map +1 -1
- package/dist/components/NavBottom/NavBottom.js +6 -4
- package/dist/components/NavBottom/NavBottom.js.map +1 -1
- package/dist/components/NavSide/NavItem.js +1 -1
- package/dist/components/NavSide/NavItem.js.map +1 -1
- package/dist/components/NavSide/NavSide.d.ts +2 -1
- package/dist/components/NavSide/NavSide.d.ts.map +1 -1
- package/dist/components/NavSide/NavSide.js +5 -3
- package/dist/components/NavSide/NavSide.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +7 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/components/PopoverBody.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverBody.js +5 -2
- package/dist/components/Popover/components/PopoverBody.js.map +1 -1
- package/dist/components/Popover/components/PopoverContext.d.ts +1 -0
- package/dist/components/Popover/components/PopoverContext.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverContext.js.map +1 -1
- package/dist/components/Popover/components/PopoverTrigger.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverTrigger.js +2 -2
- package/dist/components/Popover/components/PopoverTrigger.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +5 -3
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/Select/Select.d.ts +11 -2
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +64 -18
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectDropdown.d.ts +14 -2
- package/dist/components/Select/SelectDropdown.d.ts.map +1 -1
- package/dist/components/Select/SelectDropdown.js +19 -4
- package/dist/components/Select/SelectDropdown.js.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts +10 -3
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +12 -3
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Select/useSelectKeyboard.d.ts +15 -1
- package/dist/components/Select/useSelectKeyboard.d.ts.map +1 -1
- package/dist/components/Select/useSelectKeyboard.js +73 -65
- package/dist/components/Select/useSelectKeyboard.js.map +1 -1
- package/dist/components/Sheet/Sheet.d.ts +19 -5
- package/dist/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet/Sheet.js +18 -6
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/Sheet/components/SheetContext.d.ts +10 -0
- package/dist/components/Sheet/components/SheetContext.d.ts.map +1 -1
- package/dist/components/Sheet/components/SheetContext.js.map +1 -1
- package/dist/components/Sheet/components/SheetHeader.d.ts.map +1 -1
- package/dist/components/Sheet/components/SheetHeader.js +11 -2
- package/dist/components/Sheet/components/SheetHeader.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +2 -1
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton/Skeleton.js +5 -3
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.d.ts +10 -2
- package/dist/components/Sparkline/Sparkline.d.ts.map +1 -1
- package/dist/components/Sparkline/Sparkline.js +5 -3
- package/dist/components/Sparkline/Sparkline.js.map +1 -1
- package/dist/components/StatsCard/StatsCard.d.ts +4 -4
- package/dist/components/StatsCard/StatsCard.d.ts.map +1 -1
- package/dist/components/StatsCard/StatsCard.js +5 -3
- package/dist/components/StatsCard/StatsCard.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/Tabs/components/TabsList.d.ts +1 -1
- package/dist/components/Tabs/components/TabsList.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabsList.js +5 -4
- package/dist/components/Tabs/components/TabsList.js.map +1 -1
- package/dist/components/Tabs/components/TabsPanels.d.ts +1 -1
- package/dist/components/Tabs/components/TabsPanels.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabsPanels.js +5 -3
- package/dist/components/Tabs/components/TabsPanels.js.map +1 -1
- package/dist/components/TagChip/TagChip.d.ts +2 -1
- package/dist/components/TagChip/TagChip.d.ts.map +1 -1
- package/dist/components/TagChip/TagChip.js +5 -3
- package/dist/components/TagChip/TagChip.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +1 -1
- package/dist/components/TagInput/TagInput.d.ts.map +1 -1
- package/dist/components/TagInput/TagInput.js +5 -4
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts +2 -2
- package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/components/TimePicker/TimePicker.js +27 -11
- package/dist/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/components/TimePicker/timepicker.types.d.ts +14 -13
- package/dist/components/TimePicker/timepicker.types.d.ts.map +1 -1
- package/dist/components/TimePicker/timepicker.types.js +4 -3
- package/dist/components/TimePicker/timepicker.types.js.map +1 -1
- package/dist/date-time/index.d.ts +2 -0
- package/dist/date-time/index.d.ts.map +1 -1
- package/dist/date-time/index.js +9 -0
- package/dist/date-time/index.js.map +1 -1
- package/dist/date-time/iso.d.ts +261 -0
- package/dist/date-time/iso.d.ts.map +1 -0
- package/dist/date-time/iso.js +358 -0
- package/dist/date-time/iso.js.map +1 -0
- package/dist/date-time/now.d.ts +7 -6
- package/dist/date-time/now.d.ts.map +1 -1
- package/dist/date-time/now.js +3 -3
- package/dist/date-time/now.js.map +1 -1
- package/dist/theme/index.d.ts +4 -3
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +3 -2
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/schema.d.ts +70 -32
- package/dist/theme/schema.d.ts.map +1 -1
- package/dist/theme/schema.js +36 -18
- package/dist/theme/schema.js.map +1 -1
- package/package.json +9 -15
- package/src/components/Badge/Badge.tsx +5 -4
- package/src/components/BarChart/BarChart.tsx +25 -30
- package/src/components/Calendar/Calendar.tsx +91 -401
- package/src/components/Calendar/CalendarView.tsx +445 -0
- package/src/components/Calendar/calendar.types.ts +94 -29
- package/src/components/Calendar/index.ts +16 -17
- package/src/components/ColorDot/ColorDot.tsx +6 -4
- package/src/components/DatePicker/DatePicker.tsx +92 -16
- package/src/components/DatePicker/datepicker.types.ts +38 -39
- package/src/components/DatePicker/index.ts +11 -10
- package/src/components/DateRangePicker/DateRangePicker.tsx +17 -21
- package/src/components/DateRangePicker/daterangepicker.types.ts +22 -22
- package/src/components/DateRangePicker/index.ts +9 -1
- package/src/components/DateTimePicker/DateTimePicker.tsx +46 -18
- package/src/components/DateTimePicker/datetimepicker.types.ts +22 -18
- package/src/components/DateTimePicker/index.ts +9 -1
- package/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx +62 -28
- package/src/components/DateTimeRangePicker/datetimerangepicker.types.ts +24 -19
- package/src/components/DateTimeRangePicker/index.ts +9 -0
- package/src/components/EmptyState/EmptyState.tsx +8 -7
- package/src/components/Field/Field.tsx +7 -6
- package/src/components/LineChart/LineChart.tsx +147 -141
- package/src/components/Markdown/Markdown.tsx +4 -3
- package/src/components/Message/Message.tsx +17 -1
- package/src/components/MetricList/MetricList.tsx +10 -5
- package/src/components/Modal/Modal.tsx +119 -87
- package/src/components/Modal/components/ModalContext.tsx +14 -0
- package/src/components/Modal/components/ModalHeader.tsx +14 -2
- package/src/components/NavBottom/NavBottom.tsx +6 -4
- package/src/components/NavSide/NavItem.tsx +1 -1
- package/src/components/NavSide/NavSide.tsx +5 -3
- package/src/components/Popover/Popover.tsx +7 -0
- package/src/components/Popover/components/PopoverBody.tsx +6 -1
- package/src/components/Popover/components/PopoverContext.tsx +1 -0
- package/src/components/Popover/components/PopoverTrigger.tsx +2 -1
- package/src/components/ProgressBar/ProgressBar.tsx +32 -28
- package/src/components/Select/Select.tsx +76 -19
- package/src/components/Select/SelectDropdown.tsx +32 -3
- package/src/components/Select/SelectTrigger.tsx +26 -3
- package/src/components/Select/useSelectKeyboard.ts +20 -10
- package/src/components/Sheet/Sheet.tsx +108 -83
- package/src/components/Sheet/components/SheetContext.tsx +10 -0
- package/src/components/Sheet/components/SheetHeader.tsx +17 -2
- package/src/components/Skeleton/Skeleton.tsx +5 -3
- package/src/components/Sparkline/Sparkline.tsx +29 -36
- package/src/components/StatsCard/StatsCard.tsx +7 -6
- package/src/components/Tabs/components/TabsList.tsx +5 -3
- package/src/components/Tabs/components/TabsPanels.tsx +5 -3
- package/src/components/TagChip/TagChip.tsx +10 -3
- package/src/components/TagInput/TagInput.tsx +5 -3
- package/src/components/TimePicker/TimePicker.tsx +31 -13
- package/src/components/TimePicker/timepicker.types.ts +14 -13
- package/src/date-time/index.ts +61 -0
- package/src/date-time/iso.ts +511 -0
- package/src/date-time/now.ts +10 -9
- package/src/theme/index.ts +11 -3
- package/src/theme/schema.ts +82 -54
- package/src/theme/tokens.css +807 -0
- package/dist/styles.css +0 -2
- package/dist/theme.generated.css +0 -438
- package/src/styles/base.css +0 -41
- package/src/theme/palette.json +0 -100
- package/src/theme/palette.schema.json +0 -40
- package/src/theme/theme.json +0 -349
- package/src/theme/theme.schema.json +0 -876
- package/src/theme/typography.json +0 -7
- package/src/theme/typography.schema.json +0 -36
- package/tailwind.config.ts +0 -261
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A single package, `@sixthshift/design-system`: ~80 components (primitives, overl
|
|
|
8
8
|
|
|
9
9
|
**Owns:** The component library — 80+ exports via subpath imports, design tokens, theme system (JSON-driven CSS generation), Tailwind config, and Storybook stories. Components span primitives, composites, typography, charts, and overlays.
|
|
10
10
|
|
|
11
|
-
**Boundaries:** Bundles a `./date-time` module (`@sixthshift/design-system/date-time`, wrapping `@js-temporal/polyfill`) used by the date/time components, Floating UI (popover/tooltip positioning)
|
|
11
|
+
**Boundaries:** Bundles a `./date-time` module (`@sixthshift/design-system/date-time`, wrapping `@js-temporal/polyfill`) used internally by the date/time components — those components exchange ISO 8601 strings, so consuming one does not require adopting Temporal. Also Floating UI (popover/tooltip positioning) and CVA (variant styling). Peer-depends on React 18 or 19. No app/domain coupling — domain-specific components live in consuming apps.
|
|
12
12
|
|
|
13
13
|
**Surprise:** All components are imported via subpath exports (`@sixthshift/design-system/button`), never from a barrel root — there is no main export. Positioning uses Floating UI, not Radix. Variants use the `variant` (visual) + `intent` (semantic) orthogonal prop pattern via CVA, not className-based styling. Compound components (e.g. Tabs) use `Object.assign` to attach sub-components. Check `src/components/` before creating any new UI element.
|
|
14
14
|
|
|
@@ -18,22 +18,30 @@ A single package, `@sixthshift/design-system`: ~80 components (primitives, overl
|
|
|
18
18
|
npm install @sixthshift/design-system
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
import "
|
|
24
|
-
import "@sixthshift/design-system/
|
|
21
|
+
```css
|
|
22
|
+
/* your CSS entry — Tailwind 4 is a required peer */
|
|
23
|
+
@import "tailwindcss";
|
|
24
|
+
@import "@sixthshift/design-system/theme.css";
|
|
25
|
+
```
|
|
25
26
|
|
|
27
|
+
That second line is opinionated: it replaces Tailwind's default palette with this
|
|
28
|
+
system's tokens and takes over a few globals. See
|
|
29
|
+
[what the theme takes over](#what-the-theme-takes-over) before adopting it.
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
26
32
|
// anywhere — components via subpath exports (no barrel root)
|
|
27
33
|
import { Button } from "@sixthshift/design-system/button";
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
**What ships:** compiled ESM (`.js`) plus type declarations (`.d.ts`) in `dist/`,
|
|
36
|
+
**What ships:** compiled ESM (`.js`) plus type declarations (`.d.ts`) in `dist/`, and the tokens as CSS. No prebuilt stylesheet: the components are Tailwind classes, so your build compiles them from the `@theme` block `theme.css` brings with it. Nothing runs on install and no consumer toolchain has to transpile this package. The module tree is preserved rather than bundled, so subpath imports still tree-shake.
|
|
31
37
|
|
|
32
38
|
TypeScript sources are published too, but only as the target of the declaration and source maps — nothing resolves to them. Go-to-definition lands on real `.tsx`, and stack traces map back to it.
|
|
33
39
|
|
|
40
|
+
**Module resolution:** subpath types only resolve under `"moduleResolution": "bundler"`, `"node16"`, or `"nodenext"` in `tsconfig.json`. The older `"node"` setting ignores the `exports` map entirely and fails with `TS2307` on every subpath. The package is also ESM-only — every `exports` entry has an `"import"` condition and nothing else, so `require("@sixthshift/design-system/button")` fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. A CJS test runner (e.g. Jest without ESM configured) needs to be set up for ESM before it can import this package.
|
|
41
|
+
|
|
34
42
|
### Peer dependencies
|
|
35
43
|
|
|
36
|
-
`react
|
|
44
|
+
`react`, `react-dom` and `tailwindcss` are the required peers — React at **18 or 19**, Tailwind at **4**. CI runs the type-check and the full unit suite against both React versions on every change, so that range is verified rather than merely declared.
|
|
37
45
|
|
|
38
46
|
Everything else is an **optional** peer — install it only if you import the entry point that needs it. Nothing else in the library imports them, and package managers do not warn about a missing optional peer.
|
|
39
47
|
|
|
@@ -78,7 +86,8 @@ import { FormField } from "@sixthshift/design-system/form-field";
|
|
|
78
86
|
// Charts (LineChart, BarChart, Sparkline, HeatMap)
|
|
79
87
|
import { LineChart } from "@sixthshift/design-system/line-chart";
|
|
80
88
|
|
|
81
|
-
// Pickers (Calendar, DatePicker, TimePicker, DateTimePicker, DateTimeRangePicker)
|
|
89
|
+
// Pickers (Calendar, DatePicker, TimePicker, DateTimePicker, DateRangePicker, DateTimeRangePicker)
|
|
90
|
+
// — all values are ISO 8601 strings, never date objects
|
|
82
91
|
import { DatePicker } from "@sixthshift/design-system/date-picker";
|
|
83
92
|
|
|
84
93
|
// Overlays (Modal, Sheet, Toast, Tooltip, Popover, HoverCard)
|
|
@@ -107,30 +116,125 @@ Components use two orthogonal props:
|
|
|
107
116
|
<Badge variant="soft" intent="warning">Pending</Badge>
|
|
108
117
|
```
|
|
109
118
|
|
|
119
|
+
## Dates and times
|
|
120
|
+
|
|
121
|
+
Every date/time component takes and returns canonical ISO 8601 strings. There is no
|
|
122
|
+
date library to adopt, and the engine behind the components stays an implementation
|
|
123
|
+
detail.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<DatePicker value="2026-08-26" onChange={(date) => save(date)} />
|
|
127
|
+
<TimePicker value="09:30" onChange={(time) => save(time)} />
|
|
128
|
+
<DateTimePicker value="2026-08-26T00:30:00Z" onChange={(instant) => save(instant)} />
|
|
129
|
+
<DatePicker mode="range" value={{ from: "2026-08-01", to: "2026-08-07" }} onChange={setRange} />
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Type | Shape | Notes |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
| `ISODate` | `"2026-08-26"` | |
|
|
135
|
+
| `ISOTime` | `"09:30"` or `"09:30:00"` | callbacks emit `HH:MM:SS` |
|
|
136
|
+
| `ISOInstant` | `"2026-08-26T00:30:00Z"` | always UTC; an offset like `+10:00` is accepted and normalised |
|
|
137
|
+
|
|
138
|
+
The types are template literals, so a literal in the wrong shape is a compile error
|
|
139
|
+
— a datetime passed to a `DatePicker`, an offset where `Z` is required. Values
|
|
140
|
+
arriving as `string` from an API are checked at runtime instead, and a value
|
|
141
|
+
carrying a time where a date belongs throws rather than being silently truncated.
|
|
142
|
+
|
|
143
|
+
Disabling dates is declarative, so the common cases need no date arithmetic:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<DatePicker disabled={{ dayOfWeek: ["sat", "sun"] }} />
|
|
147
|
+
<DatePicker disabled={[{ before: "2026-01-01" }, "2026-12-25"]} />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For building `presets` and bounds, `@sixthshift/design-system/date-time` carries
|
|
151
|
+
ISO-native helpers (`todayISO`, `addDaysISO`, `startOfMonthISO`, `isWeekendISO`,
|
|
152
|
+
`compareISO`, …) so you never need Temporal at a call site. It also still exports
|
|
153
|
+
Temporal itself, for arithmetic the ISO surface deliberately does not carry —
|
|
154
|
+
widen with `fromISODate`, compute, narrow back with `toISODate`.
|
|
155
|
+
|
|
156
|
+
See [docs/component-catalog.md](docs/component-catalog.md#datetime-pickers) for the
|
|
157
|
+
full prop tables.
|
|
158
|
+
|
|
159
|
+
### Upgrading from 0.2.x
|
|
160
|
+
|
|
161
|
+
The pickers previously took and returned `Temporal` objects. At a call site, wrap
|
|
162
|
+
existing values with `serialize()` and parse what comes back, or — better — drop
|
|
163
|
+
Temporal from your own code entirely:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// before
|
|
167
|
+
<DatePicker value={Temporal.PlainDate.from(dueDate)} onChange={(d) => save(d?.toString())} />
|
|
168
|
+
|
|
169
|
+
// after
|
|
170
|
+
<DatePicker value={dueDate} onChange={(d) => save(d)} />
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`DateRangeValue` and `DisabledDateMatcher` are no longer exported; use
|
|
174
|
+
`ISODateRange` and `DisabledDates`. `DateTimeRangeValue` survives as an alias of
|
|
175
|
+
`ISOInstantRange`. The Temporal-typed helpers that `@sixthshift/design-system/calendar`
|
|
176
|
+
re-exported (`isDateDisabled`, `temporalToISO`, and friends) are now internal — the
|
|
177
|
+
ISO helpers above cover what they were reachable for.
|
|
178
|
+
|
|
110
179
|
## Theming
|
|
111
180
|
|
|
112
|
-
Tokens are
|
|
181
|
+
Tokens are CSS (`src/theme/tokens.css`), published as `theme.css`. That one file
|
|
182
|
+
holds the palette, the semantic tokens for each mode, and the `@theme` block that
|
|
183
|
+
tells Tailwind which utilities exist — so a token and its utility can never
|
|
184
|
+
disagree.
|
|
185
|
+
|
|
186
|
+
Light/dark switch via the `data-theme` attribute on the root element. Consumers
|
|
187
|
+
restyle by overriding CSS variables at runtime — component source stays
|
|
188
|
+
untouched. See [docs/design-tokens.md](docs/design-tokens.md) for the full token
|
|
189
|
+
reference.
|
|
113
190
|
|
|
114
191
|
### Tailwind integration
|
|
115
192
|
|
|
116
|
-
|
|
193
|
+
The two `@import` lines above are the whole integration. That single theme import
|
|
194
|
+
carries the token variables *and* the `@theme` block declaring the library's
|
|
195
|
+
utilities, so `bg-bg-brand`, `z-modal`, `animate-fade-in` and `dark:*` compile in
|
|
196
|
+
your build alongside your own classes — same pass, same tree-shaking, and
|
|
197
|
+
`className="mt-8"` on a library component works like any other Tailwind class.
|
|
198
|
+
|
|
199
|
+
Add the library to your `content` sources only if you scan explicitly; automatic
|
|
200
|
+
detection already covers `node_modules` imports. There is no preset, no
|
|
201
|
+
`@config`, and no prebuilt stylesheet to import.
|
|
202
|
+
|
|
203
|
+
**Tailwind 4 is required, not optional.** Every component is a set of Tailwind
|
|
204
|
+
classes, so without it they render unstyled. That is why `tailwindcss` is a
|
|
205
|
+
non-optional peer dependency.
|
|
117
206
|
|
|
118
|
-
|
|
119
|
-
// tailwind.config.ts
|
|
120
|
-
import uiConfig from "@sixthshift/design-system/tailwind.config";
|
|
207
|
+
### What the theme takes over
|
|
121
208
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
209
|
+
This is a design system, not a component grab-bag: importing `theme.css` adopts
|
|
210
|
+
its opinions across your whole app, not just inside its components. All of it is
|
|
211
|
+
deliberate, and all of it is worth knowing before you commit.
|
|
212
|
+
|
|
213
|
+
| What | Effect on your app |
|
|
214
|
+
| --- | --- |
|
|
215
|
+
| **Tailwind's default palette is removed** | `bg-red-500`, `text-gray-700`, `border-gray-200` and the rest stop compiling — in your own markup too. What remains is this system's tokens (`bg-bg-brand`, `text-fg-subtle`, `border-border-normal`, …) plus `white`, `black`, `transparent` and `current`. A colour that was never designed should not be one class away. |
|
|
216
|
+
| **`dark:` means `[data-theme="dark"]`** | Not `prefers-color-scheme`. Theming here is a runtime attribute swap, so every `dark:` utility in your app follows the attribute instead of the OS setting. |
|
|
217
|
+
| **`font-sans` and `font-mono`** | Resolve to Inter Variable and JetBrains Mono. Install the [font peers](#fonts) or the stacks fall through to the system defaults. |
|
|
218
|
+
| **Three global rules** | `*` gets `border-color: var(--border-normal)`, so a bare `border` is the token colour rather than `currentColor`; `:focus-visible` gets the system focus ring; and under `prefers-reduced-motion` every animation and transition is pinned to `0.01ms`. These apply to your elements as well as ours. |
|
|
219
|
+
| **`--color-{emerald,sky,slate}-*`** | 33 variable names shared with Tailwind's palette hold this system's values. Only reachable if you read the variables directly in your own CSS. |
|
|
220
|
+
|
|
221
|
+
If you want a specific stock colour back, re-declare it in your own `@theme`
|
|
222
|
+
block after the import — everything you do not name stays gone:
|
|
223
|
+
|
|
224
|
+
```css
|
|
225
|
+
@import "tailwindcss";
|
|
226
|
+
@import "@sixthshift/design-system/theme.css";
|
|
227
|
+
|
|
228
|
+
@theme {
|
|
229
|
+
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
230
|
+
}
|
|
126
231
|
```
|
|
127
232
|
|
|
128
233
|
## Development
|
|
129
234
|
|
|
130
235
|
```bash
|
|
131
|
-
bun install # `prepare` builds JS, types
|
|
132
|
-
bun run
|
|
133
|
-
bun run dev # watch-rebuild theme + Tailwind CSS
|
|
236
|
+
bun install # `prepare` builds JS, types and styles into dist/
|
|
237
|
+
bun run dev # component workbench on :6006
|
|
134
238
|
bun run test # unit + date-time tests
|
|
135
239
|
bun run type-check # tsc --noEmit (src and tests)
|
|
136
240
|
bun run check # biome lint + format
|
|
@@ -195,9 +299,9 @@ bun run scripts/next-version.ts --explain
|
|
|
195
299
|
The line between the two halves of that table is **whether the commit can reach
|
|
196
300
|
the published tarball**, not whether it feels important. Every code subpath is
|
|
197
301
|
compiled from `src/` into the tarball, so a `refactor:` still changes the bytes
|
|
198
|
-
a consumer receives
|
|
199
|
-
|
|
200
|
-
|
|
302
|
+
a consumer receives, and `build:` changes what lands in `dist/`. Tests,
|
|
303
|
+
workflows, formatting and prose either do not ship or are not user-visible, so
|
|
304
|
+
they release nothing.
|
|
201
305
|
|
|
202
306
|
Two consequences worth knowing:
|
|
203
307
|
|
|
@@ -206,11 +310,14 @@ Two consequences worth knowing:
|
|
|
206
310
|
- A renamed or removed export needs `feat!:` or a `BREAKING CHANGE:` footer.
|
|
207
311
|
Filed as `refactor:` it cuts a patch, which understates it.
|
|
208
312
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
313
|
+
No repository secret is required. Publishing goes through npm trusted
|
|
314
|
+
publishing (OIDC): GitHub Actions mints a short-lived token scoped to the run,
|
|
315
|
+
npm exchanges it against the trusted publisher configured on the package, and
|
|
316
|
+
provenance is attached automatically. There is nothing to leak and nothing to
|
|
317
|
+
rotate. npm authorises the *calling* workflow rather than the one containing
|
|
318
|
+
the publish step, so `version.yml` has to stay the sole entry point — see
|
|
319
|
+
[`.github/workflows/release.yml`](.github/workflows/release.yml) for the
|
|
320
|
+
detail.
|
|
214
321
|
|
|
215
322
|
Tagging by hand still works and goes through the same publish path:
|
|
216
323
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
4
|
variant?: "solid" | "soft" | "outline" | null | undefined;
|
|
5
5
|
intent?: "neutral" | "primary" | "danger" | "success" | "warning" | "muted" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badgeVariants>;
|
|
8
|
-
export declare const Badge:
|
|
8
|
+
export declare const Badge: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
|
|
9
|
+
variant?: "solid" | "soft" | "outline" | null | undefined;
|
|
10
|
+
intent?: "neutral" | "primary" | "danger" | "success" | "warning" | "muted" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLSpanElement>>;
|
|
9
12
|
export { badgeVariants };
|
|
10
13
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,QAAA,MAAM,aAAa;;;8EA8ClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpG,eAAO,MAAM,KAAK;;;uHAEhB,CAAC;AAGH,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@sixthshift/design-system/utils";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
4
5
|
const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-border-brand focus:ring-offset-2", {
|
|
5
6
|
variants: {
|
|
6
7
|
variant: {
|
|
@@ -45,8 +46,9 @@ const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-
|
|
|
45
46
|
intent: "primary",
|
|
46
47
|
},
|
|
47
48
|
});
|
|
48
|
-
export const Badge = ({ className, variant, intent, ...props }) => {
|
|
49
|
-
return _jsx("span", { className: cn(badgeVariants({ variant, intent }), className), ...props });
|
|
50
|
-
};
|
|
49
|
+
export const Badge = React.forwardRef(({ className, variant, intent, ...props }, ref) => {
|
|
50
|
+
return _jsx("span", { ref: ref, className: cn(badgeVariants({ variant, intent }), className), ...props });
|
|
51
|
+
});
|
|
52
|
+
Badge.displayName = "Badge";
|
|
51
53
|
export { badgeVariants };
|
|
52
54
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
export type BarChartItem = {
|
|
3
3
|
label: string;
|
|
4
4
|
value: number;
|
|
@@ -11,5 +11,11 @@ export type BarChartProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
11
11
|
formatValue?: (value: number) => string;
|
|
12
12
|
barHeight?: number;
|
|
13
13
|
};
|
|
14
|
-
export declare const BarChart:
|
|
14
|
+
export declare const BarChart: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
data: BarChartItem[];
|
|
16
|
+
showValues?: boolean;
|
|
17
|
+
maxValue?: number;
|
|
18
|
+
formatValue?: (value: number) => string;
|
|
19
|
+
barHeight?: number;
|
|
20
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
15
21
|
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/components/BarChart/BarChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/components/BarChart/BarChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,QAAQ;UATb,YAAY,EAAE;iBACP,OAAO;eACT,MAAM;kBACH,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;gBAC3B,MAAM;wCA8BnB,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@sixthshift/design-system/utils";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
const DEFAULT_COLORS = ["var(--fg-brand)", "var(--fg-success)", "var(--fg-warning)", "var(--fg-danger)", "var(--fg-subtle)"];
|
|
4
|
-
export const BarChart = ({ data, showValues = true, maxValue: maxValueProp, formatValue = (v) => String(v), barHeight = 24, className, ...rest }) => {
|
|
5
|
+
export const BarChart = React.forwardRef(({ data, showValues = true, maxValue: maxValueProp, formatValue = (v) => String(v), barHeight = 24, className, ...rest }, ref) => {
|
|
5
6
|
const maxValue = maxValueProp ?? Math.max(...data.map((d) => d.value), 1);
|
|
6
|
-
return (_jsx("div", { ...rest, className: cn("flex flex-col gap-2", className), children: data.map((item, i) => {
|
|
7
|
+
return (_jsx("div", { ref: ref, ...rest, className: cn("flex flex-col gap-2", className), children: data.map((item, i) => {
|
|
7
8
|
// Clamp both ends: a negative value would otherwise emit an invalid
|
|
8
9
|
// `width: -n%`, whose rendering is undefined.
|
|
9
10
|
const percent = Math.min(Math.max((item.value / maxValue) * 100, 0), 100);
|
|
10
11
|
const color = item.color ?? DEFAULT_COLORS[i % DEFAULT_COLORS.length];
|
|
11
12
|
return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: "w-20 shrink-0 truncate text-right text-fg-subtle text-sm", children: item.label }), _jsx("div", { className: "flex-1 overflow-hidden rounded-sm bg-bg-subtle", style: { height: barHeight }, children: _jsx("div", { className: "h-full rounded-sm transition-all duration-300", style: { width: `${percent}%`, backgroundColor: color } }) }), showValues && _jsx("span", { className: "w-12 shrink-0 text-right font-medium text-fg-normal text-sm", children: formatValue(item.value) })] }, item.label));
|
|
12
13
|
}) }));
|
|
13
|
-
};
|
|
14
|
+
});
|
|
15
|
+
BarChart.displayName = "BarChart";
|
|
14
16
|
//# sourceMappingURL=BarChart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.js","sourceRoot":"","sources":["../../../src/components/BarChart/BarChart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"BarChart.js","sourceRoot":"","sources":["../../../src/components/BarChart/BarChart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,cAAc,GAAG,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAE7H,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CACtC,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;IAC/H,MAAM,QAAQ,GAAG,YAAY,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAO,CACL,cAAK,GAAG,EAAE,GAAG,KAAM,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,YACrE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpB,oEAAoE;YACpE,8CAA8C;YAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC1E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;YAEtE,OAAO,CACL,eAAsB,SAAS,EAAC,yBAAyB,aACvD,eAAM,SAAS,EAAC,0DAA0D,YAAE,IAAI,CAAC,KAAK,GAAQ,EAC9F,cAAK,SAAS,EAAC,gDAAgD,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAC1F,cAAK,SAAS,EAAC,+CAA+C,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,GACtH,EACL,UAAU,IAAI,eAAM,SAAS,EAAC,6DAA6D,YAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,GAAQ,KALrH,IAAI,CAAC,KAAK,CAMd,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar — the public, ISO-string-typed calendar.
|
|
3
|
+
*
|
|
4
|
+
* A thin adapter over {@link CalendarView}: it parses incoming ISO strings and
|
|
5
|
+
* serialises outgoing selections. All the behaviour lives in CalendarView.
|
|
6
|
+
*
|
|
7
|
+
* Every conversion is memoised on the string it came from, and every handler is
|
|
8
|
+
* stable. Temporal objects have no value identity — `PlainDate.from("2026-08-26")`
|
|
9
|
+
* is never `===` another PlainDate for the same day — and CalendarView keys
|
|
10
|
+
* `useMemo`/`useCallback` on these values directly, so converting unmemoised
|
|
11
|
+
* would invalidate the whole grid on every render.
|
|
12
|
+
*
|
|
13
|
+
* Props are read with `"key" in props` rather than destructured per mode,
|
|
14
|
+
* because every hook here has to run unconditionally.
|
|
15
|
+
*/
|
|
16
|
+
import * as React from "react";
|
|
1
17
|
import type { CalendarProps } from "./calendar.types.js";
|
|
2
18
|
export type { CalendarProps };
|
|
3
|
-
export declare const Calendar:
|
|
19
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
20
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,aAAa,EAAmD,MAAM,kBAAkB,CAAC;AAEvG,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,eAAO,MAAM,QAAQ,sFAsFnB,CAAC"}
|