@finsweet/webflow-apps-utils 1.0.3 → 1.0.5

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.
Files changed (116) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/providers/GlobalProvider.stories.d.ts +5 -0
  4. package/dist/providers/GlobalProvider.stories.js +419 -0
  5. package/dist/providers/GlobalProviderDemo.svelte +266 -0
  6. package/dist/providers/GlobalProviderDemo.svelte.d.ts +3 -0
  7. package/dist/providers/configuratorUtils.d.ts +11 -14
  8. package/dist/providers/configuratorUtils.js +68 -115
  9. package/dist/providers/index.d.ts +1 -1
  10. package/dist/providers/index.js +1 -1
  11. package/dist/router/Router.stories.d.ts +6 -0
  12. package/dist/router/Router.stories.js +564 -0
  13. package/dist/router/examples/RouterExample.svelte +271 -0
  14. package/dist/router/examples/RouterExample.svelte.d.ts +18 -0
  15. package/dist/router/examples/index.d.ts +4 -0
  16. package/dist/router/examples/index.js +4 -0
  17. package/dist/router/examples/pages/AboutPage.svelte +568 -0
  18. package/dist/router/examples/pages/AboutPage.svelte.d.ts +13 -0
  19. package/dist/router/examples/pages/HomePage.svelte +200 -0
  20. package/dist/router/examples/pages/HomePage.svelte.d.ts +14 -0
  21. package/dist/router/examples/pages/NotFoundPage.svelte +307 -0
  22. package/dist/router/examples/pages/NotFoundPage.svelte.d.ts +17 -0
  23. package/dist/router/hooks.svelte.d.ts +2 -2
  24. package/dist/router/index.d.ts +3 -0
  25. package/dist/router/index.js +3 -0
  26. package/dist/router/{Link.svelte → providers/Link.svelte} +1 -1
  27. package/dist/router/{Route.svelte → providers/Route.svelte} +1 -1
  28. package/dist/router/{Route.svelte.d.ts → providers/Route.svelte.d.ts} +1 -1
  29. package/dist/router/{Router.svelte → providers/RouterProvider.svelte} +22 -5
  30. package/dist/router/{Router.svelte.d.ts → providers/RouterProvider.svelte.d.ts} +8 -4
  31. package/dist/router/providers/index.d.ts +3 -0
  32. package/dist/router/providers/index.js +3 -0
  33. package/dist/router/{index.svelte.d.ts → router.svelte.d.ts} +1 -3
  34. package/dist/router/{index.svelte.js → router.svelte.js} +1 -4
  35. package/dist/stores/forms/Form.stories.d.ts +5 -0
  36. package/dist/stores/forms/Form.stories.js +342 -0
  37. package/dist/stores/forms/FormDemo.svelte +545 -0
  38. package/dist/stores/forms/FormDemo.svelte.d.ts +18 -0
  39. package/dist/stores/forms.d.ts +41 -4
  40. package/dist/stores/forms.js +86 -32
  41. package/dist/types/customCode.d.ts +1 -1
  42. package/dist/types/window.d.ts +1 -0
  43. package/dist/ui/components/button/Button.svelte +1 -1
  44. package/dist/ui/components/copy-text/CopyText.stories.d.ts +70 -0
  45. package/dist/ui/components/copy-text/CopyText.stories.js +241 -0
  46. package/dist/ui/components/copy-text/CopyText.svelte +247 -0
  47. package/dist/ui/components/copy-text/CopyText.svelte.d.ts +4 -0
  48. package/dist/ui/components/copy-text/index.d.ts +2 -0
  49. package/dist/ui/components/copy-text/index.js +1 -0
  50. package/dist/ui/components/copy-text/types.d.ts +52 -0
  51. package/dist/ui/components/copy-text/types.js +1 -0
  52. package/dist/ui/components/index.d.ts +1 -0
  53. package/dist/ui/components/index.js +1 -0
  54. package/dist/ui/components/input/Input.stories.d.ts +9 -0
  55. package/dist/ui/components/input/Input.stories.js +78 -0
  56. package/dist/ui/components/input/Input.svelte +39 -3
  57. package/dist/ui/components/input/types.d.ts +6 -0
  58. package/dist/ui/components/layout/Layout.svelte +45 -64
  59. package/dist/ui/components/layout/Layout.svelte.d.ts +26 -3
  60. package/dist/ui/components/layout/examples/ExampleLayout.svelte +32 -27
  61. package/dist/ui/components/layout/index.d.ts +1 -1
  62. package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte +20 -0
  63. package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte.d.ts +7 -0
  64. package/dist/ui/components/layout/types.d.ts +1 -10
  65. package/dist/ui/components/notification/Notification.stories.svelte +12 -1
  66. package/dist/ui/components/notification/Notification.svelte +10 -5
  67. package/dist/ui/components/notification/Notification.svelte.d.ts +1 -1
  68. package/dist/ui/components/notification/types.d.ts +1 -1
  69. package/dist/ui/components/section/Section.svelte +8 -4
  70. package/dist/ui/components/section/types.d.ts +8 -0
  71. package/dist/ui/components/text/Text.stories.svelte +67 -1
  72. package/dist/ui/components/text/Text.svelte +209 -8
  73. package/dist/ui/components/text/types.d.ts +4 -0
  74. package/dist/ui/index.css +6 -2
  75. package/dist/utils/animations/factory.d.ts +7 -0
  76. package/dist/utils/animations/factory.js +101 -0
  77. package/dist/utils/animations/index.d.ts +7 -0
  78. package/dist/utils/animations/index.js +62 -0
  79. package/dist/utils/animations/types.d.ts +39 -0
  80. package/dist/utils/animations/types.js +1 -0
  81. package/dist/utils/custom-code/configs.d.ts +22 -0
  82. package/dist/utils/custom-code/configs.js +40 -0
  83. package/dist/utils/custom-code/index.d.ts +1 -0
  84. package/dist/utils/custom-code/index.js +1 -0
  85. package/dist/utils/diff-mapper/DiffMapper.stories.d.ts +5 -0
  86. package/dist/utils/diff-mapper/DiffMapper.stories.js +185 -0
  87. package/dist/utils/diff-mapper/DiffMapperDemo.svelte +351 -0
  88. package/dist/utils/diff-mapper/DiffMapperDemo.svelte.d.ts +18 -0
  89. package/dist/utils/diff-mapper/deepDiffMapper.d.ts +31 -0
  90. package/dist/utils/diff-mapper/deepDiffMapper.js +264 -0
  91. package/dist/utils/diff-mapper/index.d.ts +1 -0
  92. package/dist/utils/diff-mapper/index.js +1 -0
  93. package/dist/utils/helpers/capitalizeFirstLetter.d.ts +4 -0
  94. package/dist/utils/helpers/capitalizeFirstLetter.js +9 -0
  95. package/dist/utils/helpers/getTimeNow.d.ts +4 -0
  96. package/dist/utils/helpers/getTimeNow.js +8 -0
  97. package/dist/utils/helpers/index.d.ts +4 -0
  98. package/dist/utils/helpers/index.js +4 -0
  99. package/dist/utils/helpers/minifyCode.d.ts +10 -0
  100. package/dist/utils/helpers/minifyCode.js +73 -0
  101. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -1
  102. package/dist/utils/helpers/objectsToModuleExports.js +1 -0
  103. package/dist/utils/helpers/toHumanReadableList.d.ts +4 -0
  104. package/dist/utils/helpers/toHumanReadableList.js +11 -0
  105. package/dist/utils/index.d.ts +2 -0
  106. package/dist/utils/index.js +2 -0
  107. package/dist/utils/webflow-canvas/getAllChildren.d.ts +16 -0
  108. package/dist/utils/webflow-canvas/getAllChildren.js +65 -0
  109. package/dist/utils/webflow-canvas/getElementClassList.d.ts +9 -0
  110. package/dist/utils/webflow-canvas/getElementClassList.js +19 -0
  111. package/dist/utils/webflow-canvas/index.d.ts +2 -0
  112. package/dist/utils/webflow-canvas/index.js +2 -0
  113. package/package.json +6 -1
  114. package/dist/providers/GlobalProvider.mdx +0 -322
  115. package/dist/router/README.md +0 -397
  116. /package/dist/router/{Link.svelte.d.ts → providers/Link.svelte.d.ts} +0 -0
