@m3-baseui/react-tailwind 1.0.4 → 1.2.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/dist/bottom-app-bar.d.ts +62 -0
- package/dist/bottom-app-bar.js +51 -0
- package/dist/bottom-app-bar.js.map +1 -0
- package/dist/bottom-sheet.d.ts +101 -0
- package/dist/bottom-sheet.js +70 -0
- package/dist/bottom-sheet.js.map +1 -0
- package/dist/button-group.d.ts +48 -0
- package/dist/button-group.js +58 -0
- package/dist/button-group.js.map +1 -0
- package/dist/carousel.d.ts +115 -0
- package/dist/carousel.js +63 -0
- package/dist/carousel.js.map +1 -0
- package/dist/chip.js +5 -2
- package/dist/chip.js.map +1 -1
- package/dist/date-picker.d.ts +188 -0
- package/dist/date-picker.js +151 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/fab-menu.d.ts +132 -0
- package/dist/fab-menu.js +116 -0
- package/dist/fab-menu.js.map +1 -0
- package/dist/icon-button.js +4 -1
- package/dist/icon-button.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +654 -11
- package/dist/index.js.map +1 -1
- package/dist/loading-indicator.d.ts +68 -0
- package/dist/loading-indicator.js +61 -0
- package/dist/loading-indicator.js.map +1 -0
- package/dist/menu.d.ts +5 -5
- package/dist/navigation-bar.d.ts +5 -5
- package/dist/navigation-rail.d.ts +101 -0
- package/dist/navigation-rail.js +92 -0
- package/dist/navigation-rail.js.map +1 -0
- package/dist/search.d.ts +148 -0
- package/dist/search.js +105 -0
- package/dist/search.js.map +1 -0
- package/dist/segmented-button.d.ts +5 -5
- package/dist/select.d.ts +5 -5
- package/dist/side-sheet.d.ts +112 -0
- package/dist/side-sheet.js +90 -0
- package/dist/side-sheet.js.map +1 -0
- package/dist/split-button.d.ts +201 -0
- package/dist/split-button.js +126 -0
- package/dist/split-button.js.map +1 -0
- package/dist/time-picker.d.ts +144 -0
- package/dist/time-picker.js +101 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/toolbar.d.ts +73 -0
- package/dist/toolbar.js +55 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/top-app-bar.d.ts +147 -0
- package/dist/top-app-bar.js +68 -0
- package/dist/top-app-bar.js.map +1 -0
- package/package.json +71 -1
- package/styles/preset.css +15 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { createDatePicker } from '@m3-baseui/core';
|
|
4
|
+
|
|
5
|
+
declare const datePickerTv: tailwind_variants.TVReturnType<{
|
|
6
|
+
[key: string]: {
|
|
7
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
8
|
+
input?: tailwind_variants.ClassValue;
|
|
9
|
+
grid?: tailwind_variants.ClassValue;
|
|
10
|
+
popup?: tailwind_variants.ClassValue;
|
|
11
|
+
header?: tailwind_variants.ClassValue;
|
|
12
|
+
weekday?: tailwind_variants.ClassValue;
|
|
13
|
+
calendar?: tailwind_variants.ClassValue;
|
|
14
|
+
navButton?: tailwind_variants.ClassValue;
|
|
15
|
+
monthLabel?: tailwind_variants.ClassValue;
|
|
16
|
+
weekdays?: tailwind_variants.ClassValue;
|
|
17
|
+
day?: tailwind_variants.ClassValue;
|
|
18
|
+
yearGrid?: tailwind_variants.ClassValue;
|
|
19
|
+
yearButton?: tailwind_variants.ClassValue;
|
|
20
|
+
field?: tailwind_variants.ClassValue;
|
|
21
|
+
fieldIcon?: tailwind_variants.ClassValue;
|
|
22
|
+
modalBackdrop?: tailwind_variants.ClassValue;
|
|
23
|
+
modalPopup?: tailwind_variants.ClassValue;
|
|
24
|
+
modalHeader?: tailwind_variants.ClassValue;
|
|
25
|
+
modalHeadline?: tailwind_variants.ClassValue;
|
|
26
|
+
modalActions?: tailwind_variants.ClassValue;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
[x: string]: {
|
|
31
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
32
|
+
input?: tailwind_variants.ClassValue;
|
|
33
|
+
grid?: tailwind_variants.ClassValue;
|
|
34
|
+
popup?: tailwind_variants.ClassValue;
|
|
35
|
+
header?: tailwind_variants.ClassValue;
|
|
36
|
+
weekday?: tailwind_variants.ClassValue;
|
|
37
|
+
calendar?: tailwind_variants.ClassValue;
|
|
38
|
+
navButton?: tailwind_variants.ClassValue;
|
|
39
|
+
monthLabel?: tailwind_variants.ClassValue;
|
|
40
|
+
weekdays?: tailwind_variants.ClassValue;
|
|
41
|
+
day?: tailwind_variants.ClassValue;
|
|
42
|
+
yearGrid?: tailwind_variants.ClassValue;
|
|
43
|
+
yearButton?: tailwind_variants.ClassValue;
|
|
44
|
+
field?: tailwind_variants.ClassValue;
|
|
45
|
+
fieldIcon?: tailwind_variants.ClassValue;
|
|
46
|
+
modalBackdrop?: tailwind_variants.ClassValue;
|
|
47
|
+
modalPopup?: tailwind_variants.ClassValue;
|
|
48
|
+
modalHeader?: tailwind_variants.ClassValue;
|
|
49
|
+
modalHeadline?: tailwind_variants.ClassValue;
|
|
50
|
+
modalActions?: tailwind_variants.ClassValue;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} | {}, {
|
|
54
|
+
calendar: string[];
|
|
55
|
+
header: string[];
|
|
56
|
+
navButton: string[];
|
|
57
|
+
monthLabel: string[];
|
|
58
|
+
grid: string[];
|
|
59
|
+
weekdays: string[];
|
|
60
|
+
weekday: string[];
|
|
61
|
+
day: string[];
|
|
62
|
+
yearGrid: string[];
|
|
63
|
+
yearButton: string[];
|
|
64
|
+
field: string[];
|
|
65
|
+
input: string[];
|
|
66
|
+
fieldIcon: string[];
|
|
67
|
+
popup: string[];
|
|
68
|
+
modalBackdrop: string[];
|
|
69
|
+
modalPopup: string[];
|
|
70
|
+
modalHeader: string[];
|
|
71
|
+
modalHeadline: string[];
|
|
72
|
+
modalActions: string[];
|
|
73
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
74
|
+
[key: string]: {
|
|
75
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
76
|
+
input?: tailwind_variants.ClassValue;
|
|
77
|
+
grid?: tailwind_variants.ClassValue;
|
|
78
|
+
popup?: tailwind_variants.ClassValue;
|
|
79
|
+
header?: tailwind_variants.ClassValue;
|
|
80
|
+
weekday?: tailwind_variants.ClassValue;
|
|
81
|
+
calendar?: tailwind_variants.ClassValue;
|
|
82
|
+
navButton?: tailwind_variants.ClassValue;
|
|
83
|
+
monthLabel?: tailwind_variants.ClassValue;
|
|
84
|
+
weekdays?: tailwind_variants.ClassValue;
|
|
85
|
+
day?: tailwind_variants.ClassValue;
|
|
86
|
+
yearGrid?: tailwind_variants.ClassValue;
|
|
87
|
+
yearButton?: tailwind_variants.ClassValue;
|
|
88
|
+
field?: tailwind_variants.ClassValue;
|
|
89
|
+
fieldIcon?: tailwind_variants.ClassValue;
|
|
90
|
+
modalBackdrop?: tailwind_variants.ClassValue;
|
|
91
|
+
modalPopup?: tailwind_variants.ClassValue;
|
|
92
|
+
modalHeader?: tailwind_variants.ClassValue;
|
|
93
|
+
modalHeadline?: tailwind_variants.ClassValue;
|
|
94
|
+
modalActions?: tailwind_variants.ClassValue;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
} | {}>, {
|
|
98
|
+
[key: string]: {
|
|
99
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
100
|
+
input?: tailwind_variants.ClassValue;
|
|
101
|
+
grid?: tailwind_variants.ClassValue;
|
|
102
|
+
popup?: tailwind_variants.ClassValue;
|
|
103
|
+
header?: tailwind_variants.ClassValue;
|
|
104
|
+
weekday?: tailwind_variants.ClassValue;
|
|
105
|
+
calendar?: tailwind_variants.ClassValue;
|
|
106
|
+
navButton?: tailwind_variants.ClassValue;
|
|
107
|
+
monthLabel?: tailwind_variants.ClassValue;
|
|
108
|
+
weekdays?: tailwind_variants.ClassValue;
|
|
109
|
+
day?: tailwind_variants.ClassValue;
|
|
110
|
+
yearGrid?: tailwind_variants.ClassValue;
|
|
111
|
+
yearButton?: tailwind_variants.ClassValue;
|
|
112
|
+
field?: tailwind_variants.ClassValue;
|
|
113
|
+
fieldIcon?: tailwind_variants.ClassValue;
|
|
114
|
+
modalBackdrop?: tailwind_variants.ClassValue;
|
|
115
|
+
modalPopup?: tailwind_variants.ClassValue;
|
|
116
|
+
modalHeader?: tailwind_variants.ClassValue;
|
|
117
|
+
modalHeadline?: tailwind_variants.ClassValue;
|
|
118
|
+
modalActions?: tailwind_variants.ClassValue;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
} | {}, {
|
|
122
|
+
calendar: string[];
|
|
123
|
+
header: string[];
|
|
124
|
+
navButton: string[];
|
|
125
|
+
monthLabel: string[];
|
|
126
|
+
grid: string[];
|
|
127
|
+
weekdays: string[];
|
|
128
|
+
weekday: string[];
|
|
129
|
+
day: string[];
|
|
130
|
+
yearGrid: string[];
|
|
131
|
+
yearButton: string[];
|
|
132
|
+
field: string[];
|
|
133
|
+
input: string[];
|
|
134
|
+
fieldIcon: string[];
|
|
135
|
+
popup: string[];
|
|
136
|
+
modalBackdrop: string[];
|
|
137
|
+
modalPopup: string[];
|
|
138
|
+
modalHeader: string[];
|
|
139
|
+
modalHeadline: string[];
|
|
140
|
+
modalActions: string[];
|
|
141
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
142
|
+
calendar: string[];
|
|
143
|
+
header: string[];
|
|
144
|
+
navButton: string[];
|
|
145
|
+
monthLabel: string[];
|
|
146
|
+
grid: string[];
|
|
147
|
+
weekdays: string[];
|
|
148
|
+
weekday: string[];
|
|
149
|
+
day: string[];
|
|
150
|
+
yearGrid: string[];
|
|
151
|
+
yearButton: string[];
|
|
152
|
+
field: string[];
|
|
153
|
+
input: string[];
|
|
154
|
+
fieldIcon: string[];
|
|
155
|
+
popup: string[];
|
|
156
|
+
modalBackdrop: string[];
|
|
157
|
+
modalPopup: string[];
|
|
158
|
+
modalHeader: string[];
|
|
159
|
+
modalHeadline: string[];
|
|
160
|
+
modalActions: string[];
|
|
161
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
162
|
+
[key: string]: {
|
|
163
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
164
|
+
input?: tailwind_variants.ClassValue;
|
|
165
|
+
grid?: tailwind_variants.ClassValue;
|
|
166
|
+
popup?: tailwind_variants.ClassValue;
|
|
167
|
+
header?: tailwind_variants.ClassValue;
|
|
168
|
+
weekday?: tailwind_variants.ClassValue;
|
|
169
|
+
calendar?: tailwind_variants.ClassValue;
|
|
170
|
+
navButton?: tailwind_variants.ClassValue;
|
|
171
|
+
monthLabel?: tailwind_variants.ClassValue;
|
|
172
|
+
weekdays?: tailwind_variants.ClassValue;
|
|
173
|
+
day?: tailwind_variants.ClassValue;
|
|
174
|
+
yearGrid?: tailwind_variants.ClassValue;
|
|
175
|
+
yearButton?: tailwind_variants.ClassValue;
|
|
176
|
+
field?: tailwind_variants.ClassValue;
|
|
177
|
+
fieldIcon?: tailwind_variants.ClassValue;
|
|
178
|
+
modalBackdrop?: tailwind_variants.ClassValue;
|
|
179
|
+
modalPopup?: tailwind_variants.ClassValue;
|
|
180
|
+
modalHeader?: tailwind_variants.ClassValue;
|
|
181
|
+
modalHeadline?: tailwind_variants.ClassValue;
|
|
182
|
+
modalActions?: tailwind_variants.ClassValue;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
} | {}>, unknown, unknown, undefined>>;
|
|
186
|
+
declare const DatePicker: ReturnType<typeof createDatePicker>;
|
|
187
|
+
|
|
188
|
+
export { DatePicker, datePickerTv };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createDatePicker } from '@m3-baseui/core';
|
|
3
|
+
import { tv as tv$1 } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
// src/date-picker.ts
|
|
6
|
+
var TYPESCALE = [
|
|
7
|
+
"display-large",
|
|
8
|
+
"display-medium",
|
|
9
|
+
"display-small",
|
|
10
|
+
"headline-large",
|
|
11
|
+
"headline-medium",
|
|
12
|
+
"headline-small",
|
|
13
|
+
"title-large",
|
|
14
|
+
"title-medium",
|
|
15
|
+
"title-small",
|
|
16
|
+
"body-large",
|
|
17
|
+
"body-medium",
|
|
18
|
+
"body-small",
|
|
19
|
+
"label-large",
|
|
20
|
+
"label-medium",
|
|
21
|
+
"label-small"
|
|
22
|
+
];
|
|
23
|
+
var tv = (options, config) => tv$1(options, {
|
|
24
|
+
...config,
|
|
25
|
+
twMergeConfig: {
|
|
26
|
+
extend: {
|
|
27
|
+
classGroups: {
|
|
28
|
+
"font-size": [{ text: [...TYPESCALE] }]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// src/date-picker.ts
|
|
35
|
+
var datePickerTv = tv({
|
|
36
|
+
slots: {
|
|
37
|
+
calendar: ["w-[328px] max-w-full p-3 text-on-surface"],
|
|
38
|
+
header: ["flex items-center justify-between gap-2 h-12 pl-3 pr-1"],
|
|
39
|
+
navButton: [
|
|
40
|
+
"relative inline-flex items-center justify-center size-10 rounded-full overflow-hidden",
|
|
41
|
+
"text-on-surface-variant cursor-pointer outline-none [&>svg]:size-6",
|
|
42
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
43
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
44
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
45
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]",
|
|
46
|
+
"disabled:text-on-surface/[0.38] disabled:before:opacity-0 disabled:pointer-events-none"
|
|
47
|
+
],
|
|
48
|
+
monthLabel: [
|
|
49
|
+
"relative inline-flex items-center gap-1 h-9 px-3 rounded-full overflow-hidden",
|
|
50
|
+
"text-label-large text-on-surface-variant cursor-pointer outline-none",
|
|
51
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
52
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
53
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
54
|
+
"[&>svg]:transition-transform data-[view=years]:[&>svg]:rotate-180"
|
|
55
|
+
],
|
|
56
|
+
grid: ["mt-2 border-collapse", "[&_td]:p-0 [&_td]:text-center"],
|
|
57
|
+
weekdays: [""],
|
|
58
|
+
weekday: ["size-12 font-normal text-body-large text-on-surface-variant"],
|
|
59
|
+
day: [
|
|
60
|
+
"relative inline-flex items-center justify-center size-12 rounded-full overflow-hidden",
|
|
61
|
+
"text-body-large text-on-surface cursor-pointer outline-none",
|
|
62
|
+
"before:absolute before:inset-0 before:rounded-full before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
63
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
64
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
65
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]",
|
|
66
|
+
// today: 1px primary outline ring
|
|
67
|
+
"data-[today]:ring-1 data-[today]:ring-inset data-[today]:ring-primary",
|
|
68
|
+
// selected: primary fill, on-primary label, no state layer tint shift
|
|
69
|
+
"data-[selected]:bg-primary data-[selected]:text-on-primary",
|
|
70
|
+
"data-[disabled]:text-on-surface/[0.38] data-[disabled]:before:opacity-0 data-[disabled]:pointer-events-none"
|
|
71
|
+
],
|
|
72
|
+
// weeks render as 7-col rows; force grid layout on each row
|
|
73
|
+
yearGrid: ["grid grid-cols-3 gap-2 max-h-[280px] overflow-y-auto px-3 py-2"],
|
|
74
|
+
yearButton: [
|
|
75
|
+
"relative inline-flex items-center justify-center h-9 rounded-full overflow-hidden",
|
|
76
|
+
"text-label-large text-on-surface-variant cursor-pointer outline-none",
|
|
77
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
78
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
79
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
80
|
+
"data-[selected]:bg-primary data-[selected]:text-on-primary"
|
|
81
|
+
],
|
|
82
|
+
field: [
|
|
83
|
+
"inline-flex items-center gap-1 h-14 pl-4 pr-1 min-w-[200px]",
|
|
84
|
+
"bg-surface-container-highest text-on-surface rounded-t-extra-small",
|
|
85
|
+
"border-b border-on-surface-variant"
|
|
86
|
+
],
|
|
87
|
+
input: [
|
|
88
|
+
"flex-1 min-w-0 h-full bg-transparent border-0 outline-none",
|
|
89
|
+
"text-body-large text-on-surface placeholder:text-on-surface-variant"
|
|
90
|
+
],
|
|
91
|
+
fieldIcon: [
|
|
92
|
+
"relative inline-flex items-center justify-center size-10 rounded-full overflow-hidden",
|
|
93
|
+
"text-on-surface-variant cursor-pointer outline-none [&>svg]:size-6",
|
|
94
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
95
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
96
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
97
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]"
|
|
98
|
+
],
|
|
99
|
+
popup: [
|
|
100
|
+
"bg-surface-container-high text-on-surface rounded-large shadow-level2",
|
|
101
|
+
"origin-[var(--transform-origin)] transition-[opacity,transform] duration-150 ease-standard",
|
|
102
|
+
"data-[starting-style]:opacity-0 data-[starting-style]:scale-95",
|
|
103
|
+
"data-[ending-style]:opacity-0",
|
|
104
|
+
"focus:outline-none"
|
|
105
|
+
],
|
|
106
|
+
modalBackdrop: [
|
|
107
|
+
"fixed inset-0 z-40 bg-scrim/32",
|
|
108
|
+
"transition-opacity duration-200 ease-standard",
|
|
109
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"
|
|
110
|
+
],
|
|
111
|
+
modalPopup: [
|
|
112
|
+
"fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2",
|
|
113
|
+
"w-[min(360px,calc(100vw-48px))] max-h-[calc(100vh-48px)] overflow-auto",
|
|
114
|
+
"bg-surface-container-high text-on-surface rounded-extra-large shadow-level3",
|
|
115
|
+
"flex flex-col",
|
|
116
|
+
"origin-[var(--transform-origin)] transition-[opacity,transform] duration-200 ease-emphasized",
|
|
117
|
+
"data-[starting-style]:opacity-0 data-[starting-style]:scale-95",
|
|
118
|
+
"data-[ending-style]:opacity-0 data-[ending-style]:scale-95",
|
|
119
|
+
"focus:outline-none"
|
|
120
|
+
],
|
|
121
|
+
modalHeader: ["px-6 pt-4 text-label-medium text-on-surface-variant m-0"],
|
|
122
|
+
modalHeadline: ["px-6 pt-1 pb-4 text-headline-large text-on-surface m-0"],
|
|
123
|
+
modalActions: ["flex justify-end gap-2 px-6 pb-4 pt-2"]
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var dp = datePickerTv();
|
|
127
|
+
var DatePicker = createDatePicker({
|
|
128
|
+
calendar: dp.calendar(),
|
|
129
|
+
header: dp.header(),
|
|
130
|
+
navButton: dp.navButton(),
|
|
131
|
+
monthLabel: dp.monthLabel(),
|
|
132
|
+
grid: dp.grid(),
|
|
133
|
+
weekdays: dp.weekdays(),
|
|
134
|
+
weekday: dp.weekday(),
|
|
135
|
+
day: dp.day(),
|
|
136
|
+
yearGrid: dp.yearGrid(),
|
|
137
|
+
yearButton: dp.yearButton(),
|
|
138
|
+
field: dp.field(),
|
|
139
|
+
input: dp.input(),
|
|
140
|
+
fieldIcon: dp.fieldIcon(),
|
|
141
|
+
popup: dp.popup(),
|
|
142
|
+
modalBackdrop: dp.modalBackdrop(),
|
|
143
|
+
modalPopup: dp.modalPopup(),
|
|
144
|
+
modalHeader: dp.modalHeader(),
|
|
145
|
+
modalHeadline: dp.modalHeadline(),
|
|
146
|
+
modalActions: dp.modalActions()
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export { DatePicker, datePickerTv };
|
|
150
|
+
//# sourceMappingURL=date-picker.js.map
|
|
151
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tv.ts","../src/date-picker.ts"],"names":["baseTv"],"mappings":"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","file":"date-picker.js","sourcesContent":["/**\n * tv.ts — a tailwind-variants factory pre-configured for the M3 typescale.\n *\n * The Tailwind v4 preset exposes the 15 typescale roles as `text-<role>`\n * font-size utilities (e.g. `text-body-small`, `text-label-large`). Stock\n * tailwind-merge does not know these custom names, so it groups them with the\n * `text-<color>` utilities and drops one when a slot sets both a color *and* a\n * typescale (the common M3 case). That silently strips either the color or the\n * type, breaking token compliance.\n *\n * Teaching tailwind-merge that the typescale names belong to the `font-size`\n * group keeps color and type independent, so both survive the merge.\n */\nimport { type TV, tv as baseTv } from 'tailwind-variants';\n\nconst TYPESCALE = [\n 'display-large',\n 'display-medium',\n 'display-small',\n 'headline-large',\n 'headline-medium',\n 'headline-small',\n 'title-large',\n 'title-medium',\n 'title-small',\n 'body-large',\n 'body-medium',\n 'body-small',\n 'label-large',\n 'label-medium',\n 'label-small',\n] as const;\n\nexport const tv: TV = (options, config) =>\n baseTv(options, {\n ...config,\n twMergeConfig: {\n extend: {\n classGroups: {\n 'font-size': [{ text: [...TYPESCALE] }],\n },\n },\n },\n });\n","/**\n * date-picker.ts — Tailwind classes for the M3 Date picker.\n *\n * The month-grid Calendar plus its two surfaces: a docked Popover\n * (surface-container-high, elevation 2, large corners) and a modal Dialog\n * (surface-container-high, elevation 3, extra-large corners). Day cells carry a\n * circular `before:` state layer keyed to hover; the selected day fills with\n * primary. Same DOM + ripple as the VE build.\n */\nimport { createDatePicker } from '@m3-baseui/core';\nimport { tv } from './tv';\n\nexport const datePickerTv = tv({\n slots: {\n calendar: ['w-[328px] max-w-full p-3 text-on-surface'],\n header: ['flex items-center justify-between gap-2 h-12 pl-3 pr-1'],\n navButton: [\n 'relative inline-flex items-center justify-center size-10 rounded-full overflow-hidden',\n 'text-on-surface-variant cursor-pointer outline-none [&>svg]:size-6',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n 'active:before:opacity-[var(--md-sys-state-pressed)]',\n 'disabled:text-on-surface/[0.38] disabled:before:opacity-0 disabled:pointer-events-none',\n ],\n monthLabel: [\n 'relative inline-flex items-center gap-1 h-9 px-3 rounded-full overflow-hidden',\n 'text-label-large text-on-surface-variant cursor-pointer outline-none',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n '[&>svg]:transition-transform data-[view=years]:[&>svg]:rotate-180',\n ],\n grid: ['mt-2 border-collapse', '[&_td]:p-0 [&_td]:text-center'],\n weekdays: [''],\n weekday: ['size-12 font-normal text-body-large text-on-surface-variant'],\n day: [\n 'relative inline-flex items-center justify-center size-12 rounded-full overflow-hidden',\n 'text-body-large text-on-surface cursor-pointer outline-none',\n 'before:absolute before:inset-0 before:rounded-full before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n 'active:before:opacity-[var(--md-sys-state-pressed)]',\n // today: 1px primary outline ring\n 'data-[today]:ring-1 data-[today]:ring-inset data-[today]:ring-primary',\n // selected: primary fill, on-primary label, no state layer tint shift\n 'data-[selected]:bg-primary data-[selected]:text-on-primary',\n 'data-[disabled]:text-on-surface/[0.38] data-[disabled]:before:opacity-0 data-[disabled]:pointer-events-none',\n ],\n // weeks render as 7-col rows; force grid layout on each row\n yearGrid: ['grid grid-cols-3 gap-2 max-h-[280px] overflow-y-auto px-3 py-2'],\n yearButton: [\n 'relative inline-flex items-center justify-center h-9 rounded-full overflow-hidden',\n 'text-label-large text-on-surface-variant cursor-pointer outline-none',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n 'data-[selected]:bg-primary data-[selected]:text-on-primary',\n ],\n\n field: [\n 'inline-flex items-center gap-1 h-14 pl-4 pr-1 min-w-[200px]',\n 'bg-surface-container-highest text-on-surface rounded-t-extra-small',\n 'border-b border-on-surface-variant',\n ],\n input: [\n 'flex-1 min-w-0 h-full bg-transparent border-0 outline-none',\n 'text-body-large text-on-surface placeholder:text-on-surface-variant',\n ],\n fieldIcon: [\n 'relative inline-flex items-center justify-center size-10 rounded-full overflow-hidden',\n 'text-on-surface-variant cursor-pointer outline-none [&>svg]:size-6',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n 'active:before:opacity-[var(--md-sys-state-pressed)]',\n ],\n popup: [\n 'bg-surface-container-high text-on-surface rounded-large shadow-level2',\n 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-150 ease-standard',\n 'data-[starting-style]:opacity-0 data-[starting-style]:scale-95',\n 'data-[ending-style]:opacity-0',\n 'focus:outline-none',\n ],\n\n modalBackdrop: [\n 'fixed inset-0 z-40 bg-scrim/32',\n 'transition-opacity duration-200 ease-standard',\n 'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0',\n ],\n modalPopup: [\n 'fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2',\n 'w-[min(360px,calc(100vw-48px))] max-h-[calc(100vh-48px)] overflow-auto',\n 'bg-surface-container-high text-on-surface rounded-extra-large shadow-level3',\n 'flex flex-col',\n 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-200 ease-emphasized',\n 'data-[starting-style]:opacity-0 data-[starting-style]:scale-95',\n 'data-[ending-style]:opacity-0 data-[ending-style]:scale-95',\n 'focus:outline-none',\n ],\n modalHeader: ['px-6 pt-4 text-label-medium text-on-surface-variant m-0'],\n modalHeadline: ['px-6 pt-1 pb-4 text-headline-large text-on-surface m-0'],\n modalActions: ['flex justify-end gap-2 px-6 pb-4 pt-2'],\n },\n});\n\nconst dp = datePickerTv();\nexport const DatePicker: ReturnType<typeof createDatePicker> = createDatePicker({\n calendar: dp.calendar(),\n header: dp.header(),\n navButton: dp.navButton(),\n monthLabel: dp.monthLabel(),\n grid: dp.grid(),\n weekdays: dp.weekdays(),\n weekday: dp.weekday(),\n day: dp.day(),\n yearGrid: dp.yearGrid(),\n yearButton: dp.yearButton(),\n field: dp.field(),\n input: dp.input(),\n fieldIcon: dp.fieldIcon(),\n popup: dp.popup(),\n modalBackdrop: dp.modalBackdrop(),\n modalPopup: dp.modalPopup(),\n modalHeader: dp.modalHeader(),\n modalHeadline: dp.modalHeadline(),\n modalActions: dp.modalActions(),\n});\n"]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as _m3_baseui_core from '@m3-baseui/core';
|
|
2
|
+
export { FabMenuItemProps, FabMenuTriggerProps } from '@m3-baseui/core';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import * as _base_ui_react from '@base-ui/react';
|
|
5
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
6
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
7
|
+
|
|
8
|
+
declare const fabMenuTv: tailwind_variants.TVReturnType<{
|
|
9
|
+
color: {
|
|
10
|
+
surface: {
|
|
11
|
+
item: string;
|
|
12
|
+
};
|
|
13
|
+
primary: {
|
|
14
|
+
item: string;
|
|
15
|
+
};
|
|
16
|
+
secondary: {
|
|
17
|
+
item: string;
|
|
18
|
+
};
|
|
19
|
+
tertiary: {
|
|
20
|
+
item: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
popup: string[];
|
|
25
|
+
item: string[];
|
|
26
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
27
|
+
color: {
|
|
28
|
+
surface: {
|
|
29
|
+
item: string;
|
|
30
|
+
};
|
|
31
|
+
primary: {
|
|
32
|
+
item: string;
|
|
33
|
+
};
|
|
34
|
+
secondary: {
|
|
35
|
+
item: string;
|
|
36
|
+
};
|
|
37
|
+
tertiary: {
|
|
38
|
+
item: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
color: {
|
|
43
|
+
surface: {
|
|
44
|
+
item: string;
|
|
45
|
+
};
|
|
46
|
+
primary: {
|
|
47
|
+
item: string;
|
|
48
|
+
};
|
|
49
|
+
secondary: {
|
|
50
|
+
item: string;
|
|
51
|
+
};
|
|
52
|
+
tertiary: {
|
|
53
|
+
item: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}>, {
|
|
57
|
+
color: {
|
|
58
|
+
surface: {
|
|
59
|
+
item: string;
|
|
60
|
+
};
|
|
61
|
+
primary: {
|
|
62
|
+
item: string;
|
|
63
|
+
};
|
|
64
|
+
secondary: {
|
|
65
|
+
item: string;
|
|
66
|
+
};
|
|
67
|
+
tertiary: {
|
|
68
|
+
item: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}, {
|
|
72
|
+
popup: string[];
|
|
73
|
+
item: string[];
|
|
74
|
+
}, tailwind_variants.TVReturnType<{
|
|
75
|
+
color: {
|
|
76
|
+
surface: {
|
|
77
|
+
item: string;
|
|
78
|
+
};
|
|
79
|
+
primary: {
|
|
80
|
+
item: string;
|
|
81
|
+
};
|
|
82
|
+
secondary: {
|
|
83
|
+
item: string;
|
|
84
|
+
};
|
|
85
|
+
tertiary: {
|
|
86
|
+
item: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
popup: string[];
|
|
91
|
+
item: string[];
|
|
92
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
93
|
+
color: {
|
|
94
|
+
surface: {
|
|
95
|
+
item: string;
|
|
96
|
+
};
|
|
97
|
+
primary: {
|
|
98
|
+
item: string;
|
|
99
|
+
};
|
|
100
|
+
secondary: {
|
|
101
|
+
item: string;
|
|
102
|
+
};
|
|
103
|
+
tertiary: {
|
|
104
|
+
item: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
color: {
|
|
109
|
+
surface: {
|
|
110
|
+
item: string;
|
|
111
|
+
};
|
|
112
|
+
primary: {
|
|
113
|
+
item: string;
|
|
114
|
+
};
|
|
115
|
+
secondary: {
|
|
116
|
+
item: string;
|
|
117
|
+
};
|
|
118
|
+
tertiary: {
|
|
119
|
+
item: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
}>, unknown, unknown, undefined>>;
|
|
123
|
+
declare const FabMenu: {
|
|
124
|
+
Root: <Payload>(props: _base_ui_react.MenuRoot.Props<Payload>) => react.JSX.Element;
|
|
125
|
+
Trigger: react.ForwardRefExoticComponent<_m3_baseui_core.FabMenuTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
126
|
+
Portal: react.ForwardRefExoticComponent<Omit<_base_ui_react.ContextMenuPortalProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
127
|
+
Positioner: react.ForwardRefExoticComponent<Omit<_base_ui_react.ContextMenuPositionerProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
128
|
+
Popup: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.ContextMenuPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<unknown>>;
|
|
129
|
+
Item: react.ForwardRefExoticComponent<_m3_baseui_core.FabMenuItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { FabMenu, fabMenuTv };
|
package/dist/fab-menu.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createFab, createFabMenu } from '@m3-baseui/core';
|
|
3
|
+
import { tv as tv$1 } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
// src/fab-menu.ts
|
|
6
|
+
var TYPESCALE = [
|
|
7
|
+
"display-large",
|
|
8
|
+
"display-medium",
|
|
9
|
+
"display-small",
|
|
10
|
+
"headline-large",
|
|
11
|
+
"headline-medium",
|
|
12
|
+
"headline-small",
|
|
13
|
+
"title-large",
|
|
14
|
+
"title-medium",
|
|
15
|
+
"title-small",
|
|
16
|
+
"body-large",
|
|
17
|
+
"body-medium",
|
|
18
|
+
"body-small",
|
|
19
|
+
"label-large",
|
|
20
|
+
"label-medium",
|
|
21
|
+
"label-small"
|
|
22
|
+
];
|
|
23
|
+
var tv = (options, config) => tv$1(options, {
|
|
24
|
+
...config,
|
|
25
|
+
twMergeConfig: {
|
|
26
|
+
extend: {
|
|
27
|
+
classGroups: {
|
|
28
|
+
"font-size": [{ text: [...TYPESCALE] }]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var fabTv = tv$1({
|
|
34
|
+
base: [
|
|
35
|
+
"relative inline-flex items-center justify-center box-border overflow-hidden",
|
|
36
|
+
"border-0 cursor-pointer select-none outline-none",
|
|
37
|
+
"shadow-level3 hover:shadow-level4",
|
|
38
|
+
"transition-shadow duration-150 ease-standard",
|
|
39
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
40
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
41
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
42
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]",
|
|
43
|
+
"data-[pressed]:before:opacity-[var(--md-sys-state-pressed)]",
|
|
44
|
+
// M3 discourages disabled FABs (material-web removed the state). When native
|
|
45
|
+
// disabled is used, apply the same container/label tokens as filled buttons.
|
|
46
|
+
"disabled:pointer-events-none disabled:shadow-none disabled:before:opacity-0",
|
|
47
|
+
"disabled:bg-on-surface/12 disabled:text-on-surface/38",
|
|
48
|
+
"data-[disabled]:pointer-events-none data-[disabled]:shadow-none data-[disabled]:before:opacity-0",
|
|
49
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38"
|
|
50
|
+
],
|
|
51
|
+
variants: {
|
|
52
|
+
size: {
|
|
53
|
+
small: "size-10 rounded-medium [&_svg]:size-6",
|
|
54
|
+
regular: "size-14 rounded-large [&_svg]:size-6",
|
|
55
|
+
large: "size-24 rounded-extra-large [&_svg]:size-9",
|
|
56
|
+
extended: "h-14 min-w-20 px-4 gap-3 rounded-large text-label-large [&_svg]:size-6"
|
|
57
|
+
},
|
|
58
|
+
color: {
|
|
59
|
+
surface: "bg-surface-container-high text-primary",
|
|
60
|
+
primary: "bg-primary-container text-on-primary-container",
|
|
61
|
+
secondary: "bg-secondary-container text-on-secondary-container",
|
|
62
|
+
tertiary: "bg-tertiary-container text-on-tertiary-container"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
size: "regular",
|
|
67
|
+
color: "surface"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
createFab(({ size, color }) => fabTv({ size, color }));
|
|
71
|
+
|
|
72
|
+
// src/fab-menu.ts
|
|
73
|
+
var fabMenuTv = tv({
|
|
74
|
+
slots: {
|
|
75
|
+
popup: [
|
|
76
|
+
"flex flex-col items-end gap-2 bg-transparent outline-none",
|
|
77
|
+
"origin-[var(--transform-origin)] transition-[opacity,transform] duration-150 ease-standard",
|
|
78
|
+
"data-[starting-style]:opacity-0 data-[starting-style]:scale-95",
|
|
79
|
+
"data-[ending-style]:opacity-0"
|
|
80
|
+
],
|
|
81
|
+
item: [
|
|
82
|
+
"relative inline-flex items-center gap-3 h-14 px-4 overflow-hidden box-border",
|
|
83
|
+
"cursor-pointer select-none outline-none rounded-full text-label-large",
|
|
84
|
+
"shadow-level3 hover:shadow-level4 transition-shadow duration-150 ease-standard",
|
|
85
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
86
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
87
|
+
"data-[highlighted]:before:opacity-[var(--md-sys-state-hover)]",
|
|
88
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]",
|
|
89
|
+
// M3 leading icon (24dp).
|
|
90
|
+
"[&_[data-slot=fab-menu-leading]]:inline-flex [&_[data-slot=fab-menu-leading]>svg]:size-6",
|
|
91
|
+
// M3 discourages disabled FABs; when used, match the filled-button tokens
|
|
92
|
+
// (per-token, not a blanket opacity) and suppress the state layer.
|
|
93
|
+
"data-[disabled]:pointer-events-none data-[disabled]:shadow-none data-[disabled]:before:opacity-0",
|
|
94
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
variants: {
|
|
98
|
+
color: {
|
|
99
|
+
surface: { item: "bg-surface-container-high text-primary" },
|
|
100
|
+
primary: { item: "bg-primary-container text-on-primary-container" },
|
|
101
|
+
secondary: { item: "bg-secondary-container text-on-secondary-container" },
|
|
102
|
+
tertiary: { item: "bg-tertiary-container text-on-tertiary-container" }
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
defaultVariants: {
|
|
106
|
+
color: "primary"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
var FabMenu = createFabMenu(({ size, color }) => fabTv({ size, color }), {
|
|
110
|
+
popup: fabMenuTv().popup(),
|
|
111
|
+
item: (color) => fabMenuTv({ color }).item()
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export { FabMenu, fabMenuTv };
|
|
115
|
+
//# sourceMappingURL=fab-menu.js.map
|
|
116
|
+
//# sourceMappingURL=fab-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tv.ts","../src/fab.ts","../src/fab-menu.ts"],"names":["baseTv","tv"],"mappings":"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","file":"fab-menu.js","sourcesContent":["/**\n * tv.ts — a tailwind-variants factory pre-configured for the M3 typescale.\n *\n * The Tailwind v4 preset exposes the 15 typescale roles as `text-<role>`\n * font-size utilities (e.g. `text-body-small`, `text-label-large`). Stock\n * tailwind-merge does not know these custom names, so it groups them with the\n * `text-<color>` utilities and drops one when a slot sets both a color *and* a\n * typescale (the common M3 case). That silently strips either the color or the\n * type, breaking token compliance.\n *\n * Teaching tailwind-merge that the typescale names belong to the `font-size`\n * group keeps color and type independent, so both survive the merge.\n */\nimport { type TV, tv as baseTv } from 'tailwind-variants';\n\nconst TYPESCALE = [\n 'display-large',\n 'display-medium',\n 'display-small',\n 'headline-large',\n 'headline-medium',\n 'headline-small',\n 'title-large',\n 'title-medium',\n 'title-small',\n 'body-large',\n 'body-medium',\n 'body-small',\n 'label-large',\n 'label-medium',\n 'label-small',\n] as const;\n\nexport const tv: TV = (options, config) =>\n baseTv(options, {\n ...config,\n twMergeConfig: {\n extend: {\n classGroups: {\n 'font-size': [{ text: [...TYPESCALE] }],\n },\n },\n },\n });\n","/**\n * fab.ts — tailwind-variants for the M3 FAB.\n *\n * Four sizes + four container colors, elevation level3 (level4 on hover) and a\n * currentColor state-layer `::before`. The pointer ripple is added by the\n * factory. Same DOM as the VE build.\n */\nimport { createFab } from '@m3-baseui/core';\nimport { tv } from 'tailwind-variants';\n\nexport const fabTv = tv({\n base: [\n 'relative inline-flex items-center justify-center box-border overflow-hidden',\n 'border-0 cursor-pointer select-none outline-none',\n 'shadow-level3 hover:shadow-level4',\n 'transition-shadow duration-150 ease-standard',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'focus-visible:before:opacity-[var(--md-sys-state-focus)]',\n 'active:before:opacity-[var(--md-sys-state-pressed)]',\n 'data-[pressed]:before:opacity-[var(--md-sys-state-pressed)]',\n // M3 discourages disabled FABs (material-web removed the state). When native\n // disabled is used, apply the same container/label tokens as filled buttons.\n 'disabled:pointer-events-none disabled:shadow-none disabled:before:opacity-0',\n 'disabled:bg-on-surface/12 disabled:text-on-surface/38',\n 'data-[disabled]:pointer-events-none data-[disabled]:shadow-none data-[disabled]:before:opacity-0',\n 'data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38',\n ],\n variants: {\n size: {\n small: 'size-10 rounded-medium [&_svg]:size-6',\n regular: 'size-14 rounded-large [&_svg]:size-6',\n large: 'size-24 rounded-extra-large [&_svg]:size-9',\n extended: 'h-14 min-w-20 px-4 gap-3 rounded-large text-label-large [&_svg]:size-6',\n },\n color: {\n surface: 'bg-surface-container-high text-primary',\n primary: 'bg-primary-container text-on-primary-container',\n secondary: 'bg-secondary-container text-on-secondary-container',\n tertiary: 'bg-tertiary-container text-on-tertiary-container',\n },\n },\n defaultVariants: {\n size: 'regular',\n color: 'surface',\n },\n});\n\nexport const Fab = createFab(({ size, color }) => fabTv({ size, color }));\nexport type { FabProps, FabSize, FabColor } from '@m3-baseui/core';\n","/**\n * fab-menu.ts — tailwind-variants for the M3 FAB menu.\n *\n * The popup stacks the actions in a right-aligned column with the M3 menu\n * enter/exit motion; each item is a 56dp full-corner pill (elevation level3,\n * level4 on hover) with a currentColor state-layer `::before`, a 24dp leading\n * icon slot and a label-large label. The trigger reuses the FAB resolver. Same\n * DOM + ripple as the VE build.\n */\nimport { createFabMenu } from '@m3-baseui/core';\nimport { tv } from './tv';\nimport { fabTv } from './fab';\n\nexport const fabMenuTv = tv({\n slots: {\n popup: [\n 'flex flex-col items-end gap-2 bg-transparent outline-none',\n 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-150 ease-standard',\n 'data-[starting-style]:opacity-0 data-[starting-style]:scale-95',\n 'data-[ending-style]:opacity-0',\n ],\n item: [\n 'relative inline-flex items-center gap-3 h-14 px-4 overflow-hidden box-border',\n 'cursor-pointer select-none outline-none rounded-full text-label-large',\n 'shadow-level3 hover:shadow-level4 transition-shadow duration-150 ease-standard',\n 'before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100',\n 'hover:before:opacity-[var(--md-sys-state-hover)]',\n 'data-[highlighted]:before:opacity-[var(--md-sys-state-hover)]',\n 'active:before:opacity-[var(--md-sys-state-pressed)]',\n // M3 leading icon (24dp).\n '[&_[data-slot=fab-menu-leading]]:inline-flex [&_[data-slot=fab-menu-leading]>svg]:size-6',\n // M3 discourages disabled FABs; when used, match the filled-button tokens\n // (per-token, not a blanket opacity) and suppress the state layer.\n 'data-[disabled]:pointer-events-none data-[disabled]:shadow-none data-[disabled]:before:opacity-0',\n 'data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38',\n ],\n },\n variants: {\n color: {\n surface: { item: 'bg-surface-container-high text-primary' },\n primary: { item: 'bg-primary-container text-on-primary-container' },\n secondary: { item: 'bg-secondary-container text-on-secondary-container' },\n tertiary: { item: 'bg-tertiary-container text-on-tertiary-container' },\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n});\n\nexport const FabMenu = createFabMenu(({ size, color }) => fabTv({ size, color }), {\n popup: fabMenuTv().popup(),\n item: (color) => fabMenuTv({ color }).item(),\n});\n\nexport type { FabMenuTriggerProps, FabMenuItemProps } from '@m3-baseui/core';\n"]}
|
package/dist/icon-button.js
CHANGED
|
@@ -25,7 +25,10 @@ var widthCompounds = Object.entries(WIDTHS).flatMap(
|
|
|
25
25
|
var iconButton = tv({
|
|
26
26
|
base: [
|
|
27
27
|
"relative inline-flex items-center justify-center shrink-0",
|
|
28
|
-
|
|
28
|
+
// No `overflow-hidden`: it would clip the 48dp touch target on small sizes.
|
|
29
|
+
// The state layer is already rounded (before:rounded-[inherit]); the ripple
|
|
30
|
+
// self-clips.
|
|
31
|
+
"rounded-full cursor-pointer select-none border-0 bg-transparent",
|
|
29
32
|
"transition-[box-shadow,background-color,color] duration-200 ease-standard",
|
|
30
33
|
// State layer overlay
|
|
31
34
|
"before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:pointer-events-none",
|