@asd20/ui-next 2.0.2 → 2.0.4

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 (43) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/Asd20Badge/index.vue +1 -0
  4. package/src/components/molecules/Asd20Share/index.vue +1 -0
  5. package/src/components/organisms/Asd20AiSearch/index.vue +4 -0
  6. package/src/components/organisms/Asd20CampusHeader/index.vue +5 -7
  7. package/src/components/organisms/Asd20ImageGallery/index.vue +1 -0
  8. package/src/components/organisms/Asd20ImageHeader/index.vue +4 -6
  9. package/src/components/organisms/Asd20PageHeader/index.vue +4 -6
  10. package/src/components/organisms/Asd20SiteMenu/index.vue +2 -0
  11. package/src/components/organisms/Asd20SiteNavigation/index.vue +10 -8
  12. package/src/components/organisms/Asd20SiteSearch/index.vue +1 -0
  13. package/src/components/templates/Asd20AppTemplate/index.vue +18 -24
  14. package/src/components/templates/Asd20ArticleDigestCompactTemplate/index.vue +20 -26
  15. package/src/components/templates/Asd20ArticleDigestTemplate/index.vue +20 -26
  16. package/src/components/templates/Asd20ArticleListTemplate/index.vue +20 -26
  17. package/src/components/templates/Asd20ArticleTemplate/index.vue +14 -18
  18. package/src/components/templates/Asd20BasePageTemplate/index.vue +26 -34
  19. package/src/components/templates/Asd20CampusDetailTemplate/index.vue +20 -26
  20. package/src/components/templates/Asd20CampusTemplate/index.vue +50 -58
  21. package/src/components/templates/Asd20ClubsTemplate/index.vue +20 -26
  22. package/src/components/templates/Asd20DetailAlternateTemplate/index.vue +20 -26
  23. package/src/components/templates/Asd20DetailImageFullTemplate/index.vue +20 -26
  24. package/src/components/templates/Asd20DetailImageTemplate/index.vue +20 -26
  25. package/src/components/templates/Asd20DetailTemplate/index.vue +20 -26
  26. package/src/components/templates/Asd20DistrictHomeTemplate/index.vue +45 -55
  27. package/src/components/templates/Asd20DistrictVideoTemplate/index.vue +45 -55
  28. package/src/components/templates/Asd20FileListPageTemplate/index.vue +20 -26
  29. package/src/components/templates/Asd20GroupFeatureTemplate/index.vue +20 -26
  30. package/src/components/templates/Asd20LoginsTemplate/index.vue +21 -27
  31. package/src/components/templates/Asd20PeopleFeatureTemplate/index.vue +20 -26
  32. package/src/components/templates/Asd20ProfileTemplate/index.vue +20 -26
  33. package/src/components/templates/Asd20SalaryCalculatorTemplate/index.vue +20 -26
  34. package/src/components/templates/Asd20SchoolHomeTemplate/index.vue +84 -96
  35. package/src/components/templates/Asd20SchoolHomeVideoTemplate/index.vue +81 -93
  36. package/src/components/templates/Asd20WayfindingAccessibilityTemplate/index.vue +21 -27
  37. package/src/components/templates/Asd20WayfindingAlternateTemplate/index.vue +21 -27
  38. package/src/components/templates/Asd20WayfindingImageTemplate/index.vue +21 -27
  39. package/src/components/templates/Asd20WayfindingTemplate/index.vue +21 -27
  40. package/src/design/_template.scss +1 -1
  41. package/src/helpers/linkPolicy.js +4 -10
  42. package/src/mixins/inputComponentMixin.js +18 -11
  43. package/src/utils/createComponentInstanceId.js +6 -3
@@ -17,14 +17,12 @@
17
17
  </asd20-site-navigation>
18
18
 
19
19
  <!-- Banner Notifications -->
20
- <client-only>
21
- <asd20-notification-group
22
- :notifications="activeNotificationsByType.banner"
23
- group-type="banner"
24
- @dismiss="$emit('dismiss-notification', $event)"
25
- @toggle-all="$emit('toggle-all')"
26
- ></asd20-notification-group>
27
- </client-only>
20
+ <asd20-notification-group
21
+ :notifications="activeNotificationsByType.banner"
22
+ group-type="banner"
23
+ @dismiss="$emit('dismiss-notification', $event)"
24
+ @toggle-all="$emit('toggle-all')"
25
+ ></asd20-notification-group>
28
26
 
29
27
  <!-- Page Header -->
30
28
  <asd20-image-header
@@ -39,30 +37,26 @@
39
37
  >
