@onereach/ui-components 2.62.7-beta.1929.0 → 2.62.7-beta.1930.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 (253) hide show
  1. package/dist/v2/OrCardCollection-5d5046f1.js +227 -0
  2. package/dist/v2/{OrConfirm-24e2a1a2.js → OrConfirm-edc537b3.js} +1 -1
  3. package/dist/v2/{OrInlineInput-8455f9da.js → OrInlineInput-73ec1b85.js} +5 -5
  4. package/dist/v2/{OrInlineTextarea-1127e512.js → OrInlineTextarea-1858a348.js} +5 -5
  5. package/dist/v2/{OrInput-24028f23.js → OrInput-655bed71.js} +5 -5
  6. package/dist/v2/{OrSearch-978a3a6e.js → OrSearch-287a08a9.js} +1 -1
  7. package/dist/v2/{OrSelect-c6d0a69e.js → OrSelect-1a353817.js} +3 -3
  8. package/dist/v2/OrSortHeader-a6004b24.js +133 -0
  9. package/dist/v2/{OrTabs-f2a60b41.js → OrTabs-b4a9740b.js} +1 -1
  10. package/dist/v2/{OrTextarea-8773d494.js → OrTextarea-cc70afc9.js} +5 -5
  11. package/dist/v2/components/index.d.ts +2 -1
  12. package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  13. package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  14. package/dist/v2/components/or-card-collection-v3/index.d.ts +3 -0
  15. package/dist/v2/components/or-card-collection-v3/props.d.ts +4 -0
  16. package/dist/v2/components/or-card-collection-v3/styles.d.ts +6 -0
  17. package/dist/v2/components/or-card-collection-v3/types.d.ts +7 -0
  18. package/dist/v2/components/{or-segmented-control-v3/OrSegmentedControl.stories3.d.ts → or-sort-header-v3/OrSortHeader.stories3.d.ts} +1 -1
  19. package/dist/{v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts → v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts} +25 -45
  20. package/dist/v2/components/or-sort-header-v3/index.d.ts +2 -0
  21. package/dist/v2/components/or-sort-header-v3/styles.d.ts +1 -0
  22. package/dist/v2/components/or-sort-header-v3/types.d.ts +4 -0
  23. package/dist/v2/index.js +10 -9
  24. package/dist/v2/index11.js +20 -1
  25. package/dist/v2/index12.js +3 -12
  26. package/dist/v2/index13.js +3 -2
  27. package/dist/v2/index14.js +11 -5
  28. package/dist/v2/index15.js +5 -14
  29. package/dist/v2/index16.js +4 -19
  30. package/dist/v2/index17.js +28 -4
  31. package/dist/v2/index18.js +3 -7
  32. package/dist/v2/index19.js +5 -23
  33. package/dist/v2/index2.js +10 -9
  34. package/dist/v2/index20.js +25 -21
  35. package/dist/v2/index21.js +21 -18
  36. package/dist/v2/index22.js +20 -2
  37. package/dist/v2/index23.js +2 -4
  38. package/dist/v2/index24.js +2 -1
  39. package/dist/v2/index25.js +1 -2
  40. package/dist/v2/index26.js +2 -2
  41. package/dist/v2/index27.js +4 -7
  42. package/dist/v2/index28.js +6 -2
  43. package/dist/v2/index29.js +3 -3
  44. package/dist/v2/index30.js +3 -10
  45. package/dist/v2/index31.js +9 -12
  46. package/dist/v2/index32.js +11 -1
  47. package/dist/v2/index33.js +1 -1
  48. package/dist/v2/index34.js +1 -16
  49. package/dist/v2/index35.js +17 -17
  50. package/dist/v2/index36.js +17 -17
  51. package/dist/v2/index37.js +16 -1
  52. package/dist/v2/index38.js +1 -17
  53. package/dist/v2/index39.js +18 -22
  54. package/dist/v2/index40.js +22 -2
  55. package/dist/v2/index41.js +3 -3
  56. package/dist/v2/index42.js +1 -1
  57. package/dist/v2/index43.js +3 -20
  58. package/dist/v2/index44.js +1 -7
  59. package/dist/v2/index45.js +24 -1
  60. package/dist/v2/index46.js +3 -3
  61. package/dist/v2/index47.js +1 -2
  62. package/dist/v2/index48.js +2 -9
  63. package/dist/v2/index49.js +10 -17
  64. package/dist/v2/index50.js +17 -13
  65. package/dist/v2/index51.js +13 -14
  66. package/dist/v2/index52.js +14 -13
  67. package/dist/v2/index53.js +12 -15
  68. package/dist/v2/index54.js +16 -1
  69. package/dist/v2/index55.js +2 -6
  70. package/dist/v2/index56.js +1 -5
  71. package/dist/v2/index57.js +10 -3
  72. package/dist/v2/index58.js +2 -4
  73. package/dist/v2/index59.js +5 -3
  74. package/dist/v2/index60.js +2 -1
  75. package/dist/v2/index61.js +2 -5
  76. package/dist/v2/index62.js +3 -18
  77. package/dist/v2/index63.js +19 -2
  78. package/dist/v2/index65.js +2 -2
  79. package/dist/v2/index71.js +4 -15
  80. package/dist/v2/index72.js +13 -2
  81. package/dist/v2/index73.js +4 -6
  82. package/dist/v2/index74.js +6 -4
  83. package/dist/v2/index75.js +2 -1
  84. package/dist/v2/index76.js +3 -3
  85. package/dist/v2/index77.js +3 -4
  86. package/dist/v2/index78.js +4 -15
  87. package/dist/v2/index79.js +14 -11
  88. package/dist/v2/index80.js +11 -13
  89. package/dist/v2/index81.js +14 -2
  90. package/dist/v2/index82.js +2 -2
  91. package/dist/v2/index83.js +2 -3
  92. package/dist/v2/index84.js +1 -6
  93. package/dist/v2/index85.js +7 -20
  94. package/dist/v2/index86.js +12 -9
  95. package/dist/v2/index87.js +18 -1
  96. package/dist/v2/index88.js +2 -18
  97. package/dist/v2/index89.js +18 -2
  98. package/dist/v2/index90.js +2 -10
  99. package/dist/v2/index91.js +9 -11
  100. package/dist/v2/index92.js +12 -1
  101. package/dist/v2/index93.js +1 -6
  102. package/dist/v2/index94.js +5 -1
  103. package/dist/v2/index95.js +3 -0
  104. package/dist/v3/OrCardCollection-c6f3ac23.js +198 -0
  105. package/dist/v3/{OrConfirm-371630a4.js → OrConfirm-0bafcc7b.js} +1 -1
  106. package/dist/v3/{OrInlineInput-a080b0a3.js → OrInlineInput-dc71bbcb.js} +5 -3
  107. package/dist/v3/{OrInlineTextarea-08767485.js → OrInlineTextarea-bdebb784.js} +5 -3
  108. package/dist/v3/{OrInput-256d2530.js → OrInput-db4813b4.js} +5 -3
  109. package/dist/v3/{OrSearch-375eab55.js → OrSearch-0c29f499.js} +1 -1
  110. package/dist/v3/{OrSelect-52cfb10d.js → OrSelect-323a87b4.js} +6 -4
  111. package/dist/v3/OrSortHeader-5eba50cd.js +104 -0
  112. package/dist/v3/{OrTabs-ac0be933.js → OrTabs-194ca950.js} +1 -1
  113. package/dist/v3/{OrTextarea-09aa33dc.js → OrTextarea-98895b2a.js} +6 -4
  114. package/dist/v3/components/index.d.ts +2 -1
  115. package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  116. package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  117. package/dist/v3/components/or-card-collection-v3/index.d.ts +3 -0
  118. package/dist/v3/components/or-card-collection-v3/props.d.ts +4 -0
  119. package/dist/v3/components/or-card-collection-v3/styles.d.ts +6 -0
  120. package/dist/v3/components/or-card-collection-v3/types.d.ts +7 -0
  121. package/dist/v3/components/{or-segmented-control-v3/OrSegmentedControl.stories3.d.ts → or-sort-header-v3/OrSortHeader.stories3.d.ts} +1 -1
  122. package/dist/{v2/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts → v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts} +25 -45
  123. package/dist/v3/components/or-sort-header-v3/index.d.ts +2 -0
  124. package/dist/v3/components/or-sort-header-v3/styles.d.ts +1 -0
  125. package/dist/v3/components/or-sort-header-v3/types.d.ts +4 -0
  126. package/dist/v3/index.js +10 -9
  127. package/dist/v3/index11.js +19 -1
  128. package/dist/v3/index12.js +3 -11
  129. package/dist/v3/index13.js +3 -2
  130. package/dist/v3/index14.js +9 -4
  131. package/dist/v3/index15.js +4 -11
  132. package/dist/v3/index16.js +3 -17
  133. package/dist/v3/index17.js +25 -4
  134. package/dist/v3/index18.js +3 -6
  135. package/dist/v3/index19.js +5 -20
  136. package/dist/v3/index2.js +10 -9
  137. package/dist/v3/index20.js +21 -20
  138. package/dist/v3/index21.js +20 -15
  139. package/dist/v3/index22.js +16 -1
  140. package/dist/v3/index23.js +2 -4
  141. package/dist/v3/index24.js +2 -1
  142. package/dist/v3/index25.js +1 -2
  143. package/dist/v3/index26.js +2 -2
  144. package/dist/v3/index27.js +4 -6
  145. package/dist/v3/index28.js +5 -2
  146. package/dist/v3/index29.js +3 -3
  147. package/dist/v3/index30.js +3 -9
  148. package/dist/v3/index31.js +8 -11
  149. package/dist/v3/index32.js +10 -1
  150. package/dist/v3/index33.js +1 -1
  151. package/dist/v3/index34.js +1 -15
  152. package/dist/v3/index35.js +16 -14
  153. package/dist/v3/index36.js +14 -16
  154. package/dist/v3/index37.js +16 -2
  155. package/dist/v3/index38.js +2 -17
  156. package/dist/v3/index39.js +17 -17
  157. package/dist/v3/index40.js +16 -1
  158. package/dist/v3/index41.js +3 -3
  159. package/dist/v3/index42.js +1 -1
  160. package/dist/v3/index43.js +3 -16
  161. package/dist/v3/index44.js +1 -7
  162. package/dist/v3/index45.js +20 -1
  163. package/dist/v3/index46.js +3 -3
  164. package/dist/v3/index47.js +1 -2
  165. package/dist/v3/index48.js +2 -8
  166. package/dist/v3/index49.js +9 -14
  167. package/dist/v3/index50.js +14 -12
  168. package/dist/v3/index51.js +12 -11
  169. package/dist/v3/index52.js +11 -12
  170. package/dist/v3/index53.js +11 -11
  171. package/dist/v3/index54.js +12 -1
  172. package/dist/v3/index55.js +2 -5
  173. package/dist/v3/index56.js +1 -5
  174. package/dist/v3/index57.js +9 -3
  175. package/dist/v3/index58.js +2 -4
  176. package/dist/v3/index59.js +5 -3
  177. package/dist/v3/index60.js +2 -1
  178. package/dist/v3/index61.js +1 -4
  179. package/dist/v3/index62.js +3 -17
  180. package/dist/v3/index63.js +18 -2
  181. package/dist/v3/index65.js +2 -2
  182. package/dist/v3/index71.js +4 -12
  183. package/dist/v3/index72.js +10 -2
  184. package/dist/v3/index73.js +3 -5
  185. package/dist/v3/index74.js +5 -3
  186. package/dist/v3/index75.js +2 -1
  187. package/dist/v3/index76.js +3 -3
  188. package/dist/v3/index77.js +3 -4
  189. package/dist/v3/index78.js +4 -14
  190. package/dist/v3/index79.js +13 -10
  191. package/dist/v3/index80.js +10 -12
  192. package/dist/v3/index81.js +13 -1
  193. package/dist/v3/index82.js +1 -1
  194. package/dist/v3/index83.js +1 -3
  195. package/dist/v3/index84.js +1 -6
  196. package/dist/v3/index85.js +6 -16
  197. package/dist/v3/index86.js +12 -9
  198. package/dist/v3/index87.js +15 -1
  199. package/dist/v3/index88.js +2 -17
  200. package/dist/v3/index89.js +17 -2
  201. package/dist/v3/index90.js +2 -8
  202. package/dist/v3/index91.js +6 -9
  203. package/dist/v3/index92.js +11 -1
  204. package/dist/v3/index93.js +1 -6
  205. package/dist/v3/index94.js +5 -1
  206. package/dist/v3/index95.js +3 -0
  207. package/package.json +1 -1
  208. package/src/components/index.ts +2 -1
  209. package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +3 -0
  210. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +162 -0
  211. package/src/components/or-card-collection-v3/OrCardCollection.vue +210 -0
  212. package/src/components/or-card-collection-v3/index.ts +3 -0
  213. package/src/components/or-card-collection-v3/props.ts +4 -0
  214. package/src/components/or-card-collection-v3/styles.ts +53 -0
  215. package/src/components/or-card-collection-v3/types.ts +8 -0
  216. package/src/components/or-checkbox-v3/OrCheckbox.stories3.ts +1 -1
  217. package/src/components/or-inline-input-v3/OrInlineInput.vue +12 -10
  218. package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +12 -10
  219. package/src/components/or-input-v3/OrInput.vue +12 -10
  220. package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
  221. package/src/components/or-select-v3/OrSelect.vue +5 -3
  222. package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +3 -0
  223. package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +132 -0
  224. package/src/components/{or-segmented-control-v3/OrSegmentedControl.vue → or-sort-header-v3/OrSortHeader.vue} +38 -34
  225. package/src/components/or-sort-header-v3/index.ts +2 -0
  226. package/src/components/or-sort-header-v3/styles.ts +23 -0
  227. package/src/components/or-sort-header-v3/types.ts +4 -0
  228. package/src/components/or-switch-v3/OrSwitch.stories3.ts +1 -1
  229. package/src/components/or-tabs-v3/OrTabs.stories3.ts +4 -9
  230. package/src/components/or-tabs-v3/OrTabs.vue +1 -1
  231. package/src/components/or-textarea-v3/OrTextarea.vue +12 -10
  232. package/dist/v2/OrSegmentedControl-908d951a.js +0 -231
  233. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +0 -47
  234. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +0 -3
  235. package/dist/v2/components/or-segmented-control-v3/index.d.ts +0 -3
  236. package/dist/v2/components/or-segmented-control-v3/props.d.ts +0 -4
  237. package/dist/v2/components/or-segmented-control-v3/styles.d.ts +0 -3
  238. package/dist/v2/components/or-segmented-control-v3/types.d.ts +0 -4
  239. package/dist/v3/OrSegmentedControl-e6fdc79b.js +0 -183
  240. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +0 -47
  241. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +0 -3
  242. package/dist/v3/components/or-segmented-control-v3/index.d.ts +0 -3
  243. package/dist/v3/components/or-segmented-control-v3/props.d.ts +0 -4
  244. package/dist/v3/components/or-segmented-control-v3/styles.d.ts +0 -3
  245. package/dist/v3/components/or-segmented-control-v3/types.d.ts +0 -4
  246. package/src/components/or-segmented-control-v3/OrSegmentedControl.docs.mdx +0 -7
  247. package/src/components/or-segmented-control-v3/OrSegmentedControl.stories3.ts +0 -108
  248. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue +0 -63
  249. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/styles.ts +0 -50
  250. package/src/components/or-segmented-control-v3/index.ts +0 -3
  251. package/src/components/or-segmented-control-v3/props.ts +0 -4
  252. package/src/components/or-segmented-control-v3/styles.ts +0 -24
  253. package/src/components/or-segmented-control-v3/types.ts +0 -4
