@m3-baseui/react-tailwind 1.0.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/badge.d.ts +45 -0
- package/dist/badge.js +50 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.d.ts +69 -0
- package/dist/button.js +74 -0
- package/dist/button.js.map +1 -0
- package/dist/card.d.ts +80 -0
- package/dist/card.js +77 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.d.ts +63 -0
- package/dist/checkbox.js +60 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chip.d.ts +165 -0
- package/dist/chip.js +76 -0
- package/dist/chip.js.map +1 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +68 -0
- package/dist/dialog.js.map +1 -0
- package/dist/divider.d.ts +83 -0
- package/dist/divider.js +34 -0
- package/dist/divider.js.map +1 -0
- package/dist/fab.d.ts +104 -0
- package/dist/fab.js +43 -0
- package/dist/fab.js.map +1 -0
- package/dist/icon-button.d.ts +174 -0
- package/dist/icon-button.js +121 -0
- package/dist/icon-button.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1157 -0
- package/dist/index.js.map +1 -0
- package/dist/item.d.ts +94 -0
- package/dist/item.js +62 -0
- package/dist/item.js.map +1 -0
- package/dist/list.d.ts +163 -0
- package/dist/list.js +94 -0
- package/dist/list.js.map +1 -0
- package/dist/menu.d.ts +119 -0
- package/dist/menu.js +114 -0
- package/dist/menu.js.map +1 -0
- package/dist/navigation-bar.d.ts +91 -0
- package/dist/navigation-bar.js +48 -0
- package/dist/navigation-bar.js.map +1 -0
- package/dist/navigation-drawer.d.ts +86 -0
- package/dist/navigation-drawer.js +78 -0
- package/dist/navigation-drawer.js.map +1 -0
- package/dist/progress.d.ts +118 -0
- package/dist/progress.js +41 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio.d.ts +56 -0
- package/dist/radio.js +47 -0
- package/dist/radio.js.map +1 -0
- package/dist/segmented-button.d.ts +83 -0
- package/dist/segmented-button.js +71 -0
- package/dist/segmented-button.js.map +1 -0
- package/dist/select.d.ts +125 -0
- package/dist/select.js +99 -0
- package/dist/select.js.map +1 -0
- package/dist/slider.d.ts +94 -0
- package/dist/slider.js +71 -0
- package/dist/slider.js.map +1 -0
- package/dist/snackbar.d.ts +108 -0
- package/dist/snackbar.js +57 -0
- package/dist/snackbar.js.map +1 -0
- package/dist/switch.d.ts +72 -0
- package/dist/switch.js +66 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.d.ts +118 -0
- package/dist/tabs.js +97 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textfield.d.ts +127 -0
- package/dist/textfield.js +83 -0
- package/dist/textfield.js.map +1 -0
- package/dist/tooltip.d.ts +61 -0
- package/dist/tooltip.js +52 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tv.d.ts +19 -0
- package/dist/tv.js +35 -0
- package/dist/tv.js.map +1 -0
- package/package.json +171 -0
- package/styles/preset.css +30 -0
- package/styles/theme.css +213 -0
- package/styles/tokens.css +361 -0
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as _m3_baseui_core from '@m3-baseui/core';
|
|
2
|
+
export { TabsVariant } 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 tabsTv: tailwind_variants.TVReturnType<{
|
|
9
|
+
variant: {
|
|
10
|
+
primary: {
|
|
11
|
+
tab: string;
|
|
12
|
+
indicator: string;
|
|
13
|
+
};
|
|
14
|
+
secondary: {
|
|
15
|
+
tab: string;
|
|
16
|
+
indicator: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
root: string;
|
|
21
|
+
list: string[];
|
|
22
|
+
tab: string[];
|
|
23
|
+
indicator: string[];
|
|
24
|
+
panel: string;
|
|
25
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
26
|
+
variant: {
|
|
27
|
+
primary: {
|
|
28
|
+
tab: string;
|
|
29
|
+
indicator: string;
|
|
30
|
+
};
|
|
31
|
+
secondary: {
|
|
32
|
+
tab: string;
|
|
33
|
+
indicator: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
variant: {
|
|
38
|
+
primary: {
|
|
39
|
+
tab: string;
|
|
40
|
+
indicator: string;
|
|
41
|
+
};
|
|
42
|
+
secondary: {
|
|
43
|
+
tab: string;
|
|
44
|
+
indicator: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}>, {
|
|
48
|
+
variant: {
|
|
49
|
+
primary: {
|
|
50
|
+
tab: string;
|
|
51
|
+
indicator: string;
|
|
52
|
+
};
|
|
53
|
+
secondary: {
|
|
54
|
+
tab: string;
|
|
55
|
+
indicator: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
root: string;
|
|
60
|
+
list: string[];
|
|
61
|
+
tab: string[];
|
|
62
|
+
indicator: string[];
|
|
63
|
+
panel: string;
|
|
64
|
+
}, tailwind_variants.TVReturnType<{
|
|
65
|
+
variant: {
|
|
66
|
+
primary: {
|
|
67
|
+
tab: string;
|
|
68
|
+
indicator: string;
|
|
69
|
+
};
|
|
70
|
+
secondary: {
|
|
71
|
+
tab: string;
|
|
72
|
+
indicator: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
root: string;
|
|
77
|
+
list: string[];
|
|
78
|
+
tab: string[];
|
|
79
|
+
indicator: string[];
|
|
80
|
+
panel: string;
|
|
81
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
82
|
+
variant: {
|
|
83
|
+
primary: {
|
|
84
|
+
tab: string;
|
|
85
|
+
indicator: string;
|
|
86
|
+
};
|
|
87
|
+
secondary: {
|
|
88
|
+
tab: string;
|
|
89
|
+
indicator: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}, {
|
|
93
|
+
variant: {
|
|
94
|
+
primary: {
|
|
95
|
+
tab: string;
|
|
96
|
+
indicator: string;
|
|
97
|
+
};
|
|
98
|
+
secondary: {
|
|
99
|
+
tab: string;
|
|
100
|
+
indicator: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
}>, unknown, unknown, undefined>>;
|
|
104
|
+
declare const Tabs: {
|
|
105
|
+
Root: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TabsRootProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
106
|
+
variant?: _m3_baseui_core.TabsVariant;
|
|
107
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
List: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TabsListProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
109
|
+
scrollable?: boolean;
|
|
110
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
111
|
+
Tab: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TabsTabProps, "ref"> & react.RefAttributes<HTMLElement>, "ref"> & {
|
|
112
|
+
icon?: React.ReactNode;
|
|
113
|
+
} & react.RefAttributes<HTMLElement>>;
|
|
114
|
+
Indicator: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TabsIndicatorProps, "ref"> & react.RefAttributes<HTMLSpanElement>, "ref"> & react.RefAttributes<HTMLSpanElement>>;
|
|
115
|
+
Panel: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TabsPanelProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { Tabs, tabsTv };
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createTabs } from '@m3-baseui/core';
|
|
3
|
+
import { tv as tv$1 } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
// src/tabs.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/tabs.ts
|
|
35
|
+
var tabsTv = tv({
|
|
36
|
+
slots: {
|
|
37
|
+
root: "flex flex-col",
|
|
38
|
+
list: [
|
|
39
|
+
"relative flex border-b border-surface-variant",
|
|
40
|
+
// M3 scrollable tabs: horizontal overflow, no wrap, hidden scrollbar.
|
|
41
|
+
"data-[scrollable]:overflow-x-auto data-[scrollable]:flex-nowrap",
|
|
42
|
+
"data-[scrollable]:[scrollbar-width:none] data-[scrollable]:[&::-webkit-scrollbar]:hidden"
|
|
43
|
+
],
|
|
44
|
+
tab: [
|
|
45
|
+
"relative flex shrink-0 items-center justify-center gap-2 h-12 px-4 overflow-hidden",
|
|
46
|
+
"cursor-pointer select-none border-0 bg-transparent outline-none text-title-small",
|
|
47
|
+
"text-on-surface-variant",
|
|
48
|
+
// Icon slot (24dp), centered.
|
|
49
|
+
"[&_[data-slot=tab-icon]]:inline-flex [&_[data-slot=tab-icon]>svg]:size-6",
|
|
50
|
+
"before:absolute before:inset-0 before:bg-current before:opacity-0 before:pointer-events-none before:transition-opacity before:duration-100",
|
|
51
|
+
"hover:before:opacity-[var(--md-sys-state-hover)]",
|
|
52
|
+
"focus-visible:before:opacity-[var(--md-sys-state-focus)]",
|
|
53
|
+
"active:before:opacity-[var(--md-sys-state-pressed)]",
|
|
54
|
+
// M3 disabled (per-token, not a blanket fade): label + icon on-surface/0.38,
|
|
55
|
+
// no state layer. currentColor carries the dim to the icon slot.
|
|
56
|
+
"data-[disabled]:text-on-surface/[0.38] data-[disabled]:before:opacity-0 data-[disabled]:pointer-events-none",
|
|
57
|
+
// A disabled tab that is also the active value stays dimmed: the variant's
|
|
58
|
+
// data-[active] color has equal specificity, so a combined selector wins.
|
|
59
|
+
"data-[disabled]:data-[active]:text-on-surface/[0.38]"
|
|
60
|
+
],
|
|
61
|
+
indicator: [
|
|
62
|
+
"absolute bottom-0 left-0 bg-primary",
|
|
63
|
+
"w-[var(--active-tab-width)] translate-x-[var(--active-tab-left)]",
|
|
64
|
+
"transition-all duration-200 ease-standard"
|
|
65
|
+
],
|
|
66
|
+
panel: "p-4 outline-none"
|
|
67
|
+
},
|
|
68
|
+
variants: {
|
|
69
|
+
variant: {
|
|
70
|
+
// primary: 3dp active indicator with rounded top corners; icon stacks
|
|
71
|
+
// above the label (64dp tall) when a tab carries an icon.
|
|
72
|
+
primary: {
|
|
73
|
+
tab: "data-[active]:text-primary data-[with-icon]:flex-col data-[with-icon]:h-16 data-[with-icon]:gap-1",
|
|
74
|
+
indicator: "h-[3px] rounded-t-[3px]"
|
|
75
|
+
},
|
|
76
|
+
// secondary: 2dp square active indicator, active label = on-surface
|
|
77
|
+
secondary: { tab: "data-[active]:text-on-surface", indicator: "h-[2px]" }
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
variant: "primary"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
var Tabs = createTabs((variant) => {
|
|
85
|
+
const s = tabsTv({ variant });
|
|
86
|
+
return {
|
|
87
|
+
root: s.root(),
|
|
88
|
+
list: s.list(),
|
|
89
|
+
tab: s.tab(),
|
|
90
|
+
indicator: s.indicator(),
|
|
91
|
+
panel: s.panel()
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export { Tabs, tabsTv };
|
|
96
|
+
//# sourceMappingURL=tabs.js.map
|
|
97
|
+
//# sourceMappingURL=tabs.js.map
|
package/dist/tabs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tv.ts","../src/tabs.ts"],"names":["baseTv"],"mappings":";;;;;AAeA,IAAM,SAAA,GAAY;AAAA,EAChB,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,EAAA,GAAS,CAAC,OAAA,EAAS,MAAA,KAC9BA,KAAO,OAAA,EAAS;AAAA,EACd,GAAG,MAAA;AAAA,EACH,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,MACN,WAAA,EAAa;AAAA,QACX,WAAA,EAAa,CAAC,EAAE,IAAA,EAAM,CAAC,GAAG,SAAS,GAAG;AAAA;AACxC;AACF;AAEJ,CAAC,CAAA;;;ACjCI,IAAM,SAAS,EAAA,CAAG;AAAA,EACvB,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,eAAA;AAAA,IACN,IAAA,EAAM;AAAA,MACJ,+CAAA;AAAA;AAAA,MAEA,iEAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,GAAA,EAAK;AAAA,MACH,oFAAA;AAAA,MACA,kFAAA;AAAA,MACA,yBAAA;AAAA;AAAA,MAEA,0EAAA;AAAA,MACA,4IAAA;AAAA,MACA,kDAAA;AAAA,MACA,0DAAA;AAAA,MACA,qDAAA;AAAA;AAAA;AAAA,MAGA,6GAAA;AAAA;AAAA;AAAA,MAGA;AAAA,KACF;AAAA,IACA,SAAA,EAAW;AAAA,MACT,qCAAA;AAAA,MACA,kEAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,KAAA,EAAO;AAAA,GACT;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA;AAAA;AAAA,MAGP,OAAA,EAAS;AAAA,QACP,GAAA,EAAK,mGAAA;AAAA,QACL,SAAA,EAAW;AAAA,OACb;AAAA;AAAA,MAEA,SAAA,EAAW,EAAE,GAAA,EAAK,+BAAA,EAAiC,WAAW,SAAA;AAAU;AAC1E,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS;AAAA;AAEb,CAAC;AAEM,IAAM,IAAA,GAAO,UAAA,CAAW,CAAC,OAAA,KAAY;AAC1C,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,EAAE,OAAA,EAAS,CAAA;AAC5B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,IAAA,EAAK;AAAA,IACb,IAAA,EAAM,EAAE,IAAA,EAAK;AAAA,IACb,GAAA,EAAK,EAAE,GAAA,EAAI;AAAA,IACX,SAAA,EAAW,EAAE,SAAA,EAAU;AAAA,IACvB,KAAA,EAAO,EAAE,KAAA;AAAM,GACjB;AACF,CAAC","file":"tabs.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 * tabs.ts — tailwind-variants slots for the M3 Tabs.\n *\n * The active-tab underline reads Base UI's --active-tab-width/left CSS vars on\n * the indicator. The `variant` recolors the active tab (primary → primary,\n * secondary → on-surface). Tabs carry a `before:` state layer + ripple.\n */\nimport { createTabs } from '@m3-baseui/core';\nimport { tv } from './tv';\n\nexport const tabsTv = tv({\n slots: {\n root: 'flex flex-col',\n list: [\n 'relative flex border-b border-surface-variant',\n // M3 scrollable tabs: horizontal overflow, no wrap, hidden scrollbar.\n 'data-[scrollable]:overflow-x-auto data-[scrollable]:flex-nowrap',\n 'data-[scrollable]:[scrollbar-width:none] data-[scrollable]:[&::-webkit-scrollbar]:hidden',\n ],\n tab: [\n 'relative flex shrink-0 items-center justify-center gap-2 h-12 px-4 overflow-hidden',\n 'cursor-pointer select-none border-0 bg-transparent outline-none text-title-small',\n 'text-on-surface-variant',\n // Icon slot (24dp), centered.\n '[&_[data-slot=tab-icon]]:inline-flex [&_[data-slot=tab-icon]>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 // M3 disabled (per-token, not a blanket fade): label + icon on-surface/0.38,\n // no state layer. currentColor carries the dim to the icon slot.\n 'data-[disabled]:text-on-surface/[0.38] data-[disabled]:before:opacity-0 data-[disabled]:pointer-events-none',\n // A disabled tab that is also the active value stays dimmed: the variant's\n // data-[active] color has equal specificity, so a combined selector wins.\n 'data-[disabled]:data-[active]:text-on-surface/[0.38]',\n ],\n indicator: [\n 'absolute bottom-0 left-0 bg-primary',\n 'w-[var(--active-tab-width)] translate-x-[var(--active-tab-left)]',\n 'transition-all duration-200 ease-standard',\n ],\n panel: 'p-4 outline-none',\n },\n variants: {\n variant: {\n // primary: 3dp active indicator with rounded top corners; icon stacks\n // above the label (64dp tall) when a tab carries an icon.\n primary: {\n tab: 'data-[active]:text-primary data-[with-icon]:flex-col data-[with-icon]:h-16 data-[with-icon]:gap-1',\n indicator: 'h-[3px] rounded-t-[3px]',\n },\n // secondary: 2dp square active indicator, active label = on-surface\n secondary: { tab: 'data-[active]:text-on-surface', indicator: 'h-[2px]' },\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n});\n\nexport const Tabs = createTabs((variant) => {\n const s = tabsTv({ variant });\n return {\n root: s.root(),\n list: s.list(),\n tab: s.tab(),\n indicator: s.indicator(),\n panel: s.panel(),\n };\n});\nexport type { TabsVariant } from '@m3-baseui/core';\n"]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as _m3_baseui_core from '@m3-baseui/core';
|
|
3
|
+
export { TextFieldProps, TextFieldVariant } from '@m3-baseui/core';
|
|
4
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
5
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
6
|
+
|
|
7
|
+
declare const textFieldTv: tailwind_variants.TVReturnType<{
|
|
8
|
+
variant: {
|
|
9
|
+
filled: {
|
|
10
|
+
field: string[];
|
|
11
|
+
input: string;
|
|
12
|
+
label: string[];
|
|
13
|
+
};
|
|
14
|
+
outlined: {
|
|
15
|
+
field: string[];
|
|
16
|
+
label: string[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
root: string;
|
|
21
|
+
field: string[];
|
|
22
|
+
inputWrap: string;
|
|
23
|
+
input: string[];
|
|
24
|
+
label: string[];
|
|
25
|
+
leadingIcon: string;
|
|
26
|
+
trailingIcon: string;
|
|
27
|
+
supporting: string[];
|
|
28
|
+
supportingText: string;
|
|
29
|
+
counter: string;
|
|
30
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
31
|
+
variant: {
|
|
32
|
+
filled: {
|
|
33
|
+
field: string[];
|
|
34
|
+
input: string;
|
|
35
|
+
label: string[];
|
|
36
|
+
};
|
|
37
|
+
outlined: {
|
|
38
|
+
field: string[];
|
|
39
|
+
label: string[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
variant: {
|
|
44
|
+
filled: {
|
|
45
|
+
field: string[];
|
|
46
|
+
input: string;
|
|
47
|
+
label: string[];
|
|
48
|
+
};
|
|
49
|
+
outlined: {
|
|
50
|
+
field: string[];
|
|
51
|
+
label: string[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}>, {
|
|
55
|
+
variant: {
|
|
56
|
+
filled: {
|
|
57
|
+
field: string[];
|
|
58
|
+
input: string;
|
|
59
|
+
label: string[];
|
|
60
|
+
};
|
|
61
|
+
outlined: {
|
|
62
|
+
field: string[];
|
|
63
|
+
label: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
root: string;
|
|
68
|
+
field: string[];
|
|
69
|
+
inputWrap: string;
|
|
70
|
+
input: string[];
|
|
71
|
+
label: string[];
|
|
72
|
+
leadingIcon: string;
|
|
73
|
+
trailingIcon: string;
|
|
74
|
+
supporting: string[];
|
|
75
|
+
supportingText: string;
|
|
76
|
+
counter: string;
|
|
77
|
+
}, tailwind_variants.TVReturnType<{
|
|
78
|
+
variant: {
|
|
79
|
+
filled: {
|
|
80
|
+
field: string[];
|
|
81
|
+
input: string;
|
|
82
|
+
label: string[];
|
|
83
|
+
};
|
|
84
|
+
outlined: {
|
|
85
|
+
field: string[];
|
|
86
|
+
label: string[];
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
root: string;
|
|
91
|
+
field: string[];
|
|
92
|
+
inputWrap: string;
|
|
93
|
+
input: string[];
|
|
94
|
+
label: string[];
|
|
95
|
+
leadingIcon: string;
|
|
96
|
+
trailingIcon: string;
|
|
97
|
+
supporting: string[];
|
|
98
|
+
supportingText: string;
|
|
99
|
+
counter: string;
|
|
100
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<{
|
|
101
|
+
variant: {
|
|
102
|
+
filled: {
|
|
103
|
+
field: string[];
|
|
104
|
+
input: string;
|
|
105
|
+
label: string[];
|
|
106
|
+
};
|
|
107
|
+
outlined: {
|
|
108
|
+
field: string[];
|
|
109
|
+
label: string[];
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
}, {
|
|
113
|
+
variant: {
|
|
114
|
+
filled: {
|
|
115
|
+
field: string[];
|
|
116
|
+
input: string;
|
|
117
|
+
label: string[];
|
|
118
|
+
};
|
|
119
|
+
outlined: {
|
|
120
|
+
field: string[];
|
|
121
|
+
label: string[];
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
}>, unknown, unknown, undefined>>;
|
|
125
|
+
declare const TextField: react.ForwardRefExoticComponent<_m3_baseui_core.TextFieldOwnProps & Omit<react.InputHTMLAttributes<HTMLInputElement>, "size"> & react.RefAttributes<HTMLInputElement>>;
|
|
126
|
+
|
|
127
|
+
export { TextField, textFieldTv };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createTextField } from '@m3-baseui/core';
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
// src/textfield.ts
|
|
6
|
+
var textFieldTv = tv({
|
|
7
|
+
slots: {
|
|
8
|
+
root: "flex flex-col gap-1 min-w-[210px]",
|
|
9
|
+
field: [
|
|
10
|
+
"relative flex items-stretch gap-3 h-14 px-4 box-border",
|
|
11
|
+
"transition-[border-color,padding] duration-150 ease-standard",
|
|
12
|
+
"group-data-[disabled]:opacity-[0.38] group-data-[disabled]:pointer-events-none"
|
|
13
|
+
],
|
|
14
|
+
inputWrap: "relative flex-1 flex items-center min-w-0",
|
|
15
|
+
input: [
|
|
16
|
+
"peer w-full bg-transparent outline-none border-0 p-0 text-body-large text-on-surface",
|
|
17
|
+
"placeholder:text-on-surface-variant"
|
|
18
|
+
],
|
|
19
|
+
label: [
|
|
20
|
+
"absolute left-0 pointer-events-none origin-left",
|
|
21
|
+
"top-1/2 -translate-y-1/2 text-body-large text-on-surface-variant",
|
|
22
|
+
"transition-all duration-150 ease-standard",
|
|
23
|
+
"group-data-[focused]:text-primary group-data-[invalid]:text-error"
|
|
24
|
+
],
|
|
25
|
+
leadingIcon: "flex items-center shrink-0 text-on-surface-variant",
|
|
26
|
+
trailingIcon: "flex items-center shrink-0 text-on-surface-variant",
|
|
27
|
+
supporting: [
|
|
28
|
+
"flex justify-between gap-4 px-4 text-body-small text-on-surface-variant",
|
|
29
|
+
"group-data-[invalid]:text-error"
|
|
30
|
+
],
|
|
31
|
+
supportingText: "min-w-0",
|
|
32
|
+
counter: "shrink-0 tabular-nums"
|
|
33
|
+
},
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
filled: {
|
|
37
|
+
field: [
|
|
38
|
+
"rounded-t-extra-small bg-surface-container-highest",
|
|
39
|
+
"border-b-2 border-outline",
|
|
40
|
+
"group-data-[focused]:border-primary group-data-[invalid]:border-error"
|
|
41
|
+
],
|
|
42
|
+
input: "pt-3",
|
|
43
|
+
label: [
|
|
44
|
+
"group-data-[focused]:top-1.5 group-data-[focused]:translate-y-0 group-data-[focused]:text-body-small",
|
|
45
|
+
"group-data-[filled]:top-1.5 group-data-[filled]:translate-y-0 group-data-[filled]:text-body-small"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
outlined: {
|
|
49
|
+
field: [
|
|
50
|
+
"rounded-extra-small border border-outline",
|
|
51
|
+
"group-data-[focused]:border-2 group-data-[focused]:border-primary group-data-[focused]:px-[15px]",
|
|
52
|
+
"group-data-[invalid]:border-error"
|
|
53
|
+
],
|
|
54
|
+
label: [
|
|
55
|
+
"group-data-[focused]:top-0 group-data-[focused]:-translate-y-1/2 group-data-[focused]:text-body-small group-data-[focused]:bg-surface group-data-[focused]:px-1",
|
|
56
|
+
"group-data-[filled]:top-0 group-data-[filled]:-translate-y-1/2 group-data-[filled]:text-body-small group-data-[filled]:bg-surface group-data-[filled]:px-1"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
variant: "filled"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var TextField = createTextField(({ variant }) => {
|
|
66
|
+
const c = textFieldTv({ variant });
|
|
67
|
+
return {
|
|
68
|
+
root: c.root(),
|
|
69
|
+
field: c.field(),
|
|
70
|
+
inputWrap: c.inputWrap(),
|
|
71
|
+
input: c.input(),
|
|
72
|
+
label: c.label(),
|
|
73
|
+
leadingIcon: c.leadingIcon(),
|
|
74
|
+
trailingIcon: c.trailingIcon(),
|
|
75
|
+
supporting: c.supporting(),
|
|
76
|
+
supportingText: c.supportingText(),
|
|
77
|
+
counter: c.counter()
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export { TextField, textFieldTv };
|
|
82
|
+
//# sourceMappingURL=textfield.js.map
|
|
83
|
+
//# sourceMappingURL=textfield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/textfield.ts"],"names":[],"mappings":";;;;;AAWO,IAAM,cAAc,EAAA,CAAG;AAAA,EAC5B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,mCAAA;AAAA,IACN,KAAA,EAAO;AAAA,MACL,wDAAA;AAAA,MACA,8DAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,SAAA,EAAW,2CAAA;AAAA,IACX,KAAA,EAAO;AAAA,MACL,sFAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,KAAA,EAAO;AAAA,MACL,iDAAA;AAAA,MACA,kEAAA;AAAA,MACA,2CAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,WAAA,EAAa,oDAAA;AAAA,IACb,YAAA,EAAc,oDAAA;AAAA,IACd,UAAA,EAAY;AAAA,MACV,yEAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,cAAA,EAAgB,SAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ;AAAA,QACN,KAAA,EAAO;AAAA,UACL,oDAAA;AAAA,UACA,2BAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,KAAA,EAAO,MAAA;AAAA,QACP,KAAA,EAAO;AAAA,UACL,sGAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,MACA,QAAA,EAAU;AAAA,QACR,KAAA,EAAO;AAAA,UACL,2CAAA;AAAA,UACA,kGAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,KAAA,EAAO;AAAA,UACL,iKAAA;AAAA,UACA;AAAA;AACF;AACF;AACF,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS;AAAA;AAEb,CAAC;AAEM,IAAM,SAAA,GAAY,eAAA,CAAgB,CAAC,EAAE,SAAQ,KAAM;AACxD,EAAA,MAAM,CAAA,GAAI,WAAA,CAAY,EAAE,OAAA,EAAS,CAAA;AACjC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,IAAA,EAAK;AAAA,IACb,KAAA,EAAO,EAAE,KAAA,EAAM;AAAA,IACf,SAAA,EAAW,EAAE,SAAA,EAAU;AAAA,IACvB,KAAA,EAAO,EAAE,KAAA,EAAM;AAAA,IACf,KAAA,EAAO,EAAE,KAAA,EAAM;AAAA,IACf,WAAA,EAAa,EAAE,WAAA,EAAY;AAAA,IAC3B,YAAA,EAAc,EAAE,YAAA,EAAa;AAAA,IAC7B,UAAA,EAAY,EAAE,UAAA,EAAW;AAAA,IACzB,cAAA,EAAgB,EAAE,cAAA,EAAe;AAAA,IACjC,OAAA,EAAS,EAAE,OAAA;AAAQ,GACrB;AACF,CAAC","file":"textfield.js","sourcesContent":["/**\n * textfield.ts — tailwind-variants slots for the M3 TextField.\n *\n * 56dp tall. The floating label and focus/filled border key off Field's\n * `data-focused` / `data-filled` / `data-invalid` via the `group` on Root.\n * Filled = surface-container-highest with a bottom indicator; outlined = a\n * border that thickens to 2dp primary on focus. Same DOM as the VE build.\n */\nimport { createTextField } from '@m3-baseui/core';\nimport { tv } from 'tailwind-variants';\n\nexport const textFieldTv = tv({\n slots: {\n root: 'flex flex-col gap-1 min-w-[210px]',\n field: [\n 'relative flex items-stretch gap-3 h-14 px-4 box-border',\n 'transition-[border-color,padding] duration-150 ease-standard',\n 'group-data-[disabled]:opacity-[0.38] group-data-[disabled]:pointer-events-none',\n ],\n inputWrap: 'relative flex-1 flex items-center min-w-0',\n input: [\n 'peer w-full bg-transparent outline-none border-0 p-0 text-body-large text-on-surface',\n 'placeholder:text-on-surface-variant',\n ],\n label: [\n 'absolute left-0 pointer-events-none origin-left',\n 'top-1/2 -translate-y-1/2 text-body-large text-on-surface-variant',\n 'transition-all duration-150 ease-standard',\n 'group-data-[focused]:text-primary group-data-[invalid]:text-error',\n ],\n leadingIcon: 'flex items-center shrink-0 text-on-surface-variant',\n trailingIcon: 'flex items-center shrink-0 text-on-surface-variant',\n supporting: [\n 'flex justify-between gap-4 px-4 text-body-small text-on-surface-variant',\n 'group-data-[invalid]:text-error',\n ],\n supportingText: 'min-w-0',\n counter: 'shrink-0 tabular-nums',\n },\n variants: {\n variant: {\n filled: {\n field: [\n 'rounded-t-extra-small bg-surface-container-highest',\n 'border-b-2 border-outline',\n 'group-data-[focused]:border-primary group-data-[invalid]:border-error',\n ],\n input: 'pt-3',\n label: [\n 'group-data-[focused]:top-1.5 group-data-[focused]:translate-y-0 group-data-[focused]:text-body-small',\n 'group-data-[filled]:top-1.5 group-data-[filled]:translate-y-0 group-data-[filled]:text-body-small',\n ],\n },\n outlined: {\n field: [\n 'rounded-extra-small border border-outline',\n 'group-data-[focused]:border-2 group-data-[focused]:border-primary group-data-[focused]:px-[15px]',\n 'group-data-[invalid]:border-error',\n ],\n label: [\n 'group-data-[focused]:top-0 group-data-[focused]:-translate-y-1/2 group-data-[focused]:text-body-small group-data-[focused]:bg-surface group-data-[focused]:px-1',\n 'group-data-[filled]:top-0 group-data-[filled]:-translate-y-1/2 group-data-[filled]:text-body-small group-data-[filled]:bg-surface group-data-[filled]:px-1',\n ],\n },\n },\n },\n defaultVariants: {\n variant: 'filled',\n },\n});\n\nexport const TextField = createTextField(({ variant }) => {\n const c = textFieldTv({ variant });\n return {\n root: c.root(),\n field: c.field(),\n inputWrap: c.inputWrap(),\n input: c.input(),\n label: c.label(),\n leadingIcon: c.leadingIcon(),\n trailingIcon: c.trailingIcon(),\n supporting: c.supporting(),\n supportingText: c.supportingText(),\n counter: c.counter(),\n };\n});\n\nexport type { TextFieldProps, TextFieldVariant } from '@m3-baseui/core';\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as _base_ui_react from '@base-ui/react';
|
|
3
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
4
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
declare const tooltipTv: tailwind_variants.TVReturnType<{
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
+
popup?: tailwind_variants.ClassValue;
|
|
10
|
+
arrow?: tailwind_variants.ClassValue;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
[x: string]: {
|
|
15
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
16
|
+
popup?: tailwind_variants.ClassValue;
|
|
17
|
+
arrow?: tailwind_variants.ClassValue;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | {}, {
|
|
21
|
+
popup: string[];
|
|
22
|
+
arrow: string[];
|
|
23
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
24
|
+
[key: string]: {
|
|
25
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
26
|
+
popup?: tailwind_variants.ClassValue;
|
|
27
|
+
arrow?: tailwind_variants.ClassValue;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
} | {}>, {
|
|
31
|
+
[key: string]: {
|
|
32
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
33
|
+
popup?: tailwind_variants.ClassValue;
|
|
34
|
+
arrow?: tailwind_variants.ClassValue;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
} | {}, {
|
|
38
|
+
popup: string[];
|
|
39
|
+
arrow: string[];
|
|
40
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
41
|
+
popup: string[];
|
|
42
|
+
arrow: string[];
|
|
43
|
+
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
44
|
+
[key: string]: {
|
|
45
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
46
|
+
popup?: tailwind_variants.ClassValue;
|
|
47
|
+
arrow?: tailwind_variants.ClassValue;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
} | {}>, unknown, unknown, undefined>>;
|
|
51
|
+
declare const Tooltip: {
|
|
52
|
+
Provider: react.FC<_base_ui_react.TooltipProviderProps>;
|
|
53
|
+
Root: <Payload>(props: _base_ui_react.TooltipRoot.Props<Payload>) => react.JSX.Element;
|
|
54
|
+
Trigger: _base_ui_react.TooltipTrigger;
|
|
55
|
+
Portal: react.ForwardRefExoticComponent<Omit<_base_ui_react.TooltipPortalProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
Positioner: react.ForwardRefExoticComponent<Omit<_base_ui_react.TooltipPositionerProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
57
|
+
Popup: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TooltipPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<unknown>>;
|
|
58
|
+
Arrow: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.TooltipArrowProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<unknown>>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { Tooltip, tooltipTv };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createTooltip } from '@m3-baseui/core';
|
|
3
|
+
import { tv as tv$1 } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
// src/tooltip.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/tooltip.ts
|
|
35
|
+
var tooltipTv = tv({
|
|
36
|
+
slots: {
|
|
37
|
+
popup: [
|
|
38
|
+
"bg-inverse-surface text-inverse-on-surface text-body-small",
|
|
39
|
+
"rounded-extra-small px-2 py-1 max-w-[224px] select-none",
|
|
40
|
+
"origin-[var(--transform-origin)] transition-[opacity,transform] duration-150 ease-standard",
|
|
41
|
+
"data-[starting-style]:opacity-0 data-[starting-style]:scale-95",
|
|
42
|
+
"data-[ending-style]:opacity-0 data-[ending-style]:scale-95"
|
|
43
|
+
],
|
|
44
|
+
arrow: ["text-inverse-surface"]
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var t = tooltipTv();
|
|
48
|
+
var Tooltip = createTooltip({ popup: t.popup(), arrow: t.arrow() });
|
|
49
|
+
|
|
50
|
+
export { Tooltip, tooltipTv };
|
|
51
|
+
//# sourceMappingURL=tooltip.js.map
|
|
52
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tv.ts","../src/tooltip.ts"],"names":["baseTv"],"mappings":";;;;;AAeA,IAAM,SAAA,GAAY;AAAA,EAChB,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,EAAA,GAAS,CAAC,OAAA,EAAS,MAAA,KAC9BA,KAAO,OAAA,EAAS;AAAA,EACd,GAAG,MAAA;AAAA,EACH,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,MACN,WAAA,EAAa;AAAA,QACX,WAAA,EAAa,CAAC,EAAE,IAAA,EAAM,CAAC,GAAG,SAAS,GAAG;AAAA;AACxC;AACF;AAEJ,CAAC,CAAA;;;ACjCI,IAAM,YAAY,EAAA,CAAG;AAAA,EAC1B,KAAA,EAAO;AAAA,IACL,KAAA,EAAO;AAAA,MACL,4DAAA;AAAA,MACA,yDAAA;AAAA,MACA,4FAAA;AAAA,MACA,gEAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,KAAA,EAAO,CAAC,sBAAsB;AAAA;AAElC,CAAC;AAED,IAAM,IAAI,SAAA,EAAU;AACb,IAAM,OAAA,GAAU,aAAA,CAAc,EAAE,KAAA,EAAO,CAAA,CAAE,KAAA,EAAM,EAAG,KAAA,EAAO,CAAA,CAAE,KAAA,EAAM,EAAG","file":"tooltip.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 * tooltip.ts — Tailwind classes for the M3 plain Tooltip.\n *\n * Inverse-surface background, body-small text, extra-small corners, with a fade\n * + small-move transition driven by Base UI's data-[starting-style] /\n * data-[ending-style] attributes.\n */\nimport { createTooltip } from '@m3-baseui/core';\nimport { tv } from './tv';\n\nexport const tooltipTv = tv({\n slots: {\n popup: [\n 'bg-inverse-surface text-inverse-on-surface text-body-small',\n 'rounded-extra-small px-2 py-1 max-w-[224px] select-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 data-[ending-style]:scale-95',\n ],\n arrow: ['text-inverse-surface'],\n },\n});\n\nconst t = tooltipTv();\nexport const Tooltip = createTooltip({ popup: t.popup(), arrow: t.arrow() });\n"]}
|
package/dist/tv.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TV } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* tv.ts — a tailwind-variants factory pre-configured for the M3 typescale.
|
|
5
|
+
*
|
|
6
|
+
* The Tailwind v4 preset exposes the 15 typescale roles as `text-<role>`
|
|
7
|
+
* font-size utilities (e.g. `text-body-small`, `text-label-large`). Stock
|
|
8
|
+
* tailwind-merge does not know these custom names, so it groups them with the
|
|
9
|
+
* `text-<color>` utilities and drops one when a slot sets both a color *and* a
|
|
10
|
+
* typescale (the common M3 case). That silently strips either the color or the
|
|
11
|
+
* type, breaking token compliance.
|
|
12
|
+
*
|
|
13
|
+
* Teaching tailwind-merge that the typescale names belong to the `font-size`
|
|
14
|
+
* group keeps color and type independent, so both survive the merge.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare const tv: TV;
|
|
18
|
+
|
|
19
|
+
export { tv };
|
package/dist/tv.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tv as tv$1 } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
// src/tv.ts
|
|
5
|
+
var TYPESCALE = [
|
|
6
|
+
"display-large",
|
|
7
|
+
"display-medium",
|
|
8
|
+
"display-small",
|
|
9
|
+
"headline-large",
|
|
10
|
+
"headline-medium",
|
|
11
|
+
"headline-small",
|
|
12
|
+
"title-large",
|
|
13
|
+
"title-medium",
|
|
14
|
+
"title-small",
|
|
15
|
+
"body-large",
|
|
16
|
+
"body-medium",
|
|
17
|
+
"body-small",
|
|
18
|
+
"label-large",
|
|
19
|
+
"label-medium",
|
|
20
|
+
"label-small"
|
|
21
|
+
];
|
|
22
|
+
var tv = (options, config) => tv$1(options, {
|
|
23
|
+
...config,
|
|
24
|
+
twMergeConfig: {
|
|
25
|
+
extend: {
|
|
26
|
+
classGroups: {
|
|
27
|
+
"font-size": [{ text: [...TYPESCALE] }]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { tv };
|
|
34
|
+
//# sourceMappingURL=tv.js.map
|
|
35
|
+
//# sourceMappingURL=tv.js.map
|
package/dist/tv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tv.ts"],"names":["baseTv"],"mappings":";;;;AAeA,IAAM,SAAA,GAAY;AAAA,EAChB,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,EAAA,GAAS,CAAC,OAAA,EAAS,MAAA,KAC9BA,KAAO,OAAA,EAAS;AAAA,EACd,GAAG,MAAA;AAAA,EACH,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,MACN,WAAA,EAAa;AAAA,QACX,WAAA,EAAa,CAAC,EAAE,IAAA,EAAM,CAAC,GAAG,SAAS,GAAG;AAAA;AACxC;AACF;AAEJ,CAAC","file":"tv.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"]}
|