@processdynamics/components 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Process Dynamics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,175 @@
1
- # Temporary Holding Version
1
+ # pd-design-system
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A component library for Process Dynamics, built with Next.js, Tailwind CSS v4 and Storybook. Components are built on [shadcn](https://ui.shadcn.com) (Radix base). Storybook is both the documentation and the test suite.
4
+
5
+ ## Install
6
+
7
+ The library is published on npm as `@processdynamics/components`.
8
+
9
+ ```bash
10
+ pnpm add @processdynamics/components
11
+ ```
12
+
13
+ Install the peer dependencies too (see [What the using app must install](#what-the-using-app-must-install)), then add two lines to your global CSS, after Tailwind:
14
+
15
+ ```css
16
+ @import "tailwindcss";
17
+ @import "tw-animate-css";
18
+ @import "@processdynamics/components/styles.css";
19
+ ```
20
+
21
+ `styles.css` carries the shadcn theme colours, the dark mode variant, and the Tailwind source line that makes Tailwind scan the package's classes. Then import components by name:
22
+
23
+ ```tsx
24
+ import { DatePicker } from "@processdynamics/components";
25
+ ```
26
+
27
+ ## Stack
28
+
29
+ - Next.js 16 (App Router) and React 19. The Next app is only a host for the components.
30
+ - Tailwind CSS v4, with the theme in `src/app/globals.css`.
31
+ - shadcn on the Radix base, with the `cn` package for class merging.
32
+ - Storybook 10 for docs and stories, with the Vitest addon running every story as a test in a real browser.
33
+ - pnpm, pinned in `package.json`. Use pnpm, not npm.
34
+
35
+ ## Getting started
36
+
37
+ ```bash
38
+ pnpm install
39
+ pnpm exec playwright install chromium # one-off, for the story tests
40
+ pnpm storybook # http://localhost:6006
41
+ ```
42
+
43
+ ## Commands
44
+
45
+ - `pnpm storybook` runs Storybook on port 6006.
46
+ - `pnpm build-storybook` builds the static Storybook.
47
+ - `pnpm build` builds Storybook into `public/storybook` first and then the Next app, so the deployed site serves Storybook at `/storybook/index.html`. Don't commit `public/storybook`, it is generated.
48
+ - `pnpm exec vitest run` runs every story as a test, including the `play` interaction checks.
49
+ - `pnpm exec tsc --noEmit` runs the type check.
50
+ - `pnpm lint` runs ESLint.
51
+ - `pnpm dev` runs the Next host app.
52
+ - `pnpm build:lib` builds the package into `dist/` (ESM, CommonJS, types and `styles.css`).
53
+
54
+ The story tests don't check styling. For visual changes, open the story in a browser as well.
55
+
56
+ ## Components
57
+
58
+ ### DatePicker
59
+
60
+ A single date picker. A button shows the chosen date, or "Pick a date", and opens a calendar in a popover.
61
+
62
+ ```tsx
63
+ "use client";
64
+
65
+ import { useState } from "react";
66
+ import { DatePicker } from "@processdynamics/components";
67
+
68
+ export function Example() {
69
+ const [date, setDate] = useState<Date | null>(null);
70
+ return <DatePicker date={date} onSelect={setDate} />;
71
+ }
72
+ ```
73
+
74
+ | Prop | Type | Description |
75
+ | --- | --- | --- |
76
+ | `date` | `Date \| null` | The selected date. Optional. The component is controlled, so update it from `onSelect` or the button won't change. |
77
+ | `onSelect` | `(date: Date) => void` | Required. Called with the chosen day, and the popover closes straight after. |
78
+
79
+ Behaviour to know about:
80
+
81
+ - The button and popover fill the width of their container, so size it with a wrapper.
82
+ - The date shows in long format, for example "March 15th, 2026".
83
+ - The calendar opens on the month of `date`, or the current month when there is none. With no date, today is highlighted as the selection while the button still says "Pick a date".
84
+ - A date can be changed but not cleared.
85
+ - The popover is modal on purpose, so it works inside a vaul drawer.
86
+
87
+ The full docs page, with live controls and stories, is in Storybook under Components, then DatePicker.
88
+
89
+ ## Project layout
90
+
91
+ ```
92
+ .storybook/ Storybook config (main.ts registers the Tailwind Vite plugin)
93
+ src/
94
+ app/ Next host app and globals.css (theme tokens)
95
+ components/
96
+ <name>/ one folder per component: Component.tsx and its stories
97
+ ui/ shadcn parts: button, calendar, popover
98
+ index.ts public exports
99
+ lib/
100
+ utils.ts re-exports cn
101
+ styles/
102
+ theme.css theme tokens and variants, shipped as styles.css
103
+ scripts/ buildStyles.mjs writes dist/styles.css
104
+ tsup.config.ts library build config
105
+ components.json shadcn config
106
+ ```
107
+
108
+ - Storybook runs on Vite while Next handles Tailwind itself, so `.storybook/main.ts` adds the Tailwind Vite plugin. Without it every story renders unstyled.
109
+ - `src/lib/utils.ts` re-exports `cn` from the [cn](https://www.npmjs.com/package/cn) package, shadcn's class-merging helper. It replaces `clsx` and `tailwind-merge`.
110
+
111
+ ## Adding a component
112
+
113
+ 1. Make `src/components/<name>/<Name>.tsx`. Use shadcn parts from `src/components/ui/` where you can.
114
+ 2. Add JSDoc to the component and every prop. Storybook's docs page reads it.
115
+ 3. Add `<Name>.stories.tsx` with `tags: ["autodocs"]`, a story for each state, and a `play` function for behaviour.
116
+ 4. Export it from `src/components/index.ts`.
117
+
118
+ Add shadcn parts with `pnpm dlx shadcn@latest add <name>`. After running shadcn, check two things: `components.json` and the new files still use the Radix base (the default, Base UI, has no `asChild`), and `src/lib/utils.ts` is still `export { cn } from "cn"`.
119
+
120
+ See `CLAUDE.md` for the full coding and Git conventions.
121
+
122
+ ## What the using app must install
123
+
124
+ The packages the components import are declared as `peerDependencies` in `package.json`, so the app that uses them installs and owns them:
125
+
126
+ - `react` and `react-dom`
127
+ - `react-day-picker` and `date-fns` for the date picker
128
+ - `radix-ui` for the popover
129
+ - `lucide-react` for icons
130
+ - `class-variance-authority` for button variants
131
+ - `cn` for class merging
132
+
133
+ They are also dev dependencies here so Storybook and the tests can run.
134
+
135
+ The app also needs Tailwind v4 and `tw-animate-css` (for the popover animation). The theme colours and the Tailwind source line come from `@processdynamics/components/styles.css`, as shown in [Install](#install).
136
+
137
+ ## Publishing
138
+
139
+ The package is public on npm under the `processdynamics` organisation. Every merge to `main` publishes a new version automatically.
140
+
141
+ ### How it works
142
+
143
+ - **When you commit**, a pre-commit hook (Husky, installed by `pnpm install`) runs `pnpm version:sync`. It asks npm for the latest version and, if `package.json` isn't already ahead, sets it to that plus one patch and stages the change. It never blocks a commit: if npm is unreachable or the package isn't published yet, it just skips.
144
+ - **On every pull request**, the Release workflow runs `pnpm version:check`, which fails if `package.json` isn't ahead of npm. It's the safety net for a skipped hook, or for another P R that merged first and took your number. If it fails, run `pnpm version:sync`, commit, and push.
145
+ - **On every merge to `main`**, the workflow runs the checks, publishes to npm and tags the release (`v0.1.5`). It uses npm trusted publishing, so no npm token is stored anywhere. It never commits to `main`, because `main` is protected.
146
+ - **For a minor or major release**, set the version yourself in `package.json` (for example `0.2.0`) in the P R. A version already ahead of npm is kept as it is.
147
+
148
+ If two P Rs merge close together and the second carries a number that's already taken, the workflow publishes npm's latest plus one instead and tags that. `package.json` on `main` is then one behind until the next P R's hook corrects it.
149
+
150
+ ### One-off setup
151
+
152
+ 1. Publish the first version by hand (see below), because the trusted publisher can only be added to a package that exists.
153
+ 2. On npmjs.com, open the package, then Settings, then Trusted Publisher, and add GitHub Actions with owner `IncredibleMrTim`, repository `pd-design-system` and workflow filename `release.yml`. All three are case-sensitive.
154
+
155
+ ### If a publish fails
156
+
157
+ The Release workflow only tags a release after the publish succeeds, so a failed publish leaves no tag and nothing on npm. Look at the failed run's "Publish to npm" step:
158
+
159
+ - **`E403 ... OIDC permission denied for this action`**: npm didn't accept the trusted publisher settings for this workflow. Open the package on npmjs.com, then Settings, then Trusted Publisher, and check the owner (`IncredibleMrTim`), repository (`pd-design-system`) and workflow filename (`release.yml`, with the extension). They're case-sensitive, and if there's an allowed actions option, `npm publish` must be ticked.
160
+ - **`TLOG_CREATE_ENTRY_ERROR ... (409) an equivalent entry already exists`**: the repo is public, so npm records signed provenance for each publish in a public transparency log. Once an attempt has logged an entry, re-running the same run is refused. Don't re-run it. A new commit on `main`, meaning a new merged P R, makes a fresh run and publishes normally. Each failed attempt adds a permanent public log entry, so fix the cause before trying again.
161
+
162
+ If `package.json` is already ahead of npm when a merge happens, the workflow publishes that version as it is, so a retry after a failure publishes the same number.
163
+
164
+ ### Publishing by hand
165
+
166
+ This is only needed for the first release. Commit and merge first, then:
167
+
168
+ 1. Switch to `main` with a clean, up-to-date checkout.
169
+ 2. Log in with `npm login` (two-factor authentication is on).
170
+ 3. Run `pnpm release:dry` to rehearse. It runs the type check, lint and story tests, confirms you're logged in to npm, then does a publish dry run that uploads nothing. It works from any branch.
171
+ 4. Run `pnpm release`. It first stops unless you're on `main` with a clean working tree that matches `origin/main`. Then it runs the same checks as the rehearsal and `pnpm publish`, which asks for your two-factor code. Publishing builds the package first through `prepublishOnly`, and `publishConfig` already sets public access.
172
+
173
+ To check what would ship without publishing, run `pnpm pack` and read the file list. Only `dist/`, `package.json`, this README and the licence go in.
174
+
175
+ Because of how it's built, every component is bundled into one client bundle with a `"use client"` banner, and the `@/` alias used inside the source is resolved at build time.
package/dist/index.cjs ADDED
@@ -0,0 +1,368 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/components/index.ts
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ DatePicker: () => DatePicker
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/components/datePicker/DatePicker.tsx
39
+ var import_lucide_react2 = require("lucide-react");
40
+
41
+ // src/components/ui/calendar.tsx
42
+ var React = __toESM(require("react"), 1);
43
+ var import_cn2 = require("cn");
44
+ var import_react_day_picker = require("react-day-picker");
45
+
46
+ // src/components/ui/button.tsx
47
+ var import_class_variance_authority = require("class-variance-authority");
48
+ var import_cn = require("cn");
49
+ var import_radix_ui = require("radix-ui");
50
+ var import_jsx_runtime = require("react/jsx-runtime");
51
+ var buttonVariants = (0, import_class_variance_authority.cva)(
52
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
53
+ {
54
+ variants: {
55
+ variant: {
56
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
57
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
58
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
59
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
60
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
61
+ link: "text-primary underline-offset-4 hover:underline"
62
+ },
63
+ size: {
64
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
65
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
66
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
67
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
68
+ icon: "size-8",
69
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
70
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
71
+ "icon-lg": "size-9"
72
+ }
73
+ },
74
+ defaultVariants: {
75
+ variant: "default",
76
+ size: "default"
77
+ }
78
+ }
79
+ );
80
+ function Button({
81
+ className,
82
+ variant = "default",
83
+ size = "default",
84
+ asChild = false,
85
+ ...props
86
+ }) {
87
+ const Comp = asChild ? import_radix_ui.Slot.Root : "button";
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ Comp,
90
+ {
91
+ "data-slot": "button",
92
+ "data-variant": variant,
93
+ "data-size": size,
94
+ className: (0, import_cn.cn)(buttonVariants({ variant, size, className })),
95
+ ...props
96
+ }
97
+ );
98
+ }
99
+
100
+ // src/components/ui/calendar.tsx
101
+ var import_lucide_react = require("lucide-react");
102
+ var import_jsx_runtime2 = require("react/jsx-runtime");
103
+ function Calendar({
104
+ className,
105
+ classNames,
106
+ showOutsideDays = true,
107
+ captionLayout = "label",
108
+ buttonVariant = "ghost",
109
+ locale,
110
+ formatters,
111
+ components,
112
+ ...props
113
+ }) {
114
+ const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
115
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
116
+ import_react_day_picker.DayPicker,
117
+ {
118
+ showOutsideDays,
119
+ className: (0, import_cn2.cn)(
120
+ "group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
121
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
122
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
123
+ className
124
+ ),
125
+ captionLayout,
126
+ locale,
127
+ formatters: {
128
+ formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
129
+ ...formatters
130
+ },
131
+ classNames: {
132
+ root: (0, import_cn2.cn)("w-fit", defaultClassNames.root),
133
+ months: (0, import_cn2.cn)(
134
+ "relative flex flex-col gap-4 md:flex-row",
135
+ defaultClassNames.months
136
+ ),
137
+ month: (0, import_cn2.cn)("flex w-full flex-col gap-4", defaultClassNames.month),
138
+ nav: (0, import_cn2.cn)(
139
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
140
+ defaultClassNames.nav
141
+ ),
142
+ button_previous: (0, import_cn2.cn)(
143
+ buttonVariants({ variant: buttonVariant }),
144
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
145
+ defaultClassNames.button_previous
146
+ ),
147
+ button_next: (0, import_cn2.cn)(
148
+ buttonVariants({ variant: buttonVariant }),
149
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
150
+ defaultClassNames.button_next
151
+ ),
152
+ month_caption: (0, import_cn2.cn)(
153
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
154
+ defaultClassNames.month_caption
155
+ ),
156
+ dropdowns: (0, import_cn2.cn)(
157
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
158
+ defaultClassNames.dropdowns
159
+ ),
160
+ dropdown_root: (0, import_cn2.cn)(
161
+ "relative rounded-(--cell-radius)",
162
+ defaultClassNames.dropdown_root
163
+ ),
164
+ dropdown: (0, import_cn2.cn)(
165
+ "absolute inset-0 bg-popover opacity-0",
166
+ defaultClassNames.dropdown
167
+ ),
168
+ caption_label: (0, import_cn2.cn)(
169
+ "font-medium select-none",
170
+ captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
171
+ defaultClassNames.caption_label
172
+ ),
173
+ month_grid: (0, import_cn2.cn)("w-full border-collapse", defaultClassNames.month_grid),
174
+ weekdays: (0, import_cn2.cn)("flex", defaultClassNames.weekdays),
175
+ weekday: (0, import_cn2.cn)(
176
+ "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
177
+ defaultClassNames.weekday
178
+ ),
179
+ week: (0, import_cn2.cn)("mt-2 flex w-full", defaultClassNames.week),
180
+ week_number_header: (0, import_cn2.cn)(
181
+ "w-(--cell-size) select-none",
182
+ defaultClassNames.week_number_header
183
+ ),
184
+ week_number: (0, import_cn2.cn)(
185
+ "text-[0.8rem] text-muted-foreground select-none",
186
+ defaultClassNames.week_number
187
+ ),
188
+ day: (0, import_cn2.cn)(
189
+ "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
190
+ props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
191
+ defaultClassNames.day
192
+ ),
193
+ range_start: (0, import_cn2.cn)(
194
+ "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
195
+ defaultClassNames.range_start
196
+ ),
197
+ range_middle: (0, import_cn2.cn)("rounded-none", defaultClassNames.range_middle),
198
+ range_end: (0, import_cn2.cn)(
199
+ "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
200
+ defaultClassNames.range_end
201
+ ),
202
+ today: (0, import_cn2.cn)(
203
+ "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
204
+ defaultClassNames.today
205
+ ),
206
+ outside: (0, import_cn2.cn)(
207
+ "text-muted-foreground aria-selected:text-muted-foreground",
208
+ defaultClassNames.outside
209
+ ),
210
+ disabled: (0, import_cn2.cn)(
211
+ "text-muted-foreground opacity-50",
212
+ defaultClassNames.disabled
213
+ ),
214
+ hidden: (0, import_cn2.cn)("invisible", defaultClassNames.hidden),
215
+ ...classNames
216
+ },
217
+ components: {
218
+ Root: ({ className: className2, rootRef, ...props2 }) => {
219
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
220
+ "div",
221
+ {
222
+ "data-slot": "calendar",
223
+ ref: rootRef,
224
+ className: (0, import_cn2.cn)(className2),
225
+ ...props2
226
+ }
227
+ );
228
+ },
229
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
230
+ if (orientation === "left") {
231
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronLeftIcon, { className: (0, import_cn2.cn)("size-4", className2), ...props2 });
232
+ }
233
+ if (orientation === "right") {
234
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronRightIcon, { className: (0, import_cn2.cn)("size-4", className2), ...props2 });
235
+ }
236
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronDownIcon, { className: (0, import_cn2.cn)("size-4", className2), ...props2 });
237
+ },
238
+ DayButton: ({ ...props2 }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CalendarDayButton, { locale, ...props2 }),
239
+ WeekNumber: ({ children, ...props2 }) => {
240
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { ...props2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
241
+ },
242
+ ...components
243
+ },
244
+ ...props
245
+ }
246
+ );
247
+ }
248
+ function CalendarDayButton({
249
+ className,
250
+ day,
251
+ modifiers,
252
+ locale,
253
+ ...props
254
+ }) {
255
+ const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
256
+ const ref = React.useRef(null);
257
+ React.useEffect(() => {
258
+ if (modifiers.focused) ref.current?.focus();
259
+ }, [modifiers.focused]);
260
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
261
+ Button,
262
+ {
263
+ ref,
264
+ variant: "ghost",
265
+ size: "icon",
266
+ "data-day": day.date.toLocaleDateString(locale?.code),
267
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
268
+ "data-range-start": modifiers.range_start,
269
+ "data-range-end": modifiers.range_end,
270
+ "data-range-middle": modifiers.range_middle,
271
+ className: (0, import_cn2.cn)(
272
+ "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
273
+ defaultClassNames.day,
274
+ className
275
+ ),
276
+ ...props
277
+ }
278
+ );
279
+ }
280
+
281
+ // src/components/ui/popover.tsx
282
+ var import_cn3 = require("cn");
283
+ var import_radix_ui2 = require("radix-ui");
284
+ var import_jsx_runtime3 = require("react/jsx-runtime");
285
+ function Popover({
286
+ ...props
287
+ }) {
288
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Popover.Root, { "data-slot": "popover", ...props });
289
+ }
290
+ function PopoverTrigger({
291
+ ...props
292
+ }) {
293
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
294
+ }
295
+ function PopoverContent({
296
+ className,
297
+ align = "center",
298
+ sideOffset = 4,
299
+ ...props
300
+ }) {
301
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
302
+ import_radix_ui2.Popover.Content,
303
+ {
304
+ "data-slot": "popover-content",
305
+ align,
306
+ sideOffset,
307
+ className: (0, import_cn3.cn)(
308
+ "z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
309
+ className
310
+ ),
311
+ ...props
312
+ }
313
+ ) });
314
+ }
315
+
316
+ // src/components/datePicker/DatePicker.tsx
317
+ var import_date_fns = require("date-fns");
318
+ var import_react = require("react");
319
+ var import_jsx_runtime4 = require("react/jsx-runtime");
320
+ var DatePicker = ({ onSelect, date }) => {
321
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
322
+ const handleSelect = (selectedDate) => {
323
+ onSelect(selectedDate);
324
+ setIsOpen(false);
325
+ };
326
+ return (
327
+ // Modal so the calendar re-enables pointer events for itself. Inside a vaul
328
+ // drawer the popover is portaled outside the drawer, and vaul bundles its
329
+ // own copy of Radix's layer package, so a non-modal popover inherits the
330
+ // drawer's pointer-events: none and its day buttons never receive clicks.
331
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Popover, { modal: true, open: isOpen, onOpenChange: setIsOpen, children: [
332
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
333
+ Button,
334
+ {
335
+ variant: "outline",
336
+ "data-empty": !date,
337
+ className: "w-full justify-between text-left font-normal data-[empty=true]:text-muted-foreground",
338
+ children: [
339
+ date ? (0, import_date_fns.format)(date, "PPP") : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Pick a date" }),
340
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.ChevronDownIcon, { "data-icon": "inline-end" })
341
+ ]
342
+ }
343
+ ) }),
344
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
345
+ PopoverContent,
346
+ {
347
+ className: "w-[--radix-popover-trigger-width] p-0",
348
+ align: "start",
349
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
350
+ Calendar,
351
+ {
352
+ classNames: { root: "w-full" },
353
+ mode: "single",
354
+ required: true,
355
+ selected: date ?? /* @__PURE__ */ new Date(),
356
+ onSelect: handleSelect,
357
+ defaultMonth: date ?? /* @__PURE__ */ new Date()
358
+ }
359
+ )
360
+ }
361
+ )
362
+ ] })
363
+ );
364
+ };
365
+ // Annotate the CommonJS export names for ESM import in node:
366
+ 0 && (module.exports = {
367
+ DatePicker
368
+ });
@@ -0,0 +1,33 @@
1
+ import * as react from 'react';
2
+
3
+ interface IDatePicker {
4
+ /**
5
+ * Called with the chosen day when the user picks one. The popover closes
6
+ * straight afterwards. It is not called when the popover is dismissed
7
+ * without a pick.
8
+ */
9
+ onSelect: (date: Date) => void;
10
+ /**
11
+ * The selected date. The component is controlled: it never stores the
12
+ * date itself, so update this from `onSelect` or the button text will not
13
+ * change. Leave it empty (`undefined` or `null`) to show the placeholder.
14
+ */
15
+ date?: Date | null;
16
+ }
17
+ /**
18
+ * A single date picker. A button shows the chosen date (or "Pick a date")
19
+ * and opens a calendar in a popover.
20
+ *
21
+ * - The button and the popover both fill the width of their container, so
22
+ * size it by wrapping it in an element with a width.
23
+ * - The date is shown in the long format from date-fns, for example
24
+ * "March 15th, 2026".
25
+ * - The calendar opens on the month of `date`, or on the current month when
26
+ * there is no date. With no date, today is highlighted as the selection.
27
+ * - A date can be changed but not cleared, because the calendar is in
28
+ * required single mode.
29
+ * - The popover is modal on purpose, so it still works inside a vaul drawer.
30
+ */
31
+ declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
32
+
33
+ export { DatePicker };
@@ -0,0 +1,33 @@
1
+ import * as react from 'react';
2
+
3
+ interface IDatePicker {
4
+ /**
5
+ * Called with the chosen day when the user picks one. The popover closes
6
+ * straight afterwards. It is not called when the popover is dismissed
7
+ * without a pick.
8
+ */
9
+ onSelect: (date: Date) => void;
10
+ /**
11
+ * The selected date. The component is controlled: it never stores the
12
+ * date itself, so update this from `onSelect` or the button text will not
13
+ * change. Leave it empty (`undefined` or `null`) to show the placeholder.
14
+ */
15
+ date?: Date | null;
16
+ }
17
+ /**
18
+ * A single date picker. A button shows the chosen date (or "Pick a date")
19
+ * and opens a calendar in a popover.
20
+ *
21
+ * - The button and the popover both fill the width of their container, so
22
+ * size it by wrapping it in an element with a width.
23
+ * - The date is shown in the long format from date-fns, for example
24
+ * "March 15th, 2026".
25
+ * - The calendar opens on the month of `date`, or on the current month when
26
+ * there is no date. With no date, today is highlighted as the selection.
27
+ * - A date can be changed but not cleared, because the calendar is in
28
+ * required single mode.
29
+ * - The popover is modal on purpose, so it still works inside a vaul drawer.
30
+ */
31
+ declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
32
+
33
+ export { DatePicker };
package/dist/index.js ADDED
@@ -0,0 +1,335 @@
1
+ "use client";
2
+
3
+ // src/components/datePicker/DatePicker.tsx
4
+ import { ChevronDownIcon as ChevronDownIcon2 } from "lucide-react";
5
+
6
+ // src/components/ui/calendar.tsx
7
+ import * as React from "react";
8
+ import { cn as cn2 } from "cn";
9
+ import {
10
+ DayPicker,
11
+ getDefaultClassNames
12
+ } from "react-day-picker";
13
+
14
+ // src/components/ui/button.tsx
15
+ import { cva } from "class-variance-authority";
16
+ import { cn } from "cn";
17
+ import { Slot } from "radix-ui";
18
+ import { jsx } from "react/jsx-runtime";
19
+ var buttonVariants = cva(
20
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
21
+ {
22
+ variants: {
23
+ variant: {
24
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
25
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
26
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
27
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
28
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
29
+ link: "text-primary underline-offset-4 hover:underline"
30
+ },
31
+ size: {
32
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
33
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
34
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
35
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
36
+ icon: "size-8",
37
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
38
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
39
+ "icon-lg": "size-9"
40
+ }
41
+ },
42
+ defaultVariants: {
43
+ variant: "default",
44
+ size: "default"
45
+ }
46
+ }
47
+ );
48
+ function Button({
49
+ className,
50
+ variant = "default",
51
+ size = "default",
52
+ asChild = false,
53
+ ...props
54
+ }) {
55
+ const Comp = asChild ? Slot.Root : "button";
56
+ return /* @__PURE__ */ jsx(
57
+ Comp,
58
+ {
59
+ "data-slot": "button",
60
+ "data-variant": variant,
61
+ "data-size": size,
62
+ className: cn(buttonVariants({ variant, size, className })),
63
+ ...props
64
+ }
65
+ );
66
+ }
67
+
68
+ // src/components/ui/calendar.tsx
69
+ import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react";
70
+ import { jsx as jsx2 } from "react/jsx-runtime";
71
+ function Calendar({
72
+ className,
73
+ classNames,
74
+ showOutsideDays = true,
75
+ captionLayout = "label",
76
+ buttonVariant = "ghost",
77
+ locale,
78
+ formatters,
79
+ components,
80
+ ...props
81
+ }) {
82
+ const defaultClassNames = getDefaultClassNames();
83
+ return /* @__PURE__ */ jsx2(
84
+ DayPicker,
85
+ {
86
+ showOutsideDays,
87
+ className: cn2(
88
+ "group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
89
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
90
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
91
+ className
92
+ ),
93
+ captionLayout,
94
+ locale,
95
+ formatters: {
96
+ formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
97
+ ...formatters
98
+ },
99
+ classNames: {
100
+ root: cn2("w-fit", defaultClassNames.root),
101
+ months: cn2(
102
+ "relative flex flex-col gap-4 md:flex-row",
103
+ defaultClassNames.months
104
+ ),
105
+ month: cn2("flex w-full flex-col gap-4", defaultClassNames.month),
106
+ nav: cn2(
107
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
108
+ defaultClassNames.nav
109
+ ),
110
+ button_previous: cn2(
111
+ buttonVariants({ variant: buttonVariant }),
112
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
113
+ defaultClassNames.button_previous
114
+ ),
115
+ button_next: cn2(
116
+ buttonVariants({ variant: buttonVariant }),
117
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
118
+ defaultClassNames.button_next
119
+ ),
120
+ month_caption: cn2(
121
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
122
+ defaultClassNames.month_caption
123
+ ),
124
+ dropdowns: cn2(
125
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
126
+ defaultClassNames.dropdowns
127
+ ),
128
+ dropdown_root: cn2(
129
+ "relative rounded-(--cell-radius)",
130
+ defaultClassNames.dropdown_root
131
+ ),
132
+ dropdown: cn2(
133
+ "absolute inset-0 bg-popover opacity-0",
134
+ defaultClassNames.dropdown
135
+ ),
136
+ caption_label: cn2(
137
+ "font-medium select-none",
138
+ captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
139
+ defaultClassNames.caption_label
140
+ ),
141
+ month_grid: cn2("w-full border-collapse", defaultClassNames.month_grid),
142
+ weekdays: cn2("flex", defaultClassNames.weekdays),
143
+ weekday: cn2(
144
+ "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
145
+ defaultClassNames.weekday
146
+ ),
147
+ week: cn2("mt-2 flex w-full", defaultClassNames.week),
148
+ week_number_header: cn2(
149
+ "w-(--cell-size) select-none",
150
+ defaultClassNames.week_number_header
151
+ ),
152
+ week_number: cn2(
153
+ "text-[0.8rem] text-muted-foreground select-none",
154
+ defaultClassNames.week_number
155
+ ),
156
+ day: cn2(
157
+ "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
158
+ props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
159
+ defaultClassNames.day
160
+ ),
161
+ range_start: cn2(
162
+ "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
163
+ defaultClassNames.range_start
164
+ ),
165
+ range_middle: cn2("rounded-none", defaultClassNames.range_middle),
166
+ range_end: cn2(
167
+ "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
168
+ defaultClassNames.range_end
169
+ ),
170
+ today: cn2(
171
+ "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
172
+ defaultClassNames.today
173
+ ),
174
+ outside: cn2(
175
+ "text-muted-foreground aria-selected:text-muted-foreground",
176
+ defaultClassNames.outside
177
+ ),
178
+ disabled: cn2(
179
+ "text-muted-foreground opacity-50",
180
+ defaultClassNames.disabled
181
+ ),
182
+ hidden: cn2("invisible", defaultClassNames.hidden),
183
+ ...classNames
184
+ },
185
+ components: {
186
+ Root: ({ className: className2, rootRef, ...props2 }) => {
187
+ return /* @__PURE__ */ jsx2(
188
+ "div",
189
+ {
190
+ "data-slot": "calendar",
191
+ ref: rootRef,
192
+ className: cn2(className2),
193
+ ...props2
194
+ }
195
+ );
196
+ },
197
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
198
+ if (orientation === "left") {
199
+ return /* @__PURE__ */ jsx2(ChevronLeftIcon, { className: cn2("size-4", className2), ...props2 });
200
+ }
201
+ if (orientation === "right") {
202
+ return /* @__PURE__ */ jsx2(ChevronRightIcon, { className: cn2("size-4", className2), ...props2 });
203
+ }
204
+ return /* @__PURE__ */ jsx2(ChevronDownIcon, { className: cn2("size-4", className2), ...props2 });
205
+ },
206
+ DayButton: ({ ...props2 }) => /* @__PURE__ */ jsx2(CalendarDayButton, { locale, ...props2 }),
207
+ WeekNumber: ({ children, ...props2 }) => {
208
+ return /* @__PURE__ */ jsx2("td", { ...props2, children: /* @__PURE__ */ jsx2("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
209
+ },
210
+ ...components
211
+ },
212
+ ...props
213
+ }
214
+ );
215
+ }
216
+ function CalendarDayButton({
217
+ className,
218
+ day,
219
+ modifiers,
220
+ locale,
221
+ ...props
222
+ }) {
223
+ const defaultClassNames = getDefaultClassNames();
224
+ const ref = React.useRef(null);
225
+ React.useEffect(() => {
226
+ if (modifiers.focused) ref.current?.focus();
227
+ }, [modifiers.focused]);
228
+ return /* @__PURE__ */ jsx2(
229
+ Button,
230
+ {
231
+ ref,
232
+ variant: "ghost",
233
+ size: "icon",
234
+ "data-day": day.date.toLocaleDateString(locale?.code),
235
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
236
+ "data-range-start": modifiers.range_start,
237
+ "data-range-end": modifiers.range_end,
238
+ "data-range-middle": modifiers.range_middle,
239
+ className: cn2(
240
+ "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
241
+ defaultClassNames.day,
242
+ className
243
+ ),
244
+ ...props
245
+ }
246
+ );
247
+ }
248
+
249
+ // src/components/ui/popover.tsx
250
+ import { cn as cn3 } from "cn";
251
+ import { Popover as PopoverPrimitive } from "radix-ui";
252
+ import { jsx as jsx3 } from "react/jsx-runtime";
253
+ function Popover({
254
+ ...props
255
+ }) {
256
+ return /* @__PURE__ */ jsx3(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
257
+ }
258
+ function PopoverTrigger({
259
+ ...props
260
+ }) {
261
+ return /* @__PURE__ */ jsx3(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
262
+ }
263
+ function PopoverContent({
264
+ className,
265
+ align = "center",
266
+ sideOffset = 4,
267
+ ...props
268
+ }) {
269
+ return /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
270
+ PopoverPrimitive.Content,
271
+ {
272
+ "data-slot": "popover-content",
273
+ align,
274
+ sideOffset,
275
+ className: cn3(
276
+ "z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
277
+ className
278
+ ),
279
+ ...props
280
+ }
281
+ ) });
282
+ }
283
+
284
+ // src/components/datePicker/DatePicker.tsx
285
+ import { format } from "date-fns";
286
+ import { useState } from "react";
287
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
288
+ var DatePicker = ({ onSelect, date }) => {
289
+ const [isOpen, setIsOpen] = useState(false);
290
+ const handleSelect = (selectedDate) => {
291
+ onSelect(selectedDate);
292
+ setIsOpen(false);
293
+ };
294
+ return (
295
+ // Modal so the calendar re-enables pointer events for itself. Inside a vaul
296
+ // drawer the popover is portaled outside the drawer, and vaul bundles its
297
+ // own copy of Radix's layer package, so a non-modal popover inherits the
298
+ // drawer's pointer-events: none and its day buttons never receive clicks.
299
+ /* @__PURE__ */ jsxs(Popover, { modal: true, open: isOpen, onOpenChange: setIsOpen, children: [
300
+ /* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
301
+ Button,
302
+ {
303
+ variant: "outline",
304
+ "data-empty": !date,
305
+ className: "w-full justify-between text-left font-normal data-[empty=true]:text-muted-foreground",
306
+ children: [
307
+ date ? format(date, "PPP") : /* @__PURE__ */ jsx4("span", { children: "Pick a date" }),
308
+ /* @__PURE__ */ jsx4(ChevronDownIcon2, { "data-icon": "inline-end" })
309
+ ]
310
+ }
311
+ ) }),
312
+ /* @__PURE__ */ jsx4(
313
+ PopoverContent,
314
+ {
315
+ className: "w-[--radix-popover-trigger-width] p-0",
316
+ align: "start",
317
+ children: /* @__PURE__ */ jsx4(
318
+ Calendar,
319
+ {
320
+ classNames: { root: "w-full" },
321
+ mode: "single",
322
+ required: true,
323
+ selected: date ?? /* @__PURE__ */ new Date(),
324
+ onSelect: handleSelect,
325
+ defaultMonth: date ?? /* @__PURE__ */ new Date()
326
+ }
327
+ )
328
+ }
329
+ )
330
+ ] })
331
+ );
332
+ };
333
+ export {
334
+ DatePicker
335
+ };
@@ -0,0 +1,145 @@
1
+ @source "./";
2
+
3
+ /*
4
+ * Theme tokens and variants the components need. Shipped to apps as
5
+ * @processdynamics/components/styles.css. The two data-* variants are copied from
6
+ * shadcn/tailwind.css so using apps don't have to install the shadcn package.
7
+ * A future shadcn component may need more of its variants copied here.
8
+ */
9
+ @custom-variant dark (&:is(.dark *));
10
+
11
+ @custom-variant data-open {
12
+ &:where([data-state="open"]),
13
+ &:where([data-open]:not([data-open="false"])) {
14
+ @slot;
15
+ }
16
+ }
17
+
18
+ @custom-variant data-closed {
19
+ &:where([data-state="closed"]),
20
+ &:where([data-closed]:not([data-closed="false"])) {
21
+ @slot;
22
+ }
23
+ }
24
+
25
+ @theme inline {
26
+ --color-sidebar-ring: var(--sidebar-ring);
27
+ --color-sidebar-border: var(--sidebar-border);
28
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
29
+ --color-sidebar-accent: var(--sidebar-accent);
30
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
31
+ --color-sidebar-primary: var(--sidebar-primary);
32
+ --color-sidebar-foreground: var(--sidebar-foreground);
33
+ --color-sidebar: var(--sidebar);
34
+ --color-chart-5: var(--chart-5);
35
+ --color-chart-4: var(--chart-4);
36
+ --color-chart-3: var(--chart-3);
37
+ --color-chart-2: var(--chart-2);
38
+ --color-chart-1: var(--chart-1);
39
+ --color-ring: var(--ring);
40
+ --color-input: var(--input);
41
+ --color-border: var(--border);
42
+ --color-destructive: var(--destructive);
43
+ --color-accent-foreground: var(--accent-foreground);
44
+ --color-accent: var(--accent);
45
+ --color-muted-foreground: var(--muted-foreground);
46
+ --color-muted: var(--muted);
47
+ --color-secondary-foreground: var(--secondary-foreground);
48
+ --color-secondary: var(--secondary);
49
+ --color-primary-foreground: var(--primary-foreground);
50
+ --color-primary: var(--primary);
51
+ --color-popover-foreground: var(--popover-foreground);
52
+ --color-popover: var(--popover);
53
+ --color-card-foreground: var(--card-foreground);
54
+ --color-card: var(--card);
55
+ --color-foreground: var(--foreground);
56
+ --color-background: var(--background);
57
+ --radius-sm: calc(var(--radius) * 0.6);
58
+ --radius-md: calc(var(--radius) * 0.8);
59
+ --radius-lg: var(--radius);
60
+ --radius-xl: calc(var(--radius) * 1.4);
61
+ --radius-2xl: calc(var(--radius) * 1.8);
62
+ --radius-3xl: calc(var(--radius) * 2.2);
63
+ --radius-4xl: calc(var(--radius) * 2.6);
64
+ }
65
+
66
+ :root {
67
+ --card: oklch(1 0 0);
68
+ --card-foreground: oklch(0.145 0 0);
69
+ --popover: oklch(1 0 0);
70
+ --popover-foreground: oklch(0.145 0 0);
71
+ --primary: oklch(0.205 0 0);
72
+ --primary-foreground: oklch(0.985 0 0);
73
+ --secondary: oklch(0.97 0 0);
74
+ --secondary-foreground: oklch(0.205 0 0);
75
+ --muted: oklch(0.97 0 0);
76
+ --muted-foreground: oklch(0.556 0 0);
77
+ --accent: oklch(0.97 0 0);
78
+ --accent-foreground: oklch(0.205 0 0);
79
+ --destructive: oklch(0.577 0.245 27.325);
80
+ --border: oklch(0.922 0 0);
81
+ --input: oklch(0.922 0 0);
82
+ --ring: oklch(0.708 0 0);
83
+ --chart-1: oklch(0.87 0 0);
84
+ --chart-2: oklch(0.556 0 0);
85
+ --chart-3: oklch(0.439 0 0);
86
+ --chart-4: oklch(0.371 0 0);
87
+ --chart-5: oklch(0.269 0 0);
88
+ --radius: 0.625rem;
89
+ --sidebar: oklch(0.985 0 0);
90
+ --sidebar-foreground: oklch(0.145 0 0);
91
+ --sidebar-primary: oklch(0.205 0 0);
92
+ --sidebar-primary-foreground: oklch(0.985 0 0);
93
+ --sidebar-accent: oklch(0.97 0 0);
94
+ --sidebar-accent-foreground: oklch(0.205 0 0);
95
+ --sidebar-border: oklch(0.922 0 0);
96
+ --sidebar-ring: oklch(0.708 0 0);
97
+ --background: oklch(1 0 0);
98
+ --foreground: oklch(0.145 0 0);
99
+ }
100
+
101
+ .dark {
102
+ --background: oklch(0.145 0 0);
103
+ --foreground: oklch(0.985 0 0);
104
+ --card: oklch(0.205 0 0);
105
+ --card-foreground: oklch(0.985 0 0);
106
+ --popover: oklch(0.205 0 0);
107
+ --popover-foreground: oklch(0.985 0 0);
108
+ --primary: oklch(0.922 0 0);
109
+ --primary-foreground: oklch(0.205 0 0);
110
+ --secondary: oklch(0.269 0 0);
111
+ --secondary-foreground: oklch(0.985 0 0);
112
+ --muted: oklch(0.269 0 0);
113
+ --muted-foreground: oklch(0.708 0 0);
114
+ --accent: oklch(0.269 0 0);
115
+ --accent-foreground: oklch(0.985 0 0);
116
+ --destructive: oklch(0.704 0.191 22.216);
117
+ --border: oklch(1 0 0 / 10%);
118
+ --input: oklch(1 0 0 / 15%);
119
+ --ring: oklch(0.556 0 0);
120
+ --chart-1: oklch(0.87 0 0);
121
+ --chart-2: oklch(0.556 0 0);
122
+ --chart-3: oklch(0.439 0 0);
123
+ --chart-4: oklch(0.371 0 0);
124
+ --chart-5: oklch(0.269 0 0);
125
+ --sidebar: oklch(0.205 0 0);
126
+ --sidebar-foreground: oklch(0.985 0 0);
127
+ --sidebar-primary: oklch(0.488 0.243 264.376);
128
+ --sidebar-primary-foreground: oklch(0.985 0 0);
129
+ --sidebar-accent: oklch(0.269 0 0);
130
+ --sidebar-accent-foreground: oklch(0.985 0 0);
131
+ --sidebar-border: oklch(1 0 0 / 10%);
132
+ --sidebar-ring: oklch(0.556 0 0);
133
+ }
134
+
135
+ @layer base {
136
+ * {
137
+ @apply border-border outline-ring/50;
138
+ }
139
+ body {
140
+ @apply bg-background text-foreground;
141
+ }
142
+ html {
143
+ @apply font-sans;
144
+ }
145
+ }
package/package.json CHANGED
@@ -1,6 +1,101 @@
1
1
  {
2
2
  "name": "@processdynamics/components",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Process Dynamics React component library, built on shadcn (Radix) and Tailwind CSS v4.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/IncredibleMrTim/pd-design-system.git"
9
+ },
10
+ "sideEffects": false,
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./styles.css": "./dist/styles.css",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "dev": "next dev",
37
+ "build": "pnpm build:storybook-site && next build",
38
+ "start": "next start",
39
+ "lint": "eslint",
40
+ "storybook": "storybook dev -p 6006",
41
+ "build-storybook": "storybook build",
42
+ "build:storybook-site": "rm -rf public/storybook && storybook build -o storybook-static && mv storybook-static public/storybook",
43
+ "build:lib": "tsup && node scripts/buildStyles.mjs",
44
+ "version:sync": "node scripts/version.mjs sync",
45
+ "version:check": "node scripts/version.mjs check",
46
+ "release:guard": "node scripts/checkReleaseBranch.mjs",
47
+ "release:check": "pnpm exec tsc --noEmit && pnpm lint && pnpm exec vitest run && npm whoami",
48
+ "release:dry": "pnpm release:check && pnpm publish --dry-run",
49
+ "release": "pnpm release:guard && pnpm release:check && pnpm publish",
50
+ "prepublishOnly": "pnpm build:lib",
51
+ "prepare": "husky || true"
52
+ },
53
+ "devDependencies": {
54
+ "@chromatic-com/storybook": "latest",
55
+ "@storybook/addon-a11y": "^10.6.5",
56
+ "@storybook/addon-docs": "^10.6.5",
57
+ "@storybook/addon-mcp": "^10.6.5",
58
+ "@storybook/addon-vitest": "^10.6.5",
59
+ "@storybook/nextjs-vite": "^10.6.5",
60
+ "@tailwindcss/turbopack": "^4",
61
+ "@tailwindcss/vite": "^4.3.3",
62
+ "@types/node": "^20",
63
+ "@types/react": "^19",
64
+ "@types/react-dom": "^19",
65
+ "@vitest/browser-playwright": "^4",
66
+ "@vitest/coverage-v8": "^4",
67
+ "class-variance-authority": "^0.7.1",
68
+ "cn": "^0.5.2",
69
+ "date-fns": "^4.4.0",
70
+ "eslint": "^9",
71
+ "eslint-config-next": "16.4.3",
72
+ "eslint-plugin-storybook": "^10.6.5",
73
+ "husky": "^9.1.7",
74
+ "lucide-react": "^1.66.0",
75
+ "next": "16.4.3",
76
+ "playwright": "latest",
77
+ "radix-ui": "^1.8.1",
78
+ "react": "19.3.0",
79
+ "react-day-picker": "^10.0.2",
80
+ "react-dom": "19.3.0",
81
+ "shadcn": "^4.23.0",
82
+ "storybook": "^10.6.5",
83
+ "tailwindcss": "^4",
84
+ "tsup": "^9.0.0",
85
+ "tw-animate-css": "^1.4.0",
86
+ "typescript": "^5",
87
+ "vite": "latest",
88
+ "vitest": "^4"
89
+ },
90
+ "packageManager": "pnpm@10.6.5",
91
+ "peerDependencies": {
92
+ "class-variance-authority": "^0.7.1",
93
+ "cn": "^0.5.2",
94
+ "date-fns": "^4.4.0",
95
+ "lucide-react": "^1.66.0",
96
+ "radix-ui": "^1.8.1",
97
+ "react": "^19.0.0",
98
+ "react-day-picker": "^10.0.2",
99
+ "react-dom": "^19.0.0"
100
+ }
101
+ }