@for-the-people-initiative/design-system 1.3.1

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 (342) hide show
  1. package/README.md +80 -0
  2. package/dist/css/theme-dark.css +7 -0
  3. package/dist/css/tokens.css +2315 -0
  4. package/dist/scss/_tokens.scss +2521 -0
  5. package/dist/ts/tokens.ts +2441 -0
  6. package/package.json +80 -0
  7. package/src/components/Accordion/Accordion.scss +118 -0
  8. package/src/components/Accordion/Accordion.vue +105 -0
  9. package/src/components/Accordion/AccordionTab.vue +79 -0
  10. package/src/components/Alert/Alert.scss +109 -0
  11. package/src/components/Alert/Alert.vue +79 -0
  12. package/src/components/AppBar/AppBar.scss +73 -0
  13. package/src/components/AppBar/AppBar.vue +49 -0
  14. package/src/components/AtmosphericBackground/AtmosphericBackground.vue +198 -0
  15. package/src/components/AutoComplete/AutoComplete.scss +282 -0
  16. package/src/components/AutoComplete/AutoComplete.vue +398 -0
  17. package/src/components/Avatar/Avatar.scss +191 -0
  18. package/src/components/Avatar/Avatar.vue +44 -0
  19. package/src/components/Badge/Badge.scss +84 -0
  20. package/src/components/Badge/Badge.vue +41 -0
  21. package/src/components/BlockUI/BlockUI.scss +85 -0
  22. package/src/components/BlockUI/BlockUI.vue +90 -0
  23. package/src/components/Breadcrumb/Breadcrumb.scss +84 -0
  24. package/src/components/Breadcrumb/Breadcrumb.vue +141 -0
  25. package/src/components/Button/Button.scss +254 -0
  26. package/src/components/Button/Button.vue +68 -0
  27. package/src/components/CTA/CTA.scss +92 -0
  28. package/src/components/CTA/CTA.vue +33 -0
  29. package/src/components/Calendar/Calendar.scss +330 -0
  30. package/src/components/Calendar/Calendar.vue +455 -0
  31. package/src/components/Card/Card.scss +66 -0
  32. package/src/components/Card/Card.vue +48 -0
  33. package/src/components/Carousel/Carousel.scss +121 -0
  34. package/src/components/Carousel/Carousel.vue +191 -0
  35. package/src/components/Chart/Chart.scss +109 -0
  36. package/src/components/Chart/Chart.vue +209 -0
  37. package/src/components/Checkbox/Checkbox.scss +148 -0
  38. package/src/components/Checkbox/Checkbox.vue +75 -0
  39. package/src/components/Chip/Chip.scss +83 -0
  40. package/src/components/Chip/Chip.vue +73 -0
  41. package/src/components/ColorPicker/ColorPicker.scss +244 -0
  42. package/src/components/ColorPicker/ColorPicker.vue +411 -0
  43. package/src/components/Column/Column.scss +87 -0
  44. package/src/components/Column/Column.vue +45 -0
  45. package/src/components/ColumnGroup/ColumnGroup.scss +41 -0
  46. package/src/components/ColumnGroup/ColumnGroup.vue +27 -0
  47. package/src/components/ColumnGroup/ColumnGroupRow.vue +18 -0
  48. package/src/components/CommandPalette/CommandPalette.scss +143 -0
  49. package/src/components/CommandPalette/CommandPalette.vue +165 -0
  50. package/src/components/ConfirmDialog/ConfirmDialog.scss +177 -0
  51. package/src/components/ConfirmDialog/ConfirmDialog.vue +162 -0
  52. package/src/components/ConfirmPopup/ConfirmPopup.scss +180 -0
  53. package/src/components/ConfirmPopup/ConfirmPopup.vue +185 -0
  54. package/src/components/ContextMenu/ContextMenu.scss +171 -0
  55. package/src/components/ContextMenu/ContextMenu.vue +383 -0
  56. package/src/components/DataTable/DataTable.scss +162 -0
  57. package/src/components/DataTable/DataTable.vue +225 -0
  58. package/src/components/DataView/DataView.scss +149 -0
  59. package/src/components/DataView/DataView.vue +172 -0
  60. package/src/components/DatePicker/DatePicker.scss +71 -0
  61. package/src/components/DatePicker/DatePicker.vue +121 -0
  62. package/src/components/Dialog/Dialog.scss +161 -0
  63. package/src/components/Dialog/Dialog.vue +245 -0
  64. package/src/components/Divider/Divider.scss +147 -0
  65. package/src/components/Divider/Divider.vue +49 -0
  66. package/src/components/Dock/Dock.scss +221 -0
  67. package/src/components/Dock/Dock.vue +107 -0
  68. package/src/components/Drawer/Drawer.scss +220 -0
  69. package/src/components/Drawer/Drawer.vue +137 -0
  70. package/src/components/Dropdown/Dropdown.scss +218 -0
  71. package/src/components/Dropdown/Dropdown.vue +313 -0
  72. package/src/components/Editor/Editor.scss +156 -0
  73. package/src/components/Editor/Editor.vue +253 -0
  74. package/src/components/FAQ/FAQ.scss +24 -0
  75. package/src/components/FAQ/FAQ.vue +28 -0
  76. package/src/components/FeatureGrid/FeatureGrid.scss +92 -0
  77. package/src/components/FeatureGrid/FeatureGrid.vue +39 -0
  78. package/src/components/FieldSet/FieldSet.scss +97 -0
  79. package/src/components/FieldSet/FieldSet.vue +70 -0
  80. package/src/components/FileUpload/FileUpload.scss +137 -0
  81. package/src/components/FileUpload/FileUpload.vue +183 -0
  82. package/src/components/Footer/Footer.scss +95 -0
  83. package/src/components/Footer/Footer.vue +59 -0
  84. package/src/components/Form/Form.scss +72 -0
  85. package/src/components/Form/Form.vue +30 -0
  86. package/src/components/Form/FormField.vue +42 -0
  87. package/src/components/Galleria/Galleria.scss +295 -0
  88. package/src/components/Galleria/Galleria.vue +274 -0
  89. package/src/components/Hero/Hero.scss +116 -0
  90. package/src/components/Hero/Hero.vue +57 -0
  91. package/src/components/Image/Image.scss +129 -0
  92. package/src/components/Image/Image.vue +117 -0
  93. package/src/components/ImageCompare/ImageCompare.scss +97 -0
  94. package/src/components/ImageCompare/ImageCompare.vue +66 -0
  95. package/src/components/InPlace/InPlace.scss +97 -0
  96. package/src/components/InPlace/InPlace.vue +107 -0
  97. package/src/components/InlineMessage/InlineMessage.scss +69 -0
  98. package/src/components/InlineMessage/InlineMessage.vue +47 -0
  99. package/src/components/InputChips/InputChips.scss +165 -0
  100. package/src/components/InputChips/InputChips.vue +169 -0
  101. package/src/components/InputGroup/InputGroup.scss +57 -0
  102. package/src/components/InputGroup/InputGroup.vue +22 -0
  103. package/src/components/InputGroupAddon/InputGroupAddon.scss +28 -0
  104. package/src/components/InputGroupAddon/InputGroupAddon.vue +22 -0
  105. package/src/components/InputIcon/InputIcon.scss +58 -0
  106. package/src/components/InputIcon/InputIcon.vue +28 -0
  107. package/src/components/InputMask/InputMask.scss +65 -0
  108. package/src/components/InputMask/InputMask.vue +268 -0
  109. package/src/components/InputNumber/InputNumber.scss +122 -0
  110. package/src/components/InputNumber/InputNumber.vue +150 -0
  111. package/src/components/InputOtp/InputOtp.scss +88 -0
  112. package/src/components/InputOtp/InputOtp.vue +230 -0
  113. package/src/components/InputSwitch/InputSwitch.scss +131 -0
  114. package/src/components/InputSwitch/InputSwitch.vue +49 -0
  115. package/src/components/InputText/InputText.scss +61 -0
  116. package/src/components/InputText/InputText.vue +71 -0
  117. package/src/components/Knob/Knob.scss +92 -0
  118. package/src/components/Knob/Knob.vue +252 -0
  119. package/src/components/ListBox/ListBox.scss +152 -0
  120. package/src/components/ListBox/ListBox.vue +198 -0
  121. package/src/components/LogoCloud/LogoCloud.scss +64 -0
  122. package/src/components/LogoCloud/LogoCloud.vue +35 -0
  123. package/src/components/MegaMenu/MegaMenu.scss +280 -0
  124. package/src/components/MegaMenu/MegaMenu.vue +218 -0
  125. package/src/components/Menu/Menu.scss +102 -0
  126. package/src/components/Menu/Menu.vue +221 -0
  127. package/src/components/MenuBar/MenuBar.scss +208 -0
  128. package/src/components/MenuBar/MenuBar.vue +306 -0
  129. package/src/components/Message/Message.scss +126 -0
  130. package/src/components/Message/Message.vue +99 -0
  131. package/src/components/MeterGroup/MeterGroup.scss +105 -0
  132. package/src/components/MeterGroup/MeterGroup.vue +73 -0
  133. package/src/components/MultiSelect/MultiSelect.scss +239 -0
  134. package/src/components/MultiSelect/MultiSelect.vue +296 -0
  135. package/src/components/OrderList/OrderList.scss +133 -0
  136. package/src/components/OrderList/OrderList.vue +267 -0
  137. package/src/components/OrganizationChart/OrganizationChart.scss +145 -0
  138. package/src/components/OrganizationChart/OrganizationChart.vue +220 -0
  139. package/src/components/OverlayPanel/OverlayPanel.scss +69 -0
  140. package/src/components/OverlayPanel/OverlayPanel.vue +180 -0
  141. package/src/components/Paginator/Paginator.scss +130 -0
  142. package/src/components/Paginator/Paginator.vue +212 -0
  143. package/src/components/Panel/Panel.scss +113 -0
  144. package/src/components/Panel/Panel.vue +89 -0
  145. package/src/components/PanelMenu/PanelMenu.scss +211 -0
  146. package/src/components/PanelMenu/PanelMenu.vue +295 -0
  147. package/src/components/ParticleBackground/ParticleBackground.vue +310 -0
  148. package/src/components/PickList/PickList.scss +126 -0
  149. package/src/components/PickList/PickList.vue +249 -0
  150. package/src/components/PopOver/PopOver.scss +112 -0
  151. package/src/components/PopOver/PopOver.vue +254 -0
  152. package/src/components/PricingTable/PricingCard.vue +33 -0
  153. package/src/components/PricingTable/PricingTable.scss +133 -0
  154. package/src/components/PricingTable/PricingTable.vue +21 -0
  155. package/src/components/ProgressBar/ProgressBar.scss +58 -0
  156. package/src/components/ProgressBar/ProgressBar.vue +48 -0
  157. package/src/components/ProgressSpinner/ProgressSpinner.scss +48 -0
  158. package/src/components/ProgressSpinner/ProgressSpinner.vue +53 -0
  159. package/src/components/RadioButton/RadioButton.scss +148 -0
  160. package/src/components/RadioButton/RadioButton.vue +52 -0
  161. package/src/components/Rating/Rating.scss +109 -0
  162. package/src/components/Rating/Rating.vue +136 -0
  163. package/src/components/Row/Row.scss +38 -0
  164. package/src/components/Row/Row.vue +30 -0
  165. package/src/components/ScrollPanel/ScrollPanel.scss +90 -0
  166. package/src/components/ScrollPanel/ScrollPanel.vue +284 -0
  167. package/src/components/ScrollTop/ScrollTop.scss +59 -0
  168. package/src/components/ScrollTop/ScrollTop.vue +99 -0
  169. package/src/components/Section/Section.scss +58 -0
  170. package/src/components/Section/Section.vue +39 -0
  171. package/src/components/Select/Select.scss +98 -0
  172. package/src/components/Select/Select.vue +92 -0
  173. package/src/components/SelectButton/SelectButton.scss +65 -0
  174. package/src/components/SelectButton/SelectButton.vue +144 -0
  175. package/src/components/Sidebar/Sidebar.scss +170 -0
  176. package/src/components/Sidebar/Sidebar.vue +137 -0
  177. package/src/components/Skeleton/Skeleton.scss +43 -0
  178. package/src/components/Skeleton/Skeleton.vue +57 -0
  179. package/src/components/Slider/Slider.scss +103 -0
  180. package/src/components/Slider/Slider.vue +65 -0
  181. package/src/components/SpeedDial/SpeedDial.scss +217 -0
  182. package/src/components/SpeedDial/SpeedDial.vue +196 -0
  183. package/src/components/SplitButton/SplitButton.scss +264 -0
  184. package/src/components/SplitButton/SplitButton.vue +172 -0
  185. package/src/components/Splitter/Splitter.scss +95 -0
  186. package/src/components/Splitter/Splitter.vue +191 -0
  187. package/src/components/Splitter/SplitterPanel.vue +125 -0
  188. package/src/components/Stats/Stats.scss +54 -0
  189. package/src/components/Stats/Stats.vue +28 -0
  190. package/src/components/Steps/Steps.scss +164 -0
  191. package/src/components/Steps/Steps.vue +100 -0
  192. package/src/components/TabMenu/TabMenu.scss +106 -0
  193. package/src/components/TabMenu/TabMenu.vue +174 -0
  194. package/src/components/Tabs/TabPanel.vue +41 -0
  195. package/src/components/Tabs/Tabs.scss +82 -0
  196. package/src/components/Tabs/Tabs.vue +162 -0
  197. package/src/components/Tag/Tag.scss +73 -0
  198. package/src/components/Tag/Tag.vue +37 -0
  199. package/src/components/Terminal/Terminal.scss +80 -0
  200. package/src/components/Terminal/Terminal.vue +113 -0
  201. package/src/components/Testimonial/Testimonial.scss +80 -0
  202. package/src/components/Testimonial/Testimonial.vue +29 -0
  203. package/src/components/Textarea/Textarea.scss +65 -0
  204. package/src/components/Textarea/Textarea.vue +101 -0
  205. package/src/components/TieredMenu/TieredMenu.scss +146 -0
  206. package/src/components/TieredMenu/TieredMenu.vue +270 -0
  207. package/src/components/TieredMenu/TieredMenuSub.vue +132 -0
  208. package/src/components/Timeline/Timeline.scss +190 -0
  209. package/src/components/Timeline/Timeline.vue +79 -0
  210. package/src/components/Toast/Toast.scss +284 -0
  211. package/src/components/Toast/Toast.vue +162 -0
  212. package/src/components/ToggleButton/ToggleButton.scss +99 -0
  213. package/src/components/ToggleButton/ToggleButton.vue +65 -0
  214. package/src/components/ToggleSwitch/ToggleSwitch.scss +68 -0
  215. package/src/components/ToggleSwitch/ToggleSwitch.vue +44 -0
  216. package/src/components/Toolbar/Toolbar.scss +37 -0
  217. package/src/components/Toolbar/Toolbar.vue +23 -0
  218. package/src/components/Tooltip/Tooltip.scss +114 -0
  219. package/src/components/Tooltip/Tooltip.vue +169 -0
  220. package/src/components/Tree/Tree.scss +164 -0
  221. package/src/components/Tree/Tree.vue +273 -0
  222. package/src/components/TreeSelect/TreeSelect.scss +238 -0
  223. package/src/components/TreeSelect/TreeSelect.vue +401 -0
  224. package/src/components/TreeTable/TreeTable.scss +172 -0
  225. package/src/components/TreeTable/TreeTable.vue +285 -0
  226. package/src/components/VirtualScroller/VirtualScroller.scss +107 -0
  227. package/src/components/VirtualScroller/VirtualScroller.vue +234 -0
  228. package/src/scss/fonts.scss +63 -0
  229. package/src/scss/mixins/accent-gradient.scss +43 -0
  230. package/src/scss/mixins/border.scss +28 -0
  231. package/src/scss/mixins/breakpoint.scss +80 -0
  232. package/src/scss/mixins/container.scss +33 -0
  233. package/src/scss/mixins/elevation.scss +43 -0
  234. package/src/scss/mixins/grid.scss +23 -0
  235. package/src/scss/mixins/levitation.scss +15 -0
  236. package/src/scss/mixins/list.scss +5 -0
  237. package/src/scss/mixins/surface-atmospheric.scss +93 -0
  238. package/src/scss/mixins/surface.scss +19 -0
  239. package/src/scss/mixins/typography.scss +91 -0
  240. package/src/scss/utility-classes/utility-classes-spacing.scss +34 -0
  241. package/src/scss/utility-classes/utility-classes-typography.scss +114 -0
  242. package/tokens/components/accordion.json +127 -0
  243. package/tokens/components/autocomplete.json +238 -0
  244. package/tokens/components/avatar.json +220 -0
  245. package/tokens/components/badge.json +119 -0
  246. package/tokens/components/block-ui.json +40 -0
  247. package/tokens/components/breadcrumb.json +57 -0
  248. package/tokens/components/button.json +395 -0
  249. package/tokens/components/calendar.json +260 -0
  250. package/tokens/components/card.json +157 -0
  251. package/tokens/components/carousel.json +154 -0
  252. package/tokens/components/chart.json +132 -0
  253. package/tokens/components/checkbox.json +130 -0
  254. package/tokens/components/chip.json +100 -0
  255. package/tokens/components/color-picker.json +196 -0
  256. package/tokens/components/column-group.json +45 -0
  257. package/tokens/components/column.json +109 -0
  258. package/tokens/components/confirm-dialog.json +141 -0
  259. package/tokens/components/confirm-popup.json +101 -0
  260. package/tokens/components/context-menu.json +168 -0
  261. package/tokens/components/data-table.json +157 -0
  262. package/tokens/components/data-view.json +172 -0
  263. package/tokens/components/dialog.json +151 -0
  264. package/tokens/components/divider.json +45 -0
  265. package/tokens/components/dock.json +173 -0
  266. package/tokens/components/drawer.json +163 -0
  267. package/tokens/components/dropdown.json +230 -0
  268. package/tokens/components/editor.json +170 -0
  269. package/tokens/components/field-set.json +115 -0
  270. package/tokens/components/file-upload.json +193 -0
  271. package/tokens/components/galleria.json +235 -0
  272. package/tokens/components/image-compare.json +74 -0
  273. package/tokens/components/image.json +71 -0
  274. package/tokens/components/in-place.json +100 -0
  275. package/tokens/components/inline-message.json +107 -0
  276. package/tokens/components/input-chips.json +187 -0
  277. package/tokens/components/input-group-addon.json +47 -0
  278. package/tokens/components/input-group.json +21 -0
  279. package/tokens/components/input-icon.json +38 -0
  280. package/tokens/components/input-mask.json +136 -0
  281. package/tokens/components/input-number.json +144 -0
  282. package/tokens/components/input-otp.json +138 -0
  283. package/tokens/components/input-switch.json +108 -0
  284. package/tokens/components/input-text.json +136 -0
  285. package/tokens/components/knob.json +119 -0
  286. package/tokens/components/listbox.json +166 -0
  287. package/tokens/components/mega-menu.json +283 -0
  288. package/tokens/components/menu.json +145 -0
  289. package/tokens/components/menubar.json +152 -0
  290. package/tokens/components/message.json +151 -0
  291. package/tokens/components/meter-group.json +108 -0
  292. package/tokens/components/multi-select.json +244 -0
  293. package/tokens/components/order-list.json +193 -0
  294. package/tokens/components/organization-chart.json +188 -0
  295. package/tokens/components/overlay-panel.json +94 -0
  296. package/tokens/components/paginator.json +186 -0
  297. package/tokens/components/panel.json +120 -0
  298. package/tokens/components/panelmenu.json +190 -0
  299. package/tokens/components/picklist.json +187 -0
  300. package/tokens/components/popover.json +65 -0
  301. package/tokens/components/progress-bar.json +33 -0
  302. package/tokens/components/progress-spinner.json +38 -0
  303. package/tokens/components/radio.json +125 -0
  304. package/tokens/components/rating.json +76 -0
  305. package/tokens/components/row.json +62 -0
  306. package/tokens/components/scroll-panel.json +69 -0
  307. package/tokens/components/scroll-top.json +84 -0
  308. package/tokens/components/select-button.json +145 -0
  309. package/tokens/components/select.json +190 -0
  310. package/tokens/components/sidebar.json +146 -0
  311. package/tokens/components/skeleton.json +26 -0
  312. package/tokens/components/slider.json +82 -0
  313. package/tokens/components/speed-dial.json +144 -0
  314. package/tokens/components/split-button.json +316 -0
  315. package/tokens/components/splitter.json +88 -0
  316. package/tokens/components/steps.json +154 -0
  317. package/tokens/components/tabmenu.json +103 -0
  318. package/tokens/components/tabs.json +97 -0
  319. package/tokens/components/tag.json +122 -0
  320. package/tokens/components/terminal.json +100 -0
  321. package/tokens/components/textarea.json +96 -0
  322. package/tokens/components/tieredmenu.json +142 -0
  323. package/tokens/components/timeline.json +129 -0
  324. package/tokens/components/toast.json +281 -0
  325. package/tokens/components/toggle-button.json +220 -0
  326. package/tokens/components/toggle-switch.json +95 -0
  327. package/tokens/components/toolbar.json +41 -0
  328. package/tokens/components/tooltip.json +60 -0
  329. package/tokens/components/tree-select.json +224 -0
  330. package/tokens/components/tree.json +153 -0
  331. package/tokens/components/treetable.json +155 -0
  332. package/tokens/components/virtualscroller.json +95 -0
  333. package/tokens/primitives/color.json +137 -0
  334. package/tokens/primitives/radius.json +12 -0
  335. package/tokens/primitives/shadow.json +29 -0
  336. package/tokens/primitives/spacing.json +15 -0
  337. package/tokens/semantics/color.json +81 -0
  338. package/tokens/semantics/radius.json +10 -0
  339. package/tokens/semantics/shadow.json +9 -0
  340. package/tokens/semantics/spacing.json +24 -0
  341. package/tokens/themes/dark.json +7 -0
  342. package/tokens/themes/light.json +7 -0
