@asd20/ui-next 2.0.27 → 2.0.29

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.29](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.28...ui-next-v2.0.29) (2026-04-06)
4
+
5
+ ## [2.0.28](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.27...ui-next-v2.0.28) (2026-04-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * reinstall send an email functionality ([202c86b](https://github.com/academydistrict20/asd20-ui-next/commit/202c86b028e15121d83484de3fa280770448c46b))
11
+
3
12
  ## [2.0.27](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.26...ui-next-v2.0.27) (2026-04-03)
4
13
 
5
14
  ## [2.0.26](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.25...ui-next-v2.0.26) (2026-04-03)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.0.27",
3
+ "version": "2.0.29",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -39,6 +39,7 @@
39
39
  import Asd20BodyAccordion from '../../molecules/Asd20BodyAccordion'
40
40
  import Asd20TableauEmbed from '../../molecules/Asd20TableauEmbed'
41
41
  import { navigateInternalHref } from '../../../helpers/linkPolicy'
42
+ import { applyRichListColumnExceptions } from '../../../helpers/richBodyListColumns'
42
43
 
43
44
  const BODY_BLOCK_PLACEHOLDER_PATTERN =
44
45
  /<div\b(?=[^>]*\bdata-cc-block=(['"])([^'"]+)\1)(?=[^>]*\bdata-block-id=(['"])([^'"]+)\3)[^>]*><\/div>/gi
@@ -146,9 +147,17 @@ export default {
146
147
 
147
148
  mounted() {
148
149
  this.hasMounted = true
150
+ this.applyListColumnExceptions()
151
+ },
152
+
153
+ updated() {
154
+ this.applyListColumnExceptions()
149
155
  },
150
156
 
151
157
  methods: {
158
+ applyListColumnExceptions() {
159
+ applyRichListColumnExceptions(this.$el)
160
+ },
152
161
  onContentClick(event) {
153
162
  const anchor = event.target?.closest?.('a')
154
163
 
@@ -62,6 +62,7 @@ import Asd20Viewport from '../../atoms/Asd20Viewport'
62
62
  import Asd20Spinner from '../../atoms/Asd20Spinner'
63
63
  import Asd20Button from '../../atoms/Asd20Button'
64
64
  import Recaptcha from '../../utils/Recaptcha'
65
+ import sendEmail from '../../../helpers/sendEmail.js'
65
66
 
66
67
  export default {
67
68
  name: 'Asd20ComposeEmailModal',
@@ -102,6 +103,31 @@ export default {
102
103
  },
103
104
  },
104
105
  methods: {
106
+ resolveRuntimeConfig() {
107
+ const runtimeConfig =
108
+ this.$config ||
109
+ this.$?.appContext?.config?.globalProperties?.$config ||
110
+ {}
111
+
112
+ if (
113
+ runtimeConfig.public &&
114
+ typeof runtimeConfig.public === 'object' &&
115
+ !Array.isArray(runtimeConfig.public)
116
+ ) {
117
+ return runtimeConfig.public
118
+ }
119
+
120
+ return runtimeConfig
121
+ },
122
+ resolveSendEmailEndpoint() {
123
+ const runtimeConfig = this.resolveRuntimeConfig()
124
+
125
+ return (
126
+ runtimeConfig.sendEmailEndpoint ||
127
+ runtimeConfig.azureSendEmailEndpoint ||
128
+ null
129
+ )
130
+ },
105
131
  validateEmailAddress({ value, validationErrors }) {
106
132
  const pattern = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
107
133
  const regex = RegExp(pattern)
@@ -124,13 +150,39 @@ export default {
124
150
  if (response) this.sendEmail()
125
151
  },
126
152
  async sendEmail() {
127
- if (!this.isValid || !this.$sendEmail) return
153
+ if (!this.isValid) return
154
+
155
+ const endpoint = this.resolveSendEmailEndpoint()
156
+ const sendEmailClient =
157
+ this.$sendEmail ||
158
+ (endpoint
159
+ ? async (message) => await sendEmail(message, endpoint)
160
+ : null)
161
+
162
+ if (!sendEmailClient) {
163
+ console.error('Send email endpoint is not configured.')
164
+ alert(
165
+ 'Email sending is not configured for this environment. Please try again later.'
166
+ )
167
+ return
168
+ }
169
+
128
170
  this.sending = true
129
- await this.$sendEmail(
130
- Object.assign({}, this.emailMessage, { recipientId: this.recipientId })
131
- )
132
- this.sending = false
133
- this.$emit('dismiss')
171
+ try {
172
+ await sendEmailClient(
173
+ Object.assign({}, this.emailMessage, {
174
+ recipientId: this.recipientId,
175
+ })
176
+ )
177
+ this.$emit('dismiss')
178
+ } catch (error) {
179
+ console.error('Email send failed:', error?.message || error)
180
+ alert(
181
+ 'Something went wrong while sending your email. Please try again later.'
182
+ )
183
+ } finally {
184
+ this.sending = false
185
+ }
134
186
  },
135
187
  },
136
188
  }
@@ -140,6 +140,13 @@
140
140
  flex-basis: 40%;
141
141
  }
142
142
 
143
+ .asd20-messaging .asd20-rich-list--single-column {
144
+ > li:first-child:nth-last-child(n+20),
145
+ > li:first-child:nth-last-child(n+20) ~ li {
146
+ flex-basis: 100%;
147
+ }
148
+ }
149
+
143
150
  h1,
144
151
  h2,
145
152
  h3,
@@ -0,0 +1,48 @@
1
+ export const SINGLE_COLUMN_RICH_LIST_CLASS = 'asd20-rich-list--single-column'
2
+ export const MULTI_COLUMN_LIST_ITEM_THRESHOLD = 20
3
+ export const SIGNIFICANT_LIST_ITEM_TEXT_THRESHOLD = 120
4
+
5
+ const COMPLEX_DIRECT_CHILD_SELECTOR =
6
+ 'ul, ol, dl, blockquote, pre, table, figure, h1, h2, h3, h4, h5, h6'
7
+
8
+ function isDomElement(value) {
9
+ return typeof Element !== 'undefined' && value instanceof Element
10
+ }
11
+
12
+ function normalizeTextContent(value) {
13
+ return value.replace(/\s+/g, ' ').trim()
14
+ }
15
+
16
+ export function isSignificantRichListItem(listItem) {
17
+ if (!isDomElement(listItem)) return false
18
+
19
+ if (listItem.querySelector(COMPLEX_DIRECT_CHILD_SELECTOR)) return true
20
+ if (listItem.children.length > 1) return true
21
+ if (listItem.querySelectorAll('br').length >= 2) return true
22
+
23
+ const textContent = normalizeTextContent(listItem.textContent || '')
24
+ return textContent.length >= SIGNIFICANT_LIST_ITEM_TEXT_THRESHOLD
25
+ }
26
+
27
+ export function shouldPreventRichListColumns(listElement) {
28
+ if (!isDomElement(listElement)) return false
29
+
30
+ const listItems = Array.from(listElement.children).filter(
31
+ child => child.tagName === 'LI'
32
+ )
33
+
34
+ if (listItems.length < MULTI_COLUMN_LIST_ITEM_THRESHOLD) return false
35
+
36
+ return listItems.some(isSignificantRichListItem)
37
+ }
38
+
39
+ export function applyRichListColumnExceptions(rootElement) {
40
+ if (!isDomElement(rootElement)) return
41
+
42
+ rootElement.querySelectorAll('ul, ol').forEach(list => {
43
+ list.classList.toggle(
44
+ SINGLE_COLUMN_RICH_LIST_CLASS,
45
+ shouldPreventRichListColumns(list)
46
+ )
47
+ })
48
+ }