noph-ui 0.49.0 → 0.51.0
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/app-bar/AppBar.svelte +68 -26
- package/dist/autocomplete/AutoComplete.svelte +3 -4
- package/dist/autocomplete/types.d.ts +3 -3
- package/dist/badge/Badge.svelte +1 -1
- package/dist/button/Button.svelte +7 -15
- package/dist/button/ButtonGroup.svelte +2 -2
- package/dist/button/IconButton.svelte +6 -41
- package/dist/button/SegmentedButton.svelte +9 -9
- package/dist/button/SplitButton.svelte +2 -2
- package/dist/button/types.d.ts +13 -11
- package/dist/card/Card.svelte +16 -7
- package/dist/card/types.d.ts +4 -4
- package/dist/carousel/Carousel.svelte +16 -12
- package/dist/carousel/CarouselItem.svelte +24 -15
- package/dist/carousel/carouselMorph.js +1 -1
- package/dist/carousel/types.d.ts +5 -4
- package/dist/checkbox/Checkbox.svelte +1 -1
- package/dist/checkbox/types.d.ts +2 -3
- package/dist/chip/AssistChip.svelte +1 -1
- package/dist/chip/ChipSet.svelte +1 -1
- package/dist/chip/FilterChip.svelte +1 -1
- package/dist/chip/InputChip.svelte +1 -1
- package/dist/chip/SuggestionChip.svelte +3 -3
- package/dist/chip/types.d.ts +5 -8
- package/dist/date-picker/Calendar.svelte +8 -7
- package/dist/date-picker/DatePickerDialog.svelte +2 -1
- package/dist/date-picker/DateRangePicker.svelte +3 -6
- package/dist/date-picker/DockedDatePicker.svelte +1 -1
- package/dist/date-picker/DockedDateTimePicker.svelte +1 -1
- package/dist/date-picker/SelectionList.svelte +2 -2
- package/dist/date-picker/SelectionList.svelte.d.ts +1 -1
- package/dist/date-picker/TimeColumn.svelte +2 -2
- package/dist/date-picker/TimeColumn.svelte.d.ts +1 -1
- package/dist/date-picker/YearGrid.svelte +1 -1
- package/dist/date-picker/internalTypes.d.ts +7 -0
- package/dist/date-picker/internalTypes.js +1 -0
- package/dist/date-picker/types.d.ts +10 -44
- package/dist/dialog/Dialog.svelte +3 -4
- package/dist/divider/Divider.svelte +1 -1
- package/dist/fab/ExtendedFab.svelte +5 -9
- package/dist/fab/Fab.svelte +5 -10
- package/dist/fab/FabMenu.svelte +7 -7
- package/dist/icons/Icon.svelte +1 -1
- package/dist/internal/elementTag.d.ts +26 -0
- package/dist/internal/elementTag.js +23 -0
- package/dist/internal/fieldTypes.d.ts +24 -0
- package/dist/internal/fieldTypes.js +1 -0
- package/dist/list/Item.svelte +17 -6
- package/dist/list/List.svelte +1 -1
- package/dist/list/ListItem.svelte +1 -1
- package/dist/list/types.d.ts +7 -6
- package/dist/loading-indicator/LoadingIndicator.svelte +2 -2
- package/dist/menu/Menu.svelte +1 -1
- package/dist/menu/MenuItem.svelte +8 -4
- package/dist/navigation-bar/NavigationBar.svelte +1 -1
- package/dist/navigation-bar/NavigationBarItem.svelte +6 -7
- package/dist/navigation-drawer/NavigationDrawer.svelte +9 -7
- package/dist/navigation-drawer/NavigationDrawerItem.svelte +2 -3
- package/dist/navigation-drawer/types.d.ts +6 -2
- package/dist/navigation-rail/NavigationRail.svelte +1 -1
- package/dist/navigation-rail/NavigationRailItem.svelte +3 -3
- package/dist/progress/CircularProgress.svelte +10 -4
- package/dist/progress/LinearProgress.svelte +2 -2
- package/dist/radio/Radio.svelte +2 -2
- package/dist/radio/types.d.ts +2 -3
- package/dist/ripple/Ripple.svelte +1 -1
- package/dist/search/Search.svelte +2 -2
- package/dist/select/NativeSelect.svelte +4 -2
- package/dist/select/Option.svelte +1 -1
- package/dist/select/Select.svelte +42 -20
- package/dist/select/types.d.ts +4 -8
- package/dist/shared/types.d.ts +9 -0
- package/dist/shared/types.js +1 -0
- package/dist/sheet/Sheet.svelte +16 -4
- package/dist/slider/Slider.svelte +4 -3
- package/dist/slider/types.d.ts +2 -4
- package/dist/snackbar/Snackbar.svelte +7 -4
- package/dist/switch/Switch.svelte +12 -7
- package/dist/switch/types.d.ts +2 -4
- package/dist/tabs/Tab.svelte +2 -2
- package/dist/tabs/Tabs.svelte +2 -2
- package/dist/text-field/TextField.svelte +1 -1
- package/dist/text-field/types.d.ts +1 -21
- package/dist/themes/defaultTheme.css +1 -0
- package/dist/time-picker/ClockDial.svelte +3 -3
- package/dist/time-picker/DockedTimePicker.svelte +1 -1
- package/dist/time-picker/PeriodSelector.svelte +4 -7
- package/dist/time-picker/PeriodSelector.svelte.d.ts +1 -1
- package/dist/time-picker/TimeInputs.svelte +1 -1
- package/dist/time-picker/TimeInputs.svelte.d.ts +1 -1
- package/dist/time-picker/TimePickerDialog.svelte +1 -1
- package/dist/time-picker/TimePickerPanel.svelte +4 -2
- package/dist/time-picker/TimePickerPanel.svelte.d.ts +1 -1
- package/dist/time-picker/TimeSelectors.svelte +2 -2
- package/dist/time-picker/TimeSelectors.svelte.d.ts +1 -1
- package/dist/time-picker/internalTypes.d.ts +76 -0
- package/dist/time-picker/internalTypes.js +1 -0
- package/dist/time-picker/types.d.ts +7 -95
- package/dist/toolbar/Toolbar.svelte +9 -9
- package/dist/tooltip/RichTooltip.svelte +2 -2
- package/dist/tooltip/Tooltip.svelte +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.js +34 -33
- package/package.json +49 -49
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { arrowKeyNav } from '../keyboard-nav.js'
|
|
3
3
|
import { reducedMotion } from '../media.js'
|
|
4
4
|
import type { Attachment } from 'svelte/attachments'
|
|
5
|
-
import { carouselMorph, scrollTimelines } from './carouselMorph.
|
|
5
|
+
import { carouselMorph, scrollTimelines } from './carouselMorph.ts'
|
|
6
6
|
import { setCarouselContext } from './context.js'
|
|
7
|
-
import type { CarouselContext, CarouselItemElement, CarouselProps } from './types.
|
|
7
|
+
import type { CarouselContext, CarouselItemElement, CarouselProps } from './types.ts'
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
variant = 'multi-browse',
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
let snapPoints = $state<HTMLDivElement>()
|
|
27
27
|
let items = $state.raw<CarouselItemElement[]>([])
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let axis = $derived(orientation ?? (variant === 'full-screen' ? 'vertical' : 'horizontal'))
|
|
30
|
+
let vertical = $derived(axis === 'vertical')
|
|
31
|
+
let snapping = $derived(snap ?? variant !== 'uncontained')
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
let keylined = $derived(variant === 'multi-browse' || variant === 'hero' ? variant : undefined)
|
|
34
|
+
let morphing = $derived(!!keylined && scrollTimelines && !reducedMotion.current)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
let cropping = $derived(variant === 'uncontained' && !reducedMotion.current)
|
|
37
37
|
|
|
38
38
|
const collectItems: Attachment<HTMLElement> = (node) => {
|
|
39
39
|
const read = () => {
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
return () => observer.disconnect()
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
let morph = $derived(
|
|
60
60
|
morphing && keylined
|
|
61
61
|
? carouselMorph({ variant: keylined, alignment, vertical, items, track, metrics, uid })
|
|
62
62
|
: undefined,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
let arrowHandler = $derived(arrowKeyNav('.np-carousel-item', axis, { wrap: false }))
|
|
66
66
|
|
|
67
67
|
const handleKeydown = (
|
|
68
68
|
event: KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement },
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
if (!event.defaultPrevented) arrowHandler(event)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
let places = $derived(new Map(items.map((item, index) => [item, index + 1])))
|
|
75
75
|
|
|
76
76
|
const handleFocusIn = (event: FocusEvent) => {
|
|
77
77
|
const item = (event.target as HTMLElement | null)?.closest<HTMLElement>('.np-carousel-item')
|
|
@@ -195,6 +195,10 @@
|
|
|
195
195
|
padding-block: var(--_cross);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
.np-carousel-uncontained.np-carousel-horizontal .np-carousel-track {
|
|
199
|
+
padding-inline-end: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
198
202
|
.np-carousel-vertical .np-carousel-track {
|
|
199
203
|
flex-direction: column;
|
|
200
204
|
padding-block: var(--_pad);
|
|
@@ -208,7 +212,7 @@
|
|
|
208
212
|
|
|
209
213
|
.np-carousel-full-screen {
|
|
210
214
|
--np-carousel-padding: 0px;
|
|
211
|
-
--_gap:
|
|
215
|
+
--_gap: var(--np-carousel-item-spacing, 1rem);
|
|
212
216
|
--_cross: 0px;
|
|
213
217
|
--np-carousel-item-container-shape: 0px;
|
|
214
218
|
--np-carousel-snap-stop: always;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '../internal/focus-ring.css'
|
|
3
3
|
import { pressMorph } from '../press.svelte.js'
|
|
4
|
+
import { buttonType, elementTag } from '../internal/elementTag.js'
|
|
4
5
|
import Ripple from '../ripple/Ripple.svelte'
|
|
5
|
-
import { minVisibleFraction } from './carouselStrategy.
|
|
6
|
+
import { minVisibleFraction } from './carouselStrategy.ts'
|
|
6
7
|
import { getCarouselContext } from './context.js'
|
|
7
|
-
import type { CarouselItemElement, CarouselItemProps } from './types.
|
|
8
|
+
import type { CarouselItemElement, CarouselItemProps } from './types.ts'
|
|
8
9
|
|
|
9
10
|
let {
|
|
10
11
|
type,
|
|
11
12
|
label,
|
|
12
13
|
image,
|
|
14
|
+
imageAlt,
|
|
13
15
|
aspectRatio,
|
|
14
16
|
disabled = false,
|
|
15
17
|
children,
|
|
@@ -19,13 +21,15 @@
|
|
|
19
21
|
...attributes
|
|
20
22
|
}: CarouselItemProps = $props()
|
|
21
23
|
|
|
24
|
+
let tag = $derived(elementTag(attributes, type))
|
|
25
|
+
|
|
22
26
|
const carouselContext = getCarouselContext()
|
|
23
27
|
const press = pressMorph()
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
let total = $derived(carouselContext.items.length)
|
|
30
|
+
let position = $derived(element ? carouselContext.position(element) : 0)
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
let itemStyle = $derived(
|
|
29
33
|
[
|
|
30
34
|
`--_visible:${minVisibleFraction(aspectRatio)}`,
|
|
31
35
|
aspectRatio != null && `--_aspect:${aspectRatio}`,
|
|
@@ -35,26 +39,31 @@
|
|
|
35
39
|
.join(';'),
|
|
36
40
|
)
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
let accessibleName = $derived(
|
|
39
43
|
attributes['aria-label'] ??
|
|
40
|
-
(
|
|
44
|
+
(tag !== 'div' && label && position > 0
|
|
41
45
|
? carouselContext.itemLabel(label, position, total)
|
|
42
46
|
: undefined),
|
|
43
47
|
)
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
let labelHidden = $derived(accessibleName !== undefined)
|
|
46
50
|
|
|
47
51
|
const handlePointerdown = (
|
|
48
52
|
event: PointerEvent & { currentTarget: EventTarget & CarouselItemElement },
|
|
49
53
|
) => {
|
|
50
54
|
onpointerdown?.(event)
|
|
51
|
-
if (!disabled &&
|
|
55
|
+
if (!disabled && tag !== 'div') press.press()
|
|
52
56
|
}
|
|
53
57
|
</script>
|
|
54
58
|
|
|
55
59
|
{#snippet content()}
|
|
56
60
|
{#if image}
|
|
57
|
-
<div
|
|
61
|
+
<div
|
|
62
|
+
class="np-carousel-item-image"
|
|
63
|
+
style="background-image: url({image})"
|
|
64
|
+
role={imageAlt ? 'img' : undefined}
|
|
65
|
+
aria-label={imageAlt || undefined}
|
|
66
|
+
></div>
|
|
58
67
|
{/if}
|
|
59
68
|
{#if children}
|
|
60
69
|
{@render children()}
|
|
@@ -62,12 +71,12 @@
|
|
|
62
71
|
{#if label}
|
|
63
72
|
<span class="np-carousel-item-label" aria-hidden={labelHidden || undefined}>{label}</span>
|
|
64
73
|
{/if}
|
|
65
|
-
{#if !disabled &&
|
|
74
|
+
{#if !disabled && tag !== 'div'}
|
|
66
75
|
<Ripple />
|
|
67
76
|
{/if}
|
|
68
77
|
{/snippet}
|
|
69
78
|
|
|
70
|
-
{#if
|
|
79
|
+
{#if tag === 'div'}
|
|
71
80
|
<div
|
|
72
81
|
{...attributes}
|
|
73
82
|
bind:this={element}
|
|
@@ -83,11 +92,11 @@
|
|
|
83
92
|
>
|
|
84
93
|
{@render content()}
|
|
85
94
|
</div>
|
|
86
|
-
{:else if
|
|
95
|
+
{:else if tag === 'button'}
|
|
87
96
|
<button
|
|
88
97
|
{...attributes}
|
|
89
98
|
bind:this={element}
|
|
90
|
-
type=
|
|
99
|
+
type={buttonType(type)}
|
|
91
100
|
{disabled}
|
|
92
101
|
aria-disabled={disabled}
|
|
93
102
|
aria-label={accessibleName}
|
|
@@ -103,7 +112,7 @@
|
|
|
103
112
|
>
|
|
104
113
|
{@render content()}
|
|
105
114
|
</button>
|
|
106
|
-
{:else
|
|
115
|
+
{:else}
|
|
107
116
|
<a
|
|
108
117
|
{...attributes}
|
|
109
118
|
bind:this={element}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arrange, itemKeyframes, morphTrack, notches } from
|
|
1
|
+
import { arrange, itemKeyframes, morphTrack, notches } from './carouselStrategy.ts';
|
|
2
2
|
export const scrollTimelines = typeof CSS !== 'undefined' && CSS.supports('animation-timeline', 'scroll(nearest inline)');
|
|
3
3
|
const px = (value) => `${Math.round(value * 100) / 100}px`;
|
|
4
4
|
const lengthOf = (value, fallback) => {
|
package/dist/carousel/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ElementKindProps } from '../internal/elementTag.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
4
|
export type CarouselVariant = 'multi-browse' | 'uncontained' | 'hero' | 'full-screen';
|
|
4
5
|
export type CarouselAlignment = 'start' | 'center';
|
|
5
6
|
export type CarouselOrientation = 'horizontal' | 'vertical';
|
|
@@ -15,12 +16,12 @@ export interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
16
|
scroller?: HTMLDivElement;
|
|
16
17
|
element?: HTMLDivElement;
|
|
17
18
|
}
|
|
18
|
-
export interface CarouselItemProps extends
|
|
19
|
-
type: 'text' | 'button' | 'link';
|
|
19
|
+
export interface CarouselItemProps extends ElementKindProps<CarouselItemElement> {
|
|
20
20
|
label?: string | null;
|
|
21
21
|
image?: string | null;
|
|
22
|
+
/** Describes `image` for assistive technology. Leave it out for a decorative image. */
|
|
23
|
+
imageAlt?: string;
|
|
22
24
|
aspectRatio?: number | null;
|
|
23
|
-
disabled?: boolean | null;
|
|
24
25
|
children?: Snippet;
|
|
25
26
|
element?: CarouselItemElement;
|
|
26
27
|
}
|
package/dist/checkbox/types.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type { Issue } from '../shared/types.js';
|
|
1
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
3
|
export interface CheckboxProps extends Omit<HTMLInputAttributes, 'type'> {
|
|
3
4
|
element?: HTMLElement;
|
|
4
5
|
group?: (string | number)[] | null;
|
|
5
|
-
issues?:
|
|
6
|
-
message: string;
|
|
7
|
-
}[];
|
|
6
|
+
issues?: Issue[];
|
|
8
7
|
}
|
package/dist/chip/ChipSet.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
|
|
3
|
-
import type { ChipSetProps } from './types.
|
|
3
|
+
import type { ChipSetProps } from './types.ts'
|
|
4
4
|
|
|
5
5
|
let { children, element = $bindable(), ...attributes }: ChipSetProps = $props()
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import CheckIcon from '../icons/CheckIcon.svelte'
|
|
5
5
|
import CloseIcon from '../icons/CloseIcon.svelte'
|
|
6
6
|
import Ripple from '../ripple/Ripple.svelte'
|
|
7
|
-
import type { FilterChipProps } from './types.
|
|
7
|
+
import type { FilterChipProps } from './types.ts'
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
selected = $bindable(),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import IconButton from '../button/IconButton.svelte'
|
|
4
4
|
import CloseIcon from '../icons/CloseIcon.svelte'
|
|
5
5
|
import Ripple from '../ripple/Ripple.svelte'
|
|
6
|
-
import type { InputChipProps } from './types.
|
|
6
|
+
import type { InputChipProps } from './types.ts'
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
selected = $bindable(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Button from '../button/Button.svelte'
|
|
3
|
-
import type { SuggestionChipProps } from './types.
|
|
3
|
+
import type { SuggestionChipProps } from './types.ts'
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
variant = 'outlined',
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<Button
|
|
15
|
-
--np-elevated-button-label-text-color="var(--np-suggestion-chip-label-text-color, var(--np-color-on-surface))"
|
|
16
|
-
--np-outlined-button-label-text-color="var(--np-suggestion-chip-label-text-color, var(--np-color-on-surface))"
|
|
15
|
+
--np-elevated-button-label-text-color="var(--np-suggestion-chip-label-text-color, var(--np-color-on-surface-variant))"
|
|
16
|
+
--np-outlined-button-label-text-color="var(--np-suggestion-chip-label-text-color, var(--np-color-on-surface-variant))"
|
|
17
17
|
--np-outlined-button-outline-color="var(--np-suggestion-chip-outline-color, var(--np-color-outline-variant))"
|
|
18
18
|
--np-button-padding="1rem"
|
|
19
19
|
--np-button-shape="0.5rem"
|
package/dist/chip/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Issue } from '../shared/types.js';
|
|
1
2
|
import type { ButtonElement } from '../button/types.js';
|
|
2
3
|
import type { Snippet } from 'svelte';
|
|
3
4
|
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes, MouseEventHandler } from 'svelte/elements';
|
|
@@ -16,7 +17,7 @@ export type SuggestionChipProps = Omit<AssistChipProps, 'icon'>;
|
|
|
16
17
|
export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
18
|
selected?: boolean;
|
|
18
19
|
removable?: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
+
disabled?: boolean | null;
|
|
20
21
|
variant?: 'outlined' | 'elevated';
|
|
21
22
|
label?: string;
|
|
22
23
|
icon?: Snippet;
|
|
@@ -27,13 +28,11 @@ export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
27
28
|
group?: (string | number)[] | null;
|
|
28
29
|
defaultSelected?: boolean | null;
|
|
29
30
|
onremove?: MouseEventHandler<ButtonElement>;
|
|
30
|
-
issues?:
|
|
31
|
-
message: string;
|
|
32
|
-
}[];
|
|
31
|
+
issues?: Issue[];
|
|
33
32
|
}
|
|
34
33
|
export interface InputChipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onclick'> {
|
|
35
34
|
selected?: boolean;
|
|
36
|
-
disabled?: boolean;
|
|
35
|
+
disabled?: boolean | null;
|
|
37
36
|
label?: string;
|
|
38
37
|
icon?: Snippet;
|
|
39
38
|
removeAriaLabel?: string;
|
|
@@ -43,9 +42,7 @@ export interface InputChipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
|
|
43
42
|
value?: string | number;
|
|
44
43
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
45
44
|
onremove?: MouseEventHandler<ButtonElement>;
|
|
46
|
-
issues?:
|
|
47
|
-
message: string;
|
|
48
|
-
}[];
|
|
45
|
+
issues?: Issue[];
|
|
49
46
|
}
|
|
50
47
|
export interface ChipSetContext {
|
|
51
48
|
chips: {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
today as getToday,
|
|
22
22
|
} from './dateUtils.js'
|
|
23
23
|
import { afterTwoFrames } from '../animation.js'
|
|
24
|
-
import type { CalendarProps } from './types.
|
|
24
|
+
import type { CalendarProps } from './types.ts'
|
|
25
25
|
|
|
26
26
|
let {
|
|
27
27
|
month,
|
|
@@ -212,13 +212,14 @@
|
|
|
212
212
|
{#if !inMonth && !adjacentMonthDays}
|
|
213
213
|
<td role="gridcell" class="np-calendar-cell"></td>
|
|
214
214
|
{:else}
|
|
215
|
-
{
|
|
215
|
+
{let isSelected = $derived(
|
|
216
216
|
isSameDay(date, selected) ||
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
{
|
|
221
|
-
{
|
|
217
|
+
isSameDay(date, rangeStart) ||
|
|
218
|
+
isSameDay(date, rangeEnd),
|
|
219
|
+
)}
|
|
220
|
+
{let isToday = $derived(isSameDay(date, todayValue))}
|
|
221
|
+
{let enabled = $derived(isEnabled(date))}
|
|
222
|
+
{let between = $derived(inRange(date))}
|
|
222
223
|
<td
|
|
223
224
|
role="gridcell"
|
|
224
225
|
aria-selected={isSelected}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
toISODate,
|
|
33
33
|
today as getToday,
|
|
34
34
|
} from './dateUtils.js'
|
|
35
|
-
import type { DatePickerDialogProps, ISODate } from './types.
|
|
35
|
+
import type { DatePickerDialogProps, ISODate } from './types.ts'
|
|
36
36
|
|
|
37
37
|
let {
|
|
38
38
|
value = $bindable(),
|
|
@@ -400,6 +400,7 @@
|
|
|
400
400
|
|
|
401
401
|
.np-date-picker-dialog-headline {
|
|
402
402
|
margin: 0;
|
|
403
|
+
color: var(--np-color-on-surface);
|
|
403
404
|
font-size: 2rem;
|
|
404
405
|
line-height: 2.5rem;
|
|
405
406
|
font-weight: 400;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
toISODate,
|
|
23
23
|
today as getToday,
|
|
24
24
|
} from './dateUtils.js'
|
|
25
|
-
import type { DateRange, DateRangePickerProps } from './types.
|
|
25
|
+
import type { DateRange, DateRangePickerProps } from './types.ts'
|
|
26
26
|
|
|
27
27
|
let {
|
|
28
28
|
value = $bindable({}),
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
--np-dialog-elevation: none;
|
|
298
298
|
--np-dialog-container-color: var(
|
|
299
299
|
--np-date-range-picker-container-color,
|
|
300
|
-
var(--np-color-surface)
|
|
300
|
+
var(--np-color-surface-container-high)
|
|
301
301
|
);
|
|
302
302
|
--np-dialog-container-shape: var(
|
|
303
303
|
--np-date-range-picker-container-shape,
|
|
@@ -368,6 +368,7 @@
|
|
|
368
368
|
|
|
369
369
|
.np-date-range-picker-headline {
|
|
370
370
|
margin: 0;
|
|
371
|
+
color: var(--np-color-on-surface);
|
|
371
372
|
display: flex;
|
|
372
373
|
gap: 0.5rem;
|
|
373
374
|
font-size: 1.375rem;
|
|
@@ -419,10 +420,6 @@
|
|
|
419
420
|
--np-dialog-inset: 2rem 1rem;
|
|
420
421
|
--np-dialog-max-height: calc(100dvh - 3rem);
|
|
421
422
|
--np-dialog-elevation: var(--np-elevation-3);
|
|
422
|
-
--np-dialog-container-color: var(
|
|
423
|
-
--np-date-range-picker-container-color,
|
|
424
|
-
var(--np-color-surface-container-high)
|
|
425
|
-
);
|
|
426
423
|
--np-dialog-container-shape: var(
|
|
427
424
|
--np-date-range-picker-container-shape,
|
|
428
425
|
var(--np-shape-corner-extra-large)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { arrowKeyNav } from '../keyboard-nav.js'
|
|
4
4
|
import Ripple from '../ripple/Ripple.svelte'
|
|
5
5
|
import { revealSelected, tabStop } from './optionList.js'
|
|
6
|
-
import type { TimeColumnProps } from './
|
|
6
|
+
import type { TimeColumnProps } from './internalTypes.ts'
|
|
7
7
|
|
|
8
8
|
let { options, value, onselect, ...attributes }: TimeColumnProps = $props()
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
onkeydown={handleKeydown}
|
|
22
22
|
>
|
|
23
23
|
{#each options as option (option.value)}
|
|
24
|
-
{
|
|
24
|
+
{let selected = $derived(option.value === value)}
|
|
25
25
|
<button
|
|
26
26
|
{@attach selected && reveal}
|
|
27
27
|
type="button"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TimeColumnProps } from './
|
|
1
|
+
import type { TimeColumnProps } from './internalTypes.ts';
|
|
2
2
|
declare const SelectionList: import("svelte").Component<TimeColumnProps, {}, "">;
|
|
3
3
|
type SelectionList = ReturnType<typeof SelectionList>;
|
|
4
4
|
export default SelectionList;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { arrowKeyNav } from '../keyboard-nav.js'
|
|
3
3
|
import Ripple from '../ripple/Ripple.svelte'
|
|
4
4
|
import { revealSelected, tabStop } from './optionList.js'
|
|
5
|
-
import type { TimeColumnProps } from './
|
|
5
|
+
import type { TimeColumnProps } from './internalTypes.ts'
|
|
6
6
|
|
|
7
7
|
let { options, value, onselect, ...attributes }: TimeColumnProps = $props()
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
onkeydown={handleKeydown}
|
|
21
21
|
>
|
|
22
22
|
{#each options as option (option.value)}
|
|
23
|
-
{
|
|
23
|
+
{let selected = $derived(option.value === value)}
|
|
24
24
|
<button
|
|
25
25
|
{@attach selected && reveal}
|
|
26
26
|
type="button"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TimeColumnProps } from './
|
|
1
|
+
import type { TimeColumnProps } from './internalTypes.ts';
|
|
2
2
|
declare const TimeColumn: import("svelte").Component<TimeColumnProps, {}, "">;
|
|
3
3
|
type TimeColumn = ReturnType<typeof TimeColumn>;
|
|
4
4
|
export default TimeColumn;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { TimeOption } from './types.ts';
|
|
3
|
+
export interface TimeColumnProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onselect'> {
|
|
4
|
+
options: TimeOption[];
|
|
5
|
+
value?: number;
|
|
6
|
+
onselect?: (value: number) => void;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Issue } from '../shared/types.js';
|
|
1
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { DockedFieldProps } from '../internal/fieldTypes.js';
|
|
2
4
|
import type { TextFieldElement } from '../text-field/types.js';
|
|
3
|
-
import type { HTMLAttributes
|
|
5
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
6
|
export type ISODate = string;
|
|
5
7
|
export type ISODateTime = string;
|
|
6
8
|
export interface DateRange {
|
|
@@ -27,26 +29,13 @@ interface MonthStepperLabelProps {
|
|
|
27
29
|
nextMonthLabel?: string;
|
|
28
30
|
previousMonthLabel?: string;
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
value?: ISODate | number | null;
|
|
32
|
+
interface DockedDateFieldProps extends DockedFieldProps {
|
|
32
33
|
displayMonth?: ISODate;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
form?: string;
|
|
37
|
-
required?: boolean;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
readonly?: boolean;
|
|
40
|
-
variant?: 'outlined' | 'filled';
|
|
41
|
-
issues?: {
|
|
42
|
-
message: string;
|
|
43
|
-
}[];
|
|
34
|
+
}
|
|
35
|
+
export interface DockedDatePickerProps extends Omit<HTMLAttributes<TextFieldElement>, 'onchange'>, DatePickerLocaleProps, DatePickerRangeProps, DatePickerCommonLabelProps, MonthStepperLabelProps, DockedDateFieldProps {
|
|
36
|
+
value?: ISODate | number | null;
|
|
44
37
|
defaultValue?: ISODate | number | null;
|
|
45
38
|
type?: 'date';
|
|
46
|
-
noAsterisk?: boolean;
|
|
47
|
-
autocomplete?: HTMLInputAttributes['autocomplete'];
|
|
48
|
-
label?: string;
|
|
49
|
-
supportingText?: string;
|
|
50
39
|
nextYearLabel?: string;
|
|
51
40
|
previousYearLabel?: string;
|
|
52
41
|
selectMonthLabel?: string;
|
|
@@ -55,28 +44,12 @@ export interface DockedDatePickerProps extends Omit<HTMLAttributes<TextFieldElem
|
|
|
55
44
|
invalidDateMessage?: string;
|
|
56
45
|
onchange?: (value: ISODate | undefined) => void;
|
|
57
46
|
}
|
|
58
|
-
export interface DockedDateTimePickerProps extends Omit<HTMLAttributes<TextFieldElement>, 'onchange'>, DatePickerLocaleProps, Omit<DatePickerRangeProps, 'min' | 'max'>, DatePickerCommonLabelProps, MonthStepperLabelProps {
|
|
47
|
+
export interface DockedDateTimePickerProps extends Omit<HTMLAttributes<TextFieldElement>, 'onchange'>, DatePickerLocaleProps, Omit<DatePickerRangeProps, 'min' | 'max'>, DatePickerCommonLabelProps, MonthStepperLabelProps, DockedDateFieldProps {
|
|
59
48
|
value?: ISODateTime | number | null;
|
|
60
|
-
|
|
61
|
-
open?: boolean;
|
|
62
|
-
element?: HTMLSpanElement;
|
|
49
|
+
defaultValue?: ISODateTime | number | null;
|
|
63
50
|
min?: ISODate | ISODateTime;
|
|
64
51
|
max?: ISODate | ISODateTime;
|
|
65
|
-
name?: string;
|
|
66
|
-
form?: string;
|
|
67
|
-
required?: boolean;
|
|
68
|
-
disabled?: boolean;
|
|
69
|
-
readonly?: boolean;
|
|
70
|
-
variant?: 'outlined' | 'filled';
|
|
71
|
-
issues?: {
|
|
72
|
-
message: string;
|
|
73
|
-
}[];
|
|
74
|
-
defaultValue?: ISODateTime | number | null;
|
|
75
52
|
type?: 'datetime-local';
|
|
76
|
-
noAsterisk?: boolean;
|
|
77
|
-
autocomplete?: HTMLInputAttributes['autocomplete'];
|
|
78
|
-
label?: string;
|
|
79
|
-
supportingText?: string;
|
|
80
53
|
minuteStep?: number;
|
|
81
54
|
hour12?: boolean;
|
|
82
55
|
defaultTime?: string;
|
|
@@ -96,11 +69,6 @@ export interface TimeOption {
|
|
|
96
69
|
label: string;
|
|
97
70
|
disabled?: boolean;
|
|
98
71
|
}
|
|
99
|
-
export interface TimeColumnProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onselect'> {
|
|
100
|
-
options: TimeOption[];
|
|
101
|
-
value?: number;
|
|
102
|
-
onselect?: (value: number) => void;
|
|
103
|
-
}
|
|
104
72
|
export interface DatePickerDialogProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'onchange'>, DatePickerLocaleProps, DatePickerRangeProps, DatePickerCommonLabelProps, MonthStepperLabelProps {
|
|
105
73
|
value?: ISODate | null;
|
|
106
74
|
displayMonth?: ISODate;
|
|
@@ -113,9 +81,7 @@ export interface DatePickerDialogProps extends Omit<HTMLAttributes<HTMLDialogEle
|
|
|
113
81
|
modeToggle?: boolean;
|
|
114
82
|
label?: string;
|
|
115
83
|
supportingText?: string;
|
|
116
|
-
issues?:
|
|
117
|
-
message: string;
|
|
118
|
-
}[];
|
|
84
|
+
issues?: Issue[];
|
|
119
85
|
selectYearLabel?: string;
|
|
120
86
|
calendarModeLabel?: string;
|
|
121
87
|
inputModeLabel?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Divider from '../divider/Divider.svelte'
|
|
3
3
|
import { syncOpenEffect } from '../popover.svelte.js'
|
|
4
|
-
import type { DialogProps } from './types.
|
|
4
|
+
import type { DialogProps } from './types.ts'
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
element = $bindable(),
|
|
@@ -40,14 +40,12 @@
|
|
|
40
40
|
<dialog
|
|
41
41
|
bind:this={element}
|
|
42
42
|
{...attributes}
|
|
43
|
-
tabindex="-1"
|
|
44
43
|
closedby="any"
|
|
45
44
|
aria-labelledby={ariaLabelledby ?? (headline ? `${uid}-dialog-headline` : undefined)}
|
|
46
45
|
aria-describedby={supportingText ? `${uid}-dialog-supporting-text` : undefined}
|
|
47
46
|
class={['np-dialog-container', !quick && 'np-animate', attributes.class]}
|
|
48
47
|
ontoggle={(event) => {
|
|
49
48
|
open = event.newState === 'open'
|
|
50
|
-
if (event.newState === 'open') element?.focus()
|
|
51
49
|
ontoggle?.(event)
|
|
52
50
|
}}
|
|
53
51
|
onclick={(event) => {
|
|
@@ -114,7 +112,7 @@
|
|
|
114
112
|
|
|
115
113
|
.np-dialog {
|
|
116
114
|
border: 0;
|
|
117
|
-
background-color: var(--np-dialog-container-color, var(--np-color-surface));
|
|
115
|
+
background-color: var(--np-dialog-container-color, var(--np-color-surface-container-high));
|
|
118
116
|
color: var(--np-color-on-surface);
|
|
119
117
|
padding: var(--np-dialog-padding, 1.5rem);
|
|
120
118
|
border-radius: var(--np-dialog-container-shape, var(--np-shape-corner-extra-large));
|
|
@@ -129,6 +127,7 @@
|
|
|
129
127
|
|
|
130
128
|
.np-dialog-scroller {
|
|
131
129
|
overflow-y: auto;
|
|
130
|
+
overscroll-behavior: contain;
|
|
132
131
|
display: flex;
|
|
133
132
|
flex: 1 1 0%;
|
|
134
133
|
flex-direction: column;
|