@@ -9,42 +9,66 @@
9
9
  WarningCircleOutlineIcon
10
10
  } from '../../icons';
11
11
 
12
+ import Section from '../section/Section.svelte';
12
13
  import { Tooltip } from '../tooltip';
13
14
  import { EditModeMessage } from './common';
14
- import type { LayoutFooter, LayoutTab } from './types';
15
+ import type { LayoutTab } from './types';
15
16
 
16
17
  interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
18
+ /** The currently active tab path */
17
19
  activeTab: string;
20
+ /** Array of available tabs to display in the navbar */
18
21
  tabs: LayoutTab[];
22
+ /** Function to handle tab switching */
19
23
  switchTab: (tab: string) => void;
20
- footer?: LayoutFooter;
24
+ /** Unique key for the form context */
21
25
  formKey: string;
22
- editMode?: boolean;
26
+ /** Whether to show the edit mode message banner */
27
+ showEditModeMessage?: boolean;
28
+ /** Whether to display the footer section */
23
29
  showFooter?: boolean;
30
+ /** Whether to display the sidebar */
24
31
  showSidebar?: boolean;
32
+ /** Whether to display the tab navigation bar */
25
33
  showTabs?: boolean;
34
+ /** The height at which the main content area becomes scrollable */
35
+ mainContentScrollableAt?: number;
36
+ /** Whether to display the preview bar */
26
37
  showPreviewBar?: boolean;
