@onereach/ui-components 2.63.0-beta.1907.0 → 2.63.1-beta.1936.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 (300) hide show
  1. package/dist/v2/OrCardCollection-5d5046f1.js +227 -0
  2. package/dist/v2/{OrConfirm-8d149ece.js → OrConfirm-edc537b3.js} +1 -1
  3. package/dist/v2/{OrIconButton-5883eba0.js → OrIconButton-2088a37f.js} +1 -1
  4. package/dist/v2/{OrInlineInput-16a343c1.js → OrInlineInput-da65c72a.js} +9 -8
  5. package/dist/v2/{OrInlineTextarea-f154bdf5.js → OrInlineTextarea-da66759a.js} +9 -8
  6. package/dist/v2/{OrInput-4a50fe57.js → OrInput-655bed71.js} +9 -7
  7. package/dist/v2/{OrModal-64c5ae2e.js → OrModal-a1452b11.js} +1 -1
  8. package/dist/v2/{OrNotification-9c164908.js → OrNotification-ac420f39.js} +1 -1
  9. package/dist/v2/{OrSearch-a247f072.js → OrSearch-287a08a9.js} +1 -1
  10. package/dist/v2/OrSegmentedControl-17df63b8.js +236 -0
  11. package/dist/v2/{OrSelect-f416b7aa.js → OrSelect-1a353817.js} +4 -4
  12. package/dist/v2/OrSortHeader-a6004b24.js +133 -0
  13. package/dist/v2/{OrTabs-b4a9740b.js → OrTabs-f2a60b41.js} +1 -1
  14. package/dist/v2/{OrTag-ab03c4f7.js → OrTag-1ced4e58.js} +1 -1
  15. package/dist/v2/{OrTextarea-8773d494.js → OrTextarea-cc70afc9.js} +5 -5
  16. package/dist/v2/{OrTooltip-caeac590.js → OrTooltip-afe7030b.js} +33 -3
  17. package/dist/v2/components/index.d.ts +3 -0
  18. package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  19. package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  20. package/dist/v2/components/or-card-collection-v3/index.d.ts +3 -0
  21. package/dist/v2/components/or-card-collection-v3/props.d.ts +4 -0
  22. package/dist/v2/components/or-card-collection-v3/styles.d.ts +6 -0
  23. package/dist/v2/components/or-card-collection-v3/types.d.ts +7 -0
  24. package/dist/v2/components/{or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
  25. package/dist/v2/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
  26. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
  27. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
  28. package/dist/v2/components/or-segmented-control-v3/index.d.ts +3 -0
  29. package/dist/v2/components/or-segmented-control-v3/props.d.ts +4 -0
  30. package/dist/v2/components/or-segmented-control-v3/styles.d.ts +3 -0
  31. package/dist/v2/components/or-segmented-control-v3/types.d.ts +4 -0
  32. package/dist/{v3/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → v2/components/or-sort-header-v3/OrSortHeader.stories3.d.ts} +1 -1
  33. package/dist/v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
  34. package/dist/v2/components/or-sort-header-v3/index.d.ts +2 -0
  35. package/dist/v2/components/or-sort-header-v3/styles.d.ts +1 -0
  36. package/dist/v2/components/or-sort-header-v3/types.d.ts +4 -0
  37. package/dist/v2/components/or-tooltip-v3/styles.d.ts +2 -0
  38. package/dist/v2/index.js +17 -14
  39. package/dist/v2/index11.js +20 -1
  40. package/dist/v2/index12.js +3 -12
  41. package/dist/v2/index13.js +3 -2
  42. package/dist/v2/index14.js +11 -5
  43. package/dist/v2/index15.js +5 -14
  44. package/dist/v2/index16.js +4 -19
  45. package/dist/v2/index17.js +28 -4
  46. package/dist/v2/index18.js +3 -7
  47. package/dist/v2/index19.js +5 -23
  48. package/dist/v2/index2.js +17 -14
  49. package/dist/v2/index20.js +25 -21
  50. package/dist/v2/index21.js +21 -18
  51. package/dist/v2/index22.js +20 -2
  52. package/dist/v2/index23.js +2 -4
  53. package/dist/v2/index24.js +2 -1
  54. package/dist/v2/index25.js +1 -2
  55. package/dist/v2/index26.js +2 -2
  56. package/dist/v2/index27.js +4 -7
  57. package/dist/v2/index28.js +6 -2
  58. package/dist/v2/index29.js +3 -3
  59. package/dist/v2/index30.js +3 -10
  60. package/dist/v2/index31.js +9 -12
  61. package/dist/v2/index32.js +11 -1
  62. package/dist/v2/index33.js +1 -1
  63. package/dist/v2/index34.js +1 -16
  64. package/dist/v2/index35.js +17 -17
  65. package/dist/v2/index36.js +17 -17
  66. package/dist/v2/index37.js +16 -1
  67. package/dist/v2/index38.js +1 -17
  68. package/dist/v2/index39.js +18 -22
  69. package/dist/v2/index40.js +22 -2
  70. package/dist/v2/index41.js +3 -3
  71. package/dist/v2/index42.js +1 -1
  72. package/dist/v2/index43.js +3 -20
  73. package/dist/v2/index44.js +1 -7
  74. package/dist/v2/index45.js +24 -1
  75. package/dist/v2/index46.js +3 -3
  76. package/dist/v2/index47.js +1 -2
  77. package/dist/v2/index48.js +2 -9
  78. package/dist/v2/index49.js +10 -17
  79. package/dist/v2/index50.js +17 -13
  80. package/dist/v2/index51.js +13 -14
  81. package/dist/v2/index52.js +14 -13
  82. package/dist/v2/index53.js +12 -15
  83. package/dist/v2/index54.js +16 -1
  84. package/dist/v2/index55.js +2 -6
  85. package/dist/v2/index56.js +1 -5
  86. package/dist/v2/index57.js +10 -3
  87. package/dist/v2/index58.js +2 -4
  88. package/dist/v2/index59.js +5 -3
  89. package/dist/v2/index60.js +2 -1
  90. package/dist/v2/index61.js +2 -5
  91. package/dist/v2/index62.js +6 -334
  92. package/dist/v2/index63.js +4 -4
  93. package/dist/v2/index64.js +2 -16
  94. package/dist/v2/index65.js +15 -24
  95. package/dist/v2/index66.js +26 -4
  96. package/dist/v2/index67.js +2 -1
  97. package/dist/v2/index68.js +3 -4
  98. package/dist/v2/index69.js +3 -4
  99. package/dist/v2/index70.js +3 -10
  100. package/dist/v2/index71.js +3 -6
  101. package/dist/v2/index72.js +4 -4
  102. package/dist/v2/index73.js +15 -6
  103. package/dist/v2/index74.js +2 -2
  104. package/dist/v2/index75.js +6 -3
  105. package/dist/v2/index76.js +4 -3
  106. package/dist/v2/index77.js +1 -2
  107. package/dist/v2/index78.js +2 -14
  108. package/dist/v2/index79.js +2 -10
  109. package/dist/v2/index80.js +5 -4
  110. package/dist/v2/index81.js +12 -2
  111. package/dist/v2/index82.js +14 -2
  112. package/dist/v2/index83.js +2 -3
  113. package/dist/v2/index84.js +2 -8
  114. package/dist/v2/index85.js +2 -20
  115. package/dist/v2/index86.js +8 -18
  116. package/dist/v2/index87.js +21 -1
  117. package/dist/v2/index88.js +17 -16
  118. package/dist/v2/index89.js +1 -1
  119. package/dist/v2/index90.js +17 -9
  120. package/dist/v2/index91.js +2 -12
  121. package/dist/v2/index92.js +10 -1
  122. package/dist/v2/index93.js +12 -6
  123. package/dist/v2/index94.js +1 -2
  124. package/dist/v2/index95.js +7 -0
  125. package/dist/v2/index96.js +3 -0
  126. package/dist/v2/{types-fb93ea4e.js → types-89aad7fb.js} +1 -1
  127. package/dist/v3/OrCardCollection-c6f3ac23.js +198 -0
  128. package/dist/v3/{OrConfirm-456ddee1.js → OrConfirm-0bafcc7b.js} +1 -1
  129. package/dist/v3/{OrIconButton-b8066b5d.js → OrIconButton-5fb3a9aa.js} +1 -1
  130. package/dist/v3/{OrInlineInput-280768ba.js → OrInlineInput-d9bbc08c.js} +9 -6
  131. package/dist/v3/{OrInlineTextarea-0f63f344.js → OrInlineTextarea-d5a97ed9.js} +9 -6
  132. package/dist/v3/{OrInput-3eef7945.js → OrInput-db4813b4.js} +11 -6
  133. package/dist/v3/{OrModal-f67d37d3.js → OrModal-3a43b7e7.js} +1 -1
  134. package/dist/v3/{OrNotification-fefa1cb4.js → OrNotification-433d16f7.js} +1 -1
  135. package/dist/v3/{OrSearch-15a70678.js → OrSearch-0c29f499.js} +1 -1
  136. package/dist/v3/OrSegmentedControl-2bbc0f22.js +184 -0
  137. package/dist/v3/{OrSelect-9d300f55.js → OrSelect-323a87b4.js} +7 -5
  138. package/dist/v3/OrSortHeader-5eba50cd.js +104 -0
  139. package/dist/v3/{OrTabs-194ca950.js → OrTabs-ac0be933.js} +1 -1
  140. package/dist/v3/{OrTag-144b4ab8.js → OrTag-deaff080.js} +1 -1
  141. package/dist/v3/{OrTextarea-09aa33dc.js → OrTextarea-98895b2a.js} +6 -4
  142. package/dist/v3/{OrTooltip-30e05f9e.js → OrTooltip-36c6728c.js} +33 -3
  143. package/dist/v3/components/index.d.ts +3 -0
  144. package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  145. package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  146. package/dist/v3/components/or-card-collection-v3/index.d.ts +3 -0
  147. package/dist/v3/components/or-card-collection-v3/props.d.ts +4 -0
  148. package/dist/v3/components/or-card-collection-v3/styles.d.ts +6 -0
  149. package/dist/v3/components/or-card-collection-v3/types.d.ts +7 -0
  150. package/dist/v3/components/or-segmented-control-v3/OrSegmentedControl.stories3.d.ts +12 -0
  151. package/dist/v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
  152. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
  153. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
  154. package/dist/v3/components/or-segmented-control-v3/index.d.ts +3 -0
  155. package/dist/v3/components/or-segmented-control-v3/props.d.ts +4 -0
  156. package/dist/v3/components/or-segmented-control-v3/styles.d.ts +3 -0
  157. package/dist/v3/components/or-segmented-control-v3/types.d.ts +4 -0
  158. package/dist/v3/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +12 -0
  159. package/dist/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
  160. package/dist/v3/components/or-sort-header-v3/index.d.ts +2 -0
  161. package/dist/v3/components/or-sort-header-v3/styles.d.ts +1 -0
  162. package/dist/v3/components/or-sort-header-v3/types.d.ts +4 -0
  163. package/dist/v3/components/or-tooltip-v3/styles.d.ts +2 -0
  164. package/dist/v3/index.js +17 -14
  165. package/dist/v3/index11.js +19 -1
  166. package/dist/v3/index12.js +3 -11
  167. package/dist/v3/index13.js +3 -2
  168. package/dist/v3/index14.js +9 -4
  169. package/dist/v3/index15.js +4 -11
  170. package/dist/v3/index16.js +3 -17
  171. package/dist/v3/index17.js +25 -4
  172. package/dist/v3/index18.js +3 -6
  173. package/dist/v3/index19.js +5 -20
  174. package/dist/v3/index2.js +17 -14
  175. package/dist/v3/index20.js +21 -20
  176. package/dist/v3/index21.js +20 -15
  177. package/dist/v3/index22.js +16 -1
  178. package/dist/v3/index23.js +2 -4
  179. package/dist/v3/index24.js +2 -1
  180. package/dist/v3/index25.js +1 -2
  181. package/dist/v3/index26.js +2 -2
  182. package/dist/v3/index27.js +4 -6
  183. package/dist/v3/index28.js +5 -2
  184. package/dist/v3/index29.js +3 -3
  185. package/dist/v3/index30.js +3 -9
  186. package/dist/v3/index31.js +8 -11
  187. package/dist/v3/index32.js +10 -1
  188. package/dist/v3/index33.js +1 -1
  189. package/dist/v3/index34.js +1 -15
  190. package/dist/v3/index35.js +16 -14
  191. package/dist/v3/index36.js +14 -16
  192. package/dist/v3/index37.js +16 -2
  193. package/dist/v3/index38.js +2 -17
  194. package/dist/v3/index39.js +17 -17
  195. package/dist/v3/index40.js +16 -1
  196. package/dist/v3/index41.js +3 -3
  197. package/dist/v3/index42.js +1 -1
  198. package/dist/v3/index43.js +3 -16
  199. package/dist/v3/index44.js +1 -7
  200. package/dist/v3/index45.js +20 -1
  201. package/dist/v3/index46.js +3 -3
  202. package/dist/v3/index47.js +1 -2
  203. package/dist/v3/index48.js +2 -8
  204. package/dist/v3/index49.js +9 -14
  205. package/dist/v3/index50.js +14 -12
  206. package/dist/v3/index51.js +12 -11
  207. package/dist/v3/index52.js +11 -12
  208. package/dist/v3/index53.js +11 -11
  209. package/dist/v3/index54.js +12 -1
  210. package/dist/v3/index55.js +2 -5
  211. package/dist/v3/index56.js +1 -5
  212. package/dist/v3/index57.js +9 -3
  213. package/dist/v3/index58.js +2 -4
  214. package/dist/v3/index59.js +5 -3
  215. package/dist/v3/index60.js +2 -1
  216. package/dist/v3/index61.js +1 -4
  217. package/dist/v3/index62.js +6 -307
  218. package/dist/v3/index63.js +4 -4
  219. package/dist/v3/index64.js +2 -15
  220. package/dist/v3/index65.js +13 -22
  221. package/dist/v3/index66.js +24 -3
  222. package/dist/v3/index67.js +2 -1
  223. package/dist/v3/index68.js +3 -4
  224. package/dist/v3/index69.js +3 -4
  225. package/dist/v3/index70.js +3 -9
  226. package/dist/v3/index71.js +3 -4
  227. package/dist/v3/index72.js +4 -4
  228. package/dist/v3/index73.js +11 -5
  229. package/dist/v3/index74.js +2 -2
  230. package/dist/v3/index75.js +5 -2
  231. package/dist/v3/index76.js +4 -3
  232. package/dist/v3/index77.js +1 -2
  233. package/dist/v3/index78.js +2 -13
  234. package/dist/v3/index79.js +2 -9
  235. package/dist/v3/index80.js +5 -4
  236. package/dist/v3/index81.js +11 -1
  237. package/dist/v3/index82.js +13 -1
  238. package/dist/v3/index83.js +1 -3
  239. package/dist/v3/index84.js +1 -8
  240. package/dist/v3/index85.js +2 -17
  241. package/dist/v3/index86.js +7 -14
  242. package/dist/v3/index87.js +18 -1
  243. package/dist/v3/index88.js +14 -15
  244. package/dist/v3/index89.js +1 -1
  245. package/dist/v3/index90.js +15 -6
  246. package/dist/v3/index91.js +2 -11
  247. package/dist/v3/index92.js +8 -1
  248. package/dist/v3/index93.js +11 -6
  249. package/dist/v3/index94.js +1 -2
  250. package/dist/v3/index95.js +7 -0
  251. package/dist/v3/index96.js +3 -0
  252. package/dist/v3/{types-a2a8f948.js → types-d5d4ab32.js} +1 -1
  253. package/package.json +2 -8
  254. package/src/components/index.ts +3 -0
  255. package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +3 -0
  256. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +162 -0
  257. package/src/components/or-card-collection-v3/OrCardCollection.vue +210 -0
  258. package/src/components/or-card-collection-v3/index.ts +3 -0
  259. package/src/components/or-card-collection-v3/props.ts +4 -0
  260. package/src/components/or-card-collection-v3/styles.ts +53 -0
  261. package/src/components/or-card-collection-v3/types.ts +8 -0
  262. package/src/components/or-checkbox-v3/OrCheckbox.stories3.ts +1 -1
  263. package/src/components/or-inline-input-v3/OrInlineInput.vue +14 -12
  264. package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +14 -12
  265. package/src/components/or-input-v3/OrInput.vue +33 -29
  266. package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
  267. package/src/components/or-segmented-control-v3/OrSegmentedControl.docs.mdx +7 -0
  268. package/src/components/or-segmented-control-v3/OrSegmentedControl.stories3.ts +106 -0
  269. package/src/components/or-segmented-control-v3/OrSegmentedControl.vue +107 -0
  270. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue +64 -0
  271. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/styles.ts +50 -0
  272. package/src/components/or-segmented-control-v3/index.ts +3 -0
  273. package/src/components/or-segmented-control-v3/props.ts +4 -0
  274. package/src/components/or-segmented-control-v3/styles.ts +24 -0
  275. package/src/components/or-segmented-control-v3/types.ts +4 -0
  276. package/src/components/or-select-v3/OrSelect.vue +5 -3
  277. package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +3 -0
  278. package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +132 -0
  279. package/src/components/or-sort-header-v3/OrSortHeader.vue +111 -0
  280. package/src/components/or-sort-header-v3/index.ts +2 -0
  281. package/src/components/or-sort-header-v3/styles.ts +23 -0
  282. package/src/components/or-sort-header-v3/types.ts +4 -0
  283. package/src/components/or-switch-v3/OrSwitch.stories3.ts +1 -1
  284. package/src/components/or-tabs-v3/OrTabs.stories3.ts +9 -4
  285. package/src/components/or-tabs-v3/OrTabs.vue +1 -1
  286. package/src/components/or-textarea-v3/OrTextarea.vue +12 -10
  287. package/src/components/or-tooltip-v3/OrTooltip.vue +3 -2
  288. package/src/components/or-tooltip-v3/styles.ts +55 -0
  289. package/src/hooks/useClassAttribute.ts +1 -1
  290. package/dist/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
  291. package/dist/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
  292. package/dist/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -7
  293. package/dist/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
  294. package/dist/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
  295. package/dist/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -7
  296. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -16
  297. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -57
  298. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -322
  299. package/src/components/or-rich-text-editor-v3/index.ts +0 -1
  300. package/src/components/or-rich-text-editor-v3/styles.ts +0 -71
@@ -0,0 +1,106 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { Meta, StoryFn } from '@storybook/vue3';
3
+ import { ref, watch } from 'vue-demi';
4
+ import OrSegmentedControlDocs from './OrSegmentedControl.docs.mdx';
5
+ import OrSegmentedControl from './OrSegmentedControl.vue';
6
+ import { SegmentedControlSize } from './props';
7
+ import { SegmentedControlOption } from './types';
8
+
9
+ export default {
10
+ title: 'Components/Forms/Segmented Control',
11
+ component: OrSegmentedControl,
12
+
13
+ argTypes: {
14
+ // Props
15
+ options: {
16
+ control: { type: 'object' },
17
+ },
18
+
19
+ modelValue: {
20
+ control: { type: 'text' },
21
+ },
22
+
23
+ value: { // TODO: Remove Vue 2 fallback
24
+ table: { disable: true },
25
+ },
26
+
27
+ size: {
28
+ control: { type: 'select' },
29
+ options: Object.values(SegmentedControlSize),
30
+ },
31
+
32
+ disabled: {
33
+ control: { type: 'boolean' },
34
+ },
35
+
36
+ // Events
37
+ 'update:modelValue': {
38
+ table: { disable: true },
39
+ },
40
+
41
+ input: {
42
+ table: { disable: true },
43
+ },
44
+ },
45
+
46
+ parameters: {
47
+ layout: 'centered',
48
+
49
+ docs: {
50
+ page: OrSegmentedControlDocs,
51
+ },
52
+
53
+ design: {
54
+ type: 'figma',
55
+ url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=410%3A2097&t=7N93DAotOYMOX2kx-1',
56
+ },
57
+ },
58
+ } as Meta<typeof OrSegmentedControl>;
59
+
60
+ const Template: StoryFn<typeof OrSegmentedControl> = (args) => ({
61
+ components: {
62
+ OrSegmentedControl,
63
+ },
64
+
65
+ setup() {
66
+ // State
67
+ const model = ref<string>();
68
+
69
+ // Effects
70
+ watch(model, (value) => {
71
+ console.debug(value);
72
+ });
73
+
74
+ return {
75
+ args,
76
+ model,
77
+ onUpdateModelValue: action('update:modelValue'),
78
+ onInput: action('input'),
79
+ };
80
+ },
81
+
82
+ template: `
83
+ <OrSegmentedControl
84
+ v-model="model"
85
+ v-bind="args"
86
+ @update:modelValue="onUpdateModelValue"
87
+ @input="onInput"
88
+ />
89
+ `,
90
+ });
91
+
92
+ export const Base = Template.bind({});
93
+
94
+ Base.args = {
95
+ // Props
96
+ options: Array.from<string, SegmentedControlOption>([
97
+ 'Alfa',
98
+ 'Bravo',
99
+ 'Charlie',
100
+ 'Delta',
101
+ 'Echo',
102
+ ], (item) => ({
103
+ value: item.toLowerCase(),
104
+ label: item,
105
+ })),
106
+ };
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ >
7
+ <OrSegmentedControlItem
8
+ v-for="option in options"
9
+ :key="option.value"
10
+ :size="size"
11
+ :selected="option.value === proxyModelValue"
12
+ :disabled="disabled"
13
+ @click.stop="proxyModelValue = option.value"
14
+ >
15
+ {{ option.label }}
16
+ </OrSegmentedControlItem>
17
+ </div>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
22
+ import { useClassAttribute } from '../../hooks';
23
+ import OrSegmentedControlItem from './components/or-segmented-control-item/OrSegmentedControlItem.vue';
24
+ import { SegmentedControlSize } from './props';
25
+ import { SegmentedControlRoot, SegmentedControlRootSizes } from './styles';
26
+ import { SegmentedControlOption } from './types';
27
+
28
+ export default defineComponent({
29
+ name: 'OrSegmentedControl',
30
+
31
+ components: {
32
+ OrSegmentedControlItem,
33
+ },
34
+
35
+ inheritAttrs: false,
36
+
37
+ props: {
38
+ options: {
39
+ type: Array as PropType<SegmentedControlOption[]>,
40
+ default: [] as SegmentedControlOption[],
41
+ },
42
+
43
+ modelValue: {
44
+ type: String,
45
+ default: undefined,
46
+ },
47
+
48
+ value: { // TODO: Remove Vue 2 fallback
49
+ type: String,
50
+ default: undefined,
51
+ },
52
+
53
+ size: {
54
+ type: String as PropType<SegmentedControlSize>,
55
+ default: SegmentedControlSize.M,
56
+ },
57
+
58
+ disabled: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ },
63
+
64
+ emits: [
65
+ 'update:modelValue',
66
+
67
+ 'input',
68
+ ],
69
+
70
+ expose: [
71
+ 'root',
72
+ ],
73
+
74
+ setup(props, context) {
75
+ // Refs
76
+ const root = ref<HTMLElement>();
77
+
78
+ // Styles
79
+ const classAttribute = useClassAttribute();
80
+
81
+ const rootStyles = computed(() => [
82
+ 'or-segmented-control',
83
+ ...SegmentedControlRoot,
84
+ ...SegmentedControlRootSizes[props.size],
85
+ classAttribute.value,
86
+ ]);
87
+
88
+ // State
89
+ const proxyModelValue = computed({
90
+ get: () => {
91
+ return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
92
+ },
93
+
94
+ set: (value) => {
95
+ context.emit('input', value);
96
+ context.emit('update:modelValue', value);
97
+ },
98
+ });
99
+
100
+ return {
101
+ root,
102
+ rootStyles,
103
+ proxyModelValue,
104
+ };
105
+ },
106
+ });
107
+ </script>
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ :selected="selected ? '' : null"
7
+ :disabled="disabled ? '' : null"
8
+ @click="$emit('click', $event)"
9
+ >
10
+ <div :class="['truncate']">
11
+ <slot />
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
18
+ import { useClassAttribute } from '../../../../hooks';
19
+ import { SegmentedControlSize } from '../../props';
20
+ import { SegmentedControlItemRoot, SegmentedControlItemRootSizes } from './styles';
21
+
22
+ export default defineComponent({
23
+ name: 'OrSegmentedControlItem',
24
+
25
+ inheritAttrs: false,
26
+
27
+ props: {
28
+ size: {
29
+ type: String as PropType<SegmentedControlSize>,
30
+ required: true,
31
+ },
32
+
33
+ selected: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+
38
+ disabled: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ },
43
+
44
+ setup(props) {
45
+ // Refs
46
+ const root = ref<HTMLElement>();
47
+
48
+ // Styles
49
+ const classAttribute = useClassAttribute();
50
+
51
+ const rootStyles = computed(() => [
52
+ 'or-segmented-control-item',
53
+ ...SegmentedControlItemRoot,
54
+ ...SegmentedControlItemRootSizes[props.size],
55
+ classAttribute.value,
56
+ ]);
57
+
58
+ return {
59
+ root,
60
+ rootStyles,
61
+ };
62
+ },
63
+ });
64
+ </script>
@@ -0,0 +1,50 @@
1
+ import { SegmentedControlSize } from '../../props';
2
+
3
+ export const SegmentedControlItemRoot: string[] = [
4
+ // Layout
5
+ 'flex',
6
+ 'items-center',
7
+ 'justify-center',
8
+
9
+ // Shape
10
+ 'rounded-md',
11
+
12
+ // Interactivity
13
+ 'interactivity-auto',
14
+
15
+ // Theme
16
+ 'theme-foreground-default',
17
+ 'dark:theme-foreground-default-dark',
18
+
19
+ // Theme (selected)
20
+ 'selected:theme-background-default',
21
+ 'dark:selected:theme-background-default-dark',
22
+
23
+ // Theme (selected, enabled)
24
+ 'selected:enabled:shadow-card',
25
+ 'dark:selected:enabled:shadow-card-dark',
26
+ ];
27
+
28
+ export const SegmentedControlItemRootSizes: Record<SegmentedControlSize, string[]> = {
29
+ 'm': [
30
+ // Box
31
+ 'h-[44px] md:h-[36px]',
32
+
33
+ // Spacing
34
+ 'px-sm+ md:px-sm+',
35
+
36
+ // Typography
37
+ 'typography-body-2-regular',
38
+ ],
39
+
40
+ 's': [
41
+ // Box
42
+ 'h-[36px] md:h-[32px]',
43
+
44
+ // Spacing
45
+ 'px-sm+ md:px-sm',
46
+
47
+ // Typography
48
+ 'typography-caption-regular',
49
+ ],
50
+ };
@@ -0,0 +1,3 @@
1
+ export { default as OrSegmentedControlV3 } from './OrSegmentedControl.vue';
2
+ export * from './props';
3
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export enum SegmentedControlSize {
2
+ M = 'm',
3
+ S = 's',
4
+ }
@@ -0,0 +1,24 @@
1
+ import { SegmentedControlSize } from './props';
2
+
3
+ export const SegmentedControlRoot: string[] = [
4
+ // Layout
5
+ 'grid',
6
+ 'grid-flow-col',
7
+ 'auto-cols-fr',
8
+
9
+ // Shape
10
+ 'rounded-md',
11
+
12
+ // Spacing
13
+ 'px-[2px]',
14
+ 'py-[2px]',
15
+
16
+ // Theme
17
+ 'theme-background-surface-variant',
18
+ 'dark:theme-background-surface-variant-dark',
19
+ ];
20
+
21
+ export const SegmentedControlRootSizes: Record<SegmentedControlSize, string[]> = {
22
+ 'm': [],
23
+ 's': [],
24
+ };
@@ -0,0 +1,4 @@
1
+ export interface SegmentedControlOption {
2
+ value: string;
3
+ label: string;
4
+ }
@@ -193,9 +193,11 @@
193
193
  </OrInputBox>
194
194
 
195
195
  <template v-if="!invalid">
196
- <OrHint :disabled="disabled">
197
- {{ hint }}
198
- </OrHint>
196
+ <template v-if="hint">
197
+ <OrHint :disabled="disabled">
198
+ {{ hint }}
199
+ </OrHint>
200
+ </template>
199
201
  </template>
200
202
 
201
203
  <template v-else>
@@ -0,0 +1,3 @@
1
+ import { DocsPage } from '@storybook/addon-docs';
2
+
3
+ <DocsPage />
@@ -0,0 +1,132 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { Meta, StoryFn } from '@storybook/vue3';
3
+ import { ref, watch } from 'vue-demi';
4
+ import OrSortHeaderDocs from './OrSortHeader.docs.mdx';
5
+ import OrSortHeader from './OrSortHeader.vue';
6
+ import { SortHeaderModel } from './types';
7
+
8
+ export default {
9
+ title: 'Components/Sort Header',
10
+ component: OrSortHeader,
11
+
12
+ argTypes: {
13
+ // Slots
14
+ default: {
15
+ type: {
16
+ name: 'string',
17
+ required: true,
18
+ },
19
+
20
+ control: { type: 'text' },
21
+ },
22
+
23
+ // Props
24
+ modelValue: {
25
+ control: { type: 'object' },
26
+ },
27
+
28
+ value: { // TODO: Remove Vue 2 fallback
29
+ control: { type: 'object' },
30
+ },
31
+
32
+ inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
33
+ control: { type: 'text' },
34
+ },
35
+
36
+ // Events
37
+ 'update:modelValue': {
38
+ table: { disable: true },
39
+ },
40
+
41
+ input: {
42
+ table: { disable: true },
43
+ },
44
+
45
+ focus: {
46
+ table: { disable: true },
47
+ },
48
+
49
+ blur: {
50
+ table: { disable: true },
51
+ },
52
+ },
53
+
54
+ parameters: {
55
+ layout: 'centered',
56
+
57
+ docs: {
58
+ page: OrSortHeaderDocs,
59
+ },
60
+ },
61
+
62
+ decorators: [
63
+ () => ({
64
+ template: `
65
+ <div class="flex flex-row gap-sm">
66
+ <story />
67
+ </div>
68
+ `,
69
+ }),
70
+ ],
71
+ } as Meta<typeof OrSortHeader>;
72
+
73
+ const Template: StoryFn<typeof OrSortHeader> = (args) => ({
74
+ components: {
75
+ OrSortHeader,
76
+ },
77
+
78
+ setup() {
79
+ // State
80
+ const model = ref<SortHeaderModel>();
81
+
82
+ // Effects
83
+ watch(model, (value) => {
84
+ console.debug(value);
85
+ });
86
+
87
+ return {
88
+ args,
89
+ model,
90
+ onUpdateModelValue: action('update:modelValue'),
91
+ onInput: action('input'),
92
+ onFocus: action('focus'),
93
+ onBlur: action('blur'),
94
+ };
95
+ },
96
+
97
+ template: `
98
+ <div class="contents">
99
+ <OrSortHeader
100
+ v-model="model"
101
+ v-bind="args"
102
+ @update:modelValue="onUpdateModelValue"
103
+ @input="onInput"
104
+ @focus="onFocus"
105
+ @blur="onBlur"
106
+ >
107
+ ${args.default}
108
+ </OrSortHeader>
109
+
110
+ <OrSortHeader
111
+ v-model="model"
112
+ input-value="column-2"
113
+ @update:modelValue="onUpdateModelValue"
114
+ @input="onInput"
115
+ @focus="onFocus"
116
+ @blur="onBlur"
117
+ >
118
+ Column 2
119
+ </OrSortHeader>
120
+ </div>
121
+ `,
122
+ });
123
+
124
+ export const Default = Template.bind({});
125
+
126
+ Default.args = {
127
+ // Slots
128
+ default: 'Column 1',
129
+
130
+ // Props
131
+ inputValue: 'column-1',
132
+ };
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ :activated="activated ? '' : null"
7
+ @click.stop="toggleDirection()"
8
+ >
9
+ <slot />
10
+
11
+ <template v-if="activated">
12
+ <OrIcon
13
+ :class="{ 'rotate-180': proxyModelValue.direction === 'asc' }"
14
+ :icon="'arrow_downward'"
15
+ />
16
+ </template>
17
+ </div>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
22
+ import { useClassAttribute } from '../../hooks';
23
+ import { OrIconV3 as OrIcon } from '../or-icon-v3';
24
+ import { SortHeaderRoot } from './styles';
25
+ import { SortHeaderModel } from './types';
26
+
27
+ export default defineComponent({
28
+ name: 'OrSortHeader',
29
+
30
+ components: {
31
+ OrIcon,
32
+ },
33
+
34
+ inheritAttrs: false,
35
+
36
+ props: {
37
+ modelValue: {
38
+ type: Object as PropType<SortHeaderModel>,
39
+ default: undefined,
40
+ },
41
+
42
+ value: { // TODO: Remove Vue 2 fallback
43
+ type: Object as PropType<SortHeaderModel>,
44
+ default: undefined,
45
+ },
46
+
47
+ inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
48
+ type: String,
49
+ required: true,
50
+ },
51
+ },
52
+
53
+ emits: [
54
+ 'update:modelValue',
55
+
56
+ 'input',
57
+ 'focus',
58
+ 'blur',
59
+ ],
60
+
61
+ expose: [
62
+ 'root',
63
+ ],
64
+
65
+ setup(props, context) {
66
+ // Refs
67
+ const root = ref<HTMLElement>();
68
+
69
+ // Styles
70
+ const classAttribute = useClassAttribute();
71
+
72
+ const rootStyles = computed(() => [
73
+ 'or-sort-header',
74
+ ...SortHeaderRoot,
75
+ classAttribute.value,
76
+ ]);
77
+
78
+ // State
79
+ const proxyModelValue = computed({
80
+ get: () => {
81
+ return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
82
+ },
83
+
84
+ set: (value) => {
85
+ context.emit('input', value);
86
+ context.emit('update:modelValue', value);
87
+ },
88
+ });
89
+
90
+ const activated = computed(() => {
91
+ return proxyModelValue.value?.column === props.inputValue;
92
+ });
93
+
94
+ // Methods
95
+ function toggleDirection(): void {
96
+ proxyModelValue.value = {
97
+ column: props.inputValue,
98
+ direction: proxyModelValue.value?.direction === 'asc' ? 'desc' : 'asc',
99
+ };
100
+ }
101
+
102
+ return {
103
+ root,
104
+ rootStyles,
105
+ proxyModelValue,
106
+ activated,
107
+ toggleDirection,
108
+ };
109
+ },
110
+ });
111
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as OrSortHeaderV3 } from './OrSortHeader.vue';
2
+ export * from './types';
@@ -0,0 +1,23 @@
1
+ export const SortHeaderRoot: string[] = [
2
+ // Layout
3
+ 'inline-flex',
4
+ 'justify-normal',
5
+ 'items-center',
6
+
7
+ // Interactivity
8
+ 'interactivity-auto',
9
+
10
+ // Typography
11
+ 'typography-caption-regular',
12
+
13
+ // Typography (activated)
14
+ 'activated:typography-caption-semibold',
15
+
16
+ // Theme
17
+ 'theme-foreground-outline',
18
+ 'dark:theme-foreground-outline-dark',
19
+
20
+ // Theme (activated)
21
+ 'activated:theme-foreground-default',
22
+ 'dark:activated:theme-foreground-default-dark',
23
+ ];
@@ -0,0 +1,4 @@
1
+ export interface SortHeaderModel {
2
+ column: string;
3
+ direction: 'asc' | 'desc';
4
+ }
@@ -27,7 +27,7 @@ export default {
27
27
  },
28
28
 
29
29
  value: { // TODO: Remove Vue 2 fallback
30
- control: { type: 'object' },
30
+ table: { disable: true },
31
31
  },
32
32
 
33
33
  inputValue: { // TODO: Rename to `value` after complete migration to Vue 3