@@ -0,0 +1,230 @@
1
+ <template>
2
+ <div class="input-otp" :class="additionalClasses">
3
+ <div class="input-otp__container">
4
+ <template v-for="(_, index) in length" :key="index">
5
+ <!-- Separator (optional, e.g., between groups) -->
6
+ <span
7
+ v-if="separator && index > 0 && index % separator === 0"
8
+ class="input-otp__separator"
9
+ ></span>
10
+
11
+ <input
12
+ ref="inputRefs"
13
+ type="text"
14
+ :inputmode="integerOnly ? 'numeric' : 'text'"
15
+ :pattern="integerOnly ? '[0-9]*' : undefined"
16
+ class="input-otp__cell"
17
+ :class="{
18
+ 'input-otp__cell--filled': values[index] !== '',
19
+ 'input-otp__cell--focus': focusedIndex === index,
20
+ }"
21
+ :value="mask && values[index] ? maskChar : values[index]"
22
+ :disabled="isDisabled"
23
+ :aria-label="`Digit ${index + 1} of ${length}`"
24
+ maxlength="1"
25
+ autocomplete="one-time-code"
26
+ @input="onInput($event, index)"
27
+ @keydown="onKeyDown($event, index)"
28
+ @focus="onFocus(index)"
29
+ @blur="onBlur"
30
+ @paste="onPaste($event, index)"
31
+ />
32
+ </template>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <style src="./InputOtp.scss"></style>
38
+
39
+ <script setup lang="ts">
40
+ import type { InputOtpProps, InputOtpEmits } from '../../types';
41
+ import { computed, ref, watch, nextTick, onMounted } from "vue";
42
+
43
+ defineOptions({ name: 'FtpInputOtp' });
44
+
45
+ const props = withDefaults(defineProps<InputOtpProps>(), {
46
+ modelValue: "",
47
+ length: 4,
48
+ mask: false,
49
+ maskChar: "*",
50
+ integerOnly: true,
51
+ separator: 0,
52
+ isDisabled: false,
53
+ isInvalid: false,
54
+ autoFocus: false,
55
+ });
56
+
57
+ const emit = defineEmits(["update:modelValue", "change", "complete"]);
58
+
59
+ const inputRefs = ref<(HTMLInputElement | null)[]>([]);
60
+ const focusedIndex = ref(-1);
61
+ const values = ref<string[]>([]);
62
+
63
+ // Initialize values from modelValue
64
+ const initializeValues = () => {
65
+ const newValues = new Array(props.length).fill("");
66
+ const modelChars = props.modelValue.split("");
67
+ for (let i = 0; i < Math.min(modelChars.length, props.length); i++) {
68
+ newValues[i] = modelChars[i];
69
+ }
70
+ values.value = newValues;
71
+ };
72
+
73
+ initializeValues();
74
+
75
+ watch(
76
+ () => props.modelValue,
77
+ () => {
78
+ initializeValues();
79
+ }
80
+ );
81
+
82
+ watch(
83
+ () => props.length,
84
+ () => {
85
+ initializeValues();
86
+ }
87
+ );
88
+
89
+ const additionalClasses = computed(() =>
90
+ [
91
+ props.isDisabled && "input-otp--disabled",
92
+ props.isInvalid && "input-otp--invalid",
93
+ ]
94
+ .filter(Boolean)
95
+ .join(" ")
96
+ );
97
+
98
+ const emitValue = () => {
99
+ const newValue = values.value.join("");
100
+ emit("update:modelValue", newValue);
101
+ emit("change", { value: newValue });
102
+
103
+ // Check if complete
104
+ if (newValue.length === props.length && !values.value.includes("")) {
105
+ emit("complete", { value: newValue });
106
+ }
107
+ };
108
+
109
+ const isValidChar = (char: any) => {
110
+ if (props.integerOnly) {
111
+ return /^[0-9]$/.test(char);
112
+ }
113
+ return char.length === 1;
114
+ };
115
+
116
+ const onInput = (event: Event, index: any) => {
117
+ const inputValue = (event.target as HTMLInputElement).value;
118
+ const char = inputValue.slice(-1);
119
+
120
+ if (char && !isValidChar(char)) {
121
+ (event.target as HTMLInputElement).value = values.value[index];
122
+ return;
123
+ }
124
+
125
+ values.value[index] = char;
126
+ emitValue();
127
+
128
+ // Move to next cell
129
+ if (char && index < props.length - 1) {
130
+ nextTick(() => {
131
+ inputRefs.value[index + 1]?.focus();
132
+ });
133
+ }
134
+ };
135
+
136
+ const onKeyDown = (event: KeyboardEvent, index: any) => {
137
+ switch (event.key) {
138
+ case "Backspace":
139
+ if (values.value[index] === "" && index > 0) {
140
+ // Move to previous cell and clear it
141
+ nextTick(() => {
142
+ inputRefs.value[index - 1]?.focus();
143
+ });
144
+ } else {
145
+ values.value[index] = "";
146
+ emitValue();
147
+ }
148
+ break;
149
+
150
+ case "Delete":
151
+ values.value[index] = "";
152
+ emitValue();
153
+ break;
154
+
155
+ case "ArrowLeft":
156
+ if (index > 0) {
157
+ event.preventDefault();
158
+ inputRefs.value[index - 1]?.focus();
159
+ }
160
+ break;
161
+
162
+ case "ArrowRight":
163
+ if (index < props.length - 1) {
164
+ event.preventDefault();
165
+ inputRefs.value[index + 1]?.focus();
166
+ }
167
+ break;
168
+
169
+ case "Home":
170
+ event.preventDefault();
171
+ inputRefs.value[0]?.focus();
172
+ break;
173
+
174
+ case "End":
175
+ event.preventDefault();
176
+ inputRefs.value[props.length - 1]?.focus();
177
+ break;
178
+ }
179
+ };
180
+
181
+ const onFocus = (index: any) => {
182
+ focusedIndex.value = index;
183
+ // Select existing content
184
+ nextTick(() => {
185
+ inputRefs.value[index]?.select();
186
+ });
187
+ };
188
+
189
+ const onBlur = () => {
190
+ focusedIndex.value = -1;
191
+ };
192
+
193
+ const onPaste = (event: ClipboardEvent, index: any) => {
194
+ event.preventDefault();
195
+ const pastedData = event.clipboardData?.getData("text") || "";
196
+ const chars = pastedData.split("").filter((char: any) => isValidChar(char));
197
+
198
+ // Fill from current index
199
+ for (let i = 0; i < chars.length && index + i < props.length; i++) {
200
+ values.value[index + i] = chars[i];
201
+ }
202
+
203
+ emitValue();
204
+
205
+ // Focus appropriate cell
206
+ const newIndex = Math.min(index + chars.length, props.length - 1);
207
+ nextTick(() => {
208
+ inputRefs.value[newIndex]?.focus();
209
+ });
210
+ };
211
+
212
+ // Focus first cell on mount if autoFocus
213
+ onMounted(() => {
214
+ if (props.autoFocus && inputRefs.value[0]) {
215
+ inputRefs.value[0].focus();
216
+ }
217
+ });
218
+
219
+ // Expose methods
220
+ defineExpose({
221
+ focus: () => inputRefs.value[0]?.focus(),
222
+ clear: () => {
223
+ values.value = new Array(props.length).fill("");
224
+ emitValue();
225
+ nextTick(() => {
226
+ inputRefs.value[0]?.focus();
227
+ });
228
+ },
229
+ });
230
+ </script>
@@ -0,0 +1,131 @@
1
+ @use "../../../dist/scss/tokens" as *;
2
+ @use "../../scss/mixins/accent-gradient.scss" as *;
3
+
4
+ $c: input-switch;
5
+
6
+ .#{$c} {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ gap: var(--inputSwitch-label-gap, $inputSwitch-label-gap);
10
+ cursor: pointer;
11
+ user-select: none;
12
+ }
13
+
14
+ .#{$c}__input {
15
+ position: absolute;
16
+ opacity: 0;
17
+ width: 0;
18
+ height: 0;
19
+ pointer-events: none;
20
+ }
21
+
22
+ .#{$c}__track {
23
+ position: relative;
24
+ display: inline-flex;
25
+ align-items: center;
26
+ flex-shrink: 0;
27
+ background-color: var(--inputSwitch-track-background-off, $inputSwitch-track-background-off);
28
+ border-radius: 9999px;
29
+ transition: background-color 0.2s ease;
30
+ }
31
+
32
+ .#{$c}__thumb {
33
+ position: absolute;
34
+ left: var(--inputSwitch-thumb-offset, $inputSwitch-thumb-offset);
35
+ background-color: var(--inputSwitch-thumb-color-default, $inputSwitch-thumb-color-default);
36
+ border-radius: 50%;
37
+ box-shadow: var(--inputSwitch-thumb-shadow, $inputSwitch-thumb-shadow);
38
+ transition: transform 0.2s ease;
39
+ }
40
+
41
+ .#{$c}__label {
42
+ color: var(--inputSwitch-label-color-default, $inputSwitch-label-color-default);
43
+ line-height: 1.4;
44
+ }
45
+
46
+ // Focus state
47
+ .#{$c}__input:focus-visible ~ .#{$c}__track {
48
+ outline: var(--inputSwitch-focus-ringWidth, $inputSwitch-focus-ringWidth) solid var(--inputSwitch-focus-ringColor, $inputSwitch-focus-ringColor);
49
+ outline-offset: var(--inputSwitch-focus-ringOffset, $inputSwitch-focus-ringOffset);
50
+ }
51
+
52
+ // Checked state
53
+ .#{$c}--checked {
54
+ .#{$c}__track {
55
+ @include accent-gradient($angle: 90deg);
56
+ }
57
+ }
58
+
59
+ // Disabled state
60
+ .#{$c}--disabled {
61
+ cursor: not-allowed;
62
+
63
+ .#{$c}__track {
64
+ background-color: var(--inputSwitch-track-background-disabled, $inputSwitch-track-background-disabled);
65
+ }
66
+
67
+ .#{$c}__label {
68
+ color: var(--inputSwitch-label-color-disabled, $inputSwitch-label-color-disabled);
69
+ }
70
+ }
71
+
72
+ // Sizes
73
+ .#{$c}--size-sm {
74
+ .#{$c}__track {
75
+ width: var(--inputSwitch-width-sm, $inputSwitch-width-sm);
76
+ height: var(--inputSwitch-height-sm, $inputSwitch-height-sm);
77
+ }
78
+
79
+ .#{$c}__thumb {
80
+ width: var(--inputSwitch-thumb-size-sm, $inputSwitch-thumb-size-sm);
81
+ height: var(--inputSwitch-thumb-size-sm, $inputSwitch-thumb-size-sm);
82
+ }
83
+
84
+ &.#{$c}--checked .#{$c}__thumb {
85
+ transform: translateX(calc(var(--inputSwitch-width-sm, $inputSwitch-width-sm) - var(--inputSwitch-thumb-size-sm, $inputSwitch-thumb-size-sm) - var(--inputSwitch-thumb-offset, $inputSwitch-thumb-offset) * 2));
86
+ }
87
+
88
+ .#{$c}__label {
89
+ font-size: 14px;
90
+ }
91
+ }
92
+
93
+ .#{$c}--size-md {
94
+ .#{$c}__track {
95
+ width: var(--inputSwitch-width-md, $inputSwitch-width-md);
96
+ height: var(--inputSwitch-height-md, $inputSwitch-height-md);
97
+ }
98
+
99
+ .#{$c}__thumb {
100
+ width: var(--inputSwitch-thumb-size-md, $inputSwitch-thumb-size-md);
101
+ height: var(--inputSwitch-thumb-size-md, $inputSwitch-thumb-size-md);
102
+ }
103
+
104
+ &.#{$c}--checked .#{$c}__thumb {
105
+ transform: translateX(calc(var(--inputSwitch-width-md, $inputSwitch-width-md) - var(--inputSwitch-thumb-size-md, $inputSwitch-thumb-size-md) - var(--inputSwitch-thumb-offset, $inputSwitch-thumb-offset) * 2));
106
+ }
107
+
108
+ .#{$c}__label {
109
+ font-size: 15px;
110
+ }
111
+ }
112
+
113
+ .#{$c}--size-lg {
114
+ .#{$c}__track {
115
+ width: var(--inputSwitch-width-lg, $inputSwitch-width-lg);
116
+ height: var(--inputSwitch-height-lg, $inputSwitch-height-lg);
117
+ }
118
+
119
+ .#{$c}__thumb {
120
+ width: var(--inputSwitch-thumb-size-lg, $inputSwitch-thumb-size-lg);
121
+ height: var(--inputSwitch-thumb-size-lg, $inputSwitch-thumb-size-lg);
122
+ }
123
+
124
+ &.#{$c}--checked .#{$c}__thumb {
125
+ transform: translateX(calc(var(--inputSwitch-width-lg, $inputSwitch-width-lg) - var(--inputSwitch-thumb-size-lg, $inputSwitch-thumb-size-lg) - var(--inputSwitch-thumb-offset, $inputSwitch-thumb-offset) * 2));
126
+ }
127
+
128
+ .#{$c}__label {
129
+ font-size: 16px;
130
+ }
131
+ }
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <label class="input-switch" :class="additionalClasses">
3
+ <input
4
+ type="checkbox"
5
+ class="input-switch__input"
6
+ :checked="modelValue"
7
+ :disabled="isDisabled"
8
+ :name="name"
9
+ role="switch"
10
+ :aria-checked="modelValue"
11
+ @change="onChange"
12
+ />
13
+ <span class="input-switch__track">
14
+ <span class="input-switch__thumb"></span>
15
+ </span>
16
+ <span v-if="label || $slots.default" class="input-switch__label">
17
+ <slot>{{ label }}</slot>
18
+ </span>
19
+ </label>
20
+ </template>
21
+
22
+ <style src="./InputSwitch.scss"></style>
23
+
24
+ <script setup lang="ts">
25
+ import type { InputSwitchProps, InputSwitchEmits } from '../../types';
26
+ import { computed } from "vue";
27
+
28
+ defineOptions({ name: 'FtpInputSwitch' });
29
+
30
+ const props = withDefaults(defineProps<InputSwitchProps>(), {
31
+ modelValue: false,
32
+ size: "md",
33
+ isDisabled: false,
34
+ });
35
+
36
+ const emit = defineEmits(["update:modelValue", "change"]);
37
+
38
+ const onChange = (event: Event) => {
39
+ const checked = (event.target as HTMLInputElement).checked;
40
+ emit("update:modelValue", checked);
41
+ emit("change", { value: checked, originalEvent: event });
42
+ };
43
+
44
+ const additionalClasses = computed(() => [
45
+ `input-switch--size-${props.size}`,
46
+ props.isDisabled && "input-switch--disabled",
47
+ props.modelValue && "input-switch--checked",
48
+ ].filter(Boolean).join(" "));
49
+ </script>
@@ -0,0 +1,61 @@
1
+ @use "../../../dist/scss/tokens" as *;
2
+
3
+ $c: input-text;
4
+
5
+ .#{$c} {
6
+ display: block;
7
+ width: 100%;
8
+ appearance: none;
9
+ background-color: var(--input-text-background-default, $input-text-background-default);
10
+ border: var(--input-text-border-width, $input-text-border-width) solid var(--input-text-border-color-default, $input-text-border-color-default);
11
+ border-radius: var(--input-text-radius, $input-text-radius);
12
+ padding: 0 var(--input-text-padding-x, $input-text-padding-x);
13
+ color: var(--input-text-text-default, $input-text-text-default);
14
+ transition: all 0.15s ease;
15
+
16
+ &::placeholder {
17
+ color: var(--input-text-text-placeholder, $input-text-text-placeholder);
18
+ }
19
+
20
+ &:hover:not(:disabled) {
21
+ border-color: var(--input-text-border-color-hover, $input-text-border-color-hover);
22
+ }
23
+
24
+ &:focus {
25
+ outline: var(--input-text-focus-ringWidth, $input-text-focus-ringWidth) solid var(--input-text-focus-ringColor, $input-text-focus-ringColor);
26
+ outline-offset: var(--input-text-focus-ringOffset, $input-text-focus-ringOffset);
27
+ border-color: var(--input-text-border-color-focus, $input-text-border-color-focus);
28
+ }
29
+
30
+ &:disabled {
31
+ cursor: not-allowed;
32
+ background-color: var(--input-text-background-disabled, $input-text-background-disabled);
33
+ border-color: var(--input-text-border-color-disabled, $input-text-border-color-disabled);
34
+ color: var(--input-text-text-disabled, $input-text-text-disabled);
35
+ }
36
+ }
37
+
38
+ // Invalid state
39
+ .#{$c}--invalid {
40
+ border-color: var(--input-text-border-color-error, $input-text-border-color-error);
41
+
42
+ &:focus {
43
+ border-color: var(--input-text-border-color-error, $input-text-border-color-error);
44
+ }
45
+ }
46
+
47
+ // Sizes
48
+ .#{$c}--size-sm {
49
+ height: var(--input-text-height-sm, $input-text-height-sm);
50
+ font-size: var(--input-text-fontSize-sm, $input-text-fontSize-sm);
51
+ }
52
+
53
+ .#{$c}--size-md {
54
+ height: var(--input-text-height-md, $input-text-height-md);
55
+ font-size: var(--input-text-fontSize-md, $input-text-fontSize-md);
56
+ }
57
+
58
+ .#{$c}--size-lg {
59
+ height: var(--input-text-height-lg, $input-text-height-lg);
60
+ font-size: var(--input-text-fontSize-lg, $input-text-fontSize-lg);
61
+ }
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <input
3
+ ref="inputRef"
4
+ class="input-text"
5
+ :class="additionalClasses"
6
+ :type="type"
7
+ :value="modelValue"
8
+ :placeholder="placeholder"
9
+ :disabled="isDisabled"
10
+ :name="name"
11
+ :aria-invalid="isInvalid || undefined"
12
+ :aria-describedby="ariaDescribedby || undefined"
13
+ @input="onInput"
14
+ @change="onChange"
15
+ @focus="onFocus"
16
+ @blur="onBlur"
17
+ />
18
+ </template>
19
+
20
+ <style src="./InputText.scss"></style>
21
+
22
+ <script setup lang="ts">
23
+ import type { InputTextProps, InputTextEmits } from '../../types';
24
+ import { computed, ref } from "vue";
25
+
26
+ defineOptions({ name: 'FtpInputText' });
27
+
28
+ const props = withDefaults(defineProps<InputTextProps>(), {
29
+ modelValue: "",
30
+ type: "text",
31
+ size: "md",
32
+ isDisabled: false,
33
+ isInvalid: false,
34
+ });
35
+
36
+ const emit = defineEmits(["update:modelValue", "input", "change", "focus", "blur"]);
37
+
38
+ const inputRef = ref<HTMLInputElement | null>(null);
39
+
40
+ const onInput = (event: Event) => {
41
+ const value = (event.target as HTMLInputElement).value;
42
+ emit("update:modelValue", value);
43
+ emit("input", { value, originalEvent: event });
44
+ };
45
+
46
+ const onChange = (event: Event) => {
47
+ emit("change", { value: (event.target as HTMLInputElement).value, originalEvent: event });
48
+ };
49
+
50
+ const onFocus = (event: FocusEvent) => {
51
+ emit("focus", { originalEvent: event });
52
+ };
53
+
54
+ const onBlur = (event: FocusEvent) => {
55
+ emit("blur", { originalEvent: event });
56
+ };
57
+
58
+ const additionalClasses = computed(() => [
59
+ `input-text--size-${props.size}`,
60
+ props.isDisabled && "input-text--disabled",
61
+ props.isInvalid && "input-text--invalid",
62
+ ].filter(Boolean).join(" "));
63
+
64
+ // Expose input ref for programmatic focus
65
+ defineExpose({
66
+ focus: () => inputRef.value?.focus(),
67
+ blur: () => inputRef.value?.blur(),
68
+ select: () => inputRef.value?.select(),
69
+ el: inputRef,
70
+ });
71
+ </script>
@@ -0,0 +1,92 @@
1
+ @use "../../../dist/scss/tokens" as *;
2
+
3
+ $c: knob;
4
+
5
+ .#{$c} {
6
+ position: relative;
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ }
11
+
12
+ .#{$c}__svg {
13
+ width: 100%;
14
+ height: 100%;
15
+ cursor: pointer;
16
+ touch-action: none;
17
+ transition: opacity 150ms ease;
18
+
19
+ &:focus {
20
+ outline: none;
21
+ }
22
+
23
+ &:focus-visible {
24
+ outline: var(--knob-focus-ringWidth, $knob-focus-ringWidth) solid var(--knob-focus-ringColor, $knob-focus-ringColor);
25
+ outline-offset: var(--knob-focus-ringOffset, $knob-focus-ringOffset);
26
+ border-radius: 50%;
27
+ }
28
+ }
29
+
30
+ .#{$c}__track {
31
+ stroke: var(--knob-track-color, $knob-track-color);
32
+ }
33
+
34
+ .#{$c}__fill {
35
+ stroke: var(--knob-fill-color-default, $knob-fill-color-default);
36
+ transition: stroke-dashoffset var(--knob-transition-duration, $knob-transition-duration) ease;
37
+ }
38
+
39
+ .#{$c}__value {
40
+ position: absolute;
41
+ top: 50%;
42
+ left: 50%;
43
+ transform: translate(-50%, -50%);
44
+ font-weight: var(--knob-valueText-fontWeight, $knob-valueText-fontWeight);
45
+ color: var(--knob-valueText-color-default, $knob-valueText-color-default);
46
+ pointer-events: none;
47
+ user-select: none;
48
+ }
49
+
50
+ // Sizes
51
+ .#{$c}--size-sm {
52
+ width: var(--knob-size-sm, $knob-size-sm);
53
+ height: var(--knob-size-sm, $knob-size-sm);
54
+
55
+ .#{$c}__value {
56
+ font-size: var(--knob-valueText-fontSize-sm, $knob-valueText-fontSize-sm);
57
+ }
58
+ }
59
+
60
+ .#{$c}--size-md {
61
+ width: var(--knob-size-md, $knob-size-md);
62
+ height: var(--knob-size-md, $knob-size-md);
63
+
64
+ .#{$c}__value {
65
+ font-size: var(--knob-valueText-fontSize-md, $knob-valueText-fontSize-md);
66
+ }
67
+ }
68
+
69
+ .#{$c}--size-lg {
70
+ width: var(--knob-size-lg, $knob-size-lg);
71
+ height: var(--knob-size-lg, $knob-size-lg);
72
+
73
+ .#{$c}__value {
74
+ font-size: var(--knob-valueText-fontSize-lg, $knob-valueText-fontSize-lg);
75
+ }
76
+ }
77
+
78
+ // Disabled state
79
+ .#{$c}--disabled {
80
+ .#{$c}__svg {
81
+ cursor: not-allowed;
82
+ opacity: 0.6;
83
+ }
84
+
85
+ .#{$c}__fill {
86
+ stroke: var(--knob-fill-color-disabled, $knob-fill-color-disabled);
87
+ }
88
+
89
+ .#{$c}__value {
90
+ color: var(--knob-valueText-color-disabled, $knob-valueText-color-disabled);
91
+ }
92
+ }