@finsweet/webflow-apps-utils 1.0.2 → 1.0.4
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.
- package/README.md +162 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/providers/GlobalProvider.mdx +322 -0
- package/dist/providers/GlobalProvider.svelte +58 -0
- package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
- package/dist/providers/configuratorUtils.d.ts +37 -0
- package/dist/providers/configuratorUtils.js +219 -0
- package/dist/providers/globalContext.svelte.d.ts +18 -0
- package/dist/providers/globalContext.svelte.js +439 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/types.d.ts +103 -0
- package/dist/providers/types.js +6 -0
- package/dist/router/Router.mdx +958 -0
- package/dist/router/Router.stories.d.ts +6 -0
- package/dist/router/Router.stories.js +47 -0
- package/dist/router/examples/RouterExample.svelte +271 -0
- package/dist/{ui/components/NoSettingsNeeded.svelte.d.ts → router/examples/RouterExample.svelte.d.ts} +3 -3
- package/dist/router/examples/index.d.ts +4 -0
- package/dist/router/examples/index.js +4 -0
- package/dist/router/examples/pages/AboutPage.svelte +568 -0
- package/dist/router/examples/pages/AboutPage.svelte.d.ts +13 -0
- package/dist/router/examples/pages/HomePage.svelte +200 -0
- package/dist/router/examples/pages/HomePage.svelte.d.ts +14 -0
- package/dist/router/examples/pages/NotFoundPage.svelte +307 -0
- package/dist/router/examples/pages/NotFoundPage.svelte.d.ts +17 -0
- package/dist/router/hooks.svelte.d.ts +2 -2
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.js +3 -0
- package/dist/router/{Link.svelte → providers/Link.svelte} +1 -1
- package/dist/router/{Route.svelte → providers/Route.svelte} +1 -1
- package/dist/router/{Route.svelte.d.ts → providers/Route.svelte.d.ts} +1 -1
- package/dist/router/{Router.svelte → providers/RouterProvider.svelte} +22 -5
- package/dist/router/{Router.svelte.d.ts → providers/RouterProvider.svelte.d.ts} +8 -4
- package/dist/router/providers/index.d.ts +3 -0
- package/dist/router/providers/index.js +3 -0
- package/dist/router/{index.svelte.d.ts → router.svelte.d.ts} +1 -3
- package/dist/router/{index.svelte.js → router.svelte.js} +1 -4
- package/dist/stores/docs/Form.mdx +542 -0
- package/dist/stores/forms.d.ts +41 -4
- package/dist/stores/forms.js +86 -32
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/customCode.d.ts +1 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/types/window.d.ts +1 -0
- package/dist/ui/components/LoadingScreen.svelte +2 -1
- package/dist/ui/components/button/Button.svelte +1 -1
- package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
- package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
- package/dist/ui/components/button-group/index.d.ts +2 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/components/button-group/types.d.ts +32 -0
- package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
- package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
- package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
- package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/ui/components/checkbox/index.d.ts +2 -0
- package/dist/ui/components/checkbox/index.js +1 -0
- package/dist/ui/components/checkbox/types.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
- package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
- package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
- package/dist/ui/components/controlled-buttons/index.js +1 -0
- package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
- package/dist/ui/components/copy-text/CopyText.stories.d.ts +70 -0
- package/dist/ui/components/copy-text/CopyText.stories.js +241 -0
- package/dist/ui/components/copy-text/CopyText.svelte +249 -0
- package/dist/ui/components/copy-text/CopyText.svelte.d.ts +4 -0
- package/dist/ui/components/copy-text/index.d.ts +2 -0
- package/dist/ui/components/copy-text/index.js +1 -0
- package/dist/ui/components/copy-text/types.d.ts +52 -0
- package/dist/ui/components/copy-text/types.js +1 -0
- package/dist/ui/components/divider/Divider.stories.svelte +134 -0
- package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
- package/dist/ui/components/divider/Divider.svelte +30 -0
- package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
- package/dist/ui/components/divider/index.d.ts +2 -0
- package/dist/ui/components/divider/index.js +1 -0
- package/dist/ui/components/divider/types.d.ts +23 -0
- package/dist/ui/components/divider/types.js +1 -0
- package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
- package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
- package/dist/ui/components/iframe/Iframe.svelte +75 -0
- package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
- package/dist/ui/components/iframe/index.d.ts +2 -0
- package/dist/ui/components/iframe/index.js +1 -0
- package/dist/ui/components/iframe/types.d.ts +38 -0
- package/dist/ui/components/iframe/types.js +1 -0
- package/dist/ui/components/index.d.ts +13 -39
- package/dist/ui/components/index.js +13 -39
- package/dist/ui/components/input/Input.stories.d.ts +33 -0
- package/dist/ui/components/input/Input.stories.js +176 -0
- package/dist/ui/components/input/Input.svelte +358 -81
- package/dist/ui/components/input/types.d.ts +33 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +10 -64
- package/dist/ui/components/layout/Layout.svelte.d.ts +2 -2
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +56 -39
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{Header.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +4 -6
- package/dist/ui/components/layout/examples/index.d.ts +2 -0
- package/dist/ui/components/layout/examples/index.js +2 -0
- package/dist/ui/components/layout/index.d.ts +3 -2
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte +20 -0
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte.d.ts +7 -0
- package/dist/ui/components/layout/types.d.ts +1 -10
- package/dist/ui/components/modal/Example.svelte +320 -0
- package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
- package/dist/ui/components/modal/Modal.stories.svelte +18 -0
- package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
- package/dist/ui/components/modal/Modal.svelte +490 -0
- package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
- package/dist/ui/components/modal/index.d.ts +2 -0
- package/dist/ui/components/modal/index.js +1 -0
- package/dist/ui/components/modal/types.d.ts +75 -0
- package/dist/ui/components/modal/types.js +1 -0
- package/dist/ui/components/notification/Notification.stories.svelte +239 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +294 -0
- package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
- package/dist/ui/components/notification/index.d.ts +2 -0
- package/dist/ui/components/notification/index.js +1 -0
- package/dist/ui/components/notification/types.d.ts +68 -0
- package/dist/ui/components/notification/types.js +1 -0
- package/dist/ui/components/section/Section.stories.svelte +263 -0
- package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
- package/dist/ui/components/section/Section.svelte +326 -0
- package/dist/ui/components/section/Section.svelte.d.ts +5 -0
- package/dist/ui/components/section/index.d.ts +2 -0
- package/dist/ui/components/section/index.js +1 -0
- package/dist/ui/components/section/types.d.ts +114 -0
- package/dist/ui/components/section/types.js +1 -0
- package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
- package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
- package/dist/ui/components/shared/index.d.ts +2 -0
- package/dist/ui/components/shared/index.js +2 -0
- package/dist/ui/components/text/Text.stories.svelte +67 -1
- package/dist/ui/components/text/Text.svelte +209 -8
- package/dist/ui/components/text/types.d.ts +4 -0
- package/dist/ui/index.css +33 -5
- package/dist/utils/animations/factory.d.ts +7 -0
- package/dist/utils/animations/factory.js +101 -0
- package/dist/utils/animations/index.d.ts +7 -0
- package/dist/utils/animations/index.js +62 -0
- package/dist/utils/animations/types.d.ts +39 -0
- package/dist/utils/animations/types.js +1 -0
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
- package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
- package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
- package/dist/utils/api/clipboard/handlePaste.js +2 -6
- package/dist/utils/api/getAllAssets.d.ts +1 -2
- package/dist/utils/api/getAllAssets.js +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
- package/dist/utils/api/index.d.ts +0 -1
- package/dist/utils/api/index.js +0 -1
- package/dist/utils/api/insertWithXSCP.d.ts +1 -2
- package/dist/utils/api/insertWithXSCP.js +1 -2
- package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
- package/dist/utils/auth/crossWindowLogin.js +3 -0
- package/dist/utils/auth/index.d.ts +9 -25
- package/dist/utils/auth/index.js +9 -25
- package/dist/utils/browser-storage/localStorage.d.ts +4 -12
- package/dist/utils/browser-storage/localStorage.js +4 -12
- package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
- package/dist/utils/browser-storage/sessionStorage.js +4 -12
- package/dist/utils/custom-code/api.d.ts +3 -7
- package/dist/utils/custom-code/api.js +3 -7
- package/dist/utils/custom-code/configs.d.ts +22 -0
- package/dist/utils/custom-code/configs.js +40 -0
- package/dist/utils/custom-code/index.d.ts +1 -0
- package/dist/utils/custom-code/index.js +1 -0
- package/dist/utils/helpers/capitalizeFirstLetter.d.ts +4 -0
- package/dist/utils/helpers/capitalizeFirstLetter.js +9 -0
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/getTimeNow.d.ts +4 -0
- package/dist/utils/helpers/getTimeNow.js +8 -0
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +5 -0
- package/dist/utils/helpers/index.js +5 -0
- package/dist/utils/helpers/minifyCode.d.ts +10 -0
- package/dist/utils/helpers/minifyCode.js +73 -0
- package/dist/utils/helpers/noop.d.ts +1 -1
- package/dist/utils/helpers/noop.js +1 -1
- package/dist/utils/helpers/numbers.d.ts +4 -14
- package/dist/utils/helpers/numbers.js +4 -14
- package/dist/utils/helpers/objectsToModuleExports.d.ts +2 -4
- package/dist/utils/helpers/objectsToModuleExports.js +2 -3
- package/dist/utils/helpers/toHumanReadableList.d.ts +4 -0
- package/dist/utils/helpers/toHumanReadableList.js +11 -0
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/logger/index.d.ts +0 -2
- package/dist/utils/logger/index.js +0 -2
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
- package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
- package/dist/utils/webflow-canvas/getAllChildren.d.ts +16 -0
- package/dist/utils/webflow-canvas/getAllChildren.js +65 -0
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getElementClassList.d.ts +9 -0
- package/dist/utils/webflow-canvas/getElementClassList.js +19 -0
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
- package/dist/utils/webflow-canvas/index.d.ts +3 -0
- package/dist/utils/webflow-canvas/index.js +3 -0
- package/package.json +14 -2
- package/dist/router/README.md +0 -397
- package/dist/stores/globalStore.d.ts +0 -10
- package/dist/stores/globalStore.js +0 -10
- package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
- package/dist/ui/components/Checkbox.svelte +0 -94
- package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
- package/dist/ui/components/Copy.svelte +0 -329
- package/dist/ui/components/Copy.svelte.d.ts +0 -35
- package/dist/ui/components/CustomModal.svelte +0 -192
- package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
- package/dist/ui/components/DisableInEditMode.svelte +0 -66
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
- package/dist/ui/components/Divider.svelte +0 -31
- package/dist/ui/components/Divider.svelte.d.ts +0 -31
- package/dist/ui/components/Header.svelte +0 -30
- package/dist/ui/components/Iframe.svelte +0 -89
- package/dist/ui/components/Iframe.svelte.d.ts +0 -40
- package/dist/ui/components/InjectComponent.svelte +0 -297
- package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
- package/dist/ui/components/Modal.svelte +0 -139
- package/dist/ui/components/Modal.svelte.d.ts +0 -42
- package/dist/ui/components/Navbar.svelte +0 -132
- package/dist/ui/components/Navbar.svelte.d.ts +0 -29
- package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
- package/dist/ui/components/Notification.svelte +0 -193
- package/dist/ui/components/Notification.svelte.d.ts +0 -64
- package/dist/ui/components/PlusMinusButton.svelte +0 -91
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
- package/dist/ui/components/PreviewBar.svelte +0 -40
- package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
- package/dist/ui/components/ScrollableContent.svelte +0 -18
- package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
- package/dist/ui/components/Section.svelte +0 -97
- package/dist/ui/components/Section.svelte.d.ts +0 -50
- package/dist/ui/components/Spacer.svelte +0 -9
- package/dist/ui/components/Spacer.svelte.d.ts +0 -22
- package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
- package/dist/ui/components/SpinnerUpDown.svelte +0 -194
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
- package/dist/ui/components/Tabs.svelte +0 -71
- package/dist/ui/components/Tabs.svelte.d.ts +0 -26
- package/dist/ui/components/ToggleItem.svelte +0 -29
- package/dist/ui/components/ToggleList.svelte +0 -57
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
- package/dist/ui/components/buttons/index.d.ts +0 -5
- package/dist/ui/components/buttons/index.js +0 -5
- package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
- package/dist/ui/components/clickable/Clickable.svelte +0 -93
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
- package/dist/ui/components/clickable/index.d.ts +0 -2
- package/dist/ui/components/clickable/index.js +0 -1
- package/dist/ui/components/clickable/types.d.ts +0 -17
- package/dist/utils/api/copyPaste/index.d.ts +0 -18
- /package/dist/router/{Link.svelte.d.ts → providers/Link.svelte.d.ts} +0 -0
- /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
- /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
- /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
- /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
- /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
- /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
ArrowIcon,
|
|
7
|
+
CheckCircleIcon,
|
|
8
|
+
CloseCircleIcon,
|
|
9
|
+
InfoIcon,
|
|
10
|
+
WarningCircleOutlineIcon,
|
|
11
|
+
WarningTriangleIcon
|
|
12
|
+
} from '../../icons';
|
|
13
|
+
import Notification from './Notification.svelte';
|
|
14
|
+
|
|
15
|
+
const { Story } = defineMeta({
|
|
16
|
+
title: 'UI/Notification',
|
|
17
|
+
component: Notification,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'centered'
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
variant: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: ['warning', 'error', 'success', 'info'],
|
|
26
|
+
description: 'The type of notification or custom color string'
|
|
27
|
+
},
|
|
28
|
+
message: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'The main message content to display'
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'The title/heading of the notification'
|
|
35
|
+
},
|
|
36
|
+
href: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'External link URL'
|
|
39
|
+
},
|
|
40
|
+
linkText: {
|
|
41
|
+
control: 'text',
|
|
42
|
+
description: 'Text for the link button'
|
|
43
|
+
},
|
|
44
|
+
showCloseButton: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
description: 'Whether to show the close button'
|
|
47
|
+
},
|
|
48
|
+
showBorder: {
|
|
49
|
+
control: 'boolean',
|
|
50
|
+
description: 'Whether to show the colored left border'
|
|
51
|
+
},
|
|
52
|
+
richTextMessage: {
|
|
53
|
+
control: 'boolean',
|
|
54
|
+
description: 'Whether to render message as rich text/HTML'
|
|
55
|
+
},
|
|
56
|
+
richTextTitle: {
|
|
57
|
+
control: 'boolean',
|
|
58
|
+
description: 'Whether to render title as rich text/HTML'
|
|
59
|
+
},
|
|
60
|
+
titleFontWeight: {
|
|
61
|
+
control: { type: 'number', min: 100, max: 900, step: 100 },
|
|
62
|
+
description: 'Font weight for the title text'
|
|
63
|
+
},
|
|
64
|
+
onClose: { action: 'close' }
|
|
65
|
+
},
|
|
66
|
+
args: {
|
|
67
|
+
onClose: fn()
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<!-- Basic Variants -->
|
|
73
|
+
<Story
|
|
74
|
+
name="Warning"
|
|
75
|
+
args={{
|
|
76
|
+
variant: 'warning',
|
|
77
|
+
title: 'Warning Notification',
|
|
78
|
+
message: 'This is a warning message that requires your attention.'
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<Story
|
|
83
|
+
name="Error"
|
|
84
|
+
args={{
|
|
85
|
+
variant: 'error',
|
|
86
|
+
title: 'Error Notification',
|
|
87
|
+
message: 'An error occurred while processing your request. Please try again.',
|
|
88
|
+
icon: CloseCircleIcon
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<Story
|
|
93
|
+
name="Success"
|
|
94
|
+
args={{
|
|
95
|
+
variant: 'success',
|
|
96
|
+
title: 'Success Notification',
|
|
97
|
+
message: 'Your action was completed successfully!',
|
|
98
|
+
icon: CheckCircleIcon
|
|
99
|
+
}}
|
|
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
|
+
|
|
112
|
+
<!-- Content Variations -->
|
|
113
|
+
<Story
|
|
114
|
+
name="Message Only"
|
|
115
|
+
args={{
|
|
116
|
+
variant: 'warning',
|
|
117
|
+
message: 'This notification only has a message without a title.'
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<Story
|
|
122
|
+
name="Title Only"
|
|
123
|
+
args={{
|
|
124
|
+
variant: 'error',
|
|
125
|
+
title: 'This notification only has a title'
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<!-- Interactive Features -->
|
|
130
|
+
<Story
|
|
131
|
+
name="With Link"
|
|
132
|
+
args={{
|
|
133
|
+
variant: 'warning',
|
|
134
|
+
title: 'Update Available',
|
|
135
|
+
message: 'A new version of the application is available.',
|
|
136
|
+
href: 'https://example.com/download',
|
|
137
|
+
linkText: 'Download Now',
|
|
138
|
+
linkIcon: ArrowIcon
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<Story
|
|
143
|
+
name="Interactive"
|
|
144
|
+
args={{
|
|
145
|
+
variant: 'warning',
|
|
146
|
+
title: 'Interactive Notification',
|
|
147
|
+
message: 'Click the close button to dismiss this notification.'
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<!-- Customization -->
|
|
152
|
+
<Story
|
|
153
|
+
name="Custom Color"
|
|
154
|
+
args={{
|
|
155
|
+
variant: '#9333EA',
|
|
156
|
+
title: 'Custom Color',
|
|
157
|
+
message: 'This notification uses a custom purple color.',
|
|
158
|
+
icon: WarningTriangleIcon
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<Story
|
|
163
|
+
name="Without Close Button"
|
|
164
|
+
args={{
|
|
165
|
+
variant: 'warning',
|
|
166
|
+
title: 'Persistent Notification',
|
|
167
|
+
message: 'This notification cannot be dismissed by the user.',
|
|
168
|
+
showCloseButton: false
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<Story
|
|
173
|
+
name="Without Border"
|
|
174
|
+
args={{
|
|
175
|
+
variant: 'success',
|
|
176
|
+
title: 'No Border',
|
|
177
|
+
message: 'This notification does not have a colored left border.',
|
|
178
|
+
showBorder: false
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
<!-- Rich Text Support -->
|
|
183
|
+
<Story
|
|
184
|
+
name="Rich Text Content"
|
|
185
|
+
args={{
|
|
186
|
+
variant: 'warning',
|
|
187
|
+
title: '<strong>Rich Text Title</strong>',
|
|
188
|
+
message: 'This message supports <em>HTML</em> and <strong>rich text</strong> formatting.',
|
|
189
|
+
richTextTitle: true,
|
|
190
|
+
richTextMessage: true
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
|
|
194
|
+
<!-- Complex Content -->
|
|
195
|
+
<Story
|
|
196
|
+
name="Long Content"
|
|
197
|
+
args={{
|
|
198
|
+
variant: 'error',
|
|
199
|
+
title: 'Very Long Notification Title That Might Wrap to Multiple Lines',
|
|
200
|
+
message:
|
|
201
|
+
'This is a very long message that demonstrates how the notification component handles extensive content. It should wrap gracefully and maintain proper spacing and alignment throughout the entire notification area.',
|
|
202
|
+
href: 'https://example.com/help',
|
|
203
|
+
linkText: 'Learn More'
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
|
|
207
|
+
<!-- Accessibility Test -->
|
|
208
|
+
<Story
|
|
209
|
+
name="Accessibility Test"
|
|
210
|
+
args={{
|
|
211
|
+
variant: 'error',
|
|
212
|
+
title: 'Accessibility Test',
|
|
213
|
+
message: 'This notification tests accessibility features.',
|
|
214
|
+
href: 'https://example.com',
|
|
215
|
+
linkText: 'Accessible Link'
|
|
216
|
+
}}
|
|
217
|
+
parameters={{
|
|
218
|
+
a11y: {
|
|
219
|
+
config: {
|
|
220
|
+
rules: [
|
|
221
|
+
{ id: 'color-contrast', enabled: true },
|
|
222
|
+
{ id: 'link-name', enabled: true },
|
|
223
|
+
{ id: 'button-name', enabled: true }
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
|
|
230
|
+
<!-- Custom Actions Info -->
|
|
231
|
+
<Story
|
|
232
|
+
name="Custom Actions Support"
|
|
233
|
+
args={{
|
|
234
|
+
variant: 'warning',
|
|
235
|
+
title: 'Custom Actions Available',
|
|
236
|
+
message:
|
|
237
|
+
'This component supports custom action buttons via the actions snippet prop. See component tests and documentation for implementation examples.'
|
|
238
|
+
}}
|
|
239
|
+
/>
|
package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts}
RENAMED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
export default
|
|
2
|
-
type
|
|
3
|
-
|
|
1
|
+
export default Notification;
|
|
2
|
+
type Notification = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
4
|
}, {
|
|
5
|
-
default: {};
|
|
6
|
-
}>, {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {
|
|
9
|
-
default: {};
|
|
10
|
-
}> & {
|
|
6
|
+
}, {}> & {
|
|
11
7
|
$$bindings?: string | undefined;
|
|
12
8
|
};
|
|
13
|
-
declare const
|
|
14
|
-
|
|
9
|
+
declare const Notification: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
15
11
|
}, {
|
|
16
|
-
default: {};
|
|
17
|
-
}>, {
|
|
18
12
|
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {
|
|
20
|
-
|
|
21
|
-
}, {}, string>;
|
|
22
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
23
|
-
default: any;
|
|
24
|
-
} ? Props extends Record<string, never> ? any : {
|
|
25
|
-
children?: any;
|
|
26
|
-
} : {});
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Notification from './Notification.svelte';
|
|
27
15
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
28
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
29
17
|
$$bindings?: Bindings;
|
|
30
18
|
} & Exports;
|
|
31
|
-
(internal: unknown, props:
|
|
19
|
+
(internal: unknown, props: {
|
|
32
20
|
$$events?: Events;
|
|
33
21
|
$$slots?: Slots;
|
|
34
22
|
}): Exports & {
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
import { TimesIcon, WarningCircleOutlineIcon } from '../../icons';
|
|
5
|
+
import { Text } from '../';
|
|
6
|
+
|
|
7
|
+
type NotificationType = 'warning' | 'error' | 'success' | 'info';
|
|
8
|
+
|
|
9
|
+
interface NotificationProps {
|
|
10
|
+
/**
|
|
11
|
+
* Additional CSS classes to apply
|
|
12
|
+
*/
|
|
13
|
+
class?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The main message content to display
|
|
16
|
+
*/
|
|
17
|
+
message?: string;
|
|
18
|
+
/**
|
|
19
|
+
* External link URL
|
|
20
|
+
*/
|
|
21
|
+
href?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The title/heading of the notification
|
|
24
|
+
*/
|
|
25
|
+
title?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Font weight for the title text
|
|
28
|
+
*/
|
|
29
|
+
titleFontWeight?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Text for the link button
|
|
32
|
+
*/
|
|
33
|
+
linkText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to show the close button
|
|
36
|
+
*/
|
|
37
|
+
showCloseButton?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Custom icon component to display
|
|
40
|
+
*/
|
|
41
|
+
icon?: Component;
|
|
42
|
+
/**
|
|
43
|
+
* Icon component for the link
|
|
44
|
+
*/
|
|
45
|
+
linkIcon?: Component | null;
|
|
46
|
+
/**
|
|
47
|
+
* Notification type or custom color string
|
|
48
|
+
*/
|
|
49
|
+
variant?: NotificationType | string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to render message as rich text/HTML
|
|
52
|
+
*/
|
|
53
|
+
richTextMessage?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to render title as rich text/HTML
|
|
56
|
+
*/
|
|
57
|
+
richTextTitle?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to show the colored left border
|
|
60
|
+
*/
|
|
61
|
+
showBorder?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Custom action content
|
|
64
|
+
*/
|
|
65
|
+
actions?: Snippet;
|
|
66
|
+
/**
|
|
67
|
+
* Event handler for close button click
|
|
68
|
+
*/
|
|
69
|
+
onClose?: () => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let {
|
|
73
|
+
class: className = '',
|
|
74
|
+
message = '',
|
|
75
|
+
href = '',
|
|
76
|
+
title = '',
|
|
77
|
+
titleFontWeight = 600,
|
|
78
|
+
linkText = '',
|
|
79
|
+
showCloseButton = true,
|
|
80
|
+
icon = WarningCircleOutlineIcon,
|
|
81
|
+
linkIcon = null,
|
|
82
|
+
variant = 'warning',
|
|
83
|
+
richTextMessage = false,
|
|
84
|
+
richTextTitle = false,
|
|
85
|
+
showBorder = true,
|
|
86
|
+
actions,
|
|
87
|
+
onClose,
|
|
88
|
+
...restProps
|
|
89
|
+
}: NotificationProps = $props();
|
|
90
|
+
|
|
91
|
+
// Computed colors based on variant
|
|
92
|
+
let colors = $derived.by(() => {
|
|
93
|
+
switch (variant) {
|
|
94
|
+
case 'warning':
|
|
95
|
+
return {
|
|
96
|
+
icon: 'var(--yellowIcon)',
|
|
97
|
+
border: 'var(--yellowBorder)'
|
|
98
|
+
};
|
|
99
|
+
case 'error':
|
|
100
|
+
return {
|
|
101
|
+
icon: 'var(--redIcon)',
|
|
102
|
+
border: 'var(--redBorder)'
|
|
103
|
+
};
|
|
104
|
+
case 'success':
|
|
105
|
+
return {
|
|
106
|
+
icon: 'var(--greenIcon)',
|
|
107
|
+
border: 'var(--greenBorder)'
|
|
108
|
+
};
|
|
109
|
+
case 'info':
|
|
110
|
+
return {
|
|
111
|
+
icon: 'var(--blueIcon)',
|
|
112
|
+
border: 'var(--blueBorder)'
|
|
113
|
+
};
|
|
114
|
+
default:
|
|
115
|
+
// Custom color string
|
|
116
|
+
return {
|
|
117
|
+
icon: variant,
|
|
118
|
+
border: variant
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Computed wrapper classes
|
|
124
|
+
let wrapperClasses = $derived(`wrapper ${className}`.trim());
|
|
125
|
+
|
|
126
|
+
// Computed border style
|
|
127
|
+
let borderStyle = $derived(showBorder ? `border-left: 2px solid ${colors.border};` : '');
|
|
128
|
+
|
|
129
|
+
// Computed default icon component
|
|
130
|
+
let DefaultIcon = $derived(icon);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Handle close button click
|
|
134
|
+
*/
|
|
135
|
+
function handleCloseClick() {
|
|
136
|
+
onClose?.();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Handle close button keydown
|
|
141
|
+
*/
|
|
142
|
+
function handleCloseKeyDown(event: KeyboardEvent) {
|
|
143
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
handleCloseClick();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<div
|
|
151
|
+
class={wrapperClasses}
|
|
152
|
+
style={borderStyle}
|
|
153
|
+
class:centered={!message && !href && !linkText && !actions}
|
|
154
|
+
data-testid="notification"
|
|
155
|
+
{...restProps}
|
|
156
|
+
>
|
|
157
|
+
<span class="icon" style="color: {colors.icon};">
|
|
158
|
+
<DefaultIcon />
|
|
159
|
+
</span>
|
|
160
|
+
|
|
161
|
+
<div class="content">
|
|
162
|
+
{#if title}
|
|
163
|
+
<Text
|
|
164
|
+
label={title}
|
|
165
|
+
fontSize="normal"
|
|
166
|
+
fontWeight={titleFontWeight.toString()}
|
|
167
|
+
raw={richTextTitle}
|
|
168
|
+
/>
|
|
169
|
+
{/if}
|
|
170
|
+
|
|
171
|
+
{#if message || href || linkText}
|
|
172
|
+
<div class="message">
|
|
173
|
+
{#if message}
|
|
174
|
+
<Text label={message} fontColor="var(--text2)" raw={richTextMessage} />
|
|
175
|
+
{/if}
|
|
176
|
+
|
|
177
|
+
{#if href && linkText}
|
|
178
|
+
<a {href} class="link" target="_blank" rel="noopener noreferrer">
|
|
179
|
+
<span>{linkText}</span>
|
|
180
|
+
{#if linkIcon}
|
|
181
|
+
{@const Icon = linkIcon}
|
|
182
|
+
<Icon />
|
|
183
|
+
{/if}
|
|
184
|
+
</a>
|
|
185
|
+
{/if}
|
|
186
|
+
</div>
|
|
187
|
+
{/if}
|
|
188
|
+
|
|
189
|
+
{#if actions}
|
|
190
|
+
{@render actions()}
|
|
191
|
+
{/if}
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
{#if showCloseButton}
|
|
195
|
+
<button
|
|
196
|
+
class="close-button"
|
|
197
|
+
onclick={handleCloseClick}
|
|
198
|
+
onkeydown={handleCloseKeyDown}
|
|
199
|
+
aria-label="Close notification"
|
|
200
|
+
type="button"
|
|
201
|
+
>
|
|
202
|
+
<TimesIcon />
|
|
203
|
+
</button>
|
|
204
|
+
{/if}
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<style>
|
|
208
|
+
.wrapper {
|
|
209
|
+
display: flex;
|
|
210
|
+
padding: 8px;
|
|
211
|
+
align-items: flex-start;
|
|
212
|
+
gap: 8px;
|
|
213
|
+
align-self: stretch;
|
|
214
|
+
border-radius: 4px;
|
|
215
|
+
background: var(--background3);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.icon {
|
|
219
|
+
display: flex;
|
|
220
|
+
align-items: center;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
flex-shrink: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.content {
|
|
226
|
+
display: flex;
|
|
227
|
+
padding-right: var(--spacing-24, 24px);
|
|
228
|
+
flex-direction: column;
|
|
229
|
+
align-items: flex-start;
|
|
230
|
+
gap: 4px;
|
|
231
|
+
flex: 1 0 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.centered {
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.message {
|
|
239
|
+
color: var(--text-text-2, #bdbdbd);
|
|
240
|
+
font-family: Inter;
|
|
241
|
+
font-size: 11px;
|
|
242
|
+
font-style: normal;
|
|
243
|
+
font-weight: 400;
|
|
244
|
+
line-height: 16px;
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
justify-content: center;
|
|
248
|
+
align-items: flex-start;
|
|
249
|
+
gap: 4px;
|
|
250
|
+
align-self: stretch;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.link {
|
|
254
|
+
color: var(--blue-blue-text, #8ac2ff);
|
|
255
|
+
font-family: Inter;
|
|
256
|
+
font-size: 11px;
|
|
257
|
+
font-style: normal;
|
|
258
|
+
font-weight: 400;
|
|
259
|
+
line-height: 16px;
|
|
260
|
+
cursor: pointer;
|
|
261
|
+
text-decoration: none;
|
|
262
|
+
display: flex;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
align-items: center;
|
|
265
|
+
width: max-content;
|
|
266
|
+
gap: 4px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.link :global(svg) {
|
|
270
|
+
color: var(--blue-blue-text, #8ac2ff);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.close-button {
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
border: none;
|
|
276
|
+
background: transparent;
|
|
277
|
+
padding: 0;
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: center;
|
|
281
|
+
color: var(--text2);
|
|
282
|
+
flex-shrink: 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.close-button:hover {
|
|
286
|
+
opacity: 0.8;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.close-button:focus-visible {
|
|
290
|
+
outline: 2px solid var(--color-focus, #8ac2ff);
|
|
291
|
+
outline-offset: 2px;
|
|
292
|
+
border-radius: 2px;
|
|
293
|
+
}
|
|
294
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
type NotificationType = 'warning' | 'error' | 'success' | 'info';
|
|
3
|
+
interface NotificationProps {
|
|
4
|
+
/**
|
|
5
|
+
* Additional CSS classes to apply
|
|
6
|
+
*/
|
|
7
|
+
class?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The main message content to display
|
|
10
|
+
*/
|
|
11
|
+
message?: string;
|
|
12
|
+
/**
|
|
13
|
+
* External link URL
|
|
14
|
+
*/
|
|
15
|
+
href?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The title/heading of the notification
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Font weight for the title text
|
|
22
|
+
*/
|
|
23
|
+
titleFontWeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Text for the link button
|
|
26
|
+
*/
|
|
27
|
+
linkText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to show the close button
|
|
30
|
+
*/
|
|
31
|
+
showCloseButton?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom icon component to display
|
|
34
|
+
*/
|
|
35
|
+
icon?: Component;
|
|
36
|
+
/**
|
|
37
|
+
* Icon component for the link
|
|
38
|
+
*/
|
|
39
|
+
linkIcon?: Component | null;
|
|
40
|
+
/**
|
|
41
|
+
* Notification type or custom color string
|
|
42
|
+
*/
|
|
43
|
+
variant?: NotificationType | string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to render message as rich text/HTML
|
|
46
|
+
*/
|
|
47
|
+
richTextMessage?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to render title as rich text/HTML
|
|
50
|
+
*/
|
|
51
|
+
richTextTitle?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to show the colored left border
|
|
54
|
+
*/
|
|
55
|
+
showBorder?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Custom action content
|
|
58
|
+
*/
|
|
59
|
+
actions?: Snippet;
|
|
60
|
+
/**
|
|
61
|
+
* Event handler for close button click
|
|
62
|
+
*/
|
|
63
|
+
onClose?: () => void;
|
|
64
|
+
}
|
|
65
|
+
declare const Notification: Component<NotificationProps, {}, "">;
|
|
66
|
+
type Notification = ReturnType<typeof Notification>;
|
|
67
|
+
export default Notification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Notification } from './Notification.svelte';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
export type NotificationType = 'warning' | 'error' | 'success' | 'info';
|
|
3
|
+
export interface NotificationProps {
|
|
4
|
+
/**
|
|
5
|
+
* Additional CSS classes to apply
|
|
6
|
+
*/
|
|
7
|
+
class?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The main message content to display
|
|
10
|
+
*/
|
|
11
|
+
message?: string;
|
|
12
|
+
/**
|
|
13
|
+
* External link URL
|
|
14
|
+
*/
|
|
15
|
+
href?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The title/heading of the notification
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Font weight for the title text
|
|
22
|
+
*/
|
|
23
|
+
titleFontWeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Text for the link button
|
|
26
|
+
*/
|
|
27
|
+
linkText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to show the close button
|
|
30
|
+
*/
|
|
31
|
+
showCloseButton?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom icon component to display
|
|
34
|
+
*/
|
|
35
|
+
icon?: Component;
|
|
36
|
+
/**
|
|
37
|
+
* Icon component for the link
|
|
38
|
+
*/
|
|
39
|
+
linkIcon?: Component | null;
|
|
40
|
+
/**
|
|
41
|
+
* Notification type or custom color string
|
|
42
|
+
*/
|
|
43
|
+
variant?: NotificationType | string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to render message as rich text/HTML
|
|
46
|
+
*/
|
|
47
|
+
richTextMessage?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to render title as rich text/HTML
|
|
50
|
+
*/
|
|
51
|
+
richTextTitle?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to show the colored left border
|
|
54
|
+
*/
|
|
55
|
+
showBorder?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Custom action content
|
|
58
|
+
*/
|
|
59
|
+
actions?: Snippet;
|
|
60
|
+
/**
|
|
61
|
+
* Event handler for close button click
|
|
62
|
+
*/
|
|
63
|
+
onClose?: () => void;
|
|
64
|
+
}
|
|
65
|
+
export interface NotificationColors {
|
|
66
|
+
icon: string;
|
|
67
|
+
border: string;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|