@dvcol/neo-svelte 0.1.2 → 0.1.4

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 (152) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +25 -26
  3. package/dist/buttons/NeoButton.svelte +140 -128
  4. package/dist/buttons/NeoButtonGroup.svelte +99 -108
  5. package/dist/buttons/neo-button-group.model.d.ts +18 -19
  6. package/dist/buttons/neo-button.model.d.ts +6 -10
  7. package/dist/cards/NeoCard.svelte +176 -73
  8. package/dist/cards/NeoCard.svelte.d.ts +1 -1
  9. package/dist/cards/neo-card.model.d.ts +29 -1
  10. package/dist/containers/NeoTransitionContainer.svelte +13 -2
  11. package/dist/containers/neo-transition-container.model.d.ts +9 -1
  12. package/dist/divider/NeoDivider.svelte +11 -11
  13. package/dist/icons/IconAccount.svelte +10 -2
  14. package/dist/icons/IconAdd.svelte +10 -2
  15. package/dist/icons/IconAlert.svelte +2 -2
  16. package/dist/icons/IconCalendar.svelte +23 -0
  17. package/dist/icons/IconCalendar.svelte.d.ts +26 -0
  18. package/dist/icons/IconCheckbox.svelte +87 -0
  19. package/dist/icons/IconCheckbox.svelte.d.ts +55 -0
  20. package/dist/icons/IconCircleLoading.svelte +2 -2
  21. package/dist/icons/IconClear.svelte +10 -2
  22. package/dist/icons/IconClose.svelte +2 -2
  23. package/dist/icons/IconConfirm.svelte +2 -2
  24. package/dist/icons/IconDownload.svelte +17 -0
  25. package/dist/icons/IconDownload.svelte.d.ts +26 -0
  26. package/dist/icons/IconEmpty.svelte +2 -2
  27. package/dist/icons/IconFileUpload.svelte +2 -2
  28. package/dist/icons/IconGithub.svelte +2 -2
  29. package/dist/icons/IconImage.svelte +2 -2
  30. package/dist/icons/IconMinus.svelte +2 -2
  31. package/dist/icons/IconMoon.svelte +2 -2
  32. package/dist/icons/IconPaint.svelte +19 -0
  33. package/dist/icons/{IconSunrise.svelte.d.ts → IconPaint.svelte.d.ts} +3 -3
  34. package/dist/icons/IconPencil.svelte +13 -0
  35. package/dist/icons/IconPencil.svelte.d.ts +26 -0
  36. package/dist/icons/IconRadio.svelte +14 -0
  37. package/dist/icons/IconRadio.svelte.d.ts +22 -0
  38. package/dist/icons/IconSave.svelte +1 -1
  39. package/dist/icons/IconSave.svelte.d.ts +3 -3
  40. package/dist/icons/IconSaveOff.svelte +1 -1
  41. package/dist/icons/IconSaveOff.svelte.d.ts +3 -3
  42. package/dist/icons/IconSearch.svelte +2 -2
  43. package/dist/icons/IconSun.svelte +3 -3
  44. package/dist/icons/{IconSunrise.svelte → IconSunFull.svelte} +5 -4
  45. package/dist/icons/IconSunFull.svelte.d.ts +26 -0
  46. package/dist/icons/IconVideo.svelte +2 -2
  47. package/dist/icons/IconWatch.svelte +2 -2
  48. package/dist/icons/IconWatchOff.svelte +2 -2
  49. package/dist/inputs/NeoCheckbox.svelte +316 -0
  50. package/dist/inputs/NeoCheckbox.svelte.d.ts +19 -0
  51. package/dist/inputs/NeoColorPicker.svelte +140 -0
  52. package/dist/inputs/NeoColorPicker.svelte.d.ts +19 -0
  53. package/dist/inputs/NeoDateTime.svelte +96 -0
  54. package/dist/inputs/NeoDateTime.svelte.d.ts +19 -0
  55. package/dist/inputs/NeoFilePicker.svelte +528 -0
  56. package/dist/inputs/NeoFilePicker.svelte.d.ts +19 -0
  57. package/dist/inputs/NeoFilePickerCard.svelte +314 -0
  58. package/dist/inputs/NeoFilePickerCard.svelte.d.ts +19 -0
  59. package/dist/inputs/NeoNumberStep.svelte +174 -0
  60. package/dist/inputs/NeoNumberStep.svelte.d.ts +19 -0
  61. package/dist/inputs/NeoPassword.svelte +86 -17
  62. package/dist/inputs/NeoPassword.svelte.d.ts +19 -16
  63. package/dist/inputs/NeoPin.svelte +589 -0
  64. package/dist/inputs/NeoPin.svelte.d.ts +19 -0
  65. package/dist/inputs/NeoRadio.svelte +254 -0
  66. package/dist/inputs/NeoRadio.svelte.d.ts +19 -0
  67. package/dist/inputs/NeoRange.svelte +518 -0
  68. package/dist/inputs/NeoRange.svelte.d.ts +18 -0
  69. package/dist/inputs/NeoSwitch.svelte +373 -0
  70. package/dist/inputs/NeoSwitch.svelte.d.ts +19 -0
  71. package/dist/inputs/NeoTextarea.svelte +335 -301
  72. package/dist/inputs/NeoTextarea.svelte.d.ts +5 -2
  73. package/dist/inputs/common/NeoAffix.svelte +166 -0
  74. package/dist/inputs/common/NeoAffix.svelte.d.ts +19 -0
  75. package/dist/inputs/common/NeoBaseInput.svelte +338 -0
  76. package/dist/inputs/common/NeoBaseInput.svelte.d.ts +30 -0
  77. package/dist/inputs/common/NeoInput.svelte +684 -0
  78. package/dist/inputs/{NeoInput.svelte.d.ts → common/NeoInput.svelte.d.ts} +2 -10
  79. package/dist/inputs/common/NeoInputValidation.svelte +45 -0
  80. package/dist/inputs/common/NeoInputValidation.svelte.d.ts +22 -0
  81. package/dist/inputs/common/NeoLabel.svelte +93 -0
  82. package/dist/inputs/common/NeoLabel.svelte.d.ts +19 -0
  83. package/dist/inputs/{NeoValidation.svelte → common/NeoValidation.svelte} +9 -16
  84. package/dist/inputs/common/NeoValidation.svelte.d.ts +22 -0
  85. package/dist/inputs/common/neo-affix.model.d.ts +32 -0
  86. package/dist/inputs/common/neo-input-validation.model.d.ts +20 -0
  87. package/dist/inputs/common/neo-input-validation.model.js +1 -0
  88. package/dist/inputs/{neo-input.model.d.ts → common/neo-input.model.d.ts} +148 -68
  89. package/dist/inputs/common/neo-label.model.d.ts +36 -0
  90. package/dist/inputs/common/neo-label.model.js +1 -0
  91. package/dist/inputs/common/neo-validation.model.d.ts +70 -0
  92. package/dist/inputs/common/neo-validation.model.js +1 -0
  93. package/dist/inputs/index.d.ts +2 -2
  94. package/dist/inputs/index.js +1 -1
  95. package/dist/inputs/neo-checkbox.model.d.ts +9 -0
  96. package/dist/inputs/neo-checkbox.model.js +1 -0
  97. package/dist/inputs/neo-color-picker.model.d.ts +17 -0
  98. package/dist/inputs/neo-color-picker.model.js +1 -0
  99. package/dist/inputs/neo-date-time.model.d.ts +8 -0
  100. package/dist/inputs/neo-date-time.model.js +1 -0
  101. package/dist/inputs/neo-file-picker.model.d.ts +138 -0
  102. package/dist/inputs/neo-file-picker.model.js +1 -0
  103. package/dist/inputs/neo-number-step.model.d.ts +24 -0
  104. package/dist/inputs/neo-number-step.model.js +1 -0
  105. package/dist/inputs/neo-password.model.d.ts +13 -0
  106. package/dist/inputs/neo-password.model.js +1 -0
  107. package/dist/inputs/neo-pin.model.d.ts +47 -0
  108. package/dist/inputs/neo-pin.model.js +1 -0
  109. package/dist/inputs/neo-radio.model.d.ts +3 -0
  110. package/dist/inputs/neo-radio.model.js +1 -0
  111. package/dist/inputs/neo-switch.model.d.ts +9 -0
  112. package/dist/inputs/neo-switch.model.js +1 -0
  113. package/dist/nav/NeoTab.svelte +29 -25
  114. package/dist/nav/NeoTabPanel.svelte +1 -1
  115. package/dist/nav/NeoTabs.svelte +51 -44
  116. package/dist/nav/NeoTabsCard.svelte +8 -10
  117. package/dist/nav/neo-tabs-context.svelte.d.ts +2 -11
  118. package/dist/nav/neo-tabs-context.svelte.js +1 -41
  119. package/dist/nav/neo-tabs.model.d.ts +6 -0
  120. package/dist/providers/NeoThemeProvider.svelte +417 -305
  121. package/dist/providers/NeoThemeSelector.svelte +10 -10
  122. package/dist/providers/neo-theme-provider-context.svelte.js +16 -15
  123. package/dist/providers/neo-theme-provider.model.d.ts +6 -6
  124. package/dist/providers/neo-theme-provider.model.js +17 -12
  125. package/dist/providers/neo-theme-selector.model.d.ts +2 -2
  126. package/dist/skeletons/NeoSkeletonMedia.svelte +4 -4
  127. package/dist/skeletons/NeoSkeletonText.svelte +12 -12
  128. package/dist/styles/common/colors.scss +85 -97
  129. package/dist/styles/common/filters.scss +17 -0
  130. package/dist/styles/common/shadows.scss +531 -293
  131. package/dist/styles/common/spacing.scss +7 -3
  132. package/dist/styles/common/typography.scss +1 -1
  133. package/dist/styles/common/utils.scss +1 -1
  134. package/dist/styles/common/z-index.scss +1 -1
  135. package/dist/styles/mixin.scss +80 -27
  136. package/dist/styles/reset.scss +8 -1
  137. package/dist/styles/theme.scss +39 -16
  138. package/dist/utils/html-element.utils.d.ts +3 -0
  139. package/dist/utils/regex.utils.d.ts +3 -0
  140. package/dist/utils/regex.utils.js +3 -0
  141. package/dist/utils/shadow.utils.d.ts +30 -3
  142. package/dist/utils/shadow.utils.js +41 -14
  143. package/dist/utils/transition.utils.d.ts +4 -0
  144. package/dist/utils/transition.utils.js +10 -1
  145. package/dist/utils/utils.svelte.d.ts +6 -0
  146. package/dist/utils/utils.svelte.js +13 -0
  147. package/package.json +13 -12
  148. package/dist/inputs/NeoInput.svelte +0 -750
  149. package/dist/inputs/NeoValidation.svelte.d.ts +0 -22
  150. package/dist/inputs/neo-validation.model.d.ts +0 -40
  151. /package/dist/inputs/{neo-validation.model.js → common/neo-affix.model.js} +0 -0
  152. /package/dist/inputs/{neo-input.model.js → common/neo-input.model.js} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLTransitionProps } from '../../utils/action.utils.js';