@@ -72,16 +72,18 @@
72
72
  </OrInputBox>
73
73
 
74
74
  <template v-if="!invalid">
75
- <OrHint :disabled="disabled">
76
- {{ hint }}
77
-
78
- <template
79
- v-if="maxLength"
80
- v-slot:addon
81
- >
82
- {{ currentLength }} / {{ maxLength }}
83
- </template>
84
- </OrHint>
75
+ <template v-if="hint || maxLength">
76
+ <OrHint :disabled="disabled">
77
+ {{ hint }}
78
+
79
+ <template
80
+ v-if="maxLength"
81
+ v-slot:addon
82
+ >
83
+ {{ currentLength }} / {{ maxLength }}
84
+ </template>
85
+ </OrHint>
86
+ </template>
85
87
  </template>
86
88
 
87
89
  <template v-else>
@@ -27,7 +27,7 @@ export default {
27
27
  },
28
28
 
29
29
  value: { // TODO: Remove Vue 2 fallback
30
- table: { disable: true },
30
+ control: { type: 'object' },
31
31
  },
32
32
 
33
33
  inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
@@ -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
+ };
@@ -3,61 +3,50 @@
3
3
  ref="root"
4
4
  v-bind="$attrs"
5
5
  :class="rootStyles"
6
+ :activated="activated ? '' : null"
7
+ @click.stop="toggleDirection()"
6
8
  >
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>
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
17
  </div>
