@placeholderco/placeholder-ui 1.0.11 → 2.0.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 (289) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +134 -130
  3. package/dist/app.css +178 -0
  4. package/dist/bootstrap.min.css +3600 -0
  5. package/dist/cards/GitCard.svelte +115 -0
  6. package/dist/cards/GitCard.svelte.d.ts +22 -0
  7. package/dist/display/Avatar.svelte +29 -17
  8. package/dist/display/Avatar.svelte.d.ts +12 -2
  9. package/dist/display/LinkCollection.svelte +40 -18
  10. package/dist/display/LinkCollection.svelte.d.ts +9 -2
  11. package/dist/display/Paper.svelte +31 -19
  12. package/dist/display/Paper.svelte.d.ts +12 -3
  13. package/dist/display/alert/Alert.svelte +129 -0
  14. package/dist/display/alert/Alert.svelte.d.ts +15 -0
  15. package/dist/display/alert/AlertVariant.d.ts +1 -0
  16. package/dist/display/alert/AlertVariant.js +1 -0
  17. package/dist/display/filetree/FileTree.svelte +259 -0
  18. package/dist/display/filetree/FileTree.svelte.d.ts +76 -0
  19. package/dist/display/filetree/FileTreeItem.svelte +396 -0
  20. package/dist/display/filetree/FileTreeItem.svelte.d.ts +40 -0
  21. package/dist/display/filetree/FileTreeNode.d.ts +46 -0
  22. package/dist/display/filetree/FileTreeNode.js +115 -0
  23. package/dist/display/filetree/index.d.ts +5 -0
  24. package/dist/display/filetree/index.js +3 -0
  25. package/dist/editors/CodeMirror.svelte +306 -0
  26. package/dist/editors/CodeMirror.svelte.d.ts +31 -0
  27. package/dist/editors/tiptap/LinkActionMenu.svelte +307 -0
  28. package/dist/editors/tiptap/LinkActionMenu.svelte.d.ts +8 -0
  29. package/dist/editors/tiptap/TipTap.svelte +856 -0
  30. package/dist/editors/tiptap/TipTap.svelte.d.ts +54 -0
  31. package/dist/editors/tiptap/TipTapBubble.svelte +790 -0
  32. package/dist/editors/tiptap/TipTapBubble.svelte.d.ts +44 -0
  33. package/dist/editors/tiptap/collaboration.d.ts +55 -0
  34. package/dist/editors/tiptap/collaboration.js +1 -0
  35. package/dist/editors/tiptap/extensions/Alert.d.ts +18 -0
  36. package/dist/editors/tiptap/extensions/Alert.js +72 -0
  37. package/dist/editors/tiptap/extensions/CodeBlockEditor.d.ts +21 -0
  38. package/dist/editors/tiptap/extensions/CodeBlockEditor.js +326 -0
  39. package/dist/editors/tiptap/extensions/Div.d.ts +19 -0
  40. package/dist/editors/tiptap/extensions/Div.js +89 -0
  41. package/dist/editors/tiptap/extensions/Span.d.ts +5 -0
  42. package/dist/editors/tiptap/extensions/Span.js +56 -0
  43. package/dist/editors/tiptap/extensions/codeBlockEditor.css +236 -0
  44. package/dist/editors/tiptap/extensions/codeBlockLanguages.d.ts +17 -0
  45. package/dist/editors/tiptap/extensions/codeBlockLanguages.js +124 -0
  46. package/dist/editors/tiptap/extensions/index.d.ts +7 -0
  47. package/dist/editors/tiptap/extensions/index.js +5 -0
  48. package/dist/editors/tiptap/toolbar/AlertButton.svelte +261 -0
  49. package/dist/editors/tiptap/toolbar/AlertButton.svelte.d.ts +7 -0
  50. package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +18 -0
  51. package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte.d.ts +7 -0
  52. package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +18 -0
  53. package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte.d.ts +7 -0
  54. package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +18 -0
  55. package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte.d.ts +7 -0
  56. package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +18 -0
  57. package/dist/editors/tiptap/toolbar/AlignRightButton.svelte.d.ts +7 -0
  58. package/dist/editors/tiptap/toolbar/BoldButton.svelte +18 -0
  59. package/dist/editors/tiptap/toolbar/BoldButton.svelte.d.ts +7 -0
  60. package/dist/editors/tiptap/toolbar/BulletListButton.svelte +18 -0
  61. package/dist/editors/tiptap/toolbar/BulletListButton.svelte.d.ts +7 -0
  62. package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte +18 -0
  63. package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte.d.ts +7 -0
  64. package/dist/editors/tiptap/toolbar/CodeButton.svelte +18 -0
  65. package/dist/editors/tiptap/toolbar/CodeButton.svelte.d.ts +7 -0
  66. package/dist/editors/tiptap/toolbar/ColorButton.svelte +299 -0
  67. package/dist/editors/tiptap/toolbar/ColorButton.svelte.d.ts +20 -0
  68. package/dist/editors/tiptap/toolbar/DocumentButton.svelte +58 -0
  69. package/dist/editors/tiptap/toolbar/DocumentButton.svelte.d.ts +9 -0
  70. package/dist/editors/tiptap/toolbar/HeadingButton.svelte +30 -0
  71. package/dist/editors/tiptap/toolbar/HeadingButton.svelte.d.ts +8 -0
  72. package/dist/editors/tiptap/toolbar/HtmlButton.svelte +68 -0
  73. package/dist/editors/tiptap/toolbar/HtmlButton.svelte.d.ts +7 -0
  74. package/dist/editors/tiptap/toolbar/ImageButton.svelte +54 -0
  75. package/dist/editors/tiptap/toolbar/ImageButton.svelte.d.ts +8 -0
  76. package/dist/editors/tiptap/toolbar/ItalicButton.svelte +18 -0
  77. package/dist/editors/tiptap/toolbar/ItalicButton.svelte.d.ts +7 -0
  78. package/dist/editors/tiptap/toolbar/LinkButton.svelte +257 -0
  79. package/dist/editors/tiptap/toolbar/LinkButton.svelte.d.ts +7 -0
  80. package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +18 -0
  81. package/dist/editors/tiptap/toolbar/OrderedListButton.svelte.d.ts +7 -0
  82. package/dist/editors/tiptap/toolbar/RedoButton.svelte +18 -0
  83. package/dist/editors/tiptap/toolbar/RedoButton.svelte.d.ts +7 -0
  84. package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +18 -0
  85. package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte.d.ts +7 -0
  86. package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +18 -0
  87. package/dist/editors/tiptap/toolbar/SubscriptButton.svelte.d.ts +7 -0
  88. package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +18 -0
  89. package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte.d.ts +7 -0
  90. package/dist/editors/tiptap/toolbar/TableButton.svelte +258 -0
  91. package/dist/editors/tiptap/toolbar/TableButton.svelte.d.ts +7 -0
  92. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +84 -0
  93. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte.d.ts +10 -0
  94. package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +18 -0
  95. package/dist/editors/tiptap/toolbar/UnderlineButton.svelte.d.ts +7 -0
  96. package/dist/editors/tiptap/toolbar/UndoButton.svelte +18 -0
  97. package/dist/editors/tiptap/toolbar/UndoButton.svelte.d.ts +7 -0
  98. package/dist/form/Autocomplete.svelte +270 -137
  99. package/dist/form/Autocomplete.svelte.d.ts +58 -10
  100. package/dist/form/AutocompleteMulti.svelte +385 -227
  101. package/dist/form/AutocompleteMulti.svelte.d.ts +59 -10
  102. package/dist/form/Checkbox.svelte +124 -43
  103. package/dist/form/Checkbox.svelte.d.ts +26 -2
  104. package/dist/form/Chips.svelte +47 -17
  105. package/dist/form/Chips.svelte.d.ts +24 -3
  106. package/dist/form/ComboBox.svelte +30 -20
  107. package/dist/form/ComboBox.svelte.d.ts +1 -1
  108. package/dist/form/ComboBoxItemBuilder.svelte +161 -188
  109. package/dist/form/ComboBoxItemBuilder.svelte.d.ts +19 -2
  110. package/dist/form/ComboBoxMulti.svelte +38 -24
  111. package/dist/form/ComboBoxMulti.svelte.d.ts +1 -1
  112. package/dist/form/CronBuilder.svelte +84 -67
  113. package/dist/form/CronBuilder.svelte.d.ts +16 -3
  114. package/dist/form/DatePicker.svelte +177 -191
  115. package/dist/form/DatePicker.svelte.d.ts +17 -2
  116. package/dist/form/DateRangePicker.svelte +775 -0
  117. package/dist/form/DateRangePicker.svelte.d.ts +23 -0
  118. package/dist/form/DateTimePicker.svelte +168 -209
  119. package/dist/form/DateTimePicker.svelte.d.ts +10 -2
  120. package/dist/form/FormGroup.svelte +33 -10
  121. package/dist/form/FormGroup.svelte.d.ts +12 -2
  122. package/dist/form/Number.svelte +71 -29
  123. package/dist/form/Number.svelte.d.ts +39 -6
  124. package/dist/form/Radio.svelte +174 -0
  125. package/dist/form/Radio.svelte.d.ts +21 -0
  126. package/dist/form/RadioGroup.svelte +52 -138
  127. package/dist/form/RadioGroup.svelte.d.ts +19 -2
  128. package/dist/form/SegmentedControl.svelte +103 -57
  129. package/dist/form/SegmentedControl.svelte.d.ts +12 -2
  130. package/dist/form/Select.svelte +160 -229
  131. package/dist/form/Select.svelte.d.ts +35 -6
  132. package/dist/form/SelectMulti.svelte +166 -277
  133. package/dist/form/SelectMulti.svelte.d.ts +37 -6
  134. package/dist/form/Slider.svelte +185 -268
  135. package/dist/form/Slider.svelte.d.ts +33 -16
  136. package/dist/form/StringArrayBuilder.svelte +249 -0
  137. package/dist/form/StringArrayBuilder.svelte.d.ts +15 -0
  138. package/dist/form/Switch.svelte +164 -106
  139. package/dist/form/Switch.svelte.d.ts +22 -3
  140. package/dist/form/TextArea.svelte +80 -45
  141. package/dist/form/TextArea.svelte.d.ts +35 -10
  142. package/dist/form/Textbox.svelte +80 -47
  143. package/dist/form/Textbox.svelte.d.ts +41 -8
  144. package/dist/form/TimePicker.svelte +42 -47
  145. package/dist/form/TimePicker.svelte.d.ts +12 -2
  146. package/dist/form/comboBoxCore.svelte.d.ts +99 -0
  147. package/dist/form/comboBoxCore.svelte.js +243 -0
  148. package/dist/icon/Icon.svelte +8 -3
  149. package/dist/icon/Icon.svelte.d.ts +8 -3
  150. package/dist/icon/cube-send.svg +1 -0
  151. package/dist/icon/file-type-bmp.svg +1 -0
  152. package/dist/icon/file-type-csv.svg +1 -0
  153. package/dist/icon/file-type-doc.svg +1 -0
  154. package/dist/icon/file-type-docx.svg +1 -0
  155. package/dist/icon/file-type-jpg.svg +1 -0
  156. package/dist/icon/file-type-pdf.svg +1 -0
  157. package/dist/icon/file-type-png.svg +1 -0
  158. package/dist/icon/file-type-ppt.svg +1 -0
  159. package/dist/icon/file-type-svg.svg +1 -0
  160. package/dist/icon/file-type-txt.svg +1 -0
  161. package/dist/icon/file-type-xls.svg +1 -0
  162. package/dist/icon/file-type-zip.svg +1 -0
  163. package/dist/icon/index.d.ts +166 -145
  164. package/dist/icon/index.js +166 -146
  165. package/dist/icon/layout-sidebar-left-collapse.svg +1 -0
  166. package/dist/icon/layout-sidebar-left-expand.svg +1 -0
  167. package/dist/icon/logo-placeholder.svg +6 -0
  168. package/dist/icon/paperclip.svg +1 -0
  169. package/dist/icon/source-code.svg +1 -0
  170. package/dist/icon/sun-moon.svg +1 -0
  171. package/dist/icon/table.svg +6 -0
  172. package/dist/icon/thumb-down.svg +1 -0
  173. package/dist/icon/thumb-up.svg +1 -0
  174. package/dist/index.d.ts +93 -22
  175. package/dist/index.js +28 -27
  176. package/dist/layout/AppShell.svelte +12 -162
  177. package/dist/layout/AppShell.svelte.d.ts +6 -27
  178. package/dist/layout/CustomNavbar.svelte +9 -7
  179. package/dist/layout/CustomNavbar.svelte.d.ts +4 -2
  180. package/dist/layout/Navbar.svelte +158 -110
  181. package/dist/layout/Navbar.svelte.d.ts +26 -12
  182. package/dist/layout/NavbarItemDisplay.svelte +2 -2
  183. package/dist/layout/NavbarItemView.svelte +182 -0
  184. package/dist/layout/NavbarItemView.svelte.d.ts +10 -0
  185. package/dist/layout/Sidenav.svelte +280 -341
  186. package/dist/layout/Sidenav.svelte.d.ts +36 -4
  187. package/dist/models/ComboBoxItem.d.ts +2 -0
  188. package/dist/models/Employee.d.ts +53 -0
  189. package/dist/models/Employee.js +23 -0
  190. package/dist/models/Hyperlink.d.ts +3 -1
  191. package/dist/models/LinkCollectionItem.d.ts +3 -1
  192. package/dist/models/NavbarItem.d.ts +6 -2
  193. package/dist/theme.svelte.d.ts +0 -1
  194. package/dist/theme.svelte.js +46 -58
  195. package/dist/ui/Accordion.svelte +81 -242
  196. package/dist/ui/Accordion.svelte.d.ts +37 -14
  197. package/dist/ui/AccordionItem.svelte +303 -0
  198. package/dist/ui/AccordionItem.svelte.d.ts +21 -0
  199. package/dist/ui/ActionIcon.svelte +25 -21
  200. package/dist/ui/ActionIcon.svelte.d.ts +15 -2
  201. package/dist/ui/Badge.svelte +170 -161
  202. package/dist/ui/Badge.svelte.d.ts +16 -4
  203. package/dist/ui/Button.svelte +178 -205
  204. package/dist/ui/Button.svelte.d.ts +19 -2
  205. package/dist/ui/ButtonVariant.d.ts +15 -1
  206. package/dist/ui/ContextMenu.svelte +146 -0
  207. package/dist/ui/ContextMenu.svelte.d.ts +37 -0
  208. package/dist/ui/ContextMenuList.svelte +188 -0
  209. package/dist/ui/ContextMenuList.svelte.d.ts +12 -0
  210. package/dist/ui/Dialog.svelte +183 -104
  211. package/dist/ui/Dialog.svelte.d.ts +21 -2
  212. package/dist/ui/Drawer.svelte +237 -184
  213. package/dist/ui/Drawer.svelte.d.ts +20 -2
  214. package/dist/ui/Dropdown.svelte +24 -14
  215. package/dist/ui/Dropdown.svelte.d.ts +11 -2
  216. package/dist/ui/Dropzone.svelte +159 -57
  217. package/dist/ui/Dropzone.svelte.d.ts +29 -2
  218. package/dist/ui/Link.svelte +12 -4
  219. package/dist/ui/Link.svelte.d.ts +8 -2
  220. package/dist/ui/Loader.svelte +23 -18
  221. package/dist/ui/Loader.svelte.d.ts +5 -2
  222. package/dist/ui/Logo.svelte +37 -0
  223. package/dist/ui/Logo.svelte.d.ts +16 -0
  224. package/dist/ui/MultiSortable.svelte +287 -0
  225. package/dist/ui/MultiSortable.svelte.d.ts +50 -0
  226. package/dist/ui/Pagination.svelte +12 -6
  227. package/dist/ui/Pagination.svelte.d.ts +6 -2
  228. package/dist/ui/Popover.svelte +43 -65
  229. package/dist/ui/Popover.svelte.d.ts +14 -5
  230. package/dist/ui/ProgressBar.svelte +169 -0
  231. package/dist/ui/ProgressBar.svelte.d.ts +30 -0
  232. package/dist/ui/ProgressBarVariant.d.ts +7 -0
  233. package/dist/ui/ProgressBarVariant.js +1 -0
  234. package/dist/ui/SegmentedControl.svelte +0 -0
  235. package/dist/ui/SegmentedControl.svelte.d.ts +26 -0
  236. package/dist/ui/Sortable.svelte +163 -0
  237. package/dist/ui/Sortable.svelte.d.ts +47 -0
  238. package/dist/ui/Table.svelte +497 -56
  239. package/dist/ui/Table.svelte.d.ts +64 -2
  240. package/dist/ui/Tabs.svelte +22 -18
  241. package/dist/ui/Tabs.svelte.d.ts +6 -2
  242. package/dist/ui/ThemeSwitcher.svelte +26 -7
  243. package/dist/ui/ThemeSwitcher.svelte.d.ts +4 -2
  244. package/dist/ui/Tooltip.svelte +312 -180
  245. package/dist/ui/Tooltip.svelte.d.ts +4 -3
  246. package/dist/uiTheme.svelte.d.ts +86 -0
  247. package/dist/uiTheme.svelte.js +214 -0
  248. package/dist/util/DateFunctions.js +1 -1
  249. package/dist/util/DragDrop.d.ts +50 -0
  250. package/dist/util/DragDrop.js +154 -0
  251. package/dist/util/NavigateTo.js +2 -2
  252. package/dist/util/dayjs.d.ts +4 -0
  253. package/dist/util/dayjs.js +15 -0
  254. package/dist/util/interceptLinkClick.d.ts +13 -0
  255. package/dist/util/interceptLinkClick.js +33 -0
  256. package/package.json +66 -26
  257. package/dist/display/Alert.svelte +0 -179
  258. package/dist/display/Alert.svelte.d.ts +0 -13
  259. package/dist/form/FileInput.svelte +0 -235
  260. package/dist/form/FileInput.svelte.d.ts +0 -23
  261. package/dist/form/PasswordInput.svelte +0 -252
  262. package/dist/form/PasswordInput.svelte.d.ts +0 -33
  263. package/dist/form/Rating.svelte +0 -235
  264. package/dist/form/Rating.svelte.d.ts +0 -21
  265. package/dist/styles/components.css +0 -199
  266. package/dist/styles/dark.css +0 -146
  267. package/dist/styles/index.css +0 -116
  268. package/dist/styles/reset.css +0 -110
  269. package/dist/styles/semantic.css +0 -86
  270. package/dist/styles/tokens.css +0 -203
  271. package/dist/styles/utilities.css +0 -523
  272. package/dist/ui/Breadcrumbs.svelte +0 -131
  273. package/dist/ui/Breadcrumbs.svelte.d.ts +0 -16
  274. package/dist/ui/LoadingOverlay.svelte +0 -53
  275. package/dist/ui/LoadingOverlay.svelte.d.ts +0 -11
  276. package/dist/ui/Progress.svelte +0 -191
  277. package/dist/ui/Progress.svelte.d.ts +0 -15
  278. package/dist/ui/RingProgress.svelte +0 -141
  279. package/dist/ui/RingProgress.svelte.d.ts +0 -18
  280. package/dist/ui/Skeleton.svelte +0 -85
  281. package/dist/ui/Skeleton.svelte.d.ts +0 -12
  282. package/dist/ui/Stepper.svelte +0 -355
  283. package/dist/ui/Stepper.svelte.d.ts +0 -24
  284. package/dist/ui/Timeline.svelte +0 -225
  285. package/dist/ui/Timeline.svelte.d.ts +0 -23
  286. /package/dist/{actions → util}/ClickOutside.d.ts +0 -0
  287. /package/dist/{actions → util}/ClickOutside.js +0 -0
  288. /package/dist/{transitions → util}/Transitions.d.ts +0 -0
  289. /package/dist/{transitions → util}/Transitions.js +0 -0
