noph-ui 0.43.1 → 0.44.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.
Files changed (60) hide show
  1. package/dist/autocomplete/AutoComplete.svelte.d.ts +1 -1
  2. package/dist/badge/Badge.svelte +6 -1
  3. package/dist/badge/Badge.svelte.d.ts +2 -5
  4. package/dist/badge/types.d.ts +6 -0
  5. package/dist/badge/types.js +1 -0
  6. package/dist/card/Card.svelte +1 -1
  7. package/dist/checkbox/Checkbox.svelte +3 -2
  8. package/dist/chip/ChipSet.svelte +3 -2
  9. package/dist/chip/ChipSet.svelte.d.ts +1 -1
  10. package/dist/chip/FilterChip.svelte.d.ts +1 -1
  11. package/dist/chip/types.d.ts +2 -1
  12. package/dist/date-picker/DatePickerDialog.svelte.d.ts +1 -1
  13. package/dist/date-picker/DateRangePicker.svelte.d.ts +1 -1
  14. package/dist/date-picker/DockedDatePicker.svelte.d.ts +1 -1
  15. package/dist/date-picker/DockedDateTimePicker.svelte.d.ts +1 -1
  16. package/dist/dialog/Dialog.svelte +1 -1
  17. package/dist/divider/Divider.svelte +6 -2
  18. package/dist/divider/Divider.svelte.d.ts +1 -1
  19. package/dist/divider/types.d.ts +1 -0
  20. package/dist/icons/Icon.svelte +1 -6
  21. package/dist/icons/Icon.svelte.d.ts +1 -6
  22. package/dist/icons/types.d.ts +6 -0
  23. package/dist/icons/types.js +1 -0
  24. package/dist/list/Item.svelte +5 -0
  25. package/dist/list/Item.svelte.d.ts +1 -1
  26. package/dist/list/ListItem.svelte +2 -2
  27. package/dist/list/ListItem.svelte.d.ts +1 -1
  28. package/dist/list/types.d.ts +1 -0
  29. package/dist/loading-indicator/LoadingIndicator.svelte +7 -2
  30. package/dist/loading-indicator/LoadingIndicator.svelte.d.ts +1 -1
  31. package/dist/loading-indicator/types.d.ts +3 -2
  32. package/dist/menu/Menu.svelte +1 -1
  33. package/dist/menu/MenuItem.svelte +2 -2
  34. package/dist/menu/MenuItem.svelte.d.ts +1 -1
  35. package/dist/navigation-drawer/NavigationDrawerItem.svelte +3 -0
  36. package/dist/navigation-drawer/NavigationDrawerItem.svelte.d.ts +1 -1
  37. package/dist/navigation-drawer/types.d.ts +1 -0
  38. package/dist/navigation-rail/NavigationRail.svelte +9 -3
  39. package/dist/navigation-rail/NavigationRail.svelte.d.ts +1 -1
  40. package/dist/navigation-rail/NavigationRailItem.svelte +9 -1
  41. package/dist/navigation-rail/NavigationRailItem.svelte.d.ts +1 -1
  42. package/dist/navigation-rail/types.d.ts +4 -1
  43. package/dist/progress/CircularProgress.svelte +4 -1
  44. package/dist/progress/CircularProgress.svelte.d.ts +1 -1
  45. package/dist/progress/LinearProgress.svelte +9 -1
  46. package/dist/progress/LinearProgress.svelte.d.ts +1 -1
  47. package/dist/progress/types.d.ts +3 -2
  48. package/dist/select/NativeSelect.svelte +13 -16
  49. package/dist/select/NativeSelect.svelte.d.ts +2 -12
  50. package/dist/select/Option.svelte +1 -7
  51. package/dist/select/Option.svelte.d.ts +1 -6
  52. package/dist/select/Select.svelte.d.ts +1 -1
  53. package/dist/select/types.d.ts +15 -1
  54. package/dist/slider/Slider.svelte.d.ts +1 -1
  55. package/dist/tabs/Tabs.svelte.d.ts +1 -1
  56. package/dist/text-field/TextField.svelte +17 -10
  57. package/dist/text-field/TextField.svelte.d.ts +1 -1
  58. package/dist/types.d.ts +2 -0
  59. package/dist/types.js +2 -0
  60. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import type { AutoCompleteProps } from './types.ts';
2
- declare const AutoComplete: import("svelte").Component<AutoCompleteProps, {}, "value" | "element" | "menuOpen">;
2
+ declare const AutoComplete: import("svelte").Component<AutoCompleteProps, {}, "element" | "value" | "menuOpen">;
3
3
  type AutoComplete = ReturnType<typeof AutoComplete>;
4
4
  export default AutoComplete;
@@ -1,14 +1,19 @@
1
1
  <script lang="ts">
2
- let { label, ariaLabel }: { label?: string | number; ariaLabel?: string } = $props()
2
+ import type { BadgeProps } from './types.js'
3
+
4
+ let { label, ariaLabel, element = $bindable(), ...attributes }: BadgeProps = $props()
3
5
  </script>
4
6
 
5
7
  <div
8
+ {...attributes}
6
9
  aria-hidden={ariaLabel ? undefined : 'true'}
