@teammodlr/ui-kit 3.0.0-beta.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/lib/components/checkbox/Checkbox.vue.d.ts +4 -4
  2. package/lib/components/clearbutton/ClearButton.vue.d.ts +7 -0
  3. package/lib/components/clearbutton/style/ClearButton.css.d.ts +2 -0
  4. package/lib/components/clearbutton/style/index.d.ts +1 -0
  5. package/lib/components/colorpicker/ColorPicker.vue.d.ts +0 -1
  6. package/lib/components/colorpicker/style/ColorPicker.css.d.ts +1 -0
  7. package/lib/components/dialog/style/Dialog.css.d.ts +2 -0
  8. package/lib/components/drawer/Drawer.vue.d.ts +142 -0
  9. package/lib/components/drawer/style/Drawer.css.d.ts +33 -0
  10. package/lib/components/drawer/style/index.d.ts +1 -0
  11. package/lib/components/hovercard/HoverCard.vue.d.ts +122 -0
  12. package/lib/components/hovercard/style/HoverCard.css.d.ts +3 -0
  13. package/lib/components/hovercard/style/index.d.ts +1 -0
  14. package/lib/components/index.d.ts +3 -0
  15. package/lib/components/input/Input.vue.d.ts +20 -5
  16. package/lib/components/input/style/Input.css.d.ts +4 -0
  17. package/lib/components/paneldialog/PanelDialog.vue.d.ts +167 -0
  18. package/lib/components/paneldialog/style/PanelDialog.css.d.ts +8 -0
  19. package/lib/components/paneldialog/style/index.d.ts +1 -0
  20. package/lib/components/popover/Popover.vue.d.ts +24 -0
  21. package/lib/components/radio/Radio.vue.d.ts +5 -5
  22. package/lib/components/radiobutton/RadioButton.vue.d.ts +4 -4
  23. package/lib/components/select/Select.vue.d.ts +72 -91
  24. package/lib/components/select/style/Select.css.d.ts +9 -1
  25. package/lib/components/switch/Switch.vue.d.ts +4 -4
  26. package/lib/components/textarea/Textarea.vue.d.ts +16 -5
  27. package/lib/components/textarea/style/Textarea.css.d.ts +2 -0
  28. package/lib/composables/useInput.d.ts +9 -2
  29. package/lib/index.cjs.js +3 -3
  30. package/lib/index.es.js +8491 -6431
  31. package/lib/style.css +1 -1
  32. package/lib/tsconfig.app.tsbuildinfo +1 -0
  33. package/package.json +7 -4
  34. package/src/components/cardcontextmenu/style/Dropdown.css.ts +7 -0
  35. package/src/components/clearbutton/ClearButton.vue +39 -0
  36. package/src/components/clearbutton/style/ClearButton.css.ts +37 -0
  37. package/src/components/clearbutton/style/index.ts +1 -0
  38. package/src/components/colorpicker/ColorPicker.vue +8 -11
  39. package/src/components/colorpicker/examples/basic.vue +8 -17
  40. package/src/components/colorpicker/style/ColorPicker.css.ts +6 -1
  41. package/src/components/dialog/Dialog.vue +2 -5
  42. package/src/components/dialog/style/Dialog.css.ts +30 -0
  43. package/src/components/drawer/Drawer.vue +276 -0
  44. package/src/components/drawer/examples/basic.vue +15 -0
  45. package/src/components/drawer/examples/custom-title.vue +21 -0
  46. package/src/components/drawer/examples/index.stories.ts +24 -0
  47. package/src/components/drawer/examples/index.ts +7 -0
  48. package/src/components/drawer/examples/no-mask.vue +15 -0
  49. package/src/components/drawer/examples/no-outside-close.vue +15 -0
  50. package/src/components/drawer/examples/placements.vue +28 -0
  51. package/src/components/drawer/examples/with-footer.vue +21 -0
  52. package/src/components/drawer/examples/with-trigger.vue +13 -0
  53. package/src/components/drawer/style/Drawer.css.ts +208 -0
  54. package/src/components/drawer/style/index.ts +1 -0
  55. package/src/components/dropdown/Dropdown.vue +1 -1
  56. package/src/components/hovercard/HoverCard.vue +163 -0
  57. package/src/components/hovercard/style/HoverCard.css.ts +175 -0
  58. package/src/components/hovercard/style/index.ts +1 -0
  59. package/src/components/index.ts +3 -0
  60. package/src/components/input/Input.vue +52 -4
  61. package/src/components/input/examples/clearable.vue +18 -0
  62. package/src/components/input/examples/index.stories.ts +3 -1
  63. package/src/components/input/examples/index.ts +1 -0
  64. package/src/components/input/style/Input.css.ts +19 -0
  65. package/src/components/messageprovider/MessageProvider.vue +33 -7
  66. package/src/components/paneldialog/PanelDialog.vue +500 -0
  67. package/src/components/paneldialog/examples/basic.vue +36 -0
  68. package/src/components/paneldialog/examples/index.stories.ts +22 -0
  69. package/src/components/paneldialog/examples/index.ts +2 -0
  70. package/src/components/paneldialog/examples/modal.vue +31 -0
  71. package/src/components/paneldialog/style/PanelDialog.css.ts +90 -0
  72. package/src/components/paneldialog/style/index.ts +1 -0
  73. package/src/components/popover/Popover.vue +6 -1
  74. package/src/components/select/Select.vue +122 -42
  75. package/src/components/select/examples/clearable.vue +18 -0
  76. package/src/components/select/examples/fill.vue +52 -0
  77. package/src/components/select/examples/index.stories.ts +3 -1
  78. package/src/components/select/examples/index.ts +2 -0
  79. package/src/components/select/style/Select.css.ts +140 -24
  80. package/src/components/tab/Tab.vue +1 -1
  81. package/src/components/tab/style/Tab.css.ts +6 -0
  82. package/src/components/textarea/Textarea.vue +40 -4
  83. package/src/components/textarea/examples/clearable.vue +16 -0
  84. package/src/components/textarea/examples/index.stories.ts +2 -1
  85. package/src/components/textarea/examples/index.ts +1 -0
  86. package/src/components/textarea/style/Textarea.css.ts +10 -0
  87. package/src/composables/useInput.ts +10 -2
