@onsvisual/svelte-components 1.0.25 → 1.0.28

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 (32) hide show
  1. package/dist/css/main.css +1 -1
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +10 -0
  4. package/dist/inputs/ButtonGroup/ButtonGroup.stories.svelte +40 -0
  5. package/dist/inputs/ButtonGroup/ButtonGroup.stories.svelte.d.ts +23 -0
  6. package/dist/inputs/ButtonGroup/ButtonGroup.svelte +57 -0
  7. package/dist/inputs/ButtonGroup/ButtonGroup.svelte.d.ts +27 -0
  8. package/dist/inputs/ButtonGroup/ButtonGroupItem.svelte +101 -0
  9. package/dist/inputs/ButtonGroup/ButtonGroupItem.svelte.d.ts +23 -0
  10. package/dist/inputs/ButtonGroup/docs/component.md +21 -0
  11. package/dist/inputs/Radios/Radio.svelte +8 -1
  12. package/dist/inputs/Toolbar/HelpModal.svelte +234 -0
  13. package/dist/inputs/Toolbar/HelpModal.svelte.d.ts +16 -0
  14. package/dist/inputs/Toolbar/ToolControl.svelte +23 -0
  15. package/dist/inputs/Toolbar/ToolControl.svelte.d.ts +27 -0
  16. package/dist/inputs/Toolbar/ToolControls.svelte +9 -0
  17. package/dist/inputs/Toolbar/ToolControls.svelte.d.ts +27 -0
  18. package/dist/inputs/Toolbar/Toolbar.stories.svelte +148 -0
  19. package/dist/inputs/Toolbar/Toolbar.stories.svelte.d.ts +23 -0
  20. package/dist/inputs/Toolbar/Toolbar.svelte +70 -0
  21. package/dist/inputs/Toolbar/Toolbar.svelte.d.ts +29 -0
  22. package/dist/inputs/Toolbar/ToolbarButton.svelte +184 -0
  23. package/dist/inputs/Toolbar/ToolbarButton.svelte.d.ts +19 -0
  24. package/dist/inputs/Toolbar/ToolbarDivider.svelte +29 -0
  25. package/dist/inputs/Toolbar/ToolbarDivider.svelte.d.ts +14 -0
  26. package/dist/inputs/Toolbar/ToolbarIcon.svelte +106 -0
  27. package/dist/inputs/Toolbar/ToolbarIcon.svelte.d.ts +23 -0
  28. package/dist/inputs/Toolbar/ToolbarsContainer.svelte +69 -0
  29. package/dist/inputs/Toolbar/ToolbarsContainer.svelte.d.ts +19 -0
  30. package/dist/inputs/Toolbar/docs/component.md +99 -0
  31. package/dist/inputs/Toolbar/img/movepan.png +0 -0
  32. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ /** @typedef {typeof __propDef.props} ToolControlsProps */
2
+ /** @typedef {typeof __propDef.events} ToolControlsEvents */
3
+ /** @typedef {typeof __propDef.slots} ToolControlsSlots */
4
+ export default class ToolControls extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {
9
+ default: {};
10
+ }> {
11
+ }
12
+ export type ToolControlsProps = typeof __propDef.props;
13
+ export type ToolControlsEvents = typeof __propDef.events;
14
+ export type ToolControlsSlots = typeof __propDef.slots;
15
+ import { SvelteComponentTyped } from "svelte";
16
+ declare const __propDef: {
17
+ props: {
18
+ [x: string]: never;
19
+ };
20
+ events: {
21
+ [evt: string]: CustomEvent<any>;
22
+ };
23
+ slots: {
24
+ default: {};
25
+ };
26
+ };
27
+ export {};
@@ -0,0 +1,148 @@
1
+ <script module>
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import { withComponentDocs } from "../../js/withParams.js";
4
+ import ToolbarsContainer from "./ToolbarsContainer.svelte";
5
+ import Toolbar from "./Toolbar.svelte";
6
+ import ToolbarButton from "./ToolbarButton.svelte";
7
+ import ToolbarDivider from "./ToolbarDivider.svelte";
8
+ import movepanimg from "./img/movepan.png";
9
+ import Button from "../Button/Button.svelte";
10
+ import ToolControls from "./ToolControls.svelte";
11
+ import ToolControl from "./ToolControl.svelte";
12
+ import componentDocs from "./docs/component.md?raw";
13
+
14
+ let container;
15
+
16
+ const toolbarContent = [
17
+ {
18
+ type: "button",
19
+ id: "move",
20
+ icon: "move",
21
+ label: "Move and Pan",
22
+ helpContent: `<h3>Move and pan</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p><img src='${movepanimg}' alt='Move and pan' />`
23
+ },
24
+ {
25
+ type: "button",
26
+ id: "polygon",
27
+ icon: "polygon",
28
+ label: "Draw a polygon",
29
+ helpContent:
30
+ "<h3>Draw a polygon</h3><p>Left-click to add a point to the polygon. Double-click to finish drawing.</p>",
31
+ hasAriaControls: true
32
+ },
33
+ {
34
+ type: "button",
35
+ id: "circle",
36
+ icon: "radius",
37
+ label: "Draw a circle",
38
+ helpContent:
39
+ "<h3>Draw a circle</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p>"
40
+ },
41
+ {
42
+ type: "divider"
43
+ },
44
+ {
45
+ type: "button",
46
+ id: "zoomin",
47
+ icon: "zoomin",
48
+ label: "Zoom in",
49
+ helpContent:
50
+ "<h3>Zoom in</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p>"
51
+ },
52
+ {
53
+ type: "button",
54
+ id: "zoomout",
55
+ icon: "zoomout",
56
+ label: "Zoom out",
57
+ helpContent:
58
+ "<h3>Zoom out</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p>"
59
+ },
60
+ {
61
+ type: "divider"
62
+ },
63
+ {
64
+ type: "button",
65
+ id: "undo",
66
+ icon: "undo",
67
+ label: "Undo last step",
68
+ helpContent:
69
+ "<h3>Undo last step</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p>"
70
+ },
71
+ {
72
+ type: "button",
73
+ id: "redo",
74
+ icon: "redo",
75
+ label: "Redo last step",
76
+ helpContent:
77
+ "<h3>Redo last step</h3><p>Left-click anywhere on the map and hold the button down while dragging the mouse to move the map in the desired direction.</p>",
78
+ disabled: true
79
+ },
80
+ {
81
+ type: "divider"
82
+ },
83
+ {
84
+ type: "button",
85
+ id: "search",
86
+ icon: "search",
87
+ label: "Search for an area",
88
+ helpContent: "<h3>Search</h3><p>Search for an area by name or postcode.</p>"
89
+ }
90
+ ];
91
+
92
+ const { Story } = defineMeta({
93
+ title: "Inputs/Toolbar",
94
+ component: ToolbarsContainer,
95
+ tags: ["autodocs"],
96
+ argTypes: {
97
+ orientation: {
98
+ options: ["horizontal", "vertical"],
99
+ control: { type: "select" }
100
+ }
101
+ },
102
+ parameters: withComponentDocs(componentDocs)
103
+ });
104
+ </script>
105
+
106
+ {#snippet template(args)}
107
+ <ToolbarsContainer bind:this={container}>
108
+ <Toolbar orientation={args.orientation} ariaLabel={args.ariaLabel}>
109
+ {#each toolbarContent as { type, id, icon, label, helpContent, disabled, hasAriaControls }}
110
+ {#if type === "button"}
111
+ <ToolbarButton {id} {icon} {label} {disabled} {hasAriaControls}>
112
+ {@html helpContent}
113
+ </ToolbarButton>
114
+ {:else}
115
+ <ToolbarDivider />
116
+ {/if}
117
+ {/each}
118
+ <ToolControls slot="controls">
119
+ <ToolControl id="polygon">
120
+ <p>
121
+ Click or tap an area on the map to add a node to the shape. To apply a shape, close it
122
+ by clicking or tapping on the starting node.
123
+ </p>
124
+ <Button variant="secondary" disabled>Clear shape</Button>
125
+ <Button variant="primary">Apply shape</Button>
126
+ </ToolControl>
127
+ </ToolControls>
128
+ </Toolbar>
129
+ <Toolbar orientation={args.orientation}>
130
+ <ToolbarButton id="download" icon="download" label="Download area" />
131
+ <ToolbarButton id="upload" icon="upload" label="Upload a geometry" />
132
+ <ToolbarDivider />
133
+ <ToolbarButton id="help" icon="help" label="Help" on:click={container.resetHelp} />
134
+ <ToolbarDivider />
135
+ <ToolbarButton id="getstarted" custom label="Get started">
136
+ <div slot="custom">
137
+ <Button disabled small>Build profile</Button>
138
+ </div>
139
+ </ToolbarButton>
140
+ </Toolbar>
141
+ </ToolbarsContainer>
142
+ {/snippet}
143
+
144
+ {#snippet transient(args)}{/snippet}
145
+
146
+ <Story name="Default" args={{ ariaLabel: "Toolbar" }} {template} />
147
+
148
+ <Story name="Vertical" args={{ orientation: "vertical" }} {template} />
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} ToolbarProps */
2
+ /** @typedef {typeof __propDef.events} ToolbarEvents */
3
+ /** @typedef {typeof __propDef.slots} ToolbarSlots */
4
+ export default class Toolbar extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type ToolbarProps = typeof __propDef.props;
11
+ export type ToolbarEvents = typeof __propDef.events;
12
+ export type ToolbarSlots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: never;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
@@ -0,0 +1,70 @@
1
+ <script>
2
+ import { getContext, setContext } from "svelte";
3
+ import { writable } from "svelte/store";
4
+
5
+ /**
6
+ * @typedef {object} ToolbarProps
7
+ * @property {string | null} [classes=null] - Additional classes for the button
8
+ * @property {string | null} [ariaLabel=null] - aria label for button
9
+ * @property {'horizontal' | 'vertical'} [orientation='horizontal'] - Orientation of the toolbar
10
+ */
11
+
12
+ /** @type {ToolbarProps} */
13
+ let { classes = null, ariaLabel = null, orientation = "horizontal" } = $props();
14
+
15
+ // Set context for child components
16
+ const orientationStore = writable(orientation);
17
+ setContext("orientation", orientationStore);
18
+
19
+ $effect(() => {
20
+ orientationStore.set(orientation);
21
+ });
22
+
23
+ // Get the showHelpModals state from context
24
+ const showHelpModals = getContext("showHelpModals");
25
+ const showHelp = $derived(showHelpModals);
26
+ </script>
27
+
28
+ <!-- Toolbar container -->
29
+ <div
30
+ role="toolbar"
31
+ aria-label={ariaLabel}
32
+ class={`toolbar ${orientation === "vertical" ? "" : "flex-col"} ${classes}`}
33
+ >
34
+ <!-- slot for helpModal -->
35
+ <div class={`grid--flex ${orientation === "vertical" ? "flex-col" : ""}`}>
36
+ <slot />
37
+ </div>
38
+
39
+ {#if !$showHelp}
40
+ <slot name="controls" />
41
+ {/if}
42
+ </div>
43
+
44
+ <style>
45
+ .grid--flex {
46
+ display: flex;
47
+ gap: 4px;
48
+ }
49
+
50
+ .toolbar {
51
+ display: flex;
52
+ align-items: center;
53
+ box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);
54
+ border-radius: 8px;
55
+ padding: 8px;
56
+ justify-content: flex-start;
57
+ align-content: flex-start;
58
+ flex-wrap: nowrap;
59
+ width: auto;
60
+ max-width: fit-content;
61
+ height: 100%;
62
+ margin: 8px;
63
+ background: white;
64
+ pointer-events: all;
65
+ }
66
+
67
+ .flex-col {
68
+ flex-direction: column;
69
+ }
70
+ </style>
@@ -0,0 +1,29 @@
1
+ /** @typedef {typeof __propDef.props} ToolbarProps */
2
+ /** @typedef {typeof __propDef.events} ToolbarEvents */
3
+ /** @typedef {typeof __propDef.slots} ToolbarSlots */
4
+ export default class Toolbar extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {
9
+ default: {};
10
+ controls: {};
11
+ }> {
12
+ }
13
+ export type ToolbarProps = typeof __propDef.props;
14
+ export type ToolbarEvents = typeof __propDef.events;
15
+ export type ToolbarSlots = typeof __propDef.slots;
16
+ import { SvelteComponentTyped } from "svelte";
17
+ declare const __propDef: {
18
+ props: {
19
+ [x: string]: never;
20
+ };
21
+ events: {
22
+ [evt: string]: CustomEvent<any>;
23
+ };
24
+ slots: {
25
+ default: {};
26
+ controls: {};
27
+ };
28
+ };
29
+ export {};
@@ -0,0 +1,184 @@
1
+ <script lang="ts">
2
+ import { onMount, onDestroy, createEventDispatcher, getContext } from "svelte";
3
+ import Icon from "./ToolbarIcon.svelte";
4
+ import HelpModal from "./HelpModal.svelte";
5
+ import { nanoid } from "nanoid";
6
+
7
+ // Props for the ToolbarButton
8
+ let {
9
+ id = nanoid(6),
10
+ icon = "",
11
+ label = "",
12
+ disabled = false,
13
+ classes = "",
14
+ helpText = null,
15
+ selected = false,
16
+ custom = false,
17
+ hasAriaControls = false,
18
+ sticky = false,
19
+ transient = false,
20
+ disableHelp = false
21
+ }: {
22
+ id?: string;
23
+ icon?: string;
24
+ label?: string;
25
+ disabled?: boolean;
26
+ classes?: string;
27
+ helpText?: string | null;
28
+ selected?: boolean;
29
+ custom?: boolean;
30
+ hasAriaControls?: boolean;
31
+ sticky?: boolean;
32
+ transient?: boolean;
33
+ disableHelp?: boolean;
34
+ } = $props();
35
+
36
+ const dispatch = createEventDispatcher();
37
+
38
+ let buttonElement: HTMLElement;
39
+
40
+ // Get activeModalId store from context
41
+ const activeModalId = getContext("activeModalId");
42
+ const currentActiveId = $derived(activeModalId);
43
+ const isActive = $derived($currentActiveId === id);
44
+
45
+ // Retrieve button registry from context
46
+ const { register, unregister } = getContext("buttonIds");
47
+
48
+ // Register button on mount
49
+ onMount(() => {
50
+ register(id);
51
+ });
52
+
53
+ // Unregister button on destroy
54
+ onDestroy(() => {
55
+ unregister(id);
56
+ });
57
+
58
+ // Subscribe to the store to determine if this modal is active
59
+ function handleClick() {
60
+ if (!disabled) {
61
+ if (transient) {
62
+ // If it's a transient button, just trigger the action and return
63
+ dispatch("click");
64
+ return;
65
+ }
66
+
67
+ dispatch("click");
68
+ if ($activeModalId === id && sticky) {
69
+ // If it's already active and sticky, keep it selected
70
+ return;
71
+ }
72
+ activeModalId.set(isActive ? null : id); // Toggle the modal
73
+ }
74
+ }
75
+ </script>
76
+
77
+ <div class="toolbar-button-wrapper">
78
+ {#if custom}
79
+ <div on:click={handleClick} bind:this={buttonElement}>
80
+ <slot name="custom" />
81
+ </div>
82
+ {:else}
83
+ <button
84
+ type="button"
85
+ aria-label={label}
86
+ class={`toolbar-button ${disabled ? "disabled" : ""} ${
87
+ isActive && !transient ? "selected" : ""
88
+ } ${classes}`}
89
+ on:click={handleClick}
90
+ {disabled}
91
+ bind:this={buttonElement}
92
+ id={`button-${id}`}
93
+ aria-controls={hasAriaControls ? `panel-${id}` : undefined}
94
+ >
95
+ {#if icon}
96
+ <Icon type={icon} selected={!transient ? (isActive ? true : false) : false} {disabled} />
97
+ {:else}
98
+ {label}
99
+ {/if}
100
+ </button>
101
+ {/if}
102
+
103
+ {#if isActive}
104
+ {#if helpText && !disableHelp}
105
+ <HelpModal triggerElement={buttonElement} onClose={() => activeModalId.set(null)}>
106
+ <p>{helpText}</p>
107
+ </HelpModal>
108
+ {:else if !helpText && !disableHelp}
109
+ <HelpModal triggerElement={buttonElement} onClose={() => activeModalId.set(null)}>
110
+ <slot />
111
+ </HelpModal>
112
+ {/if}
113
+ {/if}
114
+ </div>
115
+
116
+ <!--
117
+
118
+ /* /* Slightly darker gray when clicked */
119
+
120
+ /*
121
+ button:active {
122
+ background-color: #d6d6d6;
123
+ }
124
+
125
+ button.active {
126
+ background-color: #ddd; /* Selected button background */
127
+ border: 2px solid #333; /* Active button border */
128
+ }
129
+
130
+ button:hover:active {
131
+ background-color: #ccc; /* Slightly more contrast when active */
132
+ }
133
+
134
+ button:disabled {
135
+ opacity: 0.5;
136
+ cursor: not-allowed;
137
+ background-color: #f2f2f2;
138
+ border: 1px solid #ddd;
139
+ }
140
+
141
+ button:hover:disabled {
142
+ background-color: #f2f2f2; /* Keep it the same so disabled buttons don’t change on hover */
143
+ border: 1px solid #ddd;
144
+ } */
145
+ -->
146
+
147
+ <style>
148
+ .toolbar-button-wrapper {
149
+ position: relative;
150
+ }
151
+ .toolbar-button {
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ padding: 0.5rem;
156
+ background: none;
157
+ border: none;
158
+ cursor: pointer;
159
+ flex-shrink: 0;
160
+ flex-grow: 0;
161
+ }
162
+
163
+ .toolbar-button.disabled {
164
+ /* opacity: 0.5; */
165
+ cursor: not-allowed;
166
+ }
167
+
168
+ .selected {
169
+ background: #e9eff4;
170
+ border-radius: 8px;
171
+ }
172
+
173
+ button:hover {
174
+ background-color: #f5f5f6;
175
+ border-radius: 8px;
176
+ }
177
+
178
+ button:focus {
179
+ outline: 2px solid #fbc900;
180
+ outline-offset: 2px;
181
+ box-shadow: 0 0 2px 2px #222222;
182
+ border-radius: 8px;
183
+ }
184
+ </style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ click: CustomEvent<any>;
6
+ } & {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {
10
+ custom: {};
11
+ default: {};
12
+ };
13
+ };
14
+ export type ToolbarButtonProps = typeof __propDef.props;
15
+ export type ToolbarButtonEvents = typeof __propDef.events;
16
+ export type ToolbarButtonSlots = typeof __propDef.slots;
17
+ export default class ToolbarButton extends SvelteComponentTyped<ToolbarButtonProps, ToolbarButtonEvents, ToolbarButtonSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { getContext } from "svelte";
3
+
4
+ let { classes = "" }: { classes?: string } = $props();
5
+
6
+ // Get the orientation store from context
7
+ const orientationStore = getContext("orientation");
8
+
9
+ // Subscribe to the store to get its value
10
+ const orientation = $derived(orientationStore);
11
+ </script>
12
+
13
+ <div class={`toolbar-divider ${$orientation} ${classes}`} aria-hidden="true"></div>
14
+
15
+ <style>
16
+ .toolbar-divider {
17
+ background-color: #ccc;
18
+ }
19
+
20
+ .toolbar-divider.horizontal {
21
+ width: 1px;
22
+ }
23
+
24
+ .toolbar-divider.vertical {
25
+ width: 100%;
26
+ height: 1px;
27
+ margin: 0.5rem 0;
28
+ }
29
+ </style>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ToolbarDividerProps = typeof __propDef.props;
10
+ export type ToolbarDividerEvents = typeof __propDef.events;
11
+ export type ToolbarDividerSlots = typeof __propDef.slots;
12
+ export default class ToolbarDivider extends SvelteComponentTyped<ToolbarDividerProps, ToolbarDividerEvents, ToolbarDividerSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,106 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [type]
5
+ * @property {boolean} [marginLeft]
6
+ * @property {boolean} [marginRight]
7
+ * @property {boolean} [selected]
8
+ * @property {boolean} [disabled]
9
+ */
10
+
11
+ /** @type {Props} */
12
+ let {
13
+ type = "move",
14
+ marginLeft = false,
15
+ marginRight = false,
16
+ selected = false,
17
+ disabled = false
18
+ } = $props();
19
+
20
+ const paths = {
21
+ move: {
22
+ selected: "M29 16L16 29L3 16L16 3L29 16Z",
23
+ d: "M11.293 7.707a1 1 0 0 1 0-1.415l4-4a1 1 0 0 1 1.415 0l4 4a1 1 0 0 1-1.415 1.415L17 5.414V12a1 1 0 0 1-2 0V5.414l-2.293 2.293a1 1 0 0 1-1.415 0m8 16.586L17 26.586V20a1 1 0 0 0-2 0v6.586l-2.293-2.293a1 1 0 1 0-1.415 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415m10.415-9-4-4a1 1 0 1 0-1.415 1.415L26.586 15H20a1 1 0 0 0 0 2h6.586l-2.293 2.293a1 1 0 1 0 1.415 1.415l4-4a1 1 0 0 0 0-1.415M5.413 17H12a1 1 0 0 0 0-2H5.414l2.293-2.293a1 1 0 1 0-1.415-1.415l-4 4a1 1 0 0 0 0 1.415l4 4a1 1 0 0 0 1.415-1.415z"
24
+ },
25
+ polygon: {
26
+ selected: "M17.5 24L7.5 17V12.5L12.5 8.5L16 9L17.5 7.5L22.5 8.5L25 12.5L21 23L17.5 24Z",
27
+ d: "M28.83 6.17a4 4 0 0 0-6.302.845L19 6.053a4 4 0 1 0-7.549 1.793L7.21 11.665a4.01 4.01 0 0 0-5.039.506 4 4 0 0 0 5.361 5.927l8.75 6.42a4 4 0 1 0 5.947-1.837l3.423-9.699q.172.015.345.016a4 4 0 0 0 2.829-6.828zM13.58 4.584a2 2 0 1 1-.433 2.18 2 2 0 0 1 .438-2.18zm-10 11.831a2 2 0 1 1 2.826-2.83 2 2 0 0 1-2.826 2.83m17.831 11a2 2 0 1 1-2.829-2.828 2 2 0 0 1 2.83 2.828m-1.069-5.398a4 4 0 0 0-2.874.886l-8.75-6.42a4.02 4.02 0 0 0-.168-3.332l4.244-3.818a4 4 0 0 0 5.683-1.352L22 8.945a4 4 0 0 0 1.765 3.375zm7.07-11.604a2 2 0 1 1-2.825-2.828 2 2 0 1 1 2.83 2.829z"
28
+ },
29
+ radius: {},
30
+ erase: {
31
+ d: "M28.125 10.05 22.95 4.875a3 3 0 0 0-4.242 0L3.874 19.708a3 3 0 0 0 0 4.242l3.758 3.758a1 1 0 0 0 .71.292H27a1 1 0 1 0 0-2H16.413l11.712-11.707a3 3 0 0 0 0-4.243M13.585 26H8.756l-3.465-3.465a1 1 0 0 1 0-1.414L12 14.414 18.586 21zM26.71 12.875 20 19.586 13.414 13l6.711-6.707a1 1 0 0 1 1.415 0l5.172 5.172a1 1 0 0 1 0 1.414z"
32
+ },
33
+ zoomin: {
34
+ selected: "M24 14a10 10 0 1 1-20 0 10 10 0 0 1 20 0",
35
+ d: "M19 14a1 1 0 0 1-1 1h-3v3a1 1 0 0 1-2 0v-3h-3a1 1 0 0 1 0-2h3v-3a1 1 0 0 1 2 0v3h3a1 1 0 0 1 1 1m9.708 14.708a1 1 0 0 1-1.415 0l-6.258-6.26a11.014 11.014 0 1 1 1.414-1.413l6.258 6.258a1 1 0 0 1 0 1.415M14 23a9 9 0 1 0-9-9 9.01 9.01 0 0 0 9 9"
36
+ },
37
+ zoomout: {
38
+ selected: "M24 14a10 10 0 1 1-20 0 10 10 0 0 1 20 0",
39
+ d: "M19 14a1 1 0 0 1-1 1h-8a1 1 0 0 1 0-2h8a1 1 0 0 1 1 1m9.708 14.708a1 1 0 0 1-1.415 0l-6.258-6.26a11.014 11.014 0 1 1 1.414-1.413l6.258 6.258a1 1 0 0 1 0 1.415M14 23a9 9 0 1 0-9-9 9.01 9.01 0 0 0 9 9"
40
+ },
41
+ undo: {
42
+ selected: "M10 5V17L4 11L10 5Z",
43
+ d: "M29 18a8.01 8.01 0 0 1-8 8H10a1 1 0 1 1 0-2h11a6 6 0 1 0 0-12H6.414l4.294 4.293a1 1 0 0 1-1.416 1.415l-6-6a1 1 0 0 1 0-1.415l6-6a1 1 0 0 1 1.415 1.415L6.414 10H21a8.01 8.01 0 0 1 8 8"
44
+ },
45
+ redo: {
46
+ selected: "M28 11L22 17V5L28 11Z",
47
+ d: "M21.293 16.293 25.586 12H11a6 6 0 1 0 0 12h11a1 1 0 0 1 0 2H11a8 8 0 1 1 0-16h14.586l-4.293-4.292a1.001 1.001 0 0 1 1.415-1.415l6 6a1 1 0 0 1 0 1.415l-6 6a1 1 0 1 1-1.415-1.415"
48
+ },
49
+ search: {
50
+ selected: "M24 14a10 10 0 1 1-20 0 10 10 0 0 1 20 0",
51
+ d: "m28.708 27.293-6.26-6.258a11.014 11.014 0 1 0-1.413 1.414l6.258 6.258a1 1 0 0 0 1.415-1.415M5 14a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9"
52
+ },
53
+ download: {
54
+ selected: "M27 6v20H5V6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2",
55
+ d: "M28 18v8a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-8a1 1 0 1 1 2 0v7h20v-7a1 1 0 0 1 2 0m-12.707.707a1 1 0 0 0 1.415 0l5-5a1 1 0 0 0-1.415-1.415L17 15.587V4a1 1 0 0 0-2 0v11.586l-3.293-3.293a1 1 0 1 0-1.415 1.415z"
56
+ },
57
+ upload: {
58
+ selected: "M27 6v20H5V6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2",
59
+ d: "M28 18v8a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-8a1 1 0 1 1 2 0v7h20v-7a1 1 0 0 1 2 0M11.708 9.707 15 6.414V18a1 1 0 0 0 2 0V6.414l3.293 3.293a1 1 0 1 0 1.415-1.415l-5-5a1 1 0 0 0-1.415 0l-5 5a1 1 0 0 0 1.415 1.415"
60
+ },
61
+ help: {
62
+ selected: "M28 16a12 12 0 1 1-23.999 0A12 12 0 0 1 28 16",
63
+ d: "M17.5 22.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M16 9c-2.758 0-5 2.019-5 4.5v.5a1 1 0 0 0 2 0v-.5c0-1.375 1.346-2.5 3-2.5s3 1.125 3 2.5-1.346 2.5-3 2.5a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.09c2.28-.419 4-2.238 4-4.41 0-2.481-2.242-4.5-5-4.5m13 7A13 13 0 1 1 16 3a13.014 13.014 0 0 1 13 13m-2 0a11 11 0 1 0-11 11 11.01 11.01 0 0 0 11-11"
64
+ },
65
+ bin: {
66
+ selected: "M25 7v19a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V7z",
67
+ d: "M27 6h-5V5a3 3 0 0 0-3-3h-6a3 3 0 0 0-3 3v1H5a1 1 0 0 0 0 2h1v18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h1a1 1 0 1 0 0-2M12 5a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v1h-8zm12 21H8V8h16zM14 13v8a1 1 0 0 1-2 0v-8a1 1 0 0 1 2 0m6 0v8a1 1 0 0 1-2 0v-8a1 1 0 0 1 2 0"
68
+ }
69
+ };
70
+ </script>
71
+
72
+ {#if paths[type]}
73
+ <svg
74
+ class="ons-svg-icon ons-svg-icon--m"
75
+ class:ons-u-ml-xs={marginLeft}
76
+ class:ons-u-mr-xs={marginRight}
77
+ class:selected
78
+ viewBox="0 0 32 32"
79
+ xmlns="http://www.w3.org/2000/svg"
80
+ focusable="false"
81
+ fill={selected ? "#206095" : disabled ? "#BCBCBD" : "currentColor"}
82
+ >
83
+ {#if selected}
84
+ <path opacity="0.2" d={paths[type].selected}></path>
85
+ {/if}
86
+ {#if type != "radius"}
87
+ <path d={paths[type].d}></path>
88
+ {:else if type == "radius"}
89
+ <circle
90
+ cx="16"
91
+ cy="16"
92
+ r="12"
93
+ stroke="currentColor"
94
+ stroke-width="2"
95
+ fill={selected ? "#206095" : "none"}
96
+ fill-opacity={selected ? "0.2" : "0"}
97
+ ></circle>
98
+ {/if}
99
+ </svg>
100
+ {/if}
101
+
102
+ <style>
103
+ .selected {
104
+ fill: #206095;
105
+ }
106
+ </style>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} ToolbarIconProps */
2
+ /** @typedef {typeof __propDef.events} ToolbarIconEvents */
3
+ /** @typedef {typeof __propDef.slots} ToolbarIconSlots */
4
+ export default class ToolbarIcon extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type ToolbarIconProps = typeof __propDef.props;
11
+ export type ToolbarIconEvents = typeof __propDef.events;
12
+ export type ToolbarIconSlots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: never;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};