@onsvisual/svelte-components 0.1.102-component.toolbar → 0.1.103

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 (33) hide show
  1. package/dist/@types/index.d.ts +1 -10
  2. package/dist/@types/inputs/AccessibleSelect/AccessibleSelect.svelte.d.ts +58 -0
  3. package/dist/@types/inputs/AccessibleSelect/options.d.ts +6 -0
  4. package/dist/@types/inputs/Button/Button.svelte.d.ts +2 -2
  5. package/dist/@types/inputs/Select/Select.svelte.d.ts +10 -10
  6. package/dist/@types/layout/Titleblock/Titleblock.svelte.d.ts +0 -2
  7. package/dist/css/main.css +1 -1
  8. package/dist/index.js +1 -10
  9. package/dist/inputs/AccessibleSelect/AccessibleSelect.svelte +280 -0
  10. package/dist/inputs/AccessibleSelect/options.js +263 -0
  11. package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte +41 -9
  12. package/dist/layout/Titleblock/Titleblock.svelte +0 -6
  13. package/package.json +4 -15
  14. package/dist/@types/inputs/ButtonGroup/ButtonGroup.svelte.d.ts +0 -33
  15. package/dist/@types/inputs/ButtonGroup/ButtonGroupItem.svelte.d.ts +0 -25
  16. package/dist/@types/inputs/Toolbar/HelpModal.svelte.d.ts +0 -19
  17. package/dist/@types/inputs/Toolbar/Icon.svelte.d.ts +0 -31
  18. package/dist/@types/inputs/Toolbar/ToolControl.svelte.d.ts +0 -27
  19. package/dist/@types/inputs/Toolbar/ToolControls.svelte.d.ts +0 -27
  20. package/dist/@types/inputs/Toolbar/Toolbar.svelte.d.ts +0 -33
  21. package/dist/@types/inputs/Toolbar/ToolbarButton.svelte.d.ts +0 -32
  22. package/dist/@types/inputs/Toolbar/ToolbarDivider.svelte.d.ts +0 -16
  23. package/dist/@types/inputs/Toolbar/ToolbarsContainer.svelte.d.ts +0 -19
  24. package/dist/inputs/ButtonGroup/ButtonGroup.svelte +0 -55
  25. package/dist/inputs/ButtonGroup/ButtonGroupItem.svelte +0 -103
  26. package/dist/inputs/Toolbar/HelpModal.svelte +0 -220
  27. package/dist/inputs/Toolbar/Icon.svelte +0 -142
  28. package/dist/inputs/Toolbar/ToolControl.svelte +0 -19
  29. package/dist/inputs/Toolbar/ToolControls.svelte +0 -8
  30. package/dist/inputs/Toolbar/Toolbar.svelte +0 -72
  31. package/dist/inputs/Toolbar/ToolbarButton.svelte +0 -162
  32. package/dist/inputs/Toolbar/ToolbarDivider.svelte +0 -27
  33. package/dist/inputs/Toolbar/ToolbarsContainer.svelte +0 -61
@@ -58,11 +58,6 @@
58
58
  * @type {string}
59
59
  */
60
60
  export let titleBadgeColor = "#003C57";
61
- /**
62
- * Set a width for the container
63
- * @type {"narrow"|"medium"|"wide"|"wider"|"full"}
64
- */
65
- export let width = "wide";
66
61
 
67
62
  $: titleBadgeTextColor = contrastColor(titleBadgeColor);
68
63
  </script>
@@ -72,7 +67,6 @@
72
67
  themeOverrides="{themeOverrides}"
73
68
  allowClientOverrides="{allowClientOverrides}"
74
69
  background="{background}"
75
- width="{width}"
76
70
  >
77
71
  <section class="ons-u-mb-xl">
78
72
  <slot name="before" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.1.102-component.toolbar",
3
+ "version": "0.1.103",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",
@@ -17,8 +17,7 @@
17
17
  "build": "npm-run-all build:package build:docs",
18
18
  "deploy": "gh-pages -d docs -t true",
