@morze/ui 0.2.11 → 0.3.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.
@@ -0,0 +1,164 @@
1
+ import * as React from 'react';
2
+
3
+ type DateRange = {
4
+ from: Date | undefined;
5
+ to?: Date | undefined;
6
+ };
7
+ /**
8
+ * Which days a rule applies to. The shapes are the ones a form actually
9
+ * expresses: one day, a list, a closed span, an open-ended bound, or a
10
+ * predicate for everything else ("no weekends", "only in stock").
11
+ */
12
+ type DateMatcher = Date | Date[] | {
13
+ from: Date;
14
+ to: Date;
15
+ } | {
16
+ before?: Date;
17
+ after?: Date;
18
+ } | ((date: Date) => boolean);
19
+ type CalendarLabels = {
20
+ previousMonth: string;
21
+ nextMonth: string;
22
+ month: string;
23
+ year: string;
24
+ weekNumber: string;
25
+ };
26
+ type CalendarBaseProps = {
27
+ /** Controlled leading month. Pair with `onMonthChange`. */
28
+ month?: Date;
29
+ defaultMonth?: Date;
30
+ onMonthChange?: (month: Date) => void;
31
+ /** How many months to draw side by side. */
32
+ numberOfMonths?: number;
33
+ /** BCP 47 tag for month, weekday and day names. Defaults to the browser's. */
34
+ locale?: string;
35
+ /** 0 (Sunday) to 6. Defaults to what the locale says. */
36
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
37
+ disabled?: DateMatcher;
38
+ /** Nothing before this day can be picked or paged to. */
39
+ fromDate?: Date;
40
+ /** Nothing after this day can be picked or paged to. */
41
+ toDate?: Date;
42
+ /** Draws the days that spill in from the neighbouring months. */
43
+ showOutsideDays?: boolean;
44
+ showWeekNumbers?: boolean;
45
+ /** A static caption, or month and year as selects. */
46
+ captionLayout?: 'label' | 'dropdown';
47
+ /** Year range for the dropdown caption. Defaults to ±10 years. */
48
+ fromYear?: number;
49
+ toYear?: number;
50
+ /** Which day gets the "today" ring. Injectable so tests are not clock-bound. */
51
+ today?: Date;
52
+ labels?: Partial<CalendarLabels>;
53
+ className?: string;
54
+ id?: string;
55
+ };
56
+ type SingleProps = {
57
+ mode?: 'single';
58
+ selected?: Date;
59
+ /** Clicking the selected day clears it, unless `required`. */
60
+ onSelect?: (date: Date | undefined) => void;
61
+ required?: boolean;
62
+ };
63
+ type MultipleProps = {
64
+ mode: 'multiple';
65
+ selected?: Date[];
66
+ onSelect?: (dates: Date[]) => void;
67
+ };
68
+ type RangeProps = {
69
+ mode: 'range';
70
+ selected?: DateRange;
71
+ onSelect?: (range: DateRange | undefined) => void;
72
+ };
73
+ type CalendarProps = CalendarBaseProps & (SingleProps | MultipleProps | RangeProps);
74
+ /**
75
+ * A month grid, with no date library behind it.
76
+ *
77
+ * Names come from `Intl`, so a locale tag is the whole of the localisation
78
+ * story — there is no bundle of month names to import and nothing to keep in
79
+ * sync. Six week rows are always drawn, so paging does not resize the popover
80
+ * the calendar usually sits in.
81
+ *
82
+ * <Calendar mode="range" selected={range} onSelect={setRange} numberOfMonths={2} />
83
+ */
84
+ declare function Calendar({ month: monthProp, defaultMonth, onMonthChange, numberOfMonths, locale, weekStartsOn, disabled, fromDate, toDate, showOutsideDays, showWeekNumbers, captionLayout, fromYear, toYear, today: todayProp, labels: labelsProp, className, id, ...selection }: CalendarProps): React.JSX.Element;
85
+
86
+ /**
87
+ * Every visible string the table owns, in one place. Defaults are English;
88
+ * pass a partial `labels` object to translate or reword any of them.
89
+ */
90
+ type DataTableLabels = {
91
+ filter: string;
92
+ filterFor: (column: string) => string;
93
+ filterActive: string;
94
+ contains: string;
95
+ apply: string;
96
+ reset: string;
97
+ resetAll: string;
98
+ resetFilters: string;
99
+ clearFilter: string;
100
+ rangeFrom: string;
101
+ rangeTo: string;
102
+ dateFrom: string;
103
+ dateTo: string;
104
+ yes: string;
105
+ no: string;
106
+ columns: string;
107
+ moveUp: (column: string) => string;
108
+ moveDown: (column: string) => string;
109
+ pinning: (column: string, side: string) => string;
110
+ pinnedLeft: string;
111
+ pinnedRight: string;
112
+ notPinned: string;
113
+ show: (column: string) => string;
114
+ hide: (column: string) => string;
115
+ sortBy: (column: string) => string;
116
+ columnWidth: (column: string) => string;
117
+ selectPage: string;
118
+ selectRow: string;
119
+ expandRow: string;
120
+ collapseRow: string;
121
+ details: string;
122
+ empty: string;
123
+ retry: string;
124
+ rowsPerPage: string;
125
+ nothingFound: string;
126
+ of: string;
127
+ firstPage: string;
128
+ previousPage: string;
129
+ nextPage: string;
130
+ lastPage: string;
131
+ loadMore: string;
132
+ loadingMore: string;
133
+ selectedCount: (count: string) => string;
134
+ allMatchingSuffix: string;
135
+ selectAllMatching: (total: string) => string;
136
+ clearSelection: string;
137
+ bulkActions: string;
138
+ };
139
+ declare const defaultDataTableLabels: DataTableLabels;
140
+ declare function resolveLabels(labels?: Partial<DataTableLabels>): DataTableLabels;
141
+
142
+ /**
143
+ * Strings the rest of the kit takes as individual props: `Dialog`/`Sheet`
144
+ * `closeLabel`, `Spinner` `label`, `Sidebar` `mobileTitle` /
145
+ * `mobileDescription`, `SidebarTrigger` `label`, `Toaster` `closeLabel`,
146
+ * `BreadcrumbEllipsis` `label`, `TabsList` `overflowLabel`.
147
+ */
148
+ type MorzeCommonLabels = {
149
+ close: string;
150
+ loading: string;
151
+ /** What is behind a collapse: the breadcrumb ellipsis, the tab overflow. */
152
+ more: string;
153
+ sidebarNavigation: string;
154
+ sidebarSections: string;
155
+ toggleSidebar: string;
156
+ };
157
+ /** One language, complete. A missing key is a type error, not a silent drift. */
158
+ type MorzeLocale = {
159
+ dataTable: DataTableLabels;
160
+ calendar: CalendarLabels;
161
+ common: MorzeCommonLabels;
162
+ };
163
+
164
+ export { Calendar as C, type DataTableLabels as D, type MorzeCommonLabels as M, type CalendarLabels as a, type CalendarProps as b, type DateMatcher as c, type DateRange as d, type MorzeLocale as e, defaultDataTableLabels as f, resolveLabels as r };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morze/ui",
3
- "version": "0.2.11",
4
- "description": "Morze UI \u2014 React component kit built on shadcn/ui + Radix primitives with the Morze convex look.",
3
+ "version": "0.3.1",
4
+ "description": "Morze UI React component kit built on shadcn/ui + Radix primitives with the Morze convex look.",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -34,6 +34,11 @@
34
34
  "import": "./dist/index.js",
