@sierra-95/svelte-scaffold 1.2.10 → 1.2.12

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.
@@ -12,9 +12,6 @@
12
12
  #sierra-button:hover{
13
13
  opacity: 0.8;
14
14
  }
15
- #sierra-button i{
16
- font-size: 0.9rem;
17
- }
18
15
  /*********Button Variants*************************/
19
16
  /* .sierra-button-contained {
20
17
 
@@ -18,6 +18,7 @@
18
18
  html2canvas_ignore = 'false',
19
19
  startIcon = '',
20
20
  endIcon = '',
21
+ iconSize = '0.9rem',
21
22
  style = '',
22
23
  children = null,
23
24
  ...rest
@@ -53,9 +54,6 @@
53
54
  #sierra-button:hover{
54
55
  opacity: 0.8;
55
56
  }
56
- #sierra-button i{
57
- font-size: 0.9rem;
58
- }
59
57
  /*********Button Variants*************************/
60
58
  /* .sierra-button-contained {
61
59
 
@@ -118,11 +116,11 @@
118
116
  }}
119
117
  >
120
118
  {#if startIcon}
121
- <i class="fa {startIcon}"></i>
119
+ <i class="fa {startIcon}" style={`font-size: ${iconSize};`}></i>
122
120
  {/if}
123
121
  {@render children?.()}
124
122
  {#if endIcon}
125
- <i class="fa {endIcon}"></i>
123
+ <i class="fa {endIcon}" style={`font-size: ${iconSize};`}></i>
126
124
  {/if}
127
125
  {#if isLoading}
128
126
  <CircularProgress size={spinner} thickness={thickness} />
@@ -11,6 +11,7 @@ declare const Button: import("svelte").Component<{
11
11
  html2canvas_ignore?: string;
12
12
  startIcon?: string;
13
13
  endIcon?: string;
14
+ iconSize?: string;
14
15
  style?: string;
15
16
  children?: any;
16
17
  } & Record<string, any>, {}, "">;
@@ -0,0 +1,7 @@
1
+ export declare function buildRedirectUrl(baseUrl: string, redirectTo?: string): string;
2
+ type RedirectOptions = {
3
+ replaceState?: boolean;
4
+ useHardRedirect?: boolean;
5
+ };
6
+ export declare function handleRedirect(baseUrl: string, redirectTo?: string, options?: RedirectOptions): void;
7
+ export {};
@@ -0,0 +1,33 @@
1
+ import { addToast } from '../index.js';
2
+ import { goto } from '$app/navigation';
3
+ import { browser } from '$app/environment';
4
+ function sanitizeRedirect(redirectTo) {
5
+ if (!redirectTo)
6
+ return undefined;
7
+ if (!redirectTo.startsWith('/')) {
8
+ addToast({
9
+ status: 'warning',
10
+ message: `Invalid redirectTo path: "${redirectTo}". It must start with a "/". Redirect will be ignored.`,
11
+ persistent: true
12
+ });
13
+ return undefined;
14
+ }
15
+ return redirectTo;
16
+ }
17
+ export function buildRedirectUrl(baseUrl, redirectTo) {
18
+ const safe = sanitizeRedirect(redirectTo);
19
+ return safe
20
+ ? `${baseUrl}?redirectTo=${encodeURIComponent(safe)}`
21
+ : baseUrl;
22
+ }
23
+ export function handleRedirect(baseUrl, redirectTo, options = {}) {
24
+ if (!browser)
25
+ return;
26
+ const finalUrl = buildRedirectUrl(baseUrl, redirectTo);
27
+ const { replaceState = false, useHardRedirect = false } = options;
28
+ if (useHardRedirect) {
29
+ window.location.href = finalUrl;
30
+ return;
31
+ }
32
+ goto(finalUrl, { replaceState });
33
+ }
package/dist/index.d.ts CHANGED
@@ -60,5 +60,6 @@ export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout
60
60
  export { buttonRipple } from './Hooks/button.js';
61
61
  export { buildSearchIndex } from './Hooks/buildSearch.js';
62
62
  export { isValidEmail } from './Hooks/validateForms.js';
63
+ export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
63
64
  export type { SearchResult } from './Hooks/buildSearch.js';
64
65
  export type { Section, SectionItem } from './stores/modules/layout.js';
package/dist/index.js CHANGED
@@ -72,3 +72,4 @@ export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout
72
72
  export { buttonRipple } from './Hooks/button.js';
73
73
  export { buildSearchIndex } from './Hooks/buildSearch.js';
74
74
  export { isValidEmail } from './Hooks/validateForms.js';
75
+ export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",