3
+ import type { HTMLNeoBaseElement, HTMLRefProps } from '../../utils/html-element.utils.js';
4
+ export type NeoValidationValue = string | string[] | number | boolean | boolean[] | FileList | any;
5
+ export type NeoValidationState<T extends NeoValidationValue = NeoValidationValue> = {
6
+ /**
7
+ * `true` if the input has been focused.
8
+ */
9
+ touched?: boolean;
10
+ /**
11
+ * `true` if the input content has been modified and defers from the initial state.
12
+ * If `dirtyOnChange` is `true`, the input will always be considered dirty once it has been modified.
13
+ *
14
+ * @see dirtyOnChange
15
+ */
16
+ dirty?: boolean;
17
+ /**
18
+ * `true` if the input passes validation.
19
+ */
20
+ valid?: boolean;
21
+ /**
22
+ * The input/textarea value.
23
+ */
24
+ value?: T;
25
+ /**
26
+ * The initial input/textarea value.
27
+ */
28
+ initial?: T;
29
+ };
30
+ export type NeoValidationContext<T extends HTMLElement = HTMLElement, V extends NeoValidationValue = NeoValidationValue, C extends NeoValidationFieldContext<T, V> = NeoValidationFieldContext<T, V>> = {
31
+ /**
32
+ * The message's element id.
33
+ */
34
+ messageId?: string;
35
+ /**
36
+ * A snippet or a string to display as the input info message.
37
+ */
38
+ message?: Snippet<[C]> | string;
39
+ /**
40
+ * A snippet or a string to display as the input error message.
41
+ */
42
+ error?: Snippet<[C]> | string;
43
+ };
44
+ export type NeoValidationFieldContext<T extends HTMLElement = HTMLElement, V extends NeoValidationValue = NeoValidationValue> = HTMLRefProps<T> & NeoValidationState<V>;
45
+ export type NeoValidationProps<T extends HTMLElement = HTMLElement, V extends NeoValidationValue = NeoValidationValue, C extends NeoValidationFieldContext<T, V> = NeoValidationFieldContext<T, V>> = {
46
+ /**
47
+ * The component to wrap with the validation context.
48
+ */
49
+ children?: Snippet<[NeoValidationContext<T, V, C>]>;
50
+ /**
51
+ * The HTML tag to use for the wrapper component (when message or error are shown).
52
+ */
53
+ tag?: keyof HTMLElementTagNameMap;
54
+ /**
55
+ * The context to pass to the snippets.
56
+ */
57
+ context: C;
58
+ /**
59
+ * If true, the wrapper will adjust spacing to match rounded styles.
60
+ */
61
+ rounded?: boolean;
62
+ /**
63
+ * The HTML tag to use for the message and error components.
64
+ */
65
+ messageTag?: keyof HTMLElementTagNameMap;
66
+ /**
67
+ * The props to pass to the message and error components.
68
+ */
69
+ messageProps?: HTMLNeoBaseElement;
70
+ } & HTMLTransitionProps & NeoValidationContext<T, V, C> & HTMLNeoBaseElement;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- export { default as NeoInput } from './NeoInput.svelte';
1
+ export { default as NeoInput } from './common/NeoInput.svelte';
2
2
  export { default as NeoTextarea } from './NeoTextarea.svelte';
