noph-ui 0.4.0 → 0.4.2

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 (56) hide show
  1. package/README.md +4 -3
  2. package/dist/button/Button.svelte +6 -24
  3. package/dist/button/Button.svelte.d.ts +2 -15
  4. package/dist/button/IconButton.svelte +4 -23
  5. package/dist/button/IconButton.svelte.d.ts +2 -16
  6. package/dist/button/SegmentedButton.svelte +2 -15
  7. package/dist/button/SegmentedButton.svelte.d.ts +2 -14
  8. package/dist/button/types.d.ts +46 -0
  9. package/dist/button/types.js +1 -0
  10. package/dist/card/Card.svelte +14 -41
  11. package/dist/card/Card.svelte.d.ts +2 -33
  12. package/dist/card/types.d.ts +37 -0
  13. package/dist/card/types.js +1 -0
  14. package/dist/chip/types.d.ts +1 -0
  15. package/dist/chip/types.js +1 -0
  16. package/dist/divider/Divider.svelte +24 -4
  17. package/dist/divider/Divider.svelte.d.ts +2 -1
  18. package/dist/divider/types.d.ts +4 -0
  19. package/dist/divider/types.js +1 -0
  20. package/dist/index.js +0 -1
  21. package/dist/list/Item.svelte +2 -27
  22. package/dist/list/Item.svelte.d.ts +2 -27
  23. package/dist/list/ListItem.svelte +2 -27
  24. package/dist/list/ListItem.svelte.d.ts +2 -27
  25. package/dist/list/types.d.ts +27 -0
  26. package/dist/list/types.js +1 -1
  27. package/dist/menu/Menu.svelte +1 -7
  28. package/dist/menu/Menu.svelte.d.ts +2 -6
  29. package/dist/menu/MenuItem.svelte +3 -19
  30. package/dist/menu/MenuItem.svelte.d.ts +2 -17
  31. package/dist/menu/types.d.ts +21 -0
  32. package/dist/menu/types.js +1 -0
  33. package/dist/progress/CircularProgress.svelte +3 -9
  34. package/dist/progress/LinearProgress.svelte +3 -10
  35. package/dist/progress/LinearProgress.svelte.d.ts +2 -9
  36. package/dist/progress/types.d.ts +13 -0
  37. package/dist/progress/types.js +1 -0
  38. package/dist/ripple/Ripple.svelte +1 -6
  39. package/dist/ripple/Ripple.svelte.d.ts +2 -6
  40. package/dist/ripple/types.d.ts +6 -0
  41. package/dist/ripple/types.js +1 -0
  42. package/dist/snackbar/Snackbar.svelte +2 -17
  43. package/dist/snackbar/Snackbar.svelte.d.ts +2 -15
  44. package/dist/snackbar/types.d.ts +15 -0
  45. package/dist/snackbar/types.js +1 -0
  46. package/dist/text-field/TextField.svelte +10 -10
  47. package/dist/text-field/TextField.svelte.d.ts +2 -3
  48. package/dist/text-field/types.d.ts +4 -1
  49. package/dist/tooltip/Tooltip.svelte +1 -5
  50. package/dist/tooltip/Tooltip.svelte.d.ts +2 -4
  51. package/dist/tooltip/types.d.ts +4 -0
  52. package/dist/tooltip/types.js +1 -0
  53. package/dist/types.d.ts +13 -3
  54. package/dist/types.js +13 -1
  55. package/package.json +92 -91
  56. package/dist/progress/CircularProgress.svelte.d.ts +0 -10
package/README.md CHANGED
@@ -56,21 +56,22 @@ Beta (No breaking changes expected)
56
56
 
57
57
  - Buttons
58
58
  - Cards
59
+ - Checkbox
60
+ - Divider
59
61
  - Icon buttons
60
62
  - Progress indicators
61
63
  - Ripple
62
64
  - Segmented buttons
63
65
  - Snackbar
66
+ - Radio
67
+ - Text fields
64
68
 
65
69
  In progress (Breaking changes expected)
66
70
 
67
- - Checkbox
68
71
  - Chips
69
72
  - Lists
70
73
  - Menus
71
- - Radio
72
74
  - Tooltips
73
- - Text fields
74
75
 
75
76
  Pending
76
77
 
@@ -2,23 +2,9 @@
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
3
  import Tooltip from '../tooltip/Tooltip.svelte'
4
4
  import { generateUUIDv4 } from '../utils.js'
5
- import type { Snippet } from 'svelte'
6
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements'
5
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
6
+ import type { ButtonProps } from './types.ts'
7
7
 
8
- interface ButtonProps extends HTMLButtonAttributes {
9
- variant?: 'text' | 'filled' | 'outlined' | 'elevated' | 'tonal'
10
- start?: Snippet | undefined
11
- end?: Snippet | undefined
12
- element?: HTMLElement
13
- disabled?: boolean
14
- }
15
- interface AnchorProps extends HTMLAnchorAttributes {
16
- variant?: 'text' | 'filled' | 'outlined' | 'elevated' | 'tonal'
17
- start?: Snippet
18
- end?: Snippet
19
- element?: HTMLElement
20
- disabled?: boolean
21
- }
22
8
  let {
23
9
  variant = 'outlined',
24
10
  children,
@@ -28,18 +14,14 @@
28
14
  element = $bindable(),
29
15
  disabled = false,
30
16
  ...attributes
31
- }: ButtonProps | AnchorProps = $props()
17
+ }: ButtonProps = $props()
32
18
 
33
19
  let tooltipId = $state(title ? generateUUIDv4() : '')
34
20
 
35
- const isButton = (
36
- obj: HTMLAnchorAttributes | HTMLButtonAttributes | HTMLAttributes<HTMLDivElement>,
37
- ): obj is HTMLButtonAttributes => {
21
+ const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
38
22
  return (obj as HTMLAnchorAttributes).href === undefined
39
23
  }
40
- const isLink = (
41
- obj: HTMLAnchorAttributes | HTMLButtonAttributes | HTMLAttributes<HTMLDivElement>,
42
- ): obj is HTMLAnchorAttributes => {
24
+ const isLink = (obj: unknown): obj is HTMLAnchorAttributes => {
43
25
  return (obj as HTMLAnchorAttributes).href !== undefined
44
26
  }
45
27
  </script>
@@ -78,7 +60,7 @@
78
60
  </button>
79
61
  {:else if isLink(attributes)}
80
62
  <a
81
- {...attributes as HTMLAnchorAttributes}
63
+ {...attributes}
82
64
  aria-describedby={title ? tooltipId : attributes['aria-describedby']}
83
65
  aria-label={title || attributes['aria-label']}
84
66
  bind:this={element}
@@ -1,17 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- declare const Button: import("svelte").Component<(HTMLButtonAttributes & {
4
- variant?: "text" | "filled" | "outlined" | "elevated" | "tonal";
5
- start?: Snippet | undefined;
6
- end?: Snippet | undefined;
7
- element?: HTMLElement;
8
- disabled?: boolean;
9
- }) | (HTMLAnchorAttributes & {
10
- variant?: "text" | "filled" | "outlined" | "elevated" | "tonal";
11
- start?: Snippet;
12
- end?: Snippet;
13
- element?: HTMLElement;
14
- disabled?: boolean;
15
- }), {}, "element">;
1
+ import type { ButtonProps } from './types.ts';
2
+ declare const Button: import("svelte").Component<ButtonProps, {}, "element">;
16
3
  type Button = ReturnType<typeof Button>;
17
4
  export default Button;
@@ -2,24 +2,9 @@
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
3
  import Tooltip from '../tooltip/Tooltip.svelte'
4
4
  import { generateUUIDv4 } from '../utils.js'
5
- import { type Snippet } from 'svelte'
5
+ import type { IconButtonProps } from './types.ts'
6
6
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
7
7
 
8
- interface ButtonProps extends HTMLButtonAttributes {
9
- variant?: 'text' | 'filled' | 'outlined' | 'tonal'
10
- element?: HTMLElement
11
- toggle?: boolean
12
- selected?: boolean
13
- selectedIcon?: Snippet
14
- }
15
- interface AnchorProps extends HTMLAnchorAttributes {
16
- variant?: 'text' | 'filled' | 'outlined' | 'tonal'
17
- element?: HTMLElement
18
- disabled?: boolean
19
- toggle?: boolean
20
- selected?: boolean
21
- selectedIcon?: Snippet
22
- }
23
8
  let {
24
9
  variant = 'text',
25
10
  toggle = false,
@@ -30,20 +15,16 @@
30
15
  selected = false,
31
16
  selectedIcon,
32
17
  ...attributes
33
- }: ButtonProps | AnchorProps = $props()
18
+ }: IconButtonProps = $props()
34
19
 
