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
@@ -20,112 +20,114 @@ export const ViraTextArea = defineViraElement()({
20
20
  'vira-text-area-padding-horizontal': '12px',
21
21
  'vira-text-area-padding-vertical': '8px',
22
22
  },
23
- styles: ({ hostClasses, cssVars }) => css `
24
- :host {
25
- position: relative;
26
- display: inline-flex;
27
- width: 320px;
28
- box-sizing: border-box;
29
- color: ${viraFormCssVars['vira-form-foreground-color'].value};
30
- }
31
-
32
- label {
33
- display: flex;
34
- flex-direction: column;
35
- justify-content: flex-start;
36
- gap: 2px;
37
- width: 100%;
38
- max-width: 100%;
39
- cursor: text;
40
-
41
- & .text-area-label {
42
- font-weight: ${viraFormCssVars['vira-form-label-font-weight'].value};
43
- text-align: left;
44
- flex-shrink: 0;
45
- flex-wrap: wrap;
23
+ styles: ({ hostClasses, cssVars }) => {
24
+ return css `
25
+ :host {
26
+ position: relative;
27
+ display: inline-flex;
28
+ width: 320px;
29
+ box-sizing: border-box;
30
+ color: ${viraFormCssVars['vira-form-foreground-color'].value};
46
31
  }
47
- }
48
32
 
49
- .text-area-wrapper {
50
- position: relative;
51
- display: inline-flex;
52
- width: 100%;
53
- max-width: 100%;
54
- box-sizing: border-box;
55
- }
56
-
57
- textarea {
58
- ${noNativeFormStyles};
59
- overscroll-behavior: contain;
60
- font: inherit;
61
- cursor: text;
62
- width: 100%;
63
- box-sizing: border-box;
64
- padding: ${cssVars['vira-text-area-padding-vertical'].value}
65
- ${cssVars['vira-text-area-padding-horizontal'].value};
66
- border-radius: ${viraFormCssVars['vira-form-radius'].value};
67
- background-color: ${viraFormCssVars['vira-form-background-color'].value};
68
- border: 1px solid ${viraFormCssVars['vira-form-border-color'].value};
69
- color: inherit;
70
- resize: vertical;
71
- outline: none;
72
-
73
- &::placeholder {
74
- color: ${viraFormCssVars['vira-form-placeholder-color'].value};
33
+ label {
34
+ display: flex;
35
+ flex-direction: column;
36
+ justify-content: flex-start;
37
+ gap: 2px;
38
+ width: 100%;
39
+ max-width: 100%;
40
+ cursor: text;
41
+
42
+ & .text-area-label {
43
+ font-weight: ${viraFormCssVars['vira-form-label-font-weight'].value};
44
+ text-align: left;
45
+ flex-shrink: 0;
46
+ flex-wrap: wrap;
47
+ }
75
48
  }
76
49
 
77
- &::selection {
78
- background: ${viraFormCssVars['vira-form-text-selection-color'].value};
50
+ .text-area-wrapper {
51
+ position: relative;
52
+ display: inline-flex;
53
+ width: 100%;
54
+ max-width: 100%;
55
+ box-sizing: border-box;
79
56
  }
80
57
 
81
- &:focus:focus-visible:not([disabled]) ~ .focus-border {
82
- ${createFocusStyles({
83
- elementBorderSize: '1px',
84
- noNesting: true,
85
- })}
58
+ textarea {
59
+ ${noNativeFormStyles};
60
+ overscroll-behavior: contain;
61
+ font: inherit;
62
+ cursor: text;
63
+ width: 100%;
64
+ box-sizing: border-box;
65
+ padding: ${cssVars['vira-text-area-padding-vertical'].value}
66
+ ${cssVars['vira-text-area-padding-horizontal'].value};
67
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
68
+ background-color: ${viraFormCssVars['vira-form-background-color'].value};
69
+ border: 1px solid ${viraFormCssVars['vira-form-border-color'].value};
70
+ color: inherit;
71
+ resize: vertical;
72
+ outline: none;
73
+
74
+ &::placeholder {
75
+ color: ${viraFormCssVars['vira-form-placeholder-color'].value};
76
+ }
77
+
78
+ &::selection {
79
+ background: ${viraFormCssVars['vira-form-text-selection-color'].value};
80
+ }
81
+
82
+ &:focus:focus-visible:not([disabled]) ~ .focus-border {
83
+ ${createFocusStyles({
84
+ elementBorderSize: '1px',
85
+ noNesting: true,
86
+ })}
87
+ }
86
88
  }
87
- }
88
-
89
- .border-style {
90
- position: absolute;
91
- top: 0;
92
- left: 0;
93
- width: 100%;
94
- height: 100%;
95
- border-radius: ${viraFormCssVars['vira-form-radius'].value};
96
- z-index: 0;
97
- pointer-events: none;
98
- }
99
89
 
100
- .readonly-value {
101
- white-space: pre-wrap;
102
- overflow-wrap: anywhere;
103
- }
90
+ .border-style {
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ width: 100%;
95
+ height: 100%;
96
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
97
+ z-index: 0;
98
+ pointer-events: none;
99
+ }
104
100
 
105
- ${hostClasses['vira-text-area-prevent-resize'].selector} textarea {
106
- resize: none;
107
- }
101
+ .readonly-value {
102
+ white-space: pre-wrap;
103
+ overflow-wrap: anywhere;
104
+ }
108
105
 
109
- ${hostClasses['vira-text-area-error'].selector} textarea {
110
- border-color: ${viraFormCssVars['vira-form-error-color'].value};
111
- }
106
+ ${hostClasses['vira-text-area-prevent-resize'].selector} textarea {
107
+ resize: none;
108
+ }
112
109
 
113
- ${hostClasses['vira-text-area-disabled'].selector} {
114
- cursor: not-allowed;
110
+ ${hostClasses['vira-text-area-error'].selector} textarea {
111
+ border-color: ${viraFormCssVars['vira-form-error-color'].value};
112
+ }
115
113
 
116
- & * {
114
+ ${hostClasses['vira-text-area-disabled'].selector} {
117
115
  cursor: not-allowed;
118
- }
119
116
 
120
- & > * {
121
- ${viraDisabledStyles};
122
- }
117
+ & * {
118
+ cursor: not-allowed;
119
+ }
120
+
121
+ & > * {
122
+ ${viraDisabledStyles};
123
+ }
123
124
 
124
- & .focus-border {
125
- display: none;
125
+ & .focus-border {
126
+ display: none;
127
+ }
126
128
  }
127
- }
128
- `,
129
+ `;
130
+ },
129
131
  events: {
130
132
  /**
131
133
  * Fires whenever a user input created a new value. Does not fire if all input letters are
@@ -14,11 +14,13 @@ function setSvgAttribute({ svgString, attributeName, value, }) {
14
14
  : svgString.replace(/<svg\b/, `<svg ${attributeName}="${value}"`);
15
15
  }
16
16
  function applySvgAttributes(svgString, attributes) {
17
- return Object.entries(attributes).reduce((result, [key, value,]) => setSvgAttribute({
18
- svgString: result,
19
- attributeName: key,
20
- value,
21
- }), svgString);
17
+ return Object.entries(attributes).reduce((result, [key, value,]) => {
18
+ return setSvgAttribute({
19
+ svgString: result,
20
+ attributeName: key,
21
+ value,
22
+ });
23
+ }, svgString);
22
24
  }
23
25
  function isLucideIconKey(key) {
24
26
  return key in lucideStaticImport;
@@ -5,10 +5,12 @@ function doesMatch({ input, matcher }) {
5
5
  return true;
6
6
  }
7
7
  else if (input.length > 1) {
8
- return input.split('').every((singleInput) => doesMatch({
9
- input: singleInput,
10
- matcher,
11
- }));
8
+ return input.split('').every((singleInput) => {
9
+ return doesMatch({
10
+ input: singleInput,
11
+ matcher,
12
+ });
13
+ });
12
14
  }
13
15
  else if (matcher instanceof RegExp) {
14
16
  return !!input.match(matcher);
@@ -1,5 +1,5 @@
1
1
  import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { type FullDate } from 'date-vir';
2
+ import { type FullDate, type Timezone } from 'date-vir';
3
3
  import { type HtmlInterpolation } from 'element-vir';
4
4
  import { type ViraIconSvg } from '../icons/icon-svg.js';
5
5
  import { type ViraSelectOption } from './vira-select-option.js';
@@ -115,7 +115,7 @@ export type ViraFormField = ({
115
115
  /** Upper bound for selectable dates. Defaults to 10 years from now when omitted. */
116
116
  max: FullDate;
117
117
  /** Timezone used to interpret the selected date. Defaults to the user's timezone. */
118
- timezone: string;
118
+ timezone: Timezone;
119
119
  /** Only show the date part of the selected date when in readonly mode. */
120
120
  showDateOnly: boolean;
121
121
  /** Only show the time part of the selected date when in readonly mode. */
@@ -174,10 +174,12 @@ export function expandSchemaBranches(schema, context) {
174
174
  if (branches.length === 0) {
175
175
  return [resolved];
176
176
  }
177
- return branches.flatMap((branch) => expandSchemaBranches(branch, {
178
- root: context.root,
179
- seenRefs: context.seenRefs,
180
- }));
177
+ return branches.flatMap((branch) => {
178
+ return expandSchemaBranches(branch, {
179
+ root: context.root,
180
+ seenRefs: context.seenRefs,
181
+ });
182
+ });
181
183
  }
182
184
  /**
183
185
  * Computes the set of JSON types that a given schema allows.
@@ -538,10 +540,12 @@ function validateBranch({ value, branch, path, context, errors, }) {
538
540
  return;
539
541
  }
540
542
  if ('enum' in branch && check.isArray(branch.enum)) {
541
- const matched = branch.enum.some((entry) => deepEqualsJson({
542
- a: value,
543
- b: entry,
544
- }));
543
+ const matched = branch.enum.some((entry) => {
544
+ return deepEqualsJson({
545
+ a: value,
546
+ b: entry,
547
+ });
548
+ });
545
549
  if (!matched) {
546
550
  errors.push(`${formatPathLabel(path)} must be one of the enum values.`);
547
551
  return;
@@ -625,10 +629,12 @@ function deepEqualsJson({ a, b }) {
625
629
  }
626
630
  else if (check.isArray(a) && check.isArray(b)) {
627
631
  return (a.length === b.length &&
628
- a.every((entry, i) => deepEqualsJson({
629
- a: entry,
630
- b: b[i] ?? null,
631
- })));
632
+ a.every((entry, i) => {
633
+ return deepEqualsJson({
634
+ a: entry,
635
+ b: b[i] ?? null,
636
+ });
637
+ }));
632
638
  }
633
639
  else if (check.isObject(a) && check.isObject(b)) {
634
640
  const aKeys = Object.keys(a);
@@ -636,10 +642,12 @@ function deepEqualsJson({ a, b }) {
636
642
  if (aKeys.length !== bKeys.length) {
637
643
  return false;
638
644
  }
639
- return aKeys.every((key) => deepEqualsJson({
640
- a: a[key] ?? null,
641
- b: b[key] ?? null,
642
- }));
645
+ return aKeys.every((key) => {
646
+ return deepEqualsJson({
647
+ a: a[key] ?? null,
648
+ b: b[key] ?? null,
649
+ });
650
+ });
643
651
  }
644
652
  else {
645
653
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "31.31.0",
3
+ "version": "31.31.2",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",
@@ -38,36 +38,36 @@
38
38
  "test:docs": "virmator docs check"
39
39
  },
40
40
  "dependencies": {
41
- "@augment-vir/assert": "^32.2.1",
42
- "@augment-vir/common": "^32.2.1",
43
- "@augment-vir/web": "^32.2.1",
41
+ "@augment-vir/assert": "^32.2.2",
42
+ "@augment-vir/common": "^32.2.2",
43
+ "@augment-vir/web": "^32.2.2",
44
44
  "@electrovir/color": "^1.7.11",
45
45
  "@electrovir/local-storage-client": "^0.1.1",
46
- "date-vir": "^8.6.2",
46
+ "date-vir": "^9.1.0",
47
47
  "device-navigation": "^4.7.3",
48
48
  "json-schema-to-ts": "^3.1.1",
49
49
  "lit-css-vars": "^3.6.3",
50
- "object-shape-tester": "^6.14.1",
50
+ "object-shape-tester": "^6.15.0",
51
51
  "observavir": "^2.3.3",
52
52
  "page-active": "^1.0.4",
53
53
  "spa-router-vir": "^6.6.1",
54
- "typed-event-target": "^4.3.2"
54
+ "typed-event-target": "^4.3.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@augment-vir/test": "^32.2.1",
57
+ "@augment-vir/test": "^32.2.2",
58
58
  "@web/dev-server-esbuild": "^2.0.0",
59
59
  "@web/test-runner": "^1.0.0",
60
60
  "@web/test-runner-commands": "^1.0.1",
61
61
  "@web/test-runner-playwright": "^1.0.0",
62
62
  "@web/test-runner-visual-regression": "^1.0.1",
63
- "esbuild": "^0.28.1",
63
+ "esbuild": "^0.28.2",
64
64
  "istanbul-smart-text-reporter": "^1.1.5",
65
- "lucide-static": "^1.26.0",
65
+ "lucide-static": "^1.31.0",
66
66
  "markdown-code-example-inserter": "^3.0.6",
67
67
  "theme-vir": "^28.25.1",
68
68
  "typedoc": "^0.28.20",
69
69
  "typescript": "^6.0.3",
70
- "vite": "^8.1.5",
70
+ "vite": "^8.2.1",
71
71
  "vite-tsconfig-paths": "^6.1.1"
72
72
  },
73
73
  "peerDependencies": {