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

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.
@@ -63955,6 +63955,100 @@
63955
63955
  }
63956
63956
  ]
63957
63957
  },
63958
+ {
63959
+ "kind": "javascript-module",
63960
+ "path": "src/components/textbox/textbox.ts",
63961
+ "declarations": [
63962
+ {
63963
+ "kind": "class",
63964
+ "description": "`<obc-textbox>` – A text container that renders inline text at a\nprecise, cap-height-trimmed size with configurable alignment and reservable\nwidth.\n\nUse it to present short, read-only strings – such as values, labels, or\nunits – where vertical metrics must line up exactly across rows and the\nhorizontal footprint should stay stable while the text changes (for example\na numeric value that updates frequently). Synonyms: text container, value\nbox, label box.\n\n## Features / Variants\n- **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box\n height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving\n cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable\n grid.\n- **Font weight:** `regular` (default), `semibold`, `bold`.\n- **Alignment:** `left`, `center`, `right` (default) – positions the text\n within the box's width when the box is wider than the content.\n- **Reserved width:** content placed in the `length` slot reserves a minimum\n width invisibly, so the box does not resize as the visible text changes.\n The box always shows all content – it never crops.\n\n## Usage Guidelines\n- Pass the longest expected string to the `length` slot (e.g. `\"888.8\"` or\n `\"Wind speed\"`) so the box reserves space and does not jump in width as the\n visible value updates.\n- This is a display primitive for static text – use an input component for\n editable values.\n\n## Slots\n| Slot | Renders when… | Purpose |\n|-----------|--------------------|------------------------------------------------------|\n| (default) | Always | The visible text content. |\n| `length` | Always (invisible) | Reserves a minimum width based on its content width. |",
63965
+ "name": "ObcTextbox",
63966
+ "slots": [
63967
+ {
63968
+ "description": "The visible text content.",
63969
+ "name": ""
63970
+ },
63971
+ {
63972
+ "description": "Reserves a minimum width based on its content width.",
63973
+ "name": "length"
63974
+ }
63975
+ ],
63976
+ "members": [
63977
+ {
63978
+ "kind": "field",
63979
+ "name": "alignment",
63980
+ "type": {
63981
+ "text": "ObcTextboxAlignment"
63982
+ },
63983
+ "attribute": "alignment"
63984
+ },
63985
+ {
63986
+ "kind": "field",
63987
+ "name": "size",
63988
+ "type": {
63989
+ "text": "ObcTextboxSize"
63990
+ },
63991
+ "attribute": "size"
63992
+ },
63993
+ {
63994
+ "kind": "field",
63995
+ "name": "fontWeight",
63996
+ "type": {
63997
+ "text": "ObcTextboxFontWeight"
63998
+ },
63999
+ "attribute": "fontWeight"
64000
+ }
64001
+ ],
64002
+ "attributes": [
64003
+ {
64004
+ "name": "alignment",
64005
+ "type": {
64006
+ "text": "ObcTextboxAlignment"
64007
+ },
64008
+ "fieldName": "alignment"
64009
+ },
64010
+ {
64011
+ "name": "size",
64012
+ "type": {
64013
+ "text": "ObcTextboxSize"
64014
+ },
64015
+ "fieldName": "size"
64016
+ },
64017
+ {
64018
+ "name": "fontWeight",
64019
+ "type": {
64020
+ "text": "ObcTextboxFontWeight"
64021
+ },
64022
+ "fieldName": "fontWeight"
64023
+ }
64024
+ ],
64025
+ "superclass": {
64026
+ "name": "LitElement",
64027
+ "package": "lit"
64028
+ },
64029
+ "tagName": "obc-textbox",
64030
+ "customElement": true
64031
+ }
64032
+ ],
64033
+ "exports": [
64034
+ {
64035
+ "kind": "js",
64036
+ "name": "ObcTextbox",
64037
+ "declaration": {
64038
+ "name": "ObcTextbox",
64039
+ "module": "src/components/textbox/textbox.ts"
64040
+ }
64041
+ },
64042
+ {
64043
+ "kind": "custom-element-definition",
64044
+ "name": "obc-textbox",
64045
+ "declaration": {
64046
+ "name": "ObcTextbox",
64047
+ "module": "src/components/textbox/textbox.ts"
64048
+ }
64049
+ }
64050
+ ]
64051
+ },
63958
64052
  {
63959
64053
  "kind": "javascript-module",
63960
64054
  "path": "src/components/title-container/title-container.ts",
@@ -0,0 +1,114 @@
1
+ import { css } from "lit";
2
+ const componentStyle = css`
3
+ * {
4
+ -webkit-tap-highlight-color: transparent;
5
+ }
6
+
7
+ :host {
8
+ display: inline-block;
9
+ line-height: 0;
10
+ }
11
+
12
+ .wrapper {
13
+ display: inline-flex;
14
+ flex-direction: column;
15
+ width: fit-content;
16
+ --height: 24px;
17
+ --padding: 4px;
18
+ font-family: var(--font-family-main);
19
+ letter-spacing: var(--global-typography-generic-l-letter-spacing);
20
+ }
21
+
22
+ /* The inner-wrapper is the box: its height (--height) is the full textbox
23
+ height, padding included. The content is sized to the cap height and
24
+ vertically centered, which leaves the padding as equal space above and
25
+ below. In engines that support text-box-trim the content box collapses to
26
+ the cap height exactly; in Firefox (no text-box-trim) the content keeps its
27
+ natural line box, so align-items:center + overflow:hidden crops it to the
28
+ same height instead. No padding here – the centering provides it.
29
+ (A small top padding could be added later to nudge the text up in Firefox.) */
30
+
31
+ .inner-wrapper {
32
+ box-sizing: border-box;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: var(--alignment-justify, flex-end);
36
+ height: var(--height);
37
+ overflow: hidden;
38
+ }
39
+
40
+ /* The spacer must share the content's exact font metrics so the width it
41
+ reserves equals the rendered content width. font-size-adjust scales the
42
+ font, so it has to match too. */
43
+
44
+ .content,
45
+ .length-spacer {
46
+ font-size: calc(var(--height) - 2 * var(--padding));
47
+ font-size-adjust: cap-height 1;
48
+ white-space: nowrap;
49
+ }
50
+
51
+ .content {
52
+ text-box-trim: trim-both;
53
+ text-box-edge: cap alphabetic;
54
+ }
55
+
56
+ .wrapper.size-xs .inner-wrapper {
57
+ --height: 16px;
58
+ }
59
+
60
+ .wrapper.size-s .inner-wrapper {
61
+ --height: 20px;
62
+ }
63
+
64
+ .wrapper.size-m .inner-wrapper {
65
+ --height: 24px;
66
+ }
67
+
68
+ .wrapper.size-l .inner-wrapper {
69
+ --height: 32px;
70
+ }
71
+
72
+ .wrapper.size-xl .inner-wrapper {
73
+ --height: 40px;
74
+ }
75
+
76
+ .wrapper.font-weight-regular {
77
+ font-weight: var(--global-typography-generic-l-font-weight-regular);
78
+ }
79
+
80
+ .wrapper.font-weight-semibold {
81
+ font-weight: var(--global-typography-generic-l-font-weight-medium);
82
+ }
83
+
84
+ .wrapper.font-weight-bold {
85
+ font-weight: var(--global-typography-generic-l-font-weight-bold);
86
+ }
87
+
88
+ .wrapper.alignment-left {
89
+ --alignment-justify: flex-start;
90
+ }
91
+
92
+ .wrapper.alignment-center {
93
+ --alignment-justify: center;
94
+ }
95
+
96
+ .wrapper.alignment-right {
97
+ --alignment-justify: flex-end;
98
+ }
99
+
100
+ /* Reserves the box width from the \`length\` slot without occupying vertical
101
+ space. Acts as a minimum width so the box does not resize as visible
102
+ text changes. */
103
+
104
+ .length-spacer {
105
+ height: 0;
106
+ opacity: 0;
107
+ visibility: hidden;
108
+ overflow: hidden;
109
+ }
110
+ `;
111
+ export {
112
+ componentStyle as default
113
+ };
114
+ //# sourceMappingURL=textbox.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,70 @@
1
+ import { LitElement } from 'lit';
2
+ export declare enum ObcTextboxAlignment {
3
+ Left = "left",
4
+ Center = "center",
5
+ Right = "right"
6
+ }
7
+ export declare enum ObcTextboxSize {
8
+ xs = "xs",
9
+ s = "s",
10
+ m = "m",
11
+ l = "l",
12
+ xl = "xl"
13
+ }
14
+ export declare enum ObcTextboxFontWeight {
15
+ regular = "regular",
16
+ semibold = "semibold",
17
+ bold = "bold"
18
+ }
19
+ /**
20
+ * `<obc-textbox>` – A text container that renders inline text at a
21
+ * precise, cap-height-trimmed size with configurable alignment and reservable
22
+ * width.
23
+ *
24
+ * Use it to present short, read-only strings – such as values, labels, or
25
+ * units – where vertical metrics must line up exactly across rows and the
26
+ * horizontal footprint should stay stable while the text changes (for example
27
+ * a numeric value that updates frequently). Synonyms: text container, value
28
+ * box, label box.
29
+ *
30
+ * ## Features / Variants
31
+ * - **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box
32
+ * height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving
33
+ * cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable
34
+ * grid.
35
+ * - **Font weight:** `regular` (default), `semibold`, `bold`.
36
+ * - **Alignment:** `left`, `center`, `right` (default) – positions the text
37
+ * within the box's width when the box is wider than the content.
38
+ * - **Reserved width:** content placed in the `length` slot reserves a minimum
39
+ * width invisibly, so the box does not resize as the visible text changes.
40
+ * The box always shows all content – it never crops.
41
+ *
42
+ * ## Usage Guidelines
43
+ * - Pass the longest expected string to the `length` slot (e.g. `"888.8"` or
44
+ * `"Wind speed"`) so the box reserves space and does not jump in width as the
45
+ * visible value updates.
46
+ * - This is a display primitive for static text – use an input component for
47
+ * editable values.
48
+ *
49
+ * ## Slots
50
+ * | Slot | Renders when… | Purpose |
51
+ * |-----------|--------------------|------------------------------------------------------|
52
+ * | (default) | Always | The visible text content. |
53
+ * | `length` | Always (invisible) | Reserves a minimum width based on its content width. |
54
+ *
55
+ * @slot - The visible text content.
56
+ * @slot length - Reserves a minimum width based on its content width.
57
+ */
58
+ export declare class ObcTextbox extends LitElement {
59
+ alignment: ObcTextboxAlignment;
60
+ size: ObcTextboxSize;
61
+ fontWeight: ObcTextboxFontWeight;
62
+ render(): import('lit-html').TemplateResult<1>;
63
+ static styles: import('lit').CSSResult;
64
+ }
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ 'obc-textbox': ObcTextbox;
68
+ }
69
+ }
70
+ //# sourceMappingURL=textbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../../src/components/textbox/textbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;CACV;AAED,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa,UAAW,SAAQ,UAAU;IACd,SAAS,EAAE,mBAAmB,CAC5B;IACF,IAAI,EAAE,cAAc,CAAoB;IACxC,UAAU,EAAE,oBAAoB,CAC3B;IAEtB,MAAM;IAsBf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,84 @@
1
+ import { unsafeCSS, LitElement, html } from "lit";
2
+ import { customElement } from "../../decorator.js";
3
+ import componentStyle from "./textbox.css.js";
4
+ import { property } from "lit/decorators.js";
5
+ import { classMap } from "lit/directives/class-map.js";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ var ObcTextboxAlignment = /* @__PURE__ */ ((ObcTextboxAlignment2) => {
17
+ ObcTextboxAlignment2["Left"] = "left";
18
+ ObcTextboxAlignment2["Center"] = "center";
19
+ ObcTextboxAlignment2["Right"] = "right";
20
+ return ObcTextboxAlignment2;
21
+ })(ObcTextboxAlignment || {});
22
+ var ObcTextboxSize = /* @__PURE__ */ ((ObcTextboxSize2) => {
23
+ ObcTextboxSize2["xs"] = "xs";
24
+ ObcTextboxSize2["s"] = "s";
25
+ ObcTextboxSize2["m"] = "m";
26
+ ObcTextboxSize2["l"] = "l";
27
+ ObcTextboxSize2["xl"] = "xl";
28
+ return ObcTextboxSize2;
29
+ })(ObcTextboxSize || {});
30
+ var ObcTextboxFontWeight = /* @__PURE__ */ ((ObcTextboxFontWeight2) => {
31
+ ObcTextboxFontWeight2["regular"] = "regular";
32
+ ObcTextboxFontWeight2["semibold"] = "semibold";
33
+ ObcTextboxFontWeight2["bold"] = "bold";
34
+ return ObcTextboxFontWeight2;
35
+ })(ObcTextboxFontWeight || {});
36
+ let ObcTextbox = class extends LitElement {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.alignment = "right";
40
+ this.size = "m";
41
+ this.fontWeight = "regular";
42
+ }
43
+ render() {
44
+ return html`
45
+ <div
46
+ class=${classMap({
47
+ wrapper: true,
48
+ [`alignment-${this.alignment}`]: true,
49
+ [`size-${this.size}`]: true,
50
+ [`font-weight-${this.fontWeight}`]: true
51
+ })}
52
+ >
53
+ <div class="inner-wrapper">
54
+ <div class="content">
55
+ <slot></slot>
56
+ </div>
57
+ </div>
58
+ <div class="length-spacer" aria-hidden="true">
59
+ <slot name="length"></slot>
60
+ </div>
61
+ </div>
62
+ `;
63
+ }
64
+ };
65
+ ObcTextbox.styles = unsafeCSS(componentStyle);
66
+ __decorateClass([
67
+ property({ type: String })
68
+ ], ObcTextbox.prototype, "alignment", 2);
69
+ __decorateClass([
70
+ property({ type: String })
71
+ ], ObcTextbox.prototype, "size", 2);
72
+ __decorateClass([
73
+ property({ type: String })
74
+ ], ObcTextbox.prototype, "fontWeight", 2);
75
+ ObcTextbox = __decorateClass([
76
+ customElement("obc-textbox")
77
+ ], ObcTextbox);
78
+ export {
79
+ ObcTextbox,
80
+ ObcTextboxAlignment,
81
+ ObcTextboxFontWeight,
82
+ ObcTextboxSize
83
+ };
84
+ //# sourceMappingURL=textbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.js","sources":["../../../src/components/textbox/textbox.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport componentStyle from './textbox.css?inline';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nexport enum ObcTextboxAlignment {\n Left = 'left',\n Center = 'center',\n Right = 'right',\n}\n\nexport enum ObcTextboxSize {\n xs = 'xs',\n s = 's',\n m = 'm',\n l = 'l',\n xl = 'xl',\n}\n\nexport enum ObcTextboxFontWeight {\n regular = 'regular',\n semibold = 'semibold',\n bold = 'bold',\n}\n\n/**\n * `<obc-textbox>` – A text container that renders inline text at a\n * precise, cap-height-trimmed size with configurable alignment and reservable\n * width.\n *\n * Use it to present short, read-only strings – such as values, labels, or\n * units – where vertical metrics must line up exactly across rows and the\n * horizontal footprint should stay stable while the text changes (for example\n * a numeric value that updates frequently). Synonyms: text container, value\n * box, label box.\n *\n * ## Features / Variants\n * - **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box\n * height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving\n * cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable\n * grid.\n * - **Font weight:** `regular` (default), `semibold`, `bold`.\n * - **Alignment:** `left`, `center`, `right` (default) – positions the text\n * within the box's width when the box is wider than the content.\n * - **Reserved width:** content placed in the `length` slot reserves a minimum\n * width invisibly, so the box does not resize as the visible text changes.\n * The box always shows all content – it never crops.\n *\n * ## Usage Guidelines\n * - Pass the longest expected string to the `length` slot (e.g. `\"888.8\"` or\n * `\"Wind speed\"`) so the box reserves space and does not jump in width as the\n * visible value updates.\n * - This is a display primitive for static text – use an input component for\n * editable values.\n *\n * ## Slots\n * | Slot | Renders when… | Purpose |\n * |-----------|--------------------|------------------------------------------------------|\n * | (default) | Always | The visible text content. |\n * | `length` | Always (invisible) | Reserves a minimum width based on its content width. |\n *\n * @slot - The visible text content.\n * @slot length - Reserves a minimum width based on its content width.\n */\n@customElement('obc-textbox')\nexport class ObcTextbox extends LitElement {\n @property({type: String}) alignment: ObcTextboxAlignment =\n ObcTextboxAlignment.Right;\n @property({type: String}) size: ObcTextboxSize = ObcTextboxSize.m;\n @property({type: String}) fontWeight: ObcTextboxFontWeight =\n ObcTextboxFontWeight.regular;\n\n override render() {\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`alignment-${this.alignment}`]: true,\n [`size-${this.size}`]: true,\n [`font-weight-${this.fontWeight}`]: true,\n })}\n >\n <div class=\"inner-wrapper\">\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n <div class=\"length-spacer\" aria-hidden=\"true\">\n <slot name=\"length\"></slot>\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-textbox': ObcTextbox;\n }\n}\n"],"names":["ObcTextboxAlignment","ObcTextboxSize","ObcTextboxFontWeight"],"mappings":";;;;;;;;;;;;;;;AAMO,IAAK,wCAAAA,yBAAL;AACLA,uBAAA,MAAA,IAAO;AACPA,uBAAA,QAAA,IAAS;AACTA,uBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AAML,IAAK,mCAAAC,oBAAL;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,GAAA,IAAI;AACJA,kBAAA,GAAA,IAAI;AACJA,kBAAA,GAAA,IAAI;AACJA,kBAAA,IAAA,IAAK;AALK,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAQL,IAAK,yCAAAC,0BAAL;AACLA,wBAAA,SAAA,IAAU;AACVA,wBAAA,UAAA,IAAW;AACXA,wBAAA,MAAA,IAAO;AAHG,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AA8CL,IAAM,aAAN,cAAyB,WAAW;AAAA,EAApC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,YACxB;AACwB,SAAA,OAAuB;AACvB,SAAA,aACxB;AAAA,EAAA;AAAA,EAEO,SAAS;AAChB,WAAO;AAAA;AAAA,gBAEK,SAAS;AAAA,MACf,SAAS;AAAA,MACT,CAAC,aAAa,KAAK,SAAS,EAAE,GAAG;AAAA,MACjC,CAAC,QAAQ,KAAK,IAAI,EAAE,GAAG;AAAA,MACvB,CAAC,eAAe,KAAK,UAAU,EAAE,GAAG;AAAA,IAAA,CACrC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYR;AAGF;AA9Ba,WA6BK,SAAS,UAAU,cAAc;AA5BvB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GADb,WACe,WAAA,aAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAHb,WAGe,WAAA,QAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAJb,WAIe,WAAA,cAAA,CAAA;AAJf,aAAN,gBAAA;AAAA,EADN,cAAc,aAAa;AAAA,GACf,UAAA;"}
package/eslint.config.mjs CHANGED
@@ -301,16 +301,11 @@ const openbridgePlugin = {
301
301
  p.key.type === 'Identifier' &&
302
302
  p.key.name === 'attribute'
303
303
  );
304
- const isBuildingBlock =
305
- typeof context.filename === 'string' &&
306
- context.filename.includes('building-blocks');
307
304
  if (property?.value?.value === false) {
308
305
  return;
309
306
  }
310
- let message = 'Prefer boolean property default values of false';
311
- if (isBuildingBlock) {
312
- message += ' or set Attribute: false on the property decorator';
313
- }
307
+ let message =
308
+ 'Prefer boolean property default values of false or set attribute: false on the property decorator';
314
309
  context.report({
315
310
  node,
316
311
  message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.0.0-next.70",
3
+ "version": "2.0.0-next.71",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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
+ };