40
38
  <!-- Floating Notifications -->
41
39
  <template #top>
42
- <client-only>
43
- <asd20-notification-group
44
- class="asd20-notification-group--floating"
45
- :notifications="activeNotificationsByType.floating"
46
- :total-dismissed-notifications="totalDismissedNotifications"
47
- group-type="floating"
48
- @dismiss="$emit('dismiss-notification', $event)"
49
- @toggle-all="$emit('toggle-all')"
50
- ></asd20-notification-group>
51
- </client-only>
40
+ <asd20-notification-group
41
+ class="asd20-notification-group--floating"
42
+ :notifications="activeNotificationsByType.floating"
43
+ :total-dismissed-notifications="totalDismissedNotifications"
44
+ group-type="floating"
45
+ @dismiss="$emit('dismiss-notification', $event)"
46
+ @toggle-all="$emit('toggle-all')"
47
+ ></asd20-notification-group>
52
48
  </template>
53
49
  <!-- <template #top><asd20-breadcrumb :links="breadcrumbLinks"></asd20-breadcrumb></template> -->
54
50
  </asd20-image-header>
55
51
 
56
52
  <!-- Inline-Notifications -->
57
- <client-only>
58
- <asd20-notification-group
59
- class="asd20-notification-group--inline"
60
- :notifications="activeNotificationsByType.inline"
61
- group-type="inline"
62
- @dismiss="$emit('dismiss-notification', $event)"
63
- @toggle-all="$emit('toggle-all')"
64
- ></asd20-notification-group>
65
- </client-only>
53
+ <asd20-notification-group
54
+ class="asd20-notification-group--inline"
55
+ :notifications="activeNotificationsByType.inline"
56
+ group-type="inline"
57
+ @dismiss="$emit('dismiss-notification', $event)"
58
+ @toggle-all="$emit('toggle-all')"
59
+ ></asd20-notification-group>
66
60
 
67
61
  <!-- Page Content -->
68
62
  <asd20-page-content
@@ -17,14 +17,12 @@
17
17
  </asd20-site-navigation>
18
18
 
19
19
  <!-- Banner Notifications -->
20
- <client-only>
21
- <asd20-notification-group
22
- :notifications="activeNotificationsByType.banner"
23
- group-type="banner"
24
- @dismiss="$emit('dismiss-notification', $event)"
25
- @toggle-all="$emit('toggle-all')"
26
- ></asd20-notification-group>
27
- </client-only>
20
+ <asd20-notification-group
21
+ :notifications="activeNotificationsByType.banner"
22
+ group-type="banner"
23
+ @dismiss="$emit('dismiss-notification', $event)"
24
+ @toggle-all="$emit('toggle-all')"
25
+ ></asd20-notification-group>
28
26
 
29
27
  <!-- Page Header -->
30
28
  <asd20-page-header
@@ -39,30 +37,26 @@
39
37
  >
40
38
  <!-- Floating Notifications -->
41
39
  <template #top>
42
- <client-only>
43
- <asd20-notification-group
44
- class="asd20-notification-group--floating"
45
- :notifications="activeNotificationsByType.floating"
46
- :total-dismissed-notifications="totalDismissedNotifications"
47
- group-type="floating"
48
- @dismiss="$emit('dismiss-notification', $event)"
49
- @toggle-all="$emit('toggle-all')"
50
- ></asd20-notification-group>
51
- </client-only>
40
+ <asd20-notification-group
41
+ class="asd20-notification-group--floating"
42
+ :notifications="activeNotificationsByType.floating"
43
+ :total-dismissed-notifications="totalDismissedNotifications"
44
+ group-type="floating"
45
+ @dismiss="$emit('dismiss-notification', $event)"
46
+ @toggle-all="$emit('toggle-all')"
47
+ ></asd20-notification-group>
52
48
  </template>
53
49
  <!-- <template #top><asd20-breadcrumb :links="breadcrumbLinks"></asd20-breadcrumb></template> -->
54
50
  </asd20-page-header>
55
51
 
56
52
  <!-- Inline-Notifications -->
57
- <client-only>
58
- <asd20-notification-group
59
- class="asd20-notification-group--inline"
60
- :notifications="activeNotificationsByType.inline"
61
- group-type="inline"
62
- @dismiss="$emit('dismiss-notification', $event)"
63
- @toggle-all="$emit('toggle-all')"
64
- ></asd20-notification-group>
65
- </client-only>
53
+ <asd20-notification-group
54
+ class="asd20-notification-group--inline"
55
+ :notifications="activeNotificationsByType.inline"
56
+ group-type="inline"
57
+ @dismiss="$emit('dismiss-notification', $event)"
58
+ @toggle-all="$emit('toggle-all')"
59
+ ></asd20-notification-group>
66
60
 
