@winkintel/bootstrap-svelte 1.0.5 → 1.0.6
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 +1 -1
- package/dist/Alert/alert.svelte +4 -2
- package/dist/Badge/badge.svelte +6 -4
- package/dist/Badge/badge.svelte.d.ts +2 -2
- package/dist/Badge/types.d.ts +2 -1
- package/dist/Badge/types.js +3 -11
- package/dist/Button/button.svelte +29 -9
- package/dist/ButtonGroup/button-group.svelte +3 -2
- package/dist/ButtonGroup/button-toolbar.svelte +3 -2
- package/dist/ButtonGroup/types.contract.d.ts +1 -0
- package/dist/ButtonGroup/types.contract.js +15 -0
- package/dist/ButtonGroup/types.d.ts +2 -2
- package/dist/Carousel/carousel-indicator-button.svelte +8 -1
- package/dist/Carousel/carousel-item.svelte +29 -9
- package/dist/Carousel/carousel.svelte +12 -5
- package/dist/Carousel/carousel.svelte.js +200 -42
- package/dist/Col/col.svelte +30 -22
- package/dist/Collapse/collapse.svelte +3 -3
- package/dist/Collapse/transition.js +78 -15
- package/dist/Collapse/types.d.ts +1 -0
- package/dist/Dropdown/dropdown-item.svelte +7 -0
- package/dist/Dropdown/dropdown.svelte.js +66 -19
- package/dist/Form/form-check-input.svelte +6 -6
- package/dist/Form/form-color-input.svelte +8 -3
- package/dist/Form/form-date-input.svelte +4 -4
- package/dist/Form/form-datetime-local-input.svelte +4 -4
- package/dist/Form/form-email-input.svelte +4 -4
- package/dist/Form/form-file-input.svelte +46 -6
- package/dist/Form/form-file-input.svelte.d.ts +3 -2
- package/dist/Form/form-hidden-input.svelte +1 -1
- package/dist/Form/form-hidden-input.svelte.d.ts +1 -1
- package/dist/Form/form-image-input.svelte +1 -1
- package/dist/Form/form-image-input.svelte.d.ts +2 -1
- package/dist/Form/form-month-input.svelte +4 -4
- package/dist/Form/form-number-input.svelte +4 -4
- package/dist/Form/form-password-input.svelte +4 -4
- package/dist/Form/form-radio-input.svelte +53 -3
- package/dist/Form/form-radio-input.svelte.d.ts +3 -2
- package/dist/Form/form-range-input.svelte +1 -1
- package/dist/Form/form-range-input.svelte.d.ts +2 -1
- package/dist/Form/form-search-input.svelte +4 -4
- package/dist/Form/form-select.svelte +7 -7
- package/dist/Form/form-switch-input.svelte +4 -4
- package/dist/Form/form-telephone-input.svelte +4 -4
- package/dist/Form/form-text-area.svelte +4 -4
- package/dist/Form/form-text-input.svelte +4 -4
- package/dist/Form/form-time-input.svelte +4 -4
- package/dist/Form/form-url-input.svelte +4 -4
- package/dist/Form/form-week-Input.svelte +4 -4
- package/dist/Form/types.d.ts +26 -20
- package/dist/ListGroup/list-group-item-action.svelte +14 -7
- package/dist/Modal/modal.svelte +86 -26
- package/dist/Modal/modal.svelte.js +15 -0
- package/dist/Nav/nav-link.svelte +12 -8
- package/dist/Navbar/navbar-collapse.svelte +18 -7
- package/dist/Navbar/navbar-collapse.svelte.d.ts +1 -1
- package/dist/Navbar/navbar-nav.svelte +1 -1
- package/dist/Navbar/navbar-toggler.svelte +9 -7
- package/dist/Navbar/navbar-toggler.svelte.d.ts +1 -1
- package/dist/Navbar/types.d.ts +3 -2
- package/dist/Offcanvas/offcanvas.svelte +38 -7
- package/dist/Pagination/pagination-item.svelte +27 -20
- package/dist/Pagination/pagination-link.svelte +20 -5
- package/dist/Pagination/pagination.svelte.js +28 -8
- package/dist/Placeholder/placeholder-item.svelte +7 -2
- package/dist/Placeholder/placeholder-item.svelte.d.ts +1 -1
- package/dist/Placeholder/types.d.ts +1 -0
- package/dist/Portal/portal.svelte +6 -1
- package/dist/Progress/progress-bar.svelte +22 -9
- package/dist/Row/row.svelte +9 -10
- package/dist/Row/types.d.ts +8 -7
- package/dist/Scrollspy/scrollspy-attachment.svelte.js +47 -28
- package/dist/Tooltip/tooltip.svelte +57 -10
- package/dist/common/css.js +96 -24
- package/dist/common/navbar-offcanvas.svelte.d.ts +2 -0
- package/dist/common/navbar-offcanvas.svelte.js +5 -4
- package/dist/common/overlay-stack.d.ts +13 -0
- package/dist/common/overlay-stack.js +49 -0
- package/dist/common/scrollbar.js +24 -8
- package/package.json +1 -1
|
@@ -32,16 +32,66 @@ Bootstrap-styled radio input component for single selection options.
|
|
|
32
32
|
### Props
|
|
33
33
|
- `class` (string): Optional. Additional CSS classes to apply to the radio.
|
|
34
34
|
- `elementRef` (HTMLInputElement): Optional. Reference to the radio DOM element.
|
|
35
|
-
- `
|
|
35
|
+
- `checked` (boolean): Optional. Controls checked state once it is boolean; undefined is uncontrolled.
|
|
36
|
+
- `group` (string): Optional. Binds this radio's selected value; it may initially be undefined.
|
|
36
37
|
- `isInvalid` (boolean): Optional. Indicates whether the input is invalid. If undefined, no validation styles are applied.
|
|
37
38
|
- `isValid` (boolean): Optional. Indicates whether the input is valid. If undefined, no validation styles are applied.
|
|
38
39
|
-->
|
|
39
40
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
40
|
-
|
|
41
|
+
import { noop } from '../common/noop.js';
|
|
42
|
+
let { 'aria-invalid': ariaInvalid, checked = $bindable(undefined), class: classValues, elementRef = $bindable(null), group = $bindable(undefined), isInvalid, isValid, onchange = noop, value = 'on', ...restOfProps } = $props();
|
|
43
|
+
let controlsChecked = $derived(checked !== undefined);
|
|
44
|
+
const unset = Symbol('unset');
|
|
45
|
+
const controlledSnapshot = { checked: unset, group: unset };
|
|
41
46
|
let classes = $derived(uniqueClsx('form-check-input', {
|
|
42
47
|
'is-valid': isValid,
|
|
43
48
|
'is-invalid': isInvalid
|
|
44
49
|
}, classValues));
|
|
50
|
+
$effect(() => {
|
|
51
|
+
const currentChecked = checked;
|
|
52
|
+
const currentGroup = group;
|
|
53
|
+
if (!controlsChecked) {
|
|
54
|
+
controlledSnapshot.checked = unset;
|
|
55
|
+
controlledSnapshot.group = unset;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const isInitialSync = controlledSnapshot.checked === unset;
|
|
59
|
+
const checkedChanged = !isInitialSync && controlledSnapshot.checked !== currentChecked;
|
|
60
|
+
const groupChanged = !isInitialSync && controlledSnapshot.group !== currentGroup;
|
|
61
|
+
controlledSnapshot.checked = currentChecked;
|
|
62
|
+
controlledSnapshot.group = currentGroup;
|
|
63
|
+
// `checked` establishes the initial selection and drives later explicit
|
|
64
|
+
// checked updates. Group updates are authoritative otherwise so sibling
|
|
65
|
+
// radios and parent assignments can clear this radio without ping-ponging.
|
|
66
|
+
if (isInitialSync || (checkedChanged && !groupChanged)) {
|
|
67
|
+
const nextGroup = currentChecked ? value : currentGroup === value ? undefined : currentGroup;
|
|
68
|
+
if (currentGroup !== nextGroup) {
|
|
69
|
+
group = nextGroup;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (groupChanged) {
|
|
73
|
+
const nextChecked = currentGroup === value;
|
|
74
|
+
if (currentChecked !== nextChecked) {
|
|
75
|
+
checked = nextChecked;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const handleChange = (event) => {
|
|
80
|
+
if (controlsChecked) {
|
|
81
|
+
checked = event.currentTarget.checked;
|
|
82
|
+
}
|
|
83
|
+
onchange?.(event);
|
|
84
|
+
};
|
|
45
85
|
</script>
|
|
46
86
|
|
|
47
|
-
|
|
87
|
+
<!-- svelte-ignore a11y_role_supports_aria_props_implicit -->
|
|
88
|
+
<input
|
|
89
|
+
{...restOfProps}
|
|
90
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
91
|
+
bind:this={elementRef}
|
|
92
|
+
bind:group
|
|
93
|
+
checked={controlsChecked ? checked : undefined}
|
|
94
|
+
class={classes}
|
|
95
|
+
onchange={handleChange}
|
|
96
|
+
{value}
|
|
97
|
+
type="radio" />
|
|
@@ -32,10 +32,11 @@ import type { Form } from './index.js';
|
|
|
32
32
|
* ### Props
|
|
33
33
|
* - `class` (string): Optional. Additional CSS classes to apply to the radio.
|
|
34
34
|
* - `elementRef` (HTMLInputElement): Optional. Reference to the radio DOM element.
|
|
35
|
-
* - `
|
|
35
|
+
* - `checked` (boolean): Optional. Controls checked state once it is boolean; undefined is uncontrolled.
|
|
36
|
+
* - `group` (string): Optional. Binds this radio's selected value; it may initially be undefined.
|
|
36
37
|
* - `isInvalid` (boolean): Optional. Indicates whether the input is invalid. If undefined, no validation styles are applied.
|
|
37
38
|
* - `isValid` (boolean): Optional. Indicates whether the input is valid. If undefined, no validation styles are applied.
|
|
38
39
|
*/
|
|
39
|
-
declare const FormRadioInput: import("svelte").Component<Form.RadioInputProps, {}, "elementRef" | "group">;
|
|
40
|
+
declare const FormRadioInput: import("svelte").Component<Form.RadioInputProps, {}, "elementRef" | "group" | "checked">;
|
|
40
41
|
type FormRadioInput = ReturnType<typeof FormRadioInput>;
|
|
41
42
|
export default FormRadioInput;
|
|
@@ -40,4 +40,4 @@ let { class: classValues, elementRef = $bindable(null), value = $bindable(undefi
|
|
|
40
40
|
let classes = $derived(uniqueClsx('form-range', classValues));
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
|
-
<input bind:this={elementRef} bind:value class={classes} type="range"
|
|
43
|
+
<input {...restOfProps} bind:this={elementRef} bind:value class={classes} type="range" />
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Form } from './index.js';
|
|
1
2
|
/**
|
|
2
3
|
* ## Form.RangeInput
|
|
3
4
|
* Bootstrap-styled range slider input component for selecting a value within a range.
|
|
@@ -34,6 +35,6 @@
|
|
|
34
35
|
* - `elementRef` (HTMLInputElement): Optional. Reference to the input DOM element.
|
|
35
36
|
* - `value` (number): Optional. The numeric value of the input. If undefined, the input is empty.
|
|
36
37
|
*/
|
|
37
|
-
declare const FormRangeInput: import("svelte").Component<
|
|
38
|
+
declare const FormRangeInput: import("svelte").Component<Form.RangeInputProps, {}, "value" | "elementRef">;
|
|
38
39
|
type FormRangeInput = ReturnType<typeof FormRangeInput>;
|
|
39
40
|
export default FormRangeInput;
|
|
@@ -41,7 +41,7 @@ Bootstrap-styled search input component with search-specific features.
|
|
|
41
41
|
- `value` (string): Optional. The search value. If undefined, the input is empty.
|
|
42
42
|
-->
|
|
43
43
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
44
|
-
let { autocomplete = 'off', class: classValues, 'data-form-type': dataFormType = 'search', 'data-lpignore': dataLpignore = undefined, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
44
|
+
let { 'aria-invalid': ariaInvalid, autocomplete = 'off', class: classValues, 'data-form-type': dataFormType = 'search', 'data-lpignore': dataLpignore = undefined, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
45
45
|
let classes = $derived(uniqueClsx({
|
|
46
46
|
'form-control': !isPlaintext,
|
|
47
47
|
'form-control-plaintext': isPlaintext,
|
|
@@ -52,12 +52,12 @@ let classes = $derived(uniqueClsx({
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<input
|
|
55
|
-
|
|
55
|
+
{...restOfProps}
|
|
56
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
56
57
|
{autocomplete}
|
|
57
58
|
bind:this={elementRef}
|
|
58
59
|
bind:value
|
|
59
60
|
class={classes}
|
|
60
61
|
data-form-type={autocomplete == 'off' ? 'other' : dataFormType}
|
|
61
62
|
data-lpignore={autocomplete == 'off' ? 'true' : dataLpignore}
|
|
62
|
-
type="search"
|
|
63
|
-
{...restOfProps} />
|
|
63
|
+
type="search" />
|
|
@@ -55,7 +55,7 @@ Bootstrap-styled select input component for dropdown selection.
|
|
|
55
55
|
- `value` (string): Optional. The selected value of the select. If undefined, the select is empty.
|
|
56
56
|
-->
|
|
57
57
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
58
|
-
let { children, class: classValues, elementRef = $bindable(null), isInvalid, isValid, multiple, sizing, value = $bindable(multiple ? [] : undefined), ...restOfProps } = $props();
|
|
58
|
+
let { 'aria-invalid': ariaInvalid, children, class: classValues, elementRef = $bindable(null), isInvalid, isValid, multiple, sizing, value = $bindable(multiple ? [] : undefined), ...restOfProps } = $props();
|
|
59
59
|
let classes = $derived(uniqueClsx('form-select', {
|
|
60
60
|
[`form-select-${sizing}`]: !!sizing,
|
|
61
61
|
'is-valid': isValid,
|
|
@@ -65,21 +65,21 @@ let classes = $derived(uniqueClsx('form-select', {
|
|
|
65
65
|
|
|
66
66
|
{#if multiple}
|
|
67
67
|
<select
|
|
68
|
-
|
|
68
|
+
{...restOfProps}
|
|
69
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
69
70
|
bind:this={elementRef}
|
|
70
71
|
bind:value
|
|
71
72
|
class={classes}
|
|
72
|
-
multiple
|
|
73
|
-
{...restOfProps}>
|
|
73
|
+
multiple>
|
|
74
74
|
{@render children?.()}
|
|
75
75
|
</select>
|
|
76
76
|
{:else}
|
|
77
77
|
<select
|
|
78
|
-
|
|
78
|
+
{...restOfProps}
|
|
79
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
79
80
|
bind:this={elementRef}
|
|
80
81
|
bind:value
|
|
81
|
-
class={classes}
|
|
82
|
-
{...restOfProps}>
|
|
82
|
+
class={classes}>
|
|
83
83
|
{@render children?.()}
|
|
84
84
|
</select>
|
|
85
85
|
{/if}
|
|
@@ -37,7 +37,7 @@ Bootstrap-styled switch input component for toggling between two states.
|
|
|
37
37
|
- `isValid` (boolean): Optional. Indicates whether the input is valid. If undefined, no validation styles are applied.
|
|
38
38
|
-->
|
|
39
39
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
40
|
-
let { checked = $bindable(undefined), class: classValues, elementRef = $bindable(null), isInvalid, isValid, ...restOfProps } = $props();
|
|
40
|
+
let { 'aria-invalid': ariaInvalid, checked = $bindable(undefined), class: classValues, elementRef = $bindable(null), isInvalid, isValid, ...restOfProps } = $props();
|
|
41
41
|
let classes = $derived(uniqueClsx('form-check-input', {
|
|
42
42
|
'is-valid': isValid,
|
|
43
43
|
'is-invalid': isInvalid
|
|
@@ -45,10 +45,10 @@ let classes = $derived(uniqueClsx('form-check-input', {
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<input
|
|
48
|
-
|
|
48
|
+
{...restOfProps}
|
|
49
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
49
50
|
bind:this={elementRef}
|
|
50
51
|
bind:checked
|
|
51
52
|
class={classes}
|
|
52
53
|
role="switch"
|
|
53
|
-
type="checkbox"
|
|
54
|
-
{...restOfProps} />
|
|
54
|
+
type="checkbox" />
|
|
@@ -52,7 +52,7 @@ Bootstrap-styled telephone input component for entering phone numbers.
|
|
|
52
52
|
-->
|
|
53
53
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
54
54
|
import { noop } from '../common/index.js';
|
|
55
|
-
let { class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, mask, oninput = noop, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
55
|
+
let { 'aria-invalid': ariaInvalid, class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, mask, oninput = noop, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
56
56
|
let classes = $derived(uniqueClsx({
|
|
57
57
|
'form-control': !isPlaintext,
|
|
58
58
|
'form-control-plaintext': isPlaintext,
|
|
@@ -120,10 +120,10 @@ const handleInput = (event) => {
|
|
|
120
120
|
</script>
|
|
121
121
|
|
|
122
122
|
<input
|
|
123
|
-
|
|
123
|
+
{...restOfProps}
|
|
124
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
124
125
|
bind:this={elementRef}
|
|
125
126
|
bind:value
|
|
126
127
|
class={classes}
|
|
127
128
|
oninput={handleInput}
|
|
128
|
-
type="tel"
|
|
129
|
-
{...restOfProps} />
|
|
129
|
+
type="tel" />
|
|
@@ -34,7 +34,7 @@ Bootstrap-styled textarea component for multi-line text input.
|
|
|
34
34
|
- `value` (string): Optional. The text value of the textarea. If undefined, the textarea is empty.
|
|
35
35
|
-->
|
|
36
36
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
37
|
-
let { class: classValues, elementRef = $bindable(null), isInvalid, isResizable = true, isValid, sizing, style, value = $bindable(undefined), ...restOfProps } = $props();
|
|
37
|
+
let { 'aria-invalid': ariaInvalid, class: classValues, elementRef = $bindable(null), isInvalid, isResizable = true, isValid, sizing, style, value = $bindable(undefined), ...restOfProps } = $props();
|
|
38
38
|
let classes = $derived(uniqueClsx('form-control', {
|
|
39
39
|
[`form-control-${sizing}`]: !!sizing,
|
|
40
40
|
'is-valid': isValid,
|
|
@@ -49,9 +49,9 @@ let styles = $derived.by(() => {
|
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<textarea
|
|
52
|
-
|
|
52
|
+
{...restOfProps}
|
|
53
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
53
54
|
bind:this={elementRef}
|
|
54
55
|
bind:value
|
|
55
56
|
class={classes}
|
|
56
|
-
style={styles}
|
|
57
|
-
{...restOfProps}></textarea>
|
|
57
|
+
style={styles}></textarea>
|
|
@@ -33,7 +33,7 @@ Input field component for standard text values with Bootstrap styling.
|
|
|
33
33
|
- `value` (string): Optional. The text value of the input. If undefined, the input is empty.
|
|
34
34
|
-->
|
|
35
35
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
36
|
-
let { autocomplete = 'off', class: classValues, 'data-form-type': dataFormType = undefined, 'data-lpignore': dataLpignore = undefined, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
36
|
+
let { 'aria-invalid': ariaInvalid, autocomplete = 'off', class: classValues, 'data-form-type': dataFormType = undefined, 'data-lpignore': dataLpignore = undefined, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
37
37
|
let classes = $derived(uniqueClsx({
|
|
38
38
|
'form-control': !isPlaintext,
|
|
39
39
|
'form-control-plaintext': isPlaintext,
|
|
@@ -44,12 +44,12 @@ let classes = $derived(uniqueClsx({
|
|
|
44
44
|
</script>
|
|
45
45
|
|
|
46
46
|
<input
|
|
47
|
-
|
|
47
|
+
{...restOfProps}
|
|
48
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
48
49
|
{autocomplete}
|
|
49
50
|
bind:this={elementRef}
|
|
50
51
|
bind:value
|
|
51
52
|
class={classes}
|
|
52
53
|
data-form-type={autocomplete == 'off' ? 'other' : dataFormType}
|
|
53
54
|
data-lpignore={autocomplete == 'off' ? 'true' : dataLpignore}
|
|
54
|
-
type="text"
|
|
55
|
-
{...restOfProps} />
|
|
55
|
+
type="text" />
|
|
@@ -43,7 +43,7 @@ Bootstrap-styled time input component for selecting a specific time.
|
|
|
43
43
|
- `value` (string): Optional. The time value in the format "HH:MM". If undefined, the input is empty.
|
|
44
44
|
-->
|
|
45
45
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
46
|
-
let { class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
46
|
+
let { 'aria-invalid': ariaInvalid, class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
47
47
|
let classes = $derived(uniqueClsx({
|
|
48
48
|
'form-control': !isPlaintext,
|
|
49
49
|
'form-control-plaintext': isPlaintext,
|
|
@@ -54,9 +54,9 @@ let classes = $derived(uniqueClsx({
|
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
56
|
<input
|
|
57
|
-
|
|
57
|
+
{...restOfProps}
|
|
58
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
58
59
|
bind:this={elementRef}
|
|
59
60
|
bind:value
|
|
60
61
|
class={classes}
|
|
61
|
-
type="time"
|
|
62
|
-
{...restOfProps} />
|
|
62
|
+
type="time" />
|
|
@@ -41,7 +41,7 @@ Bootstrap-styled URL input component for entering website addresses.
|
|
|
41
41
|
- `value` (string): Optional. The URL value. If undefined, the input is empty.
|
|
42
42
|
-->
|
|
43
43
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
44
|
-
let { class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
44
|
+
let { 'aria-invalid': ariaInvalid, class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
45
45
|
let classes = $derived(uniqueClsx({
|
|
46
46
|
'form-control': !isPlaintext,
|
|
47
47
|
'form-control-plaintext': isPlaintext,
|
|
@@ -52,9 +52,9 @@ let classes = $derived(uniqueClsx({
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<input
|
|
55
|
-
|
|
55
|
+
{...restOfProps}
|
|
56
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
56
57
|
bind:this={elementRef}
|
|
57
58
|
bind:value
|
|
58
59
|
class={classes}
|
|
59
|
-
type="url"
|
|
60
|
-
{...restOfProps} />
|
|
60
|
+
type="url" />
|
|
@@ -43,7 +43,7 @@ Bootstrap-styled week input component for selecting a specific week of a year.
|
|
|
43
43
|
- `value` (string): Optional. The week value in the format "YYYY-Www". If undefined, the input is empty.
|
|
44
44
|
-->
|
|
45
45
|
<script lang="ts">import { uniqueClsx } from '../common/css.js';
|
|
46
|
-
let { class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
46
|
+
let { 'aria-invalid': ariaInvalid, class: classValues, elementRef = $bindable(null), isInvalid, isPlaintext = false, isValid, sizing, value = $bindable(undefined), ...restOfProps } = $props();
|
|
47
47
|
let classes = $derived(uniqueClsx({
|
|
48
48
|
'form-control': !isPlaintext,
|
|
49
49
|
'form-control-plaintext': isPlaintext,
|
|
@@ -54,9 +54,9 @@ let classes = $derived(uniqueClsx({
|
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
56
|
<input
|
|
57
|
-
|
|
57
|
+
{...restOfProps}
|
|
58
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : ariaInvalid}
|
|
58
59
|
bind:this={elementRef}
|
|
59
60
|
bind:value
|
|
60
61
|
class={classes}
|
|
61
|
-
type="week"
|
|
62
|
-
{...restOfProps} />
|
|
62
|
+
type="week" />
|
package/dist/Form/types.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { enhance } from '$app/forms';
|
|
2
2
|
import type { DivElement, FormControlSize, FormElement, FormInputGroupSize, InputElement, LabelElement, SelectElement, SpanElement, TextAreaElement } from '../common/types.js';
|
|
3
|
-
|
|
3
|
+
type FixedInputType<Type extends string> = {
|
|
4
|
+
/** The matching literal remains accepted; mismatched input types are rejected because specialized inputs own this attribute. */
|
|
5
|
+
type?: Type;
|
|
6
|
+
};
|
|
7
|
+
export type FormCheckInputProps = Omit<InputElement, 'type'> & FixedInputType<'checkbox'> & {
|
|
4
8
|
isIndeterminate?: boolean;
|
|
5
9
|
isInvalid?: boolean;
|
|
6
10
|
isValid?: boolean;
|
|
@@ -12,24 +16,24 @@ export type FormCheckProps = DivElement & {
|
|
|
12
16
|
isInline?: boolean;
|
|
13
17
|
isSwitch?: boolean;
|
|
14
18
|
};
|
|
15
|
-
export type FormColorInputProps = InputElement & {
|
|
19
|
+
export type FormColorInputProps = Omit<InputElement, 'type'> & FixedInputType<'color'> & {
|
|
16
20
|
isInvalid?: boolean;
|
|
17
21
|
isValid?: boolean;
|
|
18
22
|
sizing?: FormControlSize;
|
|
19
23
|
};
|
|
20
|
-
export type FormDateInputProps = InputElement & {
|
|
24
|
+
export type FormDateInputProps = Omit<InputElement, 'type'> & FixedInputType<'date'> & {
|
|
21
25
|
isInvalid?: boolean;
|
|
22
26
|
isPlaintext?: boolean;
|
|
23
27
|
isValid?: boolean;
|
|
24
28
|
sizing?: FormControlSize;
|
|
25
29
|
};
|
|
26
|
-
export type FormDatetimeLocalInputProps = InputElement & {
|
|
30
|
+
export type FormDatetimeLocalInputProps = Omit<InputElement, 'type'> & FixedInputType<'datetime-local'> & {
|
|
27
31
|
isInvalid?: boolean;
|
|
28
32
|
isPlaintext?: boolean;
|
|
29
33
|
isValid?: boolean;
|
|
30
34
|
sizing?: FormControlSize;
|
|
31
35
|
};
|
|
32
|
-
export type FormEmailInputProps = InputElement & {
|
|
36
|
+
export type FormEmailInputProps = Omit<InputElement, 'type'> & FixedInputType<'email'> & {
|
|
33
37
|
'data-form-type'?: string;
|
|
34
38
|
'data-lpignore'?: string;
|
|
35
39
|
isInvalid?: boolean;
|
|
@@ -42,15 +46,16 @@ export type FormFeedbackProps = DivElement & {
|
|
|
42
46
|
isTooltip?: boolean;
|
|
43
47
|
isValid?: boolean;
|
|
44
48
|
};
|
|
45
|
-
export type FormFileInputProps = InputElement & {
|
|
49
|
+
export type FormFileInputProps = Omit<InputElement, 'files' | 'type'> & FixedInputType<'file'> & {
|
|
50
|
+
files?: FileList | null;
|
|
46
51
|
isInvalid?: boolean;
|
|
47
52
|
isValid?: boolean;
|
|
48
53
|
sizing?: FormControlSize;
|
|
49
54
|
};
|
|
50
55
|
export type FormFloatingProps = DivElement;
|
|
51
56
|
export type FormHelperTextProps = DivElement;
|
|
52
|
-
export type FormHiddenInputProps = InputElement
|
|
53
|
-
export type FormImageInputProps = InputElement
|
|
57
|
+
export type FormHiddenInputProps = Omit<InputElement, 'type'> & FixedInputType<'hidden'>;
|
|
58
|
+
export type FormImageInputProps = Omit<InputElement, 'type'> & FixedInputType<'image'>;
|
|
54
59
|
export type FormInputGroupProps = DivElement & {
|
|
55
60
|
hasValidation?: boolean;
|
|
56
61
|
noWrap?: boolean;
|
|
@@ -62,19 +67,19 @@ export type FormInputGroupTextProps = (SpanElement | LabelElement) & {
|
|
|
62
67
|
export type FormInputLabelProps = LabelElement & {
|
|
63
68
|
isFloating?: boolean;
|
|
64
69
|
};
|
|
65
|
-
export type FormMonthInputProps = InputElement & {
|
|
70
|
+
export type FormMonthInputProps = Omit<InputElement, 'type'> & FixedInputType<'month'> & {
|
|
66
71
|
isInvalid?: boolean;
|
|
67
72
|
isPlaintext?: boolean;
|
|
68
73
|
isValid?: boolean;
|
|
69
74
|
sizing?: FormControlSize;
|
|
70
75
|
};
|
|
71
|
-
export type FormNumberInputProps = InputElement & {
|
|
76
|
+
export type FormNumberInputProps = Omit<InputElement, 'type'> & FixedInputType<'number'> & {
|
|
72
77
|
isInvalid?: boolean;
|
|
73
78
|
isPlaintext?: boolean;
|
|
74
79
|
isValid?: boolean;
|
|
75
80
|
sizing?: FormControlSize;
|
|
76
81
|
};
|
|
77
|
-
export type FormPasswordInputProps = InputElement & {
|
|
82
|
+
export type FormPasswordInputProps = Omit<InputElement, 'type'> & FixedInputType<'password'> & {
|
|
78
83
|
autocomplete?: 'current-password' | 'new-password' | 'off' | 'on';
|
|
79
84
|
'data-form-type'?: string;
|
|
80
85
|
'data-lpignore'?: string;
|
|
@@ -84,18 +89,18 @@ export type FormPasswordInputProps = InputElement & {
|
|
|
84
89
|
sizing?: FormControlSize;
|
|
85
90
|
showPassword?: boolean;
|
|
86
91
|
};
|
|
87
|
-
export type FormRadioInputProps = InputElement & {
|
|
92
|
+
export type FormRadioInputProps = Omit<InputElement, 'type'> & FixedInputType<'radio'> & {
|
|
88
93
|
isInvalid?: boolean;
|
|
89
94
|
isValid?: boolean;
|
|
90
95
|
};
|
|
91
|
-
export type FormRangeInputProps = InputElement
|
|
96
|
+
export type FormRangeInputProps = Omit<InputElement, 'type'> & FixedInputType<'range'>;
|
|
92
97
|
export type FormRadioLabelProps = LabelElement;
|
|
93
98
|
export type FormRootProps = FormElement & {
|
|
94
99
|
enhance?: typeof enhance | ((el: HTMLFormElement, events?: any) => ReturnType<typeof enhance>);
|
|
95
100
|
needsValidation?: boolean;
|
|
96
101
|
wasValidated?: boolean;
|
|
97
102
|
};
|
|
98
|
-
export type FormSearchInputProps = InputElement & {
|
|
103
|
+
export type FormSearchInputProps = Omit<InputElement, 'type'> & FixedInputType<'search'> & {
|
|
99
104
|
'data-form-type'?: string;
|
|
100
105
|
'data-lpignore'?: string;
|
|
101
106
|
isInvalid?: boolean;
|
|
@@ -108,12 +113,12 @@ export type FormSelectProps = SelectElement & {
|
|
|
108
113
|
isValid?: boolean;
|
|
109
114
|
sizing?: FormControlSize;
|
|
110
115
|
};
|
|
111
|
-
export type FormSwitchInputProps = InputElement & {
|
|
116
|
+
export type FormSwitchInputProps = Omit<InputElement, 'type'> & FixedInputType<'checkbox'> & {
|
|
112
117
|
isInvalid?: boolean;
|
|
113
118
|
isValid?: boolean;
|
|
114
119
|
};
|
|
115
120
|
export type FormSwitchLabelProps = LabelElement;
|
|
116
|
-
export type FormTelephoneInputProps = InputElement & {
|
|
121
|
+
export type FormTelephoneInputProps = Omit<InputElement, 'type'> & FixedInputType<'tel'> & {
|
|
117
122
|
isInvalid?: boolean;
|
|
118
123
|
isPlaintext?: boolean;
|
|
119
124
|
isValid?: boolean;
|
|
@@ -140,7 +145,7 @@ export type FormTextAreaProps = TextAreaElement & {
|
|
|
140
145
|
isValid?: boolean;
|
|
141
146
|
sizing?: FormControlSize;
|
|
142
147
|
};
|
|
143
|
-
export type FormTextInputProps = InputElement & {
|
|
148
|
+
export type FormTextInputProps = Omit<InputElement, 'type'> & FixedInputType<'text'> & {
|
|
144
149
|
'data-form-type'?: string;
|
|
145
150
|
'data-lpignore'?: string;
|
|
146
151
|
isInvalid?: boolean;
|
|
@@ -148,21 +153,22 @@ export type FormTextInputProps = InputElement & {
|
|
|
148
153
|
isValid?: boolean;
|
|
149
154
|
sizing?: FormControlSize;
|
|
150
155
|
};
|
|
151
|
-
export type FormTimeInputProps = InputElement & {
|
|
156
|
+
export type FormTimeInputProps = Omit<InputElement, 'type'> & FixedInputType<'time'> & {
|
|
152
157
|
isInvalid?: boolean;
|
|
153
158
|
isPlaintext?: boolean;
|
|
154
159
|
isValid?: boolean;
|
|
155
160
|
sizing?: FormControlSize;
|
|
156
161
|
};
|
|
157
|
-
export type FormUrlInputProps = InputElement & {
|
|
162
|
+
export type FormUrlInputProps = Omit<InputElement, 'type'> & FixedInputType<'url'> & {
|
|
158
163
|
isInvalid?: boolean;
|
|
159
164
|
isPlaintext?: boolean;
|
|
160
165
|
isValid?: boolean;
|
|
161
166
|
sizing?: FormControlSize;
|
|
162
167
|
};
|
|
163
|
-
export type FormWeekInputProps = InputElement & {
|
|
168
|
+
export type FormWeekInputProps = Omit<InputElement, 'type'> & FixedInputType<'week'> & {
|
|
164
169
|
isInvalid?: boolean;
|
|
165
170
|
isPlaintext?: boolean;
|
|
166
171
|
isValid?: boolean;
|
|
167
172
|
sizing?: FormControlSize;
|
|
168
173
|
};
|
|
174
|
+
export {};
|
|
@@ -23,28 +23,35 @@ import { uniqueClsx } from '../common/css.js';
|
|
|
23
23
|
import { noop } from '../common/noop.js';
|
|
24
24
|
// Generate a unique ID for the element, in case one is not provided...
|
|
25
25
|
const uid = $props.id();
|
|
26
|
-
let { children, class: classValues, colorVariant, elementRef = $bindable(null), href, id = `list-group-item-action-${uid}`, isActive = false, isDisabled = false, onclick = noop, ...restOfProps } = $props();
|
|
27
|
-
const isAnchor = $derived(
|
|
26
|
+
let { 'aria-current': ariaCurrent, 'aria-disabled': ariaDisabled, children, class: classValues, colorVariant, elementRef = $bindable(null), href, id = `list-group-item-action-${uid}`, isActive = false, isDisabled = false, onclick = noop, role: consumerRole, tabindex: consumerTabIndex, type: consumerType, ...restOfProps } = $props();
|
|
27
|
+
const isAnchor = $derived(href !== undefined);
|
|
28
28
|
const elementType = $derived(isAnchor ? 'a' : 'button');
|
|
29
29
|
let classes = $derived(uniqueClsx('list-group-item', 'list-group-item-action', {
|
|
30
30
|
active: isActive,
|
|
31
31
|
disabled: isDisabled
|
|
32
32
|
}, colorVariant && `list-group-item-${colorVariant}`, classValues));
|
|
33
33
|
const handleClick = (event) => {
|
|
34
|
+
if (isDisabled) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
34
38
|
onclick(event);
|
|
35
39
|
};
|
|
36
40
|
</script>
|
|
37
41
|
|
|
38
42
|
<svelte:element
|
|
39
43
|
this={elementType}
|
|
40
|
-
|
|
41
|
-
aria-
|
|
44
|
+
{...restOfProps as any}
|
|
45
|
+
aria-current={isActive ? 'page' : ariaCurrent}
|
|
46
|
+
aria-disabled={isDisabled ? 'true' : ariaDisabled}
|
|
42
47
|
bind:this={elementRef}
|
|
43
48
|
class={classes}
|
|
44
|
-
{href}
|
|
49
|
+
href={isAnchor && !isDisabled ? href : undefined}
|
|
45
50
|
{id}
|
|
51
|
+
disabled={isAnchor ? undefined : isDisabled}
|
|
46
52
|
onclick={handleClick}
|
|
47
|
-
|
|
48
|
-
{
|
|
53
|
+
role={consumerRole}
|
|
54
|
+
tabindex={isDisabled ? -1 : consumerTabIndex}
|
|
55
|
+
type={isAnchor ? consumerType : 'button'}>
|
|
49
56
|
{@render children?.()}
|
|
50
57
|
</svelte:element>
|