@softwareone/spi-sv5-library 1.7.0 → 1.7.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.
@@ -170,7 +170,15 @@
170
170
  {/snippet}
171
171
  </Notification>
172
172
  </section>
173
- <Form {action} initialData={{ files }} {schema} {extraData} {onsuccess} {onfailure}>
173
+ <Form
174
+ {action}
175
+ initialData={{ files }}
176
+ {schema}
177
+ {extraData}
178
+ enctype="multipart/form-data"
179
+ {onsuccess}
180
+ {onfailure}
181
+ >
174
182
  {#snippet children()}
175
183
  <h2 class="title">Upload file</h2>
176
184
  <section class="drop-area">
@@ -54,6 +54,8 @@
54
54
  margin-top: 4px;
55
55
  color: var(--color-gray-auro);
56
56
  text-align: right;
57
+ font-size: 14px;
58
+ line-height: 20px;
57
59
  }
58
60
 
59
61
  .container {
@@ -16,6 +16,7 @@
16
16
  import { isEqual } from './helper.js';
17
17
 
18
18
  type Schema = z.infer<typeof schema>;
19
+ type Enctype = 'application/x-www-form-urlencoded' | 'multipart/form-data';
19
20
 
20
21
  interface Props {
21
22
  id?: string;
@@ -23,6 +24,7 @@
23
24
  action: string;
24
25
  schema: z.ZodObject;
25
26
  extraData?: Record<string, string | number>;
27
+ enctype?: Enctype;
26
28
  onsuccess: (data?: Record<string, unknown>) => void;
27
29
  onfailure?: (status: number | undefined, error: unknown) => void;
28
30
  children?: Snippet;
@@ -34,6 +36,7 @@
34
36
  action,
35
37
  schema,
36
38
  extraData,
39
+ enctype = 'application/x-www-form-urlencoded',
37
40
  onsuccess,
38
41
  onfailure = undefined,
39
42
  children
@@ -150,6 +153,7 @@
150
153
  id={id ? `form-${id}` : 'form'}
151
154
  method="POST"
152
155
  action="?/{action}"
156
+ {enctype}
153
157
  use:enhance
154
158
  onsubmit={(event) => event.preventDefault()}
155
159
  >
@@ -6,6 +6,7 @@ declare const Form: import("svelte").Component<{
6
6
  action: string;
7
7
  schema: z.ZodObject;
8
8
  extraData?: Record<string, string | number>;
9
+ enctype?: "application/x-www-form-urlencoded" | "multipart/form-data";
9
10
  onsuccess: (data?: Record<string, unknown>) => void;
10
11
  onfailure?: (status: number | undefined, error: unknown) => void;
11
12
  children?: Snippet;
@@ -4,6 +4,7 @@ type BaseMenu = {
4
4
  };
5
5
  export type MenuItem = BaseMenu & {
6
6
  icon?: string;
7
+ roles?: string[];
7
8
  };
8
9
  export type HomeItem = BaseMenu & {
9
10
  homeIcon?: string;
@@ -12,11 +13,11 @@ export type HomeItem = BaseMenu & {
12
13
  export type MainMenu = HomeItem & {
13
14
  icon?: string;
14
15
  roles?: string[];
15
- children?: SidebarItem[];
16
+ children?: SubMenuItem[];
16
17
  };
17
- export interface SidebarItem {
18
+ export interface SubMenuItem {
18
19
  category: string;
19
20
  menuItems: MenuItem[];
20
21
  }
21
- export declare const getSidebarItemsFromMenu: (items: MainMenu[], url: string, excludedRoutes?: string[]) => SidebarItem[];
22
+ export declare const getSubMenuItemsFromMenu: (items: MainMenu[], url: string, excludedRoutes?: string[]) => SubMenuItem[];
22
23
  export {};
@@ -1,4 +1,4 @@
1
- export const getSidebarItemsFromMenu = (items, url, excludedRoutes) => {
1
+ export const getSubMenuItemsFromMenu = (items, url, excludedRoutes) => {
2
2
  if (excludedRoutes?.includes(url))
3
3
  return [];
4
4
  const matchedPath = /^\/[^/]+/.exec(url);
@@ -2,19 +2,19 @@
2
2
  import { page } from '$app/state';
3
3
  import { fade } from 'svelte/transition';
4
4
 
5
- import MenuItemSidebar from './MenuItem.svelte';
6
- import type { MenuItem, SidebarItem } from './MenuState.svelte.js';
5
+ import SidebarMenuItem from './MenuItem.svelte';
6
+ import type { MenuItem, SubMenuItem } from './MenuState.svelte.js';
7
7
 
8
8
  interface Props {
9
- sidebarItems: SidebarItem[];
9
+ subMenuItems: SubMenuItem[];
10
10
  }
11
11
 
12
- let { sidebarItems = [] }: Props = $props();
12
+ let { subMenuItems = [] }: Props = $props();
13
13
 
14
- let hasItems: boolean = $derived(!!sidebarItems.length);
14
+ let hasItems: boolean = $derived(!!subMenuItems.length);
15
15
  let isCollapsed: boolean = $state(true);
16
16
  let selectedItem: MenuItem | undefined = $derived(
17
- sidebarItems
17
+ subMenuItems
18
18
  .flatMap((item) => item.menuItems)
19
19
  .find(
20
20
  (menuItem) =>
@@ -51,13 +51,13 @@
51
51
  </header>
52
52
 
53
53
  <section class="content">
54
- {#each sidebarItems as item}
54
+ {#each subMenuItems as subMenuItem}
55
55
  <section class="category-content">
56
- <h2 class="category-span" class:hidden={isCollapsed}>{item.category}</h2>
56
+ <h2 class="category-span" class:hidden={isCollapsed}>{subMenuItem.category}</h2>
57
57
  <menu class="category-items-details">
58
- {#if item.menuItems}
59
- {#each item.menuItems as menuItem}
60
- <MenuItemSidebar
58
+ {#if subMenuItem.menuItems}
59
+ {#each subMenuItem.menuItems as menuItem}
60
+ <SidebarMenuItem
61
61
  item={menuItem}
62
62
  {isCollapsed}
63
63
  activeItem={selectedItem?.text === menuItem.text}
@@ -1,6 +1,6 @@
1
- import type { SidebarItem } from './MenuState.svelte.js';
1
+ import type { SubMenuItem } from './MenuState.svelte.js';
2
2
  interface Props {
3
- sidebarItems: SidebarItem[];
3
+ subMenuItems: SubMenuItem[];
4
4
  }
5
5
  declare const Sidebar: import("svelte").Component<Props, {}, "">;
6
6
  type Sidebar = ReturnType<typeof Sidebar>;
package/dist/index.d.ts CHANGED
@@ -43,12 +43,12 @@ import { addToast } from './Toast/toastState.svelte';
43
43
  import { setFormContext, getFormContext } from './Form/FormController/context.js';
44
44
  import { validateSchema } from './Form/FormController/helper.js';
45
45
  import { createZodString } from './Form/FormController/zod-validations.js';
46
- import { getSidebarItemsFromMenu } from './Menu/MenuState.svelte';
46
+ import { getSubMenuItemsFromMenu } from './Menu/MenuState.svelte';
47
47
  import type { BreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
48
48
  import type { FormError, FormContext } from './Form/FormController/types.js';
49
49
  import type { HighlightPanelColumn } from './HighlightPanel/highlightPanelState.svelte.js';
50
50
  import type { HomeItem } from './Menu/MenuState.svelte.js';
51
- import type { MainMenu, MenuItem, SidebarItem } from './Menu/MenuState.svelte.js';
51
+ import type { MainMenu, MenuItem, SubMenuItem } from './Menu/MenuState.svelte.js';
52
52
  import type { ModalProps } from './Modal/modalState.svelte.js';
53
53
  import type { ProgressWizardStep } from './ProgressWizard/progressWizardState.svelte.js';
54
54
  import type { SwitcherOption } from './Switcher/switcherState.svelte.js';
@@ -58,4 +58,4 @@ import type { Toast } from './Toast/toastState.svelte';
58
58
  import type { WaffleItem } from './Waffle/waffleState.svelte.js';
59
59
  import type { AttachFileFormConfig, FileValidationCallback } from './Form/AttachFile/attachFile.svelte.js';
60
60
  import type { NotificationProps } from './Notification/notificationState.svelte.js';
61
- export { Accordion, Avatar, Breadcrumbs, Button, Card, Chips, DeleteConfirmationModal, ErrorPage, Footer, Form, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, Input, Link, Menu, Modal, Notification, Processing, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Switcher, Tabs, TextArea, Toaster, Toggle, Tooltip, Waffle, AttachFile, addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString, getSidebarItemsFromMenu, ChipType, ColumnType, ImageType, type BreadcrumbsNameMap, type HighlightPanelColumn, type HomeItem, type MainMenu, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type SwitcherOption, type Tab, type Toast, type WaffleItem, type FormError, type FormContext, type SidebarItem, type AttachFileFormConfig, type FileValidationCallback, type NotificationProps };
61
+ export { Accordion, Avatar, Breadcrumbs, Button, Card, Chips, DeleteConfirmationModal, ErrorPage, Footer, Form, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, Input, Link, Menu, Modal, Notification, Processing, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Switcher, Tabs, TextArea, Toaster, Toggle, Tooltip, Waffle, AttachFile, addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString, getSubMenuItemsFromMenu, ChipType, ColumnType, ImageType, type BreadcrumbsNameMap, type HighlightPanelColumn, type HomeItem, type MainMenu, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type SwitcherOption, type Tab, type Toast, type WaffleItem, type FormError, type FormContext, type SubMenuItem, type AttachFileFormConfig, type FileValidationCallback, type NotificationProps };
package/dist/index.js CHANGED
@@ -45,11 +45,11 @@ import { addToast } from './Toast/toastState.svelte';
45
45
  import { setFormContext, getFormContext } from './Form/FormController/context.js';
46
46
  import { validateSchema } from './Form/FormController/helper.js';
47
47
  import { createZodString } from './Form/FormController/zod-validations.js';
48
- import { getSidebarItemsFromMenu } from './Menu/MenuState.svelte';
48
+ import { getSubMenuItemsFromMenu } from './Menu/MenuState.svelte';
49
49
  export {
50
50
  // Components
51
51
  Accordion, Avatar, Breadcrumbs, Button, Card, Chips, DeleteConfirmationModal, ErrorPage, Footer, Form, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, Input, Link, Menu, Modal, Notification, Processing, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Switcher, Tabs, TextArea, Toaster, Toggle, Tooltip, Waffle, AttachFile,
52
52
  // Functions and helpers
53
- addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString, getSidebarItemsFromMenu,
53
+ addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString, getSubMenuItemsFromMenu,
54
54
  // Enums
55
55
  ChipType, ColumnType, ImageType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",