35
20
  let tooltipId = $state(title ? generateUUIDv4() : '')
36
21
  let selectedState = $state(!toggle || selected)
37
22
  let touchEl: HTMLSpanElement | undefined = $state()
38
23
 
39
- const isButton = (
40
- obj: HTMLAnchorAttributes | HTMLButtonAttributes,
41
- ): obj is HTMLButtonAttributes => {
24
+ const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
42
25
  return (obj as HTMLAnchorAttributes).href === undefined
43
26
  }
44
- const isLink = (
45
- obj: HTMLAnchorAttributes | HTMLButtonAttributes,
46
- ): obj is HTMLAnchorAttributes => {
27
+ const isLink = (obj: unknown): obj is HTMLAnchorAttributes => {
47
28
  return (obj as HTMLAnchorAttributes).href !== undefined
48
29
  }
49
30
 
@@ -1,18 +1,4 @@
1
- import { type Snippet } from 'svelte';
2
- import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- declare const IconButton: import("svelte").Component<(HTMLButtonAttributes & {
4
- variant?: "text" | "filled" | "outlined" | "tonal";
5
- element?: HTMLElement;
6
- toggle?: boolean;
7
- selected?: boolean;
8
- selectedIcon?: Snippet;
9
- }) | (HTMLAnchorAttributes & {
10
- variant?: "text" | "filled" | "outlined" | "tonal";
11
- element?: HTMLElement;
12
- disabled?: boolean;
13
- toggle?: boolean;
14
- selected?: boolean;
15
- selectedIcon?: Snippet;
16
- }), {}, "element">;
1
+ import type { IconButtonProps } from './types.ts';
2
+ declare const IconButton: import("svelte").Component<IconButtonProps, {}, "element">;
17
3
  type IconButton = ReturnType<typeof IconButton>;
18
4
  export default IconButton;
@@ -1,21 +1,7 @@
1
1
  <script lang="ts">
2
2
  import CheckIcon from '../icons/CheckIcon.svelte'
3
3
  import Ripple from '../ripple/Ripple.svelte'
4
- import type { Snippet } from 'svelte'
5
- import type { HTMLAttributes } from 'svelte/elements'
6
-
7
- interface SegmentedButtonProps extends HTMLAttributes<HTMLDivElement> {
8
- name: string
9
- multiSelect?: boolean
10
- options: {
11
- label: string | Snippet
12
- selected?: boolean
13
- disabled?: boolean
14
- icon?: Snippet
15
- onclick?: (event: Event) => void
16
- }[]
17
- element?: HTMLElement
18
- }
4
+ import type { SegmentedButtonProps } from './types.ts'
19
5
 
20
6
  let {
21
7
  name,
@@ -28,6 +14,7 @@
28
14
  </script>
29
15
 
30
16
  <div
17
+ {...attributes}
31
18
  class="np-segmented-buttons {attributes.class}"
32
19
  bind:this={element}
33
20
  style="{attributes.style};grid-template-columns: repeat({options.length}, minmax(max-content, 1fr));"
@@ -1,16 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- declare const SegmentedButton: import("svelte").Component<HTMLAttributes<HTMLDivElement> & {
4
- name: string;
5
- multiSelect?: boolean;
6
- options: {
7
- label: string | Snippet;
8
- selected?: boolean;
9
- disabled?: boolean;
10
- icon?: Snippet;
11
- onclick?: (event: Event) => void;
12
- }[];
13
- element?: HTMLElement;
14
- }, {}, "element">;
1
+ import type { SegmentedButtonProps } from './types.ts';
2
+ declare const SegmentedButton: import("svelte").Component<SegmentedButtonProps, {}, "element">;
15
3
  type SegmentedButton = ReturnType<typeof SegmentedButton>;
16
4
  export default SegmentedButton;
@@ -0,0 +1,46 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes, HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
+ interface ButtonButtonProps extends HTMLButtonAttributes {
4
+ variant?: 'text' | 'filled' | 'outlined' | 'elevated' | 'tonal';
5
+ start?: Snippet | undefined;
6
+ end?: Snippet | undefined;
7
+ element?: HTMLElement;
8
+ disabled?: boolean;
9
+ }
10
+ interface ButtonAnchorProps extends HTMLAnchorAttributes {
11
+ variant?: 'text' | 'filled' | 'outlined' | 'elevated' | 'tonal';
12
+ start?: Snippet;
13
+ end?: Snippet;
14
+ element?: HTMLElement;
15
+ disabled?: boolean;
16
+ }
17
+ interface IconButtonButtonProps extends HTMLButtonAttributes {
18
+ variant?: 'text' | 'filled' | 'outlined' | 'tonal';
19
+ element?: HTMLElement;
20
+ toggle?: boolean;
21
+ selected?: boolean;
22
+ selectedIcon?: Snippet;
23
+ }
24
+ interface IconButtonAnchorProps extends HTMLAnchorAttributes {
25
+ variant?: 'text' | 'filled' | 'outlined' | 'tonal';
26
+ element?: HTMLElement;
27
+ disabled?: boolean;
28
+ toggle?: boolean;
29
+ selected?: boolean;
30
+ selectedIcon?: Snippet;
31
+ }
32
+ export type IconButtonProps = IconButtonButtonProps | IconButtonAnchorProps;
33
+ export type ButtonProps = ButtonButtonProps | ButtonAnchorProps;
34
+ export interface SegmentedButtonProps extends HTMLAttributes<HTMLDivElement> {
35
+ name: string;
36
+ multiSelect?: boolean;
37
+ options: {
38
+ label: string | Snippet;
39
+ selected?: boolean;
40
+ disabled?: boolean;
41
+ icon?: Snippet;
42
+ onclick?: (event: Event) => void;
43
+ }[];
44
+ element?: HTMLElement;
45
+ }
46
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,41 +1,8 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
- import type { Snippet } from 'svelte'
4
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements'
3
+ import type { CardProps } from './types.ts'
4
+ import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements'
5
5
 
6
- interface TextProps extends HTMLAttributes<HTMLDivElement> {
7
- variant?: 'elevated' | 'filled' | 'outlined'
8
- disabled?: boolean
9
- image?: string | undefined
10
- element?: HTMLElement
11
- headline?: string | undefined
12
- subhead?: string
13
- supportingText?: string
14
- action?: Snippet
15
- type: 'text'
16
- }
17
- interface ButtonProps extends HTMLButtonAttributes {
18
- variant?: 'elevated' | 'filled' | 'outlined'
19
- disabled?: boolean
20
- image?: string | undefined
21
- element?: HTMLElement
22
- headline?: string | undefined
23
- subhead?: string
24
- supportingText?: string
25
- action?: Snippet
26
- type: 'button'
27
- }
28
- interface AnchorProps extends HTMLAnchorAttributes {
29
- variant?: 'elevated' | 'filled' | 'outlined'
30
- disabled?: boolean
31
- image?: string | undefined
32
- element?: HTMLElement
33
- headline?: string | undefined
34
- subhead?: string
35
- supportingText?: string
36
- action?: Snippet
37
- type: 'link'
38
- }
39
6
  let {
40
7
  image,
41
8
  variant = 'outlined',
@@ -46,7 +13,7 @@
46
13
  supportingText,
47
14
  action,
48
15
  ...attributes
49
- }: TextProps | AnchorProps | ButtonProps = $props()
16
+ }: CardProps = $props()
50
17
 
51
18
  let focused = $state(false)
52
19
 
@@ -97,7 +64,9 @@
97
64
  {...attributes as HTMLAttributes<HTMLDivElement>}
98
65
  bind:this={element}
99
66
  aria-disabled={disabled}
100
- class="np-card-container np-card-{variant}{disabled ? ' np-card-disabled' : ''}"
67
+ class="np-card-container np-card-{variant}{disabled
68
+ ? ' np-card-disabled'
69
+ : ''} {attributes.class}"
101
70
  >