3
3
  export { default as NeoPassword } from './NeoPassword.svelte';
4
- export type { NeoInputProps, NeoTextareaProps, NeoInputContext, NeoInputElevation, NeoInputLabelPositions, NeoTextAreaResize, } from './neo-input.model.js';
4
+ export type { NeoInputProps, NeoTextareaProps, NeoInputContext, NeoInputElevation, NeoInputLabelPositions, NeoTextAreaResize, } from './common/neo-input.model.js';
@@ -1,3 +1,3 @@
1
- export { default as NeoInput } from './NeoInput.svelte';
1
+ export { default as NeoInput } from './common/NeoInput.svelte';
2
2
  export { default as NeoTextarea } from './NeoTextarea.svelte';
3
3
  export { default as NeoPassword } from './NeoPassword.svelte';
@@ -0,0 +1,9 @@
1
+ import type { NeoBaseInputProps, NeoInputProps } from './common/neo-input.model.js';
2
+ import type { NeoLabelProps } from './common/neo-label.model.js';
3
+ import type { NeoValidationProps } from './common/neo-validation.model.js';
4
+ /**
5
+ * Note: Checkbox group are exclusive due to the api design.
6
+ *
7
+ * @see [github issue #2308](https://github.com/sveltejs/svelte/issues/2308)
8
+ */
9
+ export type NeoCheckboxProps = NeoBaseInputProps & Pick<NeoInputProps, 'start' | 'glass' | 'elevation' | 'rounded' | 'readonly' | 'loading' | 'disabled' | 'skeleton' | 'validation' | 'in' | 'out' | 'transition' | 'labelRef' | 'labelProps' | 'containerTag' | 'containerProps' | 'wrapperTag' | 'wrapperProps'> & Pick<NeoLabelProps, 'label'> & Pick<NeoValidationProps, 'error' | 'message' | 'messageTag' | 'messageProps'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
3
+ import type { NeoInputProps } from './common/neo-input.model.js';
4
+ export type NeoColorPickerProps = {
5
+ /**
6
+ * Reference to the color picker input element.
7
+ */
8
+ pickerRef?: HTMLInputElement;
9
+ /**
10
+ * Input properties to pass to the color picker input.
11
+ */
12
+ pickerProps?: HTMLInputAttributes;
13
+ /**
14
+ * Button properties to pass to the picker button.
15
+ */
16
+ buttonProps?: NeoButtonProps;
17
+ } & NeoInputProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
2
+ import type { NeoInputProps } from './common/neo-input.model.js';
3
+ export type NeoDateTimeProps = {
4
+ /**
5
+ * Button properties to pass to the increment and decrement buttons.
6
+ */
7
+ buttonProps?: NeoButtonProps;
8
+ } & NeoInputProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,138 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { MouseEventHandler } from 'svelte/elements';
3
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
4
+ import type { NeoCardProps } from '../cards/neo-card.model.js';
5
+ import type { NeoInputProps } from './common/neo-input.model.js';
6
+ import type { SvelteEvent } from '../utils/html-element.utils.js';
7
+ export type NeoFilePickerContext<Multiple extends boolean = boolean> = {
8
+ /**
9
+ * If the file picker is in a dragging state.
10
+ * @see drop
11
+ */
12
+ dragging?: boolean;
13
+ /**
14
+ * Whether the file picker should accept multiple files.
15
+ */
16
+ multiple?: Multiple;
17
+ /**
18
+ * Whether the file picker should append to the current files.
19
+ * If false, the current files will be replaced.
20
+ *
21
+ * Only applies when multiple is true.
22
+ *
23
+ * @see multiple
24
+ */
25
+ append?: boolean;
26
+ /**
27
+ * The current files in the file picker.
28
+ */
29
+ files?: FileList;
30
+ };
31
+ export type NeoFilePickerValue<Multiple extends boolean = boolean> = (Multiple extends true ? FileList : Multiple extends false ? File : FileList | File) | null;
32
+ export type NeoFilePickerProps<Multiple extends boolean = boolean> = {
33
+ /**
34
+ * The snippet to render when the file picker is in an expanded state (overrides default).
35
+ */
36
+ children?: Snippet<[NeoFilePickerContext]>;
37
+ /**
38
+ * A snippet or a string to display as the input label.
39
+ */
40
+ label?: Snippet | string;
41
+ /**
42
+ * If the file picker is in an expanded state.
43
+ * @see expand
44
+ * @see drop
45
+ */
46
+ expanded?: boolean;
47
+ /**
48
+ * Whether the file picker should accept dropped files.
49
+ */
50
+ drop?: boolean;
51
+ /**
52
+ * The text to display on the drop area placeholder.
53
+ */
54
+ dropText?: NeoInputProps['placeholder'];
55
+ /**
56
+ * The text to display on the expanded header.
57
+ *
58
+ * @default Number of files.
59
+ */
60
+ expandText?: string;
61
+ /**
62
+ * The maximum height of the file list in expanded state.
63
+ *
64
+ * @see expanded
65
+ * @default 20rem
66
+ */
67
+ expandHeight?: string;
68
+ /**
69
+ * On input event handler.
70
+ * Mirrors the native oninput handler with the files as the second argument.
71
+ * @param e - The original input event.
72
+ * @param value - FileList if multiple is true, File if multiple is false.
73
+ */
74
+ oninput?: <Value extends Multiple = Multiple>(e: SvelteEvent<InputEvent, HTMLInputElement>, value: NeoFilePickerValue<Value>) => unknown;
75
+ /**
76
+ * On change event handler.
77
+ * Mirrors the native onchange handler with the files as the second argument.
78
+ * @param e - The original input event.
79
+ * @param value - FileList if multiple is true, File if multiple is false.
80
+ */
81
+ onchange?: <Value extends Multiple = Multiple>(e: SvelteEvent<InputEvent, HTMLInputElement>, value: NeoFilePickerValue<Value>) => unknown;
82
+ /**
83
+ * Button properties to pass to the picker button.
84
+ */
85
+ buttonProps?: NeoButtonProps;
86
+ /**
87
+ * Card properties to pass to the card in expanded state.
88
+ * @see expanded
89
+ */
90
+ cardProps?: Omit<NeoCardProps, 'children'> & Pick<NeoFilePickerCardProps, 'editButtonProps' | 'removeButtonProps'>;
91
+ /**
92
+ * Input Group properties to pass to the input group container.
93
+ */
94
+ groupProps?: NeoInputProps['containerProps'];
95
+ } & NeoFilePickerContext<Multiple> & Omit<NeoInputProps, 'multiple' | 'oninput' | 'onchange' | 'label'>;
96
+ export type NeoFilePickerCardProps = Omit<NeoCardProps, 'children'> & {
97
+ /**
98
+ * If the is currently in a dragging state.
99
+ */
100
+ dragging?: boolean;
101
+ /**
102
+ * Header text to display in the card.
103
+ */
104
+ detailText?: string;
105
+ /**
106
+ * The maximum height of the file card list in expanded state.
107
+ *
108
+ * @see expanded
109
+ * @default 20rem
110
+ */
111
+ maxHeight?: string;
112
+ /**
113
+ * Callback when the affix close button is clicked.
114
+ */
115
+ onClear?: MouseEventHandler<HTMLButtonElement>;
116
+ /**
117
+ * Callback when the footer edit button is clicked.
118
+ */
119
+ onEdit?: MouseEventHandler<HTMLDivElement>;
120
+ /**
121
+ * Callback when the list remove item button is clicked.
122
+ * @param index
123
+ * @param e
124
+ */
125
+ onRemove?: (index: number, e: SvelteEvent<MouseEvent>) => void;
126
+ /**
127
+ * Button properties to pass to the add files button.
128
+ */
129
+ addButtonProps?: NeoButtonProps;
130
+ /**
131
+ * Button properties to pass to the edit files button.
132
+ */
133
+ editButtonProps?: NeoButtonProps;
134
+ /**
135
+ * Button properties to pass to the remove files button.
136
+ */
137
+ removeButtonProps?: NeoButtonProps;
138
+ } & Pick<NeoFilePickerProps, 'files' | 'valid' | 'clearable' | 'placeholder' | 'dropText' | 'loading' | 'multiple' | 'append' | 'children' | 'label' | 'labelProps' | 'labelRef' | 'required'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
2
+ import type { NeoInputProps } from './common/neo-input.model.js';
3
+ export type NeoNumberStepProps = NeoInputProps & {
4
+ /**
5
+ * Center the input value.
6
+ */
7
+ center?: boolean;
8
+ /**
9
+ * Event handler for the step-up button.
10
+ */
11
+ onStepUp?: (e: MouseEvent, value: number, step?: string | number) => void;
12
+ /**
13
+ * Event handler for the step-down button.
14
+ */
15
+ onStepDown?: (e: MouseEvent, value: number, step?: string | number) => void;
16
+ /**
17
+ * Button properties to pass to the increment and decrement buttons.
18
+ */
19
+ buttonProps?: NeoButtonProps;
20
+ /**
21
+ * Input Group properties to pass to the input group container.
22
+ */
23
+ groupProps?: NeoInputProps['containerProps'];
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
2
+ import type { NeoInputProps } from './common/neo-input.model.js';
3
+ import type { NeoPinState } from './neo-pin.model.js';
4
+ export type NeoPasswordProps<T extends boolean = false> = {
5
+ /**
6
+ * Show a pin input instead of a text input.
7
+ */
8
+ pin?: T;
9
+ /**
10
+ * Button properties to pass to the show/hide password button.
11
+ */
12
+ buttonProps?: NeoButtonProps;
13
+ } & NeoInputProps & (T extends true ? NeoPinState : Record<string, never>);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { NeoInputHTMLElement, NeoInputProps } from './common/neo-input.model.js';
3
+ import type { NeoValidationFieldContext } from './common/neo-validation.model.js';
4
+ export type NeoPinState = {
5
+ /**
6
+ * A snippet to display as the group separator.
7
+ */
8
+ icon?: Snippet;
9
+ /**
10
+ * The number of groups to display.
11
+ */
12
+ groups?: number;
13
+ /**
14
+ * The number of characters in each group.
15
+ */
16
+ count?: number;
17
+ /**
18
+ * The separator character to use between groups and inserted into value.
19
+ * If `true`, the default separator will be used.
20
+ * If `false`, no separator will be used.
21
+ */
22
+ separator?: boolean | string;
23
+ /**
24
+ * If true, groups will be stacked vertically.
25
+ * @default true if `groups` is greater than 1, false otherwise
26
+ */
27
+ vertical?: boolean;
28
+ };
29
+ export type NeoPinProps = NeoPinState & Omit<NeoInputProps, 'floating' | 'position'> & {
30
+ /**
31
+ * Input Group properties to pass to the input group container.
32
+ */
33
+ groupProps?: NeoInputProps['containerProps'];
34
+ };
35
+ export type NeoPinMethods = {
36
+ clear: () => Promise<void>;
37
+ };
38
+ export type NeoPinContext = NeoValidationFieldContext<NeoInputHTMLElement, string> & NeoPinMethods & {
39
+ /**
40
+ * If true, the input will be disabled.
41
+ */
42
+ disabled?: boolean;
43
+ /**
44
+ * If true, the input will be readonly.
45
+ */
46
+ readonly?: boolean;
47
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { NeoBaseInputProps, NeoInputProps } from './common/neo-input.model.js';
2
+ import type { NeoLabelProps } from './common/neo-label.model.js';
3
+ export type NeoRadioProps = NeoBaseInputProps & Pick<NeoInputProps, 'start' | 'glass' | 'elevation' | 'rounded' | 'readonly' | 'loading' | 'disabled' | 'skeleton' | 'in' | 'out' | 'transition' | 'labelRef' | 'labelProps' | 'containerTag' | 'containerProps'> & Pick<NeoLabelProps, 'label'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { NeoBaseInputProps, NeoInputProps } from './common/neo-input.model.js';
2
+ import type { NeoLabelProps } from './common/neo-label.model.js';
3
+ import type { NeoValidationProps } from './common/neo-validation.model.js';
4
+ /**
5
+ * Note: Checkbox group are exclusive due to the api design.
6
+ *
7
+ * @see [github issue #2308](https://github.com/sveltejs/svelte/issues/2308)
8
+ */
9
+ export type NeoSwitchProps = NeoBaseInputProps & Pick<NeoInputProps, 'start' | 'glass' | 'elevation' | 'rounded' | 'readonly' | 'loading' | 'disabled' | 'skeleton' | 'validation' | 'in' | 'out' | 'transition' | 'labelRef' | 'labelProps' | 'containerTag' | 'containerProps' | 'wrapperTag' | 'wrapperProps'> & Pick<NeoLabelProps, 'label'> & Pick<NeoValidationProps, 'error' | 'message' | 'messageTag' | 'messageProps'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,7 +8,7 @@
8
8
  import NeoButton from '../buttons/NeoButton.svelte';
9
9
  import IconClose from '../icons/IconClose.svelte';
10
10
  import { getTabContext } from './neo-tabs-context.svelte.js';
11
- import { toAction, toActionProps } from '../utils/action.utils.js';
11
+ import { emptyTransition, toAction, toActionProps } from '../utils/action.utils.js';
12
12
  import { defaultTransitionDuration, enterFreezeTransition } from '../utils/transition.utils.js';
13
13
 
14
14
  /* eslint-disable prefer-const -- necessary for binding checked */
@@ -38,12 +38,15 @@
38
38
  const context = getTabContext();
39
39
  const pane = $derived(context?.getPane(tabId)?.toString());
40
40
  const active = $derived(context?.active === tabId);
41
- const disabled = $derived(rest.disabled || (rest.disabled !== false && context?.disabled));
42
- const closeable = $derived(close || (close !== false && context?.close));
43
- const transition = $derived(context?.vertical ? height : width);
44
- const slide = $derived(context?.slide);
41
+ const disabled = $derived(rest.disabled || (rest.disabled !== false && context?.state?.disabled));
42
+ const closeable = $derived(close || (close !== false && context?.state?.close));
43
+ const transition = $derived.by(() => {
44
+ if (!closeable && !context?.state?.add) return emptyTransition;
45
+ return context?.state?.vertical ? height : width;
46
+ });
47
+ const slide = $derived(context?.state?.slide);
45
48
 
46
- const onClick: NeoTabProps['onclick'] = (e: MouseEvent) => {
49
+ const onClick: NeoTabProps['onclick'] = e => {
47
50
  context?.onChange(tabId);
48
51
  onclick?.(e);
49
52
  };
@@ -81,14 +84,14 @@
81
84
  data-tab-id={tabId}
82
85
  data-active={active}
83
86
  class:neo-tab={true}
84
- class:active
85
- class:slide
87
+ class:neo-active={active}
88
+ class:neo-slide={slide}
86
89
  transition:transition={enterFreezeTransition}
87
90
  {...tabProps}
88
91
  use:useFn={useProps}
89
92
  >
90
93
  <NeoButton
91
- id={`neo-tab-${String(tabId)}`}
94
+ id="neo-tab-{String(tabId)}"
92
95
  role="tab"
93
96
  aria-controls={pane}
94
97
  aria-selected={active}
@@ -105,12 +108,12 @@
105
108
  <button
106
109
  class="neo-tab-close"
107
110
  aria-label="Close tab"
108
- class:reverse={rest.reverse}
109
- class:disabled
111
+ class:neo-reverse={rest.reverse}
112
+ class:neo-disabled={disabled}
110
113
  transition:width={{ duration: skip ? 0 : defaultTransitionDuration }}
111
114
  onclick={onClose}
112
115
  >
113
- <IconClose class="icon-close" />
116
+ <IconClose class="neo-icon-close" />
114
117
  </button>
115
118
  {/if}
116
119
  </NeoButton>
@@ -119,19 +122,20 @@
119
122
  <style>.neo-tab {
120
123
  display: flex;
121
124
  }
122
- .neo-tab :global(.neo-button:active) :global(.icon-close),
123
- .neo-tab :global(.neo-button.pressed) :global(.icon-close),
124
- .neo-tab :global(.neo-button:focus-visible) :global(.icon-close),
125
- .neo-tab :global(.neo-button:hover) :global(.icon-close) {
125
+ .neo-tab :global(.neo-button:active) :global(.neo-icon-close),
126
+ .neo-tab :global(.neo-button.pressed) :global(.neo-icon-close),
127
+ .neo-tab :global(.neo-button:focus-visible) :global(.neo-icon-close),
128
+ .neo-tab :global(.neo-button:hover) :global(.neo-icon-close) {
126
129
  opacity: 1;
127
130
  pointer-events: auto;
128
131
  }
129
- .neo-tab :global(.neo-button .icon-close:focus-visible) {
132
+ .neo-tab :global(.neo-button .neo-icon-close:focus-visible) {
130
133
  transition: none;
131
134
  }
132
135
 
133
136
  .neo-tab-close {
134
- width: calc(1rem + var(--neo-tab-icon-gap, 0.3rem) + var(--neo-tab-icon-gap-offset, -0.2rem));
137
+ display: inline-flex;
138
+ width: calc(1rem + var(--neo-tab-icon-gap, 0.3rem) + var(--neo-tab-icon-gap-offset, -0.1875rem));
135
139
  padding: 0;
136
140
  color: inherit;
137
141
  font: inherit;
@@ -140,12 +144,12 @@
140
144
  outline: inherit;
141
145
  cursor: pointer;
142
146
  }
143
- .neo-tab-close.disabled {
147
+ .neo-tab-close.neo-disabled {
144
148
  cursor: not-allowed;
145
149
  pointer-events: none;
146
150
  }
147
- .neo-tab-close :global(.icon-close) {
148
- margin-right: var(--neo-tab-icon-gap-offset, -0.2rem);
151
+ .neo-tab-close :global(.neo-icon-close) {
152
+ margin-right: var(--neo-tab-icon-gap-offset, -0.1875rem);
149
153
  margin-left: var(--neo-tab-icon-gap, 0.3rem);
150
154
  padding: 0.1rem;
151
155
  border-radius: 50%;
@@ -153,18 +157,18 @@
153
157
  transition: opacity 0.2s ease-in, color 0.3s ease, background-color 0.3s ease;
154
158
  pointer-events: none;
155
159
  }
156
- .neo-tab-close:focus-visible :global(.icon-close) {
160
+ .neo-tab-close:focus-visible :global(.neo-icon-close) {
157
161
  color: var(--neo-close-color-focused, rgba(255, 0, 0, 0.75));
158
162
  background-color: var(--neo-close-bg-color-focused, rgba(255, 0, 0, 0.05));
159
163
  opacity: 1;
160
164
  transition: none;
161
165
  }
162
- .neo-tab-close:hover :global(.icon-close) {
166
+ .neo-tab-close:hover :global(.neo-icon-close) {
163
167
  color: var(--neo-close-color, rgb(255, 0, 0));
164
168
  background-color: var(--neo-close-bg-color-hover, rgba(255, 0, 0, 0.1));
165
169
  opacity: 1;
166
170
  }
167
- .neo-tab-close.reverse :global(.icon-close) {
171
+ .neo-tab-close.neo-reverse :global(.neo-icon-close) {
168
172
  margin-right: var(--neo-tab-icon-gap, 0.3rem);
169
- margin-left: var(--neo-tab-icon-gap-offset, -0.2rem);
173
+ margin-left: var(--neo-tab-icon-gap-offset, -0.1875rem);
170
174
  }</style>
@@ -29,7 +29,7 @@
29
29
 
30
30
  const context = getTabContext();
31
31
  const active = $derived(context?.active === tabId);
32
- const orientation = $derived(context?.vertical ? 'y' : 'x');
32
+ const orientation = $derived(context?.state?.vertical ? 'y' : 'x');
33
33
 
34
34
  const show = $derived(empty ? !context?.active : active);
35
35