@@ -6,7 +6,7 @@ import {
6
6
  } from '@vanilla-extract/css';
7
7
  import { themeVars } from '../../../styles/theme.css';
8
8
 
9
- const sizes = {
9
+ const heights = {
10
10
  xs: '26px',
11
11
  sm: '30px',
12
12
  md: '38px',
@@ -42,7 +42,7 @@ export const wrapper = style({
42
42
 
43
43
  export const base = style({
44
44
  vars: {
45
- [vars.height]: sizes.md,
45
+ [vars.height]: heights.md,
46
46
  [vars.radius]: borderRadiuses.md,
47
47
  [vars.paddingX]: themeVars.space[2],
48
48
  [vars.paddingY]: themeVars.space[0],
@@ -189,8 +189,7 @@ export const menu = style({
189
189
  borderRadius: '4px',
190
190
  border: `1px solid ${themeVars.color.gray[200]}`,
191
191
  boxShadow: themeVars.shadow.md,
192
- maxHeight: '230px',
193
- overflowY: 'auto'
192
+ overflow: 'hidden'
194
193
  });
195
194
 
196
195
  export const placeholder = style({
@@ -199,11 +198,7 @@ export const placeholder = style({
199
198
  });
200
199
 
201
200
  export const search = style({
202
- // padding: `${themeVars.space[1]} ${themeVars.space[1]} 0`,
203
201
  backgroundColor: '#FFFFFF',
204
- position: 'sticky',
205
- top: 0,
206
- zIndex: 1,
207
202
  borderBottom: `1px solid ${themeVars.color.gray[200]}`,
208
203
  display: 'flex'
209
204
  });
@@ -219,10 +214,7 @@ export const searchInput = style({
219
214
  });
220
215
 
221
216
  export const options = style({
222
- padding: themeVars.space[1],
223
- display: 'flex',
224
- flexDirection: 'column',
225
- gap: themeVars.space[0.5]
217
+ overflow: 'hidden'
226
218
  });
227
219
 
228
220
  export const option = style({
@@ -234,10 +226,7 @@ export const option = style({
234
226
  display: 'flex',
235
227
  alignItems: 'center',
236
228
  cursor: 'pointer',
237
- minHeight: '36px',
238
- fontSize: themeVars.fontSize.base,
239
- paddingBlock: themeVars.space['1.5'],
240
- paddingInline: themeVars.space['3'],
229
+ marginBottom: '2px',
241
230
  gap: themeVars.space[2],
242
231
  color: vars.optionColor,
243
232
  transition: 'background-color 0.05s ease-in-out',
@@ -280,6 +269,39 @@ export const optionSelected = style({
280
269
 
281
270
  export const optionLabel = style({});
282
271
 
272
+ export const optionSizes = styleVariants({
273
+ xs: {
274
+ minHeight: '28px',
275
+ fontSize: themeVars.fontSize.small,
276
+ paddingBlock: themeVars.space['1'],
277
+ paddingInline: themeVars.space['2']
278
+ },
279
+ sm: {
280
+ minHeight: '30px',
281
+ fontSize: themeVars.fontSize.base,
282
+ paddingBlock: themeVars.space['1'],
283
+ paddingInline: themeVars.space['2.5']
284
+ },
285
+ md: {
286
+ minHeight: '36px',
287
+ fontSize: themeVars.fontSize.base,
288
+ paddingBlock: themeVars.space['1.5'],
289
+ paddingInline: themeVars.space['3']
290
+ },
291
+ lg: {
292
+ minHeight: '40px',
293
+ fontSize: themeVars.fontSize.large,
294
+ paddingBlock: themeVars.space['2'],
295
+ paddingInline: themeVars.space['3']
296
+ },
297
+ xl: {
298
+ minHeight: '44px',
299
+ fontSize: themeVars.fontSize.large,
300
+ paddingBlock: themeVars.space['2.5'],
301
+ paddingInline: themeVars.space['3']
302
+ }
303
+ });
304
+
283
305
  export const checkAll = style({
284
306
  display: 'flex',
285
307
  alignItems: 'center',
@@ -357,13 +379,15 @@ export const noResults = style({
357
379
  fontSize: themeVars.fontSize.small
358
380
  });
359
381
 
360
- export const clearable = style({
361
- width: themeVars.space[4],
362
- height: themeVars.space[4],
382
+ export const clear = style({
363
383
  position: 'absolute',
364
- right: themeVars.space[2],
365
- top: '0',
366
- display: 'flex'
384
+ top: '50%',
385
+ right: '2.25rem',
386
+ transform: 'translateY(-50%)'
387
+ });
388
+
389
+ export const hasClear = style({
390
+ paddingRight: '3.75rem'
367
391
  });
368
392
 
369
393
  export const arrow = style({
@@ -371,12 +395,104 @@ export const arrow = style({
371
395
  height: themeVars.space[4],
372
396
  position: 'absolute',
373
397
  right: themeVars.space[3],
374
- top: themeVars.space[3],
398
+ top: '50%',
399
+ transform: 'translateY(-50%)',
375
400
  display: 'flex',
376
401
  color: themeVars.color.gray[500],
377
402
  transition: 'transform 0.3s ease',
378
403
  });
379
404
 
380
405
  export const arrowOpen = style({
381
- transform: 'rotate(180deg)',
406
+ transform: 'translateY(-50%) rotate(180deg)',
382
407
  })
408
+
409
+ export const fillRoot = style({
410
+ display: 'flex',
411
+ flexDirection: 'column',
412
+ height: '100%',
413
+ width: '100%'
414
+ });
415
+
416
+ export const fill = style({
417
+ flexGrow: 1,
418
+ width: '100%',
419
+ minHeight: 0
420
+ });
421
+
422
+ export const sizes = styleVariants({
423
+ xs: {
424
+ vars: {
425
+ [vars.height]: heights.xs,
426
+ [vars.radius]: borderRadiuses.xs,
427
+ [vars.paddingX]: themeVars.space[1]
428
+ },
429
+ fontSize: themeVars.fontSize.small
430
+ },
431
+ sm: {
432
+ vars: {
433
+ [vars.height]: heights.sm,
434
+ [vars.radius]: borderRadiuses.sm,
435
+ [vars.paddingX]: themeVars.space[1.5]
436
+ },
437
+ fontSize: themeVars.fontSize.small
438
+ },
439
+ md: {
440
+ vars: {
441
+ [vars.height]: heights.md,
442
+ [vars.radius]: borderRadiuses.md
443
+ }
444
+ },
445
+ lg: {
446
+ vars: {
447
+ [vars.height]: heights.lg,
448
+ [vars.radius]: borderRadiuses.lg,
449
+ [vars.paddingX]: themeVars.space[2.5]
450
+ },
451
+ fontSize: themeVars.fontSize.large
452
+ },
453
+ xl: {
454
+ vars: {
455
+ [vars.height]: heights.xl,
456
+ [vars.radius]: borderRadiuses.xl,
457
+ [vars.paddingX]: themeVars.space[3]
458
+ },
459
+ fontSize: themeVars.fontSize.large
460
+ }
461
+ });
462
+
463
+ export const fillBase = style({
464
+ minHeight: 'unset',
465
+ height: '100%',
466
+ lineHeight: 'normal',
467
+ display: 'flex',
468
+ alignItems: 'center',
469
+ overflow: 'hidden',
470
+ paddingRight: '2rem'
471
+ });
472
+
473
+ export const fillLabel = style({
474
+ overflow: 'hidden',
475
+ whiteSpace: 'nowrap',
476
+ textOverflow: 'ellipsis',
477
+ flex: 1,
478
+ minWidth: 0
479
+ });
480
+
481
+ export const noBorder = style({
482
+ vars: {
483
+ [vars.borderColor]: 'transparent'
484
+ },
485
+ borderRadius: 0,
486
+ boxShadow: 'none',
487
+ ':hover': {
488
+ vars: {
489
+ [vars.borderColor]: 'transparent'
490
+ }
491
+ },
492
+ ':focus': {
493
+ vars: {
494
+ [vars.borderColor]: 'transparent'
495
+ },
496
+ boxShadow: 'none'
497
+ }
498
+ });
@@ -14,7 +14,7 @@
14
14
 
15
15
  <teleport v-if="teleportTo && hasContent" :to="teleportTo">
16
16
  <TabsContent :value="computedValue" as-child>
17
- <div>
17
+ <div style="outline: none">
18
18
  <slot />
19
19
  </div>
20
20
  </TabsContent>
@@ -91,6 +91,12 @@ export const baseButton = style({
91
91
  vars: {
92
92
  color: themeVars.color.blue[400],
93
93
  },
94
+ },
95
+ '&:focus': {
96
+ outline: 'none',
97
+ },
98
+ '&:focus-visible': {
99
+ outline: 'none',
94
100
  }
95
101
  }
96
102
  });
@@ -17,12 +17,14 @@
17
17
  :value="textareaValue"
18
18
  :readonly="readonly"
19
19
  v-on="inputListeners"
20
+ @input="onNativeInput"
20
21
  :class="inputComputedClasses"
21
22
  v-bind="$attrs"
22
23
  :disabled="disabled || loading"
23
24
  :aria-disabled="disabled ? 'true' : 'false'"
24
25
  :aria-labelledby="`${id}-label`"
25
26
  />
27
+ <MClearButton v-if="showClear" :class="style.clear" @clear="onClear" />
26
28
  </div>
27
29
  <div v-if="inputError" :class="style.errorMessage">
28
30
  {{ inputError }}
@@ -37,14 +39,17 @@ import {
37
39
  defineComponent,
38
40
  ref,
39
41
  computed,
40
- toRef
42
+ toRef,
43
+ watch
41
44
  } from "vue";
42
45
  import { useInput } from "../../composables/useInput";
43
46
  import { useInteractive } from "../../composables/useInteractive";
47
+ import MClearButton from '../clearbutton/ClearButton.vue';
44
48
  import * as style from './style';
45
49
 
46
50
  export default defineComponent({
47
51
  name: 'MTextArea',
52
+ components: { MClearButton },
48
53
  props: {
49
54
  ...useInput.props(),
50
55
  ...useInteractive.props(),
@@ -80,15 +85,19 @@ export default defineComponent({
80
85
  default: false
81
86
  },
82
87
  error: {
83
- type: String,
88
+ type: String as PropType<string | null>,
84
89
  default: ''
85
90
  },
86
91
  height: {
87
92
  type: Number,
88
93
  default: 64
89
94
  },
95
+ clearable: {
96
+ type: Boolean,
97
+ default: false
98
+ },
90
99
  },
91
- emits: useInput.emits(),
100
+ emits: [...useInput.emits(), 'clear'],
92
101
  setup(props, { emit, expose }) {
93
102
  const element = ref<HTMLTextAreaElement | null>(null);
94
103
  const { focus, blur } = useInteractive(element);
@@ -136,6 +145,7 @@ export default defineComponent({
136
145
  [style.block]: props.block,
137
146
  [style.disabled]: disabled.value || loading.value,
138
147
  [style.error]: inputError.value,
148
+ [style.hasClear]: props.clearable,
139
149
  }
140
150
  ];
141
151
  });
@@ -144,12 +154,36 @@ export default defineComponent({
144
154
  return formError.value || props.error;
145
155
  });
146
156
 
157
+ // Tracks typed text so clearable works without v-model
158
+ const internalValue = ref('');
159
+ watch(() => props.modelValue, value => {
160
+ internalValue.value = value == null ? '' : String(value);
161
+ }, { immediate: true });
162
+
147
163
  const textareaValue = computed(() => {
148
- return props.modelValue == null ? '' : String(props.modelValue);
164
+ if (props.modelValue !== undefined) {
165
+ return props.modelValue == null ? '' : String(props.modelValue);
166
+ }
167
+ return internalValue.value;
168
+ });
169
+
170
+ const onNativeInput = (event: Event) => {
171
+ internalValue.value = (event.target as HTMLTextAreaElement).value;
172
+ };
173
+
174
+ const showClear = computed(() => {
175
+ return props.clearable
176
+ && !disabled.value
177
+ && !loading.value
178
+ && !readonly.value
179
+ && textareaValue.value !== '';
149
180
  });
150
181
 
151
182
  const onClear = () => {
183
+ internalValue.value = '';
152
184
  emit('update:modelValue', '');
185
+ emit('clear');
186
+ focus();
153
187
  };
154
188
 
155
189
  expose({
@@ -171,6 +205,8 @@ export default defineComponent({
171
205
  textareaValue,
172
206
  inputError,
173
207
  style,
208
+ showClear,
209
+ onNativeInput,
174
210
 
175
211
  onClear,
176
212
  validate,
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <MTextArea
3
+ v-model="value"
4
+ label="Some Text"
5
+ name="text"
6
+ placeholder="Some text placeholder"
7
+ :height="128"
8
+ clearable
9
+ />
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ const value = ref('Clear me');
16
+ </script>
@@ -1,5 +1,5 @@
1
1
  import MTextarea from '../Textarea.vue';
2
- import { MTextareaBasic } from './index';
2
+ import { MTextareaBasic, MTextareaClearable } from './index';
3
3
 
4
4
  import { createStory, sizeArgType } from '../../../__storybook__';
5
5
 
@@ -12,3 +12,4 @@ export default {
12
12
  };
13
13
 
14
14
  export const Basic = createStory(MTextareaBasic);
15
+ export const Clearable = createStory(MTextareaClearable);
@@ -1 +1,2 @@
1
1
  export { default as MTextareaBasic } from './basic.vue';
2
+ export { default as MTextareaClearable } from './clearable.vue';
@@ -144,6 +144,16 @@ export const disabled = style({
144
144
  }
145
145
  });
146
146
 
147
+ export const hasClear = style({
148
+ paddingRight: '1.75rem'
149
+ });
150
+
151
+ export const clear = style({
152
+ position: 'absolute',
153
+ top: themeVars.space[1],
154
+ right: themeVars.space[1]
155
+ });
156
+
147
157
  export const label = style({
148
158
  fontWeight: '500',
149
159
  display: 'inline-block',
@@ -10,6 +10,14 @@ export interface FormInput {
10
10
  setError: (value: string) => void;
11
11
  }
12
12
 
13
+ export interface InputEmitsMap {
14
+ 'update:modelValue': (...args: any[]) => any;
15
+ blur: (...args: any[]) => any;
16
+ focus: (...args: any[]) => any;
17
+ input: (...args: any[]) => any;
18
+ change: (...args: any[]) => any;
19
+ }
20
+
13
21
  export const useInput = (
14
22
  props: any,
15
23
  {
@@ -138,12 +146,12 @@ useInput.emits = (withListeners = true): string[] => {
138
146
  useInput.props = () =>
139
147
  ({
140
148
  modelValue: [String, Number, Boolean, Object, Array] as PropType<
141
- string | number | boolean | object | any[] | any[] | undefined
149
+ string | number | boolean | object | any[] | null | undefined
142
150
  >,
143
151
  name: String,
144
152
  readonly: Boolean,
145
153
  required: Boolean,
146
- error: String,
154
+ error: String as PropType<string | null | undefined>,
147
155
  rules: {
148
156
  type: Array,
149
157
  default: () => []