35
35
  "require": "./dist/index.cjs"
36
36
  },
37
+ "./form": {
38
+ "types": "./dist/form/index.d.ts",
39
+ "import": "./dist/form/index.js",
40
+ "require": "./dist/form/index.cjs"
41
+ },
37
42
  "./locales/en": {
38
43
  "types": "./dist/locales/en.d.ts",
39
44
  "import": "./dist/locales/en.js",
@@ -68,7 +73,8 @@
68
73
  },
69
74
  "peerDependencies": {
70
75
  "react": "^19.0.0",
71
- "react-dom": "^19.0.0"
76
+ "react-dom": "^19.0.0",
77
+ "react-hook-form": "^7.0.0"
72
78
  },
73
79
  "dependencies": {
74
80
  "class-variance-authority": "^0.7.1",
@@ -86,6 +92,7 @@
86
92
  "lightningcss": "^1.33.0",
87
93
  "react": "^19.2.8",
88
94
  "react-dom": "^19.2.8",
95
+ "react-hook-form": "^7.87.0",
89
96
  "tsup": "^8.5.1",
90
97
  "typescript": "^5.9.3",
91
98
  "vite": "^8.2.2",
@@ -96,5 +103,10 @@
96
103
  },
97
104
  "engines": {
98
105
  "node": ">=18"
106
+ },
107
+ "peerDependenciesMeta": {
108
+ "react-hook-form": {
109
+ "optional": true
110
+ }
99
111
  }
100
112
  }