102
71
  {@render content()}
103
72
  </div>
@@ -105,14 +74,16 @@
105
74
  <button
106
75
  {...attributes as HTMLButtonAttributes}
107
76
  bind:this={element}
108
- onfocus={() => {
77
+ onfocusin={() => {
109
78
  focused = true
110
79
  }}
111
80
  onfocusout={() => {
112
81
  focused = false
113
82
  }}
114
83
  {disabled}
115
- class="np-card-container np-card-{variant}{disabled ? ' np-card-disabled' : ''}"
84
+ class="np-card-container np-card-{variant}{disabled
85
+ ? ' np-card-disabled'
86
+ : ''} {attributes.class}"
116
87
  >
117
88
  {@render content()}
118
89
  </button>
@@ -120,13 +91,15 @@
120
91
  <a
121
92
  {...attributes}
122
93
  bind:this={element}
123
- onfocus={() => {
94
+ onfocusin={() => {
124
95
  focused = true
125
96
  }}
126
97
  onfocusout={() => {
127
98
  focused = false
128
99
  }}
129
- class="np-card-container np-card-{variant}{disabled ? ' np-card-disabled' : ''}"
100
+ class="np-card-container np-card-{variant}{disabled
101
+ ? ' np-card-disabled'
102
+ : ''} {attributes.class}"
130
103
  >
131
104
  {@render content()}
132
105
  </a>
@@ -1,35 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- declare const Card: import("svelte").Component<(HTMLAttributes<HTMLDivElement> & {
4
- variant?: "elevated" | "filled" | "outlined";
5
- disabled?: boolean;
6
- image?: string | undefined;
7
- element?: HTMLElement;
8
- headline?: string | undefined;
9
- subhead?: string;
10
- supportingText?: string;
11
- action?: Snippet;
12
- type: "text";
13
- }) | (HTMLButtonAttributes & {
14
- variant?: "elevated" | "filled" | "outlined";
15
- disabled?: boolean;
16
- image?: string | undefined;
17
- element?: HTMLElement;
18
- headline?: string | undefined;
19
- subhead?: string;
20
- supportingText?: string;
21
- action?: Snippet;
22
- type: "button";
23
- }) | (HTMLAnchorAttributes & {
24
- variant?: "elevated" | "filled" | "outlined";
25
- disabled?: boolean;
26
- image?: string | undefined;
27
- element?: HTMLElement;
28
- headline?: string | undefined;
29
- subhead?: string;
30
- supportingText?: string;
31
- action?: Snippet;
32
- type: "link";
33
- }), {}, "element">;
1
+ import type { CardProps } from './types.ts';
2
+ declare const Card: import("svelte").Component<CardProps, {}, "element">;
34
3
  type Card = ReturnType<typeof Card>;
35
4
  export default Card;
@@ -0,0 +1,37 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
+ interface TextProps extends HTMLAttributes<HTMLDivElement> {
4
+ variant?: 'elevated' | 'filled' | 'outlined';
5
+ disabled?: boolean;
6
+ image?: string | undefined;
7
+ element?: HTMLElement;
8
+ headline?: string | undefined;
9
+ subhead?: string;
10
+ supportingText?: string;
11
+ action?: Snippet;
12
+ type: 'text';
13
+ }
14
+ interface ButtonProps extends HTMLButtonAttributes {
15
+ variant?: 'elevated' | 'filled' | 'outlined';
16
+ disabled?: boolean;
17
+ image?: string | undefined;
18
+ element?: HTMLElement;
19
+ headline?: string | undefined;
20
+ subhead?: string;
21
+ supportingText?: string;
22
+ action?: Snippet;
23
+ type: 'button';
24
+ }
25
+ interface AnchorProps extends HTMLAnchorAttributes {
26
+ variant?: 'elevated' | 'filled' | 'outlined';
27
+ disabled?: boolean;
28
+ image?: string | undefined;
29
+ element?: HTMLElement;
30
+ headline?: string | undefined;
31
+ subhead?: string;
32
+ supportingText?: string;
33
+ action?: Snippet;
34
+ type: 'link';
35
+ }
36
+ export type CardProps = TextProps | ButtonProps | AnchorProps;
37
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,14 +1,34 @@
1
1
  <script lang="ts">
2
- let { ...attributes } = $props()
2
+ import type { DividerProps } from './types.ts'
3
+
4
+ let { variant = 'full', ...attributes }: DividerProps = $props()
3
5
  </script>
4
6
 
5
- <template class="divider {attributes.class}"></template>
7
+ <template
8
+ class:full={variant === 'full'}
9
+ class:inset={variant === 'inset'}
10
+ class:inset-middle={variant === 'inset-middle'}
11
+ role="separator"
12
+ {...attributes}
13
+ class="divider {attributes.class}"
14
+ ></template>
6
15
 
7
16
  <style>
17
+ .inset {
18
+ width: calc(100% - 1rem);
19
+ margin-left: 1rem;
20
+ }
21
+ .inset-middle {
22
+ width: calc(100% - 2rem);
23
+ margin-left: 1rem;
24
+ margin-right: 1rem;
25
+ }
26
+ .full {
27
+ width: 100%;
28
+ }
8
29
  .divider {
9
30
  height: 1px;
10
- width: 100%;
11
31
  display: flex;
12
- background-color: var(--np-color-outline-variant);
32
+ background-color: var(--np-divider-color, var(--np-color-outline-variant));
13
33
  }
14
34
  </style>
@@ -1,3 +1,4 @@
1
- declare const Divider: import("svelte").Component<Record<string, any>, {}, "">;
1
+ import type { DividerProps } from './types.ts';
2
+ declare const Divider: import("svelte").Component<DividerProps, {}, "">;
2
3
  type Divider = ReturnType<typeof Divider>;
3
4
  export default Divider;
@@ -0,0 +1,4 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface DividerProps extends Omit<HTMLAttributes<HTMLElement>, 'role'> {
3
+ variant?: 'full' | 'inset' | 'inset-middle';
4
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- // Reexport your entry components here
2
1
  export * from './button/index.js';
3
2
  export * from './card/index.js';
4
3
  export * from './checkbox/index.js';
@@ -1,31 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
- import type { Snippet } from 'svelte'
4
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements'
5
-
6
- interface ButtonProps extends HTMLButtonAttributes {
7
- selected?: boolean
8
- start?: Snippet
9
- end?: Snippet
10
- variant: 'button'
11
- supportingText?: Snippet
12
- }
13
- interface AnchorProps extends HTMLAnchorAttributes {
14
- selected?: boolean
15
- start?: Snippet
16
- end?: Snippet
17
- disabled?: boolean
18
- variant: 'link'
19
- supportingText?: Snippet
20
- }
21
- interface TextProps extends HTMLAttributes<HTMLDivElement> {
22
- selected?: boolean
23
- start?: Snippet
24
- end?: Snippet
25
- disabled?: boolean
26
- variant?: 'text'
27
- supportingText?: Snippet
28
- }
3
+ import type { ItemProps } from './types.ts'
29
4
 
30
5
  let {
31
6
  selected = false,
@@ -35,7 +10,7 @@
35
10
  supportingText,
36
11
  disabled = false,
37
12
  ...attributes
38
- }: ButtonProps | AnchorProps | TextProps = $props()
13
+ }: ItemProps = $props()
39
14
 
40
15
  let focused = $state(false)
41
16
  </script>
@@ -1,29 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- interface ButtonProps extends HTMLButtonAttributes {
4
- selected?: boolean;
5
- start?: Snippet;
6
- end?: Snippet;
7
- variant: 'button';
8
- supportingText?: Snippet;
9
- }
10
- interface AnchorProps extends HTMLAnchorAttributes {
11
- selected?: boolean;
12
- start?: Snippet;
13
- end?: Snippet;
14
- disabled?: boolean;
15
- variant: 'link';
16
- supportingText?: Snippet;
17
- }
18
- interface TextProps extends HTMLAttributes<HTMLDivElement> {
19
- selected?: boolean;
20
- start?: Snippet;
21
- end?: Snippet;
22
- disabled?: boolean;
23
- variant?: 'text';
24
- supportingText?: Snippet;
25
- }
26
- type $$ComponentProps = ButtonProps | AnchorProps | TextProps;
27
- declare const Item: import("svelte").Component<$$ComponentProps, {}, "">;
1
+ import type { ItemProps } from './types.ts';
2
+ declare const Item: import("svelte").Component<ItemProps, {}, "">;
28
3
  type Item = ReturnType<typeof Item>;
29
4
  export default Item;
@@ -1,33 +1,8 @@
1
1
  <script lang="ts">
2
2
  import Item from './Item.svelte'
3
- import type { Snippet } from 'svelte'
4
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements'
3
+ import type { ListItemProps } from './types.ts'
5
4
 
6
- interface ButtonProps extends HTMLButtonAttributes {
7
- selected?: boolean
8
- start?: Snippet
9
- end?: Snippet
10
- variant: 'button'
11
- supportingText?: Snippet
12
- }
13
- interface AnchorProps extends HTMLAnchorAttributes {
14
- selected?: boolean
15
- start?: Snippet
16
- end?: Snippet
17
- disabled?: boolean
18
- variant: 'link'
19
- supportingText?: Snippet
20
- }
21
- interface TextProps extends HTMLAttributes<HTMLDivElement> {
22
- selected?: boolean
23
- start?: Snippet
24
- end?: Snippet
25
- disabled?: boolean
26
- variant?: 'text'
27
- supportingText?: Snippet
28
- }
29
-
30
- let { ...attributes }: ButtonProps | AnchorProps | TextProps = $props()
5
+ let { ...attributes }: ListItemProps = $props()
31
6
  </script>
32
7
 
33
8
  <li>
@@ -1,29 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
- interface ButtonProps extends HTMLButtonAttributes {
4
- selected?: boolean;
5
- start?: Snippet;
6
- end?: Snippet;
7
- variant: 'button';
8
- supportingText?: Snippet;
9
- }
10
- interface AnchorProps extends HTMLAnchorAttributes {
11
- selected?: boolean;
12
- start?: Snippet;
13
- end?: Snippet;
14
- disabled?: boolean;
15
- variant: 'link';
16
- supportingText?: Snippet;
17
- }
18
- interface TextProps extends HTMLAttributes<HTMLDivElement> {
19
- selected?: boolean;
20
- start?: Snippet;
21
- end?: Snippet;
22
- disabled?: boolean;
23
- variant?: 'text';
24
- supportingText?: Snippet;
25
- }
26
- type $$ComponentProps = ButtonProps | AnchorProps | TextProps;
27
- declare const ListItem: import("svelte").Component<$$ComponentProps, {}, "">;
1
+ import type { ListItemProps } from './types.ts';
2
+ declare const ListItem: import("svelte").Component<ListItemProps, {}, "">;
28
3
  type ListItem = ReturnType<typeof ListItem>;
29
4
  export default ListItem;