@sveltia/ui 0.2.4 → 0.2.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.
- package/package/components/composite/checkbox-group.svelte +2 -1
- package/package/components/composite/combobox.svelte +2 -2
- package/package/components/composite/combobox.svelte.d.ts +1 -1
- package/package/components/composite/disclosure.svelte +1 -1
- package/package/components/composite/disclosure.svelte.d.ts +1 -1
- package/package/components/composite/listbox.svelte +2 -2
- package/package/components/composite/listbox.svelte.d.ts +1 -1
- package/package/components/composite/menu.svelte +1 -1
- package/package/components/composite/menu.svelte.d.ts +1 -1
- package/package/components/composite/{radio-button-group.svelte → radio-group.svelte} +9 -8
- package/package/components/composite/radio-group.svelte.d.ts +40 -0
- package/package/components/composite/select-button-group.svelte +2 -2
- package/package/components/composite/select-button-group.svelte.d.ts +2 -2
- package/package/components/composite/tab-list.svelte +2 -2
- package/package/components/composite/tab-list.svelte.d.ts +1 -1
- package/package/components/core/button.svelte +3 -3
- package/package/components/core/button.svelte.d.ts +1 -1
- package/package/components/core/checkbox.svelte +33 -14
- package/package/components/core/checkbox.svelte.d.ts +3 -1
- package/package/components/core/dialog.svelte +1 -1
- package/package/components/core/dialog.svelte.d.ts +1 -1
- package/package/components/core/drawer.svelte +1 -1
- package/package/components/core/drawer.svelte.d.ts +1 -1
- package/package/components/core/menu-button.svelte +1 -1
- package/package/components/core/menu-button.svelte.d.ts +1 -1
- package/package/components/core/number-input.svelte +11 -7
- package/package/components/core/password-input.svelte +1 -1
- package/package/components/core/{radio-button.svelte → radio.svelte} +40 -15
- package/package/components/core/radio.svelte.d.ts +41 -0
- package/package/components/core/select-button.svelte +2 -2
- package/package/components/core/select-button.svelte.d.ts +2 -2
- package/package/components/core/slider.svelte +29 -15
- package/package/components/core/switch.svelte +2 -2
- package/package/components/core/switch.svelte.d.ts +1 -1
- package/package/components/core/tab-panel.svelte +1 -1
- package/package/components/core/tab-panel.svelte.d.ts +1 -1
- package/package/components/core/tab.svelte +1 -1
- package/package/components/core/tab.svelte.d.ts +1 -1
- package/package/components/core/text-area.svelte +1 -1
- package/package/components/core/text-input.svelte +3 -3
- package/package/components/core/toolbar.svelte +1 -1
- package/package/components/core/toolbar.svelte.d.ts +1 -1
- package/package/components/helpers/group.js +3 -1
- package/package/components/helpers/popup.js +10 -1
- package/package/components/util/app-shell.svelte +8 -5
- package/package/index.d.ts +2 -2
- package/package/index.js +2 -2
- package/package/styles/variables.scss +8 -5
- package/package.json +29 -29
- package/package/components/composite/radio-button-group.svelte.d.ts +0 -36
- package/package/components/core/radio-button.svelte.d.ts +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#combobox
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
display: flex;
|
|
163
163
|
align-items: center;
|
|
164
164
|
border-width: 1px;
|
|
165
|
-
border-color: var(--control-border-color);
|
|
165
|
+
border-color: var(--secondary-control-border-color);
|
|
166
166
|
border-radius: 4px;
|
|
167
167
|
padding: 0 32px 0 8px;
|
|
168
168
|
width: 100%;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ComboboxSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#combobox
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
7
7
|
*/
|
|
8
8
|
export default class Combobox extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} DisclosureEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} DisclosureSlots */
|
|
4
4
|
/**
|
|
5
|
-
* @see https://
|
|
5
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
|
|
7
7
|
*/
|
|
8
8
|
export default class Disclosure extends SvelteComponentTyped<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#listbox
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
|
|
5
5
|
-->
|
|
6
6
|
<svelte:options accessors={true} />
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
color: inherit;
|
|
43
43
|
margin: 0;
|
|
44
44
|
border-width: 1px;
|
|
45
|
-
border-color: var(--control-border-color);
|
|
45
|
+
border-color: var(--secondary-control-border-color);
|
|
46
46
|
border-radius: 4px;
|
|
47
47
|
padding: 4px;
|
|
48
48
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ListboxSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#listbox
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
|
|
7
7
|
*/
|
|
8
8
|
export default class Listbox extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} MenuSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#menu
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
|
|
7
7
|
*/
|
|
8
8
|
export default class Menu extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
The container of `<
|
|
3
|
+
The container of `<Radio>`s.
|
|
4
4
|
@see https://w3c.github.io/aria/#radiogroup
|
|
5
|
-
@see https://
|
|
5
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { activateGroup } from '../helpers/group';
|
|
@@ -23,23 +23,24 @@
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<div
|
|
26
|
-
class="sui radio-
|
|
26
|
+
class="sui radio-group {className} {orientation}"
|
|
27
27
|
role="radiogroup"
|
|
28
28
|
tabindex="0"
|
|
29
29
|
bind:this={element}
|
|
30
|
+
on:select
|
|
30
31
|
use:activateGroup
|
|
31
32
|
>
|
|
32
33
|
<slot />
|
|
33
34
|
</div>
|
|
34
35
|
|
|
35
|
-
<style>.radio-
|
|
36
|
+
<style>.radio-group {
|
|
36
37
|
display: inline-flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
gap: 16px;
|
|
39
38
|
}
|
|
40
|
-
.radio-
|
|
39
|
+
.radio-group.horizontal {
|
|
40
|
+
gap: 16px;
|
|
41
41
|
align-items: center;
|
|
42
42
|
}
|
|
43
|
-
.radio-
|
|
43
|
+
.radio-group.vertical {
|
|
44
|
+
gap: 8px;
|
|
44
45
|
flex-direction: column;
|
|
45
46
|
}</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} RadioGroupProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} RadioGroupEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} RadioGroupSlots */
|
|
4
|
+
/**
|
|
5
|
+
* The container of `<Radio>`s.
|
|
6
|
+
* @see https://w3c.github.io/aria/#radiogroup
|
|
7
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
8
|
+
*/
|
|
9
|
+
export default class RadioGroup extends SvelteComponentTyped<{
|
|
10
|
+
class?: string;
|
|
11
|
+
element?: HTMLElement;
|
|
12
|
+
orientation?: "horizontal" | "vertical";
|
|
13
|
+
}, {
|
|
14
|
+
select: Event;
|
|
15
|
+
} & {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {
|
|
18
|
+
default: {};
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export type RadioGroupProps = typeof __propDef.props;
|
|
22
|
+
export type RadioGroupEvents = typeof __propDef.events;
|
|
23
|
+
export type RadioGroupSlots = typeof __propDef.slots;
|
|
24
|
+
import { SvelteComponentTyped } from "svelte";
|
|
25
|
+
declare const __propDef: {
|
|
26
|
+
props: {
|
|
27
|
+
class?: string;
|
|
28
|
+
element?: HTMLElement | null;
|
|
29
|
+
orientation?: ('horizontal' | 'vertical');
|
|
30
|
+
};
|
|
31
|
+
events: {
|
|
32
|
+
select: Event;
|
|
33
|
+
} & {
|
|
34
|
+
[evt: string]: CustomEvent<any>;
|
|
35
|
+
};
|
|
36
|
+
slots: {
|
|
37
|
+
default: {};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
A variant of `<
|
|
3
|
+
A variant of `<RadioGroup>`, looking like normal buttons.
|
|
4
4
|
@see https://w3c.github.io/aria/#radiogroup
|
|
5
|
-
@see https://
|
|
5
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SelectButtonGroupEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SelectButtonGroupSlots */
|
|
4
4
|
/**
|
|
5
|
-
* A variant of `<
|
|
5
|
+
* A variant of `<RadioGroup>`, looking like normal buttons.
|
|
6
6
|
* @see https://w3c.github.io/aria/#radiogroup
|
|
7
|
-
* @see https://
|
|
7
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
8
8
|
*/
|
|
9
9
|
export default class SelectButtonGroup extends SvelteComponentTyped<{
|
|
10
10
|
class?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#tablist
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
5
5
|
-->
|
|
6
6
|
<svelte:options accessors={true} />
|
|
7
7
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<style>.tab-list {
|
|
42
42
|
display: flex;
|
|
43
43
|
align-items: center;
|
|
44
|
-
border-color: var(--control-border-color);
|
|
44
|
+
border-color: var(--secondary-control-border-color);
|
|
45
45
|
}
|
|
46
46
|
.tab-list[aria-orientation=horizontal] {
|
|
47
47
|
gap: 16px;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TabListSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#tablist
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
7
7
|
*/
|
|
8
8
|
export default class TabList extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#button
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
5
5
|
-->
|
|
6
6
|
<svelte:options accessors={true} />
|
|
7
7
|
|
|
@@ -151,7 +151,7 @@ button:global(.primary) :global(.label:only-child), button:global(.secondary) :g
|
|
|
151
151
|
padding: 0 4px;
|
|
152
152
|
}
|
|
153
153
|
button:global(.primary) {
|
|
154
|
-
border-color: var(--control-border-color);
|
|
154
|
+
border-color: var(--secondary-control-border-color);
|
|
155
155
|
color: var(--primary-accent-color-foreground);
|
|
156
156
|
background-color: var(--primary-accent-color);
|
|
157
157
|
}
|
|
@@ -173,7 +173,7 @@ button:global(.secondary)[aria-pressed=true] {
|
|
|
173
173
|
background-color: var(--primary-accent-color);
|
|
174
174
|
}
|
|
175
175
|
button:global(.tertiary) {
|
|
176
|
-
border-color: var(--control-border-color);
|
|
176
|
+
border-color: var(--secondary-control-border-color);
|
|
177
177
|
color: var(--highlight-foreground-color);
|
|
178
178
|
background-color: var(--tertiary-background-color);
|
|
179
179
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ButtonSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#button
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
7
7
|
*/
|
|
8
8
|
export default class Button extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#checkbox
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
/** @type {string} */
|
|
21
21
|
export let name = '';
|
|
22
22
|
|
|
23
|
+
/** @type {string?} */
|
|
24
|
+
export let label = undefined;
|
|
25
|
+
|
|
23
26
|
/** @type {string?} */
|
|
24
27
|
export let value = undefined;
|
|
25
28
|
|
|
@@ -35,7 +38,7 @@
|
|
|
35
38
|
const dispatch = createEventDispatcher();
|
|
36
39
|
const id = getRandomId('checkbox');
|
|
37
40
|
/** @type {Button} */
|
|
38
|
-
let
|
|
41
|
+
let buttonComponent;
|
|
39
42
|
</script>
|
|
40
43
|
|
|
41
44
|
{#if name && value && checked && !indeterminate}
|
|
@@ -43,24 +46,26 @@
|
|
|
43
46
|
{/if}
|
|
44
47
|
|
|
45
48
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
46
|
-
<
|
|
49
|
+
<span
|
|
47
50
|
class="sui checkbox {className}"
|
|
48
51
|
class:checked
|
|
49
52
|
class:indeterminate
|
|
50
53
|
class:disabled
|
|
51
54
|
on:click|preventDefault|stopPropagation={(event) => {
|
|
52
55
|
if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
|
|
53
|
-
|
|
56
|
+
buttonComponent.element.click();
|
|
54
57
|
}
|
|
55
58
|
}}
|
|
56
59
|
>
|
|
57
60
|
<Button
|
|
58
61
|
{id}
|
|
59
62
|
{disabled}
|
|
63
|
+
{name}
|
|
64
|
+
{value}
|
|
60
65
|
role="checkbox"
|
|
61
66
|
aria-checked={indeterminate ? 'mixed' : checked}
|
|
62
67
|
aria-labelledby="{id}-label"
|
|
63
|
-
bind:this={
|
|
68
|
+
bind:this={buttonComponent}
|
|
64
69
|
on:click={(event) => {
|
|
65
70
|
event.preventDefault();
|
|
66
71
|
event.stopPropagation();
|
|
@@ -71,12 +76,16 @@
|
|
|
71
76
|
>
|
|
72
77
|
<Icon slot="start-icon" name={indeterminate ? 'remove' : 'check'} />
|
|
73
78
|
</Button>
|
|
74
|
-
{#if $$slots.default}
|
|
79
|
+
{#if $$slots.default || label}
|
|
75
80
|
<label id="{id}-label">
|
|
76
|
-
|
|
81
|
+
{#if $$slots.default}
|
|
82
|
+
<slot />
|
|
83
|
+
{:else}
|
|
84
|
+
{label}
|
|
85
|
+
{/if}
|
|
77
86
|
</label>
|
|
78
87
|
{/if}
|
|
79
|
-
</
|
|
88
|
+
</span>
|
|
80
89
|
|
|
81
90
|
<style>.checkbox {
|
|
82
91
|
display: inline-flex;
|
|
@@ -90,25 +99,35 @@
|
|
|
90
99
|
.checkbox.disabled {
|
|
91
100
|
cursor: default;
|
|
92
101
|
}
|
|
102
|
+
.checkbox.disabled label {
|
|
103
|
+
color: var(--disabled-foreground-color);
|
|
104
|
+
}
|
|
93
105
|
.checkbox :global(button) {
|
|
94
106
|
align-items: center;
|
|
95
107
|
justify-content: center;
|
|
96
108
|
overflow: hidden;
|
|
97
109
|
border-width: 2px;
|
|
98
|
-
border-color: var(--control-border-color);
|
|
110
|
+
border-color: var(--primary-control-border-color);
|
|
99
111
|
border-radius: 4px;
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
112
|
+
width: 20px;
|
|
113
|
+
height: 20px;
|
|
102
114
|
color: var(--primary-accent-color-lighter);
|
|
103
115
|
transition: all 200ms;
|
|
104
116
|
}
|
|
105
117
|
.checkbox :global(button) :global(.icon) {
|
|
106
|
-
font-size:
|
|
118
|
+
font-size: 20px;
|
|
119
|
+
}
|
|
120
|
+
.checkbox :global(button[aria-checked="true"]) {
|
|
121
|
+
border-color: var(--primary-accent-color-lighter);
|
|
122
|
+
color: var(--control-background-color);
|
|
123
|
+
background-color: var(--primary-accent-color-lighter);
|
|
107
124
|
}
|
|
108
|
-
.checkbox :global(button[aria-checked="true"]),
|
|
109
125
|
.checkbox :global(button[aria-checked="mixed"]) {
|
|
110
|
-
color: var(--primary-
|
|
126
|
+
color: var(--primary-control-border-color);
|
|
111
127
|
}
|
|
112
128
|
.checkbox :global(button[aria-checked="false"]) {
|
|
113
129
|
color: transparent;
|
|
130
|
+
}
|
|
131
|
+
.checkbox label {
|
|
132
|
+
cursor: inherit;
|
|
114
133
|
}</style>
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} CheckboxSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#checkbox
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
|
|
7
7
|
*/
|
|
8
8
|
export default class Checkbox extends SvelteComponentTyped<{
|
|
9
|
+
label?: string;
|
|
9
10
|
class?: string;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
name?: string;
|
|
@@ -26,6 +27,7 @@ export type CheckboxSlots = typeof __propDef.slots;
|
|
|
26
27
|
import { SvelteComponentTyped } from "svelte";
|
|
27
28
|
declare const __propDef: {
|
|
28
29
|
props: {
|
|
30
|
+
label?: string | null;
|
|
29
31
|
class?: string;
|
|
30
32
|
disabled?: boolean;
|
|
31
33
|
name?: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} DialogSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#dialog
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
7
7
|
*/
|
|
8
8
|
export default class Dialog extends SvelteComponentTyped<{
|
|
9
9
|
title?: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} DrawerSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#dialog
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
7
7
|
*/
|
|
8
8
|
export default class Drawer extends SvelteComponentTyped<{
|
|
9
9
|
title?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} MenuButtonProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} MenuButtonEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} MenuButtonSlots */
|
|
4
|
-
/** @see https://
|
|
4
|
+
/** @see https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/ */
|
|
5
5
|
export default class MenuButton extends SvelteComponentTyped<{
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
class?: string;
|
|
@@ -24,28 +24,32 @@
|
|
|
24
24
|
export let max = undefined;
|
|
25
25
|
export let step = 1;
|
|
26
26
|
|
|
27
|
+
$: maximumFractionDigits = String(step).split('.')[1]?.length || 0;
|
|
28
|
+
$: isMin = typeof min === 'number' && Number(value || 0) <= min;
|
|
29
|
+
$: isMax = typeof max === 'number' && Number(value || 0) >= max;
|
|
30
|
+
|
|
27
31
|
let component;
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
34
|
*
|
|
31
35
|
*/
|
|
32
36
|
const decrease = () => {
|
|
33
|
-
if (
|
|
37
|
+
if (isMin) {
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
value =
|
|
41
|
+
value = Number(Number(value || 0) - step).toFixed(maximumFractionDigits);
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
*
|
|
42
46
|
*/
|
|
43
47
|
const increase = () => {
|
|
44
|
-
if (
|
|
48
|
+
if (isMax) {
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
value =
|
|
52
|
+
value = Number(Number(value || 0) + step).toFixed(maximumFractionDigits);
|
|
49
53
|
};
|
|
50
54
|
</script>
|
|
51
55
|
|
|
@@ -76,7 +80,7 @@
|
|
|
76
80
|
/>
|
|
77
81
|
<Button
|
|
78
82
|
class="iconic"
|
|
79
|
-
disabled={disabled || Number.isNaN(Number(value))}
|
|
83
|
+
disabled={disabled || Number.isNaN(Number(value)) || isMin}
|
|
80
84
|
on:click={() => {
|
|
81
85
|
decrease();
|
|
82
86
|
}}
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
</Button>
|
|
86
90
|
<Button
|
|
87
91
|
class="iconic"
|
|
88
|
-
disabled={disabled || Number.isNaN(Number(value))}
|
|
92
|
+
disabled={disabled || Number.isNaN(Number(value)) || isMax}
|
|
89
93
|
on:click={() => {
|
|
90
94
|
increase();
|
|
91
95
|
}}
|
|
@@ -106,7 +110,7 @@
|
|
|
106
110
|
flex: none;
|
|
107
111
|
margin-left: -1px;
|
|
108
112
|
border-width: 1px;
|
|
109
|
-
border-color: var(--control-border-color);
|
|
113
|
+
border-color: var(--secondary-control-border-color);
|
|
110
114
|
width: 32px;
|
|
111
115
|
height: var(--input--medium--height);
|
|
112
116
|
}
|