@@ -1,75 +0,0 @@
1
- /**
2
- * Every visible string the table owns, in one place. Defaults are English;
3
- * pass a partial `labels` object to translate or reword any of them.
4
- */
5
- type DataTableLabels = {
6
- filter: string;
7
- filterFor: (column: string) => string;
8
- filterActive: string;
9
- contains: string;
10
- apply: string;
11
- reset: string;
12
- resetAll: string;
13
- resetFilters: string;
14
- clearFilter: string;
15
- rangeFrom: string;
16
- rangeTo: string;
17
- dateFrom: string;
18
- dateTo: string;
19
- yes: string;
20
- no: string;
21
- columns: string;
22
- moveUp: (column: string) => string;
23
- moveDown: (column: string) => string;
24
- pinning: (column: string, side: string) => string;
25
- pinnedLeft: string;
26
- pinnedRight: string;
27
- notPinned: string;
28
- show: (column: string) => string;
29
- hide: (column: string) => string;
30
- sortBy: (column: string) => string;
31
- columnWidth: (column: string) => string;
32
- selectPage: string;
33
- selectRow: string;
34
- expandRow: string;
35
- collapseRow: string;
36
- details: string;
37
- empty: string;
38
- retry: string;
39
- rowsPerPage: string;
40
- nothingFound: string;
41
- of: string;
42
- firstPage: string;
43
- previousPage: string;
44
- nextPage: string;
45
- lastPage: string;
46
- loadMore: string;
47
- loadingMore: string;
48
- selectedCount: (count: string) => string;
49
- allMatchingSuffix: string;
50
- selectAllMatching: (total: string) => string;
51
- clearSelection: string;
52
- bulkActions: string;
53
- };
54
- declare const defaultDataTableLabels: DataTableLabels;
55
- declare function resolveLabels(labels?: Partial<DataTableLabels>): DataTableLabels;
56
-
57
- /**
58
- * Strings the rest of the kit takes as individual props: `Dialog`/`Sheet`
59
- * `closeLabel`, `Spinner` `label`, `Sidebar` `mobileTitle` /
60
- * `mobileDescription`, `SidebarTrigger` `label`.
61
- */
62
- type MorzeCommonLabels = {
63
- close: string;
64
- loading: string;
65
- sidebarNavigation: string;
66
- sidebarSections: string;
67
- toggleSidebar: string;
68
- };
69
- /** One language, complete. A missing key is a type error, not a silent drift. */
70
- type MorzeLocale = {
71
- dataTable: DataTableLabels;
72
- common: MorzeCommonLabels;
73
- };
74
-
75
- export { type DataTableLabels as D, type MorzeCommonLabels as M, type MorzeLocale as a, defaultDataTableLabels as d, resolveLabels as r };
@@ -1,75 +0,0 @@
1
- /**
2
- * Every visible string the table owns, in one place. Defaults are English;
3
- * pass a partial `labels` object to translate or reword any of them.
4
- */
5
- type DataTableLabels = {
6
- filter: string;
7
- filterFor: (column: string) => string;
8
- filterActive: string;
9
- contains: string;
10
- apply: string;
11
- reset: string;
12
- resetAll: string;
13
- resetFilters: string;
14
- clearFilter: string;
15
- rangeFrom: string;
16
- rangeTo: string;
17
- dateFrom: string;
18
- dateTo: string;
19
- yes: string;
20
- no: string;
21
- columns: string;
22
- moveUp: (column: string) => string;
23
- moveDown: (column: string) => string;
24
- pinning: (column: string, side: string) => string;
25
- pinnedLeft: string;
26
- pinnedRight: string;
27
- notPinned: string;
28
- show: (column: string) => string;
29
- hide: (column: string) => string;
30
- sortBy: (column: string) => string;
31
- columnWidth: (column: string) => string;
32
- selectPage: string;
33
- selectRow: string;
34
- expandRow: string;
35
- collapseRow: string;
36
- details: string;
37
- empty: string;
38
- retry: string;
39
- rowsPerPage: string;
40
- nothingFound: string;
41
- of: string;
42
- firstPage: string;
43
- previousPage: string;
44
- nextPage: string;
45
- lastPage: string;
46
- loadMore: string;
47
- loadingMore: string;
48
- selectedCount: (count: string) => string;
49
- allMatchingSuffix: string;
50
- selectAllMatching: (total: string) => string;
51
- clearSelection: string;
52
- bulkActions: string;
53
- };
54
- declare const defaultDataTableLabels: DataTableLabels;
55
- declare function resolveLabels(labels?: Partial<DataTableLabels>): DataTableLabels;
56
-
57
- /**
58
- * Strings the rest of the kit takes as individual props: `Dialog`/`Sheet`
59
- * `closeLabel`, `Spinner` `label`, `Sidebar` `mobileTitle` /
60
- * `mobileDescription`, `SidebarTrigger` `label`.
61
- */
62
- type MorzeCommonLabels = {
63
- close: string;
64
- loading: string;
65
- sidebarNavigation: string;
66
- sidebarSections: string;
67
- toggleSidebar: string;
68
- };
69
- /** One language, complete. A missing key is a type error, not a silent drift. */
70
- type MorzeLocale = {
71
- dataTable: DataTableLabels;
72
- common: MorzeCommonLabels;
73
- };
74
-
75
- export { type DataTableLabels as D, type MorzeCommonLabels as M, type MorzeLocale as a, defaultDataTableLabels as d, resolveLabels as r };