vira 31.31.0 → 31.31.2

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 (30) hide show
  1. package/dist/elements/pop-up/vira-menu-item.element.js +57 -55
  2. package/dist/elements/pop-up/vira-menu.element.js +33 -31
  3. package/dist/elements/pop-up/vira-pop-up-trigger.element.js +57 -55
  4. package/dist/elements/vira-absolute-time.element.d.ts +3 -3
  5. package/dist/elements/vira-bold-text.element.js +35 -33
  6. package/dist/elements/vira-button.element.js +6 -2
  7. package/dist/elements/vira-card.element.js +16 -14
  8. package/dist/elements/vira-checkbox.element.js +95 -93
  9. package/dist/elements/vira-collapsible-card.element.js +63 -61
  10. package/dist/elements/vira-collapsible-wrapper.element.js +38 -36
  11. package/dist/elements/vira-date-input.element.d.ts +3 -3
  12. package/dist/elements/vira-date-input.element.js +37 -35
  13. package/dist/elements/vira-drawer.element.js +93 -91
  14. package/dist/elements/vira-error.element.js +8 -6
  15. package/dist/elements/vira-icon.element.js +23 -21
  16. package/dist/elements/vira-image.element.js +44 -42
  17. package/dist/elements/vira-json-form.element.js +7 -3
  18. package/dist/elements/vira-link.element.js +26 -24
  19. package/dist/elements/vira-modal.element.js +95 -80
  20. package/dist/elements/vira-progress.element.js +23 -21
  21. package/dist/elements/vira-relative-time.element.d.ts +2 -2
  22. package/dist/elements/vira-select.element.js +127 -122
  23. package/dist/elements/vira-tabs.element.js +17 -7
  24. package/dist/elements/vira-tag.element.js +3 -1
  25. package/dist/elements/vira-text-area.element.js +92 -90
  26. package/dist/icons/lucide-icons.js +7 -5
  27. package/dist/util/shared-text-input-logic.js +6 -4
  28. package/dist/util/vira-form-fields.d.ts +2 -2
  29. package/dist/util/vira-json-schema.js +24 -16
  30. package/package.json +11 -11
@@ -53,122 +53,122 @@ export const ViraDrawer = defineViraElement()({
53
53
  'vira-drawer-backdrop-filter': 'blur(3px)',
54
54
  'vira-drawer-max-height': '80dvh',
55
55
  },
56
- styles: ({ cssVars, hostClasses }) => css `
57
- :host {
58
- display: contents;
59
- }
60
-
61
- ${hostClasses['vira-drawer-dragging'].selector} {
62
- ${noUserSelect};
63
- }
64
-
65
- h1 {
66
- ${noNativeSpacing};
67
- }
68
-
69
- dialog {
70
- ${colorCss(viraTheme.colors[themeDefaultKey])}
71
- border: none;
72
- padding: 0;
73
- overflow: hidden;
74
- position: fixed;
75
- inset: auto 0 0 0;
76
- margin: 0;
77
- width: 100%;
78
- max-width: 100%;
79
- max-height: ${cssVars['vira-drawer-max-height'].value};
80
- border-radius: 16px 16px 0 0;
81
- ${viraShadows.modal}
82
- transition: transform ${viraAnimationDurations['vira-pretty-animation-duration']
83
- .value} ease;
56
+ styles: ({ cssVars, hostClasses }) => {
57
+ return css `
58
+ :host {
59
+ display: contents;
60
+ }
84
61
 
85
- &[open] {
86
- display: flex;
87
- flex-direction: column;
62
+ ${hostClasses['vira-drawer-dragging'].selector} {
63
+ ${noUserSelect};
88
64
  }
89
65
 
90
- &::backdrop {
91
- background: ${viraFormCssVars['vira-form-modal-backdrop-color'].value};
92
- backdrop-filter: ${cssVars['vira-drawer-backdrop-filter'].value};
66
+ h1 {
67
+ ${noNativeSpacing};
93
68
  }
94
69
 
95
- & .drawer-content-wrapper {
70
+ dialog {
71
+ ${colorCss(viraTheme.colors[themeDefaultKey])}
72
+ border: none;
73
+ padding: 0;
96
74
  overflow: hidden;
97
- display: flex;
98
- flex-direction: column;
75
+ position: fixed;
76
+ inset: auto 0 0 0;
77
+ margin: 0;
78
+ width: 100%;
79
+ max-width: 100%;
80
+ max-height: ${cssVars['vira-drawer-max-height'].value};
81
+ border-radius: 16px 16px 0 0;
82
+ ${viraShadows.modal}
83
+ transition: transform ${viraAnimationDurations['vira-pretty-animation-duration']
84
+ .value} ease;
99
85
 
100
- & .drag-handle-wrapper {
86
+ &[open] {
101
87
  display: flex;
102
- justify-content: center;
103
- padding: 8px 0 0;
104
- cursor: grab;
105
- touch-action: none;
106
-
107
- &:active {
108
- cursor: grabbing;
109
- }
88
+ flex-direction: column;
89
+ }
110
90
 
111
- & .drag-handle {
112
- width: 36px;
113
- height: 4px;
114
- border-radius: 2px;
115
- background-color: ${viraFormCssVars['vira-form-secondary-body-foreground']
116
- .value};
117
- opacity: 0.5;
118
- }
91
+ &::backdrop {
92
+ background: ${viraFormCssVars['vira-form-modal-backdrop-color'].value};
93
+ backdrop-filter: ${cssVars['vira-drawer-backdrop-filter'].value};
119
94
  }
120
95
 
121
- & .header {
122
- padding: 8px 24px 16px;
96
+ & .drawer-content-wrapper {
97
+ overflow: hidden;
123
98
  display: flex;
124
- gap: 16px;
125
- align-items: flex-start;
99
+ flex-direction: column;
126
100
 
127
- & .header-text-wrapper {
101
+ & .drag-handle-wrapper {
128
102
  display: flex;
129
- flex-direction: column;
130
- gap: 4px;
131
- align-self: center;
132
- flex-grow: 1;
133
- overflow: hidden;
103
+ justify-content: center;
104
+ padding: 8px 0 0;
105
+ cursor: grab;
106
+ touch-action: none;
134
107
 
135
- & h1 {
136
- font-size: 20px;
108
+ &:active {
109
+ cursor: grabbing;
110
+ }
111
+
112
+ & .drag-handle {
113
+ width: 36px;
114
+ height: 4px;
115
+ border-radius: 2px;
116
+ background-color: ${viraFormCssVars['vira-form-secondary-body-foreground'].value};
117
+ opacity: 0.5;
137
118
  }
138
119
  }
139
120
 
140
- & button.close {
141
- ${noNativeFormStyles};
142
- flex-shrink: 0;
143
- cursor: pointer;
144
- padding: 4px;
145
- border-radius: ${viraFormCssVars['vira-form-radius'].value};
121
+ & .header {
122
+ padding: 8px 24px 16px;
123
+ display: flex;
124
+ gap: 16px;
125
+ align-items: flex-start;
146
126
 
147
- &:hover {
148
- background-color: ${viraFormCssVars['vira-form-selection-hover-color']
149
- .value};
127
+ & .header-text-wrapper {
128
+ display: flex;
129
+ flex-direction: column;
130
+ gap: 4px;
131
+ align-self: center;
132
+ flex-grow: 1;
133
+ overflow: hidden;
134
+
135
+ & h1 {
136
+ font-size: 20px;
137
+ }
150
138
  }
151
139
 
152
- & ${ViraIcon} {
153
- display: flex;
140
+ & button.close {
141
+ ${noNativeFormStyles};
142
+ flex-shrink: 0;
143
+ cursor: pointer;
144
+ padding: 4px;
145
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
146
+
147
+ &:hover {
148
+ background-color: ${viraFormCssVars['vira-form-selection-hover-color'].value};
149
+ }
150
+
151
+ & ${ViraIcon} {
152
+ display: flex;
153
+ }
154
154
  }
155
155
  }
156
- }
157
156
 
158
- & .body {
159
- padding: 0 24px 24px;
160
- overflow: auto;
161
- overscroll-behavior: contain;
157
+ & .body {
158
+ padding: 0 24px 24px;
159
+ overflow: auto;
160
+ overscroll-behavior: contain;
161
+ }
162
162
  }
163
163
  }
164
- }
165
164
 
166
- ${hostClasses['vira-drawer-no-content-padding'].selector} {
167
- & dialog .drawer-content-wrapper .body {
168
- padding: 0;
165
+ ${hostClasses['vira-drawer-no-content-padding'].selector} {
166
+ & dialog .drawer-content-wrapper .body {
167
+ padding: 0;
168
+ }
169
169
  }
170
- }
171
- `,
170
+ `;
171
+ },
172
172
  render({ inputs, state, updateState, events, dispatch, slotNames }) {
173
173
  if (state.dialogElement && inputs.open !== state.dialogElement.open) {
174
174
  if (inputs.open) {
@@ -184,9 +184,11 @@ export const ViraDrawer = defineViraElement()({
184
184
  previousOpenValue: inputs.open,
185
185
  });
186
186
  if (inputs.open) {
187
- const removers = globalEventsToCloseDrawerOn.map((eventName) => listenToGlobal(eventName, () => {
188
- dispatch(new events.drawerClose());
189
- }));
187
+ const removers = globalEventsToCloseDrawerOn.map((eventName) => {
188
+ return listenToGlobal(eventName, () => {
189
+ dispatch(new events.drawerClose());
190
+ });
191
+ });
190
192
  updateState({
191
193
  cleanupListeners: () => {
192
194
  removers.forEach((remover) => remover());
@@ -13,12 +13,14 @@ export const ViraError = defineViraElement()({
13
13
  cssVars: {
14
14
  'vira-error-font-weight': viraFontCssVars['vira-font-weight-bold'].value,
15
15
  },
16
- styles: ({ cssVars }) => css `
17
- :host {
18
- color: ${viraFormCssVars['vira-form-error-color'].value};
19
- font-weight: ${cssVars['vira-error-font-weight'].value};
20
- }
21
- `,
16
+ styles: ({ cssVars }) => {
17
+ return css `
18
+ :host {
19
+ color: ${viraFormCssVars['vira-form-error-color'].value};
20
+ font-weight: ${cssVars['vira-error-font-weight'].value};
21
+ }
22
+ `;
23
+ },
22
24
  render() {
23
25
  return html `
24
26
  <slot></slot>
@@ -14,34 +14,36 @@ export const ViraIcon = defineViraElement()({
14
14
  /** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
15
15
  'vira-icon-fit-container': ({ inputs }) => !!inputs.fitContainer || !!inputs.icon?.size,
16
16
  },
17
- styles: ({ hostClasses }) => css `
18
- :host {
19
- display: inline-flex;
20
- justify-content: center;
21
- align-items: center;
22
- flex-shrink: 0;
23
- }
17
+ styles: ({ hostClasses }) => {
18
+ return css `
19
+ :host {
20
+ display: inline-flex;
21
+ justify-content: center;
22
+ align-items: center;
23
+ flex-shrink: 0;
24
+ }
24
25
 
25
- svg {
26
- /*
26
+ svg {
27
+ /*
27
28
  svg is set to inline by default which causes weird padding under the image.
28
29
  See: https://stackoverflow.com/a/34952703
29
30
  */
30
- display: block;
31
- }
31
+ display: block;
32
+ }
32
33
 
33
- svg * {
34
- vector-effect: non-scaling-stroke;
35
- }
34
+ svg * {
35
+ vector-effect: non-scaling-stroke;
36
+ }
36
37
 
37
- ${hostClasses['vira-icon-fit-container'].selector} {
38
- > *,
39
- svg {
40
- height: 100%;
41
- width: 100%;
38
+ ${hostClasses['vira-icon-fit-container'].selector} {
39
+ > *,
40
+ svg {
41
+ height: 100%;
42
+ width: 100%;
43
+ }
42
44
  }
43
- }
44
- `,
45
+ `;
46
+ },
45
47
  render({ inputs, host }) {
46
48
  if (!inputs.icon) {
47
49
  return '';
@@ -41,53 +41,55 @@ export const ViraImage = defineViraElement()({
41
41
  imageLoad: defineElementEvent(),
42
42
  imageError: defineElementEvent(),
43
43
  },
44
- styles: ({ hostClasses }) => css `
45
- :host {
46
- display: inline-flex;
47
- overflow: hidden;
48
- flex-direction: column;
49
- justify-content: center;
50
- position: relative;
51
- border-radius: inherit;
52
- min-height: 100px;
53
- min-width: 100px;
54
- }
44
+ styles: ({ hostClasses }) => {
45
+ return css `
46
+ :host {
47
+ display: inline-flex;
48
+ overflow: hidden;
49
+ flex-direction: column;
50
+ justify-content: center;
51
+ position: relative;
52
+ border-radius: inherit;
53
+ min-height: 100px;
54
+ min-width: 100px;
55
+ }
55
56
 
56
- img {
57
- width: 100%;
58
- height: auto;
59
- flex-shrink: 0;
60
- }
61
- ${hostClasses['vira-image-height-constrained'].selector} {
62
- flex-direction: row;
63
- }
57
+ img {
58
+ width: 100%;
59
+ height: auto;
60
+ flex-shrink: 0;
61
+ }
62
+ ${hostClasses['vira-image-height-constrained'].selector} {
63
+ flex-direction: row;
64
+ }
64
65
 
65
- ${hostClasses['vira-image-height-constrained'].selector} img {
66
- width: auto;
67
- height: 100%;
68
- }
66
+ ${hostClasses['vira-image-height-constrained'].selector} img {
67
+ width: auto;
68
+ height: 100%;
69
+ }
69
70
 
70
- .status-wrapper {
71
- overflow: hidden;
72
- border-radius: inherit;
73
- width: 100%;
74
- height: 100%;
75
- position: absolute;
76
- top: 0;
77
- left: 0;
78
- display: flex;
79
- justify-content: center;
80
- align-items: center;
81
- }
71
+ .status-wrapper {
72
+ overflow: hidden;
73
+ border-radius: inherit;
74
+ width: 100%;
75
+ height: 100%;
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ display: flex;
80
+ justify-content: center;
81
+ align-items: center;
82
+ }
82
83
 
83
- .error {
84
- color: red;
85
- }
84
+ .error {
85
+ color: red;
86
+ }
86
87
 
87
- .hidden {
88
- display: none;
89
- }
90
- `,
88
+ .hidden {
89
+ display: none;
90
+ }
91
+ `;
92
+ },
91
93
  render({ inputs, state, updateState, dispatch, events, slotNames }) {
92
94
  /**
93
95
  * Saved off for use in the image listeners. This is used to eliminate race conditions
@@ -495,7 +495,9 @@ export const ViraJsonForm = defineViraElement()({
495
495
  }
496
496
  const fallback = createDefaultForJsonType(onlyType);
497
497
  const pendingValue = getPendingArrayValue(pathKey, fallback);
498
- const inlineEditor = renderInlineValueEditor(onlyType, pendingValue, (value) => setPendingArrayValue(pathKey, value));
498
+ const inlineEditor = renderInlineValueEditor(onlyType, pendingValue, (value) => {
499
+ return setPendingArrayValue(pathKey, value);
500
+ });
499
501
  return html `
500
502
  ${inlineEditor}
501
503
  ${renderPlusButton({
@@ -960,9 +962,11 @@ export const ViraJsonForm = defineViraElement()({
960
962
  <div class="json-validation-errors">
961
963
  <div>Value does not match schema:</div>
962
964
  <ul>
963
- ${validationErrors.map((errorMessage) => html `
965
+ ${validationErrors.map((errorMessage) => {
966
+ return html `
964
967
  <li>${errorMessage}</li>
965
- `)}
968
+ `;
969
+ })}
966
970
  </ul>
967
971
  </div>
968
972
  </${ViraError}>
@@ -22,34 +22,36 @@ export const ViraLink = defineViraElement()({
22
22
  hostClasses: {
23
23
  'vira-link-link-styles': ({ inputs }) => !inputs.disableLinkStyles,
24
24
  },
25
- styles: ({ hostClasses }) => css `
26
- :host {
27
- display: inline;
28
- text-decoration: underline;
29
- }
30
-
31
- a,
32
- a:visited,
33
- a:active,
34
- a:link,
35
- a:hover {
36
- color: inherit;
37
- text-decoration: inherit;
38
- white-space: inherit;
39
- }
25
+ styles: ({ hostClasses }) => {
26
+ return css `
27
+ :host {
28
+ display: inline;
29
+ text-decoration: underline;
30
+ }
40
31
 
41
- ${hostClasses['vira-link-link-styles'].selector} {
42
- &:hover a,
43
- & a:hover {
44
- color: ${viraTheme.colors['vira-blue-foreground-non-body'].foreground.value};
32
+ a,
33
+ a:visited,
34
+ a:active,
35
+ a:link,
36
+ a:hover {
37
+ color: inherit;
38
+ text-decoration: inherit;
39
+ white-space: inherit;
45
40
  }
46
41
 
47
- &:active a,
48
- & a:active {
49
- color: ${viraTheme.colors['vira-blue-foreground-body'].foreground.value};
42
+ ${hostClasses['vira-link-link-styles'].selector} {
43
+ &:hover a,
44
+ & a:hover {
45
+ color: ${viraTheme.colors['vira-blue-foreground-non-body'].foreground.value};
46
+ }
47
+
48
+ &:active a,
49
+ & a:active {
50
+ color: ${viraTheme.colors['vira-blue-foreground-body'].foreground.value};
51
+ }
50
52
  }
51
- }
52
- `,
53
+ `;
54
+ },
53
55
  init({ state, updateState, host }) {
54
56
  state.cleanupListeners?.();
55
57
  let propagating = false;