38
+ /** Width of the sidebar (CSS value) */
27
39
  sidebarWidth?: string;
40
+ /** Whether to use container mode (100% dimensions) instead of viewport mode */
28
41
  containerMode?: boolean;
42
+ /** Size variant for the footer */
29
43
  footerSize?: 'normal' | 'large';
44
+ /** Array of notification objects for tab status indicators */
30
45
  notifications?: Array<{
46
+ /** Tab path this notification applies to */
31
47
  path: string;
48
+ /** Whether the notification indicates success */
32
49
  success: boolean;
50
+ /** Notification message content */
33
51
  message: string;
52
+ /** Whether to show the notification badge */
34
53
  showNotification: boolean;
35
54
  }>;
55
+ /** Sidebar content snippet */
36
56
  sidebar?: Snippet;
57
+ /** Main content area snippet */
37
58
  main?: Snippet;
59
+ /** Preview bar content snippet */
38
60
  previewBar?: Snippet;
61
+ /** Footer content snippet */
62
+ footer?: Snippet;
39
63
  }
40
64
 
41
65
  let {
42
66
  activeTab,
43
67
  tabs,
44
68
  switchTab,
45
- footer = { buttons: [] },
46
69
  formKey,
47
- editMode = false,
70
+ mainContentScrollableAt,
71
+ showEditModeMessage = false,
48
72
  showFooter = true,
49
73
  showSidebar = true,
50
74
  showTabs = true,
@@ -56,12 +80,12 @@
56
80
  sidebar,
57
81
  main,
58
82
  previewBar,
83
+ footer,
59
84
  class: className = '',
60
85
  ...restProps
61
86
  }: LayoutProps = $props();
62
87
 
63
88
  // Derived states
64
- let hasFooterButtons = $derived(footer?.buttons && footer.buttons.length > 0);
65
89
  let containerStyles = $derived(
66
90
  containerMode ? 'height: 100%; width: 100%;' : 'height: 100vh; width: 100vw;'
67
91
  );
@@ -93,7 +117,7 @@
93
117
  }
94
118
 
95
119
  // Handle footer row
