@onereach/ui-components 2.62.7-beta.1930.0 → 2.62.7-beta.1932.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/{OrConfirm-edc537b3.js → OrConfirm-24e2a1a2.js} +1 -1
- package/dist/v2/{OrInlineInput-73ec1b85.js → OrInlineInput-f00cba5e.js} +8 -7
- package/dist/v2/{OrInlineTextarea-1858a348.js → OrInlineTextarea-75de33d0.js} +8 -7
- package/dist/v2/{OrInput-655bed71.js → OrInput-24028f23.js} +5 -5
- package/dist/v2/{OrSearch-287a08a9.js → OrSearch-978a3a6e.js} +1 -1
- package/dist/v2/OrSegmentedControl-17df63b8.js +236 -0
- package/dist/v2/{OrSelect-1a353817.js → OrSelect-c6d0a69e.js} +3 -3
- package/dist/v2/{OrTabs-b4a9740b.js → OrTabs-f2a60b41.js} +1 -1
- package/dist/v2/{OrTextarea-cc70afc9.js → OrTextarea-8773d494.js} +5 -5
- package/dist/v2/components/index.d.ts +1 -2
- package/dist/v2/components/{or-sort-header-v3/OrSortHeader.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
- package/dist/{v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts → v2/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts} +45 -25
- package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
- package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
- package/dist/v2/components/or-segmented-control-v3/index.d.ts +3 -0
- package/dist/v2/components/or-segmented-control-v3/props.d.ts +4 -0
- package/dist/v2/components/or-segmented-control-v3/styles.d.ts +3 -0
- package/dist/v2/components/or-segmented-control-v3/types.d.ts +4 -0
- package/dist/v2/index.js +9 -10
- package/dist/v2/index11.js +1 -20
- package/dist/v2/index12.js +12 -3
- package/dist/v2/index13.js +2 -3
- package/dist/v2/index14.js +5 -11
- package/dist/v2/index15.js +14 -5
- package/dist/v2/index16.js +19 -4
- package/dist/v2/index17.js +4 -28
- package/dist/v2/index18.js +7 -3
- package/dist/v2/index19.js +23 -5
- package/dist/v2/index2.js +9 -10
- package/dist/v2/index20.js +21 -25
- package/dist/v2/index21.js +18 -21
- package/dist/v2/index22.js +2 -20
- package/dist/v2/index23.js +4 -2
- package/dist/v2/index24.js +1 -2
- package/dist/v2/index25.js +2 -1
- package/dist/v2/index26.js +2 -2
- package/dist/v2/index27.js +7 -4
- package/dist/v2/index28.js +2 -6
- package/dist/v2/index29.js +3 -3
- package/dist/v2/index30.js +10 -3
- package/dist/v2/index31.js +12 -9
- package/dist/v2/index32.js +1 -11
- package/dist/v2/index33.js +1 -1
- package/dist/v2/index34.js +16 -1
- package/dist/v2/index35.js +17 -17
- package/dist/v2/index36.js +17 -17
- package/dist/v2/index37.js +1 -16
- package/dist/v2/index38.js +17 -1
- package/dist/v2/index39.js +22 -18
- package/dist/v2/index40.js +2 -22
- package/dist/v2/index41.js +3 -3
- package/dist/v2/index42.js +1 -1
- package/dist/v2/index43.js +20 -3
- package/dist/v2/index44.js +7 -1
- package/dist/v2/index45.js +1 -24
- package/dist/v2/index46.js +3 -3
- package/dist/v2/index47.js +2 -1
- package/dist/v2/index48.js +9 -2
- package/dist/v2/index49.js +17 -10
- package/dist/v2/index50.js +13 -17
- package/dist/v2/index51.js +14 -13
- package/dist/v2/index52.js +13 -14
- package/dist/v2/index53.js +15 -12
- package/dist/v2/index54.js +1 -16
- package/dist/v2/index55.js +6 -2
- package/dist/v2/index56.js +5 -1
- package/dist/v2/index57.js +3 -10
- package/dist/v2/index58.js +4 -2
- package/dist/v2/index59.js +3 -5
- package/dist/v2/index60.js +1 -2
- package/dist/v2/index61.js +5 -2
- package/dist/v2/index62.js +18 -3
- package/dist/v2/index63.js +2 -19
- package/dist/v2/index65.js +2 -2
- package/dist/v2/index71.js +15 -4
- package/dist/v2/index72.js +2 -13
- package/dist/v2/index73.js +6 -4
- package/dist/v2/index74.js +4 -6
- package/dist/v2/index75.js +1 -2
- package/dist/v2/index76.js +3 -3
- package/dist/v2/index77.js +4 -3
- package/dist/v2/index78.js +15 -4
- package/dist/v2/index79.js +11 -14
- package/dist/v2/index80.js +13 -11
- package/dist/v2/index81.js +2 -14
- package/dist/v2/index82.js +2 -2
- package/dist/v2/index83.js +3 -2
- package/dist/v2/index84.js +6 -1
- package/dist/v2/index85.js +20 -7
- package/dist/v2/index86.js +9 -12
- package/dist/v2/index87.js +1 -18
- package/dist/v2/index88.js +18 -2
- package/dist/v2/index89.js +2 -18
- package/dist/v2/index90.js +10 -2
- package/dist/v2/index91.js +11 -9
- package/dist/v2/index92.js +1 -12
- package/dist/v2/index93.js +6 -1
- package/dist/v2/index94.js +1 -5
- package/dist/v3/{OrConfirm-0bafcc7b.js → OrConfirm-371630a4.js} +1 -1
- package/dist/v3/{OrInlineInput-dc71bbcb.js → OrInlineInput-bac4abdd.js} +6 -7
- package/dist/v3/{OrInlineTextarea-bdebb784.js → OrInlineTextarea-d1ec1bba.js} +6 -7
- package/dist/v3/{OrInput-db4813b4.js → OrInput-256d2530.js} +3 -5
- package/dist/v3/{OrSearch-0c29f499.js → OrSearch-375eab55.js} +1 -1
- package/dist/v3/OrSegmentedControl-2bbc0f22.js +184 -0
- package/dist/v3/{OrSelect-323a87b4.js → OrSelect-52cfb10d.js} +4 -6
- package/dist/v3/{OrTabs-194ca950.js → OrTabs-ac0be933.js} +1 -1
- package/dist/v3/{OrTextarea-98895b2a.js → OrTextarea-09aa33dc.js} +4 -6
- package/dist/v3/components/index.d.ts +1 -2
- package/dist/v3/components/{or-sort-header-v3/OrSortHeader.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
- package/dist/{v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts → v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts} +45 -25
- package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
- package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
- package/dist/v3/components/or-segmented-control-v3/index.d.ts +3 -0
- package/dist/v3/components/or-segmented-control-v3/props.d.ts +4 -0
- package/dist/v3/components/or-segmented-control-v3/styles.d.ts +3 -0
- package/dist/v3/components/or-segmented-control-v3/types.d.ts +4 -0
- package/dist/v3/index.js +9 -10
- package/dist/v3/index11.js +1 -19
- package/dist/v3/index12.js +11 -3
- package/dist/v3/index13.js +2 -3
- package/dist/v3/index14.js +4 -9
- package/dist/v3/index15.js +11 -4
- package/dist/v3/index16.js +17 -3
- package/dist/v3/index17.js +4 -25
- package/dist/v3/index18.js +6 -3
- package/dist/v3/index19.js +20 -5
- package/dist/v3/index2.js +9 -10
- package/dist/v3/index20.js +20 -21
- package/dist/v3/index21.js +15 -20
- package/dist/v3/index22.js +1 -16
- package/dist/v3/index23.js +4 -2
- package/dist/v3/index24.js +1 -2
- package/dist/v3/index25.js +2 -1
- package/dist/v3/index26.js +2 -2
- package/dist/v3/index27.js +6 -4
- package/dist/v3/index28.js +2 -5
- package/dist/v3/index29.js +3 -3
- package/dist/v3/index30.js +9 -3
- package/dist/v3/index31.js +11 -8
- package/dist/v3/index32.js +1 -10
- package/dist/v3/index33.js +1 -1
- package/dist/v3/index34.js +15 -1
- package/dist/v3/index35.js +14 -16
- package/dist/v3/index36.js +16 -14
- package/dist/v3/index37.js +2 -16
- package/dist/v3/index38.js +17 -2
- package/dist/v3/index39.js +17 -17
- package/dist/v3/index40.js +1 -16
- package/dist/v3/index41.js +3 -3
- package/dist/v3/index42.js +1 -1
- package/dist/v3/index43.js +16 -3
- package/dist/v3/index44.js +7 -1
- package/dist/v3/index45.js +1 -20
- package/dist/v3/index46.js +3 -3
- package/dist/v3/index47.js +2 -1
- package/dist/v3/index48.js +8 -2
- package/dist/v3/index49.js +14 -9
- package/dist/v3/index50.js +12 -14
- package/dist/v3/index51.js +11 -12
- package/dist/v3/index52.js +12 -11
- package/dist/v3/index53.js +11 -11
- package/dist/v3/index54.js +1 -12
- package/dist/v3/index55.js +5 -2
- package/dist/v3/index56.js +5 -1
- package/dist/v3/index57.js +3 -9
- package/dist/v3/index58.js +4 -2
- package/dist/v3/index59.js +3 -5
- package/dist/v3/index60.js +1 -2
- package/dist/v3/index61.js +4 -1
- package/dist/v3/index62.js +17 -3
- package/dist/v3/index63.js +2 -18
- package/dist/v3/index65.js +2 -2
- package/dist/v3/index71.js +12 -4
- package/dist/v3/index72.js +2 -10
- package/dist/v3/index73.js +5 -3
- package/dist/v3/index74.js +3 -5
- package/dist/v3/index75.js +1 -2
- package/dist/v3/index76.js +3 -3
- package/dist/v3/index77.js +4 -3
- package/dist/v3/index78.js +14 -4
- package/dist/v3/index79.js +10 -13
- package/dist/v3/index80.js +12 -10
- package/dist/v3/index81.js +1 -13
- package/dist/v3/index82.js +1 -1
- package/dist/v3/index83.js +3 -1
- package/dist/v3/index84.js +6 -1
- package/dist/v3/index85.js +16 -6
- package/dist/v3/index86.js +9 -12
- package/dist/v3/index87.js +1 -15
- package/dist/v3/index88.js +17 -2
- package/dist/v3/index89.js +2 -17
- package/dist/v3/index90.js +8 -2
- package/dist/v3/index91.js +9 -6
- package/dist/v3/index92.js +1 -11
- package/dist/v3/index93.js +6 -1
- package/dist/v3/index94.js +1 -5
- package/package.json +1 -1
- package/src/components/index.ts +1 -2
- package/src/components/or-checkbox-v3/OrCheckbox.stories3.ts +1 -1
- package/src/components/or-inline-input-v3/OrInlineInput.vue +12 -14
- package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +12 -14
- package/src/components/or-input-v3/OrInput.vue +10 -12
- package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
- package/src/components/or-segmented-control-v3/OrSegmentedControl.docs.mdx +7 -0
- package/src/components/or-segmented-control-v3/OrSegmentedControl.stories3.ts +106 -0
- package/src/components/{or-sort-header-v3/OrSortHeader.vue → or-segmented-control-v3/OrSegmentedControl.vue} +34 -38
- package/src/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue +64 -0
- package/src/components/or-segmented-control-v3/components/or-segmented-control-item/styles.ts +50 -0
- package/src/components/or-segmented-control-v3/index.ts +3 -0
- package/src/components/or-segmented-control-v3/props.ts +4 -0
- package/src/components/or-segmented-control-v3/styles.ts +24 -0
- package/src/components/or-segmented-control-v3/types.ts +4 -0
- package/src/components/or-select-v3/OrSelect.vue +3 -5
- package/src/components/or-switch-v3/OrSwitch.stories3.ts +1 -1
- package/src/components/or-tabs-v3/OrTabs.stories3.ts +9 -4
- package/src/components/or-tabs-v3/OrTabs.vue +1 -1
- package/src/components/or-textarea-v3/OrTextarea.vue +10 -12
- package/src/hooks/useClassAttribute.ts +1 -1
- package/dist/v2/OrCardCollection-5d5046f1.js +0 -227
- package/dist/v2/OrSortHeader-a6004b24.js +0 -133
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -17
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +0 -98
- package/dist/v2/components/or-card-collection-v3/index.d.ts +0 -3
- package/dist/v2/components/or-card-collection-v3/props.d.ts +0 -4
- package/dist/v2/components/or-card-collection-v3/styles.d.ts +0 -6
- package/dist/v2/components/or-card-collection-v3/types.d.ts +0 -7
- package/dist/v2/components/or-sort-header-v3/index.d.ts +0 -2
- package/dist/v2/components/or-sort-header-v3/styles.d.ts +0 -1
- package/dist/v2/components/or-sort-header-v3/types.d.ts +0 -4
- package/dist/v2/index95.js +0 -3
- package/dist/v3/OrCardCollection-c6f3ac23.js +0 -198
- package/dist/v3/OrSortHeader-5eba50cd.js +0 -104
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -17
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +0 -98
- package/dist/v3/components/or-card-collection-v3/index.d.ts +0 -3
- package/dist/v3/components/or-card-collection-v3/props.d.ts +0 -4
- package/dist/v3/components/or-card-collection-v3/styles.d.ts +0 -6
- package/dist/v3/components/or-card-collection-v3/types.d.ts +0 -7
- package/dist/v3/components/or-sort-header-v3/index.d.ts +0 -2
- package/dist/v3/components/or-sort-header-v3/styles.d.ts +0 -1
- package/dist/v3/components/or-sort-header-v3/types.d.ts +0 -4
- package/dist/v3/index95.js +0 -3
- package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +0 -3
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +0 -162
- package/src/components/or-card-collection-v3/OrCardCollection.vue +0 -210
- package/src/components/or-card-collection-v3/index.ts +0 -3
- package/src/components/or-card-collection-v3/props.ts +0 -4
- package/src/components/or-card-collection-v3/styles.ts +0 -53
- package/src/components/or-card-collection-v3/types.ts +0 -8
- package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +0 -3
- package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +0 -132
- package/src/components/or-sort-header-v3/index.ts +0 -2
- package/src/components/or-sort-header-v3/styles.ts +0 -23
- package/src/components/or-sort-header-v3/types.ts +0 -4
|
@@ -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
|
+
};
|
|
@@ -3,50 +3,61 @@
|
|
|
3
3
|
ref="root"
|
|
4
4
|
v-bind="$attrs"
|
|
5
5
|
:class="rootStyles"
|
|
6
|
-
:activated="activated ? '' : null"
|
|
7
|
-
@click.stop="toggleDirection()"
|
|
8
6
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
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
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
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';
|
|
26
27
|
|
|
27
28
|
export default defineComponent({
|
|
28
|
-
name: '
|
|
29
|
+
name: 'OrSegmentedControl',
|
|
29
30
|
|
|
30
31
|
components: {
|
|
31
|
-
|
|
32
|
+
OrSegmentedControlItem,
|
|
32
33
|
},
|
|
33
34
|
|
|
34
35
|
inheritAttrs: false,
|
|
35
36
|
|
|
36
37
|
props: {
|
|
38
|
+
options: {
|
|
39
|
+
type: Array as PropType<SegmentedControlOption[]>,
|
|
40
|
+
default: [] as SegmentedControlOption[],
|
|
41
|
+
},
|
|
42
|
+
|
|
37
43
|
modelValue: {
|
|
38
|
-
type:
|
|
44
|
+
type: String,
|
|
39
45
|
default: undefined,
|
|
40
46
|
},
|
|
41
47
|
|
|
42
48
|
value: { // TODO: Remove Vue 2 fallback
|
|
43
|
-
type:
|
|
49
|
+
type: String,
|
|
44
50
|
default: undefined,
|
|
45
51
|
},
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
type: String
|
|
49
|
-
|
|
53
|
+
size: {
|
|
54
|
+
type: String as PropType<SegmentedControlSize>,
|
|
55
|
+
default: SegmentedControlSize.M,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
disabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
50
61
|
},
|
|
51
62
|
},
|
|
52
63
|
|
|
@@ -54,8 +65,6 @@ export default defineComponent({
|
|
|
54
65
|
'update:modelValue',
|
|
55
66
|
|
|
56
67
|
'input',
|
|
57
|
-
'focus',
|
|
58
|
-
'blur',
|
|
59
68
|
],
|
|
60
69
|
|
|
61
70
|
expose: [
|
|
@@ -70,8 +79,9 @@ export default defineComponent({
|
|
|
70
79
|
const classAttribute = useClassAttribute();
|
|
71
80
|
|
|
72
81
|
const rootStyles = computed(() => [
|
|
73
|
-
'or-
|
|
74
|
-
...
|
|
82
|
+
'or-segmented-control',
|
|
83
|
+
...SegmentedControlRoot,
|
|
84
|
+
...SegmentedControlRootSizes[props.size],
|
|
75
85
|
classAttribute.value,
|
|
76
86
|
]);
|
|
77
87
|
|
|
@@ -87,24 +97,10 @@ export default defineComponent({
|
|
|
87
97
|
},
|
|
88
98
|
});
|
|
89
99
|
|
|
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
100
|
return {
|
|
103
101
|
root,
|
|
104
102
|
rootStyles,
|
|
105
103
|
proxyModelValue,
|
|
106
|
-
activated,
|
|
107
|
-
toggleDirection,
|
|
108
104
|
};
|
|
109
105
|
},
|
|
110
106
|
});
|
|
@@ -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,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
|
+
};
|
|
@@ -193,11 +193,9 @@
|
|
|
193
193
|
</OrInputBox>
|
|
194
194
|
|
|
195
195
|
<template v-if="!invalid">
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</OrHint>
|
|
200
|
-
</template>
|
|
196
|
+
<OrHint :disabled="disabled">
|
|
197
|
+
{{ hint }}
|
|
198
|
+
</OrHint>
|
|
201
199
|
</template>
|
|
202
200
|
|
|
203
201
|
<template v-else>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
-
import { ref } from 'vue-demi';
|
|
3
|
+
import { ref, watch } 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,11 +63,16 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
|
|
|
63
63
|
|
|
64
64
|
setup() {
|
|
65
65
|
// State
|
|
66
|
-
const
|
|
66
|
+
const model = ref<string>();
|
|
67
|
+
|
|
68
|
+
// Effects
|
|
69
|
+
watch(model, (value) => {
|
|
70
|
+
console.debug(value);
|
|
71
|
+
});
|
|
67
72
|
|
|
68
73
|
return {
|
|
69
74
|
args,
|
|
70
|
-
|
|
75
|
+
model,
|
|
71
76
|
onUpdateModelValue: action('update:modelValue'),
|
|
72
77
|
onInput: action('input'),
|
|
73
78
|
};
|
|
@@ -75,7 +80,7 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
|
|
|
75
80
|
|
|
76
81
|
template: `
|
|
77
82
|
<OrTabs
|
|
78
|
-
v-model="
|
|
83
|
+
v-model="model"
|
|
79
84
|
v-bind="args"
|
|
80
85
|
@update:modelValue="onUpdateModelValue"
|
|
81
86
|
@input="onInput"
|
|
@@ -40,18 +40,16 @@
|
|
|
40
40
|
</OrInputBox>
|
|
41
41
|
|
|
42
42
|
<template v-if="!invalid">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</OrHint>
|
|
54
|
-
</template>
|
|
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>
|
|
55
53
|
</template>
|
|
56
54
|
|
|
57
55
|
<template v-else>
|
|
@@ -8,7 +8,7 @@ export function useClassAttribute(): UseClassAttributeReturn {
|
|
|
8
8
|
|
|
9
9
|
// Functions
|
|
10
10
|
function composeClass(): UnwrapRef<UseClassAttributeReturn> {
|
|
11
|
-
const { staticClass = '', class: classProperty } = (currentInstance?.vnode as VNode).data ?? {};
|
|
11
|
+
const { staticClass = '', class: classProperty } = (currentInstance?.vnode as unknown as VNode).data ?? {};
|
|
12
12
|
|
|
13
13
|
if (!classProperty) {
|
|
14
14
|
return staticClass || undefined;
|