18
18
  </template>
19
19
 
20
20
  <script lang="ts">
21
21
  import { computed, defineComponent, PropType, ref } from 'vue-demi';
22
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';
23
+ import { OrIconV3 as OrIcon } from '../or-icon-v3';
24
+ import { SortHeaderRoot } from './styles';
25
+ import { SortHeaderModel } from './types';
27
26
 
28
27
  export default defineComponent({
29
- name: 'OrSegmentedControl',
28
+ name: 'OrSortHeader',
30
29
 
31
30
  components: {
32
- OrSegmentedControlItem,
31
+ OrIcon,
33
32
  },
34
33
 
35
34
  inheritAttrs: false,
36
35
 
37
36
  props: {
38
- options: {
39
- type: Array as PropType<SegmentedControlOption[]>,
40
- default: [] as SegmentedControlOption[],
41
- },
42
-
43
37
  modelValue: {
44
- type: String,
38
+ type: Object as PropType<SortHeaderModel>,
45
39
  default: undefined,
46
40
  },
47
41
 
48
42
  value: { // TODO: Remove Vue 2 fallback
49
- type: String,
43
+ type: Object as PropType<SortHeaderModel>,
50
44
  default: undefined,
51
45
  },
52
46
 
53
- size: {
54
- type: String as PropType<SegmentedControlSize>,
55
- default: SegmentedControlSize.M,
56
- },
57
-
58
- disabled: {
59
- type: Boolean,
60
- default: false,
47
+ inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
48
+ type: String,
49
+ required: true,
61
50
  },
62
51
  },
63
52
 
@@ -65,6 +54,8 @@ export default defineComponent({
65
54
  'update:modelValue',
66
55
 
67
56
  'input',
57
+ 'focus',
58
+ 'blur',
68
59
  ],
69
60
 
70
61
  expose: [
@@ -79,9 +70,8 @@ export default defineComponent({
79
70
  const classAttribute = useClassAttribute();
80
71
 
81
72
  const rootStyles = computed(() => [
82
- 'or-segmented-control',
83
- ...SegmentedControlRoot,
84
- ...SegmentedControlRootSizes[props.size],
73
+ 'or-sort-header',
74
+ ...SortHeaderRoot,
85
75
  classAttribute.value,
86
76
  ]);
87
77
 
@@ -97,10 +87,24 @@ export default defineComponent({
97
87
  },
98
88
  });
99
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
+
100
102
  return {
101
103
  root,
102
104
  rootStyles,
103
105
  proxyModelValue,
106
+ activated,
107
+ toggleDirection,
104
108
  };
105
109
  },
106
110
  });
@@ -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
- table: { disable: true },
30
+ control: { type: 'object' },
31
31
  },
32
32
 
33
33
  inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
@@ -1,6 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { Meta, StoryFn } from '@storybook/vue3';
3
- import { ref, watch } from 'vue-demi';
3
+ import { ref } from 'vue-demi';
4
4
  import OrTabsDocs from './OrTabs.docs.mdx';
5
5
  import OrTabs from './OrTabs.vue';
6
6
  import { TabsVariant } from './props';
@@ -63,16 +63,11 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
63
63
 
64
64
  setup() {
65
65
  // State
66
- const model = ref<string>();
67
-
68
- // Effects
69
- watch(model, (value) => {
70
- console.debug(value);
71
- });
66
+ const value = ref<string>();
72
67
 
73
68
  return {
74
69
  args,
75
- model,
70
+ value,
76
71
  onUpdateModelValue: action('update:modelValue'),
77
72
  onInput: action('input'),
78
73
  };
@@ -80,7 +75,7 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
80
75
 
81
76
  template: `
82
77
  <OrTabs
83
- v-model="model"
78
+ v-model="value"
84
79
  v-bind="args"
85
80
  @update:modelValue="onUpdateModelValue"
86
81
  @input="onInput"
@@ -8,7 +8,7 @@
8
8
  <OrTab
9
9
  v-for="tab in tabs.normal"
10
10
  :key="tab.value"
11
- :selected="tab.value === proxyModelValue"
11
+ :selected="proxyModelValue === tab.value"
12
12
  @click.stop="proxyModelValue = tab.value"
13
13
  >
14
14
  {{ tab.label }}
@@ -40,16 +40,18 @@
40
40
  </OrInputBox>
41
41
 
42
42
  <template v-if="!invalid">
43
- <OrHint :disabled="disabled">
44
- {{ hint }}
45
-
46
- <template
47
- v-if="maxLength"
48
- v-slot:addon
49
- >
50
- {{ currentLength }} / {{ maxLength }}
51
- </template>
52
- </OrHint>
43
+ <template v-if="hint || maxLength">
44
+ <OrHint :disabled="disabled">
45
+ {{ hint }}
46
+
47
+ <template
48
+ v-if="maxLength"
49
+ v-slot:addon
50
+ >
51
+ {{ currentLength }} / {{ maxLength }}
52
+ </template>
53
+ </OrHint>
54
+ </template>
53
55
  </template>
54
56
 
55
57
  <template v-else>
@@ -1,231 +0,0 @@
1
- import { defineComponent, ref, computed } from 'vue-demi';
2
- import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
3
- import '@vueuse/core';
4
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
5
-
6
- const SegmentedControlItemRoot = [
7
- // Layout
8
- 'flex', 'items-center', 'justify-center',
9
- // Shape
10
- 'rounded-md',
11
- // Interactivity
12
- 'interactivity-auto',
13
- // Theme
14
- 'theme-foreground-default', 'dark:theme-foreground-default-dark',
15
- // Theme (selected)
16
- 'selected:theme-background-default', 'dark:selected:theme-background-default-dark',
17
- // Theme (selected, enabled)
18
- 'selected:enabled:shadow-card', 'dark:selected:enabled:shadow-card-dark'];
19
- const SegmentedControlItemRootSizes = {
20
- 'm': [
21
- // Box
22
- 'h-[44px] md:h-[36px]',
23
- // Spacing
24
- 'px-sm+ md:px-sm+',
25
- // Typography
26
- 'typography-body-2-regular'],
27
- 's': [
28
- // Box
29
- 'h-[36px] md:h-[32px]',
30
- // Spacing
31
- 'px-sm+ md:px-sm',
32
- // Typography
33
- 'typography-caption-regular']
34
- };
35
-
36
- var script$1 = defineComponent({
37
- name: 'OrSegmentedControlItem',
38
- inheritAttrs: false,
39
- props: {
40
- size: {
41
- type: String,
42
- required: true
43
- },
44
- selected: {
45
- type: Boolean,
46
- default: false
47
- },
48
- disabled: {
49
- type: Boolean,
50
- default: false
51
- }
52
- },
53
- setup(props) {
54
- // Refs
55
- const root = ref();
56
- // Styles
57
- const classAttribute = useClassAttribute();
58
- const rootStyles = computed(() => ['or-segmented-control-item', ...SegmentedControlItemRoot, ...SegmentedControlItemRootSizes[props.size], classAttribute.value]);
59
- return {
60
- root,
61
- rootStyles
62
- };
63
- }
64
- });
65
-
66
- /* script */
67
- const __vue_script__$1 = script$1;
68
-
69
- /* template */
70
- var __vue_render__$1 = function () {
71
- var _vm = this;
72
- var _h = _vm.$createElement;
73
- var _c = _vm._self._c || _h;
74
- return _c('div', _vm._b({
75
- ref: "root",
76
- class: _vm.rootStyles,
77
- attrs: {
78
- "selected": _vm.selected ? '' : null,
79
- "disabled": _vm.disabled ? '' : null
80
- }
81
- }, 'div', _vm.$attrs, false), [_c('div', {
82
- class: ['truncate']
83
- }, [_vm._t("default")], 2)]);
84
- };
85
- var __vue_staticRenderFns__$1 = [];
86
-
87
- /* style */
88
- const __vue_inject_styles__$1 = undefined;
89
- /* scoped */
90
- const __vue_scope_id__$1 = undefined;
91
- /* module identifier */
92
- const __vue_module_identifier__$1 = undefined;
93
- /* functional template */
94
- const __vue_is_functional_template__$1 = false;
95
- /* style inject */
96
-
97
- /* style inject SSR */
98
-
99
- /* style inject shadow dom */
100
-
101
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
102
- render: __vue_render__$1,
103
- staticRenderFns: __vue_staticRenderFns__$1
104
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
105
-
106
- var SegmentedControlSize;
107
- (function (SegmentedControlSize) {
108
- SegmentedControlSize["M"] = "m";
109
- SegmentedControlSize["S"] = "s";
110
- })(SegmentedControlSize || (SegmentedControlSize = {}));
111
-
112
- const SegmentedControlRoot = [
113
- // Layout
114
- 'grid', 'grid-flow-col', 'auto-cols-fr',
115
- // Shape
116
- 'rounded-md',
117
- // Spacing
118
- 'px-[2px]', 'py-[2px]',
119
- // Theme
120
- 'theme-background-surface-variant', 'dark:theme-background-surface-variant-dark'];
121
- const SegmentedControlRootSizes = {
122
- 'm': [],
123
- 's': []
124
- };
125
-
126
- var script = defineComponent({
127
- name: 'OrSegmentedControl',
128
- components: {
129
- OrSegmentedControlItem: __vue_component__$1
130
- },
131
- inheritAttrs: false,
132
- props: {
133
- options: {
134
- type: Array,
135
- default: []
136
- },
137
- modelValue: {
138
- type: String,
139
- default: undefined
140
- },
141
- value: {
142
- type: String,
143
- default: undefined
144
- },
145
- size: {
146
- type: String,
147
- default: SegmentedControlSize.M
148
- },
149
- disabled: {
150
- type: Boolean,
151
- default: false
152
- }
153
- },
154
- emits: ['update:modelValue', 'input'],
155
- expose: ['root'],
156
- setup(props, context) {
157
- // Refs
158
- const root = ref();
159
- // Styles
160
- const classAttribute = useClassAttribute();
161
- const rootStyles = computed(() => ['or-segmented-control', ...SegmentedControlRoot, ...SegmentedControlRootSizes[props.size], classAttribute.value]);
162
- // State
163
- const proxyModelValue = computed({
164
- get: () => {
165
- var _a;
166
- return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
167
- },
168
-
169
- set: value => {
170
- context.emit('input', value);
171
- context.emit('update:modelValue', value);
172
- }
173
- });
174
- return {
175
- root,
176
- rootStyles,
177
- proxyModelValue
178
- };
179
- }
180
- });
181
-
182
- /* script */
183
- const __vue_script__ = script;
184
-
185
- /* template */
186
- var __vue_render__ = function () {
187
- var _vm = this;
188
- var _h = _vm.$createElement;
189
- var _c = _vm._self._c || _h;
190
- return _c('div', _vm._b({
191
- ref: "root",
192
- class: _vm.rootStyles
193
- }, 'div', _vm.$attrs, false), _vm._l(_vm.options, function (option) {
194
- return _c('OrSegmentedControlItem', {
195
- key: option.value,
196
- attrs: {
197
- "size": _vm.size,
198
- "selected": option.value === _vm.proxyModelValue,
199
- "disabled": _vm.disabled
200
- },
201
- on: {
202
- "click": function ($event) {
203
- $event.stopPropagation();
204
- _vm.proxyModelValue = option.value;
205
- }
206
- }
207
- }, [_vm._v("\n " + _vm._s(option.label) + "\n ")]);
208
- }), 1);
209
- };
210
- var __vue_staticRenderFns__ = [];
211
-
212
- /* style */
213
- const __vue_inject_styles__ = undefined;
214
- /* scoped */
215
- const __vue_scope_id__ = undefined;
216
- /* module identifier */
217
- const __vue_module_identifier__ = undefined;
218
- /* functional template */
219
- const __vue_is_functional_template__ = false;
220
- /* style inject */
221
-
222
- /* style inject SSR */
223
-
224
- /* style inject shadow dom */
225
-
226
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
227
- render: __vue_render__,
228
- staticRenderFns: __vue_staticRenderFns__
229
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
230
-
231
- export { SegmentedControlSize as S, __vue_component__ as _ };