m3-svelte 4.5.0 → 4.5.2

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.
@@ -7,7 +7,7 @@
7
7
  import type { Snippet } from "svelte";
8
8
  import Layer from "../misc/Layer.svelte";
9
9
 
10
- // If you want a toggle button, use `for` with an `<input>`.
10
+ // If you want a toggle button, use `for` with a checkbox input.
11
11
  type ActionProps =
12
12
  | ({ click?: () => void; disabled?: boolean } & HTMLButtonAttributes)
13
13
  | ({ href: string } & HTMLAnchorAttributes)
@@ -131,7 +131,7 @@
131
131
  &.filled:not(:disabled, :global(input:disabled) + label) {
132
132
  background-color: rgb(var(--m3-scheme-primary));
133
133
  color: rgb(var(--m3-scheme-on-primary));
134
- &:is(:global(input:not(:checked)) + label) {
134
+ &:is(:global(input:is([type="checkbox"], [type="radio"]):not(:checked)) + label) {
135
135
  background-color: rgb(var(--m3-scheme-surface-container));
136
136
  color: rgb(var(--m3-scheme-on-surface-variant));
137
137
  }
@@ -1,12 +1,18 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from "svelte";
3
- import type { HTMLAttributes, HTMLButtonAttributes, HTMLLabelAttributes } from "svelte/elements";
3
+ import type {
4
+ HTMLAnchorAttributes,
5
+ HTMLAttributes,
6
+ HTMLButtonAttributes,
7
+ HTMLLabelAttributes,
8
+ } from "svelte/elements";
4
9
  import Layer from "../misc/Layer.svelte";
5
10
 
6
11
  type ActionProps =
7
12
  | HTMLAttributes<HTMLDivElement>
8
13
  | ({ click: () => void } & HTMLButtonAttributes)
9
- | ({ label: true } & HTMLLabelAttributes);
14
+ | ({ label: true } & HTMLLabelAttributes)
15
+ | ({ href: string } & HTMLAnchorAttributes);
10
16
 
11
17
  let props: {
12
18
  leading?: Snippet;
@@ -78,6 +84,12 @@
78
84
  <Layer />
79
85
  {@render content(leading, overline, headline, supporting, trailing)}
80
86
  </button>
87
+ {:else if "href" in props}
88
+ {@const { leading, overline = "", headline = "", supporting = "", trailing, ...extra } = props}
89
+ <a class="m3-container lines-{_lines}" {...extra}>
90
+ <Layer />
91
+ {@render content(leading, overline, headline, supporting, trailing)}
92
+ </a>
81
93
  {:else}
82
94
  {@const { leading, overline = "", headline = "", supporting = "", trailing, ...extra } = props}
83
95
  <div class="m3-container lines-{_lines}" {...extra}>
@@ -96,6 +108,7 @@
96
108
  border: none;
97
109
  position: relative;
98
110
  background: transparent;
111
+ color: inherit;
99
112
  -webkit-tap-highlight-color: transparent;
100
113
  }
101
114
  button.m3-container,
@@ -1,10 +1,12 @@
1
1
  import type { Snippet } from "svelte";
2
- import type { HTMLAttributes, HTMLButtonAttributes, HTMLLabelAttributes } from "svelte/elements";
2
+ import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes, HTMLLabelAttributes } from "svelte/elements";
3
3
  type ActionProps = HTMLAttributes<HTMLDivElement> | ({
4
4
  click: () => void;
5
5
  } & HTMLButtonAttributes) | ({
6
6
  label: true;
7
- } & HTMLLabelAttributes);
7
+ } & HTMLLabelAttributes) | ({
8
+ href: string;
9
+ } & HTMLAnchorAttributes);
8
10
  type $$ComponentProps = {
9
11
  leading?: Snippet;
10
12
  overline?: string;
@@ -50,6 +50,7 @@ const onErrorContainerSubtle = DynamicColor.fromPalette({
50
50
  export const colors = [
51
51
  ...materialColors.allColors,
52
52
  materialColors.shadow(),
53
+ materialColors.scrim(),
53
54
  onOnPrimary,
54
55
  primaryContainerSubtle,
55
56
  onPrimaryContainerSubtle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-svelte",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "license": "Apache-2.0 OR GPL-3.0-only",
5
5
  "repository": "KTibow/m3-svelte",
6
6
  "author": {