@nxgt/material 3.10.1 → 3.11.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/CHANGELOG.md +76 -0
- package/README.md +4 -4
- package/dist/{async-slice-DDjaJY_F.js → async-slice-4qbER86I.js} +1 -1
- package/dist/button-BNjw-pnE.js +327 -0
- package/dist/button-group-context-CaP0X5p_.js +5 -0
- package/dist/{button-tones-BgZJ1tkD.js → button-tones-BwuVvAmd.js} +9 -1
- package/dist/{callout-view-DdJPdFrP.js → callout-view-C6voDS00.js} +1 -1
- package/dist/charts.js +5 -5
- package/dist/{chip-DpySRqCy.js → chip-DLgQTJBZ.js} +4 -4
- package/dist/{code-editor-BiA14xua.js → code-editor-BZbaYLvo.js} +8 -8
- package/dist/code-editor.js +7 -7
- package/dist/{code-language-items-C_dJ6GVs.js → code-language-items-BT5BO5w6.js} +2 -2
- package/dist/components/base.css +21 -6
- package/dist/components/components.css +5 -2
- package/dist/components/type-scale.css +194 -0
- package/dist/components/ui/actions/button/button.css +156 -0
- package/dist/components/ui/actions/button-group/button-group-standard.css +131 -0
- package/dist/components/ui/actions/button-group/button-group.css +4 -1
- package/dist/components/ui/actions/icon-button/icon-button.css +115 -0
- package/dist/components/ui/actions/morph-fill.css +62 -0
- package/dist/{components-fqz7csN3.js → components-1GK7YIhY.js} +14685 -14688
- package/dist/components.js +23 -23
- package/dist/{dialog-CkIYpJXk.js → dialog-BQp5IdFl.js} +147 -147
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-BC5Tbhb9.js → dropdown-menu-BsH9W_3C.js} +3 -3
- package/dist/editor-viewer.js +1 -1
- package/dist/editor.js +13 -13
- package/dist/empty-state-WaU4-T2c.js +117 -0
- package/dist/escape-owner-C4W_sOAU.js +116 -0
- package/dist/{field-blur-DPLsMufs.js → field-blur-CJHzVSh9.js} +1 -1
- package/dist/{field-blur-context-1ZwJgsHE.js → field-blur-context-Cft9s7Hg.js} +2 -2
- package/dist/{hover-card-Cox-tPDz.js → hover-card-C0fw2kLK.js} +72 -71
- package/dist/i18n.js +12 -12
- package/dist/{icon-badge-q3Ve8gra.js → icon-badge-DUAq9f7H.js} +4 -4
- package/dist/icon-button-ifTpXt0A.js +355 -0
- package/dist/{illustration-Hj-Q9se9.js → illustration-BmQmvW_4.js} +36 -30
- package/dist/illustrations.js +2 -2
- package/dist/lib/components/ui/actions/button/button-tones.d.ts +16 -0
- package/dist/lib/components/ui/actions/button/button.d.ts +13 -0
- package/dist/lib/components/ui/actions/button/button.variants.d.ts +4 -3
- package/dist/lib/components/ui/actions/button-group/button-group-context.d.ts +16 -0
- package/dist/lib/components/ui/actions/button-group/button-group-reset.d.ts +13 -0
- package/dist/lib/components/ui/actions/button-group/button-group.d.ts +19 -2
- package/dist/lib/components/ui/actions/icon-button/icon-button-shape.d.ts +3 -2
- package/dist/lib/components/ui/actions/icon-button/icon-button.d.ts +18 -4
- package/dist/lib/components/ui/actions/icon-button/icon-button.variants.d.ts +34 -4
- package/dist/lib/components/ui/feedback/state-frame/state-scene-illustration.d.ts +4 -2
- package/dist/lib/components/ui/feedback/typing-indicator/typing-indicator.d.ts +1 -1
- package/dist/lib/components/ui/fields/slider/split-slider-props.d.ts +1 -1
- package/dist/lib/components/ui/fields/slider/use-slider-control.d.ts +1 -1
- package/dist/lib/components/ui/overlays/dialog/dialog-variants.d.ts +1 -1
- package/dist/lib/components/ui/primitives/toggle/toggle.d.ts +1 -1
- package/dist/lib/components/ui/primitives/typography/typography.d.ts +17 -7
- package/dist/lib/components/ui/primitives/typography/typography.variants.d.ts +55 -0
- package/dist/lib/components/ui/selection/choice-group/use-choice-group-field.d.ts +2 -2
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/illustrations/lazy-chunk.d.ts +9 -0
- package/dist/lib.js +2 -2
- package/dist/{line-path-BQeLQZ-P.js → line-path-C5pZGC49.js} +1 -1
- package/dist/main.js +29 -29
- package/dist/map.js +9 -9
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{plated-illustration-B7fcgOED.js → plated-illustration-iNO6KYTL.js} +9 -2
- package/dist/print.js +1 -1
- package/dist/{public-Cl4dLDHQ.js → public-B0Nq_yYV.js} +524 -524
- package/dist/{render-json-DyFYFIkZ.js → render-json-BOhvPnSv.js} +1 -1
- package/dist/{rich-code-block-C2Fp_FDU.js → rich-code-block-v7WmeZp9.js} +5 -5
- package/dist/{rich-text-viewer-LO1IZCWs.js → rich-text-viewer-W15XIwah.js} +2 -2
- package/dist/{skeleton-Bmp4gWAH.js → skeleton-DSdtr2qc.js} +1 -1
- package/dist/{sortable-provider-pVaEZzty.js → sortable-provider-CgDTolQR.js} +3 -3
- package/dist/{spinner-CsHcmcpF.js → spinner-BtSIYVrC.js} +3 -3
- package/dist/{state-scenes-Be9w_3an.js → state-scenes-BX03WmSu.js} +54 -41
- package/dist/styles.css +2 -0
- package/dist/theme-picker.js +3 -3
- package/dist/{theme-toggle-oU-fh6WE.js → theme-toggle-B2Pehdhn.js} +2 -2
- package/dist/{toggle-group-j8zaxEg1.js → toggle-group-BMJNcFAC.js} +1 -1
- package/dist/{toolbar-items-CqHvlTU8.js → toolbar-items-rUHdVqAq.js} +399 -398
- package/dist/{tooltip-rhbqNmr3.js → tooltip-CkttDIab.js} +1 -1
- package/dist/{translate-material-CGZljjp1.js → translate-material-Bd_KgfB8.js} +1 -1
- package/dist/{translator-DCYO4Ij3.js → translator-Dje8HrNz.js} +5 -5
- package/dist/{use-chat-composer-UHlGFSm0.js → use-chat-composer-Bt2ULsv6.js} +4172 -4172
- package/dist/{use-material-translation-DkxcLbLM.js → use-material-translation-B3V_bz-5.js} +1 -1
- package/dist/{utils-Bcd2Z3ea.js → utils-BLfntITJ.js} +14 -1
- package/docs/components/buttons-and-actions.md +64 -15
- package/docs/components/navigation-and-layout.md +1 -1
- package/docs/components/primitives.md +52 -10
- package/docs/guides/illustrations.md +12 -0
- package/docs/guides/theming.md +51 -0
- package/docs/previews/buttons-actions-button.webp +0 -0
- package/docs/previews/buttons-actions-iconbutton.webp +0 -0
- package/docs/previews/feedback-status-circularprogress.webp +0 -0
- package/docs/previews/feedback-status-hydrateloading.webp +0 -0
- package/docs/previews/feedback-status-notifications.webp +0 -0
- package/docs/previews/feedback-status-progress.webp +0 -0
- package/docs/previews/feedback-status-skeleton.webp +0 -0
- package/docs/previews/feedback-status-spinner.webp +0 -0
- package/docs/previews/feedback-status-typingindicator.webp +0 -0
- package/docs/previews/primitives-typography.webp +0 -0
- package/docs/roadmap.md +35 -4
- package/docs/troubleshooting.md +71 -2
- package/lib/components/base.css +21 -6
- package/lib/components/components.css +5 -2
- package/lib/components/type-scale.css +194 -0
- package/lib/components/ui/actions/button/button.css +156 -0
- package/lib/components/ui/actions/button-group/button-group-standard.css +131 -0
- package/lib/components/ui/actions/button-group/button-group.css +4 -1
- package/lib/components/ui/actions/icon-button/icon-button.css +115 -0
- package/lib/components/ui/actions/morph-fill.css +62 -0
- package/lib/styles.css +2 -0
- package/package.json +1 -1
- package/dist/button-DbfdITBB.js +0 -322
- package/dist/components/ui/actions/icon-button/icon-button-morph-media.css +0 -65
- package/dist/components/ui/actions/icon-button/icon-button-morph.css +0 -152
- package/dist/empty-state-BOZWBC5q.js +0 -98
- package/dist/escape-owner-CripBce_.js +0 -57
- package/dist/icon-button-DJcWpIhu.js +0 -319
- package/lib/components/ui/actions/icon-button/icon-button-morph-media.css +0 -65
- package/lib/components/ui/actions/icon-button/icon-button-morph.css +0 -152
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
+
import { n as t } from "./use-shape-morph-BKA_R5P5.js";
|
|
3
|
+
import { n, t as r } from "./dist-DVRQkaTK.js";
|
|
4
|
+
import { o as i, t as a } from "./tooltip-CkttDIab.js";
|
|
5
|
+
import { t as o } from "./is-production-GLw59WU8.js";
|
|
6
|
+
import { a as s, i as c, n as l, r as u, t as d } from "./button-tones-BwuVvAmd.js";
|
|
7
|
+
import { t as f } from "./button-group-context-CaP0X5p_.js";
|
|
8
|
+
import { shapeOutline as p, toSvgPath as m } from "@nxgt/material-core/shapes";
|
|
9
|
+
import { useContext as h, useEffect as g, useRef as _ } from "react";
|
|
10
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
11
|
+
//#region lib/components/ui/actions/icon-button/icon-button.compound-variants.ts
|
|
12
|
+
var b = [
|
|
13
|
+
{
|
|
14
|
+
variant: "filled",
|
|
15
|
+
color: "primary",
|
|
16
|
+
class: "bg-primary text-primary-foreground [&_svg]:data-[slot=icon]:text-primary-foreground [&_svg]:stroke-primary-foreground hover:bg-[color-mix(in_oklab,var(--color-primary)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-primary)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-primary)_85%,black)]"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
variant: "filled",
|
|
20
|
+
color: "secondary",
|
|
21
|
+
class: "bg-secondary text-secondary-foreground [&_svg]:data-[slot=icon]:text-secondary-foreground [&_svg]:stroke-secondary-foreground hover:bg-[color-mix(in_oklab,var(--color-secondary)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-secondary)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-secondary)_85%,black)] dark:bg-[color-mix(in_oklab,var(--color-secondary)_70%,var(--color-background))] dark:hover:bg-[color-mix(in_oklab,var(--color-secondary)_60%,var(--color-background))] dark:active:bg-[color-mix(in_oklab,var(--color-secondary)_50%,var(--color-background))] dark:focus:bg-[color-mix(in_oklab,var(--color-secondary)_60%,var(--color-background))]"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
variant: "filled",
|
|
25
|
+
color: "success",
|
|
26
|
+
class: "bg-success text-success-foreground [&_svg]:data-[slot=icon]:text-success-foreground [&_svg]:stroke-success-foreground hover:bg-[color-mix(in_oklab,var(--color-success)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-success)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-success)_85%,black)] dark:bg-[color-mix(in_oklab,var(--color-success)_60%,var(--color-background))] dark:hover:bg-[color-mix(in_oklab,var(--color-success)_50%,var(--color-background))] dark:active:bg-[color-mix(in_oklab,var(--color-success)_40%,var(--color-background))] dark:focus:bg-[color-mix(in_oklab,var(--color-success)_50%,var(--color-background))]"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
variant: "filled",
|
|
30
|
+
color: "info",
|
|
31
|
+
class: "bg-info text-info-foreground [&_svg]:data-[slot=icon]:text-info-foreground [&_svg]:stroke-info-foreground hover:bg-[color-mix(in_oklab,var(--color-info)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-info)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-info)_85%,black)] dark:bg-[color-mix(in_oklab,var(--color-info)_60%,var(--color-background))] dark:hover:bg-[color-mix(in_oklab,var(--color-info)_50%,var(--color-background))] dark:active:bg-[color-mix(in_oklab,var(--color-info)_40%,var(--color-background))] dark:focus:bg-[color-mix(in_oklab,var(--color-info)_50%,var(--color-background))]"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
variant: "filled",
|
|
35
|
+
color: "warning",
|
|
36
|
+
class: "bg-warning text-warning-foreground [&_svg]:data-[slot=icon]:text-warning-foreground [&_svg]:stroke-warning-foreground hover:bg-[color-mix(in_oklab,var(--color-warning)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-warning)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-warning)_85%,black)] dark:bg-[color-mix(in_oklab,var(--color-warning)_60%,var(--color-background))] dark:hover:bg-[color-mix(in_oklab,var(--color-warning)_50%,var(--color-background))] dark:active:bg-[color-mix(in_oklab,var(--color-warning)_40%,var(--color-background))] dark:focus:bg-[color-mix(in_oklab,var(--color-warning)_50%,var(--color-background))]"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
variant: "filled",
|
|
40
|
+
color: "error",
|
|
41
|
+
class: "bg-error text-error-foreground [&_svg]:data-[slot=icon]:text-error-foreground [&_svg]:stroke-error-foreground hover:bg-[color-mix(in_oklab,var(--color-error)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-error)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-error)_85%,black)]"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
variant: "filled",
|
|
45
|
+
color: "default",
|
|
46
|
+
class: "bg-foreground text-background [&_svg]:data-[slot=icon]:text-background [&_svg]:stroke-background hover:bg-[color-mix(in_oklab,var(--color-foreground)_90%,var(--color-background))] active:bg-[color-mix(in_oklab,var(--color-foreground)_70%,var(--color-background))] focus:bg-[color-mix(in_oklab,var(--color-foreground)_80%,var(--color-background))]"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
variant: "tonal",
|
|
50
|
+
color: "primary",
|
|
51
|
+
class: `${u.primary} ${d.primary} ${l.primary} bg-primary/15 hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
variant: "tonal",
|
|
55
|
+
color: "secondary",
|
|
56
|
+
class: `${u.secondary} ${d.secondary} ${l.secondary} bg-secondary/15 hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
variant: "tonal",
|
|
60
|
+
color: "success",
|
|
61
|
+
class: `${u.success} ${d.success} ${l.success} bg-success/15 hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
variant: "tonal",
|
|
65
|
+
color: "info",
|
|
66
|
+
class: `${u.info} ${d.info} ${l.info} bg-info/15 hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
variant: "tonal",
|
|
70
|
+
color: "warning",
|
|
71
|
+
class: `${u.warning} ${d.warning} ${l.warning} bg-warning/15 hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
variant: "tonal",
|
|
75
|
+
color: "error",
|
|
76
|
+
class: `${u.error} ${d.error} ${l.error} bg-error/15 hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
variant: "tonal",
|
|
80
|
+
color: "default",
|
|
81
|
+
class: `${u.default} ${d.default} ${l.default} bg-foreground/15 hover:bg-foreground/10 active:bg-muted focus:bg-muted`
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
variant: "ghost",
|
|
85
|
+
color: "primary",
|
|
86
|
+
class: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
variant: "ghost",
|
|
90
|
+
color: "default",
|
|
91
|
+
class: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
color: "secondary",
|
|
96
|
+
class: `${u.secondary} ${d.secondary} ${l.secondary} hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
variant: "ghost",
|
|
100
|
+
color: "success",
|
|
101
|
+
class: `${u.success} ${d.success} ${l.success} hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
variant: "ghost",
|
|
105
|
+
color: "info",
|
|
106
|
+
class: `${u.info} ${d.info} ${l.info} hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
variant: "ghost",
|
|
110
|
+
color: "warning",
|
|
111
|
+
class: `${u.warning} ${d.warning} ${l.warning} hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
color: "error",
|
|
116
|
+
class: `${u.error} ${d.error} ${l.error} hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
variant: "outlined",
|
|
120
|
+
color: "primary",
|
|
121
|
+
class: `${u.primary} ${d.primary} ${l.primary} focus:bg-primary/10 hover:bg-primary/10`
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
variant: "outlined",
|
|
125
|
+
color: "secondary",
|
|
126
|
+
class: `${u.secondary} ${d.secondary} ${l.secondary} focus:bg-secondary/10 hover:bg-secondary/10`
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
variant: "outlined",
|
|
130
|
+
color: "success",
|
|
131
|
+
class: `${u.success} ${d.success} ${l.success} focus:bg-success/10 hover:bg-success/10`
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
variant: "outlined",
|
|
135
|
+
color: "info",
|
|
136
|
+
class: `${u.info} ${d.info} ${l.info} focus:bg-info/10 hover:bg-info/10`
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
variant: "outlined",
|
|
140
|
+
color: "warning",
|
|
141
|
+
class: `${u.warning} ${d.warning} ${l.warning} focus:bg-warning/10 hover:bg-warning/10`
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
variant: "outlined",
|
|
145
|
+
color: "error",
|
|
146
|
+
class: `${u.error} ${d.error} ${l.error} focus:bg-error/10 hover:bg-error/10`
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
variant: "outlined",
|
|
150
|
+
color: "default",
|
|
151
|
+
class: `${u.default} ${d.default} ${l.default} focus:bg-foreground/10 hover:bg-foreground/10`
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
variant: "link",
|
|
155
|
+
color: "primary",
|
|
156
|
+
class: `${u.primary} ${d.primary} ${l.primary} underline-offset-4 hover:underline hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
variant: "link",
|
|
160
|
+
color: "secondary",
|
|
161
|
+
class: `${u.secondary} ${d.secondary} ${l.secondary} underline-offset-4 hover:underline hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
variant: "link",
|
|
165
|
+
color: "success",
|
|
166
|
+
class: `${u.success} ${d.success} ${l.success} underline-offset-4 hover:underline hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
variant: "link",
|
|
170
|
+
color: "info",
|
|
171
|
+
class: `${u.info} ${d.info} ${l.info} underline-offset-4 hover:underline hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
variant: "link",
|
|
175
|
+
color: "warning",
|
|
176
|
+
class: `${u.warning} ${d.warning} ${l.warning} underline-offset-4 hover:underline hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
variant: "link",
|
|
180
|
+
color: "error",
|
|
181
|
+
class: `${u.error} ${d.error} ${l.error} underline-offset-4 hover:underline hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
variant: "link",
|
|
185
|
+
color: "default",
|
|
186
|
+
class: `${u.default} ${d.default} ${l.default} underline-offset-4 hover:underline hover:bg-foreground/10 active:bg-muted focus:bg-foreground/10`
|
|
187
|
+
}
|
|
188
|
+
], x = i("inline-flex center gap-2 cursor-pointer whitespace-nowrap text-sm font-medium disabled:pointer-events-none [&_svg]:bg-transparent [&_svg]:text-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-(--btn-ic,1rem) shrink-0 [&_svg]:shrink-0", {
|
|
189
|
+
variants: {
|
|
190
|
+
look: {
|
|
191
|
+
btn: "nxgt-btn nxgt-morph-fill aria-invalid:[--btn-focus:var(--color-error)] aria-invalid:[--btn-line:var(--color-error)]",
|
|
192
|
+
shaped: "transition-all disabled:opacity-50 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error aspect-square rounded-full"
|
|
193
|
+
},
|
|
194
|
+
size: {
|
|
195
|
+
legacy: "h-9 w-[calc(2.25rem*var(--ib-k,1))] [--btn-h:2.25rem] [--btn-sq:10px] [--btn-ic:1rem] has-[[data-slot=icon]]:p-1.5",
|
|
196
|
+
xs: "h-(--btn-h) w-[calc(var(--btn-h)*var(--ib-k,1))] [--btn-h:24px] [--btn-sq:6px] [--btn-ic:14px]",
|
|
197
|
+
sm: "h-(--btn-h) w-[calc(var(--btn-h)*var(--ib-k,1))] [--btn-h:32px] [--btn-sq:8px] [--btn-ic:16px]",
|
|
198
|
+
default: "h-(--btn-h) w-[calc(var(--btn-h)*var(--ib-k,1))] [--btn-h:36px] [--btn-sq:10px] [--btn-ic:18px]",
|
|
199
|
+
lg: "h-(--btn-h) w-[calc(var(--btn-h)*var(--ib-k,1))] [--btn-h:40px] [--btn-sq:12px] [--btn-ic:20px]",
|
|
200
|
+
xl: "h-(--btn-h) w-[calc(var(--btn-h)*var(--ib-k,1))] [--btn-h:56px] [--btn-sq:16px] [--btn-ic:28px]"
|
|
201
|
+
},
|
|
202
|
+
width: {
|
|
203
|
+
narrow: "[--ib-k:0.78]",
|
|
204
|
+
default: "",
|
|
205
|
+
wide: "[--ib-k:1.45]"
|
|
206
|
+
},
|
|
207
|
+
variant: {
|
|
208
|
+
filled: "bg-primary text-primary-foreground [&_svg]:data-[slot=icon]:text-primary-foreground [&_svg]:stroke-primary-foreground hover:bg-[color-mix(in_oklab,var(--color-primary)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-primary)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-primary)_85%,black)]",
|
|
209
|
+
tonal: "bg-primary/15 [&_svg]:data-[slot=icon]:text-primary-text [&_svg]:stroke-primary-text text-primary-text hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10",
|
|
210
|
+
ghost: "nxgt-btn-bare",
|
|
211
|
+
outlined: "shadow-[inset_0_0_0_1.5px_color-mix(in_oklab,var(--btn-line,currentColor)_55%,transparent)] text-primary-text [&_svg]:data-[slot=icon]:text-primary-text [&_svg]:stroke-primary-text focus:bg-primary/10 hover:bg-primary/10",
|
|
212
|
+
link: "nxgt-btn-bare text-primary-text [&_svg]:data-[slot=icon]:text-primary-text [&_svg]:stroke-primary-text underline-offset-4 hover:underline hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10 focus:underline"
|
|
213
|
+
},
|
|
214
|
+
color: c
|
|
215
|
+
},
|
|
216
|
+
defaultVariants: {
|
|
217
|
+
variant: "filled",
|
|
218
|
+
color: "primary",
|
|
219
|
+
look: "btn",
|
|
220
|
+
size: "legacy",
|
|
221
|
+
width: "default"
|
|
222
|
+
},
|
|
223
|
+
compoundVariants: [...b, {
|
|
224
|
+
look: "btn",
|
|
225
|
+
size: "legacy",
|
|
226
|
+
width: "default",
|
|
227
|
+
class: "[--btn-round:50%]"
|
|
228
|
+
}]
|
|
229
|
+
});
|
|
230
|
+
function S(e) {
|
|
231
|
+
return (t) => x({
|
|
232
|
+
...t,
|
|
233
|
+
look: e,
|
|
234
|
+
size: t?.size ?? "legacy",
|
|
235
|
+
color: t?.variant === "ghost" && t.color == null ? "default" : t?.color
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
var C = S("btn"), w = S("shaped"), T = {
|
|
239
|
+
filled: {
|
|
240
|
+
primary: "fill-primary",
|
|
241
|
+
secondary: "fill-secondary dark:fill-[color-mix(in_oklab,var(--color-secondary)_70%,var(--color-background))]",
|
|
242
|
+
success: "fill-success dark:fill-[color-mix(in_oklab,var(--color-success)_60%,var(--color-background))]",
|
|
243
|
+
info: "fill-info dark:fill-[color-mix(in_oklab,var(--color-info)_60%,var(--color-background))]",
|
|
244
|
+
warning: "fill-warning dark:fill-[color-mix(in_oklab,var(--color-warning)_60%,var(--color-background))]",
|
|
245
|
+
error: "fill-error",
|
|
246
|
+
default: "fill-foreground"
|
|
247
|
+
},
|
|
248
|
+
tonal: {
|
|
249
|
+
primary: "fill-primary/15 group-hover/icon-button:fill-primary/10 group-active/icon-button:fill-primary/5",
|
|
250
|
+
secondary: "fill-secondary/15 group-hover/icon-button:fill-secondary/10 group-active/icon-button:fill-secondary/5",
|
|
251
|
+
success: "fill-success/15 group-hover/icon-button:fill-success/10 group-active/icon-button:fill-success/5",
|
|
252
|
+
info: "fill-info/15 group-hover/icon-button:fill-info/10 group-active/icon-button:fill-info/5",
|
|
253
|
+
warning: "fill-warning/15 group-hover/icon-button:fill-warning/10 group-active/icon-button:fill-warning/5",
|
|
254
|
+
error: "fill-error/15 group-hover/icon-button:fill-error/10 group-active/icon-button:fill-error/5",
|
|
255
|
+
default: "fill-foreground/15 group-hover/icon-button:fill-foreground/10 group-active/icon-button:fill-foreground/5"
|
|
256
|
+
},
|
|
257
|
+
outlined: {
|
|
258
|
+
primary: "fill-transparent stroke-primary/50 group-hover/icon-button:fill-primary/10 group-active/icon-button:fill-primary/5",
|
|
259
|
+
secondary: "fill-transparent stroke-secondary/50 group-hover/icon-button:fill-secondary/10 group-active/icon-button:fill-secondary/5",
|
|
260
|
+
success: "fill-transparent stroke-success/50 group-hover/icon-button:fill-success/10 group-active/icon-button:fill-success/5",
|
|
261
|
+
info: "fill-transparent stroke-info/50 group-hover/icon-button:fill-info/10 group-active/icon-button:fill-info/5",
|
|
262
|
+
warning: "fill-transparent stroke-warning/50 group-hover/icon-button:fill-warning/10 group-active/icon-button:fill-warning/5",
|
|
263
|
+
error: "fill-transparent stroke-error/50 group-hover/icon-button:fill-error/10 group-active/icon-button:fill-error/5",
|
|
264
|
+
default: "fill-transparent stroke-foreground/50 group-hover/icon-button:fill-foreground/10 group-active/icon-button:fill-foreground/5"
|
|
265
|
+
},
|
|
266
|
+
ghost: {
|
|
267
|
+
primary: "fill-transparent group-hover/icon-button:fill-accent dark:group-hover/icon-button:fill-accent/50",
|
|
268
|
+
secondary: "fill-transparent group-hover/icon-button:fill-secondary/10 group-active/icon-button:fill-secondary/5",
|
|
269
|
+
success: "fill-transparent group-hover/icon-button:fill-success/10 group-active/icon-button:fill-success/5",
|
|
270
|
+
info: "fill-transparent group-hover/icon-button:fill-info/10 group-active/icon-button:fill-info/5",
|
|
271
|
+
warning: "fill-transparent group-hover/icon-button:fill-warning/10 group-active/icon-button:fill-warning/5",
|
|
272
|
+
error: "fill-transparent group-hover/icon-button:fill-error/10 group-active/icon-button:fill-error/5",
|
|
273
|
+
default: "fill-transparent group-hover/icon-button:fill-accent dark:group-hover/icon-button:fill-accent/50"
|
|
274
|
+
},
|
|
275
|
+
link: {
|
|
276
|
+
primary: "fill-transparent group-hover/icon-button:fill-accent dark:group-hover/icon-button:fill-accent/50",
|
|
277
|
+
secondary: "fill-transparent group-hover/icon-button:fill-secondary/10 group-active/icon-button:fill-secondary/5",
|
|
278
|
+
success: "fill-transparent group-hover/icon-button:fill-success/10 group-active/icon-button:fill-success/5",
|
|
279
|
+
info: "fill-transparent group-hover/icon-button:fill-info/10 group-active/icon-button:fill-info/5",
|
|
280
|
+
warning: "fill-transparent group-hover/icon-button:fill-warning/10 group-active/icon-button:fill-warning/5",
|
|
281
|
+
error: "fill-transparent group-hover/icon-button:fill-error/10 group-active/icon-button:fill-error/5",
|
|
282
|
+
default: "fill-transparent group-hover/icon-button:fill-accent dark:group-hover/icon-button:fill-accent/50"
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
function E({ shape: n, variant: r, color: i }) {
|
|
286
|
+
let a = p(n), o = _(null);
|
|
287
|
+
return t(o, a, !0), /* @__PURE__ */ v("svg", {
|
|
288
|
+
"data-slot": "icon-button-shape",
|
|
289
|
+
viewBox: "0 0 100 100",
|
|
290
|
+
"aria-hidden": "true",
|
|
291
|
+
focusable: "false",
|
|
292
|
+
className: e("-z-10 pointer-events-none absolute inset-0 size-full overflow-visible transition-[filter]", r === "filled" && "group-hover/icon-button:brightness-90 group-active/icon-button:brightness-80"),
|
|
293
|
+
children: /* @__PURE__ */ v("path", {
|
|
294
|
+
ref: o,
|
|
295
|
+
d: m(a),
|
|
296
|
+
vectorEffect: "non-scaling-stroke",
|
|
297
|
+
paintOrder: "stroke",
|
|
298
|
+
className: e("stroke-transparent stroke-1 transition-[fill]", T[r][i], "group-focus-visible/icon-button:stroke-ring/50 group-focus-visible/icon-button:stroke-[6px]", "forced-colors:fill-none forced-colors:stroke-[ButtonText] forced-colors:group-focus-visible/icon-button:stroke-[Highlight]")
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region lib/components/ui/actions/icon-button/icon-button.tsx
|
|
304
|
+
function D({ variant: t, color: i, size: a, width: c, className: l, asChild: u, type: d = "button", shape: p, morph: m = "pill", children: _, ...b }) {
|
|
305
|
+
let x = u ? r : "button", S = h(f), T = a ?? S, D = !!(b["aria-label"] || b["aria-labelledby"]), O = !!p && c != null && c !== "default";
|
|
306
|
+
g(() => {
|
|
307
|
+
O && !o() && console.warn("IconButton: `width` is ignored with `shape`; a shaped button is as wide as it is high.");
|
|
308
|
+
}, [O]);
|
|
309
|
+
let k = !p && m !== "none" && b["aria-pressed"] !== void 0, A = b["aria-pressed"] === !0 || b["aria-pressed"] === "true";
|
|
310
|
+
return /* @__PURE__ */ v(s, {
|
|
311
|
+
value: D,
|
|
312
|
+
children: /* @__PURE__ */ y(x, {
|
|
313
|
+
"data-slot": "icon-button",
|
|
314
|
+
"data-icon-button": "",
|
|
315
|
+
"data-variant": t ?? "filled",
|
|
316
|
+
"data-color": i,
|
|
317
|
+
type: u ? void 0 : d,
|
|
318
|
+
"data-size": T,
|
|
319
|
+
"data-shape": p,
|
|
320
|
+
"data-morph": k ? m : void 0,
|
|
321
|
+
"data-selected": k && A ? "true" : void 0,
|
|
322
|
+
className: e(p ? w({
|
|
323
|
+
variant: t,
|
|
324
|
+
color: i,
|
|
325
|
+
size: T
|
|
326
|
+
}) : C({
|
|
327
|
+
variant: t,
|
|
328
|
+
color: i,
|
|
329
|
+
size: T,
|
|
330
|
+
width: c
|
|
331
|
+
}), p && "group/icon-button nxgt-touch-target relative isolate bg-transparent! border-0! shadow-none! ring-0! focus-visible:ring-0! aria-invalid:ring-0! forced-colors:[&_svg]:stroke-[ButtonText] forced-colors:[&_svg]:text-[ButtonText]", l),
|
|
332
|
+
...b,
|
|
333
|
+
children: [p ? /* @__PURE__ */ v(E, {
|
|
334
|
+
shape: p,
|
|
335
|
+
variant: t ?? "filled",
|
|
336
|
+
color: i ?? (t === "ghost" ? "default" : "primary")
|
|
337
|
+
}) : null, /* @__PURE__ */ v(n, { children: _ })]
|
|
338
|
+
})
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function O({ tooltip: e, "aria-label": t, ...n }) {
|
|
342
|
+
let r = t ?? (typeof e == "string" ? e : void 0);
|
|
343
|
+
return e ? /* @__PURE__ */ v(a, {
|
|
344
|
+
content: e,
|
|
345
|
+
children: /* @__PURE__ */ v(D, {
|
|
346
|
+
"aria-label": r,
|
|
347
|
+
...n
|
|
348
|
+
})
|
|
349
|
+
}) : /* @__PURE__ */ v(D, {
|
|
350
|
+
"aria-label": r,
|
|
351
|
+
...n
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
export { C as n, O as t };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { r as e } from "./rolldown-runtime-BFFgcFxR.js";
|
|
2
2
|
import { t } from "./is-production-GLw59WU8.js";
|
|
3
3
|
import { n, r } from "./icon-sprites-FxHyqyhg.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { Suspense as
|
|
4
|
+
import { a as i, c as a, i as o, l as s, t as c, u as l } from "./state-scenes-BX03WmSu.js";
|
|
5
|
+
import { t as u } from "./scene-svg-DJKa5vsg.js";
|
|
6
|
+
import { Suspense as d, useId as f, useMemo as p } from "react";
|
|
7
7
|
import { jsx as m } from "react/jsx-runtime";
|
|
8
8
|
import { IconRefError as h } from "@nxgt/material-core/icons";
|
|
9
9
|
import { freeIcon as g } from "@nxgt/material-core/icons/free";
|
|
10
10
|
import { ILLUSTRATION_SCENES as _, buildIllustration as v, illustrationScene as y } from "@nxgt/material-core/illustrations";
|
|
11
11
|
//#region lib/illustrations/use-illustration.ts
|
|
12
|
-
function b(e, t,
|
|
13
|
-
let
|
|
12
|
+
function b(e, t, i) {
|
|
13
|
+
let o = l(), c = i ?? (C(e) ? void 0 : s(o, e)), u = r(), d = n(), m = `ill${f().replace(/[^\w-]/g, "-")}`;
|
|
14
14
|
return {
|
|
15
15
|
built: p(() => {
|
|
16
16
|
let n = Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0));
|
|
17
17
|
try {
|
|
18
18
|
let t = y(e, {
|
|
19
|
-
...
|
|
20
|
-
...
|
|
19
|
+
...o?.iconStyle === void 0 ? {} : { iconStyle: o.iconStyle },
|
|
20
|
+
...a(o, e),
|
|
21
21
|
...n
|
|
22
|
-
},
|
|
22
|
+
}, c);
|
|
23
23
|
return {
|
|
24
24
|
spec: t,
|
|
25
25
|
flat: v(t, {
|
|
@@ -34,11 +34,11 @@ function b(e, t, a) {
|
|
|
34
34
|
}
|
|
35
35
|
}, [
|
|
36
36
|
e,
|
|
37
|
-
|
|
37
|
+
c,
|
|
38
38
|
JSON.stringify([
|
|
39
39
|
t,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
a(o, e),
|
|
41
|
+
o?.iconStyle
|
|
42
42
|
]),
|
|
43
43
|
m,
|
|
44
44
|
u,
|
|
@@ -53,18 +53,26 @@ var x = /* @__PURE__ */ new Set();
|
|
|
53
53
|
function S(e) {
|
|
54
54
|
t() || x.has(e) || (x.add(e), console.warn(e));
|
|
55
55
|
}
|
|
56
|
-
var C = (e) => _.includes(e), w = /* @__PURE__ */ e({ Illustration: () =>
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
var C = (e) => _.includes(e), w = /* @__PURE__ */ e({ Illustration: () => D });
|
|
57
|
+
function T({ kind: e }) {
|
|
58
|
+
return /* @__PURE__ */ m(i, {
|
|
59
|
+
kind: e,
|
|
60
|
+
"data-fallback": "",
|
|
61
|
+
className: "h-full w-full"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var E = o("plated-illustration", async () => (await import("./plated-illustration-iNO6KYTL.js")).default, T);
|
|
65
|
+
function D({ scene: e, scenes: t, size: n = "md", title: r, animated: i, hero: a, satellites: o, iconStyle: s, tone: l, duotone: f, className: p, ...h }) {
|
|
66
|
+
let g = c[e] ?? "empty", { built: _, idPrefix: v, base: y, edition: x } = b(e, {
|
|
67
|
+
hero: a,
|
|
68
|
+
satellites: o,
|
|
69
|
+
iconStyle: s,
|
|
70
|
+
tone: l,
|
|
71
|
+
duotone: f
|
|
64
72
|
}, t);
|
|
65
73
|
return /* @__PURE__ */ m("div", {
|
|
66
74
|
"data-slot": "illustration",
|
|
67
|
-
...
|
|
75
|
+
...h,
|
|
68
76
|
...r ? {
|
|
69
77
|
role: "img",
|
|
70
78
|
"aria-label": r
|
|
@@ -72,20 +80,18 @@ function E({ scene: e, scenes: t, size: n = "md", title: r, animated: i, hero: o
|
|
|
72
80
|
"data-scene": e,
|
|
73
81
|
"data-size": n,
|
|
74
82
|
"data-animated": i ? "" : void 0,
|
|
75
|
-
className:
|
|
76
|
-
children: _ ? /* @__PURE__ */ m(
|
|
77
|
-
fallback: /* @__PURE__ */ m(
|
|
78
|
-
children: /* @__PURE__ */ m(
|
|
83
|
+
className: p,
|
|
84
|
+
children: _ ? /* @__PURE__ */ m(d, {
|
|
85
|
+
fallback: /* @__PURE__ */ m(u, { node: _.flat }),
|
|
86
|
+
children: /* @__PURE__ */ m(E, {
|
|
79
87
|
spec: _.spec,
|
|
80
88
|
idPrefix: v,
|
|
81
89
|
base: y,
|
|
82
|
-
edition: x
|
|
90
|
+
edition: x,
|
|
91
|
+
kind: g
|
|
83
92
|
})
|
|
84
|
-
}) : /* @__PURE__ */ m(
|
|
85
|
-
kind: c[e] ?? "empty",
|
|
86
|
-
className: "h-full w-full"
|
|
87
|
-
})
|
|
93
|
+
}) : /* @__PURE__ */ m(T, { kind: g })
|
|
88
94
|
});
|
|
89
95
|
}
|
|
90
96
|
//#endregion
|
|
91
|
-
export { w as n,
|
|
97
|
+
export { w as n, D as t };
|
package/dist/illustrations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./illustration-
|
|
1
|
+
import { s as e } from "./state-scenes-BX03WmSu.js";
|
|
2
|
+
import { t } from "./illustration-BmQmvW_4.js";
|
|
3
3
|
import { ILLUSTRATION_SCENES as n, SUGGESTED_ICONS as r } from "@nxgt/material-core/illustrations";
|
|
4
4
|
export { n as ILLUSTRATION_SCENES, t as Illustration, e as IllustrationDefaults, r as SUGGESTED_ICONS };
|
|
@@ -34,3 +34,19 @@ export declare const toneStroke: {
|
|
|
34
34
|
readonly error: "[&_svg]:stroke-[color-mix(in_oklab,var(--color-error)_85%,black)] dark:[&_svg]:stroke-[color-mix(in_oklab,var(--color-error)_70%,white)]";
|
|
35
35
|
readonly default: "[&_svg]:stroke-foreground";
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* The per-`color` variables the expressive look of `Button` reads (and
|
|
39
|
+
* `IconButton` will, in the same names): `--morph-on` / `--morph-on-fg` the
|
|
40
|
+
* solid fill of a selected button and its text, `--btn-focus` the focus
|
|
41
|
+
* outline, `--btn-line` the outlined variant's line. They follow the filled
|
|
42
|
+
* variant's fills and the tone text above, dark theme included.
|
|
43
|
+
*/
|
|
44
|
+
export declare const toneVars: {
|
|
45
|
+
readonly primary: "[--morph-on:var(--color-primary)] [--morph-on-fg:var(--color-primary-foreground)] [--btn-focus:var(--color-primary-text)] [--btn-line:var(--color-primary)]";
|
|
46
|
+
readonly secondary: "[--morph-on:var(--color-secondary)] dark:[--morph-on:color-mix(in_oklab,var(--color-secondary)_70%,var(--color-background))] [--morph-on-fg:var(--color-secondary-foreground)] [--btn-focus:var(--color-secondary)] [--btn-line:var(--color-secondary)]";
|
|
47
|
+
readonly success: "[--morph-on:var(--color-success)] dark:[--morph-on:color-mix(in_oklab,var(--color-success)_60%,var(--color-background))] [--morph-on-fg:var(--color-success-foreground)] [--btn-focus:var(--color-success)] dark:[--btn-focus:color-mix(in_oklab,var(--color-success)_85%,white)] [--btn-line:var(--color-success)]";
|
|
48
|
+
readonly info: "[--morph-on:var(--color-info)] dark:[--morph-on:color-mix(in_oklab,var(--color-info)_60%,var(--color-background))] [--morph-on-fg:var(--color-info-foreground)] [--btn-focus:var(--color-info)] [--btn-line:var(--color-info)]";
|
|
49
|
+
readonly warning: "[--morph-on:var(--color-warning)] dark:[--morph-on:color-mix(in_oklab,var(--color-warning)_60%,var(--color-background))] [--morph-on-fg:var(--color-warning-foreground)] [--btn-focus:color-mix(in_oklab,var(--color-warning)_85%,black)] dark:[--btn-focus:color-mix(in_oklab,var(--color-warning)_85%,white)] [--btn-line:var(--color-warning)]";
|
|
50
|
+
readonly error: "[--morph-on:var(--color-error)] [--morph-on-fg:var(--color-error-foreground)] [--btn-focus:color-mix(in_oklab,var(--color-error)_85%,black)] dark:[--btn-focus:color-mix(in_oklab,var(--color-error)_70%,white)] [--btn-line:var(--color-error)]";
|
|
51
|
+
readonly default: "[--morph-on:var(--color-foreground)] [--morph-on-fg:var(--color-background)] [--btn-focus:var(--color-foreground)] [--btn-line:var(--color-foreground)]";
|
|
52
|
+
};
|
|
@@ -24,6 +24,19 @@ export type ButtonProps = ComponentProps<'button'> & ButtonVariants & {
|
|
|
24
24
|
* shorter than its `size`. Without it a long label is truncated.
|
|
25
25
|
*/
|
|
26
26
|
wrap?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* `round` (default) rests as a pill and squares when pressed; `square`
|
|
29
|
+
* rests with the size's corner radius and rounds when pressed. Every
|
|
30
|
+
* corner springs, and stays at least 4px. Reduced motion: no squeeze.
|
|
31
|
+
*/
|
|
32
|
+
shape?: 'round' | 'square';
|
|
33
|
+
/**
|
|
34
|
+
* A toggle: sets `aria-pressed` and `data-selected`, takes the other
|
|
35
|
+
* shape and a solid fill of its colour. Leave it out for a plain
|
|
36
|
+
* button. Ignored with `asChild` (the child owns its attributes; a
|
|
37
|
+
* warning in development).
|
|
38
|
+
*/
|
|
39
|
+
selected?: boolean;
|
|
27
40
|
} & {
|
|
28
41
|
tooltip?: string;
|
|
29
42
|
};
|
|
@@ -2,11 +2,12 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
declare const buttonVariantsByColor: (props?: ({
|
|
3
3
|
variant?: "tonal" | "filled" | "link" | "ghost" | "outlined" | null | undefined;
|
|
4
4
|
color?: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "default" | null | undefined;
|
|
5
|
-
size?: "
|
|
5
|
+
size?: "lg" | "sm" | "default" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "xs" | "xl" | "2xl" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
/**
|
|
8
|
-
* On a ghost one, `color
|
|
9
|
-
*
|
|
8
|
+
* On a ghost one, no `color` (or `null`) is the neutral look: the default
|
|
9
|
+
* colour's, a hover tint of the page. A ghost button tinted by a colour is one
|
|
10
|
+
* given its `color` (cva matches no compound variant on `null`).
|
|
10
11
|
*/
|
|
11
12
|
export declare const buttonVariants: typeof buttonVariantsByColor;
|
|
12
13
|
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonVariants } from '../button/button.variants.js';
|
|
2
|
+
import { IconButtonSize } from '../icon-button/icon-button.variants.js';
|
|
3
|
+
/**
|
|
4
|
+
* The sizes a group can share: the ladder `Button` and `IconButton` have in
|
|
5
|
+
* common (`xs`, `sm`, `default`, `lg`, `xl`), taken from both types so a size
|
|
6
|
+
* added to one and not the other drops out of it instead of drifting.
|
|
7
|
+
*/
|
|
8
|
+
export type ButtonGroupSize = Extract<NonNullable<ButtonVariants['size']>, IconButtonSize>;
|
|
9
|
+
/**
|
|
10
|
+
* The `size` of the enclosing `ButtonGroup`, read by `Button` and
|
|
11
|
+
* `IconButton` when they get no `size` of their own (an explicit one wins).
|
|
12
|
+
* `undefined` outside a group, or in one without a `size`.
|
|
13
|
+
*
|
|
14
|
+
* Internal: not exported from the barrel.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ButtonGroupContext: import('react').Context<ButtonGroupSize | undefined>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Puts the shared `ButtonGroup` size back to "none" for what it wraps. React
|
|
4
|
+
* context crosses a portal, so an overlay opened from a button inside a
|
|
5
|
+
* `ButtonGroup size="xs"` would give its own buttons that size; the overlay
|
|
6
|
+
* contents (Dialog, Sheet, Drawer, Popover, AlertDialog) wrap themselves in
|
|
7
|
+
* this.
|
|
8
|
+
*
|
|
9
|
+
* Internal: not exported from the barrel.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ButtonGroupReset({ children }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { ButtonGroupSize } from './button-group-context.js';
|
|
3
|
+
export type { ButtonGroupSize } from './button-group-context.js';
|
|
4
|
+
export type ButtonGroupProps = {
|
|
5
|
+
/**
|
|
6
|
+
* `standard`: the Material 3 Expressive action group. The buttons keep
|
|
7
|
+
* their own look, 8px apart, and a pressed one widens by 14px on each side
|
|
8
|
+
* (less at `xs`, `sm` and `default`) while its neighbours give the width back, so the
|
|
9
|
+
* group never changes width. Reduced motion: no exchange. Unset: the
|
|
10
|
+
* original group (a bare `<div>` that tints and rounds its buttons). `standard` becomes
|
|
11
|
+
* the default in the next major, with `look="legacy"` to keep the original.
|
|
12
|
+
*/
|
|
13
|
+
look?: 'standard';
|
|
14
|
+
/**
|
|
15
|
+
* The `size` every `Button` and `IconButton` in the group takes; one with
|
|
16
|
+
* a `size` of its own keeps it. Works with either look.
|
|
17
|
+
*/
|
|
18
|
+
size?: ButtonGroupSize;
|
|
19
|
+
} & ComponentProps<'div'>;
|
|
20
|
+
export declare function ButtonGroup({ children, className, look, size, ...props }: ButtonGroupProps): import("react").JSX.Element;
|
|
@@ -5,11 +5,12 @@ export type IconButtonColor = keyof (typeof SURFACE)['filled'];
|
|
|
5
5
|
/**
|
|
6
6
|
* What a shaped `IconButton` adds to its classes: its own background,
|
|
7
7
|
* border and box-shadow (the focus ring) give way to the surface below,
|
|
8
|
-
* so nothing is clipped and the ring follows the shape
|
|
8
|
+
* so nothing is clipped and the ring follows the shape; `nxgt-touch-target`
|
|
9
|
+
* gives it the 44px hit area of a coarse pointer. In forced colours
|
|
9
10
|
* the icon takes `ButtonText`: a filled variant's light stroke would
|
|
10
11
|
* vanish on the forced background.
|
|
11
12
|
*/
|
|
12
|
-
export declare const SHAPED_BUTTON = "group/icon-button relative isolate bg-transparent! border-0! shadow-none! ring-0! focus-visible:ring-0! aria-invalid:ring-0! forced-colors:[&_svg]:stroke-[ButtonText] forced-colors:[&_svg]:text-[ButtonText]";
|
|
13
|
+
export declare const SHAPED_BUTTON = "group/icon-button nxgt-touch-target relative isolate bg-transparent! border-0! shadow-none! ring-0! focus-visible:ring-0! aria-invalid:ring-0! forced-colors:[&_svg]:stroke-[ButtonText] forced-colors:[&_svg]:text-[ButtonText]";
|
|
13
14
|
/**
|
|
14
15
|
* The surface of a shaped `IconButton`: one SVG path behind the icon,
|
|
15
16
|
* filled in the variant's colour, lighter or darker on hover and press,
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import { ShapeName } from '@nxgt/material-core/shapes';
|
|
2
|
-
import { VariantProps } from 'class-variance-authority';
|
|
3
2
|
import { ComponentProps, ReactNode } from 'react';
|
|
4
|
-
import { variants } from './icon-button.variants.js';
|
|
3
|
+
import { IconButtonVariants, variants } from './icon-button.variants.js';
|
|
5
4
|
export { variants } from './icon-button.variants.js';
|
|
6
5
|
export type IconButtonProps = {
|
|
7
6
|
asChild?: boolean;
|
|
8
|
-
} & ComponentProps<'button'> &
|
|
7
|
+
} & ComponentProps<'button'> & Omit<IconButtonVariants, 'size' | 'width'> & {
|
|
8
|
+
/**
|
|
9
|
+
* `xs` 24px, `sm` 32px, `default` 36px, `lg` 40px or `xl` 56px, with an
|
|
10
|
+
* icon of 14, 16, 18, 20 or 28px (a glyph without its own `size-*` class;
|
|
11
|
+
* an `Icon` is 16px unless sized). Unset: the 36px button with a 16px
|
|
12
|
+
* icon it always was, so an explicit `default` has an 18px icon and unset
|
|
13
|
+
* a 16px one (a `size-*` class still resizes it).
|
|
14
|
+
*/
|
|
15
|
+
size?: IconButtonVariants['size'];
|
|
16
|
+
/**
|
|
17
|
+
* The width as a factor of the height: `narrow` 0.78, `default` 1,
|
|
18
|
+
* `wide` 1.45; always a pill. Ignored with `shape` (a warning in
|
|
19
|
+
* development).
|
|
20
|
+
*/
|
|
21
|
+
width?: IconButtonVariants['width'];
|
|
9
22
|
tooltip?: ReactNode;
|
|
10
23
|
/**
|
|
11
24
|
* Draws the button as one of the expressive shapes (`cookie-9`,
|
|
12
25
|
* `sunny`, `squircle`…) instead of a circle. The shape carries the
|
|
13
26
|
* variant's colours and the focus ring, and morphs when it changes
|
|
14
|
-
* (a selected state). Unset: the round button, unchanged.
|
|
27
|
+
* (a selected state). Unset: the round button, unchanged. A shaped
|
|
28
|
+
* button ignores `width` (a warning in development).
|
|
15
29
|
*/
|
|
16
30
|
shape?: ShapeName;
|
|
17
31
|
/**
|