@getmicdrop/svelte-components 5.3.2 → 5.3.3

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.
@@ -13,6 +13,7 @@
13
13
  * - ghost-red: Destructive text button
14
14
  * - icon: Icon-only button
15
15
  * - toggle: Toggle/pill button
16
+ * - nav: Mobile navigation button (column layout with icon + label)
16
17
  *
17
18
  * Sizes (Flowbite native): xs, sm, md, lg, xl
18
19
  */
@@ -30,6 +31,7 @@
30
31
  children?: any,
31
32
  class?: string,
32
33
  onclick?: (e: MouseEvent) => void,
34
+ buttonRef?: HTMLButtonElement | HTMLAnchorElement | null,
33
35
  [key: string]: any
34
36
  }} */
35
37
  let {
@@ -44,6 +46,7 @@
44
46
  children,
45
47
  class: className = "",
46
48
  onclick,
49
+ buttonRef = $bindable(null),
47
50
  ...restProps
48
51
  } = $props();
49
52
 
@@ -82,6 +85,14 @@
82
85
  lg: "p-3",
83
86
  };
84
87
 
88
+ // Nav variant sizes (mobile bottom nav style)
89
+ const navSizes = {
90
+ xs: "py-1 text-xs",
91
+ sm: "py-1.5 text-xs",
92
+ md: "py-2 text-xs",
93
+ lg: "py-2.5 text-xs",
94
+ };
95
+
85
96
  // Variant classes with all states in Tailwind
86
97
  // Note: focus:ring-4 is added per-variant to allow icon/link variants to have no ring
87
98
  const variantClasses = {
@@ -95,13 +106,15 @@
95
106
  link: "text-blue-700 bg-transparent border-transparent hover:underline dark:text-blue-500",
96
107
  icon: "text-gray-500 bg-transparent border-transparent hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",
97
108
  toggle: "text-gray-500 bg-gray-100 border border-gray-200 hover:bg-gray-200 focus:ring-4 focus:ring-gray-200 dark:bg-gray-700 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-600",
109
+ nav: "text-gray-400 bg-transparent border-transparent hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",
98
110
  success: "text-white bg-green-600 border border-green-600",
99
111
  };
100
112
 
101
- // Active state classes for ghost and toggle
113
+ // Active state classes for ghost, toggle, and nav
102
114
  const activeClasses = {
103
115
  ghost: "text-blue-700 bg-blue-50 dark:text-white dark:bg-gray-900",
104
116
  toggle: "text-white bg-blue-600 border-blue-600 hover:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-700",
117
+ nav: "text-blue-600 dark:text-blue-500",
105
118
  };
106
119
 
107
120
  // Disabled classes
@@ -110,6 +123,8 @@
110
123
  let sizeClass = $derived(
111
124
  resolvedVariant === "icon"
112
125
  ? (iconSizes[size] || iconSizes.sm)
126
+ : resolvedVariant === "nav"
127
+ ? (navSizes[size] || navSizes.md)
113
128
  : resolvedVariant === "link"
114
129
  ? "text-sm"
115
130
  : (sizeClasses[size] || sizeClasses.md)
@@ -118,16 +133,21 @@
118
133
  let variantClass = $derived((() => {
119
134
  if (success) return variantClasses.success;
120
135
  if (disabled && !loading && !success) return disabledClasses;
121
- if (active && (resolvedVariant === "ghost" || resolvedVariant === "toggle")) {
136
+ if (active && (resolvedVariant === "ghost" || resolvedVariant === "toggle" || resolvedVariant === "nav")) {
122
137
  return activeClasses[resolvedVariant];
123
138
  }
124
139
  return variantClasses[resolvedVariant] || variantClasses.default;
125
140
  })());
126
141
 
142
+ // Nav variant uses column layout, others use row
143
+ let flexDirection = $derived(resolvedVariant === "nav" ? "flex-col" : "");
144
+ let roundedClass = $derived(resolvedVariant === "nav" ? "" : "rounded-lg");
145
+
127
146
  let buttonClasses = $derived([
128
147
  "relative",
129
148
  "inline-flex items-center justify-center",
130
- "rounded-lg",
149
+ flexDirection,
150
+ roundedClass,
131
151
  "font-medium leading-none",
132
152
  "focus:outline-none",
133
153
  "transition-colors duration-150",
@@ -141,6 +161,7 @@
141
161
 
142
162
  {#if href}
143
163
  <a
164
+ bind:this={buttonRef}
144
165
  {href}
145
166
  class="{buttonClasses} {loading ? 'loading-pulse' : ''}"
146
167
  {onclick}
@@ -155,6 +176,7 @@
155
176
  </a>
156
177
  {:else}
157
178
  <button
179
+ bind:this={buttonRef}
158
180
  class="{buttonClasses} {loading ? 'loading-pulse' : ''}"
159
181
  disabled={effectiveDisabled}
160
182
  {onclick}
@@ -14,6 +14,7 @@ type Button = {
14
14
  children?: any;
15
15
  class?: string | undefined;
16
16
  onclick?: ((e: MouseEvent) => void) | undefined;
17
+ buttonRef?: HTMLButtonElement | HTMLAnchorElement | null | undefined;
17
18
  }>): void;
18
19
  };
19
20
  declare const Button: import("svelte").Component<{
@@ -29,5 +30,6 @@ declare const Button: import("svelte").Component<{
29
30
  children?: any;
30
31
  class?: string;
31
32
  onclick?: (e: MouseEvent) => void;
32
- }, {}, "">;
33
+ buttonRef?: HTMLButtonElement | HTMLAnchorElement | null;
34
+ }, {}, "buttonRef">;
33
35
  //# sourceMappingURL=Button.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Button/Button.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8LA;;cAbc,MAAM;WACT,MAAM;eACF,OAAO;cACR,OAAO;cACP,OAAO;kBACH,MAAM;aACX,OAAO;WACT,MAAM,GAAG,IAAI;eACT,GAAG;YACN,MAAM;cACJ,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;WAGgB"}
1
+ {"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Button/Button.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmNA;;cAdc,MAAM;WACT,MAAM;eACF,OAAO;cACR,OAAO;cACP,OAAO;kBACH,MAAM;aACX,OAAO;WACT,MAAM,GAAG,IAAI;eACT,GAAG;YACN,MAAM;cACJ,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;gBACrB,iBAAiB,GAAG,iBAAiB,GAAG,IAAI;oBAGP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmicdrop/svelte-components",
3
- "version": "5.3.2",
3
+ "version": "5.3.3",
4
4
  "description": "Shared component library for Micdrop applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",