67
61
  <!-- Page Content -->
68
62
  <asd20-page-content
@@ -2,7 +2,7 @@
2
2
  .page-enter-active, .page-leave-active {
3
3
  transition: opacity .5s;
4
4
  }
5
- .page-enter, .page-leave-to {
5
+ .page-enter, .page-enter-from, .page-leave-to {
6
6
  opacity: 0;
7
7
  }
8
8
  .notification-group--inline {
@@ -50,20 +50,14 @@ export function shouldOpenInNewWindow(href, options) {
50
50
  return !isAsd20Hostname(url.hostname, options)
51
51
  }
52
52
 
53
- export function resolveCurrentHostname(vm, options) {
53
+ export function resolveCurrentHostname(_vm, options = {}) {
54
54
  if (typeof window !== 'undefined' && window.location) {
55
55
  return normalizeHostname(window.location.hostname, options)
56
56
  }
57
57
 
58
- const requestHost =
59
- vm &&
60
- vm.$ssrContext &&
61
- vm.$ssrContext.req &&
62
- vm.$ssrContext.req.headers &&
63
- (vm.$ssrContext.req.headers['x-forwarded-host'] ||
64
- vm.$ssrContext.req.headers.host)
65
-
66
- return normalizeHostname(requestHost, options)
58
+ // Server renders should stay deterministic and avoid reaching through the
59
+ // component proxy for SSR internals that are not part of the Vue 3 public API.
60
+ return normalizeHostname(options.currentHostname || '', options)
67
61
  }
68
62
 
69
63
  export function shouldShowExternalIcon(href, currentHostname, options) {
@@ -1,6 +1,12 @@
1
1
  import kebabCase from 'lodash/kebabCase'
2
+ import createComponentInstanceId from '../utils/createComponentInstanceId'
2
3
 
3
4
  const INPUT_MODEL_LISTENER_KEYS = ['onInput', 'onUpdate:modelValue']
5
+ const DEFAULT_INPUT_COMPONENT_NAME = 'asd20-input'
6
+
7
+ function resolveKebabComponentName(componentName = DEFAULT_INPUT_COMPONENT_NAME) {
8
+ return kebabCase(componentName).replace(/-([0-9])/g, '$1')
9
+ }
4
10
 
5
11
  function omitKeys(source, keys) {
6
12
  const target = { ...(source || {}) }
@@ -46,18 +52,23 @@ export default {
46
52
  reversed: { type: Boolean, default: false },
47
53
  taggable: { type: Boolean, default: true },
48
54
  },
49
- data: () => ({
50
- isDirty: false,
51
- isActive: false,
52
- validationErrors: [],
53
- }),
55
+ data() {
56
+ return {
57
+ isDirty: false,
58
+ isActive: false,
59
+ validationErrors: [],
60
+ generatedInputId: createComponentInstanceId(
61
+ resolveKebabComponentName(this.$options.name)
62
+ ),
63
+ }
64
+ },
54
65
  mounted() {
55
66
  this.validate(this.resolvedValue)
56
67
  },
57
68
 
58
69
  computed: {
59
70
  kebabComponentName() {
60
- return kebabCase(this.$options.name).replace(/-([0-9])/g, '$1')
71
+ return resolveKebabComponentName(this.$options.name)
61
72
  },
62
73
  classes() {
63
74
  let classes = {}
@@ -92,11 +103,7 @@ export default {
92
103
  },
93
104
 
94
105
  computedId() {
95
- return this.$attrs.id
96
- ? this.$attrs.id
97
- : `${this.kebabComponentName}_${Math.round(
98
- Math.random() * 10000000000000000
99
- )}`
106
+ return this.$attrs.id ? this.$attrs.id : this.generatedInputId
100
107
  },
101
108
 
102
109
  selectedItem() {
@@ -1,6 +1,9 @@
1
- let nextComponentInstanceId = 0
1
+ import { getCurrentInstance, useId } from 'vue'
2
2
 
3
3
  export default function createComponentInstanceId(prefix = 'asd20-component') {
4
- nextComponentInstanceId += 1
5
- return `${prefix}-${nextComponentInstanceId}`
4
+ if (getCurrentInstance()) {
5
+ return `${prefix}-${useId()}`
6
+ }
7
+
8
+ return `${prefix}-detached`
6
9
  }