@tanishqkancharla/maui 0.0.61 → 0.0.62
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/components/Button.js +2 -6
- package/dist/components/Checkbox.js +3 -2
- package/dist/components/Radio.js +3 -2
- package/dist/components/Switch.js +2 -1
- package/dist/tokens/shadow.d.ts +3 -0
- package/dist/tokens/shadow.js +5 -0
- package/package.json +1 -1
- package/src/components/Button.tsx +2 -7
- package/src/components/Checkbox.tsx +6 -1
- package/src/components/Radio.tsx +6 -1
- package/src/components/Switch.tsx +5 -0
- package/src/tokens/shadow.ts +6 -0
|
@@ -9,7 +9,7 @@ import { backgroundColor, surfaceMixPercent, surfaceWash, } from "../tokens/back
|
|
|
9
9
|
import { colors } from "../tokens/colors";
|
|
10
10
|
import { focusRing } from "../tokens/focusRing";
|
|
11
11
|
import { radius } from "../tokens/radius";
|
|
12
|
-
import { shadowVars } from "../tokens/shadow";
|
|
12
|
+
import { shadowVars, tintedControl } from "../tokens/shadow";
|
|
13
13
|
import { controlSize, iconSizeValues } from "../tokens/sizing";
|
|
14
14
|
import { spacing } from "../tokens/spacing";
|
|
15
15
|
import { text } from "../tokens/text";
|
|
@@ -146,10 +146,6 @@ function onSolidText(color) {
|
|
|
146
146
|
function fillShade(color, lightnessOffset, alpha = 1) {
|
|
147
147
|
return `oklch(from ${color} calc(l - ${lightnessOffset}) c h / ${alpha})`;
|
|
148
148
|
}
|
|
149
|
-
/** Dark-only top highlight, a fill-tinted lift (half strength in dark mode), and an edge painted beneath the lift: the fill's alpha step 6 in light mode, a near-black tint of the fill in dark mode. */
|
|
150
|
-
function primaryButtonShadow(color, lightEdge) {
|
|
151
|
-
return `inset 0 .5px light-dark(transparent, rgb(255 255 255 / 0.15)), 0 1px 2px light-dark(${fillShade(color, 0, 0.35)}, ${fillShade(color, 0, 0.18)}), 0 3px 8px -3px light-dark(${fillShade(color, 0, 0.6)}, ${fillShade(color, 0, 0.3)}), 0 0 0 .5px light-dark(${lightEdge}, oklch(from ${color} 0.18 calc(c * 0.5) h))`;
|
|
152
|
-
}
|
|
153
149
|
/**
|
|
154
150
|
* Diagonal from a slightly darker, more saturated, warmer-rotated fill to the
|
|
155
151
|
* fill. The offsets are the OKLCH delta between Campsite's #FB432C → #FF591E.
|
|
@@ -160,7 +156,7 @@ function primaryButtonGradient(color) {
|
|
|
160
156
|
/** Hover lightens the top of the gradient instead of replacing the fill. */
|
|
161
157
|
const primaryHoverSheen = `linear-gradient(to bottom, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0))`;
|
|
162
158
|
const primaryClass = memoize((fill, textColor, lightEdge) => {
|
|
163
|
-
const primaryShadow =
|
|
159
|
+
const primaryShadow = tintedControl(fill, lightEdge);
|
|
164
160
|
const gradient = primaryButtonGradient(fill);
|
|
165
161
|
return style(buttonBaseClass, focusRing("&:focus-visible", primaryShadow), {
|
|
166
162
|
color: textColor,
|
|
@@ -27,11 +27,11 @@ const check = style(motion.standard("opacity", "transform"), {
|
|
|
27
27
|
height: checkboxSize.checkmark,
|
|
28
28
|
paddingTop: "0.5px",
|
|
29
29
|
paddingLeft: "0.5px",
|
|
30
|
-
fill:
|
|
30
|
+
fill: "white",
|
|
31
31
|
opacity: 0,
|
|
32
32
|
transform: "scale(0)",
|
|
33
33
|
});
|
|
34
|
-
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${box}`, shadowVars.control), {
|
|
34
|
+
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${box}`, shadowVars.control), focusRing(`&[data-selected][data-focus-visible] ${box}`, shadowVars.selectedControl), {
|
|
35
35
|
position: "relative",
|
|
36
36
|
width: "fit-content",
|
|
37
37
|
minHeight: controlSize.minTarget,
|
|
@@ -41,6 +41,7 @@ const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-foc
|
|
|
41
41
|
},
|
|
42
42
|
[`&[data-selected] ${box}`]: {
|
|
43
43
|
backgroundColor: colors.accent[9],
|
|
44
|
+
boxShadow: shadowVars.selectedControl,
|
|
44
45
|
},
|
|
45
46
|
[`&[data-selected][data-hovered] ${box}`]: {
|
|
46
47
|
backgroundColor: surfaceWash(colors.gray[12], surfaceMixPercent.hover, colors.accent[9]),
|
package/dist/components/Radio.js
CHANGED
|
@@ -22,10 +22,10 @@ const dot = style(radius.circle, motion.standard("transform"), {
|
|
|
22
22
|
left: "4px",
|
|
23
23
|
width: "6px",
|
|
24
24
|
height: "6px",
|
|
25
|
-
backgroundColor:
|
|
25
|
+
backgroundColor: "white",
|
|
26
26
|
transform: "scale(0)",
|
|
27
27
|
});
|
|
28
|
-
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${circle}`, shadowVars.control), {
|
|
28
|
+
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${circle}`, shadowVars.control), focusRing(`&[data-selected][data-focus-visible] ${circle}`, shadowVars.selectedControl), {
|
|
29
29
|
position: "relative",
|
|
30
30
|
width: "fit-content",
|
|
31
31
|
[`&[data-hovered] ${circle}`]: {
|
|
@@ -33,6 +33,7 @@ const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-foc
|
|
|
33
33
|
},
|
|
34
34
|
[`&[data-selected] ${circle}`]: {
|
|
35
35
|
backgroundColor: colors.accent[9],
|
|
36
|
+
boxShadow: shadowVars.selectedControl,
|
|
36
37
|
},
|
|
37
38
|
[`&[data-selected][data-hovered] ${circle}`]: {
|
|
38
39
|
backgroundColor: surfaceWash(colors.gray[12], surfaceMixPercent.hover, colors.accent[9]),
|
|
@@ -42,7 +42,7 @@ const thumb = style(radius.circle, motion.standard("transform"), {
|
|
|
42
42
|
backgroundColor: "#ffffff",
|
|
43
43
|
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.16)",
|
|
44
44
|
});
|
|
45
|
-
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${track}`, shadowVars.control), {
|
|
45
|
+
const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-focus-visible] ${track}`, shadowVars.control), focusRing(`&[data-selected][data-focus-visible] ${track}`, shadowVars.selectedControl), {
|
|
46
46
|
position: "relative",
|
|
47
47
|
width: "fit-content",
|
|
48
48
|
minHeight: controlSize.minTarget,
|
|
@@ -51,6 +51,7 @@ const root = style(flex({ alignItems: "center", gap: 3 }), focusRing(`&[data-foc
|
|
|
51
51
|
},
|
|
52
52
|
[`&[data-selected] ${track}`]: {
|
|
53
53
|
backgroundColor: colors.accent[9],
|
|
54
|
+
boxShadow: shadowVars.selectedControl,
|
|
54
55
|
},
|
|
55
56
|
[`&[data-selected][data-hovered] ${track}`]: {
|
|
56
57
|
backgroundColor: switchOnHover,
|
package/dist/tokens/shadow.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/** Dark-only top highlight, fill-tinted lift, and a 0.5px edge beneath the lift. */
|
|
2
|
+
export declare function tintedControl(color: string, lightEdge: string): string;
|
|
1
3
|
export declare const shadowVars: import("purse-styles").VariableGroup<{
|
|
2
4
|
readonly control: {
|
|
3
5
|
readonly default: `0 .5px 1px #00000018, 0 0 4px -1px #0001, 0 0 0 .5px ${string}`;
|
|
4
6
|
readonly ":root[data-theme=\"dark\"]": "inset 0 .5px rgb(255 255 255 / 0.09), 0 1px .5px #00000018, 0 0 3px -1px #0005, 0 0 0 .5px rgb(0 0 0 / 0.8)";
|
|
5
7
|
};
|
|
8
|
+
readonly selectedControl: string;
|
|
6
9
|
readonly subtle: `rgba(var(--${string}), 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, var(--${string})) 0px 1px 1px -0.5px, rgba(0, 0, 0, var(--${string})) 0px 3px 3px -1.5px`;
|
|
7
10
|
readonly medium: `rgba(var(--${string}), 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, var(--${string})) 0px 1px 1px -0.5px, rgba(0, 0, 0, var(--${string})) 0px 3px 3px -1.5px, rgba(0, 0, 0, var(--${string})) 0px 6px 6px -3px`;
|
|
8
11
|
readonly strong: `rgba(var(--${string}), 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, var(--${string})) 0px 1px 1px -0.5px, rgba(0, 0, 0, var(--${string})) 0px 3px 3px -1.5px, rgba(0, 0, 0, var(--${string})) 0px 6px 6px -3px, rgba(0, 0, 0, calc(var(--${string}) * 0.67)) 0px 12px 12px -6px, rgba(0, 0, 0, calc(var(--${string}) * 0.67)) 0px 24px 24px -12px`;
|
package/dist/tokens/shadow.js
CHANGED
|
@@ -13,6 +13,10 @@ const shadowParams = defineVars({
|
|
|
13
13
|
});
|
|
14
14
|
const rgb = shadowParams.foregroundRgb;
|
|
15
15
|
const blur = shadowParams.blurOpacity;
|
|
16
|
+
/** Dark-only top highlight, fill-tinted lift, and a 0.5px edge beneath the lift. */
|
|
17
|
+
export function tintedControl(color, lightEdge) {
|
|
18
|
+
return `inset 0 .5px light-dark(transparent, rgb(255 255 255 / 0.15)), 0 1px 2px light-dark(oklch(from ${color} l c h / 0.35), oklch(from ${color} l c h / 0.18)), 0 3px 8px -3px light-dark(oklch(from ${color} l c h / 0.6), oklch(from ${color} l c h / 0.3)), 0 0 0 .5px light-dark(${lightEdge}, oklch(from ${color} 0.18 calc(c * 0.5) h))`;
|
|
19
|
+
}
|
|
16
20
|
export const shadowVars = defineVars({
|
|
17
21
|
control: {
|
|
18
22
|
// 0.5px edge listed last, so it paints beneath the drop: light reads as a
|
|
@@ -20,6 +24,7 @@ export const shadowVars = defineVars({
|
|
|
20
24
|
default: `0 .5px 1px #00000018, 0 0 4px -1px #0001, 0 0 0 .5px ${colors.grayAlpha[6]}`,
|
|
21
25
|
[DARK_THEME]: `inset 0 .5px rgb(255 255 255 / 0.09), 0 1px .5px #00000018, 0 0 3px -1px #0005, 0 0 0 .5px rgb(0 0 0 / 0.8)`,
|
|
22
26
|
},
|
|
27
|
+
selectedControl: tintedControl(colors.accent[9], colors.accentAlpha[6]),
|
|
23
28
|
subtle: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px`,
|
|
24
29
|
medium: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px, rgba(0, 0, 0, ${blur}) 0px 6px 6px -3px`,
|
|
25
30
|
strong: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px, rgba(0, 0, 0, ${blur}) 0px 6px 6px -3px, rgba(0, 0, 0, calc(${blur} * 0.67)) 0px 12px 12px -6px, rgba(0, 0, 0, calc(${blur} * 0.67)) 0px 24px 24px -12px`,
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { colors, type ColorName, type ColorScale } from "../tokens/colors"
|
|
16
16
|
import { focusRing } from "../tokens/focusRing"
|
|
17
17
|
import { radius } from "../tokens/radius"
|
|
18
|
-
import { shadowVars } from "../tokens/shadow"
|
|
18
|
+
import { shadowVars, tintedControl } from "../tokens/shadow"
|
|
19
19
|
import { controlSize, iconSizeValues } from "../tokens/sizing"
|
|
20
20
|
import { spacing } from "../tokens/spacing"
|
|
21
21
|
import { text } from "../tokens/text"
|
|
@@ -193,11 +193,6 @@ function fillShade(color: string, lightnessOffset: number, alpha = 1) {
|
|
|
193
193
|
return `oklch(from ${color} calc(l - ${lightnessOffset}) c h / ${alpha})`
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
/** Dark-only top highlight, a fill-tinted lift (half strength in dark mode), and an edge painted beneath the lift: the fill's alpha step 6 in light mode, a near-black tint of the fill in dark mode. */
|
|
197
|
-
function primaryButtonShadow(color: string, lightEdge: string) {
|
|
198
|
-
return `inset 0 .5px light-dark(transparent, rgb(255 255 255 / 0.15)), 0 1px 2px light-dark(${fillShade(color, 0, 0.35)}, ${fillShade(color, 0, 0.18)}), 0 3px 8px -3px light-dark(${fillShade(color, 0, 0.6)}, ${fillShade(color, 0, 0.3)}), 0 0 0 .5px light-dark(${lightEdge}, oklch(from ${color} 0.18 calc(c * 0.5) h))`
|
|
199
|
-
}
|
|
200
|
-
|
|
201
196
|
/**
|
|
202
197
|
* Diagonal from a slightly darker, more saturated, warmer-rotated fill to the
|
|
203
198
|
* fill. The offsets are the OKLCH delta between Campsite's #FB432C → #FF591E.
|
|
@@ -211,7 +206,7 @@ const primaryHoverSheen = `linear-gradient(to bottom, rgb(255 255 255 / 0.12), r
|
|
|
211
206
|
|
|
212
207
|
const primaryClass = memoize(
|
|
213
208
|
(fill: string, textColor: string, lightEdge: string) => {
|
|
214
|
-
const primaryShadow =
|
|
209
|
+
const primaryShadow = tintedControl(fill, lightEdge)
|
|
215
210
|
const gradient = primaryButtonGradient(fill)
|
|
216
211
|
return style(buttonBaseClass, focusRing("&:focus-visible", primaryShadow), {
|
|
217
212
|
color: textColor,
|
|
@@ -44,7 +44,7 @@ const check = style(motion.standard("opacity", "transform"), {
|
|
|
44
44
|
height: checkboxSize.checkmark,
|
|
45
45
|
paddingTop: "0.5px",
|
|
46
46
|
paddingLeft: "0.5px",
|
|
47
|
-
fill:
|
|
47
|
+
fill: "white",
|
|
48
48
|
opacity: 0,
|
|
49
49
|
transform: "scale(0)",
|
|
50
50
|
})
|
|
@@ -52,6 +52,10 @@ const check = style(motion.standard("opacity", "transform"), {
|
|
|
52
52
|
const root = style(
|
|
53
53
|
flex({ alignItems: "center", gap: 3 }),
|
|
54
54
|
focusRing(`&[data-focus-visible] ${box}`, shadowVars.control),
|
|
55
|
+
focusRing(
|
|
56
|
+
`&[data-selected][data-focus-visible] ${box}`,
|
|
57
|
+
shadowVars.selectedControl,
|
|
58
|
+
),
|
|
55
59
|
{
|
|
56
60
|
position: "relative",
|
|
57
61
|
width: "fit-content",
|
|
@@ -62,6 +66,7 @@ const root = style(
|
|
|
62
66
|
},
|
|
63
67
|
[`&[data-selected] ${box}`]: {
|
|
64
68
|
backgroundColor: colors.accent[9],
|
|
69
|
+
boxShadow: shadowVars.selectedControl,
|
|
65
70
|
},
|
|
66
71
|
[`&[data-selected][data-hovered] ${box}`]: {
|
|
67
72
|
backgroundColor: surfaceWash(
|
package/src/components/Radio.tsx
CHANGED
|
@@ -40,13 +40,17 @@ const dot = style(radius.circle, motion.standard("transform"), {
|
|
|
40
40
|
left: "4px",
|
|
41
41
|
width: "6px",
|
|
42
42
|
height: "6px",
|
|
43
|
-
backgroundColor:
|
|
43
|
+
backgroundColor: "white",
|
|
44
44
|
transform: "scale(0)",
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
const root = style(
|
|
48
48
|
flex({ alignItems: "center", gap: 3 }),
|
|
49
49
|
focusRing(`&[data-focus-visible] ${circle}`, shadowVars.control),
|
|
50
|
+
focusRing(
|
|
51
|
+
`&[data-selected][data-focus-visible] ${circle}`,
|
|
52
|
+
shadowVars.selectedControl,
|
|
53
|
+
),
|
|
50
54
|
{
|
|
51
55
|
position: "relative",
|
|
52
56
|
width: "fit-content",
|
|
@@ -55,6 +59,7 @@ const root = style(
|
|
|
55
59
|
},
|
|
56
60
|
[`&[data-selected] ${circle}`]: {
|
|
57
61
|
backgroundColor: colors.accent[9],
|
|
62
|
+
boxShadow: shadowVars.selectedControl,
|
|
58
63
|
},
|
|
59
64
|
[`&[data-selected][data-hovered] ${circle}`]: {
|
|
60
65
|
backgroundColor: surfaceWash(
|
|
@@ -58,6 +58,10 @@ const thumb = style(radius.circle, motion.standard("transform"), {
|
|
|
58
58
|
const root = style(
|
|
59
59
|
flex({ alignItems: "center", gap: 3 }),
|
|
60
60
|
focusRing(`&[data-focus-visible] ${track}`, shadowVars.control),
|
|
61
|
+
focusRing(
|
|
62
|
+
`&[data-selected][data-focus-visible] ${track}`,
|
|
63
|
+
shadowVars.selectedControl,
|
|
64
|
+
),
|
|
61
65
|
{
|
|
62
66
|
position: "relative",
|
|
63
67
|
width: "fit-content",
|
|
@@ -67,6 +71,7 @@ const root = style(
|
|
|
67
71
|
},
|
|
68
72
|
[`&[data-selected] ${track}`]: {
|
|
69
73
|
backgroundColor: colors.accent[9],
|
|
74
|
+
boxShadow: shadowVars.selectedControl,
|
|
70
75
|
},
|
|
71
76
|
[`&[data-selected][data-hovered] ${track}`]: {
|
|
72
77
|
backgroundColor: switchOnHover,
|
package/src/tokens/shadow.ts
CHANGED
|
@@ -16,6 +16,11 @@ const shadowParams = defineVars({
|
|
|
16
16
|
const rgb = shadowParams.foregroundRgb
|
|
17
17
|
const blur = shadowParams.blurOpacity
|
|
18
18
|
|
|
19
|
+
/** Dark-only top highlight, fill-tinted lift, and a 0.5px edge beneath the lift. */
|
|
20
|
+
export function tintedControl(color: string, lightEdge: string) {
|
|
21
|
+
return `inset 0 .5px light-dark(transparent, rgb(255 255 255 / 0.15)), 0 1px 2px light-dark(oklch(from ${color} l c h / 0.35), oklch(from ${color} l c h / 0.18)), 0 3px 8px -3px light-dark(oklch(from ${color} l c h / 0.6), oklch(from ${color} l c h / 0.3)), 0 0 0 .5px light-dark(${lightEdge}, oklch(from ${color} 0.18 calc(c * 0.5) h))`
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export const shadowVars = defineVars({
|
|
20
25
|
control: {
|
|
21
26
|
// 0.5px edge listed last, so it paints beneath the drop: light reads as a
|
|
@@ -23,6 +28,7 @@ export const shadowVars = defineVars({
|
|
|
23
28
|
default: `0 .5px 1px #00000018, 0 0 4px -1px #0001, 0 0 0 .5px ${colors.grayAlpha[6]}`,
|
|
24
29
|
[DARK_THEME]: `inset 0 .5px rgb(255 255 255 / 0.09), 0 1px .5px #00000018, 0 0 3px -1px #0005, 0 0 0 .5px rgb(0 0 0 / 0.8)`,
|
|
25
30
|
},
|
|
31
|
+
selectedControl: tintedControl(colors.accent[9], colors.accentAlpha[6]),
|
|
26
32
|
subtle: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px`,
|
|
27
33
|
medium: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px, rgba(0, 0, 0, ${blur}) 0px 6px 6px -3px`,
|
|
28
34
|
strong: `rgba(${rgb}, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, ${blur}) 0px 1px 1px -0.5px, rgba(0, 0, 0, ${blur}) 0px 3px 3px -1.5px, rgba(0, 0, 0, ${blur}) 0px 6px 6px -3px, rgba(0, 0, 0, calc(${blur} * 0.67)) 0px 12px 12px -6px, rgba(0, 0, 0, calc(${blur} * 0.67)) 0px 24px 24px -12px`,
|