@pocketprep/ui-kit 3.9.1 → 3.9.3

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.
@@ -127,7 +127,7 @@ const {
127
127
  minNumber?: number
128
128
  placeholder?: string
129
129
  maxlength?: string // default input field length
130
- modelValue?: string | null
130
+ modelValue?: string | number | null
131
131
  disabled?: boolean
132
132
  autoFocus?: boolean
133
133
  error?: boolean
@@ -141,7 +141,7 @@ const {
141
141
  }>()
142
142
 
143
143
  const emit = defineEmits<{
144
- 'update:modelValue': [modelVal: string]
144
+ 'update:modelValue': [modelVal: string | number]
145
145
  }>()
146
146
 
147
147
  const hover = ref(false)
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
  </template>
150
150
 
151
- <script setup lang="ts">
151
+ <script setup lang="ts" generic="T extends IItem">
152
152
  import Icon from '../Icons/Icon.vue'
153
153
  import { dark as vDark } from '../../directives'
154
154
  import { computed, nextTick, onMounted, ref, useTemplateRef, watch } from 'vue'
@@ -173,10 +173,10 @@ const {
173
173
  showTypeaheadClear = false,
174
174
  } = defineProps<{
175
175
  label?: string
176
- modelValue?: IItem | null
176
+ modelValue?: T | null
177
177
  subtext?: string
178
178
  placeholder?: string
179
- data: IItem[]
179
+ data: T[]
180
180
  disabled?: boolean
181
181
  autoFocus?: boolean
182
182
  showEmptyOption?: boolean
@@ -191,8 +191,8 @@ const {
191
191
  }>()
192
192
 
193
193
  const emit = defineEmits<{
194
- 'update:modelValue': [modelVal: IItem | null]
195
- 'linkClick': [item: IItem | null]
194
+ 'update:modelValue': [modelVal: T | null]
195
+ 'linkClick': [item: T | null]
196
196
  'openDropdown': [open: boolean]
197
197
  'close': []
198
198
  }>()
@@ -213,7 +213,7 @@ const filteredData = computed(() => {
213
213
  return data.filter(item => item.label.toLowerCase().includes(searchText.value.toLowerCase()))
214
214
  } else {
215
215
  if (showEmptyOption && modelValue) {
216
- return [{ value: null, label: emptyOptionLabel || '' }, ...data ]
216
+ return [ { value: null, label: emptyOptionLabel || '' } as T, ...data ]
217
217
  }
218
218
  return data
219
219
  }
@@ -394,7 +394,7 @@ const focusSelect = () => {
394
394
  }
395
395
  }
396
396
 
397
- const selectItem = (item: IItem) => {
397
+ const selectItem = (item: T) => {
398
398
  if (item) {
399
399
  showDropdown.value = false
400
400
  }
@@ -446,11 +446,11 @@ watch(searchText, (newVal: string) => {
446
446
  }
447
447
  })
448
448
 
449
- const emitUpdateModelValue = (item: IItem | null) => {
449
+ const emitUpdateModelValue = (item: T | null) => {
450
450
  emit('update:modelValue', item)
451
451
  }
452
452
 
453
- const emitLinkClick = (item: IItem | null) => {
453
+ const emitLinkClick = (item: T | null) => {
454
454
  emit('linkClick', item)
455
455
  }
456
456
 
@@ -1,5 +1,5 @@
1
1
  export interface IItem {
2
- value?: string | null
2
+ value?: number | string | null
3
3
  label: string
4
4
  type?: 'option' | 'link'
5
5
  subtext?: string
@@ -13,7 +13,6 @@
13
13
  </template>
14
14
 
15
15
  <script setup lang="ts">
16
- import type { TBundleIds } from './phonePerson'
17
16
  import PhonePersonBehavioralHealth from './phoneperson-behavioralhealth@2x.png'
18
17
  import PhonePersonEMT from './phoneperson-emt@2x.png'
19
18
  import PhonePersonEssentials from './phoneperson-essentials@2x.png'
@@ -26,10 +25,8 @@ import PhonePersonNursingSchool from './phoneperson-nursingschool@2x.png'
26
25
  import PhonePersonProfessional from './phoneperson-professional@2x.png'
27
26
  import PhonePersonSkilledTrades from './phoneperson-skilledtrades@2x.png'
28
27
 
29
- const {
30
- bundleId = 'mO5EIsoZ9H',
31
- } = defineProps<{
32
- bundleId?: TBundleIds
28
+ defineProps<{
29
+ bundleId: string
33
30
  }>()
34
31
 
35
32
  const urls = {
@@ -237,11 +237,11 @@
237
237
  </div>
238
238
  </template>
239
239
 
240
- <script setup lang="ts">
240
+ <script setup lang="ts" generic="R extends TTableRow, C extends ITableColumn">
241
241
  import Icon from '../Icons/Icon.vue'
242
242
  import OverflowTooltip from '../Tooltips/OverflowTooltip.vue'
243
243
  import { dark as vDark } from '../../directives'
244
- import type { ITableColumn, TTableRow, TSortDirection, ITableSortSettings } from './table'
244
+ import type { ITableColumn, TTableRow, TSortDirection, ITableSortSettings, TTableSubrow } from './table'
245
245
  import { ref, watch } from 'vue'
246
246
 
247
247
  const {
@@ -268,12 +268,12 @@ const {
268
268
  tableCellStyles = undefined,
269
269
  tableSubrowsStyles = undefined,
270
270
  } = defineProps<{
271
- columns: ITableColumn[]
272
- rows: TTableRow[]
271
+ columns: C[]
272
+ rows: R[]
273
273
  showHeader?: boolean
274
274
  name?: string
275
275
  count?: string | number
276
- grid?: Record<string, string>
276
+ grid?: Record<string, string> | null
277
277
  sortToggleOrder?: TSortDirection[]
278
278
  defaultSort?: ITableSortSettings
279
279
  isDarkMode?: boolean
@@ -308,10 +308,10 @@ const {
308
308
 
309
309
  const emit = defineEmits<{
310
310
  'sort': [sortSettings: ITableSortSettings]
311
- 'rowClicked': [row: TTableRow]
312
- 'rowEnter': [row: TTableRow]
313
- 'rowLeave': [row: TTableRow]
314
- 'cellClicked': [rowAndColumn: { row: TTableRow; column: ITableColumn }]
311
+ 'rowClicked': [row: R | TTableSubrow]
312
+ 'rowEnter': [row: R | TTableSubrow]
313
+ 'rowLeave': [row: R | TTableSubrow]
314
+ 'cellClicked': [rowAndColumn: { row: R | TTableSubrow; column: C }]
315
315
  }>()
316
316
 
317
317
  const gridStyles = ref<Record<string, string>>({})
@@ -335,7 +335,7 @@ if (grid) {
335
335
  }
336
336
  }
337
337
 
338
- const columnLabelClicked = (column: ITableColumn) => {
338
+ const columnLabelClicked = (column: C) => {
339
339
  // Do nothing if the column has disabled sort
340
340
  if (column.isSortDisabled) {
341
341
  return
@@ -371,19 +371,19 @@ const emitSort = () => {
371
371
  emit('sort', currentSort.value)
372
372
  }
373
373
 
374
- const emitRowClicked = (row: TTableRow) => {
374
+ const emitRowClicked = (row: R | TTableSubrow) => {
375
375
  emit('rowClicked', row)
376
376
  }
377
377
 
378
- const emitRowEnter = (row: TTableRow) => {
378
+ const emitRowEnter = (row: R | TTableSubrow) => {
379
379
  emit('rowEnter', row)
380
380
  }
381
381
 
382
- const emitRowLeave = (row: TTableRow) => {
382
+ const emitRowLeave = (row: R | TTableSubrow) => {
383
383
  emit('rowLeave', row)
384
384
  }
385
385
 
386
- const emitCellClicked = (row: TTableRow, column: ITableColumn) => {
386
+ const emitCellClicked = (row: R | TTableSubrow, column: C) => {
387
387
  emit('cellClicked', {
388
388
  row,
389
389
  column,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.9.1",
3
+ "version": "3.9.3",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {
@@ -1,12 +0,0 @@
1
- export type TBundleIds =
2
- 'mO5EIsoZ9H'
3
- | 'uKLwvbsbPV'
4
- | 'gAlCkoUVLl'
5
- | 'GVCNrq4ixh'
6
- | 'PusoOu7qGQ'
7
- | '1kS20KPPkH'
8
- | 'tVMt7KCrkQ'
9
- | '4dTgUX97Dk'
10
- | '9970muCFGV'
11
- | 'k9T5L3kC0U'
12
- | 'DO5jBm0OJo'