@dataloop-ai/components 0.20.149 → 0.20.151

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.20.149",
3
+ "version": "0.20.151",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -23,7 +23,7 @@
23
23
  "check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
24
24
  },
25
25
  "dependencies": {
26
- "@dataloop-ai/icons": "^3.1.27",
26
+ "@dataloop-ai/icons": "^3.1.29",
27
27
  "@types/flat": "^5.0.2",
28
28
  "@types/lodash": "^4.14.184",
29
29
  "@types/sortablejs": "^1.15.7",
@@ -114,14 +114,19 @@
114
114
  @click="onClick"
115
115
  >
116
116
  <div class="dl-button-dropdown--simple__title">
117
- <span
118
- :class="{
119
- 'dl-button-no-wrap': noWrap
120
- }"
121
- style="margin-right: 6px"
122
- >
123
- {{ label }}
124
- </span>
117
+ <template v-if="hasLabelSlot">
118
+ <slot name="label" />
119
+ </template>
120
+ <template v-else>
121
+ <span
122
+ :class="{
123
+ 'dl-button-no-wrap': noWrap
124
+ }"
125
+ style="margin-right: 6px"
126
+ >
127
+ {{ label }}
128
+ </span>
129
+ </template>
125
130
  <dl-icon
126
131
  :class="iconClass"
127
132
  :icon="dropdownIcon"
@@ -278,7 +283,7 @@ export default defineComponent({
278
283
  ...arrowNavigationEvents
279
284
  ],
280
285
 
281
- setup(props, { emit }) {
286
+ setup(props, { emit, slots }) {
282
287
  const vm = getCurrentInstance()
283
288
  const proxy = vm!.proxy!
284
289
  const { textColor } = toRefs(props)
@@ -286,6 +291,9 @@ export default defineComponent({
286
291
  const showing = ref<boolean>(!!props.modelValue) as Ref<boolean>
287
292
  const menuRef = ref(null)
288
293
 
294
+ const hasLabelSlot = computed(() => {
295
+ return !!slots.label
296
+ })
289
297
  const attributes = computed(() => {
290
298
  const acc: Record<string, string> = {
291
299
  'aria-expanded': showing.value === true ? 'true' : 'false',
@@ -489,7 +497,8 @@ export default defineComponent({
489
497
  cssVars,
490
498
  getIconColor,
491
499
  computedTextColor,
492
- separatorColor
500
+ separatorColor,
501
+ hasLabelSlot
493
502
  }
494
503
  }
495
504
  })
@@ -312,6 +312,33 @@
312
312
  </dl-list>
313
313
  </dl-dropdown-button>
314
314
  </div>
315
+
316
+ <div class="grid grid-cols-3" style="column-gap: 10px">
317
+ <dl-dropdown-button
318
+ auto-close
319
+ :model-value="showing"
320
+ main-button-style="width: 150px;"
321
+ @show="onOpen"
322
+ >
323
+ <template #label>
324
+ <div class="flex row" style="gap: 5px">
325
+ <span>{{ slotLabel }}</span>
326
+ <dl-icon icon="icon-dl-info" size="s" />
327
+ </div>
328
+ </template>
329
+ <dl-list>
330
+ <dl-list-item clickable>
331
+ <dl-item-section> Photos </dl-item-section>
332
+ </dl-list-item>
333
+ <dl-list-item clickable>
334
+ <dl-item-section> Videos </dl-item-section>
335
+ </dl-list-item>
336
+ <dl-list-item clickable>
337
+ <dl-item-section> Articles </dl-item-section>
338
+ </dl-list-item>
339
+ </dl-list>
340
+ </dl-dropdown-button>
341
+ </div>
315
342
  </div>
316
343
 
317
344
  <div style="margin-top: 20px; display: flex; flex-direction: column">
@@ -346,7 +373,8 @@ import {
346
373
  DlItemSection,
347
374
  DlList,
348
375
  DlDropdownButton,
349
- DlEllipsis
376
+ DlEllipsis,
377
+ DlIcon
350
378
  } from '../components'
351
379
 
352
380
  export default defineComponent({
@@ -356,7 +384,8 @@ export default defineComponent({
356
384
  DlItemSection,
357
385
  DlList,
358
386
  DlDropdownButton,
359
- DlEllipsis
387
+ DlEllipsis,
388
+ DlIcon
360
389
  },
361
390
  setup() {
362
391
  const highlightedIndex = ref(-1)
@@ -365,6 +394,7 @@ export default defineComponent({
365
394
  const arrowNavigationLabel = ref('Arrow Navigation Label')
366
395
  const outlinedLabel = ref('Outlined Label')
367
396
  const containedLabel = ref('Contained Label')
397
+ const slotLabel = ref('Slot Label')
368
398
 
369
399
  const listItems = ref([
370
400
  'New tab',
@@ -415,7 +445,8 @@ export default defineComponent({
415
445
  highlightedIndex,
416
446
  arrowNavigationLabel,
417
447
  outlinedLabel,
418
- containedLabel
448
+ containedLabel,
449
+ slotLabel
419
450
  }
420
451
  }
421
452
  })
@@ -1,4 +1,4 @@
1
- import Tokenizr from "tokenizr"
1
+ import Tokenizr from 'tokenizr/src/tokenizr.js'
2
2
 
3
3
  export enum TokenType {
4
4
  NUMBER = 'number',
@@ -18,35 +18,44 @@ enum Tags {
18
18
  HAD_VALUE = 'had-value'
19
19
  }
20
20
 
21
- let tokenizer = new Tokenizr()
21
+ const tokenizer = new Tokenizr()
22
22
 
23
23
  tokenizer.rule(/[+-]?[0-9\.]+/, (ctx, match) => {
24
24
  ctx.accept(TokenType.NUMBER, parseFloat(match[0])).tag(Tags.HAD_VALUE)
25
25
  })
26
26
 
27
- tokenizer.rule(/\((\d{2}\/\d{2}\/\d{4}[\)']?\s?|\s?DD\/MM\/YYYY)\s?(\d{2}:\d{2}:\d{2}|\s?HH:mm:ss)?\)/, (ctx, match) => {
28
- ctx.accept(TokenType.DATETIME, parseFloat(match[0])).tag(Tags.HAD_VALUE)
29
- })
30
-
27
+ tokenizer.rule(
28
+ /\((\d{2}\/\d{2}\/\d{4}[\)']?\s?|\s?DD\/MM\/YYYY)\s?(\d{2}:\d{2}:\d{2}|\s?HH:mm:ss)?\)/,
29
+ (ctx, match) => {
30
+ ctx.accept(TokenType.DATETIME, parseFloat(match[0])).tag(Tags.HAD_VALUE)
31
+ }
32
+ )
31
33
  ;[
32
- /<=?/, />=?/, /!=?/, /=/,
34
+ /<=?/,
35
+ />=?/,
36
+ /!=?/,
37
+ /=/,
33
38
  /in?(?![^\s'"])/i,
34
39
  /n(o(t(-(in?)?)?)?)?(?![^\s'"])/i,
35
40
  /e(x(i(s(ts?)?)?)?)?(?!\S)/i,
36
41
  /d(o(e(s(n(t(-(e(x(i(st?)?)?)?)?)?)?)?)?)?)?(?!\S)/i
37
- ].forEach(re => tokenizer.rule(re, (ctx, match) => {
38
- if (!ctx.tagged(Tags.HAD_FIELD) && /^[a-z]/i.test(match[0])) {
39
- ctx.accept(TokenType.FIELD).tag(Tags.HAD_FIELD)
40
- } else {
41
- ctx.accept(TokenType.OPERATOR, match[0].toUpperCase())
42
- }
43
- }))
42
+ ].forEach((re) =>
43
+ tokenizer.rule(re, (ctx, match) => {
44
+ if (!ctx.tagged(Tags.HAD_FIELD) && /^[a-z]/i.test(match[0])) {
45
+ ctx.accept(TokenType.FIELD).tag(Tags.HAD_FIELD)
46
+ } else {
47
+ ctx.accept(TokenType.OPERATOR, match[0].toUpperCase())
48
+ }
49
+ })
50
+ )
44
51
 
45
52
  tokenizer.rule(/[a-z][a-z\.\d\-_]*/i, (ctx, match) => {
46
53
  const upper = match[0].toUpperCase()
47
54
  if (ctx.tagged(Tags.HAD_VALUE)) {
48
55
  // we just had a value - it would be followed by AND or OR
49
- ctx.untag(Tags.HAD_FIELD).untag(Tags.HAD_VALUE).accept(TokenType.LOGICAL, upper)
56
+ ctx.untag(Tags.HAD_FIELD)
57
+ .untag(Tags.HAD_VALUE)
58
+ .accept(TokenType.LOGICAL, upper)
50
59
  } else if (ctx.tagged(Tags.HAD_FIELD)) {
51
60
  // we had a field but no value yet - this must be either a boolean or an unquoted string
52
61
  if (['TRUE', 'FALSE'].includes(upper)) {
@@ -65,16 +74,22 @@ tokenizer.rule(/,/, (ctx) => {
65
74
  })
66
75
 
67
76
  tokenizer.rule(/(?<!\\)"(.*?)(?<!\\)"/, (ctx, match) => {
68
- ctx.accept(TokenType.STRING, match[1].replace(/\\"/g, '"')).tag(Tags.HAD_VALUE)
77
+ ctx.accept(TokenType.STRING, match[1].replace(/\\"/g, '"')).tag(
78
+ Tags.HAD_VALUE
79
+ )
69
80
  })
70
81
 
71
82
  tokenizer.rule(/(?<!\\)'(.*?)(?<!\\)'/, (ctx, match) => {
72
- ctx.accept(TokenType.STRING, match[1].replace(/\\'/g, "'")).tag(Tags.HAD_VALUE)
83
+ ctx.accept(TokenType.STRING, match[1].replace(/\\'/g, "'")).tag(
84
+ Tags.HAD_VALUE
85
+ )
73
86
  })
74
87
 
75
88
  tokenizer.rule(/(?<!\\)['"](.*)/, (ctx, match) => {
76
89
  // partial string
77
- ctx.accept(TokenType.PARTIAL_VALUE, match[1].replace(/\\'/g, "'")).tag(Tags.HAD_VALUE)
90
+ ctx.accept(TokenType.PARTIAL_VALUE, match[1].replace(/\\'/g, "'")).tag(
91
+ Tags.HAD_VALUE
92
+ )
78
93
  })
79
94
 
80
95
  tokenizer.rule(/\s+/, (ctx) => {
@@ -94,16 +109,16 @@ export function tokenize(input: string) {
94
109
 
95
110
  export function splitByQuotes(input: string, ignore?: string) {
96
111
  const parts = tokenize(input)
97
- .filter(token => token.type !== 'whitespace')
98
- .map(token => token.text)
112
+ .filter((token) => token.type !== 'whitespace')
113
+ .map((token) => token.text)
99
114
  .map((text, index, array) => {
100
- if(array[index + 1] === ',') {
115
+ if (array[index + 1] === ',') {
101
116
  return text + ','
102
117
  } else {
103
118
  return text === ',' ? '' : text
104
119
  }
105
120
  })
106
- .filter(text => text !== '')
121
+ .filter((text) => text !== '')
107
122
 
108
123
  if (/\s$/.test(input)) {
109
124
  parts.push('')