@onereach/ui-components 2.62.2 → 2.62.3-beta.1897.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.
- package/dist/v2/OrCardCollection-89a315ed.js +227 -0
- package/dist/v2/{OrConfirm-d561bf82.js → OrConfirm-3896bd11.js} +1 -1
- package/dist/v2/{OrInlineInput-e754cb9f.js → OrInlineInput-c1d6fb73.js} +5 -5
- package/dist/v2/{OrInlineTextarea-7dc58bb1.js → OrInlineTextarea-7ec4c40d.js} +5 -5
- package/dist/v2/{OrInput-0dcfba2a.js → OrInput-0508c3fb.js} +5 -5
- package/dist/v2/{OrSearch-45ea8c33.js → OrSearch-feca9f48.js} +1 -1
- package/dist/v2/{OrSelect-21247104.js → OrSelect-bb539517.js} +3 -3
- package/dist/v2/OrSortHeader-a6004b24.js +133 -0
- package/dist/v2/{OrTextarea-8773d494.js → OrTextarea-cc70afc9.js} +5 -5
- package/dist/v2/components/index.d.ts +2 -0
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
- package/dist/v2/components/or-card-collection-v3/index.d.ts +3 -0
- package/dist/v2/components/or-card-collection-v3/props.d.ts +4 -0
- package/dist/v2/components/or-card-collection-v3/styles.d.ts +6 -0
- package/dist/v2/components/or-card-collection-v3/types.d.ts +7 -0
- package/dist/v2/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +12 -0
- package/dist/v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
- package/dist/v2/components/or-sort-header-v3/index.d.ts +2 -0
- package/dist/v2/components/or-sort-header-v3/styles.d.ts +1 -0
- package/dist/v2/components/or-sort-header-v3/types.d.ts +4 -0
- package/dist/v2/index.js +9 -7
- package/dist/v2/index11.js +20 -1
- package/dist/v2/index12.js +3 -12
- package/dist/v2/index13.js +3 -2
- package/dist/v2/index14.js +11 -5
- package/dist/v2/index15.js +5 -14
- package/dist/v2/index16.js +4 -19
- package/dist/v2/index17.js +28 -4
- package/dist/v2/index18.js +3 -7
- package/dist/v2/index19.js +5 -23
- package/dist/v2/index2.js +9 -7
- package/dist/v2/index20.js +25 -21
- package/dist/v2/index21.js +21 -18
- package/dist/v2/index22.js +20 -2
- package/dist/v2/index23.js +2 -4
- package/dist/v2/index24.js +2 -1
- package/dist/v2/index25.js +1 -2
- package/dist/v2/index26.js +2 -2
- package/dist/v2/index27.js +4 -7
- package/dist/v2/index28.js +6 -2
- package/dist/v2/index29.js +3 -3
- package/dist/v2/index30.js +3 -10
- package/dist/v2/index31.js +9 -12
- package/dist/v2/index32.js +11 -1
- package/dist/v2/index33.js +1 -1
- package/dist/v2/index34.js +1 -16
- package/dist/v2/index35.js +17 -17
- package/dist/v2/index36.js +17 -17
- package/dist/v2/index37.js +16 -1
- package/dist/v2/index38.js +1 -17
- package/dist/v2/index39.js +18 -22
- package/dist/v2/index40.js +22 -2
- package/dist/v2/index41.js +3 -3
- package/dist/v2/index42.js +1 -1
- package/dist/v2/index43.js +3 -20
- package/dist/v2/index44.js +1 -7
- package/dist/v2/index45.js +24 -1
- package/dist/v2/index46.js +3 -3
- package/dist/v2/index47.js +1 -2
- package/dist/v2/index48.js +2 -9
- package/dist/v2/index49.js +10 -17
- package/dist/v2/index50.js +17 -13
- package/dist/v2/index51.js +13 -14
- package/dist/v2/index52.js +14 -13
- package/dist/v2/index53.js +12 -15
- package/dist/v2/index54.js +16 -1
- package/dist/v2/index55.js +2 -6
- package/dist/v2/index56.js +1 -5
- package/dist/v2/index57.js +10 -3
- package/dist/v2/index58.js +2 -4
- package/dist/v2/index59.js +5 -3
- package/dist/v2/index60.js +2 -1
- package/dist/v2/index61.js +2 -5
- package/dist/v2/index62.js +3 -18
- package/dist/v2/index63.js +18 -15
- package/dist/v2/index64.js +15 -23
- package/dist/v2/index65.js +25 -4
- package/dist/v2/index66.js +2 -1
- package/dist/v2/index67.js +3 -4
- package/dist/v2/index68.js +3 -4
- package/dist/v2/index69.js +3 -10
- package/dist/v2/index70.js +3 -6
- package/dist/v2/index71.js +4 -4
- package/dist/v2/index72.js +15 -6
- package/dist/v2/index73.js +2 -2
- package/dist/v2/index74.js +6 -3
- package/dist/v2/index75.js +4 -3
- package/dist/v2/index76.js +1 -2
- package/dist/v2/index77.js +2 -14
- package/dist/v2/index78.js +2 -10
- package/dist/v2/index79.js +5 -4
- package/dist/v2/index80.js +12 -2
- package/dist/v2/index81.js +14 -2
- package/dist/v2/index82.js +2 -3
- package/dist/v2/index83.js +2 -8
- package/dist/v2/index84.js +2 -20
- package/dist/v2/index85.js +8 -18
- package/dist/v2/index86.js +21 -1
- package/dist/v2/index87.js +17 -16
- package/dist/v2/index88.js +1 -1
- package/dist/v2/index89.js +17 -9
- package/dist/v2/index90.js +2 -12
- package/dist/v2/index91.js +10 -6
- package/dist/v2/index92.js +11 -1
- package/dist/v2/index93.js +7 -0
- package/dist/v2/index94.js +3 -0
- package/dist/v3/OrCardCollection-85a00f6c.js +198 -0
- package/dist/v3/{OrConfirm-a9d3f157.js → OrConfirm-9990d64a.js} +1 -1
- package/dist/v3/{OrInlineInput-8f473205.js → OrInlineInput-bc5fa87a.js} +5 -3
- package/dist/v3/{OrInlineTextarea-86f4506d.js → OrInlineTextarea-c433b451.js} +5 -3
- package/dist/v3/{OrInput-f51916d4.js → OrInput-2b05a69c.js} +5 -3
- package/dist/v3/{OrSearch-e27cadbf.js → OrSearch-1272c3df.js} +1 -1
- package/dist/v3/{OrSelect-4cd90c6b.js → OrSelect-529b4567.js} +6 -4
- package/dist/v3/OrSortHeader-5eba50cd.js +104 -0
- package/dist/v3/{OrTextarea-09aa33dc.js → OrTextarea-98895b2a.js} +6 -4
- package/dist/v3/components/index.d.ts +2 -0
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
- package/dist/v3/components/or-card-collection-v3/index.d.ts +3 -0
- package/dist/v3/components/or-card-collection-v3/props.d.ts +4 -0
- package/dist/v3/components/or-card-collection-v3/styles.d.ts +6 -0
- package/dist/v3/components/or-card-collection-v3/types.d.ts +7 -0
- package/dist/v3/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +12 -0
- package/dist/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
- package/dist/v3/components/or-sort-header-v3/index.d.ts +2 -0
- package/dist/v3/components/or-sort-header-v3/styles.d.ts +1 -0
- package/dist/v3/components/or-sort-header-v3/types.d.ts +4 -0
- package/dist/v3/index.js +9 -7
- package/dist/v3/index11.js +19 -1
- package/dist/v3/index12.js +3 -11
- package/dist/v3/index13.js +3 -2
- package/dist/v3/index14.js +9 -4
- package/dist/v3/index15.js +4 -11
- package/dist/v3/index16.js +3 -17
- package/dist/v3/index17.js +25 -4
- package/dist/v3/index18.js +3 -6
- package/dist/v3/index19.js +5 -20
- package/dist/v3/index2.js +9 -7
- package/dist/v3/index20.js +21 -20
- package/dist/v3/index21.js +20 -15
- package/dist/v3/index22.js +16 -1
- package/dist/v3/index23.js +2 -4
- package/dist/v3/index24.js +2 -1
- package/dist/v3/index25.js +1 -2
- package/dist/v3/index26.js +2 -2
- package/dist/v3/index27.js +4 -6
- package/dist/v3/index28.js +5 -2
- package/dist/v3/index29.js +3 -3
- package/dist/v3/index30.js +3 -9
- package/dist/v3/index31.js +8 -11
- package/dist/v3/index32.js +10 -1
- package/dist/v3/index33.js +1 -1
- package/dist/v3/index34.js +1 -15
- package/dist/v3/index35.js +16 -14
- package/dist/v3/index36.js +14 -16
- package/dist/v3/index37.js +16 -2
- package/dist/v3/index38.js +2 -17
- package/dist/v3/index39.js +17 -17
- package/dist/v3/index40.js +16 -1
- package/dist/v3/index41.js +3 -3
- package/dist/v3/index42.js +1 -1
- package/dist/v3/index43.js +3 -16
- package/dist/v3/index44.js +1 -7
- package/dist/v3/index45.js +20 -1
- package/dist/v3/index46.js +3 -3
- package/dist/v3/index47.js +1 -2
- package/dist/v3/index48.js +2 -8
- package/dist/v3/index49.js +9 -14
- package/dist/v3/index50.js +14 -12
- package/dist/v3/index51.js +12 -11
- package/dist/v3/index52.js +11 -12
- package/dist/v3/index53.js +11 -11
- package/dist/v3/index54.js +12 -1
- package/dist/v3/index55.js +2 -5
- package/dist/v3/index56.js +1 -5
- package/dist/v3/index57.js +9 -3
- package/dist/v3/index58.js +2 -4
- package/dist/v3/index59.js +5 -3
- package/dist/v3/index60.js +2 -1
- package/dist/v3/index61.js +1 -4
- package/dist/v3/index62.js +3 -17
- package/dist/v3/index63.js +17 -14
- package/dist/v3/index64.js +13 -21
- package/dist/v3/index65.js +23 -3
- package/dist/v3/index66.js +2 -1
- package/dist/v3/index67.js +3 -4
- package/dist/v3/index68.js +3 -4
- package/dist/v3/index69.js +3 -9
- package/dist/v3/index70.js +3 -4
- package/dist/v3/index71.js +4 -4
- package/dist/v3/index72.js +11 -5
- package/dist/v3/index73.js +2 -2
- package/dist/v3/index74.js +5 -2
- package/dist/v3/index75.js +4 -3
- package/dist/v3/index76.js +1 -2
- package/dist/v3/index77.js +2 -13
- package/dist/v3/index78.js +2 -9
- package/dist/v3/index79.js +5 -4
- package/dist/v3/index80.js +11 -1
- package/dist/v3/index81.js +13 -1
- package/dist/v3/index82.js +1 -3
- package/dist/v3/index83.js +1 -8
- package/dist/v3/index84.js +2 -17
- package/dist/v3/index85.js +7 -14
- package/dist/v3/index86.js +18 -1
- package/dist/v3/index87.js +14 -15
- package/dist/v3/index88.js +1 -1
- package/dist/v3/index89.js +15 -6
- package/dist/v3/index90.js +2 -11
- package/dist/v3/index91.js +8 -6
- package/dist/v3/index92.js +10 -1
- package/dist/v3/index93.js +7 -0
- package/dist/v3/index94.js +3 -0
- package/package.json +2 -3
- package/src/components/index.ts +2 -0
- package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +3 -0
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +162 -0
- package/src/components/or-card-collection-v3/OrCardCollection.vue +210 -0
- package/src/components/or-card-collection-v3/index.ts +3 -0
- package/src/components/or-card-collection-v3/props.ts +4 -0
- package/src/components/or-card-collection-v3/styles.ts +53 -0
- package/src/components/or-card-collection-v3/types.ts +8 -0
- package/src/components/or-inline-input-v3/OrInlineInput.vue +12 -10
- package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +12 -10
- package/src/components/or-input-v3/OrInput.vue +12 -10
- package/src/components/or-select-v3/OrSelect.vue +5 -3
- package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +3 -0
- package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +132 -0
- package/src/components/or-sort-header-v3/OrSortHeader.vue +111 -0
- package/src/components/or-sort-header-v3/index.ts +2 -0
- package/src/components/or-sort-header-v3/styles.ts +23 -0
- package/src/components/or-sort-header-v3/types.ts +4 -0
- package/src/components/or-textarea-v3/OrTextarea.vue +12 -10
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CardCollectionView } from './props';
|
|
2
|
+
|
|
3
|
+
export const CardCollectionRoot: string[] = [
|
|
4
|
+
// Layout
|
|
5
|
+
'flex flex-col',
|
|
6
|
+
|
|
7
|
+
// Spacing
|
|
8
|
+
'gap-md',
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const CardCollectionToolbar: string[] = [
|
|
12
|
+
// Layout
|
|
13
|
+
'flex',
|
|
14
|
+
'justify-between',
|
|
15
|
+
'items-center',
|
|
16
|
+
|
|
17
|
+
// Typography
|
|
18
|
+
'typography-body-2-regular',
|
|
19
|
+
|
|
20
|
+
// Theme
|
|
21
|
+
'theme-foreground-default',
|
|
22
|
+
'dark:theme-foreground-default-dark',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const CardCollectionToolbarPanel: string[] = [
|
|
26
|
+
// Layout
|
|
27
|
+
'flex',
|
|
28
|
+
'justify-normal',
|
|
29
|
+
'items-center',
|
|
30
|
+
|
|
31
|
+
// Spacing
|
|
32
|
+
'gap-sm',
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export const CardCollectionContent: string[] = [
|
|
36
|
+
// Layout
|
|
37
|
+
'grid',
|
|
38
|
+
|
|
39
|
+
// Spacing
|
|
40
|
+
'gap-sm md:gap-md',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export const CardCollectionContentViews: Record<CardCollectionView, string[]> = {
|
|
44
|
+
'grid': [
|
|
45
|
+
// Layout
|
|
46
|
+
'sm:grid-cols-1',
|
|
47
|
+
'md:grid-cols-2',
|
|
48
|
+
'lg:grid-cols-4',
|
|
49
|
+
'xl:grid-cols-6',
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
'list': [],
|
|
53
|
+
};
|
|
@@ -41,16 +41,18 @@
|
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
43
|
<template v-if="!invalid">
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
<template v-if="hint || maxLength">
|
|
45
|
+
<OrHint>
|
|
46
|
+
{{ hint }}
|
|
47
|
+
|
|
48
|
+
<template
|
|
49
|
+
v-if="maxLength"
|
|
50
|
+
v-slot:addon
|
|
51
|
+
>
|
|
52
|
+
{{ currentLength }} / {{ maxLength }}
|
|
53
|
+
</template>
|
|
54
|
+
</OrHint>
|
|
55
|
+
</template>
|
|
54
56
|
</template>
|
|
55
57
|
|
|
56
58
|
<template v-else>
|
|
@@ -40,16 +40,18 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
42
|
<template v-if="!invalid">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
<template v-if="hint || maxLength">
|
|
44
|
+
<OrHint>
|
|
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>
|
|
@@ -70,16 +70,18 @@
|
|
|
70
70
|
</OrInputBox>
|
|
71
71
|
|
|
72
72
|
<template v-if="!invalid">
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
<template v-if="hint || maxLength">
|
|
74
|
+
<OrHint :disabled="disabled">
|
|
75
|
+
{{ hint }}
|
|
76
|
+
|
|
77
|
+
<template
|
|
78
|
+
v-if="maxLength"
|
|
79
|
+
v-slot:addon
|
|
80
|
+
>
|
|
81
|
+
{{ currentLength }} / {{ maxLength }}
|
|
82
|
+
</template>
|
|
83
|
+
</OrHint>
|
|
84
|
+
</template>
|
|
83
85
|
</template>
|
|
84
86
|
|
|
85
87
|
<template v-else>
|
|
@@ -193,9 +193,11 @@
|
|
|
193
193
|
</OrInputBox>
|
|
194
194
|
|
|
195
195
|
<template v-if="!invalid">
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
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,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,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
|
+
];
|
|
@@ -40,16 +40,18 @@
|
|
|
40
40
|
</OrInputBox>
|
|
41
41
|
|
|
42
42
|
<template v-if="!invalid">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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>
|