@aiaiai-pt/design-system 0.5.0 → 0.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.
@@ -49,6 +49,8 @@
49
49
  type = 'button',
50
50
  /** @type {string | undefined} */
51
51
  href = undefined,
52
+ /** @type {HTMLElement | undefined} — bindable ref to the underlying <button> or <a> element */
53
+ ref = $bindable(undefined),
52
54
  /** @type {string} */
53
55
  class: className = '',
54
56
  /** @type {import('svelte').Snippet | undefined} */
@@ -77,6 +79,7 @@
77
79
 
78
80
  {#if href && !disabled}
79
81
  <a
82
+ bind:this={ref}
80
83
  {href}
81
84
  class={classes}
82
85
  aria-busy={loading || undefined}
@@ -86,6 +89,7 @@
86
89
  </a>
87
90
  {:else}
88
91
  <button
92
+ bind:this={ref}
89
93
  type={buttonType}
90
94
  class={classes}
91
95
  disabled={disabled || loading}
@@ -1,7 +1,7 @@
1
1
  export default Button;
2
2
  type Button = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
5
  };
6
6
  /**
7
7
  * Button
@@ -32,7 +32,8 @@ type Button = {
32
32
  * {#snippet icon()}<PhGear size={16} />{/snippet}
33
33
  * </Button>
34
34
  */
35
- declare const Button: import("svelte").Component<{
35
+ declare const Button: import("svelte").Component<
36
+ {
36
37
  variant?: string;
37
38
  size?: string;
38
39
  loading?: boolean;
@@ -40,19 +41,24 @@ declare const Button: import("svelte").Component<{
40
41
  iconOnly?: boolean;
41
42
  type?: string;
42
43
  href?: any;
44
+ ref?: HTMLElement | undefined;
43
45
  class?: string;
44
46
  icon?: any;
45
47
  children?: any;
46
- } & Record<string, any>, {}, "">;
48
+ } & Record<string, any>,
49
+ {},
50
+ "ref"
51
+ >;
47
52
  type $$ComponentProps = {
48
- variant?: string;
49
- size?: string;
50
- loading?: boolean;
51
- disabled?: boolean;
52
- iconOnly?: boolean;
53
- type?: string;
54
- href?: any;
55
- class?: string;
56
- icon?: any;
57
- children?: any;
53
+ variant?: string;
54
+ size?: string;
55
+ loading?: boolean;
56
+ disabled?: boolean;
57
+ iconOnly?: boolean;
58
+ type?: string;
59
+ href?: any;
60
+ ref?: HTMLElement | undefined;
61
+ class?: string;
62
+ icon?: any;
63
+ children?: any;
58
64
  } & Record<string, any>;
@@ -55,11 +55,9 @@
55
55
  const hintId = $derived(`${selectId}-hint`);
56
56
  const hasHint = $derived(!!error || !!help);
57
57
 
58
- let mounted = false;
59
- $effect(() => {
60
- if (!mounted) { mounted = true; return; }
58
+ function handleChange() {
61
59
  if (onchange && value !== undefined) onchange(value);
62
- });
60
+ }
63
61
  </script>
64
62
 
65
63
  <div class="input-group {className}">
@@ -76,6 +74,7 @@
76
74
  aria-describedby={hasHint ? hintId : undefined}
77
75
  {disabled}
78
76
  bind:value
77
+ onchange={handleChange}
79
78
  {...rest}
80
79
  >
81
80
  {#if placeholder}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiai-pt/design-system",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Design system tokens and Svelte components for aiaiai products",
5
5
  "license": "MIT",
6
6
  "type": "module",