@teammodlr/ui-kit 2.1.49 → 2.1.51

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 (82) hide show
  1. package/lib/components/avatar/Avatar.vue.d.ts +1 -1
  2. package/lib/components/badge/style/Badge.css.d.ts +2 -2
  3. package/lib/components/button/Button.vue.d.ts +4 -4
  4. package/lib/components/button/style/Button.css.d.ts +3 -3
  5. package/lib/components/checkbox/Checkbox.vue.d.ts +4 -4
  6. package/lib/components/configprovider/ConfigProvider.vue.d.ts +12 -11
  7. package/lib/components/confirm/ConfirmProvider.vue.d.ts +10 -10
  8. package/lib/components/dropdown/DropdownItem.vue.d.ts +2 -2
  9. package/lib/components/dropdown/style/Dropdown.css.d.ts +1 -1
  10. package/lib/components/input/Input.vue.d.ts +6 -6
  11. package/lib/components/link/Link.vue.d.ts +2 -2
  12. package/lib/components/messageprovider/Message.vue.d.ts +2 -2
  13. package/lib/components/messageprovider/MessageProvider.vue.d.ts +5 -5
  14. package/lib/components/messageprovider/style/Message.css.d.ts +1 -1
  15. package/lib/components/modal/Modal.vue.d.ts +1 -1
  16. package/lib/components/radio/Radio.vue.d.ts +6 -6
  17. package/lib/components/radiobutton/RadioButton.vue.d.ts +4 -4
  18. package/lib/components/renderer/renderer.d.ts +1 -1
  19. package/lib/components/select/Select.vue.d.ts +21 -20
  20. package/lib/components/switch/Switch.vue.d.ts +4 -4
  21. package/lib/components/tab/Tab.vue.d.ts +4 -6
  22. package/lib/components/tab/TabGroup.vue.d.ts +17 -3
  23. package/lib/components/tab/style/Tab.css.d.ts +7 -0
  24. package/lib/components/tab/style/index.d.ts +1 -0
  25. package/lib/components/table/Table.vue.d.ts +2 -2
  26. package/lib/components/textarea/Textarea.vue.d.ts +5 -5
  27. package/lib/composables/useInput.d.ts +1 -1
  28. package/lib/index.cjs.js +10 -13
  29. package/lib/index.es.js +2386 -2432
  30. package/lib/install.d.ts +1 -1
  31. package/lib/style.css +1 -1
  32. package/package.json +75 -89
  33. package/src/components/avatar/examples/index.stories.ts +25 -25
  34. package/src/components/avatargroup/examples/index.stories.ts +19 -19
  35. package/src/components/badge/examples/index.stories.ts +19 -19
  36. package/src/components/breadcrumb/examples/index.stories.ts +16 -16
  37. package/src/components/button/examples/index.stories.ts +37 -37
  38. package/src/components/buttongroup/examples/index.stories.ts +17 -17
  39. package/src/components/checkbox/examples/index.stories.ts +16 -16
  40. package/src/components/colorpicker/examples/index.stories.ts +12 -12
  41. package/src/components/configprovider/ConfigProvider.vue +38 -38
  42. package/src/components/confirm/ConfirmProvider.vue +82 -82
  43. package/src/components/confirm/examples/index.stories.ts +26 -26
  44. package/src/components/dialog/examples/index.stories.ts +14 -14
  45. package/src/components/dropdown/examples/index.stories.ts +26 -26
  46. package/src/components/form/examples/index.stories.ts +23 -23
  47. package/src/components/image/examples/index.stories.ts +10 -10
  48. package/src/components/input/examples/index.stories.ts +26 -26
  49. package/src/components/link/examples/index.stories.ts +15 -15
  50. package/src/components/messageprovider/examples/index.stories.ts +26 -26
  51. package/src/components/modal/examples/index.stories.ts +16 -16
  52. package/src/components/pagination/examples/index.stories.ts +11 -11
  53. package/src/components/radio/examples/index.stories.ts +16 -16
  54. package/src/components/radiobuttongroup/examples/index.stories.ts +18 -18
  55. package/src/components/renderer/examlpes/index.stories.ts +14 -14
  56. package/src/components/select/Select.vue +755 -755
  57. package/src/components/select/examples/basic.vue +26 -26
  58. package/src/components/select/examples/index.stories.ts +16 -16
  59. package/src/components/select/types.ts +27 -27
  60. package/src/components/skeleton/examples/index.stories.ts +13 -13
  61. package/src/components/switch/examples/index.stories.ts +15 -15
  62. package/src/components/switch/style/Switch.css.ts +135 -135
  63. package/src/components/tab/Tab.vue +85 -98
  64. package/src/components/tab/TabGroup.vue +96 -90
  65. package/src/components/tab/examples/index.stories.ts +21 -10
  66. package/src/components/tab/style/Tab.css.ts +137 -0
  67. package/src/components/tab/style/index.ts +1 -0
  68. package/src/components/table/examples/index.stories.ts +17 -17
  69. package/src/components/tag/examples/index.stories.ts +16 -16
  70. package/src/components/textarea/examples/index.stories.ts +14 -14
  71. package/src/components/tooltip/examples/index.stories.ts +17 -17
  72. package/src/components/transfer/examples/index.stories.ts +12 -12
  73. package/src/components/tree/examples/index.stories.ts +12 -12
  74. package/src/components/virtualscroll/examples/index.stories.ts +11 -11
  75. package/src/composables/useCachedUid.ts +15 -15
  76. package/src/composables/useInput.ts +151 -151
  77. package/src/examples/cards/cards.stories.ts +9 -9
  78. package/src/examples/modal/modal.stories.ts +9 -9
  79. package/src/types/props.ts +21 -21
  80. package/src/utils/call.ts +34 -34
  81. package/src/utils/injection.ts +45 -45
  82. package/src/components/tab/Tab.css +0 -113
@@ -1,26 +1,26 @@
1
- <template>
2
- <MSelect
3
- v-model="value"
4
- :options="options"
5
- :option-value="'id'"
6
- :option-label="'name'"
7
- blank
8
- @update:value="testThis"
9
- />
10
- </template>
11
-
12
- <script lang="ts" setup>
13
- import { ref } from "vue";
14
-
15
- // make list of options with 1000 items
16
- const options = Array.from({ length: 50 }, (_, i) => ({
17
- id: i,
18
- name: `Option ${i+1}`
19
- }));
20
-
21
- const value = ref();
22
-
23
- function testThis(value: any, option: any) {
24
- alert('value: ' + value);
25
- }
26
- </script>
1
+ <template>
2
+ <MSelect
3
+ v-model="value"
4
+ :options="options"
5
+ :option-value="'id'"
6
+ :option-label="'name'"
7
+ blank
8
+ @update:value="testThis"
9
+ />
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from "vue";
14
+
15
+ // make list of options with 1000 items
16
+ const options = Array.from({ length: 50 }, (_, i) => ({
17
+ id: i,
18
+ name: `Option ${i+1}`
19
+ }));
20
+
21
+ const value = ref();
22
+
23
+ function testThis(value: any, option: any) {
24
+ alert('value: ' + value);
25
+ }
26
+ </script>
@@ -1,16 +1,16 @@
1
- import MSelect from '../Select.vue';
2
- import { MSelectBasic, MSelectSearchable, MSelectMultiple } from './index';
3
-
4
- import { createStory, sizeArgType } from '../../../__storybook__';
5
-
6
- export default {
7
- component: MSelect,
8
- title: 'Components/Select',
9
- argTypes: {
10
- ...sizeArgType()
11
- }
12
- };
13
-
14
- export const Basic = createStory(MSelectBasic);
15
- export const Searchable = createStory(MSelectSearchable);
16
- export const Multiple = createStory(MSelectMultiple);
1
+ import MSelect from '../Select.vue';
2
+ import { MSelectBasic, MSelectSearchable, MSelectMultiple } from './index';
3
+
4
+ import { createStory, sizeArgType } from '../../../__storybook__';
5
+
6
+ export default {
7
+ component: MSelect,
8
+ title: 'Components/Select',
9
+ argTypes: {
10
+ ...sizeArgType()
11
+ }
12
+ };
13
+
14
+ export const Basic = createStory(MSelectBasic);
15
+ export const Searchable = createStory(MSelectSearchable);
16
+ export const Multiple = createStory(MSelectMultiple);
@@ -1,27 +1,27 @@
1
- export type ValueAtom = string | number
2
- export type Value = ValueAtom | string[] | number[] | ValueAtom[]
3
- export type OnUpdateValue = (
4
- value: string &
5
- number &
6
- ValueAtom &
7
- string[] &
8
- number[] &
9
- ValueAtom[] &
10
- (ValueAtom | null) &
11
- (string[] | null) &
12
- (number[] | null) &
13
- (ValueAtom[] | null),
14
- option: object & null
15
- ) => void
16
- export type OnUpdateValueImpl = (
17
- value:
18
- | ValueAtom
19
- | string[]
20
- | number[]
21
- | ValueAtom[]
22
- | (ValueAtom | null)
23
- | (string[] | null)
24
- | (number[] | null)
25
- | (ValueAtom[] | null),
26
- option: object | null
27
- ) => void
1
+ export type ValueAtom = string | number
2
+ export type Value = ValueAtom | string[] | number[] | ValueAtom[]
3
+ export type OnUpdateValue = (
4
+ value: string &
5
+ number &
6
+ ValueAtom &
7
+ string[] &
8
+ number[] &
9
+ ValueAtom[] &
10
+ (ValueAtom | null) &
11
+ (string[] | null) &
12
+ (number[] | null) &
13
+ (ValueAtom[] | null),
14
+ option: object & null
15
+ ) => void
16
+ export type OnUpdateValueImpl = (
17
+ value:
18
+ | ValueAtom
19
+ | string[]
20
+ | number[]
21
+ | ValueAtom[]
22
+ | (ValueAtom | null)
23
+ | (string[] | null)
24
+ | (number[] | null)
25
+ | (ValueAtom[] | null),
26
+ option: object | null
27
+ ) => void
@@ -1,13 +1,13 @@
1
- import { createStory } from '../../../__storybook__';
2
- import MSkeleton from '../Skeleton.vue';
3
-
4
- import { MSkeletonBasic, MSkeletonPost } from './index';
5
-
6
- export default {
7
- component: MSkeleton,
8
- title: 'Components/Skeleton',
9
- argTypes: {}
10
- };
11
-
12
- export const Basic = createStory(MSkeletonBasic);
13
- export const Post = createStory(MSkeletonPost);
1
+ import { createStory } from '../../../__storybook__';
2
+ import MSkeleton from '../Skeleton.vue';
3
+
4
+ import { MSkeletonBasic, MSkeletonPost } from './index';
5
+
6
+ export default {
7
+ component: MSkeleton,
8
+ title: 'Components/Skeleton',
9
+ argTypes: {}
10
+ };
11
+
12
+ export const Basic = createStory(MSkeletonBasic);
13
+ export const Post = createStory(MSkeletonPost);
@@ -1,15 +1,15 @@
1
- import MSwitch from '../Switch.vue';
2
- import { MSwitchBasic, MSwitchSlot } from './index';
3
-
4
- import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
5
-
6
- export default {
7
- component: MSwitch,
8
- title: 'Components/Switch',
9
- argTypes: {
10
- ...sizeArgType()
11
- }
12
- };
13
-
14
- export const Basic = createStory(MSwitchBasic);
15
- export const Slot = createStory(MSwitchSlot);
1
+ import MSwitch from '../Switch.vue';
2
+ import { MSwitchBasic, MSwitchSlot } from './index';
3
+
4
+ import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
5
+
6
+ export default {
7
+ component: MSwitch,
8
+ title: 'Components/Switch',
9
+ argTypes: {
10
+ ...sizeArgType()
11
+ }
12
+ };
13
+
14
+ export const Basic = createStory(MSwitchBasic);
15
+ export const Slot = createStory(MSwitchSlot);
@@ -1,135 +1,135 @@
1
- import {
2
- createVar,
3
- globalStyle,
4
- style,
5
- styleVariants
6
- } from '@vanilla-extract/css';
7
- import { themeVars } from '../../../styles/theme.css';
8
-
9
- const sizes = {
10
- xs: '14px',
11
- sm: '16px',
12
- md: '18px',
13
- lg: '20px',
14
- xl: '22px'
15
- };
16
-
17
- const vars = {
18
- offBackground: createVar(),
19
- onBackground: createVar(),
20
- handleBackground: createVar(),
21
- height: createVar()
22
- };
23
-
24
- export const toggle = style({
25
- vars: {
26
- [vars.height]: sizes.md,
27
- [vars.offBackground]: themeVars.color.gray[300],
28
- [vars.onBackground]: themeVars.color.blue[500],
29
- [vars.handleBackground]: '#fff'
30
- },
31
- outline: 0,
32
- display: 'block',
33
- width: `calc(${vars.height} * 2)`,
34
- minWidth: `calc(${vars.height} * 2)`,
35
- height: `calc(${vars.height} + 2px)`,
36
- position: 'relative',
37
- cursor: 'pointer',
38
- userSelect: 'none',
39
- borderRadius: '2em',
40
- padding: '2px',
41
- background: vars.offBackground,
42
- transition: 'all .4s ease',
43
- selectors: {
44
- ['&:after']: {
45
- position: 'relative',
46
- display: 'block',
47
- content: '""',
48
- width: `calc(${vars.height} - 2px)`,
49
- height: '100%',
50
- left: 0,
51
- borderRadius: '50%',
52
- background: vars.handleBackground,
53
- transition: 'all .2s ease'
54
- },
55
- ['&:before']: {
56
- position: 'relative',
57
- content: '""',
58
- width: '50%',
59
- height: '100%',
60
- display: 'none'
61
- }
62
- }
63
- });
64
-
65
- export const checked = style({
66
- vars: {
67
- [vars.offBackground]: vars.onBackground
68
- },
69
- selectors: {
70
- ['&:after']: {
71
- left: '50%'
72
- }
73
- }
74
- });
75
-
76
- export const base = style({
77
- position: 'relative',
78
- display: 'inline-flex',
79
- alignItems: 'center',
80
- cursor: 'pointer',
81
- gap: themeVars.space['1.5']
82
- });
83
-
84
- export const input = style({
85
- position: 'absolute',
86
- opacity: 0,
87
- cursor: 'pointer'
88
- });
89
-
90
- export const disabled = style({
91
- opacity: 0.5,
92
- cursor: 'not-allowed'
93
- });
94
-
95
- export const label = style({
96
- marginLeft: themeVars.space['0.5'],
97
- fontWeight: '500',
98
- display: 'inline-block',
99
- fontSize: themeVars.fontSize.base,
100
- wordBreak: 'break-word',
101
- cursor: 'pointer'
102
- });
103
-
104
- export const size = styleVariants({
105
- xs: {
106
- vars: {
107
- [vars.height]: sizes.xs
108
- }
109
- },
110
- sm: {
111
- vars: {
112
- [vars.height]: sizes.sm
113
- }
114
- },
115
- md: {
116
- vars: {
117
- [vars.height]: sizes.md
118
- }
119
- },
120
- lg: {
121
- vars: {
122
- [vars.height]: sizes.lg
123
- }
124
- },
125
- xl: {
126
- vars: {
127
- [vars.height]: sizes.xl
128
- }
129
- }
130
- });
131
-
132
- globalStyle(`${base} ${input}:focus + ${toggle}`, {
133
- vars: {},
134
- boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
135
- });
1
+ import {
2
+ createVar,
3
+ globalStyle,
4
+ style,
5
+ styleVariants
6
+ } from '@vanilla-extract/css';
7
+ import { themeVars } from '../../../styles/theme.css';
8
+
9
+ const sizes = {
10
+ xs: '14px',
11
+ sm: '16px',
12
+ md: '18px',
13
+ lg: '20px',
14
+ xl: '22px'
15
+ };
16
+
17
+ const vars = {
18
+ offBackground: createVar(),
19
+ onBackground: createVar(),
20
+ handleBackground: createVar(),
21
+ height: createVar()
22
+ };
23
+
24
+ export const toggle = style({
25
+ vars: {
26
+ [vars.height]: sizes.md,
27
+ [vars.offBackground]: themeVars.color.gray[300],
28
+ [vars.onBackground]: themeVars.color.blue[500],
29
+ [vars.handleBackground]: '#fff'
30
+ },
31
+ outline: 0,
32
+ display: 'block',
33
+ width: `calc(${vars.height} * 2)`,
34
+ minWidth: `calc(${vars.height} * 2)`,
35
+ height: `calc(${vars.height} + 2px)`,
36
+ position: 'relative',
37
+ cursor: 'pointer',
38
+ userSelect: 'none',
39
+ borderRadius: '2em',
40
+ padding: '2px',
41
+ background: vars.offBackground,
42
+ transition: 'all .4s ease',
43
+ selectors: {
44
+ ['&:after']: {
45
+ position: 'relative',
46
+ display: 'block',
47
+ content: '""',
48
+ width: `calc(${vars.height} - 2px)`,
49
+ height: '100%',
50
+ left: 0,
51
+ borderRadius: '50%',
52
+ background: vars.handleBackground,
53
+ transition: 'all .2s ease'
54
+ },
55
+ ['&:before']: {
56
+ position: 'relative',
57
+ content: '""',
58
+ width: '50%',
59
+ height: '100%',
60
+ display: 'none'
61
+ }
62
+ }
63
+ });
64
+
65
+ export const checked = style({
66
+ vars: {
67
+ [vars.offBackground]: vars.onBackground
68
+ },
69
+ selectors: {
70
+ ['&:after']: {
71
+ left: '50%'
72
+ }
73
+ }
74
+ });
75
+
76
+ export const base = style({
77
+ position: 'relative',
78
+ display: 'inline-flex',
79
+ alignItems: 'center',
80
+ cursor: 'pointer',
81
+ gap: themeVars.space['1.5']
82
+ });
83
+
84
+ export const input = style({
85
+ position: 'absolute',
86
+ opacity: 0,
87
+ cursor: 'pointer'
88
+ });
89
+
90
+ export const disabled = style({
91
+ opacity: 0.5,
92
+ cursor: 'not-allowed'
93
+ });
94
+
95
+ export const label = style({
96
+ marginLeft: themeVars.space['0.5'],
97
+ fontWeight: '500',
98
+ display: 'inline-block',
99
+ fontSize: themeVars.fontSize.base,
100
+ wordBreak: 'break-word',
101
+ cursor: 'pointer'
102
+ });
103
+
104
+ export const size = styleVariants({
105
+ xs: {
106
+ vars: {
107
+ [vars.height]: sizes.xs
108
+ }
109
+ },
110
+ sm: {
111
+ vars: {
112
+ [vars.height]: sizes.sm
113
+ }
114
+ },
115
+ md: {
116
+ vars: {
117
+ [vars.height]: sizes.md
118
+ }
119
+ },
120
+ lg: {
121
+ vars: {
122
+ [vars.height]: sizes.lg
123
+ }
124
+ },
125
+ xl: {
126
+ vars: {
127
+ [vars.height]: sizes.xl
128
+ }
129
+ }
130
+ });
131
+
132
+ globalStyle(`${base} ${input}:focus + ${toggle}`, {
133
+ vars: {},
134
+ boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
135
+ });
@@ -1,98 +1,85 @@
1
- <template>
2
- <li
3
- :data-value="computedValue"
4
- :class="computedTabWrapperClasses"
5
- >
6
- <button
7
- role="button"
8
- type="button"
9
- ref="tabRef"
10
- :class="computedTabClasses"
11
- @click.prevent="handleClick"
12
- :disabled="disabled"
13
- >
14
- <slot
15
- name="tab"
16
- :label="label"
17
- :value="value"
18
- >
19
- {{ computedLabel }}
20
- </slot>
21
-
22
- <teleport v-if="selected && teleportTo" :to="teleportTo">
23
- <slot />
24
- </teleport>
25
- </button>
26
- </li>
27
- </template>
28
-
29
- <script lang="ts">
30
- import { computed, defineComponent, inject, onMounted, reactive, ref } from 'vue';
31
-
32
- export default defineComponent({
33
- name: "Tab",
34
- props: {
35
- value: {
36
- type: [String, Number]
37
- },
38
- label: {
39
- type: String,
40
- },
41
- disabled: {
42
- type: Boolean,
43
- default: false
44
- }
45
- },
46
- setup(props, { emit }) {
47
- const computedValue = computed(() => props.value);
48
- const computedLabel = computed(() => props.label || props.value);
49
- const tabRef = ref<HTMLElement | null>(null);
50
- const teleportTo = ref(null);
51
-
52
- const tabs = inject("tabs", {
53
- tabsContentRef: ref(null),
54
- selectTab: (tab: string | number) => {},
55
- state: reactive({
56
- active: ""
57
- })
58
- });
59
-
60
- const computedTabWrapperClasses = computed(() => {
61
- return {
62
- 'm-tab': true,
63
- 'm-tab--active': selected.value,
64
- 'm-tab--disabled': props.disabled
65
- }
66
- });
67
-
68
- const computedTabClasses = computed(() => {
69
- return {
70
- 'm-tabs__button': true,
71
- }
72
- });
73
-
74
- const selected = computed(() => {
75
- return tabs.state.active === computedValue.value;
76
- });
77
-
78
- function handleClick() {
79
- tabs.selectTab(computedValue.value!);
80
- }
81
-
82
- onMounted(() => {
83
- teleportTo.value = tabs.tabsContentRef.value;
84
- });
85
-
86
- return {
87
- computedValue,
88
- computedLabel,
89
- tabRef,
90
- computedTabWrapperClasses,
91
- computedTabClasses,
92
- handleClick,
93
- selected,
94
- teleportTo
95
- }
96
- }
97
- })
98
- </script>
1
+ <template>
2
+ <div ref="tabRef" :class="computedTabClasses" @click.prevent="handleClick" :disabled="disabled">
3
+ <span :class="computedTabLabelClasses">
4
+ <slot name="tab" :label="label" :value="value">
5
+ {{ computedLabel }}
6
+ </slot>
7
+ </span>
8
+
9
+ <teleport v-if="selected && teleportTo" :to="teleportTo">
10
+ <slot />
11
+ </teleport>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { computed, defineComponent, inject, onMounted, reactive, ref } from 'vue';
17
+ import { tabButton, tabButtonActive, tabLabel } from './style';
18
+ export default defineComponent({
19
+ name: "Tab",
20
+ props: {
21
+ value: {
22
+ type: [String, Number]
23
+ },
24
+ label: {
25
+ type: String,
26
+ },
27
+ disabled: {
28
+ type: Boolean,
29
+ default: false
30
+ }
31
+ },
32
+ setup(props, { emit }) {
33
+ const computedValue = computed(() => props.value);
34
+ const computedLabel = computed(() => props.label || props.value);
35
+ const tabRef = ref<HTMLElement | null>(null);
36
+ const teleportTo = ref(null);
37
+
38
+ const tabs = inject("tabs", {
39
+ tabsContentRef: ref(null),
40
+ selectTab: (tab: string | number) => { },
41
+ state: reactive({
42
+ active: "",
43
+ type: "base"
44
+ }),
45
+ });
46
+
47
+ const computedTabClasses = computed(() => {
48
+ return {
49
+ [tabButton[tabs.state.type as keyof typeof tabButton]]: true,
50
+ [tabButtonActive[tabs.state.type as keyof typeof tabButtonActive]]: selected.value,
51
+ }
52
+ });
53
+
54
+ const computedTabLabelClasses = computed(() => {
55
+ return {
56
+ [tabLabel]: true,
57
+ }
58
+ })
59
+
60
+
61
+ const selected = computed(() => {
62
+ return tabs.state.active === computedValue.value;
63
+ });
64
+
65
+ function handleClick() {
66
+ tabs.selectTab(computedValue.value!);
67
+ }
68
+
69
+ onMounted(() => {
70
+ teleportTo.value = tabs.tabsContentRef.value;
71
+ });
72
+
73
+ return {
74
+ computedValue,
75
+ computedLabel,
76
+ tabRef,
77
+ computedTabClasses,
78
+ computedTabLabelClasses,
79
+ handleClick,
80
+ selected,
81
+ teleportTo
82
+ }
83
+ }
84
+ })
85
+ </script>