@@ -1,28 +1,77 @@
1
- import type { ComboBoxItem, FetchFunctionType, SearchFunctionType } from "../models/ComboBoxItem.js";
2
- import { type Snippet } from "svelte";
3
- interface Props {
1
+ import type { ComboBoxGroup, ComboBoxItem, FetchFunctionType, RetrieveLabelFunctionType, SearchFunctionType } from '../models/ComboBoxItem.js';
2
+ import type { Snippet } from 'svelte';
3
+ export interface AutocompleteMultiProps {
4
+ /** HTML name attribute for the input */
5
+ name?: string;
6
+ /** Label text displayed above the input */
4
7
  label?: string;
8
+ /** Array of selected values (bindable) */
5
9
  values?: string[];
10
+ /**
11
+ * Array of full selected item objects (bindable). Can be passed initially to preset
12
+ * the selection with known labels — no `values` or retrieveLabelFunction needed.
13
+ */
6
14
  rawValues?: ComboBoxItem[];
15
+ /** Placeholder text when nothing is selected */
7
16
  placeholder?: string;
17
+ /** Mark field as required (shows asterisk) */
18
+ required?: boolean;
19
+ /** CSS classes for the control element */
8
20
  class?: string;
21
+ /** CSS classes for the container element */
22
+ containerClass?: string;
23
+ /** CSS classes for the FormGroup wrapper */
24
+ groupClass?: string;
25
+ /** Disable the input */
9
26
  disabled?: boolean;
10
- required?: boolean;
27
+ /** Show error state styling */
11
28
  showError?: boolean;
29
+ /** Error message to display */
12
30
  errorText?: string;
31
+ /** Auto-focus the input on mount */
13
32
  autofocus?: boolean;
14
- showNoResultsMessage?: boolean;
33
+ /** Auto-focus on every dialog open */
34
+ autofocusDialog?: boolean;
35
+ /** Hide "no results" message when search finds nothing */
36
+ hideNoResults?: boolean;
37
+ /** Close the dropdown after selecting an option */
38
+ closeOnSelection?: boolean;
39
+ /**
40
+ * Offer to add the typed text as a new chip when it doesn't match an existing option.
41
+ * On by default — set to `false` to restrict selection to the provided options.
42
+ */
43
+ allowAdd?: boolean;
44
+ /** Builds the label shown for the "add new value" suggestion (default: `Add "<value>"`) */
45
+ addItemLabel?: (value: string) => string;
46
+ /** Text shown while loading options */
15
47
  loadingText?: string;
48
+ /** SVG icon displayed on the left side */
49
+ leftIconSvg?: string;
50
+ /** Static list of autocomplete options */
16
51
  options?: ComboBoxItem[];
17
- fetchFunction?: FetchFunctionType;
18
- searchFunction?: SearchFunctionType;
19
- tooltipLocation?: "top" | "bottom" | "left" | "right";
52
+ /** Options organized into groups */
53
+ groupedOptions?: ComboBoxGroup[];
54
+ /** Position of the tooltip */
55
+ tooltipLocation?: 'top' | 'bottom' | 'left' | 'right';
56
+ /** Async function to fetch all options */
57
+ fetchFunction?: FetchFunctionType | null;
58
+ /** Async function to search/filter options based on input */
59
+ searchFunction?: SearchFunctionType | null;
60
+ /** Async function to retrieve labels for values */
61
+ retrieveLabelFunction?: RetrieveLabelFunctionType | null;
62
+ /** Rich tooltip content using a Svelte snippet */
20
63
  tooltipContent?: Snippet;
64
+ /** Simple tooltip text */
21
65
  tooltipText?: string;
66
+ /** Callback when Enter is pressed with the current filter text */
67
+ enterPressed?: (e: string) => void;
68
+ /** Callback when selection changes (returns value strings) */
22
69
  onchange?: (e: string[]) => void;
70
+ /** Callback when selection changes (returns full item objects) */
23
71
  onchangeRaw?: (e: ComboBoxItem[]) => void;
24
- onCreate?: (value: string) => void;
72
+ /** Callback when the user chooses to add the typed value as a new item */
73
+ onItemAdded?: (value: string) => void;
25
74
  }
26
- declare const AutocompleteMulti: import("svelte").Component<Props, {}, "values" | "rawValues">;
75
+ declare const AutocompleteMulti: import("svelte").Component<AutocompleteMultiProps, {}, "values" | "rawValues">;
27
76
  type AutocompleteMulti = ReturnType<typeof AutocompleteMulti>;
28
77
  export default AutocompleteMulti;
@@ -1,17 +1,48 @@
1
- <script lang="ts">
2
- interface Props {
1
+ <script module lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ export interface CheckboxProps {
5
+ /** HTML name attribute for the checkbox (falls back to label, then auto-generated) */
6
+ name?: string;
7
+ /** Label text displayed next to the checkbox */
3
8
  label?: string;
9
+ /** Mark field as required (shows asterisk) */
4
10
  required?: boolean;
11
+ /** Additional CSS classes */
5
12
  class?: string;
13
+ /** Custom ID for the input element */
6
14
  inputId?: string;
15
+ /** Disable the checkbox */
7
16
  disabled?: boolean;
17
+ /** Show error state styling */
8
18
  showError?: boolean;
19
+ /** Error message to display */
9
20
  errorText?: string;
21
+ /** Whether the checkbox is checked (bindable) */
10
22
  checked?: boolean;
23
+ /** When true, the checkbox state is controlled externally only. Clicking will call onchange but won't toggle the checkbox. */
24
+ controlled?: boolean;
25
+ /** Whether the checkbox is in an indeterminate state */
26
+ indeterminate?: boolean;
27
+ /** Callback when checked state changes */
11
28
  onchange?: (e: boolean) => void;
29
+ /** Accessible label for screen readers (use when no visible label) */
30
+ ariaLabel?: string;
31
+ /** Simple tooltip text */
32
+ tooltipText?: string;
33
+ /** Position of the tooltip */
34
+ tooltipLocation?: 'top' | 'bottom' | 'left' | 'right';
35
+ /** Rich tooltip content using a Svelte snippet */
36
+ tooltipContent?: Snippet;
12
37
  }
38
+ </script>
39
+
40
+ <script lang="ts">
41
+ import { Icon, iconInfoCircle } from '../icon/index.js';
42
+ import Tooltip from '../ui/Tooltip.svelte';
13
43
 
14
44
  let {
45
+ name,
15
46
  label,
16
47
  required = false,
17
48
  class: classes = '',
@@ -20,28 +51,67 @@
20
51
  showError = false,
21
52
  errorText = '',
22
53
  checked = $bindable(false),
23
- onchange = undefined
24
- }: Props = $props();
54
+ controlled = false,
55
+ indeterminate = false,
56
+ onchange = undefined,
57
+ ariaLabel = undefined,
58
+ tooltipText = undefined,
59
+ tooltipLocation = 'top',
60
+ tooltipContent = undefined
61
+ }: CheckboxProps = $props();
25
62
 
63
+ const autoName = `checkbox-${crypto.randomUUID()}`;
26
64
  const nonce = Math.random().toString(36).substring(2, 15);
27
65
 
66
+ let resolvedName = $derived(
67
+ (name || label || autoName).replace(/[^a-zA-Z0-9_\-:.]/g, '_')
68
+ );
69
+
28
70
  const id = $derived(inputId ? inputId : label ? `input-${label}` : `input-${nonce}`);
71
+
72
+ let inputEl = $state<HTMLInputElement>();
73
+ $effect(() => { if (inputEl) inputEl.indeterminate = indeterminate; });
29
74
  </script>
30
75
 
31
76
  <div class="checkbox-container {disabled ? 'disabled' : ''}">
32
77
  <label for={id}>
33
- <input
34
- class="checkbox {showError && 'error'} {classes}"
35
- type="checkbox"
36
- {id}
37
- {disabled}
38
- bind:checked
39
- onchange={() => onchange?.(checked)}
40
- />
78
+ {#if controlled}
79
+ <input
80
+ bind:this={inputEl}
81
+ class="checkbox text-base accent-accent mr-1 {showError && 'error'} {classes}"
82
+ type="checkbox"
83
+ {id}
84
+ name={resolvedName}
85
+ {disabled}
86
+ {checked}
87
+ aria-label={ariaLabel}
88
+ onchange={(e) => {
89
+ e.currentTarget.checked = checked;
90
+ onchange?.(!checked);
91
+ }}
92
+ />
93
+ {:else}
94
+ <input
95
+ bind:this={inputEl}
96
+ class="checkbox text-base accent-accent mr-1 {showError && 'error'} {classes}"
97
+ type="checkbox"
98
+ {id}
99
+ name={resolvedName}
100
+ {disabled}
101
+ bind:checked
102
+ aria-label={ariaLabel}
103
+ onchange={() => onchange?.(checked)}
104
+ />
105
+ {/if}
41
106
  <span class="label-text"
42
107
  >{label}
43
108
  {#if required}
44
109
  <span class="required">*</span>
110
+ {/if}
111
+ {#if tooltipContent || tooltipText}
112
+ <Tooltip {tooltipContent} location={tooltipLocation} text={tooltipText}>
113
+ <Icon svg={iconInfoCircle} size="1em" stroke="var(--accent-color)" />
114
+ </Tooltip>
45
115
  {/if}</span
46
116
  >
47
117
  </label>
@@ -51,12 +121,6 @@
51
121
  </div>
52
122
 
53
123
  <style>
54
- .checkbox-container {
55
- display: flex;
56
- align-items: center;
57
- gap: var(--pui-spacing-1_5);
58
- }
59
-
60
124
  label {
61
125
  display: flex;
62
126
  flex-direction: row;
@@ -87,28 +151,28 @@
87
151
  box-sizing: content-box;
88
152
  width: 16px;
89
153
  height: 16px;
90
- border: 2px solid var(--pui-border-disabled);
91
- transition: border-color var(--pui-transition-fast) var(--pui-ease-out);
154
+ border: 2px solid #ccc;
155
+ transition: 0.2s border-color ease;
92
156
  }
93
157
  :global(.dark) input:before {
94
- border-color: var(--pui-color-gray-600);
158
+ border-color: #666;
95
159
  }
96
160
  input:checked:before {
97
- border-color: var(--pui-color-primary);
98
- transition: border-color var(--pui-transition-slower) var(--pui-ease-out);
161
+ border-color: var(--ui-primary);
162
+ transition: 0.5s border-color ease;
99
163
  }
100
164
  :global(.dark) input:checked:before {
101
- border-color: var(--pui-color-primary);
165
+ border-color: var(--ui-accent);
102
166
  }
103
167
 
104
168
  input:disabled:before {
105
- border-color: var(--pui-border-disabled);
106
- background-color: var(--pui-bg-disabled);
169
+ border-color: #ccc;
170
+ background-color: #ccc;
107
171
  opacity: 0.5;
108
172
  }
109
173
  :global(.dark) input:disabled:before {
110
- border-color: var(--pui-color-gray-600);
111
- background-color: var(--pui-color-gray-600);
174
+ border-color: #666;
175
+ background-color: #666;
112
176
  }
113
177
  input:after {
114
178
  content: '';
@@ -118,7 +182,7 @@
118
182
  top: 50%;
119
183
  left: 50%;
120
184
  transform-origin: 50% 50%;
121
- background-color: var(--pui-color-primary);
185
+ background-color: var(--ui-primary);
122
186
  width: 16px;
123
187
  height: 16px;
124
188
  border-radius: 100vh;
@@ -128,11 +192,11 @@
128
192
  opacity: 0.5;
129
193
  }
130
194
  :global(.dark) input:after {
131
- background-color: var(--pui-color-primary);
195
+ background-color: var(--ui-accent);
132
196
  }
133
197
 
134
198
  input[type='checkbox']:before {
135
- border-radius: var(--pui-radius-sm);
199
+ border-radius: 4px;
136
200
  }
137
201
  input[type='checkbox']:after {
138
202
  width: 7px;
@@ -140,29 +204,46 @@
140
204
  border-radius: 0;
141
205
  transform: translate(-50%, -85%) scale(0) rotate(45deg);
142
206
  background-color: transparent;
143
- box-shadow: 4px 4px 0px 0px var(--pui-color-primary);
207
+ box-shadow: 4px 4px 0px 0px var(--ui-primary);
144
208
  }
145
209
  :global(.dark) input[type='checkbox']:after {
146
- box-shadow: 4px 4px 0px 0px var(--pui-color-primary);
210
+ box-shadow: 4px 4px 0px 0px var(--ui-accent);
147
211
  }
148
212
  input[type='checkbox']:checked:after {
149
- -webkit-animation: toggleOnCheckbox var(--pui-transition-fast) var(--pui-ease-out) forwards;
150
- animation: toggleOnCheckbox var(--pui-transition-fast) var(--pui-ease-out) forwards;
213
+ -webkit-animation: toggleOnCheckbox 0.2s ease forwards;
214
+ animation: toggleOnCheckbox 0.2s ease forwards;
215
+ }
216
+ input[type='checkbox']:indeterminate:before {
217
+ border-color: var(--ui-primary);
218
+ }
219
+ :global(.dark) input[type='checkbox']:indeterminate:before {
220
+ border-color: var(--ui-accent);
221
+ }
222
+ input[type='checkbox']:indeterminate:after {
223
+ width: 10px;
224
+ height: 2px;
225
+ border-radius: 1px;
226
+ background-color: var(--ui-primary);
227
+ box-shadow: none;
228
+ transform: translate(-50%, -50%) scale(1);
229
+ }
230
+ :global(.dark) input[type='checkbox']:indeterminate:after {
231
+ background-color: var(--ui-accent);
151
232
  }
152
233
  input[type='checkbox'].filled:before {
153
- border-radius: var(--pui-radius-sm);
234
+ border-radius: 4px;
154
235
  transition:
155
- border-color var(--pui-transition-fast) var(--pui-ease-out),
156
- background-color var(--pui-transition-fast) var(--pui-ease-out);
236
+ 0.2s border-color ease,
237
+ 0.2s background-color ease;
157
238
  }
158
239
  input[type='checkbox'].filled:checked:not(:disabled):before {
159
- background-color: var(--pui-color-primary);
240
+ background-color: var(--ui-primary);
160
241
  }
161
242
  :global(.dark) input[type='checkbox'].filled:checked:not(:disabled):before {
162
- background-color: var(--pui-color-primary);
243
+ background-color: var(--ui-accent);
163
244
  }
164
245
  input[type='checkbox'].filled:not(:disabled):after {
165
- box-shadow: 4px 4px 0px 0px var(--pui-color-white);
246
+ box-shadow: 4px 4px 0px 0px white;
166
247
  }
167
248
  @-webkit-keyframes toggleOnCheckbox {
168
249
  0% {
@@ -192,10 +273,10 @@
192
273
  }
193
274
 
194
275
  input.error:before {
195
- border-color: var(--pui-text-danger) !important;
276
+ border-color: var(--danger-text) !important;
196
277
  }
197
278
 
198
279
  .error-text {
199
- color: var(--pui-text-danger);
280
+ color: var(--danger-text);
200
281
  }
201
282
  </style>
@@ -1,14 +1,38 @@
1
- interface Props {
1
+ import type { Snippet } from 'svelte';
2
+ export interface CheckboxProps {
3
+ /** HTML name attribute for the checkbox (falls back to label, then auto-generated) */
4
+ name?: string;
5
+ /** Label text displayed next to the checkbox */
2
6
  label?: string;
7
+ /** Mark field as required (shows asterisk) */
3
8
  required?: boolean;
9
+ /** Additional CSS classes */
4
10
  class?: string;
11
+ /** Custom ID for the input element */
5
12
  inputId?: string;
13
+ /** Disable the checkbox */
6
14
  disabled?: boolean;
15
+ /** Show error state styling */
7
16
  showError?: boolean;
17
+ /** Error message to display */
8
18
  errorText?: string;
19
+ /** Whether the checkbox is checked (bindable) */
9
20
  checked?: boolean;
21
+ /** When true, the checkbox state is controlled externally only. Clicking will call onchange but won't toggle the checkbox. */
22
+ controlled?: boolean;
23
+ /** Whether the checkbox is in an indeterminate state */
24
+ indeterminate?: boolean;
25
+ /** Callback when checked state changes */
10
26
  onchange?: (e: boolean) => void;
27
+ /** Accessible label for screen readers (use when no visible label) */
28
+ ariaLabel?: string;
29
+ /** Simple tooltip text */
30
+ tooltipText?: string;
31
+ /** Position of the tooltip */
32
+ tooltipLocation?: 'top' | 'bottom' | 'left' | 'right';
33
+ /** Rich tooltip content using a Svelte snippet */
34
+ tooltipContent?: Snippet;
11
35
  }
12
- declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
36
+ declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "checked">;
13
37
  type Checkbox = ReturnType<typeof Checkbox>;
14
38
  export default Checkbox;
@@ -1,28 +1,52 @@
1
1
  <script lang="ts">
2
2
  import type { ComboBoxItem } from '../models/ComboBoxItem.js';
3
+ import type { ButtonVariant } from '../ui/ButtonVariant.js';
3
4
  import FormGroup from './FormGroup.svelte';
4
5
  import { iconCheck } from '../icon/index.js';
5
6
  import Button from '../ui/Button.svelte';
6
7
 
7
- interface Props {
8
- label: string;
8
+ export interface ChipsProps {
9
+ /** Label text displayed above the chips */
10
+ label?: string;
11
+ /** Visual style variant for chips */
12
+ variant?: ButtonVariant;
13
+ /** Visual style variant for selected/checked chips */
14
+ selectedVariant?: ButtonVariant;
15
+ /** Visual style variant for deselected chips (overrides variant for unselected state) */
16
+ deselectedVariant?: ButtonVariant;
17
+ /** Available chip options */
9
18
  options: ComboBoxItem[];
19
+ /** Mark field as required (shows asterisk) */
10
20
  required?: boolean;
21
+ /** Show error state styling */
11
22
  showError?: boolean;
23
+ /** Error message to display */
12
24
  errorText?: string;
25
+ /** Additional CSS classes */
13
26
  class?: string;
27
+ /** CSS classes for the container element */
14
28
  containerClass?: string;
29
+ /** Disable all chips */
15
30
  disabled?: boolean;
31
+ /** Selected value for single selection mode (bindable) */
16
32
  value?: string;
33
+ /** Selected values for multiple selection mode (bindable) */
17
34
  values?: string[];
35
+ /** Allow selecting multiple chips */
18
36
  multiple?: boolean;
37
+ /** Allow deselecting the current selection */
19
38
  deselectable?: boolean;
39
+ /** Position of the tooltip */
20
40
  tooltipLocation?: 'top' | 'bottom' | 'left' | 'right';
41
+ /** Callback when selection changes */
21
42
  onchange?: (e: string | string[] | undefined) => void;
22
43
  }
23
44
 
24
45
  let {
25
- label,
46
+ label = '',
47
+ variant = undefined,
48
+ selectedVariant = undefined,
49
+ deselectedVariant = undefined,
26
50
  options,
27
51
  required = false,
28
52
  showError = false,
@@ -36,7 +60,7 @@
36
60
  multiple = false,
37
61
  deselectable = true,
38
62
  onchange = undefined
39
- }: Props = $props();
63
+ }: ChipsProps = $props();
40
64
 
41
65
  const nonce = Math.random().toString(36).substring(2, 15);
42
66
  const randomName = $derived(label + nonce);
@@ -60,6 +84,8 @@
60
84
  onchange?.(values.length > 0 ? values : undefined);
61
85
  }
62
86
  }
87
+
88
+
63
89
  </script>
64
90
 
65
91
  <div class="radio-container {containerClass}">
@@ -73,13 +99,17 @@
73
99
  >
74
100
  {#each options as option}
75
101
  {@const checked = multiple ? values.includes(option.value) : option.value === value}
102
+ {@const hasSelection = multiple ? values.length > 0 : value !== undefined}
103
+ {@const chipVariant = checked
104
+ ? (selectedVariant ?? variant)
105
+ : (deselectedVariant && (multiple || hasSelection) ? deselectedVariant : variant)}
76
106
  <div class="flex">
77
107
  {#if checked}
78
- <Button class="chip checked" {disabled} onclick={() => handleChange(option)} svg={iconCheck} iconSize={'16px'}
108
+ <Button class="chip checked" {disabled} onclick={() => handleChange(option)} svg={iconCheck} iconSize={'16px'} variant={chipVariant}
79
109
  >{option.label}</Button
80
110
  >
81
111
  {:else}
82
- <Button class="chip" {disabled} onclick={() => handleChange(option)}
112
+ <Button class="chip" {disabled} onclick={() => handleChange(option)} variant={chipVariant}
83
113
  >{option.label}</Button
84
114
  >
85
115
  {/if}
@@ -95,34 +125,34 @@
95
125
  <style>
96
126
  .radio-options {
97
127
  display: flex;
98
- gap: var(--pui-spacing-2);
99
- border-radius: var(--pui-radius-lg);
128
+ gap: 0.5rem;
129
+ border-radius: 6px;
100
130
  }
101
131
 
102
132
  .radio-required {
103
- padding: var(--pui-spacing-1);
133
+ padding: 0.25rem;
104
134
  }
105
135
 
106
136
  .error {
107
- border: 1px solid var(--pui-text-danger);
137
+ border: 1px solid var(--danger-text);
108
138
  }
109
139
 
110
140
  .error-text {
111
- margin-top: var(--pui-spacing-1);
112
- color: var(--pui-text-danger);
141
+ margin-top: 0.25rem;
142
+ color: var(--danger-text);
113
143
  }
114
144
 
115
145
  :global(.chip) {
116
- padding: var(--pui-spacing-1) var(--pui-spacing-4) !important;
117
- border-radius: var(--pui-radius-full) !important;
146
+ padding: 0.25rem 1rem !important;
147
+ border-radius: 5rem !important;
118
148
  }
119
149
 
120
150
  :global(.chip.checked) {
121
- padding-left: var(--pui-spacing-1) !important;
122
- padding-right: var(--pui-spacing-2) !important;
151
+ padding-left: 0.3rem !important;
152
+ padding-right: 0.5rem !important;
123
153
  }
124
154
 
125
155
  :global(.chip .button) {
126
- gap: var(--pui-spacing-1);
156
+ gap: 0.25rem;
127
157
  }
128
158
  </style>
@@ -1,20 +1,41 @@
1
1
  import type { ComboBoxItem } from '../models/ComboBoxItem.js';
2
- interface Props {
3
- label: string;
2
+ import type { ButtonVariant } from '../ui/ButtonVariant.js';
3
+ export interface ChipsProps {
4
+ /** Label text displayed above the chips */
5
+ label?: string;
6
+ /** Visual style variant for chips */
7
+ variant?: ButtonVariant;
8
+ /** Visual style variant for selected/checked chips */
9
+ selectedVariant?: ButtonVariant;
10
+ /** Visual style variant for deselected chips (overrides variant for unselected state) */
11
+ deselectedVariant?: ButtonVariant;
12
+ /** Available chip options */
4
13
  options: ComboBoxItem[];
14
+ /** Mark field as required (shows asterisk) */
5
15
  required?: boolean;
16
+ /** Show error state styling */
6
17
  showError?: boolean;
18
+ /** Error message to display */
7
19
  errorText?: string;
20
+ /** Additional CSS classes */
8
21
  class?: string;
22
+ /** CSS classes for the container element */
9
23
  containerClass?: string;
24
+ /** Disable all chips */
10
25
  disabled?: boolean;
26
+ /** Selected value for single selection mode (bindable) */
11
27
  value?: string;
28
+ /** Selected values for multiple selection mode (bindable) */
12
29
  values?: string[];
30
+ /** Allow selecting multiple chips */
13
31
  multiple?: boolean;
32
+ /** Allow deselecting the current selection */
14
33
  deselectable?: boolean;
34
+ /** Position of the tooltip */
15
35
  tooltipLocation?: 'top' | 'bottom' | 'left' | 'right';
36
+ /** Callback when selection changes */
16
37
  onchange?: (e: string | string[] | undefined) => void;
17
38
  }
18
- declare const Chips: import("svelte").Component<Props, {}, "value" | "values">;
39
+ declare const Chips: import("svelte").Component<ChipsProps, {}, "value" | "values">;
19
40
  type Chips = ReturnType<typeof Chips>;
20
41
  export default Chips;