@noxlovette/material 0.1.8 → 0.1.10

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.
@@ -36,7 +36,13 @@ Buttons help people take actions, such as sending an email, sharing a document,
36
36
  const btnCls = $derived(base({ class: clsx(className) }));
37
37
  </script>
38
38
 
39
- <Button.Root {disabled} {formaction} class={btnCls} {...restProps as ButtonRootProps}>
39
+ <Button.Root
40
+ {disabled}
41
+ {formaction}
42
+ class={btnCls}
43
+ data-cy="m3-button"
44
+ {...restProps as ButtonRootProps}
45
+ >
40
46
  {#if iconProps}
41
47
  {#if loading}
42
48
  <LoadingIndicator container={variant === 'filled'} class={icon()} />
@@ -49,14 +49,16 @@ Icon buttons help people take minor actions and are often used in app bars.
49
49
  </script>
50
50
 
51
51
  <Tooltip {triggerClass} variant="snack" supportingText={tooltipContent}>
52
- {#snippet trigger()}
52
+ {#snippet trigger(triggerAttrs)}
53
53
  {#if variation === 'toggle'}
54
54
  <Toggle.Root
55
55
  bind:pressed
56
56
  {onPressedChange}
57
57
  {disabled}
58
58
  class={btnCls}
59
+ data-cy="m3-button-icon"
59
60
  {...restProps as ToggleRootProps}
61
+ {...triggerAttrs}
60
62
  >
61
63
  {#if loading}
62
64
  <LoadingIndicator />
@@ -66,7 +68,14 @@ Icon buttons help people take minor actions and are often used in app bars.
66
68
  {/if}
67
69
  </Toggle.Root>
68
70
  {:else}
69
- <Button.Root {disabled} {formaction} class={btnCls} {...restProps as ButtonRootProps}>
71
+ <Button.Root
72
+ {disabled}
73
+ {formaction}
74
+ class={btnCls}
75
+ data-cy="m3-button-icon"
76
+ {...restProps as ButtonRootProps}
77
+ {...triggerAttrs}
78
+ >
70
79
  {#if loading}
71
80
  <LoadingIndicator />
72
81
  {:else}
@@ -68,6 +68,7 @@ Floating action buttons (FABs) help people take primary actions.
68
68
  {formaction}
69
69
  class={btnCls}
70
70
  onclick={handleClick}
71
+ data-cy="m3-fab"
71
72
  {...restProps as ButtonRootProps}
72
73
  >
73
74
  <Icon {...iconProps} class={icon()} />
@@ -28,6 +28,7 @@ Should be used with `FABMenuItem` as children.
28
28
  </script>
29
29
 
30
30
  <ul
31
+ data-cy="m3-fab-menu"
31
32
  {...restProps}
32
33
  class={base({
33
34
  class: clsx(className, 'fab-menu overflow-y-auto')
@@ -23,7 +23,12 @@ An individual action within a FAB menu.
23
23
  const btnCls = $derived(base({ class: clsx(className) }));
24
24
  </script>
25
25
 
26
- <Button.Root {formaction} class={btnCls} {...restProps as ButtonRootProps}>
26
+ <Button.Root
27
+ {formaction}
28
+ class={btnCls}
29
+ data-cy="m3-fab-menu-item"
30
+ {...restProps as ButtonRootProps}
31
+ >
27
32
  {#if iconProps}
28
33
  {#if loading}
29
34
  <LoadingIndicator />
@@ -44,6 +44,7 @@ Uses Material 3 selection button styling.
44
44
  {onPressedChange}
45
45
  {disabled}
46
46
  class={btnCls}
47
+ data-cy="m3-toggle"
47
48
  {...restProps as ToggleRootProps}
48
49
  >
49
50
  {#if iconProps}
@@ -27,12 +27,12 @@ and serve as an entry point to more detailed information.
27
27
  </script>
28
28
 
29
29
  {#if href}
30
- <a {href} class={base({ class: clsx(className) })} {...restProps}>
30
+ <a {href} class={base({ class: clsx(className) })} data-cy="m3-card" {...restProps}>
31
31
  {#if hoverable}<Layer />{/if}
32
32
  {@render children?.()}
33
33
  </a>
34
34
  {:else}
35
- <div class={base({ class: clsx(className) })} {...restProps}>
35
+ <div class={base({ class: clsx(className) })} data-cy="m3-card" {...restProps}>
36
36
  {#if hoverable}<Layer />{/if}
37
37
  {@render children?.()}
38
38
  </div>
@@ -516,7 +516,6 @@ Follows Material 3 design principles for file uploaders.
516
516
 
517
517
  <Dialogue
518
518
  open={!!fileToRemove}
519
- toggle={() => (fileToRemove = null)}
520
519
  onconfirm={() => {
521
520
  if (fileToRemove) {
522
521
  removeFile(fileToRemove);
@@ -51,8 +51,13 @@ Plain tooltips are used for simple labels, while rich tooltips can contain forma
51
51
  </script>
52
52
 
53
53
  <Tooltip.Root {...restProps} {delayDuration} bind:open={isOpen}>
54
- <Tooltip.Trigger {...triggerProps} class={triggerCls({ class: clsx(triggerClass) })}>
55
- {@render trigger?.()}
54
+ <Tooltip.Trigger {...triggerProps}>
55
+ {#snippet child({ props })}
56
+ {@render trigger?.({
57
+ ...props,
58
+ class: triggerCls({ class: clsx(triggerClass, props.class as string) })
59
+ })}
60
+ {/snippet}
56
61
  </Tooltip.Trigger>
57
62
  <Tooltip.Portal>
58
63
  {#if showArrow}
@@ -9,7 +9,7 @@ export type TooltipProps = TooltipVariants & TooltipRootProps & {
9
9
  /** Secondary text providing additional context */
10
10
  supportingText?: string | null;
11
11
  /** The element that triggers the tooltip on hover or focus */
12
- trigger?: Snippet;
12
+ trigger?: Snippet<[Record<string, unknown>]>;
13
13
  /** CSS class applied to the trigger element */
14
14
  triggerClass?: string;
15
15
  /** Additional props passed to the underlying Tooltip.Trigger component */
@@ -47,7 +47,7 @@ Avatars can be used to represent people or objects.
47
47
  </script>
48
48
 
49
49
  {#if onclick}
50
- <button class={button({ class: rootClasses })} {onclick} type="button">
50
+ <button class={button({ class: rootClasses })} {onclick} type="button" data-cy="m3-avatar">
51
51
  <Layer />
52
52
  <AvatarPrimitive.Root {...rest} bind:loadingStatus class="h-full w-full">
53
53
  {#if src}
@@ -59,7 +59,7 @@ Avatars can be used to represent people or objects.
59
59
  </AvatarPrimitive.Root>
60
60
  </button>
61
61
  {:else}
62
- <AvatarPrimitive.Root {...rest} bind:loadingStatus class={rootClasses}>
62
+ <AvatarPrimitive.Root {...rest} bind:loadingStatus class={rootClasses} data-cy="m3-avatar">
63
63
  {#if src}
64
64
  <AvatarPrimitive.Image {src} {alt} class={image()} />
65
65
  {/if}
@@ -24,7 +24,7 @@ Material 3 Circular Progress Indicator.
24
24
  let circumference = $derived(Math.PI * r * 2);
25
25
  </script>
26
26
 
27
- <Progress.Root value={percent ?? null} max={100}>
27
+ <Progress.Root value={percent ?? null} max={100} data-cy="m3-circular-progress">
28
28
  {#snippet child({ props })}
29
29
  <svg
30
30
  {...props}
@@ -37,6 +37,7 @@ Material 3 Linear Progress Indicator.
37
37
  max={100}
38
38
  class={container({ class: clsx(className) })}
39
39
  style="height: {height / 16}rem"
40
+ data-cy="m3-linear-progress"
40
41
  >
41
42
  {#if percent != null}
42
43
  <div class={fill()} style:width="{percent}%"></div>
@@ -61,7 +61,7 @@ Snackbars provide brief messages about app processes at the bottom of the screen
61
61
  {#if message && !dismissed}
62
62
  <div
63
63
  class={base()}
64
- data-cy="notification-snackbar"
64
+ data-cy="m3-snackbar"
65
65
  {...restProps}
66
66
  in:enterExit={{
67
67
  duration: 400,
@@ -100,7 +100,7 @@ Snackbars provide brief messages about app processes at the bottom of the screen
100
100
  }
101
101
  }}
102
102
  aria-label="Dismiss snackbar"
103
- data-cy="notification-dismiss"
103
+ data-cy="m3-snackbar-dismiss"
104
104
  >
105
105
  <Icon class={icon()} name="close" />
106
106
  <Layer />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {