@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.70 → 2.0.0-next.72

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 (26) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +5109 -4904
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +195 -2
  4. package/dist/components/alert-menu-item/alert-menu-item.d.ts +39 -1
  5. package/dist/components/alert-menu-item/alert-menu-item.d.ts.map +1 -1
  6. package/dist/components/alert-menu-item/alert-menu-item.js +41 -0
  7. package/dist/components/alert-menu-item/alert-menu-item.js.map +1 -1
  8. package/dist/components/message-menu-item/message-menu-item.d.ts +4 -0
  9. package/dist/components/message-menu-item/message-menu-item.d.ts.map +1 -1
  10. package/dist/components/message-menu-item/message-menu-item.js +10 -0
  11. package/dist/components/message-menu-item/message-menu-item.js.map +1 -1
  12. package/dist/components/textbox/textbox.css.js +114 -0
  13. package/dist/components/textbox/textbox.css.js.map +1 -0
  14. package/dist/components/textbox/textbox.d.ts +70 -0
  15. package/dist/components/textbox/textbox.d.ts.map +1 -0
  16. package/dist/components/textbox/textbox.js +84 -0
  17. package/dist/components/textbox/textbox.js.map +1 -0
  18. package/eslint.config.mjs +2 -7
  19. package/package.json +1 -1
  20. package/src/components/alert-menu-item/alert-menu-item.stories.ts +40 -1
  21. package/src/components/alert-menu-item/alert-menu-item.ts +67 -1
  22. package/src/components/message-menu-item/message-menu-item.stories.ts +18 -0
  23. package/src/components/message-menu-item/message-menu-item.ts +6 -0
  24. package/src/components/textbox/textbox.css +100 -0
  25. package/src/components/textbox/textbox.stories.ts +165 -0
  26. package/src/components/textbox/textbox.ts +103 -0
@@ -37,6 +37,7 @@ export enum ObcMessageMenuItemSize {
37
37
  *
38
38
  * - **Actions:**
39
39
  * - Supports up to two action buttons via `primaryActionLabel` and `secondaryActionLabel`.
40
+ * - Each action can be independently disabled by setting `enablePrimaryAction` or `enableSecondaryAction` to `false`.
40
41
  * - In vertical layout, action buttons expand to full width.
41
42
  *
42
43
  * - **Timestamp:**
@@ -52,6 +53,7 @@ export enum ObcMessageMenuItemSize {
52
53
  * - Use `stackVertical=true` when actions need more prominence or when space is narrow.
53
54
  * - Enable `enhancedIcon` to highlight important or priority messages.
54
55
  * - Use `isShelved` to indicate messages that have been temporarily set aside.
56
+ * - Set `enablePrimaryAction` / `enableSecondaryAction` to `false` when an action is temporarily unavailable (e.g. awaiting a precondition) rather than removing the button.
55
57
  *
56
58
  * ## Slots
57
59
  *
@@ -134,6 +136,8 @@ export class ObcMessageMenuItem extends LitElement {
134
136
  @property({type: String}) time = '';
135
137
  @property({type: String}) primaryActionLabel = '';
136
138
  @property({type: String}) secondaryActionLabel = '';
139
+ @property({type: Boolean, attribute: false}) enablePrimaryAction = true;
140
+ @property({type: Boolean, attribute: false}) enableSecondaryAction = true;
137
141
 
138
142
  // Visibility properties for icons (slots)
139
143
  @property({type: Boolean}) hasPrimaryIcon = false;
@@ -281,6 +285,7 @@ export class ObcMessageMenuItem extends LitElement {
281
285
  variant="normal"
282
286
  .fullWidth=${this.isVertical}
283
287
  @click=${this.handleSecondaryActionClick}
288
+ ?disabled=${!this.enableSecondaryAction}
284
289
  >
285
290
  ${this.secondaryActionLabel}
286
291
  </obc-button>`
@@ -290,6 +295,7 @@ export class ObcMessageMenuItem extends LitElement {
290
295
  variant="normal"
291
296
  .fullWidth=${this.isVertical}
292
297
  @click=${this.handlePrimaryActionClick}
298
+ ?disabled=${!this.enablePrimaryAction}
293
299
  >
294
300
  ${this.hasActionLabelSlot
295
301
  ? html`<slot name="action-label"></slot>`
@@ -0,0 +1,100 @@
1
+ :host {
2
+ display: inline-block;
3
+ line-height: 0;
4
+ }
5
+
6
+ .wrapper {
7
+ display: inline-flex;
8
+ flex-direction: column;
9
+ width: fit-content;
10
+ --height: 24px;
11
+ --padding: 4px;
12
+ font-family: var(--font-family-main);
13
+ letter-spacing: var(--global-typography-generic-l-letter-spacing);
14
+ }
15
+
16
+ /* The inner-wrapper is the box: its height (--height) is the full textbox
17
+ height, padding included. The content is sized to the cap height and
18
+ vertically centered, which leaves the padding as equal space above and
19
+ below. In engines that support text-box-trim the content box collapses to
20
+ the cap height exactly; in Firefox (no text-box-trim) the content keeps its
21
+ natural line box, so align-items:center + overflow:hidden crops it to the
22
+ same height instead. No padding here – the centering provides it.
23
+ (A small top padding could be added later to nudge the text up in Firefox.) */
24
+ .inner-wrapper {
25
+ box-sizing: border-box;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: var(--alignment-justify, flex-end);
29
+ height: var(--height);
30
+ overflow: hidden;
31
+ }
32
+
33
+ /* The spacer must share the content's exact font metrics so the width it
34
+ reserves equals the rendered content width. font-size-adjust scales the
35
+ font, so it has to match too. */
36
+ .content,
37
+ .length-spacer {
38
+ font-size: calc(var(--height) - 2 * var(--padding));
39
+ font-size-adjust: cap-height 1;
40
+ white-space: nowrap;
41
+ }
42
+
43
+ .content {
44
+ text-box-trim: trim-both;
45
+ text-box-edge: cap alphabetic;
46
+ }
47
+
48
+ .wrapper.size-xs .inner-wrapper {
49
+ --height: 16px;
50
+ }
51
+
52
+ .wrapper.size-s .inner-wrapper {
53
+ --height: 20px;
54
+ }
55
+
56
+ .wrapper.size-m .inner-wrapper {
57
+ --height: 24px;
58
+ }
59
+
60
+ .wrapper.size-l .inner-wrapper {
61
+ --height: 32px;
62
+ }
63
+
64
+ .wrapper.size-xl .inner-wrapper {
65
+ --height: 40px;
66
+ }
67
+
68
+ .wrapper.font-weight-regular {
69
+ font-weight: var(--global-typography-generic-l-font-weight-regular);
70
+ }
71
+
72
+ .wrapper.font-weight-semibold {
73
+ font-weight: var(--global-typography-generic-l-font-weight-medium);
74
+ }
75
+
76
+ .wrapper.font-weight-bold {
77
+ font-weight: var(--global-typography-generic-l-font-weight-bold);
78
+ }
79
+
80
+ .wrapper.alignment-left {
81
+ --alignment-justify: flex-start;
82
+ }
83
+
84
+ .wrapper.alignment-center {
85
+ --alignment-justify: center;
86
+ }
87
+
88
+ .wrapper.alignment-right {
89
+ --alignment-justify: flex-end;
90
+ }
91
+
92
+ /* Reserves the box width from the `length` slot without occupying vertical
93
+ space. Acts as a minimum width so the box does not resize as visible
94
+ text changes. */
95
+ .length-spacer {
96
+ height: 0;
97
+ opacity: 0;
98
+ visibility: hidden;
99
+ overflow: hidden;
100
+ }
@@ -0,0 +1,165 @@
1
+ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
+ import {
3
+ ObcTextbox,
4
+ ObcTextboxAlignment,
5
+ ObcTextboxFontWeight,
6
+ ObcTextboxSize,
7
+ } from './textbox.js';
8
+ import './textbox.js';
9
+ import {html} from 'lit';
10
+
11
+ interface TextboxStoryArgs extends Partial<ObcTextbox> {
12
+ content: string;
13
+ length: string;
14
+ }
15
+
16
+ const meta: Meta<TextboxStoryArgs> = {
17
+ title: 'Building Blocks/Textbox',
18
+ tags: ['autodocs', '6.0'],
19
+ component: 'obc-textbox',
20
+ args: {
21
+ size: ObcTextboxSize.m,
22
+ fontWeight: ObcTextboxFontWeight.regular,
23
+ alignment: ObcTextboxAlignment.Right,
24
+ content: '123 ABC',
25
+ length: '1234567 ABC',
26
+ },
27
+ argTypes: {
28
+ size: {
29
+ control: {type: 'radio'},
30
+ options: Object.values(ObcTextboxSize),
31
+ },
32
+ fontWeight: {
33
+ control: {type: 'radio'},
34
+ options: Object.values(ObcTextboxFontWeight),
35
+ },
36
+ alignment: {
37
+ control: {type: 'radio'},
38
+ options: Object.values(ObcTextboxAlignment),
39
+ },
40
+ },
41
+ render: (args) => html`
42
+ <obc-textbox
43
+ .size=${args.size}
44
+ .fontWeight=${args.fontWeight}
45
+ .alignment=${args.alignment}
46
+ >
47
+ <div>${args.content}</div>
48
+ <div slot="length">${args.length}</div>
49
+ </obc-textbox>
50
+ `,
51
+ };
52
+
53
+ export default meta;
54
+ type Story = StoryObj<TextboxStoryArgs>;
55
+
56
+ const labelStyle =
57
+ 'font-size: 12px; color: var(--element-neutral-color, #777);';
58
+ const captionStyle =
59
+ 'font-size: 11px; font-style: italic; max-width: 520px; color: var(--element-neutral-color, #777);';
60
+ const boxOutline = 'outline: 1px solid var(--border-outline-color);';
61
+
62
+ export const Default: Story = {};
63
+
64
+ export const Sizes: Story = {
65
+ render: () => html`
66
+ <div
67
+ style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px;"
68
+ >
69
+ ${Object.values(ObcTextboxSize).map(
70
+ (size) => html`
71
+ <obc-textbox .size=${size}>
72
+ <div>${size.toUpperCase()} – 123 ABC</div>
73
+ </obc-textbox>
74
+ `
75
+ )}
76
+ </div>
77
+ `,
78
+ };
79
+
80
+ export const FontWeights: Story = {
81
+ render: () => html`
82
+ <div
83
+ style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px;"
84
+ >
85
+ ${Object.values(ObcTextboxFontWeight).map(
86
+ (fontWeight) => html`
87
+ <obc-textbox .fontWeight=${fontWeight}>
88
+ <div>${fontWeight} – 123 ABC</div>
89
+ </obc-textbox>
90
+ `
91
+ )}
92
+ </div>
93
+ `,
94
+ };
95
+
96
+ export const Alignments: Story = {
97
+ render: (args) => html`
98
+ <div
99
+ style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px;"
100
+ >
101
+ <div style=${captionStyle}>
102
+ Alignment positions the content within the box when the box is wider
103
+ than the content. The width is determined by whichever is wider: the
104
+ visible content or the reserved length slot.
105
+ </div>
106
+ ${Object.values(ObcTextboxAlignment).map(
107
+ (alignment) => html`
108
+ <div style="display: flex; align-items: center; gap: 12px;">
109
+ <div style="${labelStyle} width: 56px;">${alignment}</div>
110
+ <obc-textbox
111
+ .size=${args.size}
112
+ .fontWeight=${args.fontWeight}
113
+ .alignment=${alignment}
114
+ style=${boxOutline}
115
+ >
116
+ <div>${args.content}</div>
117
+ <div slot="length">${args.length}</div>
118
+ </obc-textbox>
119
+ </div>
120
+ `
121
+ )}
122
+ </div>
123
+ `,
124
+ };
125
+
126
+ export const ReserveSpace: Story = {
127
+ args: {
128
+ content: '5',
129
+ length: '00000',
130
+ },
131
+ render: (args) => html`
132
+ <div
133
+ style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px;"
134
+ >
135
+ <div style=${captionStyle}>
136
+ Content placed in the length slot reserves width invisibly, so the box
137
+ keeps the size of the longest expected value (here "${args.length}")
138
+ even when the visible content is shorter.
139
+ </div>
140
+ <div style="display: flex; align-items: center; gap: 12px;">
141
+ <div style="${labelStyle} width: 104px;">no length slot</div>
142
+ <obc-textbox
143
+ .size=${args.size}
144
+ .fontWeight=${args.fontWeight}
145
+ .alignment=${args.alignment}
146
+ style=${boxOutline}
147
+ >
148
+ <div>${args.content}</div>
149
+ </obc-textbox>
150
+ </div>
151
+ <div style="display: flex; align-items: center; gap: 12px;">
152
+ <div style="${labelStyle} width: 104px;">length: ${args.length}</div>
153
+ <obc-textbox
154
+ .size=${args.size}
155
+ .fontWeight=${args.fontWeight}
156
+ .alignment=${args.alignment}
157
+ style=${boxOutline}
158
+ >
159
+ <div>${args.content}</div>
160
+ <div slot="length">${args.length}</div>
161
+ </obc-textbox>
162
+ </div>
163
+ </div>
164
+ `,
165
+ };
@@ -0,0 +1,103 @@
1
+ import {LitElement, html, unsafeCSS} from 'lit';
2
+ import {customElement} from '../../decorator.js';
3
+ import componentStyle from './textbox.css?inline';
4
+ import {property} from 'lit/decorators.js';
5
+ import {classMap} from 'lit/directives/class-map.js';
6
+
7
+ export enum ObcTextboxAlignment {
8
+ Left = 'left',
9
+ Center = 'center',
10
+ Right = 'right',
11
+ }
12
+
13
+ export enum ObcTextboxSize {
14
+ xs = 'xs',
15
+ s = 's',
16
+ m = 'm',
17
+ l = 'l',
18
+ xl = 'xl',
19
+ }
20
+
21
+ export enum ObcTextboxFontWeight {
22
+ regular = 'regular',
23
+ semibold = 'semibold',
24
+ bold = 'bold',
25
+ }
26
+
27
+ /**
28
+ * `<obc-textbox>` – A text container that renders inline text at a
29
+ * precise, cap-height-trimmed size with configurable alignment and reservable
30
+ * width.
31
+ *
32
+ * Use it to present short, read-only strings – such as values, labels, or
33
+ * units – where vertical metrics must line up exactly across rows and the
34
+ * horizontal footprint should stay stable while the text changes (for example
35
+ * a numeric value that updates frequently). Synonyms: text container, value
36
+ * box, label box.
37
+ *
38
+ * ## Features / Variants
39
+ * - **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box
40
+ * height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving
41
+ * cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable
42
+ * grid.
43
+ * - **Font weight:** `regular` (default), `semibold`, `bold`.
44
+ * - **Alignment:** `left`, `center`, `right` (default) – positions the text
45
+ * within the box's width when the box is wider than the content.
46
+ * - **Reserved width:** content placed in the `length` slot reserves a minimum
47
+ * width invisibly, so the box does not resize as the visible text changes.
48
+ * The box always shows all content – it never crops.
49
+ *
50
+ * ## Usage Guidelines
51
+ * - Pass the longest expected string to the `length` slot (e.g. `"888.8"` or
52
+ * `"Wind speed"`) so the box reserves space and does not jump in width as the
53
+ * visible value updates.
54
+ * - This is a display primitive for static text – use an input component for
55
+ * editable values.
56
+ *
57
+ * ## Slots
58
+ * | Slot | Renders when… | Purpose |
59
+ * |-----------|--------------------|------------------------------------------------------|
60
+ * | (default) | Always | The visible text content. |
61
+ * | `length` | Always (invisible) | Reserves a minimum width based on its content width. |
62
+ *
63
+ * @slot - The visible text content.
64
+ * @slot length - Reserves a minimum width based on its content width.
65
+ */
66
+ @customElement('obc-textbox')
67
+ export class ObcTextbox extends LitElement {
68
+ @property({type: String}) alignment: ObcTextboxAlignment =
69
+ ObcTextboxAlignment.Right;
70
+ @property({type: String}) size: ObcTextboxSize = ObcTextboxSize.m;
71
+ @property({type: String}) fontWeight: ObcTextboxFontWeight =
72
+ ObcTextboxFontWeight.regular;
73
+
74
+ override render() {
75
+ return html`
76
+ <div
77
+ class=${classMap({
78
+ wrapper: true,
79
+ [`alignment-${this.alignment}`]: true,
80
+ [`size-${this.size}`]: true,
81
+ [`font-weight-${this.fontWeight}`]: true,
82
+ })}
83
+ >
84
+ <div class="inner-wrapper">
85
+ <div class="content">
86
+ <slot></slot>
87
+ </div>
88
+ </div>
89
+ <div class="length-spacer" aria-hidden="true">
90
+ <slot name="length"></slot>
91
+ </div>
92
+ </div>
93
+ `;
94
+ }
95
+
96
+ static override styles = unsafeCSS(componentStyle);
97
+ }
98
+
99
+ declare global {
100
+ interface HTMLElementTagNameMap {
101
+ 'obc-textbox': ObcTextbox;
102
+ }
103
+ }