@asd20/ui 3.2.1039 → 3.2.1041

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 (23) hide show
  1. package/package-lock.json +69350 -11699
  2. package/package.json +6 -7
  3. package/src/components/atoms/Asd20Button/index.vue +48 -26
  4. package/src/components/atoms/Asd20Icon/index.vue +1 -1
  5. package/src/components/molecules/Asd20Card/index.vue +1 -1
  6. package/src/components/molecules/Asd20Swiper/index.vue +1 -1
  7. package/src/components/organisms/Asd20EventModal/index.vue +1 -1
  8. package/src/components/organisms/Asd20ImageGallery/index.vue +1 -1
  9. package/src/components/organisms/Asd20ImageHeader/index.vue +1 -1
  10. package/src/components/organisms/Asd20PageHeader/index.vue +1 -1
  11. package/src/components/organisms/Asd20PrimaryHeader/index.vue +1 -1
  12. package/src/components/organisms/Asd20SchoolHomepageHeader/index.vue +1 -1
  13. package/src/components/organisms/Asd20SiteSearch/index.vue +1 -1
  14. package/src/components/templates/Asd20ArticleDigestCompactTemplate/index.stories.js +1 -1
  15. package/src/components/templates/Asd20ArticleDigestTemplate/index.stories.js +1 -1
  16. package/src/components/templates/Asd20ArticleListTemplate/index.stories.js +1 -1
  17. package/src/components/templates/Asd20ClubsTemplate/index.stories.js +1 -1
  18. package/src/components/templates/Asd20LoginsTemplate/index.vue +3 -3
  19. package/src/components/templates/Asd20SchoolHomeTemplate/index.vue +1 -1
  20. package/src/components/templates/Asd20SchoolHomeVideoTemplate/index.vue +1 -1
  21. package/src/helpers/mapPageQueryResultToPageTemplateProps.js +1 -1
  22. package/src/mixins/inputComponentMixin.js +2 -2
  23. package/src/helpers/toKebab.js +0 -27
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "*.scss",
6
6
  "*.vue"
7
7
  ],
8
- "version": "3.2.1039",
8
+ "version": "3.2.1041",
9
9
  "private": false,
10
10
  "license": "MIT",
11
11
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "focus-trap": "^6.9.4",
36
36
  "focus-trap-vue": "^1.1.1",
37
37
  "js-cookie": "^2.2.1",
38
- "lodash-es": "^4.17.15",
38
+ "lodash": "^4.17.21",
39
39
  "swiper": "^5.4.5",
40
40
  "uuid": "^3.3.2",
41
41
  "v-scroll-lock": "^1.3.1",
@@ -51,14 +51,13 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/core": "^7.3.4",
54
- "@release-it/conventional-changelog": "^2.0.0",
54
+ "@release-it/conventional-changelog": "^1",
55
55
  "@storybook/addon-a11y": "^6.5.16",
56
56
  "@storybook/addon-actions": "^6.5.16",
57
57
  "@storybook/addon-controls": "^6.5.16",
58
58
  "@storybook/addon-docs": "^6.5.16",
59
- "@storybook/addon-knobs": "^6.3.0",
59
+ "@storybook/addon-knobs": "^6.4.0",
60
60
  "@storybook/addon-links": "^6.5.16",
61
- "@storybook/addon-notes": "^5.3.12",
62
61
  "@storybook/vue": "^6.5.16",
63
62
  "@vue/cli-plugin-babel": "^3.4.0",
64
63
  "@vue/cli-plugin-e2e-cypress": "^3.4.0",
@@ -80,9 +79,9 @@
80
79
  "html-webpack-plugin": "^3.2.0",
81
80
  "jest-image-snapshot": "^2.5.0",
82
81
  "lint-staged": "^8.1.0",
83
- "lodash": "^4.17.15",
84
82
  "puppeteer": "^1.9.0",
85
- "react": "^16.8.3",
83
+ "react": "16.14.0",
84
+ "react-dom": "16.14.0",
86
85
  "release-it": "^10.2.0",
87
86
  "sass": "^1.69.0",
88
87
  "sass-loader": "10.1.1",
@@ -1,29 +1,16 @@
1
1
  <template>
2
- <component
3
- :is="tag"
4
- :href="link || undefined"
5
- :class="classes"
6
- :aria-label="hideLabel ? label : undefined"
7
- :aria-disabled="disabled ? 'true' : undefined"
8
- :title="hideLabel ? label : undefined"
9
- :target="
10
- !link || link.startsWith('/') || link.includes('asd20.org')
11
- ? undefined
12
- : '_blank'
13
- "
14
- v-bind="[trackingCode ? { [trackingCode]: '' } : {}]"
15
- >
2
+ <component :is="tag" v-bind="rootAttrs">
16
3
  <asd20-icon
17
4
  v-if="icon"
18
5
  :name="icon"
19
6
  :size="size"
20
- :style="`transform: rotate(${iconAngle}deg)`"
7
+ :style="{ transform: `rotate(${iconAngle}deg)` }"
21
8
  />
22
9
  <span
23
10
  v-if="(label && !hideLabel) || $slots.default"
24
11
  class="asd20-button__label"
25
12
  v-html="label"
26
- ></span>
13
+ />
27
14
  <slot />
28
15
  </component>
29
16
  </template>
@@ -40,16 +27,13 @@ export default {
40
27
  opposite: { type: Boolean, default: false },
41
28
  hideLabel: { type: Boolean, default: false },
42
29
  link: { type: String, default: '' },
43
- trackingCode: { type: String, default: '' },
30
+ trackingCode: { type: String, default: '' }, // e.g., 'data-analytics-id'
44
31
  icon: { type: String, default: '' },
45
32
  badge: { type: Number, default: 0 },
46
33
  size: {
47
34
  type: String,
48
35
  default: 'lg',
49
- validator: value => {
50
- // The value must match one of these strings
51
- return ['xs', 'sm', 'md', 'lg'].indexOf(value) !== -1
52
- },
36
+ validator: v => ['xs', 'sm', 'md', 'lg'].indexOf(v) !== -1,
53
37
  },
54
38
  textOnly: { type: Boolean, default: false },
55
39
  horizontal: { type: Boolean, default: false },
@@ -74,15 +58,53 @@ export default {
74
58
  'asd20-button--centered': this.centered,
75
59
  'asd20-button--disabled': this.disabled,
76
60
  'asd20-button--opposite': this.opposite,
77
-
78
61
  }
79
62
  },
80
63
  tag() {
81
- if (!this.link || this.link === ' ') {
82
- return 'button'
83
- } else {
84
- return 'a'
64
+ return !this.link || this.link === ' ' ? 'button' : 'a'
65
+ },
66
+ // === link policy per your latest rules ===
67
+ isExternal() {
68
+ const l = this.link || ''
69
+ if (!l) return false
70
+ if (l.startsWith('/')) return false
71
+ if (l.startsWith('https://asd20.org')) return false
72
+ // treat other *.asd20.org as same-window links
73
+ return !l.includes('.asd20.org')
74
+ },
75
+ target() {
76
+ return this.isExternal ? '_blank' : undefined
77
+ },
78
+ rel() {
79
+ return this.isExternal ? 'noopener noreferrer' : undefined
80
+ },
81
+ rootAttrs() {
82
+ // Build once, spread with v-bind
83
+ const a = {
84
+ class: this.classes,
85
+ 'aria-label': this.hideLabel ? this.label : undefined,
86
+ 'aria-disabled': this.disabled ? 'true' : undefined,
87
+ title: this.hideLabel ? this.label : undefined,
85
88
  }
89
+
90
+ // Anchor-specific attrs (only when tag is <a> AND not disabled)
91
+ if (this.tag === 'a' && !this.disabled) {
92
+ a.href = this.link || undefined
93
+ a.target = this.target
94
+ a.rel = this.rel
95
+ }
96
+
97
+ // Button-specific attrs
98
+ if (this.tag === 'button') {
99
+ a.type = 'button'
100
+ // prevent focusable-but-disabled behavior for accessibility
101
+ if (this.disabled) a.disabled = true
102
+ }
103
+
104
+ // Optional tracking code (dynamic attribute key)
105
+ if (this.trackingCode) a[this.trackingCode] = ''
106
+
107
+ return a
86
108
  },
87
109
  },
88
110
  }
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <script>
17
- import camelCase from 'lodash-es/camelCase'
17
+ import camelCase from 'lodash/camelCase'
18
18
  export default {
19
19
  props: {
20
20
  name: { type: String, default: 'search' },
@@ -113,7 +113,7 @@
113
113
  <script>
114
114
  import Asd20Icon from '../../atoms/Asd20Icon'
115
115
  import Asd20Tag from '../../atoms/Asd20Tag'
116
- import truncate from 'lodash-es/truncate'
116
+ import truncate from 'lodash/truncate'
117
117
 
118
118
  export default {
119
119
  name: 'Asd20Card',
@@ -39,7 +39,7 @@ import {
39
39
  Navigation,
40
40
  Mousewheel,
41
41
  } from 'swiper/js/swiper.esm'
42
- import merge from 'lodash-es/merge'
42
+ import merge from 'lodash/merge'
43
43
  import 'swiper/css/swiper.css'
44
44
 
45
45
  // see http://idangero.us/swiper/api/#custom-build
@@ -61,7 +61,7 @@ import Asd20List from '../../organisms/Asd20List'
61
61
  import Asd20ListItem from '../../molecules/Asd20ListItem'
62
62
  import Asd20Viewport from '../../atoms/Asd20Viewport'
63
63
  import formattedTime from '../../../helpers/formatEventTime'
64
- import truncate from 'lodash-es/truncate'
64
+ import truncate from 'lodash/truncate'
65
65
 
66
66
  export default {
67
67
  name: 'Asd20EventModal',
@@ -55,7 +55,7 @@ import Asd20Swipe from '../../../components/molecules/Asd20Swipe'
55
55
  import Asd20SwipeItem from '../../../components/atoms/Asd20SwipeItem'
56
56
  import Asd20Icon from '../../../components/atoms/Asd20Icon'
57
57
 
58
- import truncate from 'lodash-es/truncate'
58
+ import truncate from 'lodash/truncate'
59
59
 
60
60
  export default {
61
61
  name: 'Asd20ImageGallery',
@@ -164,7 +164,7 @@ import Asd20Share from '../../molecules/Asd20Share'
164
164
  import Asd20FormattedDate from '../../atoms/Asd20FormattedDate'
165
165
  import Asd20TagGroup from '../../organisms/Asd20TagGroup'
166
166
 
167
- import truncate from 'lodash-es/truncate'
167
+ import truncate from 'lodash/truncate'
168
168
 
169
169
  export default {
170
170
  name: 'Asd20ImageHeader',
@@ -159,7 +159,7 @@ import Asd20Share from '../../molecules/Asd20Share'
159
159
  import Asd20FormattedDate from '../../atoms/Asd20FormattedDate'
160
160
  import Asd20TagGroup from '../../organisms/Asd20TagGroup'
161
161
 
162
- import truncate from 'lodash-es/truncate'
162
+ import truncate from 'lodash/truncate'
163
163
 
164
164
  export default {
165
165
  name: 'Asd20PageHeader',
@@ -26,7 +26,7 @@
26
26
 
27
27
  <script>
28
28
  import Asd20Messaging from '../../atoms/Asd20Messaging'
29
- import _get from 'lodash-es/get'
29
+ import _get from 'lodash/get'
30
30
 
31
31
  export default {
32
32
  name: 'Asd20PrimaryHeader',
@@ -55,7 +55,7 @@
55
55
  import scrollTrack from '../../../directives/scroll-track'
56
56
  import Asd20Button from '../../atoms/Asd20Button'
57
57
 
58
- import truncate from 'lodash-es/truncate'
58
+ import truncate from 'lodash/truncate'
59
59
 
60
60
  export default {
61
61
  name: 'Asd20SchoolHomepageHeader',
@@ -95,7 +95,7 @@ import Asd20DepartmentContactCard from '../../molecules/Asd20DepartmentContactCa
95
95
  import Asd20Checkbox from '../../atoms/Asd20Checkbox'
96
96
 
97
97
  // Helpers
98
- import debounce from 'lodash-es/debounce'
98
+ import debounce from 'lodash/debounce'
99
99
  import mapPagesToListItems from '../../../helpers/mapPagesToListItems'
100
100
  import mapFilesToListItems from '../../../helpers/mapFilesToListItems'
101
101
 
@@ -6,7 +6,7 @@ import mockPageMixin from '../../../mixins/mockPageMixin'
6
6
  import Asd20ArticleDigestCompactTemplate from '.'
7
7
  import pageQueryResult from '../../../data/page-queries/digest-page-query-result.json'
8
8
  import notifications from '../../../data/messages/notifications'
9
- import debounce from 'lodash-es/debounce'
9
+ import debounce from 'lodash/debounce'
10
10
 
11
11
 
12
12
  const info = {
@@ -6,7 +6,7 @@ import mockPageMixin from '../../../mixins/mockPageMixin'
6
6
  import Asd20ArticleDigestTemplate from '.'
7
7
  import pageQueryResult from '../../../data/page-queries/digest-page-query-result.json'
8
8
  import notifications from '../../../data/messages/notifications'
9
- import debounce from 'lodash-es/debounce'
9
+ import debounce from 'lodash/debounce'
10
10
 
11
11
 
12
12
  const info = {
@@ -5,7 +5,7 @@ import mockPageMixin from '../../../mixins/mockPageMixin'
5
5
  import Asd20ArticleListTemplate from '.'
6
6
  import pageQueryResult from '../../../data/page-queries/story-index-page-query-result.json'
7
7
  import notifications from '../../../data/messages/notifications'
8
- import debounce from 'lodash-es/debounce'
8
+ import debounce from 'lodash/debounce'
9
9
 
10
10
  const info = {
11
11
  summary: 'Article List Template',
@@ -6,7 +6,7 @@ import mockPageMixin from '../../../mixins/mockPageMixin'
6
6
  import Asd20ClubsTemplate from '.'
7
7
  import pageQueryResult from '../../../data/page-queries/digest-page-query-result.json'
8
8
  import notifications from '../../../data/messages/notifications'
9
- import debounce from 'lodash-es/debounce'
9
+ import debounce from 'lodash/debounce'
10
10
 
11
11
 
12
12
  const info = {
@@ -168,7 +168,7 @@ import Asd20Button from '../../atoms/Asd20Button'
168
168
  import Asd20Modal from '../../molecules/Asd20Modal'
169
169
  import Asd20MessagingGroup from '../../molecules/Asd20MessagingGroup'
170
170
 
171
- import { toKebab } from '../../../helpers/toKebab'
171
+ import kebabCase from 'lodash/kebabCase'
172
172
 
173
173
  // Mixins
174
174
  import pageTemplateMixin from '../../../mixins/pageTemplateMixin'
@@ -267,8 +267,8 @@ export default {
267
267
 
268
268
  return sortedCategories.map(c => ({
269
269
  label: c,
270
- hash: `#tab-${toKebab(c)}`,
271
- active: this.tab === `#tab-${toKebab(c)}`,
270
+ hash: `#tab-${kebabCase(c)}`,
271
+ active: this.tab === `#tab-${kebabCase(c)}`,
272
272
  }))
273
273
  },
274
274
  logins() {
@@ -191,7 +191,7 @@ import Asd20LanguageTranslation from '../../molecules/Asd20LanguageTranslation'
191
191
  import Asd20BlockSchedule from '../../molecules/Asd20BlockSchedule'
192
192
 
193
193
  // Helpers
194
- import _get from 'lodash-es/get'
194
+ import _get from 'lodash/get'
195
195
 
196
196
  export default {
197
197
  name: 'Asd20SchoolHomeTemplate',
@@ -191,7 +191,7 @@ import Asd20LanguageTranslation from '../../molecules/Asd20LanguageTranslation'
191
191
  import Asd20BlockSchedule from '../../molecules/Asd20BlockSchedule'
192
192
 
193
193
  // Helpers
194
- import _get from 'lodash-es/get'
194
+ import _get from 'lodash/get'
195
195
 
196
196
  export default {
197
197
  name: 'Asd20SchoolHomeVideoTemplate',
@@ -1,4 +1,4 @@
1
- import _get from 'lodash-es/get'
1
+ import _get from 'lodash/get'
2
2
 
3
3
  function getConfigurationValueOrDefault({
4
4
  configurations,
@@ -1,4 +1,4 @@
1
- import { toKebab } from '../helpers/toKebab'
1
+ import kebabCase from 'lodash/kebabCase'
2
2
 
3
3
  export default {
4
4
  inheritAttrs: false,
@@ -44,7 +44,7 @@ export default {
44
44
 
45
45
  computed: {
46
46
  kebabComponentName() {
47
- return toKebab(this.$options.name).replace(/-([0-9])/g, '$1')
47
+ return kebabCase(this.$options.name).replace(/-([0-9])/g, '$1')
48
48
  },
49
49
  classes() {
50
50
  let classes = {}
@@ -1,27 +0,0 @@
1
- /**
2
- * Convert a string to kebab-case (lodash-like).
3
- * - lowercases
4
- * - strips accents
5
- * - splits camelCase / numbers
6
- * - collapses non-alphanumerics to single hyphens
7
- * - trims hyphens
8
- * @param {string} input
9
- * @returns {string}
10
- */
11
- export function toKebab(input) {
12
- if (input == null) return ''
13
-
14
- let s = String(input)
15
- .normalize('NFKD')
16
- .replace(/[\u0300-\u036f]/g, '')
17
-
18
- s = s
19
- .replace(/([a-z0-9])([A-Z])/g, '$1-$2') // lower/num → Upper
20
- .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2') // HTMLParser → HTML-Parser
21
- .replace(/([A-Za-z])([0-9])/g, '$1-$2') // word→digit
22
- .replace(/([0-9])([A-Za-z])/g, '$1-$2') // digit→word
23
-
24
- s = s.replace(/[^A-Za-z0-9]+/g, '-')
25
-
26
- return s.replace(/^-+|-+$/g, '').toLowerCase()
27
- }