@onereach/ui-components 2.63.0-beta.1907.0 → 2.63.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-8d149ece.js → OrConfirm-24e2a1a2.js} +1 -1
- package/dist/v2/{OrIconButton-5883eba0.js → OrIconButton-2088a37f.js} +1 -1
- package/dist/v2/{OrInlineInput-16a343c1.js → OrInlineInput-f00cba5e.js} +6 -5
- package/dist/v2/{OrInlineTextarea-f154bdf5.js → OrInlineTextarea-75de33d0.js} +6 -5
- package/dist/v2/{OrInput-4a50fe57.js → OrInput-24028f23.js} +7 -5
- package/dist/v2/{OrModal-64c5ae2e.js → OrModal-a1452b11.js} +1 -1
- package/dist/v2/{OrNotification-9c164908.js → OrNotification-ac420f39.js} +1 -1
- package/dist/v2/{OrSearch-a247f072.js → OrSearch-978a3a6e.js} +1 -1
- package/dist/v2/OrSegmentedControl-17df63b8.js +236 -0
- package/dist/v2/{OrSelect-f416b7aa.js → OrSelect-c6d0a69e.js} +2 -2
- package/dist/v2/{OrTabs-b4a9740b.js → OrTabs-f2a60b41.js} +1 -1
- package/dist/v2/{OrTag-ab03c4f7.js → OrTag-1ced4e58.js} +1 -1
- package/dist/v2/{OrTooltip-caeac590.js → OrTooltip-afe7030b.js} +33 -3
- package/dist/v2/components/index.d.ts +1 -0
- package/dist/v2/components/{or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
- package/dist/v2/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
- 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/components/or-tooltip-v3/styles.d.ts +2 -0
- package/dist/v2/index.js +14 -13
- package/dist/v2/index2.js +14 -13
- package/dist/v2/index20.js +4 -4
- package/dist/v2/index31.js +2 -2
- package/dist/v2/index34.js +3 -3
- package/dist/v2/index36.js +3 -3
- package/dist/v2/index38.js +3 -3
- package/dist/v2/index50.js +3 -3
- package/dist/v2/index52.js +3 -3
- package/dist/v2/index62.js +12 -325
- package/dist/v2/index63.js +2 -19
- package/dist/v2/index65.js +5 -5
- package/dist/v2/index78.js +1 -1
- package/dist/v2/index80.js +3 -3
- package/dist/v2/index88.js +3 -3
- package/dist/v2/index91.js +1 -1
- package/dist/v2/{types-fb93ea4e.js → types-89aad7fb.js} +1 -1
- package/dist/v3/{OrConfirm-456ddee1.js → OrConfirm-371630a4.js} +1 -1
- package/dist/v3/{OrIconButton-b8066b5d.js → OrIconButton-5fb3a9aa.js} +1 -1
- package/dist/v3/{OrInlineInput-280768ba.js → OrInlineInput-bac4abdd.js} +4 -3
- package/dist/v3/{OrInlineTextarea-0f63f344.js → OrInlineTextarea-d1ec1bba.js} +4 -3
- package/dist/v3/{OrInput-3eef7945.js → OrInput-256d2530.js} +6 -3
- package/dist/v3/{OrModal-f67d37d3.js → OrModal-3a43b7e7.js} +1 -1
- package/dist/v3/{OrNotification-fefa1cb4.js → OrNotification-433d16f7.js} +1 -1
- package/dist/v3/{OrSearch-15a70678.js → OrSearch-375eab55.js} +1 -1
- package/dist/v3/OrSegmentedControl-2bbc0f22.js +184 -0
- package/dist/v3/{OrSelect-9d300f55.js → OrSelect-52cfb10d.js} +2 -2
- package/dist/v3/{OrTabs-194ca950.js → OrTabs-ac0be933.js} +1 -1
- package/dist/v3/{OrTag-144b4ab8.js → OrTag-deaff080.js} +1 -1
- package/dist/v3/{OrTooltip-30e05f9e.js → OrTooltip-36c6728c.js} +33 -3
- package/dist/v3/components/index.d.ts +1 -0
- package/dist/v3/components/{or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
- package/dist/v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
- 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/components/or-tooltip-v3/styles.d.ts +2 -0
- package/dist/v3/index.js +14 -13
- package/dist/v3/index2.js +14 -13
- package/dist/v3/index20.js +4 -4
- package/dist/v3/index31.js +2 -2
- package/dist/v3/index34.js +3 -3
- package/dist/v3/index36.js +3 -3
- package/dist/v3/index38.js +3 -3
- package/dist/v3/index50.js +3 -3
- package/dist/v3/index52.js +3 -3
- package/dist/v3/index62.js +12 -299
- package/dist/v3/index63.js +2 -18
- package/dist/v3/index65.js +5 -5
- package/dist/v3/index78.js +1 -1
- package/dist/v3/index80.js +3 -3
- package/dist/v3/index88.js +3 -3
- package/dist/v3/index91.js +1 -1
- package/dist/v3/{types-a2a8f948.js → types-d5d4ab32.js} +1 -1
- package/package.json +4 -9
- package/src/components/index.ts +1 -0
- package/src/components/or-checkbox-v3/OrCheckbox.stories3.ts +1 -1
- package/src/components/or-inline-input-v3/OrInlineInput.vue +2 -2
- package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +2 -2
- package/src/components/or-input-v3/OrInput.vue +21 -19
- 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-segmented-control-v3/OrSegmentedControl.vue +107 -0
- 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-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-tooltip-v3/OrTooltip.vue +3 -2
- package/src/components/or-tooltip-v3/styles.ts +55 -0
- package/src/hooks/useClassAttribute.ts +1 -1
- package/dist/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
- package/dist/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -7
- package/dist/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
- package/dist/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -7
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -16
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -57
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -322
- package/src/components/or-rich-text-editor-v3/index.ts +0 -1
- 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,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
|
+
};
|
|
@@ -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"
|
|
@@ -30,7 +30,7 @@ import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
|
30
30
|
import { useClassAttribute } from '../../hooks';
|
|
31
31
|
import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
|
|
32
32
|
import { TooltipPlacement } from './props';
|
|
33
|
-
import { TooltipBody, TooltipRoot } from './styles';
|
|
33
|
+
import { TooltipBody, TooltipBodyPlacements, TooltipRoot } from './styles';
|
|
34
34
|
|
|
35
35
|
export default defineComponent({
|
|
36
36
|
name: 'OrTooltip',
|
|
@@ -63,7 +63,7 @@ export default defineComponent({
|
|
|
63
63
|
'close',
|
|
64
64
|
],
|
|
65
65
|
|
|
66
|
-
setup() {
|
|
66
|
+
setup(props) {
|
|
67
67
|
// Refs
|
|
68
68
|
const root = ref<HTMLElement>();
|
|
69
69
|
|
|
@@ -81,6 +81,7 @@ export default defineComponent({
|
|
|
81
81
|
|
|
82
82
|
const bodyStyles = computed(() => [
|
|
83
83
|
...TooltipBody,
|
|
84
|
+
...TooltipBodyPlacements[props.placement],
|
|
84
85
|
]);
|
|
85
86
|
|
|
86
87
|
// Methods
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TooltipPlacement } from './props';
|
|
2
|
+
|
|
1
3
|
export const TooltipRoot: string[] = [
|
|
2
4
|
// Layout
|
|
3
5
|
'inline-block',
|
|
@@ -9,6 +11,9 @@ export const TooltipBody: string[] = [
|
|
|
9
11
|
'rounded-sm',
|
|
10
12
|
|
|
11
13
|
// Sizing
|
|
14
|
+
'mx-sm',
|
|
15
|
+
'my-sm',
|
|
16
|
+
|
|
12
17
|
'px-sm',
|
|
13
18
|
'py-xs',
|
|
14
19
|
|
|
@@ -22,3 +27,53 @@ export const TooltipBody: string[] = [
|
|
|
22
27
|
'text-inverse-on-surface',
|
|
23
28
|
'dark:text-inverse-on-surface-dark',
|
|
24
29
|
];
|
|
30
|
+
|
|
31
|
+
export const TooltipBodyPlacements: Record<TooltipPlacement, string[]> = {
|
|
32
|
+
'top': [],
|
|
33
|
+
|
|
34
|
+
'top-start': [
|
|
35
|
+
// Sizing
|
|
36
|
+
'ml-none',
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
'top-end': [
|
|
40
|
+
// Sizing
|
|
41
|
+
'mr-none',
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
'bottom': [],
|
|
45
|
+
|
|
46
|
+
'bottom-start': [
|
|
47
|
+
// Sizing
|
|
48
|
+
'ml-none',
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
'bottom-end': [
|
|
52
|
+
// Sizing
|
|
53
|
+
'mr-none',
|
|
54
|
+
],
|
|
55
|
+
|
|
56
|
+
'left': [],
|
|
57
|
+
|
|
58
|
+
'left-start': [
|
|
59
|
+
// Sizing
|
|
60
|
+
'mt-none',
|
|
61
|
+
],
|
|
62
|
+
|
|
63
|
+
'left-end': [
|
|
64
|
+
// Sizing
|
|
65
|
+
'mb-none',
|
|
66
|
+
],
|
|
67
|
+
|
|
68
|
+
'right': [],
|
|
69
|
+
|
|
70
|
+
'right-start': [
|
|
71
|
+
// Sizing
|
|
72
|
+
'mt-none',
|
|
73
|
+
],
|
|
74
|
+
|
|
75
|
+
'right-end': [
|
|
76
|
+
// Sizing
|
|
77
|
+
'mb-none',
|
|
78
|
+
],
|
|
79
|
+
};
|
|
@@ -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;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
3
|
-
editor: Editor | null;
|
|
4
|
-
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
5
|
-
containerRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
6
|
-
iconsEnum: import("@vue/composition-api").Ref<{
|
|
7
|
-
[x: string]: string;
|
|
8
|
-
}>;
|
|
9
|
-
handleToolbarClick: (item: string) => void;
|
|
10
|
-
handleEditorClick: () => void;
|
|
11
|
-
isActive: import("@vue/composition-api").Ref<{
|
|
12
|
-
[x: string]: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
iconTooltipsEnum: import("@vue/composition-api").Ref<{
|
|
15
|
-
[x: string]: string;
|
|
16
|
-
}>;
|
|
17
|
-
containerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
18
|
-
toolbarContainerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
19
|
-
toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
20
|
-
rootStyles: import("@vue/composition-api").ComputedRef<(string | undefined)[]>;
|
|
21
|
-
toolbarButtonStyles: (item: string) => string[];
|
|
22
|
-
editorInputStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
23
|
-
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
24
|
-
modelValue: {
|
|
25
|
-
type: StringConstructor;
|
|
26
|
-
default: string;
|
|
27
|
-
required: false;
|
|
28
|
-
};
|
|
29
|
-
toolbar: {
|
|
30
|
-
type: ArrayConstructor;
|
|
31
|
-
default: () => string[][];
|
|
32
|
-
};
|
|
33
|
-
description: {
|
|
34
|
-
type: StringConstructor;
|
|
35
|
-
default: string;
|
|
36
|
-
};
|
|
37
|
-
placeholder: {
|
|
38
|
-
type: StringConstructor;
|
|
39
|
-
default: string;
|
|
40
|
-
};
|
|
41
|
-
autofocus: {
|
|
42
|
-
type: BooleanConstructor;
|
|
43
|
-
default: boolean;
|
|
44
|
-
};
|
|
45
|
-
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
46
|
-
modelValue: {
|
|
47
|
-
type: StringConstructor;
|
|
48
|
-
default: string;
|
|
49
|
-
required: false;
|
|
50
|
-
};
|
|
51
|
-
toolbar: {
|
|
52
|
-
type: ArrayConstructor;
|
|
53
|
-
default: () => string[][];
|
|
54
|
-
};
|
|
55
|
-
description: {
|
|
56
|
-
type: StringConstructor;
|
|
57
|
-
default: string;
|
|
58
|
-
};
|
|
59
|
-
placeholder: {
|
|
60
|
-
type: StringConstructor;
|
|
61
|
-
default: string;
|
|
62
|
-
};
|
|
63
|
-
autofocus: {
|
|
64
|
-
type: BooleanConstructor;
|
|
65
|
-
default: boolean;
|
|
66
|
-
};
|
|
67
|
-
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
68
|
-
modelValue: string;
|
|
69
|
-
toolbar: unknown[];
|
|
70
|
-
description: string;
|
|
71
|
-
placeholder: string;
|
|
72
|
-
autofocus: boolean;
|
|
73
|
-
} & {} & {
|
|
74
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
75
|
-
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
76
|
-
editor: Editor | null;
|
|
77
|
-
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
78
|
-
containerRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
79
|
-
iconsEnum: import("@vue/composition-api").Ref<{
|
|
80
|
-
[x: string]: string;
|
|
81
|
-
}>;
|
|
82
|
-
handleToolbarClick: (item: string) => void;
|
|
83
|
-
handleEditorClick: () => void;
|
|
84
|
-
isActive: import("@vue/composition-api").Ref<{
|
|
85
|
-
[x: string]: boolean;
|
|
86
|
-
}>;
|
|
87
|
-
iconTooltipsEnum: import("@vue/composition-api").Ref<{
|
|
88
|
-
[x: string]: string;
|
|
89
|
-
}>;
|
|
90
|
-
containerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
91
|
-
toolbarContainerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
92
|
-
toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
93
|
-
rootStyles: import("@vue/composition-api").ComputedRef<(string | undefined)[]>;
|
|
94
|
-
toolbarButtonStyles: (item: string) => string[];
|
|
95
|
-
editorInputStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
96
|
-
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
97
|
-
modelValue: string;
|
|
98
|
-
toolbar: unknown[];
|
|
99
|
-
description: string;
|
|
100
|
-
placeholder: string;
|
|
101
|
-
autofocus: boolean;
|
|
102
|
-
} & {} & {
|
|
103
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
104
|
-
}, {
|
|
105
|
-
modelValue: string;
|
|
106
|
-
toolbar: unknown[];
|
|
107
|
-
description: string;
|
|
108
|
-
placeholder: string;
|
|
109
|
-
autofocus: boolean;
|
|
110
|
-
}, true>);
|
|
111
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as OrRichTextEditor } from './OrRichTextEditor.vue';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const EditorContainer: string[];
|
|
2
|
-
export declare const EditorContainerFilled: string[];
|
|
3
|
-
export declare const ToolbarContainer: string[];
|
|
4
|
-
export declare const Toolbar: string[];
|
|
5
|
-
export declare const ToolbarButton: string[];
|
|
6
|
-
export declare const ToolbarButtonActive: string[];
|
|
7
|
-
export declare const EditorInput: string[];
|