96
- if (showFooter && hasFooterButtons) {
120
+ if (showFooter && footer) {
97
121
  if (showSidebar) {
98
122
  areas.push('"sidebar footer"');
99
123
  } else {
@@ -118,7 +142,7 @@
118
142
 
119
143
  rows.push('1fr'); // main content area takes remaining space
120
144
 
121
- if (showFooter && hasFooterButtons) {
145
+ if (showFooter && footer) {
122
146
  rows.push(footerHeight);
123
147
  }
124
148
 
@@ -217,8 +241,16 @@
217
241
  <div class="main-content" data-area="main">
218
242
  {#if main}
219
243
  <div class="main-content-container">
220
- <EditModeMessage />
221
- {@render main()}
244
+ {#if showEditModeMessage}
245
+ <EditModeMessage />
246
+ {/if}
247
+ {#if mainContentScrollableAt}
248
+ <Section height={`${mainContentScrollableAt}px`} scrollable padding="0">
249
+ {@render main()}
250
+ </Section>
251
+ {:else}
252
+ {@render main()}
253
+ {/if}
222
254
  </div>
223
255
  {:else}
224
256
  <div class="main-placeholder">
@@ -232,7 +264,7 @@
232
264
  <li>Show Tabs: {showTabs}</li>
233
265
  <li>Show Preview Bar: {showPreviewBar}</li>
234
266
  <li>Show Footer: {showFooter}</li>
235
- <li>Edit Mode: {editMode}</li>
267
+ <li>Edit Mode: {showEditModeMessage}</li>
236
268
  </ul>
237
269
  </div>
238
270
  </div>
@@ -240,21 +272,9 @@
240
272
  </div>
241
273
 
242
274
  <!-- Footer -->
243
- {#if showFooter && hasFooterButtons}
275
+ {#if showFooter && footer}
244
276
  <div class="footer" data-area="footer">
245
- {#each footer.buttons as button (button.text)}
246
- <button
247
- class="footer-button footer-button--{button.variant}"
248
- disabled={editMode}
249
- onclick={button.onClick}
250
- >
251
- {#if button.icon}
252
- {@const Icon = button.icon}
253
- <Icon />
254
- {/if}
255
- {button.text}
256
- </button>
257
- {/each}
277
+ {@render footer()}
258
278
  </div>
259
279
  {/if}
260
280
  </div>
@@ -507,43 +527,4 @@
507
527
  height: 100%;
508
528
  overflow: hidden;
509
529
  }
510
-
511
- .footer-button {
512
- display: flex;
513
- padding: 4px 8px;
514
- justify-content: center;
515
- align-items: center;
516
- gap: 2px;
517
- border-radius: 4px;
518
- border: 1px solid var(--border-border-1, #363636);
519
- background: var(--background2);
520
- color: var(--text1);
521
- text-align: center;
522
- font-family: Inter;
523
- font-size: 11px;
524
- font-style: normal;
525
- font-weight: 400;
526
- line-height: 16px;
527
- cursor: pointer;
528
- transition: all 0.2s ease-in-out;
529
- }
530
-
531
- .footer-button--primary {
532
- background: var(--action-action-primary-background-hover, #1280ee);
533
- color: var(--actionPrimaryText);
534
- }
535
-
536
- .footer-button--secondary {
537
- background: var(--background2);
538
- color: var(--text1);
539
- }
540
-
541
- .footer-button:hover:not(:disabled) {
542
- opacity: 0.8;
543
- }
544
-
545
- .footer-button:disabled {
546
- opacity: 0.5;
547
- cursor: not-allowed;
548
- }
549
530
  </style>
@@ -1,29 +1,52 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
- import type { LayoutFooter, LayoutTab } from './types';
3
+ import type { LayoutTab } from './types';
4
4
  interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** The currently active tab path */
5
6
  activeTab: string;
7
+ /** Array of available tabs to display in the navbar */
6
8
  tabs: LayoutTab[];
9
+ /** Function to handle tab switching */
7
10
  switchTab: (tab: string) => void;
8
- footer?: LayoutFooter;
11
+ /** Unique key for the form context */
9
12
  formKey: string;
10
- editMode?: boolean;
13
+ /** Whether to show the edit mode message banner */
14
+ showEditModeMessage?: boolean;
15
+ /** Whether to display the footer section */
11
16
  showFooter?: boolean;
17
+ /** Whether to display the sidebar */
12
18
  showSidebar?: boolean;
19
+ /** Whether to display the tab navigation bar */
13
20
  showTabs?: boolean;
21
+ /** The height at which the main content area becomes scrollable */
22
+ mainContentScrollableAt?: number;
23
+ /** Whether to display the preview bar */
14
24
  showPreviewBar?: boolean;
25
+ /** Width of the sidebar (CSS value) */
15
26
  sidebarWidth?: string;
27
+ /** Whether to use container mode (100% dimensions) instead of viewport mode */
16
28
  containerMode?: boolean;
29
+ /** Size variant for the footer */
17
30
  footerSize?: 'normal' | 'large';
31
+ /** Array of notification objects for tab status indicators */
18
32
  notifications?: Array<{
33
+ /** Tab path this notification applies to */
19
34
  path: string;
35
+ /** Whether the notification indicates success */
20
36
  success: boolean;
37
+ /** Notification message content */
21
38
  message: string;
39
+ /** Whether to show the notification badge */
22
40
  showNotification: boolean;
23
41
  }>;
42
+ /** Sidebar content snippet */
24
43
  sidebar?: Snippet;
44
+ /** Main content area snippet */
25
45
  main?: Snippet;
46
+ /** Preview bar content snippet */
26
47
  previewBar?: Snippet;
48
+ /** Footer content snippet */
49
+ footer?: Snippet;
27
50
  }
28
51
  declare const Layout: import("svelte").Component<LayoutProps, {}, "">;
29
52
  type Layout = ReturnType<typeof Layout>;
@@ -18,20 +18,20 @@
18
18
  let showTabs = $state(true);
19
19
  let showPreviewBar = $state(true);
20
20
  let showFooter = $state(true);
21
- let editMode = $state(false);
21
+ let showEditModeMessage = $state(false);
22
22
  let sidebarWidth = $state('239px');
23
23
  let footerSize = $state<'normal' | 'large'>('normal');
24
24
  let showNotifications = $state(false);
25
25
  let notificationSuccess = $state(true);
26
26
  let inputValue = $state('');
27
27
 
28
- // Get app context and keep editMode in sync
28
+ // Get app context and keep showEditModeMessage in sync
29
29
  const appContext = useAppContext();
30
30
 
31
- // Subscribe to context changes to keep local editMode in sync
31
+ // Subscribe to context changes to keep local showEditModeMessage in sync
32
32
  appContext.subscribe((data) => {
33
- if (data?.editMode !== undefined && data.editMode !== editMode) {
34
- editMode = data.editMode;
33
+ if (data?.editMode !== undefined && data.editMode !== showEditModeMessage) {
34
+ showEditModeMessage = data.editMode;
35
35
  }
36
36
  });
37
37
 
@@ -41,22 +41,14 @@
41
41
  { path: 'code', name: 'Code', icon: CodeIcon, isActive: false }
42
42
  ];
43
43
 
44
- // Dummy footer buttons
45
- const dummyFooterButtons = [
46
- {
47
- id: 'save' as const,
48
- text: 'Save Changes',
49
- variant: 'secondary' as const,
50
- icon: CheckCircleIcon,
51
- onClick: () => console.log('Save clicked')
52
- },
53
- {
54
- id: 'main' as const,
55
- text: 'Apply Settings',
56
- variant: 'primary' as const,
57
- onClick: () => console.log('Apply clicked')
58
- }
59
- ];
44
+ // Footer button handlers
45
+ function handleSaveClick() {
46
+ console.log('Save clicked');
47
+ }
48
+
49
+ function handleApplyClick() {
50
+ console.log('Apply clicked');
51
+ }
60
52
 
61
53
  // Create tabs with active state
62
54
  let tabs = $derived(
@@ -100,8 +92,8 @@
100
92
  watchOptions: { watchAll: true, debounceMs: 50 }
101
93
  }
102
94
  });
103
- // Initialize local editMode state
104
- editMode = true;
95
+ // Initialize local showEditModeMessage state
96
+ showEditModeMessage = true;
105
97
  });
106
98
  </script>
107
99
 
@@ -190,12 +182,12 @@
190
182
  <div class="toggle-control">
191
183
  <input
192
184
  type="checkbox"
193
- bind:checked={editMode}
185
+ bind:checked={showEditModeMessage}
194
186
  id="edit-mode"
195
187
  class="checkbox-input"
196
188
  onchange={() => {
197
189
  const current = appContext.get();
198
- appContext.set({ ...current, editMode });
190
+ appContext.set({ ...current, editMode: showEditModeMessage });
199
191
  }}
200
192
  />
201
193
  <label for="edit-mode" class="checkbox-label">Edit Mode</label>
@@ -234,9 +226,8 @@
234
226
  {activeTab}
235
227
  {tabs}
236
228
  {switchTab}
237
- footer={{ buttons: dummyFooterButtons }}
238
229
  formKey="dummy-layout"
239
- {editMode}
230
+ {showEditModeMessage}
240
231
  {showFooter}
241
232
  {showSidebar}
242
233
  {showTabs}
@@ -332,6 +323,20 @@
332
323
  {#snippet previewBar()}
333
324
  <Text fontSize="md" fontWeight="normal">Preview bar content</Text>
334
325
  {/snippet}
326
+
327
+ {#snippet footer()}
328
+ <Button
329
+ variant="secondary"
330
+ icon={CheckCircleIcon}
331
+ onclick={handleSaveClick}
332
+ disabled={showEditModeMessage}
333
+ >
334
+ Save Changes
335
+ </Button>
336
+ <Button variant="primary" onclick={handleApplyClick} disabled={showEditModeMessage}>
337
+ Apply Settings
338
+ </Button>
339
+ {/snippet}
335
340
  </Layout>
336
341
  </div>
337
342
  </div>
@@ -1,4 +1,4 @@
1
1
  export { default as Layout } from './Layout.svelte';
2
2
  export * from './examples';
3
3
  export * from './common';
4
- export type { LayoutProps, LayoutTab, LayoutFooter } from './types';
4
+ export type { LayoutProps, LayoutTab } from './types';
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { CodeIcon, SettingsIcon } from '../../../icons';
3
+ import { Button } from '../../button';
4
+ import Layout from '../Layout.svelte';
5
+ import type { LayoutProps } from '../types';
6
+
7
+ interface TestLayoutWithFooterProps extends Omit<LayoutProps, 'footer'> {
8
+ footerText?: string;
9
+ }
10
+
11
+ let { footerText = 'Test Button', ...layoutProps }: TestLayoutWithFooterProps = $props();
12
+ </script>
13
+
14
+ <Layout {...layoutProps}>
15
+ {#snippet footer()}
16
+ <Button variant="primary" onclick={() => {}}>
17
+ {footerText}
18
+ </Button>
19
+ {/snippet}
20
+ </Layout>
@@ -0,0 +1,7 @@
1
+ import type { LayoutProps } from '../types';
2
+ interface TestLayoutWithFooterProps extends Omit<LayoutProps, 'footer'> {
3
+ footerText?: string;
4
+ }
5
+ declare const TestLayoutWithFooter: import("svelte").Component<TestLayoutWithFooterProps, {}, "">;
6
+ type TestLayoutWithFooter = ReturnType<typeof TestLayoutWithFooter>;
7
+ export default TestLayoutWithFooter;
@@ -7,15 +7,6 @@ export interface LayoutTab {
7
7
  isActive: boolean;
8
8
  hidden?: boolean;
9
9
  }
10
- export interface LayoutFooter {
11
- buttons: Array<{
12
- id: string;
13
- text: string;
14
- variant: 'primary' | 'secondary';
15
- icon?: Component;
16
- onClick?: () => void;
17
- }>;
18
- }
19
10
  export interface LayoutNotification {
20
11
  path: string;
21
12
  success: boolean;
@@ -29,7 +20,7 @@ export interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
29
20
  main?: Snippet;
30
21
  sidebar?: Snippet;
31
22
  previewBar?: Snippet;
32
- footer?: LayoutFooter;
23
+ footer?: Snippet;
33
24
  formKey: string;
34
25
  editMode?: boolean;
35
26
  showFooter?: boolean;
@@ -6,6 +6,7 @@
6
6
  ArrowIcon,
7
7
  CheckCircleIcon,
8
8
  CloseCircleIcon,
9
+ InfoIcon,
9
10
  WarningCircleOutlineIcon,
10
11
  WarningTriangleIcon
11
12
  } from '../../icons';
@@ -21,7 +22,7 @@
21
22
  argTypes: {
22
23
  variant: {
23
24
  control: { type: 'select' },
24
- options: ['warning', 'error', 'success'],
25
+ options: ['warning', 'error', 'success', 'info'],
25
26
  description: 'The type of notification or custom color string'
26
27
  },
27
28
  message: {
@@ -98,6 +99,16 @@
98
99
  }}
99
100
  />
100
101
 
102
+ <Story
103
+ name="Info"
104
+ args={{
105
+ variant: 'info',
106
+ title: 'Information Notification',
107
+ message: 'Here is some important information you should know.',
108
+ icon: InfoIcon
109
+ }}
110
+ />
111
+
101
112
  <!-- Content Variations -->
102
113
  <Story
103
114
  name="Message Only"
@@ -4,7 +4,7 @@
4
4
  import { TimesIcon, WarningCircleOutlineIcon } from '../../icons';
5
5
  import { Text } from '../';
6
6
 
7
- type NotificationType = 'warning' | 'error' | 'success';
7
+ type NotificationType = 'warning' | 'error' | 'success' | 'info';
8
8
 
9
9
  interface NotificationProps {
10
10
  /**
@@ -93,18 +93,23 @@
93
93
  switch (variant) {
94
94
  case 'warning':
95
95
  return {
96
- icon: '#FFD301',
96
+ icon: 'var(--yellowIcon)',
97
97
  border: 'var(--yellowBorder)'
98
98
  };
99
99
  case 'error':
100
100
  return {
101
- icon: '#FF8A8A',
101
+ icon: 'var(--redIcon)',
102
102
  border: 'var(--redBorder)'
103
103
  };
104
104
  case 'success':
105
105
  return {
106
- icon: '#63D489',
107
- border: 'var(--greenIcon)'
106
+ icon: 'var(--greenIcon)',
107
+ border: 'var(--greenBorder)'
108
+ };
109
+ case 'info':
110
+ return {
111
+ icon: 'var(--blueIcon)',
112
+ border: 'var(--blueBorder)'
108
113
  };
109
114
  default:
110
115
  // Custom color string
@@ -1,5 +1,5 @@
1
1
  import type { Component, Snippet } from 'svelte';
2
- type NotificationType = 'warning' | 'error' | 'success';
2
+ type NotificationType = 'warning' | 'error' | 'success' | 'info';
3
3
  interface NotificationProps {
4
4
  /**
5
5
  * Additional CSS classes to apply
@@ -1,5 +1,5 @@
1
1
  import type { Component, Snippet } from 'svelte';
2
- export type NotificationType = 'warning' | 'error' | 'success';
2
+ export type NotificationType = 'warning' | 'error' | 'success' | 'info';
3
3
  export interface NotificationProps {
4
4
  /**
5
5
  * Additional CSS classes to apply
@@ -20,6 +20,8 @@
20
20
  width,
21
21
  height,
22
22
  backgroundColor,
23
+ padding = 'var(--Spacing-12, 12px)',
24
+ gap = 'var(--Spacing-8, 8px)',
23
25
  class: className = '',
24
26
  tooltip,
25
27
  disabledMessage,
@@ -107,6 +109,8 @@
107
109
  if (width) styles.width = width;
108
110
  if (height) styles.height = height;
109
111
  if (backgroundColor) styles['background-color'] = backgroundColor;
112
+ if (padding) styles.padding = padding;
113
+ if (gap) styles.gap = gap;
110
114
 
111
115
  return styles;
112
116
  });
@@ -136,7 +140,7 @@
136
140
  scrollbars: {
137
141
  theme: 'os-theme-dark',
138
142
  visibility: 'auto',
139
- autoHide: 'never',
143
+ autoHide: 'leave',
140
144
  autoHideDelay: 800
141
145
  }
142
146
  };
@@ -182,6 +186,7 @@
182
186
  tooltipIconColor="var(--yellowText)"
183
187
  message={defaultDisabledMessage}
184
188
  width={disabledTooltipWidth}
189
+ class="not-allowed"
185
190
  >
186
191
  {#snippet target()}
187
192
  {@render sectionContent()}
@@ -201,10 +206,8 @@
201
206
  <style>
202
207
  .section-wrap {
203
208
  display: flex;
204
- padding: var(--Spacing-12, 12px);
205
209
  flex-direction: column;
206
210
  align-items: flex-start;
207
- gap: var(--Spacing-8, 8px);
208
211
  align-self: stretch;
209
212
  position: relative;
210
213
  border: 1px solid transparent;
@@ -269,6 +272,7 @@
269
272
  /* Disabled in edit mode styles */
270
273
  .section-wrap.disabled-in-edit-mode {
271
274
  pointer-events: none;
275
+ cursor: not-allowed;
272
276
  }
273
277
 
274
278
  .section-wrap.disabled-in-edit-mode :global(.label-popup .labels span) {
@@ -299,7 +303,7 @@
299
303
 
300
304
  /* OverlayScrollbars dark theme customization using design system */
301
305
  .section-wrap :global(.os-scrollbar) {
302
- --os-size: var(--sb-size, 6px);
306
+ --os-size: var(--sb-size);
303
307
  --os-padding-perpendicular: 2px;
304
308
  --os-padding-axis: 2px;
305
309
  }
@@ -39,6 +39,14 @@ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
39
39
  * Background color of the section (CSS color value)
40
40
  */
41
41
  backgroundColor?: string;
42
+ /**
43
+ * Padding of the section (CSS value) - defaults to var(--Spacing-12, 12px)
44
+ */
45
+ padding?: string;
46
+ /**
47
+ * Gap between child elements (CSS value) - defaults to var(--Spacing-8, 8px)
48
+ */
49
+ gap?: string;
42
50
  /**
43
51
  * Additional CSS classes to apply
44
52
  */
@@ -63,6 +63,11 @@
63
63
  control: { type: 'object' },
64
64
  description: 'Tooltip configuration'
65
65
  },
66
+ tooltipTarget: {
67
+ control: { type: 'select' },
68
+ options: ['text', 'icon'],
69
+ description: 'Specifies whether to show tooltip on text or icon'
70
+ },
66
71
  popup: {
67
72
  control: { type: 'object' },
68
73
  description: 'Popup action configuration'
@@ -144,7 +149,7 @@
144
149
  </div>
145
150
  </Story>
146
151
 
147
- <!-- Tooltip Example -->
152
+ <!-- Tooltip Examples -->
148
153
  <Story
149
154
  name="With Tooltip"
150
155
  args={{
@@ -156,6 +161,67 @@
156
161
  }}
157
162
  />
158
163
 
164
+ <Story
165
+ name="Tooltip on Icon"
166
+ args={{
167
+ label: 'Text with tooltip on icon',
168
+ icon: ToolTipInfoCircleIcon,
169
+ tooltip: {
170
+ message: 'This tooltip appears on the icon',
171
+ placement: 'top'
172
+ },
173
+ tooltipTarget: 'icon'
174
+ }}
175
+ />
176
+
177
+ <Story name="Tooltip Target Examples">
178
+ <div style="display: flex; flex-direction: column; gap: 16px; padding: 16px;">
179
+ <div style="border: 1px dashed #ccc; padding: 12px;">
180
+ <h4 style="margin: 0 0 8px 0; font-size: 12px; color: #666;">Tooltip on Text (default):</h4>
181
+ <Text
182
+ label="Hover over this text"
183
+ icon={AccountIcon}
184
+ tooltip={{ message: 'Tooltip on the text', placement: 'top' }}
185
+ tooltipTarget="text"
186
+ />
187
+ </div>
188
+
189
+ <div style="border: 1px dashed #ccc; padding: 12px;">
190
+ <h4 style="margin: 0 0 8px 0; font-size: 12px; color: #666;">Tooltip on Icon:</h4>
191
+ <Text
192
+ label="Hover over the icon"
193
+ icon={ToolTipInfoCircleIcon}
194
+ tooltip={{ message: 'Tooltip on the icon', placement: 'top' }}
195
+ tooltipTarget="icon"
196
+ />
197
+ </div>
198
+
199
+ <div style="border: 1px dashed #ccc; padding: 12px;">
200
+ <h4 style="margin: 0 0 8px 0; font-size: 12px; color: #666;">
201
+ With Ellipsis + Icon Tooltip:
202
+ </h4>
203
+ <Text
204
+ label="Long text that will be truncated with ellipsis"
205
+ icon={ToolTipInfoCircleIcon}
206
+ tooltip={{ message: 'Icon tooltip with ellipsis', placement: 'top' }}
207
+ tooltipTarget="icon"
208
+ ellipsisOnWidth="200px"
209
+ />
210
+ </div>
211
+
212
+ <div style="border: 1px dashed #ccc; padding: 12px;">
213
+ <h4 style="margin: 0 0 8px 0; font-size: 12px; color: #666;">
214
+ Invalid Configuration (no icon for icon target):
215
+ </h4>
216
+ <Text
217
+ label="No icon but tooltipTarget is icon"
218
+ tooltip={{ message: 'This tooltip should not show', placement: 'top' }}
219
+ tooltipTarget="icon"
220
+ />
221
+ </div>
222
+ </div>
223
+ </Story>
224
+
159
225
  <!-- Popup Example -->
160
226
  <Story
161
227
  name="With Popup Action"