@noxlovette/material 0.1.9 → 0.1.11

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.
@@ -49,7 +49,7 @@ 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
@@ -58,6 +58,7 @@ Icon buttons help people take minor actions and are often used in app bars.
58
58
  class={btnCls}
59
59
  data-cy="m3-button-icon"
60
60
  {...restProps as ToggleRootProps}
61
+ {...triggerAttrs}
61
62
  >
62
63
  {#if loading}
63
64
  <LoadingIndicator />
@@ -73,6 +74,7 @@ Icon buttons help people take minor actions and are often used in app bars.
73
74
  class={btnCls}
74
75
  data-cy="m3-button-icon"
75
76
  {...restProps as ButtonRootProps}
77
+ {...triggerAttrs}
76
78
  >
77
79
  {#if loading}
78
80
  <LoadingIndicator />
@@ -31,6 +31,7 @@ on screen until confirmed, dismissed, or a required action has been taken.
31
31
  maxWidth = '560px',
32
32
  children,
33
33
  disabled = false,
34
+ delegateClose = false,
34
35
  class: className,
35
36
  contentProps,
36
37
  ...rootRest
@@ -100,11 +101,17 @@ on screen until confirmed, dismissed, or a required action has been taken.
100
101
  {cancelText}
101
102
  </Button>
102
103
 
103
- <Dialog.Close>
104
+ {#if delegateClose}
104
105
  <Button type="submit" {disabled} {loading} data-cy="dialogue-confirm">
105
106
  {confirmText}
106
107
  </Button>
107
- </Dialog.Close>
108
+ {:else}
109
+ <Dialog.Close>
110
+ <Button type="submit" {disabled} {loading} data-cy="dialogue-confirm">
111
+ {confirmText}
112
+ </Button>
113
+ </Dialog.Close>
114
+ {/if}
108
115
  </div>
109
116
  </form>
110
117
  {/if}
@@ -41,4 +41,11 @@ export type DialogueProps = DialogueVariants & Dialog.RootProps & {
41
41
  class?: string;
42
42
  /** Optional callback when the confirm button is clicked. */
43
43
  onconfirm?: () => void;
44
+ /**
45
+ * When true, Dialog.Close is NOT rendered around the confirm button.
46
+ * The consumer is responsible for closing the dialog (e.g. via onResult in superforms).
47
+ * Useful when you need to keep the dialog open on validation failure.
48
+ * @default false
49
+ */
50
+ delegateClose?: boolean;
44
51
  };
@@ -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 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {