@explorer-1/vue 0.2.8 → 0.2.9

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 (78) hide show
  1. package/components.d.ts +6 -1
  2. package/dist/explorer-1-vue.js +6871 -6420
  3. package/dist/explorer-1-vue.umd.cjs +13 -13
  4. package/dist/src/components/{BaseTag/BaseTag.stories.d.ts → BasePill/BasePill.stories.d.ts} +2 -2
  5. package/dist/src/components/{BaseTag/BaseTag.vue.d.ts → BasePill/BasePill.vue.d.ts} +7 -3
  6. package/dist/src/components/BlockLinkCard/BlockLinkCard.stories.d.ts +89 -15
  7. package/dist/src/components/BlockLinkCard/BlockLinkCard.vue.d.ts +66 -7
  8. package/dist/src/components/BlockLinkCarousel/BlockLinkCarousel.stories.d.ts +70 -2
  9. package/dist/src/components/BlockLinkTile/BlockLinkTile.vue.d.ts +4 -4
  10. package/dist/src/components/CalendarButton/CalendarButton.vue.d.ts +2 -2
  11. package/dist/src/components/CalendarChip/CalendarChip.vue.d.ts +36 -0
  12. package/dist/src/components/EventCard/EventCard.vue.d.ts +9 -0
  13. package/dist/src/components/EventDetailHero/EventDetailHero.vue.d.ts +27 -9
  14. package/dist/src/components/HeroListingIndex/HeroListingIndex.stories.d.ts +1 -0
  15. package/dist/src/components/HeroListingIndex/HeroListingIndex.vue.d.ts +6 -4
  16. package/dist/src/components/HeroMedium/HeroMedium.vue.d.ts +28 -2
  17. package/dist/src/components/Icons/IconProfile.vue.d.ts +2 -0
  18. package/dist/src/components/Icons/IconSubject.vue.d.ts +2 -0
  19. package/dist/src/components/Icons/Icons.stories.d.ts +17 -0
  20. package/dist/src/components/MetadataEduResource/MetadataEduResource.stories.d.ts +55 -0
  21. package/dist/src/components/MetadataEduResource/MetadataEduResource.vue.d.ts +38 -0
  22. package/dist/src/components/MetadataEvent/MetadataEvent.stories.d.ts +29 -0
  23. package/dist/src/components/MetadataEvent/MetadataEvent.vue.d.ts +38 -0
  24. package/dist/src/components/NavDesktopEdu/NavDesktopEdu.stories.d.ts +1 -0
  25. package/dist/src/components/SearchResultCard/SearchResultCard.stories.d.ts +23 -4
  26. package/dist/src/components/SearchResultCard/SearchResultCard.vue.d.ts +66 -1
  27. package/dist/src/components/SearchResultGridItem/SearchResultGridItem.stories.d.ts +7 -0
  28. package/dist/src/components/SearchResultGridItem/SearchResultGridItem.vue.d.ts +65 -11
  29. package/dist/src/components/SearchResultsList/SearchResultsList.stories.d.ts +404 -0
  30. package/dist/src/components/TopicDetailMoreItem/TopicDetailMoreItem.vue.d.ts +8 -4
  31. package/dist/src/constants.d.ts +4 -0
  32. package/dist/src/interfaces.d.ts +38 -3
  33. package/dist/src/templates/PageContent/PageContent.stories.d.ts +1 -0
  34. package/dist/src/templates/PageEventDetail/PageEventDetail.stories.d.ts +2 -13
  35. package/dist/src/templates/PageEventDetail/PageEventDetail.vue.d.ts +6 -3
  36. package/dist/src/templates/edu/PageEduEventDetail/PageEduEventDetail.stories.d.ts +153 -31
  37. package/dist/src/utils/mixins.d.ts +1 -1
  38. package/dist/src/utils/rangeifyGrades.d.ts +3 -0
  39. package/dist/style.css +1 -1
  40. package/lib/main.ts +2 -2
  41. package/package.json +2 -2
  42. package/src/components/{BaseTag/BaseTag.stories.js → BasePill/BasePill.stories.js} +3 -3
  43. package/src/components/BasePill/BasePill.vue +54 -0
  44. package/src/components/BlockLinkCard/BlockLinkCard.stories.js +93 -12
  45. package/src/components/BlockLinkCard/BlockLinkCard.vue +180 -39
  46. package/src/components/BlockLinkCarousel/BlockLinkCarousel.stories.js +60 -3
  47. package/src/components/BlockLinkTile/BlockLinkTile.vue +11 -8
  48. package/src/components/CalendarChip/CalendarChip.vue +52 -0
  49. package/src/components/DetailHeadline/DetailHeadline.vue +5 -5
  50. package/src/components/EventCard/EventCard.vue +28 -88
  51. package/src/components/EventDetailHero/EventDetailHero.vue +18 -25
  52. package/src/components/HeroListingIndex/HeroListingIndex.stories.js +1 -0
  53. package/src/components/HeroListingIndex/HeroListingIndex.vue +8 -3
  54. package/src/components/HeroMedium/HeroMedium.vue +24 -12
  55. package/src/components/Icons/IconProfile.vue +30 -0
  56. package/src/components/Icons/IconSubject.vue +38 -0
  57. package/src/components/Icons/Icons.stories.ts +15 -0
  58. package/src/components/MetadataEduResource/MetadataEduResource.stories.js +59 -0
  59. package/src/components/MetadataEduResource/MetadataEduResource.vue +93 -0
  60. package/src/components/MetadataEvent/MetadataEvent.stories.js +31 -0
  61. package/src/components/MetadataEvent/MetadataEvent.vue +164 -0
  62. package/src/components/SearchResultCard/SearchResultCard.stories.js +22 -5
  63. package/src/components/SearchResultCard/SearchResultCard.vue +71 -14
  64. package/src/components/SearchResultGridItem/SearchResultGridItem.stories.js +8 -1
  65. package/src/components/SearchResultGridItem/SearchResultGridItem.vue +81 -31
  66. package/src/components/SearchResultsList/SearchResultsList.stories.js +1197 -0
  67. package/src/components/SearchResultsList/SearchResultsList.vue +1 -0
  68. package/src/components/TopicDetailMoreItem/TopicDetailMoreItem.vue +12 -8
  69. package/src/constants.ts +20 -0
  70. package/src/interfaces.ts +41 -3
  71. package/src/templates/PageContent/PageContent.stories.js +1 -0
  72. package/src/templates/PageEventDetail/PageEventDetail.stories.js +1 -1
  73. package/src/templates/PageEventDetail/PageEventDetail.vue +25 -90
  74. package/src/templates/edu/PageEduEventDetail/PageEduEventDetail.stories.js +3 -2
  75. package/src/templates/edu/PageEduEventDetail/PageEduEventDetail.vue +38 -123
  76. package/src/utils/mixins.ts +1 -1
  77. package/src/utils/rangeifyGrades.ts +76 -0
  78. package/src/components/BaseTag/BaseTag.vue +0 -36
@@ -0,0 +1,76 @@
1
+ import type { GradeLevelsObject } from './../interfaces'
2
+ import { computed, ref } from 'vue'
3
+
4
+ const gradesAsNumbers = ref({
5
+ K: 0,
6
+ '1': 1,
7
+ '2': 2,
8
+ '3': 3,
9
+ '4': 4,
10
+ '5': 5,
11
+ '6': 6,
12
+ '7': 7,
13
+ '8': 8,
14
+ '9': 9,
15
+ '10': 10,
16
+ '11': 11,
17
+ '12': 12
18
+ })
19
+
20
+ const numbersAsGrades = computed(
21
+ (): {
22
+ [name: number]: string
23
+ } => {
24
+ return Object.keys(gradesAsNumbers.value).reduce((ret, key) => {
25
+ // @ts-expect-error need to correctly retype keys when swapping
26
+ ret[gradesAsNumbers.value[key]] = key
27
+ return ret
28
+ }, {})
29
+ }
30
+ )
31
+
32
+ const rangeify = (a: number[]): string[] => {
33
+ const res: string[] = []
34
+ let run = []
35
+ for (let i = 0; i < a.length; i++) {
36
+ run.push(a[i])
37
+ if (i + 1 >= a.length || a[i + 1] - a[i] > 1) {
38
+ res.push(
39
+ // @ts-expect-error
40
+ run.length > 1
41
+ ? `${numbersAsGrades.value[run[0]]}-${run.pop()}`
42
+ : run.map((item) => numbersAsGrades.value[item])
43
+ )
44
+ run = []
45
+ }
46
+ }
47
+ return res
48
+ }
49
+
50
+ export const rangeifyGrades = (gradeLevels: GradeLevelsObject[]) => {
51
+ if (gradeLevels) {
52
+ const allAgesArray = gradeLevels.map((item) => {
53
+ if (item.gradeLevel === 'All Ages') return item.gradeLevel
54
+ })
55
+ const allAges = allAgesArray.join('')
56
+
57
+ const gradesArray = gradeLevels.map((item) => {
58
+ // @ts-expect-error
59
+ const level: number = gradesAsNumbers.value[item.gradeLevel]
60
+ return level
61
+ })
62
+
63
+ const filteredGrades = rangeify(gradesArray.filter(Number.isFinite))
64
+ let preparedGrades: string = ''
65
+ if (filteredGrades?.length) {
66
+ const gradeString = filteredGrades.length > 1 ? 'Grades: ' : 'Grade: '
67
+ preparedGrades = filteredGrades
68
+ .map((grade, index) => (index === 0 ? gradeString + grade : grade))
69
+ .join(', ')
70
+ }
71
+
72
+ const audienceArray = [allAges, preparedGrades]
73
+ return audienceArray.filter(Boolean).join(', ')
74
+ }
75
+ return undefined
76
+ }
@@ -1,36 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Attributes } from './../../interfaces'
3
-
4
- // using borders to vertically center wonky font face
5
- const variantMap: Attributes = {
6
- primary: 'bg-primary border-primary',
7
- secondary: 'bg-secondary border-secondary',
8
- action: 'bg-action border-action'
9
- }
10
-
11
- const sizeMap: Attributes = {
12
- sm: 'text-xs border-t-2 py-1 px-2.5',
13
- md: 'text-xs lg:text-base border-t py-1.5 px-3.5',
14
- lg: 'text-base lg:text-lg border-t pt-1.5 pb-1 px-5'
15
- }
16
-
17
- interface BaseTagProps {
18
- variant?: string
19
- size?: string
20
- }
21
-
22
- // define props
23
- const props = withDefaults(defineProps<BaseTagProps>(), {
24
- variant: 'primary',
25
- size: 'md'
26
- })
27
- </script>
28
- <template>
29
- <p
30
- :class="`${variantMap[props.variant]} ${sizeMap[props.size]}`"
31
- class="ThemeVariantLight text-contrast-none inline-block text-white font-bold edu:font-extrabold rounded-full leading-tight m-0 uppercase print:border-none print:px-0"
32
- >
33
- <slot />
34
- <span class="sr-only">.</span>
35
- </p>
36
- </template>