@dataloop-ai/components 0.19.274 → 0.19.275

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/moveToPublic.sh CHANGED
@@ -3,5 +3,5 @@
3
3
  mkdir -p public/icons
4
4
  mkdir -p public/icons/assets
5
5
 
6
- mv node_modules/@dataloop-ai/icons/assets public/icons
6
+ cp -r node_modules/@dataloop-ai/icons/assets public/icons
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.274",
3
+ "version": "0.19.275",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -0,0 +1,936 @@
1
+ <template>
2
+ <div :id="uuid" :style="cssVars" :class="rootContainerClasses">
3
+ <div class="row">
4
+ <div
5
+ :class="`${
6
+ isSmall ? 'col' : 'row full-width full-height'
7
+ } top`"
8
+ :style="`${isSmall ? 'flex-grow: 0; max-width: 25%;' : ''}`"
9
+ >
10
+ <div
11
+ v-if="!!title.length || !!tooltip.length"
12
+ :class="{
13
+ 'dl-text-input__title-container': true,
14
+ 'dl-text-input__title-container--s': isSmall
15
+ }"
16
+ >
17
+ <label
18
+ v-if="!!title.length"
19
+ class="dl-text-input__title"
20
+ :style="`${isSmall ? 'width: 90%' : 'width: 100%'}`"
21
+ >
22
+ <dl-ellipsis>
23
+ {{ title
24
+ }}<span v-if="required" :class="asteriskClasses">
25
+ *</span
26
+ >
27
+ {{ !required && optional ? ' (Optional)' : null }}
28
+ </dl-ellipsis>
29
+ </label>
30
+ <span v-if="!!tooltip.length">
31
+ <dl-icon
32
+ class="dl-text-input__tooltip-icon"
33
+ icon="icon-dl-info"
34
+ size="12px"
35
+ />
36
+ <dl-tooltip>
37
+ {{ tooltip }}
38
+ </dl-tooltip>
39
+ </span>
40
+ </div>
41
+ <div v-if="!!topMessage.length && !isSmall" class="break" />
42
+ <div
43
+ v-if="!!topMessage.length"
44
+ :class="{
45
+ 'dl-text-input__top-message-container': true,
46
+ 'dl-text-input__top-message-container--s': isSmall
47
+ }"
48
+ >
49
+ <dl-info-error-message
50
+ v-if="!!topMessage.length"
51
+ position="above"
52
+ :value="topMessage"
53
+ />
54
+ </div>
55
+ </div>
56
+ <div
57
+ :class="`${
58
+ isSmall ? 'col' : 'row'
59
+ } bottom-section full-width full-height`"
60
+ >
61
+ <div class="row center full-width full-height">
62
+ <div style="flex-grow: 1; height: 100%; position: relative">
63
+ <input
64
+ ref="input"
65
+ :value="modelValue"
66
+ :class="inputClasses"
67
+ :placeholder="placeholder"
68
+ :maxlength="maxLength"
69
+ :type="showPass ? 'text' : type"
70
+ :disabled="disabled"
71
+ :readonly="readonly"
72
+ @input="debouncedInput"
73
+ @focus="onFocus"
74
+ @blur="debouncedBlur"
75
+ @keyup.enter="onKeyPress"
76
+ />
77
+ <div
78
+ v-if="hasPrepend"
79
+ :class="[
80
+ ...adornmentClasses,
81
+ 'dl-text-input__adornment-container--pos-left'
82
+ ]"
83
+ >
84
+ <slot name="prepend" />
85
+ </div>
86
+ <div
87
+ v-if="hasAppend"
88
+ :class="[
89
+ ...adornmentClasses,
90
+ 'dl-text-input__adornment-container--pos-right'
91
+ ]"
92
+ >
93
+ <slot name="append" />
94
+ <span
95
+ v-if="showClearButton"
96
+ v-show="focused || mouseOverClear"
97
+ @mouseenter="mouseOverClear = true"
98
+ @mouseleave="mouseOverClear = false"
99
+ >
100
+ <dl-button
101
+ ref="input-clear-button"
102
+ icon="icon-dl-close"
103
+ size="s"
104
+ text-color="dl-color-darker"
105
+ flat
106
+ fluid
107
+ @click="onClear"
108
+ />
109
+ <dl-tooltip v-if="clearButtonTooltip">
110
+ Remove text
111
+ </dl-tooltip>
112
+ </span>
113
+ <span v-if="showShowPassButton">
114
+ <dl-button
115
+ ref="input-show-pass-button"
116
+ :icon="passShowIcon"
117
+ size="s"
118
+ text-color="dl-color-darker"
119
+ flat
120
+ fluid
121
+ @click="onPassShowClick"
122
+ />
123
+ <dl-tooltip>
124
+ {{ showPass ? 'Hide' : 'Show' }}
125
+ </dl-tooltip>
126
+ </span>
127
+ </div>
128
+ </div>
129
+ <div
130
+ v-if="hasAction"
131
+ style="
132
+ width: fit-content;
133
+ display: flex;
134
+ align-items: center;
135
+ margin-left: 10px;
136
+ "
137
+ >
138
+ <slot name="action" />
139
+ </div>
140
+ <dl-menu
141
+ v-if="showSuggestItems"
142
+ v-model="isMenuOpen"
143
+ auto-close
144
+ no-focus
145
+ :offset="[0, 3]"
146
+ fit-container
147
+ :fit-content="fitContent"
148
+ :arrow-nav-items="suggestItems"
149
+ @click="onMenuShow"
150
+ @highlightedIndex="setHighlightedIndex"
151
+ @handleSelectedItem="handleSelectedItem"
152
+ >
153
+ <dl-list
154
+ bordered
155
+ :style="{ maxWidth: suggestMenuWidth }"
156
+ >
157
+ <dl-list-item
158
+ v-for="(item, suggestIndex) in suggestItems"
159
+ :key="item"
160
+ clickable
161
+ style="font-size: 12px"
162
+ :highlighted="suggestIndex === highlightedIndex"
163
+ @click="onClick($event, item)"
164
+ >
165
+ <span
166
+ v-for="(word, index) in getSuggestWords(
167
+ item,
168
+ modelValue
169
+ )"
170
+ :key="JSON.stringify(word) + index"
171
+ :class="{
172
+ 'dl-text-input__suggestion--highlighted':
173
+ word.highlighted
174
+ }"
175
+ >
176
+ <span v-if="word.value[0] === ' '"
177
+ >&nbsp;</span
178
+ >
179
+ {{ word.value }}
180
+ <span
181
+ v-if="
182
+ word.value[
183
+ word.value.length - 1
184
+ ] === ' '
185
+ "
186
+ >&nbsp;</span
187
+ >
188
+ </span>
189
+ </dl-list-item>
190
+ </dl-list>
191
+ </dl-menu>
192
+ </div>
193
+ <div class="row bottom full-width full-height">
194
+ <div
195
+ v-if="bottomMessage"
196
+ class="row full-width dl-text-input__bottom-message-container"
197
+ style="justify-content: space-between"
198
+ >
199
+ <div>
200
+ <dl-info-error-message
201
+ v-if="
202
+ !!infoMessage.length && !error && !warning
203
+ "
204
+ position="below"
205
+ :value="infoMessage"
206
+ />
207
+ <dl-info-error-message
208
+ v-else-if="
209
+ error &&
210
+ !!errorMessage &&
211
+ !!errorMessage.length
212
+ "
213
+ position="below"
214
+ error
215
+ :value="errorMessage"
216
+ />
217
+ <dl-info-error-message
218
+ v-else-if="
219
+ warning &&
220
+ !!warningMessage &&
221
+ !!warningMessage.length &&
222
+ !error
223
+ "
224
+ position="below"
225
+ warning
226
+ :value="warningMessage"
227
+ />
228
+ </div>
229
+ <div>
230
+ <span
231
+ v-if="showCounter && maxLength && maxLength > 0"
232
+ class="dl-text-input__counter"
233
+ >
234
+ {{ characterCounter }}
235
+ </span>
236
+ </div>
237
+ </div>
238
+ </div>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </template>
243
+
244
+ <script lang="ts">
245
+ import { debounce } from 'lodash'
246
+ import { computed, defineComponent, PropType, ref } from 'vue-demi'
247
+ import { DlInfoErrorMessage, DlTooltip } from '../../shared'
248
+ import { DlListItem } from '../../basic'
249
+ import { DlMenu, DlIcon, DlList, DlEllipsis } from '../../essential'
250
+ import { DlButton } from '../../basic'
251
+ import { InputSizes, TInputSizes } from '../../../utils/input-sizes'
252
+ import { v4 } from 'uuid'
253
+ import { stateManager } from '../../../StateManager'
254
+
255
+ export default defineComponent({
256
+ name: 'DlTextInput',
257
+ components: {
258
+ DlButton,
259
+ DlIcon,
260
+ DlTooltip,
261
+ DlInfoErrorMessage,
262
+ DlMenu,
263
+ DlList,
264
+ DlListItem,
265
+ DlEllipsis
266
+ },
267
+ model: {
268
+ prop: 'modelValue',
269
+ event: 'update:model-value'
270
+ },
271
+ props: {
272
+ modelValue: {
273
+ type: [String, Number],
274
+ default: null
275
+ },
276
+ size: {
277
+ type: String as PropType<TInputSizes>,
278
+ default: InputSizes.l
279
+ },
280
+ placeholder: {
281
+ type: String,
282
+ default: ''
283
+ },
284
+ title: {
285
+ type: String,
286
+ default: ''
287
+ },
288
+ required: {
289
+ type: Boolean,
290
+ default: false
291
+ },
292
+ optional: {
293
+ type: Boolean,
294
+ default: false
295
+ },
296
+ tooltip: {
297
+ type: String,
298
+ default: ''
299
+ },
300
+ type: {
301
+ type: String,
302
+ default: 'text'
303
+ },
304
+ topMessage: {
305
+ type: String,
306
+ default: ''
307
+ },
308
+ redAsterisk: {
309
+ type: Boolean,
310
+ default: false
311
+ },
312
+ infoMessage: {
313
+ type: String,
314
+ default: ''
315
+ },
316
+ errorMessage: {
317
+ type: String,
318
+ default: ''
319
+ },
320
+ error: {
321
+ type: Boolean,
322
+ default: false
323
+ },
324
+ warningMessage: {
325
+ type: String,
326
+ default: ''
327
+ },
328
+ warning: {
329
+ type: Boolean,
330
+ default: false
331
+ },
332
+ disabled: {
333
+ type: Boolean,
334
+ default: false
335
+ },
336
+ readonly: {
337
+ type: Boolean,
338
+ default: false
339
+ },
340
+ maxLength: {
341
+ type: Number,
342
+ default: null
343
+ },
344
+ showCounter: {
345
+ type: Boolean,
346
+ default: false
347
+ },
348
+ dense: Boolean,
349
+ hideClearButton: {
350
+ type: Boolean,
351
+ default: false
352
+ },
353
+ counterReverse: {
354
+ type: Boolean,
355
+ default: false
356
+ },
357
+ autoSuggestItems: {
358
+ type: Array as PropType<string[]>,
359
+ default: (): string[] => []
360
+ },
361
+ highlightMatches: {
362
+ type: Boolean,
363
+ default: false
364
+ },
365
+ suggestMenuWidth: {
366
+ type: String,
367
+ default: 'auto'
368
+ },
369
+ clearButtonTooltip: {
370
+ type: Boolean,
371
+ default: false
372
+ },
373
+ fitContent: Boolean,
374
+ margin: {
375
+ type: String,
376
+ default: null
377
+ },
378
+ debounce: {
379
+ type: Number,
380
+ default: 100
381
+ }
382
+ },
383
+ emits: ['input', 'focus', 'blur', 'clear', 'enter', 'update:model-value'],
384
+ setup(props, { emit }) {
385
+ const mouseOverClear = ref(false)
386
+ const highlightedIndex = ref(-1)
387
+ const isMenuOpen = ref(false)
388
+ const suggestItems = computed<string[]>(() => {
389
+ return props.autoSuggestItems.filter((item) =>
390
+ item.includes(`${props.modelValue}`)
391
+ )
392
+ })
393
+
394
+ const setHighlightedIndex = (value: any) => {
395
+ highlightedIndex.value = value
396
+ }
397
+ const handleSelectedItem = (value: any) => {
398
+ onAutoSuggestClick(null, value)
399
+ }
400
+ const inputRef = ref<HTMLInputElement>(null)
401
+ const onAutoSuggestClick = (
402
+ e: Event,
403
+ item: string | HTMLInputElement
404
+ ): void => {
405
+ emit('input', item, e)
406
+ emit('update:model-value', item)
407
+ inputRef.value = item as HTMLInputElement
408
+ }
409
+
410
+ return {
411
+ suggestItems,
412
+ highlightedIndex,
413
+ onAutoSuggestClick,
414
+ isMenuOpen,
415
+ setHighlightedIndex,
416
+ handleSelectedItem,
417
+ mouseOverClear
418
+ }
419
+ },
420
+ data() {
421
+ return {
422
+ uuid: `dl-text-input-${v4()}`,
423
+ showPass: false,
424
+ focused: false
425
+ }
426
+ },
427
+ computed: {
428
+ bottomMessage(): boolean {
429
+ return (
430
+ !!this.infoMessage?.length ||
431
+ !!this.errorMessage?.length ||
432
+ !!this.warningMessage?.length ||
433
+ this.showCounter
434
+ )
435
+ },
436
+ rootContainerClasses(): string[] {
437
+ const classes = ['dl-text-input']
438
+ if (this.isSmall) {
439
+ classes.push('dl-text-input--s')
440
+ }
441
+ if (this.dense) {
442
+ classes.push('dl-text-input--dense')
443
+ }
444
+ return classes
445
+ },
446
+ getBorderColor(): string {
447
+ if (this.error) {
448
+ return `var(--dl-color-negative)`
449
+ } else if (this.warning) {
450
+ return `var(--dl-color-warning)`
451
+ } else {
452
+ return `var(--dl-color-secondary)`
453
+ }
454
+ },
455
+ cssVars(): Record<string, any> {
456
+ let inputMargin = this.margin
457
+
458
+ if (!this.margin && this.isSmall) {
459
+ inputMargin = '0px 20px 0px 0px'
460
+ }
461
+ return {
462
+ '--dl-input-margin': inputMargin,
463
+ '--dl-input-border-color-hover': this.getBorderColor
464
+ }
465
+ },
466
+ inputClasses(): string[] {
467
+ const classes = [
468
+ 'dl-text-input__input',
469
+ `dl-text-input__input--${this.size}`
470
+ ]
471
+
472
+ if (this.hasPrepend) {
473
+ classes.push('dl-text-input__input--prepend')
474
+ }
475
+ if (this.hasAppend) {
476
+ classes.push('dl-text-input__input--append')
477
+ }
478
+ if (this.hasPrepend && this.hasAppend) {
479
+ classes.push('dl-text-input__input--both-adornments')
480
+ }
481
+ if (this.error) {
482
+ classes.push('dl-text-input__input--error')
483
+ } else if (this.warning) {
484
+ classes.push('dl-text-input__input--warning')
485
+ }
486
+
487
+ return classes
488
+ },
489
+ asteriskClasses(): string[] {
490
+ const classes = ['dl-text-input__asterisk']
491
+
492
+ if (this.redAsterisk) {
493
+ classes.push('dl-text-input__asterisk--red')
494
+ }
495
+
496
+ return classes
497
+ },
498
+ adornmentClasses(): string[] {
499
+ return [
500
+ 'dl-text-input__adornment-container',
501
+ `dl-text-input__adornment-container--${this.size}`
502
+ ]
503
+ },
504
+ isSmall(): boolean {
505
+ return (
506
+ this.size === (InputSizes.s as TInputSizes) ||
507
+ this.size === (InputSizes.small as TInputSizes)
508
+ )
509
+ },
510
+ hasPrepend(): boolean {
511
+ return !!this.$slots.prepend
512
+ },
513
+ hasAppend(): boolean {
514
+ return (
515
+ (!!this.$slots.append ||
516
+ !this.hideClearButton ||
517
+ this.type === 'password') &&
518
+ !this.isSmall
519
+ )
520
+ },
521
+ hasAction(): boolean {
522
+ return !!this.$slots.action && !this.isSmall
523
+ },
524
+ passShowIcon(): string {
525
+ return this.showPass ? 'icon-dl-hide' : 'icon-dl-show'
526
+ },
527
+ showClearButton(): boolean {
528
+ return (
529
+ !this.hideClearButton &&
530
+ this.type !== 'password' &&
531
+ !this.disabled &&
532
+ !this.readonly &&
533
+ !!this.modelValue
534
+ )
535
+ },
536
+ showShowPassButton(): boolean {
537
+ return !this.$slots.append && this.type === 'password'
538
+ },
539
+ showSuggestItems(): boolean {
540
+ return !!this.suggestItems.length && !!this.modelValue
541
+ },
542
+ debouncedBlur(): any {
543
+ if (stateManager.disableDebounce) {
544
+ return this.onBlur.bind(this)
545
+ }
546
+ const debounced = debounce(this.onBlur.bind(this), 50)
547
+ return debounced
548
+ },
549
+ inputLength(): number {
550
+ return `${this.modelValue}`.length
551
+ },
552
+ characterCounter(): string {
553
+ if (!this.maxLength) {
554
+ return ''
555
+ }
556
+
557
+ const chars = this.counterReverse
558
+ ? this.maxLength - this.inputLength
559
+ : this.inputLength
560
+
561
+ return `${chars}/${this.maxLength}`
562
+ },
563
+ wrapperClasses(): string {
564
+ let classes = 'flex items-center'
565
+
566
+ if (this.isSmall) {
567
+ classes += ' no-wrap'
568
+ }
569
+
570
+ return classes
571
+ },
572
+ debouncedInput(): any {
573
+ if (stateManager.disableDebounce) {
574
+ return this.onChange.bind(this)
575
+ }
576
+ const debounced = debounce(this.onChange.bind(this), this.debounce)
577
+ return debounced
578
+ }
579
+ },
580
+ methods: {
581
+ onClick(e: Event, item: string) {
582
+ this.onAutoSuggestClick(e, item)
583
+ },
584
+ onChange(e: any): void {
585
+ this.isMenuOpen = true
586
+ this.$emit('input', e.target.value, e)
587
+ this.$emit('update:model-value', e.target.value)
588
+ },
589
+ focus(): void {
590
+ const inputRef = this.$refs.input as HTMLInputElement
591
+ inputRef.focus()
592
+ },
593
+ onFocus(e: InputEvent): void {
594
+ this.focused = true
595
+ this.$emit('focus', e)
596
+ },
597
+ blur(): void {
598
+ const inputRef = this.$refs.input as HTMLInputElement
599
+ inputRef.blur()
600
+ },
601
+ onBlur(e: InputEvent): void {
602
+ this.focused = false
603
+ this.$emit('blur', e)
604
+ },
605
+ onKeyPress(e: any): void {
606
+ this.$emit('enter', e.target.value, e)
607
+ },
608
+ onClear(e: any): void {
609
+ this.$emit('clear', this.modelValue)
610
+ this.$emit('input', '', e)
611
+ this.$emit('update:model-value', '')
612
+
613
+ const inputRef = this.$refs.input as HTMLInputElement
614
+ inputRef.value = ''
615
+ inputRef.focus()
616
+ },
617
+ onPassShowClick(): void {
618
+ this.showPass = !this.showPass
619
+ },
620
+ onMenuShow(): void {
621
+ this.focus()
622
+ },
623
+ getSuggestWords(
624
+ item: string,
625
+ keyword: string | number
626
+ ): { value: string; highlighted: boolean }[] {
627
+ const words: { value: string; highlighted: boolean }[] = []
628
+ const key = `${keyword}`
629
+
630
+ if (!key.length || !this.highlightMatches) {
631
+ return [
632
+ {
633
+ value: item,
634
+ highlighted: false
635
+ }
636
+ ]
637
+ }
638
+
639
+ const regex = new RegExp(key, 'g')
640
+
641
+ const matches = [...item.matchAll(regex)]
642
+
643
+ if (!matches.length) {
644
+ return [
645
+ {
646
+ value: item,
647
+ highlighted: false
648
+ }
649
+ ]
650
+ }
651
+
652
+ if (matches[0].index !== 0) {
653
+ words.push({
654
+ value: item.split('').slice(0, matches[0].index).join(''),
655
+ highlighted: false
656
+ })
657
+ }
658
+
659
+ matches.forEach(
660
+ (match: RegExpMatchArray, iterationIndex: number) => {
661
+ const matchIndex = match.index ?? 0
662
+ const wordEndIndex = matchIndex + key.length
663
+
664
+ words.push({
665
+ value: item
666
+ .split('')
667
+ .slice(matchIndex, key.length + matchIndex)
668
+ .join(''),
669
+ highlighted: true
670
+ })
671
+
672
+ if (iterationIndex + 1 === matches.length) {
673
+ words.push({
674
+ value: item
675
+ .split('')
676
+ .slice(wordEndIndex, item.length)
677
+ .join(''),
678
+ highlighted: false
679
+ })
680
+ }
681
+
682
+ if (iterationIndex + 1 < matches.length) {
683
+ words.push({
684
+ value: item
685
+ .split('')
686
+ .slice(
687
+ wordEndIndex,
688
+ matches[iterationIndex + 1].index
689
+ )
690
+ .join(''),
691
+ highlighted: false
692
+ })
693
+ }
694
+ }
695
+ )
696
+
697
+ return words
698
+ }
699
+ }
700
+ })
701
+ </script>
702
+
703
+ <style scoped lang="scss">
704
+ .dl-text-input {
705
+ margin: var(--dl-input-margin);
706
+
707
+ /* Chrome, Safari, Edge, Opera */
708
+ input::-webkit-outer-spin-button,
709
+ input::-webkit-inner-spin-button {
710
+ -webkit-appearance: none;
711
+ margin: 0;
712
+ }
713
+
714
+ /* Firefox */
715
+ input[type='number'] {
716
+ -moz-appearance: textfield;
717
+ }
718
+
719
+ &--dense {
720
+ padding: 0;
721
+ }
722
+
723
+ &__title-container {
724
+ margin-bottom: 6px;
725
+ display: flex;
726
+ align-items: center;
727
+
728
+ &--small,
729
+ &--s {
730
+ margin-bottom: 0;
731
+ margin-right: 4px;
732
+ }
733
+ }
734
+
735
+ &__title {
736
+ color: var(--dl-color-medium);
737
+ font-size: var(--dl-font-size-body);
738
+ text-align: left;
739
+ margin-right: 5px;
740
+ white-space: nowrap;
741
+ }
742
+
743
+ &__asterisk {
744
+ color: var(--dl-color-medium);
745
+ font-size: var(--dl-font-size-body);
746
+ user-select: none;
747
+
748
+ &--red {
749
+ color: var(--dl-color-negative);
750
+ }
751
+ }
752
+
753
+ &__tooltip-icon {
754
+ color: var(--dl-color-medium);
755
+ }
756
+
757
+ &__top-message-container {
758
+ display: flex;
759
+ margin-bottom: 10px;
760
+ text-align: start;
761
+
762
+ &--s {
763
+ padding: 0px 10px;
764
+ }
765
+ &--small {
766
+ padding: 0px 10px;
767
+ }
768
+ }
769
+
770
+ &__input {
771
+ border: 1px solid var(--dl-color-separator);
772
+ border-radius: 2px;
773
+ color: var(--dl-color-darker);
774
+ width: calc(100% - 20px);
775
+ box-sizing: content-box;
776
+ height: 12px;
777
+ padding: 10px;
778
+ outline: none;
779
+ background: none;
780
+ transition: border 0.3s;
781
+ font-size: var(--dl-font-size-body);
782
+ position: relative;
783
+
784
+ &--prepend {
785
+ padding-left: 28px;
786
+ width: calc(100% - 10px - 28px);
787
+ }
788
+
789
+ &--append {
790
+ padding-right: 28px;
791
+ width: calc(100% - 10px - 28px);
792
+ }
793
+
794
+ &--both-adornments {
795
+ width: calc(100% - 28px - 28px);
796
+ }
797
+
798
+ &--l {
799
+ height: 16px;
800
+ line-height: 16px;
801
+ }
802
+
803
+ &--large {
804
+ height: 16px;
805
+ line-height: 16px;
806
+ }
807
+
808
+ &--m {
809
+ padding-top: 7px;
810
+ padding-bottom: 7px;
811
+ }
812
+ &--medium {
813
+ padding-top: 7px;
814
+ padding-bottom: 7px;
815
+ }
816
+
817
+ &--s {
818
+ padding-top: 4px;
819
+ padding-bottom: 3px;
820
+ padding-right: 5px;
821
+ }
822
+ &--small {
823
+ padding-top: 3px;
824
+ padding-bottom: 3px;
825
+ padding-left: 5px;
826
+ padding-right: 5px;
827
+ }
828
+
829
+ &--error {
830
+ border-color: var(--dl-color-negative);
831
+ &:hover {
832
+ }
833
+ }
834
+
835
+ &--warning {
836
+ border-color: var(--dl-input-border-color-hover);
837
+ &:hover {
838
+ }
839
+ }
840
+
841
+ &::placeholder {
842
+ color: var(--dl-color-lighter);
843
+ opacity: 1;
844
+ }
845
+
846
+ &:hover {
847
+ border-color: var(--dl-input-border-color-hover);
848
+ }
849
+
850
+ &:focus {
851
+ border-color: var(--dl-input-border-color-hover);
852
+ }
853
+
854
+ &:disabled {
855
+ border-color: var(--dl-color-separator);
856
+ color: var(--dl-color-disabled);
857
+ cursor: not-allowed;
858
+ }
859
+ &:read-only {
860
+ border-color: var(--dl-color-separator);
861
+ cursor: text;
862
+ &:hover {
863
+ border-color: var(--dl-color-separator) !important;
864
+ }
865
+ }
866
+ }
867
+
868
+ &__adornment-container {
869
+ display: flex;
870
+ justify-content: center;
871
+ align-items: center;
872
+ position: absolute;
873
+ width: 28px;
874
+
875
+ &--l {
876
+ height: 38px;
877
+ }
878
+
879
+ &--large {
880
+ height: 38px;
881
+ }
882
+
883
+ &--m {
884
+ height: 28px;
885
+ }
886
+
887
+ &--medium {
888
+ height: 28px;
889
+ }
890
+
891
+ &--s {
892
+ margin-top: 1px;
893
+ height: 20px;
894
+ }
895
+
896
+ &--small {
897
+ height: 20px;
898
+ }
899
+
900
+ &--pos-left {
901
+ top: 0;
902
+ left: 0;
903
+ }
904
+
905
+ &--pos-right {
906
+ top: 0;
907
+ right: 0;
908
+ }
909
+ &--pos-right-out {
910
+ top: 0;
911
+ right: -30px;
912
+ }
913
+ }
914
+
915
+ &__bottom-message-container {
916
+ display: flex;
917
+ justify-content: space-between;
918
+ text-align: left;
919
+ padding-top: 3px;
920
+ }
921
+
922
+ &__counter {
923
+ margin-left: 10px;
924
+ font-size: var(--dl-font-size-body);
925
+ color: var(--dl-color-darker);
926
+ }
927
+
928
+ &__suggestion {
929
+ &--highlighted {
930
+ background-color: var(--dl-color-warning);
931
+ border-radius: 2px;
932
+ color: var(--dl-color-text-darker-buttons);
933
+ }
934
+ }
935
+ }
936
+ </style>
@@ -1,2 +1,3 @@
1
1
  import DlInput from './DlInput.vue'
2
- export { DlInput }
2
+ import DlTextInput from './DlTextInput.vue'
3
+ export { DlInput, DlTextInput }
@@ -8,7 +8,12 @@
8
8
  :end-icon="endIcon(step)"
9
9
  :start-icon="
10
10
  step.icon
11
- ? { icon: step.icon, color: 'secondary' }
11
+ ? {
12
+ icon: step.icon,
13
+ color: step.active
14
+ ? 'secondary'
15
+ : 'dl-color-lighter'
16
+ }
12
17
  : undefined
13
18
  "
14
19
  :clickable="!disabled"
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <div>
3
+ <dl-input
4
+ v-model="textInputValue"
5
+ style="width: 920px"
6
+ placeholder="Select option"
7
+ size="l"
8
+ margin="20px"
9
+ title="Input Title"
10
+ required
11
+ tooltip="Quis fugiat et non eu proident sit et amet."
12
+ top-message="Pariatur consequat non sit aliqua labore ad reprehenderit deserunt ullamco incididunt non irure laborum deserunt."
13
+ info-message="Ipsum amet quis velit amet. Anim consectetur nostrud sunt eu non non consequat sint eu amet."
14
+ :auto-suggest-items="[
15
+ 'foo',
16
+ 'bar',
17
+ 'foobar',
18
+ 'barfoo',
19
+ 'foo bar foobarv'
20
+ ]"
21
+ show-counter
22
+ :max-length="20"
23
+ />
24
+ <dl-input
25
+ v-model="saveInputValue"
26
+ style="width: 220px"
27
+ placeholder="Input with icon"
28
+ size="l"
29
+ has-append
30
+ >
31
+ <template #append>
32
+ <dl-icon icon="icon-dl-save" size="12px" />
33
+ </template>
34
+ </dl-input>
35
+ <dl-input
36
+ v-model="passFieldValue"
37
+ title="Password"
38
+ style="width: 220px"
39
+ placeholder="Select option"
40
+ size="m"
41
+ type="password"
42
+ error
43
+ error-message="The password entered is incorrect."
44
+ info-message="This won't show, error is true"
45
+ />
46
+ <dl-input
47
+ v-model="warningFieldValue"
48
+ title="Warning Example"
49
+ style="width: 220px"
50
+ placeholder="Select option"
51
+ size="m"
52
+ warning
53
+ warning-message="Something isn't right."
54
+ info-message="This won't show, error is true"
55
+ optional
56
+ />
57
+
58
+ <p>size S with long text</p>
59
+ <dl-input
60
+ v-model="warningFieldValue"
61
+ title="Warning Example"
62
+ style="width: 220px"
63
+ placeholder="Select option"
64
+ size="s"
65
+ warning
66
+ warning-message="Something isn't right."
67
+ info-message="This won't show, error is true"
68
+ optional
69
+ />
70
+ <dl-input
71
+ v-model="errorFieldValue"
72
+ title="Error Example"
73
+ style="width: 220px"
74
+ placeholder="Select option"
75
+ size="m"
76
+ error
77
+ error-message="Error message is the strongest."
78
+ warning
79
+ warning-message="This won't show, error is true"
80
+ info-message="This won't show, error is true"
81
+ />
82
+ <dl-input
83
+ style="width: 220px"
84
+ placeholder="Select option"
85
+ title="Min"
86
+ required
87
+ size="s"
88
+ error
89
+ error-message="Error message is the strongest."
90
+ />
91
+ <dl-input
92
+ style="width: 440px"
93
+ placeholder="Select option"
94
+ title="Min"
95
+ size="s"
96
+ error
97
+ error-message="Error message is the strongest."
98
+ />
99
+ <p>input in a row with button</p>
100
+ <div class="row" style="align-items: center">
101
+ <dl-input
102
+ class="input-parts"
103
+ style="width: 440px"
104
+ placeholder="Select option"
105
+ title="Min"
106
+ dense
107
+ size="s"
108
+ />
109
+ <dl-button dense flat icon="icon-dl-add" size="m" />
110
+ </div>
111
+ <dl-input
112
+ title="Readonly"
113
+ style="width: 220px"
114
+ placeholder="Readonly state"
115
+ size="m"
116
+ readonly
117
+ />
118
+
119
+ <p>input in a limited size and action slot size m</p>
120
+ <div style="align-items: center; width: 250px; overflow: hidden">
121
+ <dl-input class="input-parts" placeholder="Select option">
122
+ <template #action>
123
+ <dl-button dense flat icon="icon-dl-add" size="m" />
124
+ </template>
125
+ </dl-input>
126
+ </div>
127
+
128
+ <p>input with tooltip and no title</p>
129
+ <div>
130
+ <dl-input
131
+ class="input-parts"
132
+ placeholder="Select option"
133
+ tooltip="test me tooltip"
134
+ >
135
+ <template #action>
136
+ <dl-button dense flat icon="icon-dl-add" size="m" />
137
+ </template>
138
+ </dl-input>
139
+ </div>
140
+
141
+ <p>input with tooltip and no title size small</p>
142
+ <div>
143
+ <dl-input
144
+ class="input-parts"
145
+ placeholder="Select option"
146
+ tooltip="test me tooltip"
147
+ size="small"
148
+ >
149
+ <template #action>
150
+ <dl-button dense flat icon="icon-dl-add" size="m" />
151
+ </template>
152
+ </dl-input>
153
+ </div>
154
+ </div>
155
+ </template>
156
+ <script lang="ts">
157
+ import { defineComponent, ref } from 'vue-demi'
158
+ import { DlInput, DlIcon, DlButton } from '../components'
159
+ export default defineComponent({
160
+ name: 'DlInputDemo',
161
+ components: {
162
+ DlInput,
163
+ DlIcon,
164
+ DlButton
165
+ },
166
+ setup() {
167
+ const textInputValue = ref<string>('')
168
+ const passFieldValue = ref<string>('')
169
+ const warningFieldValue = ref<string>('')
170
+ const errorFieldValue = ref<string>('')
171
+ const saveInputValue = ref<string>('')
172
+
173
+ return {
174
+ textInputValue,
175
+ passFieldValue,
176
+ warningFieldValue,
177
+ errorFieldValue,
178
+ saveInputValue
179
+ }
180
+ }
181
+ })
182
+ </script>
183
+ <style></style>
@@ -70,6 +70,7 @@ import { DlCodeEditorDemo } from './DlCodeEditor'
70
70
  import DlLabelPickerDemo from './DlLabelPickerDemo.vue'
71
71
  import DlInfiniteScrollDemo from './DlInfiniteScrollDemo.vue'
72
72
  import DlMarkdownDemo from './DlMarkdownDemo.vue'
73
+ import DlTextInputDemo from './DlTextInputDemo.vue'
73
74
 
74
75
  export default {
75
76
  AvatarDemo,
@@ -140,5 +141,6 @@ export default {
140
141
  DlLayoutDemo,
141
142
  DlLabelPickerDemo,
142
143
  DlInfiniteScrollDemo,
143
- DlMarkdownDemo
144
+ DlMarkdownDemo,
145
+ DlTextInputDemo
144
146
  }