7
10
  role={ariaLabel ? 'status' : undefined}
8
11
  aria-label={ariaLabel}
12
+ bind:this={element}
9
13
  class={[
10
14
  'np-badge-container',
11
15
  label === undefined ? 'np-badge-container-no-label' : 'np-badge-container-label',
16
+ attributes.class,
12
17
  ]}
13
18
  >
14
19
  {#if label !== undefined}
@@ -1,7 +1,4 @@
1
- type $$ComponentProps = {
2
- label?: string | number;
3
- ariaLabel?: string;
4
- };
5
- declare const Badge: import("svelte").Component<$$ComponentProps, {}, "">;
1
+ import type { BadgeProps } from './types.ts';
2
+ declare const Badge: import("svelte").Component<BadgeProps, {}, "element">;
6
3
  type Badge = ReturnType<typeof Badge>;
7
4
  export default Badge;
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
3
+ label?: string | number;
4
+ ariaLabel?: string;
5
+ element?: HTMLDivElement;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -66,8 +66,8 @@
66
66
  </div>
67
67
  {:else if type === 'button'}
68
68
  <button
69
- aria-disabled={disabled}
70
69
  {...attributes}
70
+ aria-disabled={disabled}
71
71
  type="button"
72
72
  bind:this={element}
73
73
  {disabled}
@@ -11,6 +11,7 @@
11
11
  issues,
12
12
  style,
13
13
  value,
14
+ 'aria-invalid': ariaInvalid,
14
15
  ...attributes
15
16
  }: CheckboxProps = $props()
16
17
 
@@ -64,7 +65,7 @@
64
65
  bind:this={inputEl}
65
66
  checked={groupChecked}
66
67
  {onchange}
67
- aria-invalid={hasError ? 'true' : undefined}
68
+ aria-invalid={hasError ? 'true' : ariaInvalid}
68
69
  aria-checked={indeterminate ? 'mixed' : undefined}
69
70
  />
70
71
  {:else}
@@ -76,7 +77,7 @@
76
77
  bind:indeterminate
77
78
  bind:checked
78
79
  bind:this={inputEl}
79
- aria-invalid={hasError ? 'true' : undefined}
80
+ aria-invalid={hasError ? 'true' : ariaInvalid}
80
81
  aria-checked={indeterminate ? 'mixed' : undefined}
81
82
  />
82
83
  {/if}
@@ -2,7 +2,7 @@
2
2
  import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
3
3
  import type { ChipSetProps } from './types.js'
4
4
 
5
- let { children, chipsCount, ...attributes }: ChipSetProps = $props()
5
+ let { children, chipsCount, element = $bindable(), ...attributes }: ChipSetProps = $props()
6
6
 
7
7
  const CHIP_SELECTOR = "input:not([type='hidden']), button, a[href]"
