@human-kit/svelte-components 1.0.0-alpha.5 → 1.0.0-alpha.7
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/dist/button/README.md +48 -0
- package/dist/button/TODO.md +13 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.js +4 -0
- package/dist/button/index.parts.d.ts +1 -0
- package/dist/button/index.parts.js +1 -0
- package/dist/button/root/README.md +43 -0
- package/dist/button/root/button-root.svelte +362 -0
- package/dist/button/root/button-root.svelte.d.ts +21 -0
- package/dist/button/root/button-test.svelte +76 -0
- package/dist/button/root/button-test.svelte.d.ts +11 -0
- package/dist/calendar/index.d.ts +3 -3
- package/dist/calendar/index.js +3 -3
- package/dist/calendar/trigger-next/calendar-trigger-next.svelte +9 -4
- package/dist/calendar/trigger-next/calendar-trigger-next.svelte.d.ts +2 -1
- package/dist/calendar/trigger-previous/calendar-trigger-previous.svelte +9 -4
- package/dist/calendar/trigger-previous/calendar-trigger-previous.svelte.d.ts +2 -1
- package/dist/checkbox/index.d.ts +3 -3
- package/dist/checkbox/index.js +3 -3
- package/dist/clock/index.d.ts +5 -5
- package/dist/clock/index.js +5 -5
- package/dist/combobox/button/combobox-button.svelte +5 -4
- package/dist/combobox/index.d.ts +3 -3
- package/dist/combobox/index.js +3 -3
- package/dist/combobox/input/combobox-input.svelte +17 -2
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +1 -1
- package/dist/combobox/popover/combobox-popover.svelte +47 -1
- package/dist/combobox/root/combobox.svelte +13 -0
- package/dist/combobox/root/context.d.ts +2 -0
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte +3 -2
- package/dist/datepicker/index.d.ts +3 -3
- package/dist/datepicker/index.js +3 -3
- package/dist/datepicker/trigger/date-picker-trigger.svelte +5 -5
- package/dist/dialog/index.d.ts +3 -3
- package/dist/dialog/index.js +2 -2
- package/dist/index.d.ts +31 -29
- package/dist/index.js +31 -29
- package/dist/listbox/index.d.ts +3 -3
- package/dist/listbox/index.js +3 -3
- package/dist/listbox/item/README.md +2 -1
- package/dist/listbox/item/listbox-item.svelte +129 -1
- package/dist/listbox/item/listbox-item.svelte.d.ts +2 -0
- package/dist/listbox/root/listbox-test.svelte +14 -2
- package/dist/listbox/root/listbox-test.svelte.d.ts +1 -0
- package/dist/listbox/root/listbox.svelte.d.ts +2 -2
- package/dist/popover/index.d.ts +3 -3
- package/dist/popover/index.js +3 -3
- package/dist/popover/trigger/popover-trigger-button.svelte +4 -3
- package/dist/table/index.d.ts +3 -3
- package/dist/table/index.js +3 -3
- package/dist/table/root/table-root.svelte.d.ts +1 -1
- package/dist/timepicker/index.d.ts +5 -5
- package/dist/timepicker/index.js +5 -5
- package/dist/timepicker/trigger/time-picker-trigger.svelte +5 -5
- package/package.json +6 -1
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
4
5
|
import { useCalendarContext } from '../root/context';
|
|
5
6
|
|
|
6
|
-
type CalendarTriggerPreviousProps = Omit<
|
|
7
|
+
type CalendarTriggerPreviousProps = Omit<
|
|
8
|
+
HTMLButtonAttributes,
|
|
9
|
+
'children' | 'class' | 'disabled' | 'aria-disabled'
|
|
10
|
+
> & {
|
|
11
|
+
class?: string;
|
|
7
12
|
children?: Snippet;
|
|
8
13
|
};
|
|
9
14
|
|
|
@@ -22,11 +27,11 @@
|
|
|
22
27
|
}
|
|
23
28
|
</script>
|
|
24
29
|
|
|
25
|
-
<
|
|
30
|
+
<ButtonRoot
|
|
26
31
|
type="button"
|
|
27
32
|
class={className}
|
|
28
33
|
aria-label="Previous page"
|
|
29
|
-
|
|
34
|
+
{isDisabled}
|
|
30
35
|
onclick={handleClick}
|
|
31
36
|
{...restProps}
|
|
32
37
|
>
|
|
@@ -35,4 +40,4 @@
|
|
|
35
40
|
{:else}
|
|
36
41
|
Prev
|
|
37
42
|
{/if}
|
|
38
|
-
</
|
|
43
|
+
</ButtonRoot>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
-
type CalendarTriggerPreviousProps = Omit<HTMLButtonAttributes, 'children'> & {
|
|
3
|
+
type CalendarTriggerPreviousProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'disabled' | 'aria-disabled'> & {
|
|
4
|
+
class?: string;
|
|
4
5
|
children?: Snippet;
|
|
5
6
|
};
|
|
6
7
|
declare const CalendarTriggerPrevious: import("svelte").Component<CalendarTriggerPreviousProps, {}, "">;
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as Checkbox from './index.parts.
|
|
1
|
+
export * as Checkbox from './index.parts.js';
|
|
2
2
|
export { default as CheckboxRoot } from './root/checkbox-root.svelte';
|
|
3
3
|
export { default as CheckboxIndicator } from './indicator/checkbox-indicator.svelte';
|
|
4
|
-
export { getCheckboxContext, setCheckboxContext, useCheckboxContext, type CheckboxContext, type CheckboxState } from './root/context.
|
|
5
|
-
import * as CheckboxParts from './index.parts.
|
|
4
|
+
export { getCheckboxContext, setCheckboxContext, useCheckboxContext, type CheckboxContext, type CheckboxState } from './root/context.js';
|
|
5
|
+
import * as CheckboxParts from './index.parts.js';
|
|
6
6
|
export default CheckboxParts;
|
package/dist/checkbox/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as Checkbox from './index.parts.
|
|
1
|
+
export * as Checkbox from './index.parts.js';
|
|
2
2
|
export { default as CheckboxRoot } from './root/checkbox-root.svelte';
|
|
3
3
|
export { default as CheckboxIndicator } from './indicator/checkbox-indicator.svelte';
|
|
4
|
-
export { getCheckboxContext, setCheckboxContext, useCheckboxContext } from './root/context.
|
|
5
|
-
import * as CheckboxParts from './index.parts.
|
|
4
|
+
export { getCheckboxContext, setCheckboxContext, useCheckboxContext } from './root/context.js';
|
|
5
|
+
import * as CheckboxParts from './index.parts.js';
|
|
6
6
|
export default CheckboxParts;
|
package/dist/clock/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as Clock from './index.parts.
|
|
1
|
+
export * as Clock from './index.parts.js';
|
|
2
2
|
export { default as ClockRoot } from './root/clock-root.svelte';
|
|
3
3
|
export { default as ClockAxis } from './axis/clock-axis.svelte';
|
|
4
4
|
export { default as ClockWheelColumn } from './wheel-column/clock-wheel-column.svelte';
|
|
5
5
|
export { default as ClockWheelItem } from './wheel-item/clock-wheel-item.svelte';
|
|
6
|
-
export { getClockContext, setClockContext, useClockContext, type ClockContext, type ClockEditableSegmentType } from './root/context.
|
|
7
|
-
export { type TimePickerGranularity as ClockGranularity, type TimePickerHourCycle as ClockHourCycle, type TimePickerTimeValue as ClockTimeValue } from './root/time-utils';
|
|
8
|
-
export { type ClockColumnInfo } from './root/resolve-visible-columns';
|
|
9
|
-
import * as ClockParts from './index.parts.
|
|
6
|
+
export { getClockContext, setClockContext, useClockContext, type ClockContext, type ClockEditableSegmentType } from './root/context.js';
|
|
7
|
+
export { type TimePickerGranularity as ClockGranularity, type TimePickerHourCycle as ClockHourCycle, type TimePickerTimeValue as ClockTimeValue } from './root/time-utils.js';
|
|
8
|
+
export { type ClockColumnInfo } from './root/resolve-visible-columns.js';
|
|
9
|
+
import * as ClockParts from './index.parts.js';
|
|
10
10
|
export default ClockParts;
|
package/dist/clock/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as Clock from './index.parts.
|
|
1
|
+
export * as Clock from './index.parts.js';
|
|
2
2
|
export { default as ClockRoot } from './root/clock-root.svelte';
|
|
3
3
|
export { default as ClockAxis } from './axis/clock-axis.svelte';
|
|
4
4
|
export { default as ClockWheelColumn } from './wheel-column/clock-wheel-column.svelte';
|
|
5
5
|
export { default as ClockWheelItem } from './wheel-item/clock-wheel-item.svelte';
|
|
6
|
-
export { getClockContext, setClockContext, useClockContext } from './root/context.
|
|
7
|
-
export {} from './root/time-utils';
|
|
8
|
-
export {} from './root/resolve-visible-columns';
|
|
9
|
-
import * as ClockParts from './index.parts.
|
|
6
|
+
export { getClockContext, setClockContext, useClockContext } from './root/context.js';
|
|
7
|
+
export {} from './root/time-utils.js';
|
|
8
|
+
export {} from './root/resolve-visible-columns.js';
|
|
9
|
+
import * as ClockParts from './index.parts.js';
|
|
10
10
|
export default ClockParts;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
4
5
|
import { useComboBoxContext } from '../root/context';
|
|
5
6
|
|
|
6
7
|
type ComboBoxButtonProps = HTMLButtonAttributes & {
|
|
@@ -26,14 +27,14 @@
|
|
|
26
27
|
|
|
27
28
|
<!-- * CHANGE: CHANGE NAME FROM BUTTON TO TRIGGER -->
|
|
28
29
|
|
|
29
|
-
<
|
|
30
|
+
<ButtonRoot
|
|
30
31
|
type="button"
|
|
31
32
|
{tabindex}
|
|
32
33
|
aria-label={ctx.isOpen ? 'Close menu' : 'Open menu'}
|
|
33
34
|
aria-expanded={ctx.isOpen}
|
|
34
35
|
aria-controls={`combobox-listbox-${ctx.instanceId}`}
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
isDisabled={ctx.isDisabled}
|
|
37
|
+
pressed={ctx.isOpen}
|
|
37
38
|
onmousedown={handleMouseDown}
|
|
38
39
|
class={className}
|
|
39
40
|
{...restProps}
|
|
@@ -56,4 +57,4 @@
|
|
|
56
57
|
<path d="m6 9 6 6 6-6" />
|
|
57
58
|
</svg>
|
|
58
59
|
{/if}
|
|
59
|
-
</
|
|
60
|
+
</ButtonRoot>
|
package/dist/combobox/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as ComboBox from './index.parts.
|
|
1
|
+
export * as ComboBox from './index.parts.js';
|
|
2
2
|
export { default as ComboBoxRoot } from './root/combobox.svelte';
|
|
3
3
|
export { default as ComboBoxInput } from './input/combobox-input.svelte';
|
|
4
4
|
export { default as ComboBoxButton } from './button/combobox-button.svelte';
|
|
@@ -9,6 +9,6 @@ export { default as ComboBoxItemIndicator } from './item-indicator/combobox-item
|
|
|
9
9
|
export { default as ComboBoxTags } from './tags/combobox-tags.svelte';
|
|
10
10
|
export { default as ComboBoxTag } from './tag/combobox-tag.svelte';
|
|
11
11
|
export { default as ComboBoxTagRemove } from './tag-remove/combobox-tag-remove.svelte';
|
|
12
|
-
export { getComboBoxContext, setComboBoxContext, useComboBoxContext, type ComboBoxContext } from './root/context.
|
|
13
|
-
import * as ComboBoxParts from './index.parts.
|
|
12
|
+
export { getComboBoxContext, setComboBoxContext, useComboBoxContext, type ComboBoxContext } from './root/context.js';
|
|
13
|
+
import * as ComboBoxParts from './index.parts.js';
|
|
14
14
|
export default ComboBoxParts;
|
package/dist/combobox/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Namespace export for component composition: <ComboBox.Root>, <ComboBox.Input>, etc.
|
|
2
|
-
export * as ComboBox from './index.parts.
|
|
2
|
+
export * as ComboBox from './index.parts.js';
|
|
3
3
|
// Direct named exports for individual imports
|
|
4
4
|
export { default as ComboBoxRoot } from './root/combobox.svelte';
|
|
5
5
|
export { default as ComboBoxInput } from './input/combobox-input.svelte';
|
|
@@ -12,7 +12,7 @@ export { default as ComboBoxTags } from './tags/combobox-tags.svelte';
|
|
|
12
12
|
export { default as ComboBoxTag } from './tag/combobox-tag.svelte';
|
|
13
13
|
export { default as ComboBoxTagRemove } from './tag-remove/combobox-tag-remove.svelte';
|
|
14
14
|
// Context and types
|
|
15
|
-
export { getComboBoxContext, setComboBoxContext, useComboBoxContext } from './root/context.
|
|
15
|
+
export { getComboBoxContext, setComboBoxContext, useComboBoxContext } from './root/context.js';
|
|
16
16
|
// Default export as namespace object
|
|
17
|
-
import * as ComboBoxParts from './index.parts.
|
|
17
|
+
import * as ComboBoxParts from './index.parts.js';
|
|
18
18
|
export default ComboBoxParts;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
import { useComboBoxContext } from '../root/context';
|
|
4
|
+
import {
|
|
5
|
+
shouldShowFocusVisible,
|
|
6
|
+
trackInteractionModality
|
|
7
|
+
} from '../../primitives/input-modality';
|
|
4
8
|
import { cn } from '../../utils/cn';
|
|
5
9
|
|
|
6
10
|
type ComboBoxInputProps = HTMLInputAttributes & {
|
|
@@ -42,6 +46,8 @@
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
function handleFocus() {
|
|
49
|
+
ctx.setFocusVisible(shouldShowFocusVisible(inputRef));
|
|
50
|
+
|
|
45
51
|
// Open on focus if trigger is 'focus'
|
|
46
52
|
// Use a small delay to avoid opening immediately on programmatic focus
|
|
47
53
|
// (e.g., from a focus trap). This gives time for refs to be set up.
|
|
@@ -54,7 +60,9 @@
|
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
function handleMouseDown() {
|
|
63
|
+
function handleMouseDown(event: MouseEvent) {
|
|
64
|
+
trackInteractionModality(event, inputRef);
|
|
65
|
+
ctx.setFocusVisible(false);
|
|
58
66
|
ctx.setFocusedTagId(null);
|
|
59
67
|
// Open on press if trigger is 'press'
|
|
60
68
|
if (ctx.trigger === 'press' && !ctx.isOpen && !ctx.isDisabled && !ctx.isReadOnly) {
|
|
@@ -62,7 +70,14 @@
|
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
|
|
73
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
74
|
+
trackInteractionModality(event, inputRef);
|
|
75
|
+
ctx.setFocusVisible(shouldShowFocusVisible(inputRef));
|
|
76
|
+
ctx.handleKeydown(event);
|
|
77
|
+
}
|
|
78
|
+
|
|
65
79
|
function handleBlur() {
|
|
80
|
+
ctx.setFocusVisible(false);
|
|
66
81
|
// Restore selection label or deselect if empty
|
|
67
82
|
ctx.handleInputBlur();
|
|
68
83
|
}
|
|
@@ -89,7 +104,7 @@
|
|
|
89
104
|
onfocus={handleFocus}
|
|
90
105
|
onmousedown={handleMouseDown}
|
|
91
106
|
onblur={handleBlur}
|
|
92
|
-
onkeydown={
|
|
107
|
+
onkeydown={handleKeyDown}
|
|
93
108
|
class={cn(
|
|
94
109
|
'bg-depth-2 sunken placeholder:text-muted-foreground hover:bg-depth-1 focus:ring-border h-8 w-full rounded-xs border px-2 text-sm shadow-xs transition-all ease-out outline-none focus:ring focus:ring-offset-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
95
110
|
className
|
|
@@ -17,7 +17,7 @@ declare function $$render<T extends object = object>(): {
|
|
|
17
17
|
} & {
|
|
18
18
|
context?: ListBoxContext;
|
|
19
19
|
element?: HTMLElement;
|
|
20
|
-
}, "children" | "id" | "
|
|
20
|
+
}, "children" | "value" | "id" | "element" | "selectionMode" | "selectionBehavior" | "defaultValue" | "onChange" | "items" | "context"> & {
|
|
21
21
|
/** Optional items for dynamic rendering - overrides items from ComboBox context */
|
|
22
22
|
items?: Iterable<T>;
|
|
23
23
|
/** Content of the listbox. Receives item in dynamic mode. */
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { useComboBoxContext } from '../root/context';
|
|
4
4
|
import { Popover } from '../../popover';
|
|
5
|
+
import { focusWithModality, type InputModality } from '../../primitives/input-modality';
|
|
6
|
+
import type { PopoverOpenChangeDetails } from '../../popover/root/context';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* ComboBox.Popover - Just the floating container wrapper.
|
|
@@ -16,7 +18,51 @@
|
|
|
16
18
|
|
|
17
19
|
const ctx = useComboBoxContext();
|
|
18
20
|
|
|
19
|
-
function
|
|
21
|
+
function resolveFocusTarget(details?: PopoverOpenChangeDetails): HTMLElement | null {
|
|
22
|
+
const rawTarget = details?.event?.target;
|
|
23
|
+
if (!(rawTarget instanceof Node)) return null;
|
|
24
|
+
if (ctx.inputRef?.contains(rawTarget)) return null;
|
|
25
|
+
return rawTarget instanceof HTMLElement ? rawTarget : rawTarget.parentElement;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function handleOpenChange(open: boolean, details?: PopoverOpenChangeDetails) {
|
|
29
|
+
if (!open) {
|
|
30
|
+
// Cancel Popover.Root's close to prevent scheduleTriggerCloseFocus from
|
|
31
|
+
// setting stale data-focused on the trigger. The combobox passes triggerRef
|
|
32
|
+
// via prop (not Popover.Trigger), so Popover.Root never registers a
|
|
33
|
+
// blur-cleanup listener and any data-focused it sets persists forever.
|
|
34
|
+
//
|
|
35
|
+
// IMPORTANT: the actual state change is deferred to a microtask so that
|
|
36
|
+
// when Popover.Root's closePopover re-reads `isOpen` after the callback,
|
|
37
|
+
// the derived value is still `true` and the guard succeeds. A synchronous
|
|
38
|
+
// ctx.onOpenChange(false) would update the upstream signal immediately,
|
|
39
|
+
// making the derived `false` and bypassing the guard despite the cancel.
|
|
40
|
+
details?.cancel();
|
|
41
|
+
|
|
42
|
+
if (details?.reason === 'outside-press') {
|
|
43
|
+
const target = resolveFocusTarget(details);
|
|
44
|
+
queueMicrotask(() => {
|
|
45
|
+
ctx.onOpenChange(false);
|
|
46
|
+
|
|
47
|
+
if (target) {
|
|
48
|
+
focusWithModality(target, 'pointer' satisfies InputModality);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// If focus is still on the input (non-focusable target), blur it
|
|
52
|
+
// so focusWithin becomes false.
|
|
53
|
+
if (document.activeElement === ctx.inputRef) {
|
|
54
|
+
ctx.inputRef?.blur();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
queueMicrotask(() => {
|
|
61
|
+
ctx.onOpenChange(false);
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
20
66
|
ctx.onOpenChange(open);
|
|
21
67
|
}
|
|
22
68
|
|
|
@@ -346,6 +346,13 @@
|
|
|
346
346
|
!!wrapperRef && !!document.activeElement && wrapperRef.contains(document.activeElement);
|
|
347
347
|
if (!focusWithin) {
|
|
348
348
|
focusVisible = false;
|
|
349
|
+
// Clean up stale data-focused/data-focus-visible that Popover.Root's
|
|
350
|
+
// focus-state module may have set imperatively on the wrapper (the
|
|
351
|
+
// wrapper is briefly used as triggerRef before the input overrides it).
|
|
352
|
+
if (wrapperRef) {
|
|
353
|
+
delete wrapperRef.dataset.focused;
|
|
354
|
+
delete wrapperRef.dataset.focusVisible;
|
|
355
|
+
}
|
|
349
356
|
}
|
|
350
357
|
}
|
|
351
358
|
|
|
@@ -358,6 +365,10 @@
|
|
|
358
365
|
queueMicrotask(syncFocusWithin);
|
|
359
366
|
}
|
|
360
367
|
|
|
368
|
+
function setFocusVisibleState(visible: boolean) {
|
|
369
|
+
focusVisible = visible && focusWithin;
|
|
370
|
+
}
|
|
371
|
+
|
|
361
372
|
// Use navigation hook methods for keyboard navigation
|
|
362
373
|
function selectFocusedItem() {
|
|
363
374
|
if (navigation.focusedId !== null) {
|
|
@@ -694,6 +705,7 @@
|
|
|
694
705
|
unregisterItem: navigation.unregister,
|
|
695
706
|
handleKeydown,
|
|
696
707
|
handleInputBlur,
|
|
708
|
+
setFocusVisible: setFocusVisibleState,
|
|
697
709
|
get focusedTagId() {
|
|
698
710
|
return focusedTagId;
|
|
699
711
|
},
|
|
@@ -712,6 +724,7 @@
|
|
|
712
724
|
aria-labelledby={ariaLabelledby}
|
|
713
725
|
class={className}
|
|
714
726
|
data-combobox
|
|
727
|
+
data-focused={focusWithin || undefined}
|
|
715
728
|
data-disabled={isDisabled || undefined}
|
|
716
729
|
data-readonly={isReadOnly || undefined}
|
|
717
730
|
data-focus-within={focusWithin || undefined}
|
|
@@ -80,6 +80,8 @@ export type ComboBoxContext<T extends object = object> = {
|
|
|
80
80
|
handleKeydown: (event: KeyboardEvent) => void;
|
|
81
81
|
/** Handle input blur - restore selection or deselect if empty */
|
|
82
82
|
handleInputBlur: () => void;
|
|
83
|
+
/** Update root-level focus-visible state based on current modality. */
|
|
84
|
+
setFocusVisible: (visible: boolean) => void;
|
|
83
85
|
/** Currently focused tag ID (virtual focus for tag navigation) */
|
|
84
86
|
focusedTagId: string | number | null;
|
|
85
87
|
/** Set focused tag ID (virtual focus for tag navigation) */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
4
|
import { getContext } from 'svelte';
|
|
5
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
5
6
|
import { cn } from '../../utils/cn';
|
|
6
7
|
import { TAG_CONTEXT_KEY, type TagContext } from '../tag/combobox-tag.svelte';
|
|
7
8
|
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
</script>
|
|
28
29
|
|
|
29
30
|
{#if !tagCtx.disabled}
|
|
30
|
-
<
|
|
31
|
+
<ButtonRoot
|
|
31
32
|
type="button"
|
|
32
33
|
onclick={handleClick}
|
|
33
34
|
aria-label={`Remove ${tagCtx.label}`}
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
/>
|
|
50
51
|
</svg>
|
|
51
52
|
{/if}
|
|
52
|
-
</
|
|
53
|
+
</ButtonRoot>
|
|
53
54
|
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as DatePicker from './index.parts.
|
|
1
|
+
export * as DatePicker from './index.parts.js';
|
|
2
2
|
export { default as DatePickerRoot } from './root/date-picker-root.svelte';
|
|
3
3
|
export { default as DatePickerInput } from './input/date-picker-input.svelte';
|
|
4
4
|
export { default as DatePickerSegment } from './segment/date-picker-segment.svelte';
|
|
@@ -13,6 +13,6 @@ export { default as DatePickerGridHeader } from '../calendar/grid-header/calenda
|
|
|
13
13
|
export { default as DatePickerHeaderCell } from '../calendar/header-cell/calendar-header-cell.svelte';
|
|
14
14
|
export { default as DatePickerGridBody } from '../calendar/grid-body/calendar-grid-body.svelte';
|
|
15
15
|
export { default as DatePickerBodyCell } from '../calendar/body-cell/calendar-body-cell.svelte';
|
|
16
|
-
export { getDatePickerContext, setDatePickerContext, useDatePickerContext, type DatePickerContext, type DatePickerOpenChangeDetails, type DatePickerOpenChangeReason, type DatePickerSegmentPart, type DatePickerSegmentType } from './root/context.
|
|
17
|
-
import * as DatePickerParts from './index.parts.
|
|
16
|
+
export { getDatePickerContext, setDatePickerContext, useDatePickerContext, type DatePickerContext, type DatePickerOpenChangeDetails, type DatePickerOpenChangeReason, type DatePickerSegmentPart, type DatePickerSegmentType } from './root/context.js';
|
|
17
|
+
import * as DatePickerParts from './index.parts.js';
|
|
18
18
|
export default DatePickerParts;
|
package/dist/datepicker/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as DatePicker from './index.parts.
|
|
1
|
+
export * as DatePicker from './index.parts.js';
|
|
2
2
|
export { default as DatePickerRoot } from './root/date-picker-root.svelte';
|
|
3
3
|
export { default as DatePickerInput } from './input/date-picker-input.svelte';
|
|
4
4
|
export { default as DatePickerSegment } from './segment/date-picker-segment.svelte';
|
|
@@ -13,6 +13,6 @@ export { default as DatePickerGridHeader } from '../calendar/grid-header/calenda
|
|
|
13
13
|
export { default as DatePickerHeaderCell } from '../calendar/header-cell/calendar-header-cell.svelte';
|
|
14
14
|
export { default as DatePickerGridBody } from '../calendar/grid-body/calendar-grid-body.svelte';
|
|
15
15
|
export { default as DatePickerBodyCell } from '../calendar/body-cell/calendar-body-cell.svelte';
|
|
16
|
-
export { getDatePickerContext, setDatePickerContext, useDatePickerContext } from './root/context.
|
|
17
|
-
import * as DatePickerParts from './index.parts.
|
|
16
|
+
export { getDatePickerContext, setDatePickerContext, useDatePickerContext } from './root/context.js';
|
|
17
|
+
import * as DatePickerParts from './index.parts.js';
|
|
18
18
|
export default DatePickerParts;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
4
5
|
import { useDatePickerContext } from '../root/context';
|
|
5
6
|
import {
|
|
6
7
|
shouldShowFocusVisible,
|
|
@@ -86,14 +87,13 @@
|
|
|
86
87
|
</script>
|
|
87
88
|
|
|
88
89
|
{#if !datePicker.isReadOnly}
|
|
89
|
-
<
|
|
90
|
-
bind:
|
|
90
|
+
<ButtonRoot
|
|
91
|
+
bind:element={buttonRef}
|
|
91
92
|
type="button"
|
|
92
|
-
|
|
93
|
+
isDisabled={datePicker.isDisabled}
|
|
93
94
|
class={className}
|
|
94
95
|
aria-haspopup="dialog"
|
|
95
96
|
aria-expanded={datePicker.open}
|
|
96
|
-
data-disabled={datePicker.isDisabled || undefined}
|
|
97
97
|
data-focused={isFocused || undefined}
|
|
98
98
|
data-focus-visible={isFocused && datePicker.focusVisible ? 'true' : undefined}
|
|
99
99
|
onmousedown={handleMouseDown}
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
{#if children}
|
|
107
107
|
{@render children()}
|
|
108
108
|
{/if}
|
|
109
|
-
</
|
|
109
|
+
</ButtonRoot>
|
|
110
110
|
{/if}
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as DialogParts from './index.parts.
|
|
1
|
+
import * as DialogParts from './index.parts.js';
|
|
2
2
|
export declare const Dialog: typeof DialogParts;
|
|
3
3
|
export default DialogParts;
|
|
4
4
|
export { default as DialogRoot } from './root/dialog-root.svelte';
|
|
@@ -6,5 +6,5 @@ export { default as DialogTrigger } from './trigger/dialog-trigger.svelte';
|
|
|
6
6
|
export { default as DialogPortal } from './portal/dialog-portal.svelte';
|
|
7
7
|
export { default as DialogOverlay } from './overlay/dialog-overlay.svelte';
|
|
8
8
|
export { default as DialogContent } from './content/dialog-content.svelte';
|
|
9
|
-
export { getDialogContext, setDialogContext, type DialogContext } from './root/context';
|
|
10
|
-
export type { DialogStateHelpers } from './root/types';
|
|
9
|
+
export { getDialogContext, setDialogContext, type DialogContext } from './root/context.js';
|
|
10
|
+
export type { DialogStateHelpers } from './root/types.js';
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Dialog component with namespace pattern
|
|
2
2
|
// Usage: <Dialog.Root>, <Dialog.Trigger>, <Dialog.Portal>, <Dialog.Overlay>, <Dialog.Content>
|
|
3
|
-
import * as DialogParts from './index.parts.
|
|
3
|
+
import * as DialogParts from './index.parts.js';
|
|
4
4
|
// Named export for namespace usage: import { Dialog } from '...'
|
|
5
5
|
export const Dialog = DialogParts;
|
|
6
6
|
// Default export for backwards compatibility
|
|
@@ -12,4 +12,4 @@ export { default as DialogPortal } from './portal/dialog-portal.svelte';
|
|
|
12
12
|
export { default as DialogOverlay } from './overlay/dialog-overlay.svelte';
|
|
13
13
|
export { default as DialogContent } from './content/dialog-content.svelte';
|
|
14
14
|
// Re-export context utilities
|
|
15
|
-
export { getDialogContext, setDialogContext } from './root/context';
|
|
15
|
+
export { getDialogContext, setDialogContext } from './root/context.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './
|
|
26
|
-
export * from './
|
|
27
|
-
export
|
|
28
|
-
export * from './
|
|
29
|
-
export
|
|
1
|
+
export { Button } from './button/index.js';
|
|
2
|
+
export { Checkbox } from './checkbox/index.js';
|
|
3
|
+
export { ComboBox } from './combobox/index.js';
|
|
4
|
+
export { Calendar } from './calendar/index.js';
|
|
5
|
+
export { Clock } from './clock/index.js';
|
|
6
|
+
export { DatePicker } from './datepicker/index.js';
|
|
7
|
+
export { TimePicker } from './timepicker/index.js';
|
|
8
|
+
export { Dialog } from './dialog/index.js';
|
|
9
|
+
export { ListBox } from './listbox/index.js';
|
|
10
|
+
export { Popover } from './popover/index.js';
|
|
11
|
+
export { Table } from './table/index.js';
|
|
12
|
+
export { default as Input } from './input/index.js';
|
|
13
|
+
export { default as Label } from './label/index.js';
|
|
14
|
+
export { default as LocaleProvider } from './locale-provider/index.js';
|
|
15
|
+
export { Portal } from './portal/index.js';
|
|
16
|
+
export * from './locale-provider/index.js';
|
|
17
|
+
export * from './button/index.js';
|
|
18
|
+
export * from './checkbox/index.js';
|
|
19
|
+
export * from './combobox/index.js';
|
|
20
|
+
export * from './calendar/index.js';
|
|
21
|
+
export * from './clock/index.js';
|
|
22
|
+
export * from './datepicker/index.js';
|
|
23
|
+
export * from './timepicker/index.js';
|
|
24
|
+
export * from './dialog/index.js';
|
|
25
|
+
export * from './listbox/index.js';
|
|
26
|
+
export * from './popover/index.js';
|
|
27
|
+
export * from './table/index.js';
|
|
28
|
+
export * from './primitives/index.js';
|
|
29
|
+
export { cn } from './utils/index.js';
|
|
30
|
+
export * from './utils/index.js';
|
|
31
|
+
export * from './utils/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
// Main library entry point
|
|
2
2
|
// Components (namespace exports)
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
3
|
+
export { Button } from './button/index.js';
|
|
4
|
+
export { Checkbox } from './checkbox/index.js';
|
|
5
|
+
export { ComboBox } from './combobox/index.js';
|
|
6
|
+
export { Calendar } from './calendar/index.js';
|
|
7
|
+
export { Clock } from './clock/index.js';
|
|
8
|
+
export { DatePicker } from './datepicker/index.js';
|
|
9
|
+
export { TimePicker } from './timepicker/index.js';
|
|
10
|
+
export { Dialog } from './dialog/index.js';
|
|
11
|
+
export { ListBox } from './listbox/index.js';
|
|
12
|
+
export { Popover } from './popover/index.js';
|
|
13
|
+
export { Table } from './table/index.js';
|
|
13
14
|
// Simple components
|
|
14
|
-
export { default as Input } from './input/index.
|
|
15
|
-
export { default as Label } from './label/index.
|
|
16
|
-
export { default as LocaleProvider } from './locale-provider/index.
|
|
17
|
-
export { Portal } from './portal/index.
|
|
18
|
-
export * from './locale-provider/index.
|
|
15
|
+
export { default as Input } from './input/index.js';
|
|
16
|
+
export { default as Label } from './label/index.js';
|
|
17
|
+
export { default as LocaleProvider } from './locale-provider/index.js';
|
|
18
|
+
export { Portal } from './portal/index.js';
|
|
19
|
+
export * from './locale-provider/index.js';
|
|
19
20
|
// Re-export named exports from components
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './
|
|
28
|
-
export * from './
|
|
29
|
-
export * from './
|
|
21
|
+
export * from './button/index.js';
|
|
22
|
+
export * from './checkbox/index.js';
|
|
23
|
+
export * from './combobox/index.js';
|
|
24
|
+
export * from './calendar/index.js';
|
|
25
|
+
export * from './clock/index.js';
|
|
26
|
+
export * from './datepicker/index.js';
|
|
27
|
+
export * from './timepicker/index.js';
|
|
28
|
+
export * from './dialog/index.js';
|
|
29
|
+
export * from './listbox/index.js';
|
|
30
|
+
export * from './popover/index.js';
|
|
31
|
+
export * from './table/index.js';
|
|
30
32
|
// Primitives
|
|
31
|
-
export * from './primitives/index.
|
|
33
|
+
export * from './primitives/index.js';
|
|
32
34
|
// Utilities
|
|
33
|
-
export { cn } from './utils/index.
|
|
34
|
-
export * from './utils/index.
|
|
35
|
-
export * from './utils/index.
|
|
35
|
+
export { cn } from './utils/index.js';
|
|
36
|
+
export * from './utils/index.js';
|
|
37
|
+
export * from './utils/index.js';
|
package/dist/listbox/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as ListBox from './index.parts.
|
|
1
|
+
export * as ListBox from './index.parts.js';
|
|
2
2
|
export { default as ListBoxRoot } from './root/listbox.svelte';
|
|
3
3
|
export { default as ListBoxItem } from './item/listbox-item.svelte';
|
|
4
|
-
export { useListBoxContext, createListBoxContext, type ListBoxContext } from './root/context.
|
|
5
|
-
import * as ListBoxParts from './index.parts.
|
|
4
|
+
export { useListBoxContext, createListBoxContext, type ListBoxContext } from './root/context.js';
|
|
5
|
+
import * as ListBoxParts from './index.parts.js';
|
|
6
6
|
export default ListBoxParts;
|
package/dist/listbox/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Namespace export for component composition: <ListBox.Root>, <ListBox.Item>
|
|
2
|
-
export * as ListBox from './index.parts.
|
|
2
|
+
export * as ListBox from './index.parts.js';
|
|
3
3
|
// Direct named exports for individual imports
|
|
4
4
|
export { default as ListBoxRoot } from './root/listbox.svelte';
|
|
5
5
|
export { default as ListBoxItem } from './item/listbox-item.svelte';
|
|
6
6
|
// Context and types
|
|
7
|
-
export { useListBoxContext, createListBoxContext } from './root/context.
|
|
7
|
+
export { useListBoxContext, createListBoxContext } from './root/context.js';
|
|
8
8
|
// Default export as namespace object
|
|
9
|
-
import * as ListBoxParts from './index.parts.
|
|
9
|
+
import * as ListBoxParts from './index.parts.js';
|
|
10
10
|
export default ListBoxParts;
|