@tanishqkancharla/maui 0.0.41 → 0.0.42
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.
|
@@ -64,25 +64,11 @@ const buttonTextClass = style({
|
|
|
64
64
|
minWidth: 0,
|
|
65
65
|
textBox: "trim-both cap alphabetic",
|
|
66
66
|
});
|
|
67
|
-
/**
|
|
68
|
-
* RAC `data-pressed` is true while the pointer is down. MenuTrigger’s
|
|
69
|
-
* PressResponder also keeps it while the menu is open. `aria-expanded`
|
|
70
|
-
* covers Select / ComboBox / DatePicker / DialogTrigger overlays.
|
|
71
|
-
*/
|
|
72
|
-
function pressedOrExpanded(styles) {
|
|
73
|
-
return {
|
|
74
|
-
"&:active:not(:disabled), &[data-pressed]:not(:disabled)": styles,
|
|
75
|
-
"&[aria-expanded='true']:not(:disabled)": styles,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
67
|
const buttonClass = style(buttonBaseClass, {
|
|
79
68
|
backgroundColor: backgroundColor.element,
|
|
80
69
|
"&:hover:not(:disabled)": {
|
|
81
70
|
backgroundColor: backgroundColor.elementHover,
|
|
82
71
|
},
|
|
83
|
-
...pressedOrExpanded({
|
|
84
|
-
backgroundColor: backgroundColor.elementActive,
|
|
85
|
-
}),
|
|
86
72
|
});
|
|
87
73
|
function paletteAlpha(name) {
|
|
88
74
|
return colors[`${name}Alpha`];
|
|
@@ -95,10 +81,6 @@ const quietClass = memoize((color, hoverColor, wash) => style(buttonBaseClass, f
|
|
|
95
81
|
color: hoverColor,
|
|
96
82
|
backgroundColor: surfaceWash(wash, surfaceMixPercent.hover),
|
|
97
83
|
},
|
|
98
|
-
...pressedOrExpanded({
|
|
99
|
-
color: hoverColor,
|
|
100
|
-
backgroundColor: surfaceWash(wash, surfaceMixPercent.active),
|
|
101
|
-
}),
|
|
102
84
|
"&:disabled": disabledQuiet,
|
|
103
85
|
}));
|
|
104
86
|
const quietButtonClass = quietClass(colors.gray[11], colors.gray[12], colors.grayAlpha[9]);
|
|
@@ -119,7 +101,7 @@ function paletteFill(name) {
|
|
|
119
101
|
function opaqueColor(color) {
|
|
120
102
|
return `oklch(from ${color} l c h / 1)`;
|
|
121
103
|
}
|
|
122
|
-
/**
|
|
104
|
+
/** Darken a one-off fill while preserving its hue. */
|
|
123
105
|
function darkerFill(color) {
|
|
124
106
|
return `oklch(from ${color} calc(l - 0.04) c h)`;
|
|
125
107
|
}
|
|
@@ -138,7 +120,6 @@ const coloredButtonClass = memoize((variant, color) => {
|
|
|
138
120
|
const fill = opaqueColor(color);
|
|
139
121
|
if (variant === "primary") {
|
|
140
122
|
const hover = surfaceWash(colors.gray[12], surfaceMixPercent.hover, fill);
|
|
141
|
-
const pressed = darkerFill(fill);
|
|
142
123
|
const primaryShadow = primaryButtonShadow(fill);
|
|
143
124
|
return style(buttonBaseClass, focusRing("&:focus-visible", primaryShadow), {
|
|
144
125
|
color: onSolidText(fill),
|
|
@@ -147,9 +128,6 @@ const coloredButtonClass = memoize((variant, color) => {
|
|
|
147
128
|
"&:hover:not(:disabled)": {
|
|
148
129
|
backgroundColor: hover,
|
|
149
130
|
},
|
|
150
|
-
...pressedOrExpanded({
|
|
151
|
-
backgroundColor: pressed,
|
|
152
|
-
}),
|
|
153
131
|
"&:disabled": disabledRaised,
|
|
154
132
|
});
|
|
155
133
|
}
|
|
@@ -166,9 +144,6 @@ const coloredButtonClass = memoize((variant, color) => {
|
|
|
166
144
|
"&:hover:not(:disabled)": {
|
|
167
145
|
backgroundColor: hover,
|
|
168
146
|
},
|
|
169
|
-
...pressedOrExpanded({
|
|
170
|
-
backgroundColor: scale[10],
|
|
171
|
-
}),
|
|
172
147
|
"&:disabled": disabledRaised,
|
|
173
148
|
});
|
|
174
149
|
}
|
package/package.json
CHANGED
|
@@ -84,26 +84,11 @@ const buttonTextClass = style({
|
|
|
84
84
|
textBox: "trim-both cap alphabetic",
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
/**
|
|
88
|
-
* RAC `data-pressed` is true while the pointer is down. MenuTrigger’s
|
|
89
|
-
* PressResponder also keeps it while the menu is open. `aria-expanded`
|
|
90
|
-
* covers Select / ComboBox / DatePicker / DialogTrigger overlays.
|
|
91
|
-
*/
|
|
92
|
-
function pressedOrExpanded(styles: Record<string, string>) {
|
|
93
|
-
return {
|
|
94
|
-
"&:active:not(:disabled), &[data-pressed]:not(:disabled)": styles,
|
|
95
|
-
"&[aria-expanded='true']:not(:disabled)": styles,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
87
|
const buttonClass = style(buttonBaseClass, {
|
|
100
88
|
backgroundColor: backgroundColor.element,
|
|
101
89
|
"&:hover:not(:disabled)": {
|
|
102
90
|
backgroundColor: backgroundColor.elementHover,
|
|
103
91
|
},
|
|
104
|
-
...pressedOrExpanded({
|
|
105
|
-
backgroundColor: backgroundColor.elementActive,
|
|
106
|
-
}),
|
|
107
92
|
})
|
|
108
93
|
|
|
109
94
|
function paletteAlpha(name: ColorName): ColorScale {
|
|
@@ -119,10 +104,6 @@ const quietClass = memoize((color: string, hoverColor: string, wash: string) =>
|
|
|
119
104
|
color: hoverColor,
|
|
120
105
|
backgroundColor: surfaceWash(wash, surfaceMixPercent.hover),
|
|
121
106
|
},
|
|
122
|
-
...pressedOrExpanded({
|
|
123
|
-
color: hoverColor,
|
|
124
|
-
backgroundColor: surfaceWash(wash, surfaceMixPercent.active),
|
|
125
|
-
}),
|
|
126
107
|
"&:disabled": disabledQuiet,
|
|
127
108
|
}),
|
|
128
109
|
)
|
|
@@ -158,7 +139,7 @@ function opaqueColor(color: string) {
|
|
|
158
139
|
return `oklch(from ${color} l c h / 1)`
|
|
159
140
|
}
|
|
160
141
|
|
|
161
|
-
/**
|
|
142
|
+
/** Darken a one-off fill while preserving its hue. */
|
|
162
143
|
function darkerFill(color: string) {
|
|
163
144
|
return `oklch(from ${color} calc(l - 0.04) c h)`
|
|
164
145
|
}
|
|
@@ -185,7 +166,6 @@ const coloredButtonClass = memoize(
|
|
|
185
166
|
surfaceMixPercent.hover,
|
|
186
167
|
fill,
|
|
187
168
|
)
|
|
188
|
-
const pressed = darkerFill(fill)
|
|
189
169
|
const primaryShadow = primaryButtonShadow(fill)
|
|
190
170
|
return style(
|
|
191
171
|
buttonBaseClass,
|
|
@@ -197,9 +177,6 @@ const coloredButtonClass = memoize(
|
|
|
197
177
|
"&:hover:not(:disabled)": {
|
|
198
178
|
backgroundColor: hover,
|
|
199
179
|
},
|
|
200
|
-
...pressedOrExpanded({
|
|
201
|
-
backgroundColor: pressed,
|
|
202
|
-
}),
|
|
203
180
|
"&:disabled": disabledRaised,
|
|
204
181
|
},
|
|
205
182
|
)
|
|
@@ -226,9 +203,6 @@ const coloredButtonClass = memoize(
|
|
|
226
203
|
"&:hover:not(:disabled)": {
|
|
227
204
|
backgroundColor: hover,
|
|
228
205
|
},
|
|
229
|
-
...pressedOrExpanded({
|
|
230
|
-
backgroundColor: scale[10],
|
|
231
|
-
}),
|
|
232
206
|
"&:disabled": disabledRaised,
|
|
233
207
|
},
|
|
234
208
|
)
|
|
@@ -29,7 +29,7 @@ export function ButtonsPage() {
|
|
|
29
29
|
<P>
|
|
30
30
|
<Code>isDisabled</Code> is React Aria’s disabled prop. It sets the
|
|
31
31
|
native <Code>disabled</Code> attribute — there is no parallel{" "}
|
|
32
|
-
<Code>disabled</Code> React prop.
|
|
32
|
+
<Code>disabled</Code> React prop. The hover fill does not apply.
|
|
33
33
|
</P>
|
|
34
34
|
<Flex row alignItems="center" gap={4} style={{ flexWrap: "wrap" }}>
|
|
35
35
|
<Button isDisabled>Button</Button>
|
|
@@ -110,9 +110,9 @@ export function ButtonsPage() {
|
|
|
110
110
|
<H3>Quiet</H3>
|
|
111
111
|
<P>
|
|
112
112
|
<Code>variant="quiet"</Code> has no fill. <Code>variantColor</Code>{" "}
|
|
113
|
-
tints the label and icon. Hover
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
tints the label and icon. Hover mixes <Code>grayAlpha[9]</Code> (or
|
|
114
|
+
that color’s alpha 9) into transparent using the shared 3.5% control
|
|
115
|
+
wash.
|
|
116
116
|
</P>
|
|
117
117
|
<Flex row alignItems="center" gap={4} style={{ flexWrap: "wrap" }}>
|
|
118
118
|
<Button variant="quiet">Button</Button>
|