8
8
  const attach = rovingTabindex(CHIP_SELECTOR, {
@@ -13,12 +13,13 @@
13
13
  </script>
14
14
 
15
15
  <div
16
+ {...attributes}
17
+ bind:this={element}
16
18
  class={[
17
19
  'np-chip-set-wrapper',
18
20
  (chipsCount ?? 0) > 0 && 'np-chip-set-has-chips',
19
21
  attributes.class,
20
22
  ]}
21
- style={attributes.style}
22
23
  >
23
24
  {#if children}
24
25
  <div {@attach attach} class={['np-chip-set']} role="toolbar" tabindex="-1" {onkeydown}>
@@ -1,4 +1,4 @@
1
1
  import type { ChipSetProps } from './types.ts';
2
- declare const ChipSet: import("svelte").Component<ChipSetProps, {}, "">;
2
+ declare const ChipSet: import("svelte").Component<ChipSetProps, {}, "element">;
3
3
  type ChipSet = ReturnType<typeof ChipSet>;
4
4
  export default ChipSet;
@@ -1,5 +1,5 @@
1
1
  import '../internal/focus-ring.css';
2
2
  import type { FilterChipProps } from './types.ts';
3
- declare const FilterChip: import("svelte").Component<FilterChipProps, {}, "element" | "selected" | "group">;
3
+ declare const FilterChip: import("svelte").Component<FilterChipProps, {}, "element" | "group" | "selected">;
4
4
  type FilterChip = ReturnType<typeof FilterChip>;
5
5
  export default FilterChip;
@@ -3,13 +3,14 @@ import type { Snippet } from 'svelte';
3
3
  import type { HTMLAttributes, MouseEventHandler } from 'svelte/elements';
4
4
  export interface ChipSetProps extends HTMLAttributes<HTMLDivElement> {
5
5
  chipsCount?: number;
6
+ element?: HTMLDivElement;
6
7
  }
7
8
  export interface AssistChipProps extends Omit<ButtonProps, 'variant' | 'start' | 'end' | 'element'> {
8
9
  elevated?: boolean;
9
10
  disabled?: boolean;
10
11
  label?: string;
11
12
  icon?: Snippet;
12
- element?: HTMLDivElement;
13
+ element?: HTMLElement;
13
14
  }
14
15
  export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
15
16
  selected?: boolean;
@@ -1,4 +1,4 @@
1
1
  import type { DatePickerDialogProps } from './types.ts';
2
- declare const DatePickerDialog: import("svelte").Component<DatePickerDialogProps, {}, "value" | "element" | "displayMonth" | "open">;
2
+ declare const DatePickerDialog: import("svelte").Component<DatePickerDialogProps, {}, "element" | "value" | "displayMonth" | "open">;
3
3
  type DatePickerDialog = ReturnType<typeof DatePickerDialog>;
4
4
  export default DatePickerDialog;
@@ -1,4 +1,4 @@
1
1
  import type { DateRangePickerProps } from './types.ts';
2
- declare const DateRangePicker: import("svelte").Component<DateRangePickerProps, {}, "value" | "element" | "open">;
2
+ declare const DateRangePicker: import("svelte").Component<DateRangePickerProps, {}, "element" | "value" | "open">;
3
3
  type DateRangePicker = ReturnType<typeof DateRangePicker>;
4
4
  export default DateRangePicker;
@@ -1,4 +1,4 @@
1
1
  import type { DockedDatePickerProps } from './types.ts';
2
- declare const DockedDatePicker: import("svelte").Component<DockedDatePickerProps, {}, "value" | "element" | "displayMonth" | "open">;
2
+ declare const DockedDatePicker: import("svelte").Component<DockedDatePickerProps, {}, "element" | "value" | "displayMonth" | "open">;
3
3
  type DockedDatePicker = ReturnType<typeof DockedDatePicker>;
4
4
  export default DockedDatePicker;
@@ -1,4 +1,4 @@
1
1
  import type { DockedDateTimePickerProps } from './types.ts';
2
- declare const DockedDateTimePicker: import("svelte").Component<DockedDateTimePickerProps, {}, "value" | "element" | "displayMonth" | "open">;
2
+ declare const DockedDateTimePicker: import("svelte").Component<DockedDateTimePickerProps, {}, "element" | "value" | "displayMonth" | "open">;
3
3
  type DockedDateTimePicker = ReturnType<typeof DockedDateTimePicker>;
4
4
  export default DockedDateTimePicker;
@@ -59,8 +59,8 @@
59
59
 
60
60
  <div
61
61
  bind:this={element}
62
- popover="auto"
63
62
  {...attributes}
63
+ popover="auto"
64
64
  ontoggle={(event) => {
65
65
  if (event.newState === 'open') {
66
66
  trapFocus()
@@ -1,10 +1,14 @@
1
1
  <script lang="ts">
2
2
  import type { DividerProps } from './types.js'
3
3
 
4
- let { variant = 'full', ...attributes }: DividerProps = $props()
4
+ let { variant = 'full', element = $bindable(), ...attributes }: DividerProps = $props()
5
5
  </script>
6
6
 
7
- <template {...attributes} role="separator" class={['np-divider', variant, attributes.class]}
7
+ <template
8
+ {...attributes}
9
+ bind:this={element}
10
+ role="separator"
11
+ class={['np-divider', variant, attributes.class]}
8
12
  ></template>
9
13
 
10
14
  <style>
@@ -1,4 +1,4 @@
1
1
  import type { DividerProps } from './types.ts';
2
- declare const Divider: import("svelte").Component<DividerProps, {}, "">;
2
+ declare const Divider: import("svelte").Component<DividerProps, {}, "element">;
3
3
  type Divider = ReturnType<typeof Divider>;
4
4
  export default Divider;
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
2
  export interface DividerProps extends Omit<HTMLAttributes<HTMLElement>, 'role'> {
3
3
  variant?: 'full' | 'inset' | 'inset-middle';
4
+ element?: HTMLElement;
4
5
  }
@@ -1,11 +1,6 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from 'svelte'
3
- import type { HTMLAttributes } from 'svelte/elements'
2
+ import type { IconProps } from './types.js'
4
3
 
5
- interface IconProps extends HTMLAttributes<HTMLSpanElement> {
6
- children: Snippet
7
- element?: HTMLSpanElement
8
- }
9
4
  let { children, element = $bindable(), ...attributes }: IconProps = $props()
10
5
  </script>
11
6
 
@@ -1,9 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- interface IconProps extends HTMLAttributes<HTMLSpanElement> {
4
- children: Snippet;
5
- element?: HTMLSpanElement;
6
- }
1
+ import type { IconProps } from './types.ts';
7
2
  declare const Icon: import("svelte").Component<IconProps, {}, "element">;
8
3
  type Icon = ReturnType<typeof Icon>;
9
4
  export default Icon;
@@ -0,0 +1,6 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
4
+ children: Snippet;
5
+ element?: HTMLSpanElement;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,7 @@
13
13
  softFocus = false,
14
14
  lazy = false,
15
15
  variant,
16
+ element = $bindable(),
16
17
  ...attributes
17
18
  }: ItemProps = $props()
18
19
  </script>
@@ -46,6 +47,7 @@
46
47
  {#if disabled}
47
48
  <div
48
49
  {...attributes}
50
+ bind:this={element}
49
51
  aria-disabled="true"
50
52
  class={['np-item disabled', lazy && 'np-item-lazy', attributes.class]}
51
53
  >
@@ -54,6 +56,7 @@
54
56
  {:else if variant === 'text' || variant === undefined}
55
57
  <div
56
58
  {...attributes}
59
+ bind:this={element}
57
60
  class={['np-item', selected && 'selected', lazy && 'np-item-lazy', attributes.class]}
58
61
  >
59
62
  {@render content()}
@@ -61,6 +64,7 @@
61
64
  {:else if variant === 'button'}
62
65
  <button
63
66
  {...attributes}
67
+ bind:this={element}
64
68
  type={attributes.type ?? 'button'}
65
69
  class={['np-item', selected && 'selected', lazy && 'np-item-lazy', attributes.class]}
66
70
  >
@@ -70,6 +74,7 @@
70
74
  {:else if variant === 'link'}
71
75
  <a
72
76
  {...attributes}
77
+ bind:this={element}
73
78
  class={['np-item', selected && 'selected', lazy && 'np-item-lazy', attributes.class]}
74
79
  >
75
80
  {@render content()}
@@ -1,5 +1,5 @@
1
1
  import '../internal/focus-ring.css';
2
2
  import type { ItemProps } from './types.ts';
3
- declare const Item: import("svelte").Component<ItemProps, {}, "">;
3
+ declare const Item: import("svelte").Component<ItemProps, {}, "element">;
4
4
  type Item = ReturnType<typeof Item>;
5
5
  export default Item;
@@ -2,9 +2,9 @@
2
2
  import Item from './Item.svelte'
3
3
  import type { ListItemProps } from './types.js'
4
4
 
5
- let { ...attributes }: ListItemProps = $props()
5
+ let { element = $bindable(), ...attributes }: ListItemProps = $props()
6
6
  </script>
7
7
 
8
8
  <li>
9
- <Item {...attributes} />
9
+ <Item bind:element {...attributes} />
10
10
  </li>
@@ -1,3 +1,3 @@
1
- declare const ListItem: import("svelte").Component<import("./types.ts").ItemProps, {}, "">;
1
+ declare const ListItem: import("svelte").Component<import("./types.ts").ItemProps, {}, "element">;
2
2
  type ListItem = ReturnType<typeof ListItem>;
3
3
  export default ListItem;
@@ -11,6 +11,7 @@ export interface ItemProps extends HTMLAttributes<ItemElement>, Omit<HTMLButtonA
11
11
  softFocus?: boolean;
12
12
  lazy?: boolean;
13
13
  type?: 'submit' | 'reset' | 'button' | null;
14
+ element?: ItemElement;
14
15
  }
15
16
  export type ListItemProps = ItemProps;
16
17
  export interface ListProps extends HTMLAttributes<HTMLUListElement> {
@@ -38,10 +38,15 @@
38
38
  </script>
39
39
 
40
40
  <script lang="ts">
41
- let { contained = false, ...attributes }: LoadingIndicatorProps = $props()
41
+ let { contained = false, element = $bindable(), ...attributes }: LoadingIndicatorProps = $props()
42
42
  </script>
43
43
 
44
- <div {...attributes} class={['np-loading-indicator', contained && 'contained']} role="progressbar">
44
+ <div
45
+ {...attributes}
46
+ bind:this={element}
47
+ class={['np-loading-indicator', contained && 'contained', attributes.class]}
48
+ role="progressbar"
49
+ >
45
50
  <svg viewBox="0 0 {VIEWBOX} {VIEWBOX}" aria-hidden="true">
46
51
  <path class="indicator" d={FRAMES[0]}>
47
52
  <animate
@@ -1,4 +1,4 @@
1
1
  import type { LoadingIndicatorProps } from './types.ts';
2
- declare const LoadingIndicator: import("svelte").Component<LoadingIndicatorProps, {}, "">;
2
+ declare const LoadingIndicator: import("svelte").Component<LoadingIndicatorProps, {}, "element">;
3
3
  type LoadingIndicator = ReturnType<typeof LoadingIndicator>;
4
4
  export default LoadingIndicator;
@@ -1,4 +1,5 @@
1
- export interface LoadingIndicatorProps {
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface LoadingIndicatorProps extends HTMLAttributes<HTMLDivElement> {
2
3
  contained?: boolean;
3
- 'aria-label'?: string | undefined | null;
4
+ element?: HTMLDivElement;
4
5
  }
@@ -65,8 +65,8 @@
65
65
 
66
66
  <svelte:window bind:innerHeight onresize={refreshValues} />
67
67
  <div
68
- role="menu"
69
68
  {...attributes}
69
+ role="menu"
70
70
  bind:this={element}
71
71
  ontoggle={(event) => {
72
72
  let { newState } = event
@@ -2,13 +2,13 @@
2
2
  import Item from '../list/Item.svelte'
3
3
  import type { MenuItemProps } from './types.js'
4
4
 
5
- let { ...attributes }: MenuItemProps = $props()
5
+ let { element = $bindable(), ...attributes }: MenuItemProps = $props()
6
6
 
7
7
  const isLink = $derived(attributes.href != null)
8
8
  </script>
9
9
 
10
10
  <div class="np-menu-item" role="none">
11
- <Item role="menuitem" {...attributes} variant={isLink ? 'link' : 'button'} />
11
+ <Item role="menuitem" bind:element {...attributes} variant={isLink ? 'link' : 'button'} />
12
12
  </div>
13
13
 
14
14
  <style>
@@ -1,4 +1,4 @@
1
1
  import type { MenuItemProps } from './types.ts';
2
- declare const MenuItem: import("svelte").Component<MenuItemProps, {}, "">;
2
+ declare const MenuItem: import("svelte").Component<MenuItemProps, {}, "element">;
3
3
  type MenuItem = ReturnType<typeof MenuItem>;
4
4
  export default MenuItem;
@@ -9,6 +9,7 @@
9
9
  label,
10
10
  badgeLabelText,
11
11
  icon,
12
+ element = $bindable(),
12
13
  ...attributes
13
14
  }: NavigationDrawerItemProps = $props()
14
15
 
@@ -31,6 +32,7 @@
31
32
  {#if isLink}
32
33
  <a
33
34
  {...attributes}
35
+ bind:this={element}
34
36
  href={attributes.href}
35
37
  class={[
36
38
  'np-navigation-drawer-item',
@@ -45,6 +47,7 @@
45
47
  {:else}
46
48
  <button
47
49
  {...attributes as HTMLButtonAttributes}
50
+ bind:this={element}
48
51
  class={[
49
52
  'np-navigation-drawer-item',
50
53
  selected && 'np-navigation-drawer-item-selected',
@@ -1,5 +1,5 @@
1
1
  import '../internal/focus-ring.css';
2
2
  import type { NavigationDrawerItemProps } from './types.ts';
3
- declare const NavigationDrawerItem: import("svelte").Component<NavigationDrawerItemProps, {}, "">;
3
+ declare const NavigationDrawerItem: import("svelte").Component<NavigationDrawerItemProps, {}, "element">;
4
4
  type NavigationDrawerItem = ReturnType<typeof NavigationDrawerItem>;
5
5
  export default NavigationDrawerItem;
@@ -13,4 +13,5 @@ export interface NavigationDrawerItemProps extends HTMLAttributes<NavigationDraw
13
13
  selected?: boolean;
14
14
  badgeLabelText?: string;
15
15
  type?: 'submit' | 'reset' | 'button' | (string & {}) | null;
16
+ element?: NavigationDrawerItemElement;
16
17
  }
@@ -2,7 +2,12 @@
2
2
  import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
3
3
  import type { NavigationRailProps } from './types.js'
4
4
 
5
- let { children, onkeydown: userKeydown, ...attributes }: NavigationRailProps = $props()
5
+ let {
6
+ children,
7
+ element = $bindable(),
8
+ onkeydown: userKeydown,
9
+ ...attributes
10
+ }: NavigationRailProps = $props()
6
11
 
7
12
  const attach = rovingTabindex('.np-navigation-action')
8
13
  const arrowHandler = arrowKeyNav('.np-navigation-action')
@@ -16,7 +21,8 @@
16
21
  <nav
17
22
  {...attributes}
18
23
  {@attach attach}
19
- class="navigation-rail {attributes.class}"
24
+ bind:this={element}
25
+ class={['np-navigation-rail', attributes.class]}
20
26
  onkeydown={handleKeydown}
21
27
  >
22
28
  {#if children}
@@ -25,7 +31,7 @@
25
31
  </nav>
26
32
 
27
33
  <style>
28
- .navigation-rail {
34
+ .np-navigation-rail {
29
35
  overflow-y: auto;
30
36
  z-index: 8;
31
37
  background-color: var(--np-color-surface);
@@ -1,4 +1,4 @@
1
1
  import type { NavigationRailProps } from './types.ts';
2
- declare const NavigationRail: import("svelte").Component<NavigationRailProps, {}, "">;
2
+ declare const NavigationRail: import("svelte").Component<NavigationRailProps, {}, "element">;
3
3
  type NavigationRail = ReturnType<typeof NavigationRail>;
4
4
  export default NavigationRail;
@@ -4,7 +4,13 @@
4
4
  import type { HTMLButtonAttributes } from 'svelte/elements'
5
5
  import type { NavigationRailItemProps } from './types.js'
6
6
 
7
- let { selected, icon, label, ...attributes }: NavigationRailItemProps = $props()
7
+ let {
8
+ selected,
9
+ icon,
10
+ label,
11
+ element = $bindable(),
12
+ ...attributes
13
+ }: NavigationRailItemProps = $props()
8
14
  let touchEl: HTMLSpanElement | undefined = $state()
9
15
 
10
16
  const isLink = $derived(attributes.href != null)
@@ -22,6 +28,7 @@
22
28
  {#if isLink}
23
29
  <a
24
30
  {...attributes}
31
+ bind:this={element}
25
32
  href={attributes.href}
26
33
  class={['np-navigation-action', selected && 'np-navigation-action-selected', attributes.class]}
27
34
  aria-current={selected ? 'page' : undefined}
@@ -32,6 +39,7 @@
32
39
  {:else}
33
40
  <button
34
41
  {...attributes as HTMLButtonAttributes}
42
+ bind:this={element}
35
43
  class={['np-navigation-action', selected && 'np-navigation-action-selected', attributes.class]}
36
44
  aria-current={selected ? 'page' : undefined}
37
45
  tabindex={selected ? 0 : -1}
@@ -1,5 +1,5 @@
1
1
  import '../internal/focus-ring.css';
2
2
  import type { NavigationRailItemProps } from './types.ts';
3
- declare const NavigationRailItem: import("svelte").Component<NavigationRailItemProps, {}, "">;
3
+ declare const NavigationRailItem: import("svelte").Component<NavigationRailItemProps, {}, "element">;
4
4
  type NavigationRailItem = ReturnType<typeof NavigationRailItem>;
5
5
  export default NavigationRailItem;
@@ -1,10 +1,13 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- export type NavigationRailProps = HTMLAttributes<HTMLElement>;
3
+ export interface NavigationRailProps extends HTMLAttributes<HTMLElement> {
4
+ element?: HTMLElement;
5
+ }
4
6
  export type NavigationRailItemElement = HTMLButtonElement | HTMLAnchorElement;
5
7
  export interface NavigationRailItemProps extends HTMLAttributes<NavigationRailItemElement>, Omit<HTMLButtonAttributes, keyof HTMLAttributes<HTMLButtonElement> | 'type'>, Omit<HTMLAnchorAttributes, keyof HTMLAttributes<HTMLAnchorElement> | 'type'> {
6
8
  icon: Snippet;
7
9
  label: string;
8
10
  selected?: boolean;
9
11
  type?: 'submit' | 'reset' | 'button' | (string & {}) | null;
12
+ element?: NavigationRailItemElement;
10
13
  }
@@ -9,6 +9,9 @@
9
9
  fourColor = false,
10
10
  track = true,
11
11
  wavy = false,
12
+ element = $bindable(),
13
+ class: className,
14
+ style,
12
15
  ...attributes
13
16
  }: CircularProgressProps = $props()
14
17
 
@@ -68,7 +71,7 @@
68
71
  let activeStyle = $derived(`--_active:${activeLength}`)
69
72
  </script>
70
73
 
71
- <div class="np-container">
74
+ <div bind:this={element} class={['np-container', className]} {style}>
72
75
  <div
73
76
  {...attributes}
74
77
  class={[
@@ -1,4 +1,4 @@
1
1
  import type { CircularProgressProps } from './types.ts';
2
- declare const CircularProgress: import("svelte").Component<CircularProgressProps, {}, "">;
2
+ declare const CircularProgress: import("svelte").Component<CircularProgressProps, {}, "element">;
3
3
  type CircularProgress = ReturnType<typeof CircularProgress>;
4
4
  export default CircularProgress;
@@ -10,6 +10,9 @@
10
10
  buffer = 0,
11
11
  wavy = false,
12
12
  track = true,
13
+ element = $bindable(),
14
+ class: className,
15
+ style,
13
16
  ...attributes
14
17
  }: LinearProgressProps = $props()
15
18
 
@@ -159,7 +162,12 @@
159
162
  let hideDots = $derived(indeterminate || !hasBuffer || bufferValue >= max || value >= max)
160
163
  </script>
161
164
 
162
- <div class={['np-container', wave && 'wavy']} bind:clientWidth={containerWidth}>
165
+ <div
166
+ bind:this={element}
167
+ class={['np-container', wave && 'wavy', className]}
168
+ {style}
169
+ bind:clientWidth={containerWidth}
170
+ >
163
171
  <div
164
172
  {...attributes}
165
173
  style={trackStyles}
@@ -1,4 +1,4 @@
1
1
  import type { LinearProgressProps } from './types.ts';
2
- declare const LinearProgress: import("svelte").Component<LinearProgressProps, {}, "">;
2
+ declare const LinearProgress: import("svelte").Component<LinearProgressProps, {}, "element">;
3
3
  type LinearProgress = ReturnType<typeof LinearProgress>;
4
4
  export default LinearProgress;
@@ -1,11 +1,12 @@
1
- export interface CircularProgressProps {
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface CircularProgressProps extends HTMLAttributes<HTMLDivElement> {
2
3
  value?: number;
3
4
  max?: number;
4
5
  indeterminate?: boolean;
5
6
  fourColor?: boolean;
6
7
  track?: boolean;
7
8
  wavy?: boolean;
8
- 'aria-label'?: string | undefined | null;
9
+ element?: HTMLDivElement;
9
10
  }
10
11
  export interface LinearProgressProps extends CircularProgressProps {
11
12
  buffer?: number;
@@ -1,18 +1,7 @@
1
1
  <script lang="ts">
2
2
  import ArrowDropDownIcon from '../icons/ArrowDropDownIcon.svelte'
3
- import type { HTMLSelectAttributes } from 'svelte/elements'
4
- interface SelectProps extends HTMLSelectAttributes {
5
- label?: string
6
- noAsterisk?: boolean
7
- supportingText?: string
8
- issues?:
9
- | {
10
- message: string
11
- }[]
12
- | undefined
13
- variant?: 'outlined' | 'filled'
14
- element?: HTMLSpanElement
15
- }
3
+ import type { NativeSelectProps } from './types.js'
4
+
16
5
  let {
17
6
  id,
18
7
  supportingText,
@@ -26,8 +15,11 @@
26
15
  children,
27
16
  oninput,
28
17
  style,
18
+ element = $bindable(),
19
+ 'aria-describedby': ariaDescribedby,
20
+ 'aria-errormessage': ariaErrormessage,
29
21
  ...attributes
30
- }: SelectProps = $props()
22
+ }: NativeSelectProps = $props()
31
23
  const uid = $props.id()
32
24
  const selectId = $derived(id ?? `select-${uid}`)
33
25
 
@@ -46,6 +38,7 @@
46
38
  attributes.class,
47
39
  ]}
48
40
  {style}
41
+ bind:this={element}
49
42
  >
50
43
  {#if variant === 'outlined'}
51
44
  <div class="np-select-outline">
@@ -83,10 +76,14 @@
83
76
  {disabled}
84
77
  {required}
85
78
  id={selectId}
86
- aria-errormessage={errorText ? `supporting-text-${uid}` : undefined}
87
- aria-describedby={supportingText && !errorText ? `supporting-text-${uid}` : undefined}
88
79
  bind:value
89
80
  {...attributes}
81
+ aria-errormessage={[errorText && `supporting-text-${uid}`, ariaErrormessage]
82
+ .filter(Boolean)
83
+ .join(' ') || undefined}
84
+ aria-describedby={[supportingText && !errorText && `supporting-text-${uid}`, ariaDescribedby]
85
+ .filter(Boolean)
86
+ .join(' ') || undefined}
90
87
  class="np-select"
91
88
  >
92
89
  {@render children?.()}
@@ -1,14 +1,4 @@
1
- import type { HTMLSelectAttributes } from 'svelte/elements';
2
- interface SelectProps extends HTMLSelectAttributes {
3
- label?: string;
4
- noAsterisk?: boolean;
5
- supportingText?: string;
6
- issues?: {
7
- message: string;
8
- }[] | undefined;
9
- variant?: 'outlined' | 'filled';
10
- element?: HTMLSpanElement;
11
- }
12
- declare const NativeSelect: import("svelte").Component<SelectProps, {}, "value">;
1
+ import type { NativeSelectProps } from './types.ts';
2
+ declare const NativeSelect: import("svelte").Component<NativeSelectProps, {}, "element" | "value">;
13
3
  type NativeSelect = ReturnType<typeof NativeSelect>;
14
4
  export default NativeSelect;
@@ -1,13 +1,7 @@
1
1
  <script lang="ts">
2
2
  import '../internal/focus-ring.css'
3
3
  import Ripple from '../ripple/Ripple.svelte'
4
- import type { Snippet } from 'svelte'
5
- import type { HTMLOptionAttributes } from 'svelte/elements'
6
-
7
- interface OptionProps extends HTMLOptionAttributes {
8
- start?: Snippet
9
- end?: Snippet
10
- }
4
+ import type { OptionProps } from './types.js'
11
5
 
12
6
  let { start, end, children, ...attributes }: OptionProps = $props()
13
7
  </script>
@@ -1,10 +1,5 @@
1
1
  import '../internal/focus-ring.css';
2
- import type { Snippet } from 'svelte';
3
- import type { HTMLOptionAttributes } from 'svelte/elements';
4
- interface OptionProps extends HTMLOptionAttributes {
5
- start?: Snippet;
6
- end?: Snippet;
7
- }
2
+ import type { OptionProps } from './types.ts';
8
3
  declare const Option: import("svelte").Component<OptionProps, {}, "">;
9
4
  type Option = ReturnType<typeof Option>;
10
5
  export default Option;
@@ -1,4 +1,4 @@
1
1
  import type { SelectProps } from './types.ts';
2
- declare const Select: import("svelte").Component<SelectProps, {}, "value" | "element">;
2
+ declare const Select: import("svelte").Component<SelectProps, {}, "element" | "value">;
3
3
  type Select = ReturnType<typeof Select>;
4
4
  export default Select;
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { HTMLSelectAttributes } from 'svelte/elements';
2
+ import type { HTMLOptionAttributes, HTMLSelectAttributes } from 'svelte/elements';
3
3
  export interface SelectOption {
4
4
  value: string | number;
5
5
  label: string;
@@ -21,3 +21,17 @@ export interface SelectProps extends Omit<HTMLSelectAttributes, 'size' | 'autoco
21
21
  clampMenuWidth?: boolean;
22
22
  virtualThreshold?: number;
23
23
  }
24
+ export interface NativeSelectProps extends HTMLSelectAttributes {
25
+ label?: string;
26
+ noAsterisk?: boolean;
27
+ supportingText?: string;
28
+ issues?: {
29
+ message: string;
30
+ }[] | undefined;
31
+ variant?: 'outlined' | 'filled';
32
+ element?: HTMLDivElement;
33
+ }
34
+ export interface OptionProps extends HTMLOptionAttributes {
35
+ start?: Snippet;
36
+ end?: Snippet;
37
+ }
@@ -1,4 +1,4 @@
1
1
  import type { SliderProps } from './types.ts';
2
- declare const Slider: import("svelte").Component<SliderProps, {}, "value" | "element" | "inputElement" | "endValue" | "endInputElement">;
2
+ declare const Slider: import("svelte").Component<SliderProps, {}, "element" | "value" | "inputElement" | "endValue" | "endInputElement">;
3
3
  type Slider = ReturnType<typeof Slider>;
4
4
  export default Slider;
@@ -1,4 +1,4 @@
1
1
  import type { TabsProps } from './types.ts';
2
- declare const Tabs: import("svelte").Component<TabsProps, {}, "value" | "element">;
2
+ declare const Tabs: import("svelte").Component<TabsProps, {}, "element" | "value">;
3
3
  type Tabs = ReturnType<typeof Tabs>;
4
4
  export default Tabs;
@@ -24,11 +24,25 @@
24
24
  focused = $bindable(false),
25
25
  clientWidth = $bindable(),
26
26
  clientHeight = $bindable(),
27
+ 'aria-invalid': ariaInvalid,
28
+ 'aria-describedby': ariaDescribedby,
29
+ 'aria-errormessage': ariaErrormessage,
27
30
  ...attributes
28
31
  }: TextFieldProps = $props()
29
32
 
30
33
  const uid = $props.id()
31
34
  let errorText = $derived(issues?.map((issue) => issue.message).join(', '))
35
+
36
+ // Merged rather than set before the spread, so a consumer's own aria wiring adds to the
37
+ // supporting-text wiring instead of silently replacing it.
38
+ const supportingTextId = `supporting-text-${uid}`
39
+ const ids = (...values: (string | undefined | null | false)[]) =>
40
+ values.filter(Boolean).join(' ') || undefined
41
+ let ariaProps = $derived({
42
+ 'aria-invalid': errorText ? ('true' as const) : ariaInvalid,
43
+ 'aria-errormessage': ids(errorText && supportingTextId, ariaErrormessage),
44
+ 'aria-describedby': ids(supportingText && !errorText && supportingTextId, ariaDescribedby),
45
+ })
32
46
  </script>
33
47
 
34
48
  <label
@@ -101,12 +115,8 @@
101
115
  <div class="content">
102
116
  {#if attributes.type === 'textarea'}
103
117
  <textarea
104
- aria-invalid={errorText ? 'true' : undefined}
105
- aria-errormessage={errorText ? `supporting-text-${uid}` : undefined}
106
- aria-describedby={supportingText && !errorText
107
- ? `supporting-text-${uid}`
108
- : undefined}
109
118
  {...attributes}
119
+ {...ariaProps}
110
120
  {placeholder}
111
121
  {defaultValue}
112
122
  bind:focused
@@ -121,14 +131,11 @@
121
131
  </span>
122
132
  {/if}
123
133
  <input
124
- aria-invalid={errorText ? 'true' : undefined}
125
- aria-errormessage={errorText ? `supporting-text-${uid}` : undefined}
126
- aria-describedby={supportingText && !errorText
127
- ? `supporting-text-${uid}`
128
- : undefined}
129
134
  {...attributes}
135
+ {...ariaProps}
130
136
  {placeholder}
131
137
  {defaultValue}
138
+ bind:focused
132
139
  bind:value
133
140
  bind:this={inputElement}
134
141
  class="input"
@@ -1,4 +1,4 @@
1
1
  import type { TextFieldProps } from './types.ts';
2
- declare const TextField: import("svelte").Component<TextFieldProps, {}, "value" | "element" | "inputElement" | "clientWidth" | "clientHeight" | "focused">;
2
+ declare const TextField: import("svelte").Component<TextFieldProps, {}, "element" | "value" | "inputElement" | "clientWidth" | "clientHeight" | "focused">;
3
3
  type TextField = ReturnType<typeof TextField>;
4
4
  export default TextField;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './autocomplete/types.ts';
2
+ export * from './badge/types.ts';
2
3
  export * from './button/types.ts';
3
4
  export * from './card/types.ts';
4
5
  export * from './checkbox/types.ts';
@@ -6,6 +7,7 @@ export * from './chip/types.ts';
6
7
  export * from './date-picker/types.ts';
7
8
  export * from './dialog/types.ts';
8
9
  export * from './divider/types.ts';
10
+ export * from './icons/types.ts';
9
11
  export * from './list/types.ts';
10
12
  export * from './loading-indicator/types.ts';
11
13
  export * from './menu/types.ts';
package/dist/types.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./autocomplete/types.js";
2
+ export * from "./badge/types.js";
2
3
  export * from "./button/types.js";
3
4
  export * from "./card/types.js";
4
5
  export * from "./checkbox/types.js";
@@ -6,6 +7,7 @@ export * from "./chip/types.js";
6
7
  export * from "./date-picker/types.js";
7
8
  export * from "./dialog/types.js";
8
9
  export * from "./divider/types.js";
10
+ export * from "./icons/types.js";
9
11
  export * from "./list/types.js";
10
12
  export * from "./loading-indicator/types.js";
11
13
  export * from "./menu/types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.43.1",
3
+ "version": "0.44.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {