@noxlovette/material 0.1.25 → 0.1.27

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.
@@ -14,7 +14,7 @@ Floating action buttons (FABs) help people take primary actions.
14
14
  import { fab } from './theme.js';
15
15
  import type { FABProps } from './types.js';
16
16
  import FABMenu from './FABMenu.svelte';
17
- import { Layer, Icon } from '../../utils/index.js';
17
+ import { Layer, Icon, LoadingIndicator } from '../../utils/index.js';
18
18
  import { clickOutside } from '../../actions/index.js';
19
19
  import { Button, type ButtonRootProps } from 'bits-ui';
20
20
 
@@ -26,6 +26,7 @@ Floating action buttons (FABs) help people take primary actions.
26
26
  config = 'primary',
27
27
  iconProps,
28
28
  label,
29
+ loading,
29
30
  expanded = false,
30
31
  class: className,
31
32
  withMenu,
@@ -48,7 +49,7 @@ Floating action buttons (FABs) help people take primary actions.
48
49
  );
49
50
 
50
51
  function handleClick(e: MouseEvent) {
51
- if (disabled) {
52
+ if (disabled || loading) {
52
53
  e.preventDefault();
53
54
  return;
54
55
  }
@@ -68,8 +69,12 @@ Floating action buttons (FABs) help people take primary actions.
68
69
  data-cy="m3-fab"
69
70
  {...restProps as ButtonRootProps}
70
71
  >
71
- <Icon {...withMenu && showMenu ? { name: 'close' } : iconProps} class={icon()} />
72
- <Layer />
72
+ {#if loading}
73
+ <LoadingIndicator />
74
+ {:else}
75
+ <Icon {...withMenu && showMenu ? { name: 'close' } : iconProps} class={icon()} />
76
+ <Layer />
77
+ {/if}
73
78
  {#if expanded && !(withMenu && showMenu)}
74
79
  <p class={labelClass()}>
75
80
  {label}
@@ -147,6 +147,8 @@ export type FABProps = FABVariants & AnchorButtonAttributes & {
147
147
  withMenu?: boolean;
148
148
  /** Configuration for the FAB's icon. */
149
149
  iconProps: IconProps;
150
+ /** Whether the FAB is in a loading state. Displays a loading indicator instead of the icon. */
151
+ loading?: boolean;
150
152
  /** The URL to link to. If provided, the FAB will render as an `<a>` tag. */
151
153
  href?: string;
152
154
  /** The `formaction` attribute for the FAB when used in a form. */
@@ -17,13 +17,14 @@ and serve as an entry point to more detailed information.
17
17
  let {
18
18
  children,
19
19
  type = 'filled',
20
+ padding = 'md',
20
21
  class: className,
21
22
  href,
22
23
  hoverable = !!href,
23
24
  ...restProps
24
25
  }: CardProps = $props();
25
26
 
26
- const { base } = $derived(card({ type, hoverable }));
27
+ const { base } = $derived(card({ type, hoverable, padding }));
27
28
  </script>
28
29
 
29
30
  {#if href}
@@ -4,6 +4,20 @@ export declare const card: import("tailwind-variants").TVReturnType<{
4
4
  filled: string;
5
5
  outlined: string;
6
6
  };
7
+ padding: {
8
+ none: {
9
+ base: string;
10
+ };
11
+ sm: {
12
+ base: string;
13
+ };
14
+ md: {
15
+ base: string;
16
+ };
17
+ lg: {
18
+ base: string;
19
+ };
20
+ };
7
21
  hoverable: {
8
22
  true: string;
9
23
  };
@@ -16,6 +30,20 @@ export declare const card: import("tailwind-variants").TVReturnType<{
16
30
  filled: string;
17
31
  outlined: string;
18
32
  };
33
+ padding: {
34
+ none: {
35
+ base: string;
36
+ };
37
+ sm: {
38
+ base: string;
39
+ };
40
+ md: {
41
+ base: string;
42
+ };
43
+ lg: {
44
+ base: string;
45
+ };
46
+ };
19
47
  hoverable: {
20
48
  true: string;
21
49
  };
@@ -28,6 +56,20 @@ export declare const card: import("tailwind-variants").TVReturnType<{
28
56
  filled: string;
29
57
  outlined: string;
30
58
  };
59
+ padding: {
60
+ none: {
61
+ base: string;
62
+ };
63
+ sm: {
64
+ base: string;
65
+ };
66
+ md: {
67
+ base: string;
68
+ };
69
+ lg: {
70
+ base: string;
71
+ };
72
+ };
31
73
  hoverable: {
32
74
  true: string;
33
75
  };
@@ -1,7 +1,7 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const card = tv({
3
3
  slots: {
4
- base: 'relative flex flex-col rounded-lg disabled:opacity-[0.38] disabled:bg-sys-color-surface-variant state-layer before:rounded-lg focus:outline-3 focus:outline-md-sys-color-secondary p-4 [transition:box-shadow_var(--md-sys-motion-duration,200ms)_var(--md-sys-motion-timing-function,cubic-bezier(0.34,0.8,0.34,1))]',
4
+ base: 'relative flex flex-col rounded-lg disabled:opacity-[0.38] disabled:bg-sys-color-surface-variant state-layer before:rounded-lg focus:outline-3 focus:outline-md-sys-color-secondary [transition:box-shadow_var(--md-sys-motion-duration,200ms)_var(--md-sys-motion-timing-function,cubic-bezier(0.34,0.8,0.34,1))]',
5
5
  icon: 'size-6 text-[24px] text-md-sys-color-primary'
6
6
  },
7
7
  variants: {
@@ -10,6 +10,12 @@ export const card = tv({
10
10
  filled: 'bg-md-sys-color-surface-container-high',
11
11
  outlined: 'bg-md-sys-color-surface outline-1 outline-md-sys-color-outline-variant'
12
12
  },
13
+ padding: {
14
+ none: { base: 'p-0' },
15
+ sm: { base: 'p-3' },
16
+ md: { base: 'p-4' },
17
+ lg: { base: 'p-6' }
18
+ },
13
19
  hoverable: {
14
20
  true: ''
15
21
  }
@@ -23,6 +23,11 @@ export type CardProps = CardVariants & HTMLAttributes<HTMLDivElement> & HTMLAnch
23
23
  * @default 'filled'
24
24
  */
25
25
  type?: CardVariants['type'];
26
+ /**
27
+ * Internal padding of the card.
28
+ * @default 'md'
29
+ */
30
+ padding?: CardVariants['padding'];
26
31
  /**
27
32
  * Whether the card should show a state layer on hover.
28
33
  * Defaults to true if `href` is provided.
@@ -6,20 +6,21 @@ SinglePane provides a centered or full-width container for content.
6
6
  import clsx from 'clsx';
7
7
  import { singlePane } from './theme.js';
8
8
  import type { SinglePaneProps } from './types.js';
9
- import type { Snippet } from 'svelte';
10
9
 
11
10
  const {
12
11
  children,
13
12
  centered = 'none',
14
13
  background = true,
15
14
  full = true,
15
+ padding = 'md',
16
+ gap = 'md',
16
17
  rounded = true,
17
18
  class: className,
18
19
  contentClass,
19
20
  ...rest
20
21
  }: SinglePaneProps = $props();
21
22
 
22
- const { base, content } = $derived(singlePane({ centered, full, background, rounded }));
23
+ const { base, content } = $derived(singlePane({ padding, gap, centered, full, background, rounded }));
23
24
  </script>
24
25
 
25
26
  <div class={base({ class: clsx(className) })} {...rest}>
@@ -17,6 +17,7 @@ SupportingPane provides a layout with a main content area and a supporting side
17
17
  position = 'right',
18
18
  centered = false,
19
19
  rounded = true,
20
+ gap = 'md',
20
21
  class: className,
21
22
  mainClass,
22
23
  full = true,
@@ -34,7 +35,7 @@ SupportingPane provides a layout with a main content area and a supporting side
34
35
  base,
35
36
  main: mainCls,
36
37
  supporting: supportingCls
37
- } = $derived(supportingPane({ anchor, position, centered, full, rounded }));
38
+ } = $derived(supportingPane({ anchor, position, centered, full, rounded, gap }));
38
39
 
39
40
  const cssVars = $derived(
40
41
  anchor === 'viewport'
@@ -128,10 +128,40 @@ export declare const singlePane: import("tailwind-variants").TVReturnType<{
128
128
  base: string;
129
129
  };
130
130
  };
131
+ padding: {
132
+ none: {
133
+ content: string;
134
+ };
135
+ sm: {
136
+ content: string;
137
+ };
138
+ md: {
139
+ content: string;
140
+ };
141
+ lg: {
142
+ content: string;
143
+ };
144
+ };
145
+ gap: {
146
+ none: {
147
+ content: string;
148
+ };
149
+ sm: {
150
+ content: string;
151
+ };
152
+ md: {
153
+ content: string;
154
+ };
155
+ lg: {
156
+ content: string;
157
+ };
158
+ xl: {
159
+ content: string;
160
+ };
161
+ };
131
162
  }, {
132
163
  base: string;
133
164
  content: string;
134
- headline: string;
135
165
  }, undefined, {
136
166
  background: {
137
167
  true: string;
@@ -158,10 +188,40 @@ export declare const singlePane: import("tailwind-variants").TVReturnType<{
158
188
  base: string;
159
189
  };
160
190
  };
191
+ padding: {
192
+ none: {
193
+ content: string;
194
+ };
195
+ sm: {
196
+ content: string;
197
+ };
198
+ md: {
199
+ content: string;
200
+ };
201
+ lg: {
202
+ content: string;
203
+ };
204
+ };
205
+ gap: {
206
+ none: {
207
+ content: string;
208
+ };
209
+ sm: {
210
+ content: string;
211
+ };
212
+ md: {
213
+ content: string;
214
+ };
215
+ lg: {
216
+ content: string;
217
+ };
218
+ xl: {
219
+ content: string;
220
+ };
221
+ };
161
222
  }, {
162
223
  base: string;
163
224
  content: string;
164
- headline: string;
165
225
  }, import("tailwind-variants").TVReturnType<{
166
226
  background: {
167
227
  true: string;
@@ -188,10 +248,40 @@ export declare const singlePane: import("tailwind-variants").TVReturnType<{
188
248
  base: string;
189
249
  };
190
250
  };
251
+ padding: {
252
+ none: {
253
+ content: string;
254
+ };
255
+ sm: {
256
+ content: string;
257
+ };
258
+ md: {
259
+ content: string;
260
+ };
261
+ lg: {
262
+ content: string;
263
+ };
264
+ };
265
+ gap: {
266
+ none: {
267
+ content: string;
268
+ };
269
+ sm: {
270
+ content: string;
271
+ };
272
+ md: {
273
+ content: string;
274
+ };
275
+ lg: {
276
+ content: string;
277
+ };
278
+ xl: {
279
+ content: string;
280
+ };
281
+ };
191
282
  }, {
192
283
  base: string;
193
284
  content: string;
194
- headline: string;
195
285
  }, undefined, unknown, unknown, undefined>>;
196
286
  export declare const supportingPane: import("tailwind-variants").TVReturnType<{
197
287
  anchor: {
@@ -220,6 +310,20 @@ export declare const supportingPane: import("tailwind-variants").TVReturnType<{
220
310
  base: string;
221
311
  };
222
312
  };
313
+ gap: {
314
+ none: {
315
+ base: string;
316
+ };
317
+ sm: {
318
+ base: string;
319
+ };
320
+ md: {
321
+ base: string;
322
+ };
323
+ lg: {
324
+ base: string;
325
+ };
326
+ };
223
327
  full: {
224
328
  true: {
225
329
  base: string;
@@ -265,6 +369,20 @@ export declare const supportingPane: import("tailwind-variants").TVReturnType<{
265
369
  base: string;
266
370
  };
267
371
  };
372
+ gap: {
373
+ none: {
374
+ base: string;
375
+ };
376
+ sm: {
377
+ base: string;
378
+ };
379
+ md: {
380
+ base: string;
381
+ };
382
+ lg: {
383
+ base: string;
384
+ };
385
+ };
268
386
  full: {
269
387
  true: {
270
388
  base: string;
@@ -310,6 +428,20 @@ export declare const supportingPane: import("tailwind-variants").TVReturnType<{
310
428
  base: string;
311
429
  };
312
430
  };
431
+ gap: {
432
+ none: {
433
+ base: string;
434
+ };
435
+ sm: {
436
+ base: string;
437
+ };
438
+ md: {
439
+ base: string;
440
+ };
441
+ lg: {
442
+ base: string;
443
+ };
444
+ };
313
445
  full: {
314
446
  true: {
315
447
  base: string;
@@ -43,8 +43,7 @@ export const splitPane = tv({
43
43
  export const singlePane = tv({
44
44
  slots: {
45
45
  base: 'flex flex-col box-border overflow-clip items-center',
46
- content: 'flex flex-1 flex-col gap-3 w-full md:pb-12 max-w-7xl mx-auto',
47
- headline: 'md-sys-typescale-title-medium mb-4'
46
+ content: 'flex flex-1 flex-col w-full max-w-7xl mx-auto'
48
47
  },
49
48
  variants: {
50
49
  background: {
@@ -71,6 +70,19 @@ export const singlePane = tv({
71
70
  false: {
72
71
  base: ''
73
72
  }
73
+ },
74
+ padding: {
75
+ none: { content: 'p-0' },
76
+ sm: { content: 'p-3 md:p-4' },
77
+ md: { content: 'p-4 md:p-6 lg:p-8' },
78
+ lg: { content: 'p-6 md:p-8 lg:p-12' }
79
+ },
80
+ gap: {
81
+ none: { content: 'gap-0' },
82
+ sm: { content: 'gap-2' },
83
+ md: { content: 'gap-3' },
84
+ lg: { content: 'gap-4' },
85
+ xl: { content: 'gap-6' }
74
86
  }
75
87
  },
76
88
  defaultVariants: {
@@ -79,7 +91,7 @@ export const singlePane = tv({
79
91
  });
80
92
  export const supportingPane = tv({
81
93
  slots: {
82
- base: 'flex w-full flex-col gap-6 md:flex-row',
94
+ base: 'flex w-full flex-col md:flex-row',
83
95
  main: 'bg-md-sys-color-surface box-border grow order-2 md:order-1',
84
96
  supporting: 'text-md-sys-color-on-surface-container box-border order-1 md:order-2 min-w-min md:w-80 overflow-x-visible'
85
97
  },
@@ -112,6 +124,12 @@ export const supportingPane = tv({
112
124
  base: 'justify-between'
113
125
  }
114
126
  },
127
+ gap: {
128
+ none: { base: 'gap-0' },
129
+ sm: { base: 'gap-4' },
130
+ md: { base: 'gap-6' },
131
+ lg: { base: 'gap-8' }
132
+ },
115
133
  full: {
116
134
  true: { base: 'min-h-dvh' },
117
135
  false: ''
@@ -147,6 +165,7 @@ export const supportingPane = tv({
147
165
  anchor: 'parent',
148
166
  position: 'right',
149
167
  centered: true,
150
- rounded: true
168
+ rounded: true,
169
+ gap: 'md'
151
170
  }
152
171
  });
@@ -14,10 +14,12 @@ export declare const stack: import("tailwind-variants").TVReturnType<{
14
14
  h: string;
15
15
  };
16
16
  gap: {
17
- md: string;
17
+ none: string;
18
+ xs: string;
18
19
  sm: string;
20
+ md: string;
19
21
  lg: string;
20
- none: string;
22
+ xl: string;
21
23
  };
22
24
  }, undefined, "flex relative", {
23
25
  type: {
@@ -33,10 +35,12 @@ export declare const stack: import("tailwind-variants").TVReturnType<{
33
35
  h: string;
34
36
  };
35
37
  gap: {
36
- md: string;
38
+ none: string;
39
+ xs: string;
37
40
  sm: string;
41
+ md: string;
38
42
  lg: string;
39
- none: string;
43
+ xl: string;
40
44
  };
41
45
  }, undefined, import("tailwind-variants").TVReturnType<{
42
46
  type: {
@@ -52,9 +56,11 @@ export declare const stack: import("tailwind-variants").TVReturnType<{
52
56
  h: string;
53
57
  };
54
58
  gap: {
55
- md: string;
59
+ none: string;
60
+ xs: string;
56
61
  sm: string;
62
+ md: string;
57
63
  lg: string;
58
- none: string;
64
+ xl: string;
59
65
  };
60
66
  }, undefined, "flex relative", unknown, unknown, undefined>>;
@@ -15,10 +15,12 @@ export const stack = tv({
15
15
  h: 'h-full'
16
16
  },
17
17
  gap: {
18
+ none: 'gap-0',
19
+ xs: 'gap-1',
20
+ sm: 'gap-2',
18
21
  md: 'gap-3',
19
- sm: 'gap-px',
20
- lg: 'gap-6',
21
- none: 'gap-0'
22
+ lg: 'gap-4',
23
+ xl: 'gap-6'
22
24
  }
23
25
  }
24
26
  });
@@ -6,7 +6,7 @@
6
6
  let open = $state(false);
7
7
  </script>
8
8
 
9
- <div class="fixed right-4 bottom-4 z-50">
9
+ <div class="fixed right-4 bottom-4 z-50 hidden md:block">
10
10
  <Popover bind:open title="Theme Settings" side="top" align="end" sideOffset={16}>
11
11
  {#snippet trigger()}
12
12
  <FAB iconProps={{ name: 'palette' }} config="primary" />
@@ -10,24 +10,30 @@ This component takes NavbarItems as its children
10
10
  @see https://m3.material.io/components/navigation-bar/overview
11
11
  -->
12
12
  <script lang="ts">
13
+ import clsx from 'clsx';
13
14
  import { NavigationMenu } from 'bits-ui';
14
15
  import { navbar } from './theme.js';
15
16
  import type { NavBarProps } from './types.js';
16
17
 
17
- const { children, fab, ghost = false }: NavBarProps = $props();
18
-
18
+ const { children, fab, ghost = false, class: className, ...restProps }: NavBarProps = $props();
19
19
  const { base, items, fab: fabCls, ghost: ghostCls } = $derived(navbar());
20
20
  </script>
21
21
 
22
- <div class={base()}>
22
+ <div class={base({ class: clsx(className) })} {...restProps}>
23
23
  {#if fab}
24
24
  <div class={fabCls()}>
25
25
  {@render fab?.()}
26
26
  </div>
27
27
  {/if}
28
28
  <NavigationMenu.Root orientation="horizontal" class="flex w-full">
29
- <NavigationMenu.List class={items()}>
30
- {@render children()}
29
+ <NavigationMenu.List>
30
+ {#snippet child({ props, wrapperProps })}
31
+ <div {...wrapperProps} class="w-full">
32
+ <ul {...props} class={items()}>
33
+ {@render children()}
34
+ </ul>
35
+ </div>
36
+ {/snippet}
31
37
  </NavigationMenu.List>
32
38
  </NavigationMenu.Root>
33
39
  </div>
@@ -12,7 +12,7 @@ export const navitem = tv({
12
12
  base: 'group relative flex flex-1 flex-col items-center justify-center min-w-0 max-w-[168px] h-full transition-colors',
13
13
  content: 'flex flex-col items-center justify-center gap-1 w-full',
14
14
  iconContainer: 'relative flex items-center justify-center h-8 w-16 rounded-full transition-colors duration-200 ease-in-out',
15
- icon: 'text-[24px]',
15
+ icon: 'text-[24px] size-6',
16
16
  label: 'md-sys-typescale-label-medium truncate w-full text-center'
17
17
  },
18
18
  variants: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {