vira 29.7.2 → 29.8.0

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.
@@ -6,13 +6,13 @@ import { type ViraFormField, type ViraFormFields } from './vira-form-fields.js';
6
6
  * @category Elements
7
7
  * @see https://electrovir.github.io/vira/book/elements/vira-form
8
8
  */
9
- export declare const ViraForm: import("element-vir").DeclarativeElementDefinition<"vira-form", Readonly<{
9
+ export declare const ViraForm: import("element-vir").DeclarativeElementDefinition<"vira-form", {
10
10
  fields: Readonly<ViraFormFields>;
11
11
  } & PartialWithUndefined<{
12
12
  showClearButtons: boolean;
13
13
  /**
14
- * When `true`, all fields in this form are disabled. Note that this will not (and can
15
- * not) disable any child elements you've inserted via <slot>.
14
+ * When `true`, all fields in this form are disabled. Note that this will not (and can not)
15
+ * disable any child elements you've inserted via <slot>.
16
16
  *
17
17
  * @default false
18
18
  */
@@ -23,7 +23,7 @@ export declare const ViraForm: import("element-vir").DeclarativeElementDefinitio
23
23
  * @default false
24
24
  */
25
25
  hideRequiredMarkers: boolean;
26
- }>>, {
26
+ }>, {
27
27
  lastIsValid: boolean;
28
28
  }, {
29
29
  valueChange: import("element-vir").DefineEvent<{
@@ -12,6 +12,7 @@ export * from './vira-bold-text.element.js';
12
12
  export * from './vira-button.element.js';
13
13
  export * from './vira-card.element.js';
14
14
  export * from './vira-checkbox.element.js';
15
+ export * from './vira-collapsible-card.element.js';
15
16
  export * from './vira-collapsible-wrapper.element.js';
16
17
  export * from './vira-dropdown.element.js';
17
18
  export * from './vira-error.element.js';
@@ -12,6 +12,7 @@ export * from './vira-bold-text.element.js';
12
12
  export * from './vira-button.element.js';
13
13
  export * from './vira-card.element.js';
14
14
  export * from './vira-checkbox.element.js';
15
+ export * from './vira-collapsible-card.element.js';
15
16
  export * from './vira-collapsible-wrapper.element.js';
16
17
  export * from './vira-dropdown.element.js';
17
18
  export * from './vira-error.element.js';
@@ -6,14 +6,14 @@ import { type MenuItem } from './pop-up-menu-item.js';
6
6
  * @category PopUp
7
7
  * @category Elements
8
8
  */
9
- export declare const ViraMenuItem: import("element-vir").DeclarativeElementDefinition<"vira-menu-item", Readonly<{
9
+ export declare const ViraMenuItem: import("element-vir").DeclarativeElementDefinition<"vira-menu-item", {
10
10
  selected: boolean;
11
11
  } & PartialWithUndefined<{
12
12
  /**
13
- * The text to show in the menu item. If this is not provided, it is expected that you
14
- * will instead utilize this element's `<slot>`.
13
+ * The text to show in the menu item. If this is not provided, it is expected that you will
14
+ * instead utilize this element's `<slot>`.
15
15
  */
16
16
  label: MenuItem["label"];
17
17
  /** If `true`, does not render the selected check icon. */
18
18
  hideCheckIcon: boolean;
19
- }>>, {}, {}, "vira-menu-item-selected", "vira-menu-item-", readonly [], readonly []>;
19
+ }>, {}, {}, "vira-menu-item-selected", "vira-menu-item-", readonly [], readonly []>;
@@ -17,10 +17,10 @@ export declare const viraMenuTestIds: {
17
17
  * @category PopUp
18
18
  * @category Elements
19
19
  */
20
- export declare const ViraMenu: import("element-vir").DeclarativeElementDefinition<"vira-menu", Readonly<{
20
+ export declare const ViraMenu: import("element-vir").DeclarativeElementDefinition<"vira-menu", {
21
21
  /**
22
- * The parent nav controller for this menu. If none is provided, an internal nav
23
- * controller is created (which means it can't be hooked into by external elements).
22
+ * The parent nav controller for this menu. If none is provided, an internal nav controller
23
+ * is created (which means it can't be hooked into by external elements).
24
24
  *
25
25
  * It is recommended to not leave this `undefined`.
26
26
  */
@@ -33,6 +33,6 @@ export declare const ViraMenu: import("element-vir").DeclarativeElementDefinitio
33
33
  isMultiSelect: boolean;
34
34
  /** Hide menu item check mark icons. */
35
35
  hideCheckIcons: boolean;
36
- }>>, {
36
+ }>, {
37
37
  internalNavController: NavController;
38
38
  }, {}, "vira-menu-multiselect", "vira-menu-", readonly [], readonly []>;
@@ -0,0 +1,36 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ /**
3
+ * A combination ViraCard and ViraCollapsibleWrapper with a collapse caret.
4
+ *
5
+ * @category Elements
6
+ * @see https://electrovir.github.io/vira/book/elements/vira-checkbox
7
+ */
8
+ export declare const ViraCollapsibleCard: import("element-vir").DeclarativeElementDefinition<"vira-collapsible-card", PartialWithUndefined<{
9
+ /**
10
+ * When set to `true`, the card styles are diminished so you can still use this element in
11
+ * more flexible ways.
12
+ *
13
+ * @default false
14
+ */
15
+ rawCollapsible: boolean;
16
+ startExpanded: boolean;
17
+ /**
18
+ * If set to true, the card will always be expanded, expansion cannot be toggled, and the
19
+ * expand toggle icon is hidden.
20
+ *
21
+ * @default false
22
+ */
23
+ blockExpansion: boolean;
24
+ /** When true, forces the content to expand when printing regardless of collapsed state. */
25
+ expandOnPrint: boolean;
26
+ /**
27
+ * When set to `true`, the header is hidden.
28
+ *
29
+ * @default false
30
+ */
31
+ hideHeader: boolean;
32
+ }>, {
33
+ isExpanded: boolean;
34
+ }, {
35
+ expandToggle: import("element-vir").DefineEvent<boolean>;
36
+ }, "vira-collapsible-card-expanded" | "vira-collapsible-card-expansion-blocked" | "vira-collapsible-card-card-styles", "vira-collapsible-card-", readonly ["header"], readonly ["openCaret"]>;
@@ -0,0 +1,162 @@
1
+ import { css, defineElementEvent, html, listen, nothing, testId } from 'element-vir';
2
+ import { ChevronUp24Icon } from '../icons/index.js';
3
+ import { viraFormCssVars } from '../styles/form-styles.js';
4
+ import { defineViraElement } from './define-vira-element.js';
5
+ import { ViraCollapsibleWrapper } from './vira-collapsible-wrapper.element.js';
6
+ import { ViraIcon } from './vira-icon.element.js';
7
+ /**
8
+ * A combination ViraCard and ViraCollapsibleWrapper with a collapse caret.
9
+ *
10
+ * @category Elements
11
+ * @see https://electrovir.github.io/vira/book/elements/vira-checkbox
12
+ */
13
+ export const ViraCollapsibleCard = defineViraElement()({
14
+ tagName: 'vira-collapsible-card',
15
+ testIds: ['openCaret'],
16
+ events: {
17
+ expandToggle: defineElementEvent(),
18
+ },
19
+ state({ inputs }) {
20
+ return {
21
+ isExpanded: !!inputs.startExpanded,
22
+ };
23
+ },
24
+ hostClasses: {
25
+ 'vira-collapsible-card-expanded': ({ state }) => state.isExpanded,
26
+ 'vira-collapsible-card-expansion-blocked': ({ inputs }) => !!inputs.blockExpansion,
27
+ 'vira-collapsible-card-card-styles': ({ inputs }) => !inputs.rawCollapsible,
28
+ },
29
+ styles: ({ hostClasses }) => css `
30
+ :host {
31
+ display: inline-flex;
32
+ }
33
+
34
+ ${hostClasses['vira-collapsible-card-expanded'].selector} .open-caret {
35
+ transform: rotate(180deg);
36
+ }
37
+
38
+ ${ViraCollapsibleWrapper} {
39
+ flex-grow: 1;
40
+ max-width: 100%;
41
+ }
42
+
43
+ ${hostClasses['vira-collapsible-card-card-styles'].selector} {
44
+ & ${ViraCollapsibleWrapper} {
45
+ border: 1px solid ${viraFormCssVars['vira-form-border-color'].value};
46
+ border-radius: ${viraFormCssVars['vira-form-wrapper-radius'].value};
47
+ }
48
+
49
+ & .card-header {
50
+ padding: 8px 16px;
51
+ }
52
+
53
+ & .card-content {
54
+ padding: 8px 16px 8px 16px;
55
+ }
56
+ }
57
+
58
+ ${hostClasses['vira-collapsible-card-expansion-blocked'].selector} {
59
+ & .header-wrapper {
60
+ cursor: default;
61
+ }
62
+ }
63
+
64
+ .card-header {
65
+ font-weight: bold;
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: space-between;
69
+ gap: 8px;
70
+
71
+ & .header-filler {
72
+ flex-grow: 1;
73
+ }
74
+ }
75
+
76
+ .card-content {
77
+ display: flex;
78
+ flex-direction: column;
79
+ align-items: stretch;
80
+ gap: 32px;
81
+ overflow-x: auto;
82
+ overflow-y: hidden;
83
+ }
84
+
85
+ @media print {
86
+ ${ViraCollapsibleWrapper} {
87
+ border: none !important;
88
+ }
89
+
90
+ .card-header {
91
+ padding: 8px 0 !important;
92
+ }
93
+
94
+ .card-content {
95
+ overflow: visible !important;
96
+ padding: 8px 0 16px 0 !important;
97
+ }
98
+
99
+ .open-caret {
100
+ display: none;
101
+ }
102
+ }
103
+ `,
104
+ slotNames: [
105
+ 'header',
106
+ ],
107
+ render({ inputs, slotNames, state, updateState, testIds, dispatch, events }) {
108
+ if (inputs.blockExpansion) {
109
+ updateState({
110
+ isExpanded: true,
111
+ });
112
+ }
113
+ const wrapperContentTemplate = state.isExpanded || inputs.expandOnPrint
114
+ ? html `
115
+ <div class="card-content">
116
+ <slot></slot>
117
+ </div>
118
+ `
119
+ : nothing;
120
+ const wrapperHeaderTemplate = inputs.hideHeader
121
+ ? nothing
122
+ : html `
123
+ <div class="card-header">
124
+ <slot name=${slotNames.header}><div class="header-filler"></div></slot>
125
+
126
+ ${inputs.blockExpansion
127
+ ? nothing
128
+ : html `
129
+ <${ViraIcon.assign({
130
+ icon: ChevronUp24Icon,
131
+ fitContainer: true,
132
+ })}
133
+ ${testId(testIds.openCaret)}
134
+ class="open-caret"
135
+ ></${ViraIcon}>
136
+ `}
137
+ </div>
138
+ `;
139
+ return html `
140
+ <${ViraCollapsibleWrapper.assign({
141
+ expanded: state.isExpanded,
142
+ expandOnPrint: inputs.expandOnPrint ?? false,
143
+ })}
144
+ ${listen(ViraCollapsibleWrapper.events.expandChange, (event) => {
145
+ event.stopImmediatePropagation();
146
+ if (inputs.blockExpansion) {
147
+ return;
148
+ }
149
+ updateState({
150
+ isExpanded: event.detail,
151
+ });
152
+ dispatch(new events.expandToggle(event.detail));
153
+ })}
154
+ >
155
+ <div class="header-wrapper" slot=${ViraCollapsibleWrapper.slotNames.header}>
156
+ ${wrapperHeaderTemplate}
157
+ </div>
158
+ ${wrapperContentTemplate}
159
+ </${ViraCollapsibleWrapper}>
160
+ `;
161
+ },
162
+ });
@@ -20,7 +20,7 @@ export declare enum ViraInputType {
20
20
  * @category Elements
21
21
  * @see https://electrovir.github.io/vira/book/elements/vira-input
22
22
  */
23
- export declare const ViraInput: import("element-vir").DeclarativeElementDefinition<"vira-input", Readonly<PartialWithUndefined<{
23
+ export declare const ViraInput: import("element-vir").DeclarativeElementDefinition<"vira-input", PartialWithUndefined<{
24
24
  icon: Pick<ViraIconSvg, "svgTemplate">;
25
25
  /** A suffix that, if provided, is shown following the input field. */
26
26
  suffix: string;
@@ -40,7 +40,7 @@ export declare const ViraInput: import("element-vir").DeclarativeElementDefiniti
40
40
  disableBrowserHelps: boolean;
41
41
  fitText: boolean;
42
42
  attributePassthrough: import("element-vir").AttributeValues;
43
- }>>, {
43
+ }>, {
44
44
  forcedInputWidth: number;
45
45
  showPassword: boolean;
46
46
  /**
@@ -5,7 +5,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
5
5
  * @category Elements
6
6
  * @see https://electrovir.github.io/vira/book/elements/vira-modal
7
7
  */
8
- export declare const ViraModal: import("element-vir").DeclarativeElementDefinition<"vira-modal", Readonly<{
8
+ export declare const ViraModal: import("element-vir").DeclarativeElementDefinition<"vira-modal", {
9
9
  open: boolean;
10
10
  } & PartialWithUndefined<{
11
11
  /** If this isn't set, make sure to use the modal title slot to fill it in. */
@@ -28,7 +28,7 @@ export declare const ViraModal: import("element-vir").DeclarativeElementDefiniti
28
28
  blockLightDismissal: boolean;
29
29
  modalSubtitle: string;
30
30
  isMobileSize: boolean;
31
- }>>, {
31
+ }>, {
32
32
  dialogElement: HTMLDialogElement | undefined;
33
33
  contentElement: HTMLDivElement | undefined;
34
34
  previousOpenValue: undefined | boolean;
@@ -4,7 +4,7 @@
4
4
  * @category Elements
5
5
  * @see https://electrovir.github.io/vira/book/elements/vira-overflow-switch
6
6
  */
7
- export declare const ViraOverflowSwitch: import("element-vir").DeclarativeElementDefinition<"vira-overflow-switch", Readonly<((Required<Pick<{
7
+ export declare const ViraOverflowSwitch: import("element-vir").DeclarativeElementDefinition<"vira-overflow-switch", ((Required<Pick<{
8
8
  automaticallySwitch: boolean;
9
9
  useSmall: boolean;
10
10
  }, "automaticallySwitch">> & Partial<Record<"useSmall", never>>) | (Required<Pick<{
@@ -13,7 +13,7 @@ export declare const ViraOverflowSwitch: import("element-vir").DeclarativeElemen
13
13
  }, "useSmall">> & Partial<Record<"automaticallySwitch", never>>)) & Omit<{
14
14
  automaticallySwitch: boolean;
15
15
  useSmall: boolean;
16
- }, "automaticallySwitch" | "useSmall">>, {
16
+ }, "automaticallySwitch" | "useSmall">, {
17
17
  isOverflowing: boolean;
18
18
  resizeObserver: undefined | ResizeObserver;
19
19
  /** Called on cleanup to clear all listeners. */
@@ -8,11 +8,11 @@ import { type PartialWithUndefined } from '@augment-vir/common';
8
8
  * @category Elements
9
9
  * @see https://electrovir.github.io/vira/book/elements/vira-progress
10
10
  */
11
- export declare const ViraProgress: import("element-vir").DeclarativeElementDefinition<"vira-progress", Readonly<{
11
+ export declare const ViraProgress: import("element-vir").DeclarativeElementDefinition<"vira-progress", {
12
12
  value: number;
13
13
  } & PartialWithUndefined<{
14
14
  /** @default 0 */
15
15
  min: number;
16
16
  /** @default 100 */
17
17
  max: number;
18
- }>>, {}, {}, "vira-progress-", "vira-progress-border-radius", readonly [], readonly []>;
18
+ }>, {}, {}, "vira-progress-", "vira-progress-border-radius", readonly [], readonly []>;
@@ -22,7 +22,7 @@ export type ViraSelectOption = {
22
22
  * @category Elements
23
23
  * @see https://electrovir.github.io/vira/book/elements/vira-select
24
24
  */
25
- export declare const ViraSelect: import("element-vir").DeclarativeElementDefinition<"vira-select", Readonly<{
25
+ export declare const ViraSelect: import("element-vir").DeclarativeElementDefinition<"vira-select", {
26
26
  options: ReadonlyArray<Readonly<ViraSelectOption>>;
27
27
  /** The currently selected option value. */
28
28
  value: undefined | string;
@@ -39,7 +39,7 @@ export declare const ViraSelect: import("element-vir").DeclarativeElementDefinit
39
39
  option: AttributeValues;
40
40
  }>>;
41
41
  hasError: boolean;
42
- }>>, {
42
+ }>, {
43
43
  /**
44
44
  * Used to couple the label and select together. This is not applied if no label is
45
45
  * provided.
@@ -8,7 +8,7 @@ import { ViraColorVariant, ViraEmphasis, ViraSize } from '../styles/form-variant
8
8
  * @category Elements
9
9
  * @see https://electrovir.github.io/vira/book/elements/vira-tag
10
10
  */
11
- export declare const ViraTag: import("element-vir").DeclarativeElementDefinition<"vira-tag", Readonly<{
11
+ export declare const ViraTag: import("element-vir").DeclarativeElementDefinition<"vira-tag", {
12
12
  text: Primitive;
13
13
  } & PartialWithUndefined<{
14
14
  isClickable: RequireExactlyOne<{
@@ -29,7 +29,7 @@ export declare const ViraTag: import("element-vir").DeclarativeElementDefinition
29
29
  /** @default ViraColor.Accent */
30
30
  color: ViraColorVariant;
31
31
  disabled: boolean;
32
- }>>, {}, {
32
+ }>, {}, {
33
33
  toggle: import("element-vir").DefineEvent<boolean>;
34
34
  cancel: import("element-vir").DefineEvent<void>;
35
35
  }, "vira-tag-selectable" | "vira-tag-checked" | "vira-tag-not-checked" | "vira-tag-cancellable" | "vira-tag-not-clickable" | "vira-tag-disabled" | "vira-tag-size-large" | "vira-tag-size-medium" | "vira-tag-size-small" | "vira-tag-emphasis-standard" | "vira-tag-emphasis-subtle" | "vira-tag-color-accent" | "vira-tag-color-plain" | "vira-tag-color-neutral" | "vira-tag-color-danger" | "vira-tag-color-warning" | "vira-tag-color-positive", "vira-tag-text-color" | "vira-tag-background-color" | "vira-tag-border-radius" | "vira-tag-gap" | "vira-tag-horizontal-padding" | "vira-tag-border-width", readonly [], readonly []>;
@@ -127,6 +127,7 @@ export const ViraTag = defineViraElement()({
127
127
 
128
128
  button {
129
129
  ${noNativeFormStyles}
130
+ flex-shrink: 0;
130
131
  cursor: pointer;
131
132
  display: flex;
132
133
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "29.7.2",
3
+ "version": "29.8.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",