19
19
  "prepublishOnly": "npm run build:package",
20
- "postversion": "git push origin && git push origin --tags",
21
- "watch:package": "npx nodemon --ext svelte,js,ts --ignore dist/ --exec 'npm run build:package'"
20
+ "postversion": "git push origin && git push origin --tags"
22
21
  },
23
22
  "license": "MIT",
24
23
  "types": "./dist/@types/index.d.ts",
@@ -71,8 +70,6 @@
71
70
  "fs-extra": "^11.1.1",
72
71
  "gh-pages": "^6.2.0",
73
72
  "kleur": "^4.1.5",
74
- "nanoid": "^5.0.9",
75
- "nodemon": "^3.1.9",
76
73
  "npm-run-all": "^4.1.5",
77
74
  "postcss": "^8.4.24",
78
75
  "postcss-load-config": "^4.0.1",
@@ -129,10 +126,10 @@
129
126
  "./decorators/Divider/Divider.svelte": "./dist/decorators/Divider/Divider.svelte",
130
127
  "./decorators/Em/Em.svelte": "./dist/decorators/Em/Em.svelte",
131
128
  "./globals.d.ts": "./dist/globals.d.ts",
129
+ "./inputs/AccessibleSelect/AccessibleSelect.svelte": "./dist/inputs/AccessibleSelect/AccessibleSelect.svelte",
130
+ "./inputs/AccessibleSelect/options": "./dist/inputs/AccessibleSelect/options.js",
132
131
  "./inputs/Button/Button.svelte": "./dist/inputs/Button/Button.svelte",
133
132
  "./inputs/Button/Icon.svelte": "./dist/inputs/Button/Icon.svelte",
134
- "./inputs/ButtonGroup/ButtonGroup.svelte": "./dist/inputs/ButtonGroup/ButtonGroup.svelte",
135
- "./inputs/ButtonGroup/ButtonGroupItem.svelte": "./dist/inputs/ButtonGroup/ButtonGroupItem.svelte",
136
133
  "./inputs/Checkbox/Checkbox.svelte": "./dist/inputs/Checkbox/Checkbox.svelte",
137
134
  "./inputs/Checkboxes/Checkboxes.svelte": "./dist/inputs/Checkboxes/Checkboxes.svelte",
138
135
  "./inputs/Dropdown/Dropdown.svelte": "./dist/inputs/Dropdown/Dropdown.svelte",
@@ -143,14 +140,6 @@
143
140
  "./inputs/Radios/Radios.svelte": "./dist/inputs/Radios/Radios.svelte",
144
141
  "./inputs/Select/Select.svelte": "./dist/inputs/Select/Select.svelte",
145
142
  "./inputs/Textarea/Textarea.svelte": "./dist/inputs/Textarea/Textarea.svelte",
146
- "./inputs/Toolbar/HelpModal.svelte": "./dist/inputs/Toolbar/HelpModal.svelte",
147
- "./inputs/Toolbar/Icon.svelte": "./dist/inputs/Toolbar/Icon.svelte",
148
- "./inputs/Toolbar/ToolControl.svelte": "./dist/inputs/Toolbar/ToolControl.svelte",
149
- "./inputs/Toolbar/ToolControls.svelte": "./dist/inputs/Toolbar/ToolControls.svelte",
150
- "./inputs/Toolbar/Toolbar.svelte": "./dist/inputs/Toolbar/Toolbar.svelte",
151
- "./inputs/Toolbar/ToolbarButton.svelte": "./dist/inputs/Toolbar/ToolbarButton.svelte",
152
- "./inputs/Toolbar/ToolbarDivider.svelte": "./dist/inputs/Toolbar/ToolbarDivider.svelte",
153
- "./inputs/Toolbar/ToolbarsContainer.svelte": "./dist/inputs/Toolbar/ToolbarsContainer.svelte",
154
143
  "./js/docsPage": "./dist/js/docsPage.js",
155
144
  "./js/utils": "./dist/js/utils.js",
156
145
  "./js/withParams": "./dist/js/withParams.js",
@@ -1,33 +0,0 @@
1
- /** @typedef {typeof __propDef.props} ButtonGroupProps */
2
- /** @typedef {typeof __propDef.events} ButtonGroupEvents */
3
- /** @typedef {typeof __propDef.slots} ButtonGroupSlots */
4
- export default class ButtonGroup extends SvelteComponentTyped<{
5
- value: any;
6
- legend?: string;
7
- name?: string;
8
- visuallyHideLegend?: boolean;
9
- }, {
10
- [evt: string]: CustomEvent<any>;
11
- }, {
12
- default: {};
13
- }> {
14
- }
15
- export type ButtonGroupProps = typeof __propDef.props;
16
- export type ButtonGroupEvents = typeof __propDef.events;
17
- export type ButtonGroupSlots = typeof __propDef.slots;
18
- import { SvelteComponentTyped } from "svelte";
19
- declare const __propDef: {
20
- props: {
21
- value: any;
22
- legend?: string;
23
- name?: string;
24
- visuallyHideLegend?: boolean;
25
- };
26
- events: {
27
- [evt: string]: CustomEvent<any>;
28
- };
29
- slots: {
30
- default: {};
31
- };
32
- };
33
- export {};
@@ -1,25 +0,0 @@
1
- /** @typedef {typeof __propDef.props} ButtonGroupItemProps */
2
- /** @typedef {typeof __propDef.events} ButtonGroupItemEvents */
3
- /** @typedef {typeof __propDef.slots} ButtonGroupItemSlots */
4
- export default class ButtonGroupItem extends SvelteComponentTyped<{
5
- label?: string;
6
- value?: string;
7
- }, {
8
- [evt: string]: CustomEvent<any>;
9
- }, {}> {
10
- }
11
- export type ButtonGroupItemProps = typeof __propDef.props;
12
- export type ButtonGroupItemEvents = typeof __propDef.events;
13
- export type ButtonGroupItemSlots = typeof __propDef.slots;
14
- import { SvelteComponentTyped } from "svelte";
15
- declare const __propDef: {
16
- props: {
17
- label?: string;
18
- value?: string;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {};
24
- };
25
- export {};
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- triggerElement?: HTMLElement | null;
5
- onClose: () => void;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type HelpModalProps = typeof __propDef.props;
15
- export type HelpModalEvents = typeof __propDef.events;
16
- export type HelpModalSlots = typeof __propDef.slots;
17
- export default class HelpModal extends SvelteComponentTyped<HelpModalProps, HelpModalEvents, HelpModalSlots> {
18
- }
19
- export {};
@@ -1,31 +0,0 @@
1
- /** @typedef {typeof __propDef.props} IconProps */
2
- /** @typedef {typeof __propDef.events} IconEvents */
3
- /** @typedef {typeof __propDef.slots} IconSlots */
4
- export default class Icon extends SvelteComponentTyped<{
5
- selected?: boolean;
6
- type?: string;
7
- marginLeft?: boolean;
8
- marginRight?: boolean;
9
- disabled?: boolean;
10
- }, {
11
- [evt: string]: CustomEvent<any>;
12
- }, {}> {
13
- }
14
- export type IconProps = typeof __propDef.props;
15
- export type IconEvents = typeof __propDef.events;
16
- export type IconSlots = typeof __propDef.slots;
17
- import { SvelteComponentTyped } from "svelte";
18
- declare const __propDef: {
19
- props: {
20
- selected?: boolean;
21
- type?: string;
22
- marginLeft?: boolean;
23
- marginRight?: boolean;
24
- disabled?: boolean;
25
- };
26
- events: {
27
- [evt: string]: CustomEvent<any>;
28
- };
29
- slots: {};
30
- };
31
- export {};
@@ -1,27 +0,0 @@
1
- /** @typedef {typeof __propDef.props} ToolControlProps */
2
- /** @typedef {typeof __propDef.events} ToolControlEvents */
3
- /** @typedef {typeof __propDef.slots} ToolControlSlots */
4
- export default class ToolControl extends SvelteComponentTyped<{
5
- id?: string;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
11
- }
12
- export type ToolControlProps = typeof __propDef.props;
13
- export type ToolControlEvents = typeof __propDef.events;
14
- export type ToolControlSlots = typeof __propDef.slots;
15
- import { SvelteComponentTyped } from "svelte";
16
- declare const __propDef: {
17
- props: {
18
- id?: string;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {
24
- default: {};
25
- };
26
- };
27
- export {};
@@ -1,27 +0,0 @@
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 {};
@@ -1,33 +0,0 @@
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
- classes?: string;
6
- ariaLabel?: string;
7
- orientation?: "horizontal" | "vertical";
8
- }, {
9
- [evt: string]: CustomEvent<any>;
10
- }, {
11
- default: {};
12
- controls: {};
13
- }> {
14
- }
15
- export type ToolbarProps = typeof __propDef.props;
16
- export type ToolbarEvents = typeof __propDef.events;
17
- export type ToolbarSlots = typeof __propDef.slots;
18
- import { SvelteComponentTyped } from "svelte";
19
- declare const __propDef: {
20
- props: {
21
- classes?: string;
22
- ariaLabel?: string;
23
- orientation?: 'horizontal' | 'vertical';
24
- };
25
- events: {
26
- [evt: string]: CustomEvent<any>;
27
- };
28
- slots: {
29
- default: {};
30
- controls: {};
31
- };
32
- };
33
- export {};
@@ -1,32 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- id?: string;
5
- icon?: string;
6
- label?: string;
7
- disabled?: boolean;
8
- classes?: string;
9
- helpText?: string | null;
10
- selected?: boolean;
11
- custom?: boolean;
12
- hasAriaControls?: boolean;
13
- sticky?: boolean;
14
- transient?: boolean;
15
- disableHelp?: boolean;
16
- };
17
- events: {
18
- click: CustomEvent<any>;
19
- } & {
20
- [evt: string]: CustomEvent<any>;
21
- };
22
- slots: {
23
- custom: {};
24
- default: {};
25
- };
26
- };
27
- export type ToolbarButtonProps = typeof __propDef.props;
28
- export type ToolbarButtonEvents = typeof __propDef.events;
29
- export type ToolbarButtonSlots = typeof __propDef.slots;
30
- export default class ToolbarButton extends SvelteComponentTyped<ToolbarButtonProps, ToolbarButtonEvents, ToolbarButtonSlots> {
31
- }
32
- export {};
@@ -1,16 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- classes?: string;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {};
10
- };
11
- export type ToolbarDividerProps = typeof __propDef.props;
12
- export type ToolbarDividerEvents = typeof __propDef.events;
13
- export type ToolbarDividerSlots = typeof __propDef.slots;
14
- export default class ToolbarDivider extends SvelteComponentTyped<ToolbarDividerProps, ToolbarDividerEvents, ToolbarDividerSlots> {
15
- }
16
- export {};
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- resetHelp?: () => void;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {
10
- default: {};
11
- };
12
- };
13
- export type ToolbarsContainerProps = typeof __propDef.props;
14
- export type ToolbarsContainerEvents = typeof __propDef.events;
15
- export type ToolbarsContainerSlots = typeof __propDef.slots;
16
- export default class ToolbarsContainer extends SvelteComponentTyped<ToolbarsContainerProps, ToolbarsContainerEvents, ToolbarsContainerSlots> {
17
- get resetHelp(): () => void;
18
- }
19
- export {};
@@ -1,55 +0,0 @@
1
- <script>
2
- import { setContext } from "svelte";
3
- import { writable } from "svelte/store";
4
-
5
- export let name = "";
6
- export let legend = "";
7
- export let value;
8
- export let visuallyHideLegend = false;
9
-
10
- // create the store
11
- const selectedValue = writable(value);
12
-
13
- // Sync the store with the prop on mount and when the prop changes
14
- $: selectedValue.set(value);
15
-
16
- // When store changes and update prop
17
-
18
- $: if ($selectedValue !== value) {
19
- value = $selectedValue;
20
- }
21
-
22
- // Create a context to share with child Button components
23
- setContext("buttonGroup", {
24
- groupName: name,
25
- selectedValue,
26
- });
27
- </script>
28
-
29
- <fieldset class="button-group">
30
- {#if legend}
31
- <legend class:ons-u-vh="{visuallyHideLegend}">{legend}</legend>
32
- {/if}
33
- <div class="buttons">
34
- <slot />
35
- </div>
36
- </fieldset>
37
-
38
- <style>
39
- .button-group {
40
- display: inline-block;
41
- }
42
-
43
- legend {
44
- font-weight: bold;
45
- margin-bottom: 0.5rem;
46
- }
47
-
48
- .buttons {
49
- display: flex;
50
- gap: 8px;
51
- background: #f5f5f6;
52
- padding: 4px;
53
- border-radius: 8px;
54
- justify-content: space-between;
55
- }</style>
@@ -1,103 +0,0 @@
1
- <script>
2
- import { getContext } from "svelte";
3
-
4
- export let value = "";
5
- export let label = "";
6
-
7
- // Get the parent ButtonGroup context
8
- const buttonGroup = getContext("buttonGroup");
9
- const { selectedValue } = buttonGroup;
10
-
11
- // Reactive variable to track selection
12
- let selected = false;
13
-
14
- // Subscribe to selectedValue store
15
- $: selectedValue.subscribe(($selectedValue) => {
16
- selected = $selectedValue === value;
17
- });
18
-
19
- function handleClick() {
20
- selectedValue.set(value); // Update the store
21
- }
22
-
23
- let buttonRef;
24
-
25
- function handleKeydown(event) {
26
- const buttons = Array.from(document.querySelectorAll(`[name="${buttonGroup.groupName}"]`));
27
- const currentIndex = buttons.indexOf(buttonRef);
28
-
29
- let newIndex = -1;
30
-
31
- if (event.key === "ArrowRight" || event.key === "ArrowDown") {
32
- newIndex = (currentIndex + 1) % buttons.length;
33
- } else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
34
- newIndex = (currentIndex - 1 + buttons.length) % buttons.length;
35
- } else if (event.key === "Enter" || event.key === " ") {
36
- handleClick();
37
- return;
38
- }
39
-
40
- if (newIndex !== -1) {
41
- buttons[newIndex].focus();
42
- }
43
- }
44
- </script>
45
-
46
- <div class="button-container">
47
- <input
48
- type="radio"
49
- id="{value}"
50
- name="{buttonGroup.groupName}"
51
- value="{value}"
52
- checked="{selected}"
53
- class="radio-input"
54
- on:click="{handleClick}"
55
- on:keydown="{handleKeydown}"
56
- aria-checked="{selected}"
57
- tabindex="0"
58
- bind:this="{buttonRef}"
59
- />
60
- <label for="{value}" class="button" class:selected="{selected}" on:click="{handleClick}">
61
- {label || value}
62
- </label>
63
- </div>
64
-
65
- <style>
66
- .button-container {
67
- display: flex;
68
- }
69
-
70
- .radio-input {
71
- position: absolute;
72
- opacity: 0;
73
- width: 0;
74
- height: 0;
75
- }
76
-
77
- .button {
78
- flex-grow: 0;
79
- padding: 4px 8px;
80
- border: none;
81
- background: transparent;
82
- font-size: 14px;
83
- cursor: pointer;
84
- border-radius: 6px;
85
- transition: background 0.2s ease, color 0.2s ease;
86
- color: #707071;
87
- text-align: center;
88
- }
89
-
90
- .button:hover {
91
- background-color: #e8e8e8;
92
- }
93
-
94
- .button:focus {
95
- box-shadow: orange 0 0 0 2px;
96
- }
97
-
98
- .button.selected {
99
- background: white;
100
- font-weight: bold;
101
- color: #206095;
102
- box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
103
- }</style>