@sierra-95/svelte-scaffold 1.2.18 → 1.2.20

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,12 +13,22 @@
13
13
  optionsBackground = 'white',
14
14
  showInput = true,
15
15
  readonly = false,
16
+ ...rest
16
17
  } = $props();
17
18
  </script>
18
19
 
19
20
  {#if showInput}
20
21
  <label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
21
- <select disabled={readonly} bind:value={value} id={id} name={id} required style="background-color: {background}; height: {height}">
22
+ <select
23
+ {...rest}
24
+ disabled={readonly}
25
+ bind:value={value} id={id} name={id}
26
+ style="background-color: {background}; height: {height}"
27
+ required={rest.required}
28
+ onchange={(e) => {
29
+ rest.onchange?.(e);
30
+ }}
31
+ >
22
32
  {#each options as option}
23
33
  <option
24
34
  value={option.value}
@@ -12,6 +12,6 @@ declare const Select: import("svelte").Component<{
12
12
  optionsBackground?: string;
13
13
  showInput?: boolean;
14
14
  readonly?: boolean;
15
- }, {}, "value">;
15
+ } & Record<string, any>, {}, "value">;
16
16
  type Select = ReturnType<typeof Select>;
17
17
  export default Select;
@@ -1,7 +1,7 @@
1
- export declare function buildRedirectUrl(baseUrl: string, redirectTo?: string): string;
1
+ export declare function buildRedirectUrl(baseUrl: string, redirectTo?: string, extraParameters?: Record<string, string>): string;
2
2
  type RedirectOptions = {
3
3
  replaceState?: boolean;
4
4
  useHardRedirect?: boolean;
5
5
  };
6
- export declare function handleRedirect(baseUrl: string, redirectTo?: string, options?: RedirectOptions): void;
6
+ export declare function handleRedirect(baseUrl: string, redirectTo?: string, options?: RedirectOptions, extraParameters?: Record<string, string>): void;
7
7
  export {};
@@ -14,16 +14,23 @@ function sanitizeRedirect(redirectTo) {
14
14
  }
15
15
  return redirectTo;
16
16
  }
17
- export function buildRedirectUrl(baseUrl, redirectTo) {
17
+ export function buildRedirectUrl(baseUrl, redirectTo, extraParameters = {}) {
18
18
  const safe = sanitizeRedirect(redirectTo);
19
- return safe
20
- ? `${baseUrl}?redirectTo=${encodeURIComponent(safe)}`
21
- : baseUrl;
19
+ const url = new URL(baseUrl, window.location.origin);
20
+ Object.entries(extraParameters).forEach(([key, value]) => {
21
+ if (value !== undefined && value !== null) {
22
+ url.searchParams.set(key, value);
23
+ }
24
+ });
25
+ if (safe) {
26
+ url.searchParams.set('redirectTo', safe);
27
+ }
28
+ return url.pathname + url.search;
22
29
  }
23
- export function handleRedirect(baseUrl, redirectTo, options = {}) {
30
+ export function handleRedirect(baseUrl, redirectTo, options = {}, extraParameters = {}) {
24
31
  if (!browser)
25
32
  return;
26
- const finalUrl = buildRedirectUrl(baseUrl, redirectTo);
33
+ const finalUrl = buildRedirectUrl(baseUrl, redirectTo, extraParameters);
27
34
  const { replaceState = false, useHardRedirect = false } = options;
28
35
  if (useHardRedirect) {
29
36
  window.location.href = finalUrl;
package/dist/index.d.ts CHANGED
@@ -56,11 +56,11 @@ export { fileInputStore, resetFileInputStore, fileInputConfig } from './stores/m
56
56
  export type { FileInputStoreMediaItem } from './stores/modules/fileInput.js';
57
57
  export { layoutStore, resetLayoutStore } from './stores/modules/layout.js';
58
58
  export { addToast, removeToast, toasts } from './stores/features/toastManager.js';
59
- export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Hooks/preview.js';
60
- export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout_menu.js';
61
- export { buttonRipple } from './Hooks/button.js';
62
- export { buildSearchIndex } from './Hooks/buildSearch.js';
63
- export { isValidEmail } from './Hooks/validateForms.js';
64
- export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
65
- export type { SearchResult } from './Hooks/buildSearch.js';
59
+ export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Utils/preview.js';
60
+ export { validateLayoutMenuSections, filterSectionsByRole } from './Utils/layout_menu.js';
61
+ export { buttonRipple } from './Utils/button.js';
62
+ export { buildSearchIndex } from './Utils/buildSearch.js';
63
+ export { isValidEmail } from './Utils/validateForms.js';
64
+ export { handleRedirect, buildRedirectUrl } from './Utils/redirectTo.js';
65
+ export type { SearchResult } from './Utils/buildSearch.js';
66
66
  export type { Section, SectionItem } from './stores/modules/layout.js';
package/dist/index.js CHANGED
@@ -68,9 +68,9 @@ export { fileInputStore, resetFileInputStore, fileInputConfig } from './stores/m
68
68
  export { layoutStore, resetLayoutStore } from './stores/modules/layout.js';
69
69
  export { addToast, removeToast, toasts } from './stores/features/toastManager.js';
70
70
  //#######################HOOKS/UTILS########################
71
- export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Hooks/preview.js';
72
- export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout_menu.js';
73
- export { buttonRipple } from './Hooks/button.js';
74
- export { buildSearchIndex } from './Hooks/buildSearch.js';
75
- export { isValidEmail } from './Hooks/validateForms.js';
76
- export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
71
+ export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Utils/preview.js';
72
+ export { validateLayoutMenuSections, filterSectionsByRole } from './Utils/layout_menu.js';
73
+ export { buttonRipple } from './Utils/button.js';
74
+ export { buildSearchIndex } from './Utils/buildSearch.js';
75
+ export { isValidEmail } from './Utils/validateForms.js';
76
+ export { handleRedirect, buildRedirectUrl } from './Utils/redirectTo.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes