@repobit/dex-system-design 4.0.0 → 4.2.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.2.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@4.1.0...@repobit/dex-system-design@4.2.0) (2026-11-17)
7
+
8
+ ### Features
9
+
10
+ * **DEX-1000:** add review carousel and review background none
11
+ * **DEX-1000:** move review carousel heading into slots and record its api
12
+
13
+ ### Bug Fixes
14
+
15
+ * **DEX-1000:** base review styles on main and add divider and background none
16
+ * **DEX-1000:** let reviews in bd-logo-marquee keep their own height
17
+ * **DEX-1000:** new variant for review component - review carousel
18
+ * **DEX-1000:** new variant for review component - review carousel
19
+ * **DEX-1000:** place review carousel in element api baseline order
20
+ * **DEX-1000:** rename review carousel subtitle slot to description
21
+ * **DEX-1000:** use breakpoint tokens and marked masks in review carousel
22
+ * **DEX-1000:** write review carousel story headings as slotted content
23
+
24
+
25
+ ## [4.1.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@4.0.0...@repobit/dex-system-design@4.1.0) (2026-11-11)
26
+
27
+ ### Features
28
+
29
+ * **DEX-29547:** bd-logo-marquee takes without-pause-button
30
+ * **DEX-29547:** bd-select takes aria-label for a name it does not draw
31
+
32
+
6
33
  ## [4.0.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@3.1.2...@repobit/dex-system-design@4.0.0) (2026-11-11)
7
34
 
8
35
  ### ⚠ BREAKING CHANGES
@@ -1,23 +1,23 @@
1
- import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{SIZES as t,isOneOf as n}from"../shared/prop-vocabulary.js";import r from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{SlotController as i}from"../shared/controller.slot.js";import{CONTROL_ID as a,FIELD_SLOTS as o,ValueControl as s,describedBy as c,fieldHint as l,fieldLabel as u,omitEmpty as d}from"../shared/form-control.js";import f from"./input.css.js";import p from"../shared/form-field.css.js";import{LitElement as m,html as h,nothing as g}from"lit";import{property as _}from"lit/decorators.js";import{keyed as v}from"lit/directives/keyed.js";var y=class extends s(m){constructor(...e){super(...e),this.type=`text`,this.size=`md`,this.placeholder=``,this.required=!1,this.focused=!1,this.invalid=!1,this.validated=!1,this.disabled=!1,this.value=``,this.name=``,this.inputmode=``,this.autocomplete=``,this.enterkeyhint=``,this.fieldSpellcheck=null,this.fieldLabel=``,this._slots=new i(this,{slots:[...o,`end`],text:[`label`]})}static{this.styles=[p,f]}get _control(){return this.renderRoot?.querySelector?.(`input`)}get _accessibleName(){return this._slots.has(`label`)?``:this.fieldLabel?this.fieldLabel:[...this._internals.labels??[]].map(e=>e.textContent.trim()).filter(Boolean).join(` `)}_onInput(e){this.value=e.target.value,this._sync()}_onChange(e){this.value=e.target.value,this._relayChange()}willUpdate(e){e.has(`size`)&&!n(t,this.size)&&(this.size=`md`)}updated(e){this._sync(),this._followFocused(e);for(let e of this._slots.elements(`end`))e.requestUpdate?.()}_followFocused(e){if(!e.has(`focused`))return;let t=this.shadowRoot.querySelector(`input`),n=this.shadowRoot.activeElement===t;this.focused&&!n&&t?.focus(),!this.focused&&n&&t?.blur()}render(){let e=this.disabled||this._formDisabled,t=e?`form-input--disabled`:this.invalid?`form-input--error`:this.validated?`form-input--success`:``,n=this.invalid?`error`:this.validated?`success`:`default`,r=this._slots.has(`end`);return h`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{SIZES as t,isOneOf as n}from"../shared/prop-vocabulary.js";import r from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{SlotController as i}from"../shared/controller.slot.js";import{CONTROL_ID as a,FIELD_SLOTS as o,ValueControl as s,describedBy as c,fieldHint as l,fieldLabel as u,fieldName as d,omitEmpty as f}from"../shared/form-control.js";import p from"./input.css.js";import m from"../shared/form-field.css.js";import{LitElement as h,html as g,nothing as _}from"lit";import{property as v}from"lit/decorators.js";import{keyed as y}from"lit/directives/keyed.js";var b=class extends s(h){constructor(...e){super(...e),this.type=`text`,this.size=`md`,this.placeholder=``,this.required=!1,this.focused=!1,this.invalid=!1,this.validated=!1,this.disabled=!1,this.value=``,this.name=``,this.inputmode=``,this.autocomplete=``,this.enterkeyhint=``,this.fieldSpellcheck=null,this.fieldLabel=``,this._slots=new i(this,{slots:[...o,`end`],text:[`label`]})}static{this.styles=[m,p]}get _control(){return this.renderRoot?.querySelector?.(`input`)}get _accessibleName(){return d(this._slots,this.fieldLabel,this._internals.labels)}_onInput(e){this.value=e.target.value,this._sync()}_onChange(e){this.value=e.target.value,this._relayChange()}willUpdate(e){e.has(`size`)&&!n(t,this.size)&&(this.size=`md`)}updated(e){this._sync(),this._followFocused(e);for(let e of this._slots.elements(`end`))e.requestUpdate?.()}_followFocused(e){if(!e.has(`focused`))return;let t=this.shadowRoot.querySelector(`input`),n=this.shadowRoot.activeElement===t;this.focused&&!n&&t?.focus(),!this.focused&&n&&t?.blur()}render(){let e=this.disabled||this._formDisabled,t=e?`form-input--disabled`:this.invalid?`form-input--error`:this.validated?`form-input--success`:``,n=this.invalid?`error`:this.validated?`success`:`default`,r=this._slots.has(`end`);return g`
2
2
  <div class="input-container">
3
- ${u(this._slots,{size:this.size,required:this.required},h`<slot name="label"></slot>`)}
3
+ ${u(this._slots,{size:this.size,required:this.required},g`<slot name="label"></slot>`)}
4
4
  <div class="control-row">
5
- ${v(this._resets,h`<input
5
+ ${y(this._resets,g`<input
6
6
  id=${a}
7
7
  part="input"
8
8
  class="form-input-bd input-${this.size} ${t} ${this._attempted?`form-input--attempted`:``} ${r?`form-input--with-end`:``}"
9
9
  type=${this.type}
10
- name=${this.name||g}
11
- placeholder=${this.placeholder||g}
10
+ name=${this.name||_}
11
+ placeholder=${this.placeholder||_}
12
12
  .value=${this.value}
13
- inputmode=${this.inputmode||g}
14
- autocomplete=${this.autocomplete||g}
15
- spellcheck=${this.fieldSpellcheck??g}
16
- enterkeyhint=${this.enterkeyhint||g}
13
+ inputmode=${this.inputmode||_}
14
+ autocomplete=${this.autocomplete||_}
15
+ spellcheck=${this.fieldSpellcheck??_}
16
+ enterkeyhint=${this.enterkeyhint||_}
17
17
  ?required=${this.required}
18
18
  ?disabled=${e}
19
- aria-label=${this._accessibleName||g}
20
- aria-invalid=${this.invalid?`true`:g}
19
+ aria-label=${this._accessibleName||_}
20
+ aria-invalid=${this.invalid?`true`:_}
21
21
  aria-describedby=${c(this._slots)}
22
22
  @focus=${()=>{this.focused=!0}}
23
23
  @blur=${()=>{this.focused=!1}}
@@ -27,7 +27,7 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
27
27
  />`)}
28
28
  <span class="end" part="end" ?hidden=${!r}><slot name="end"></slot></span>
29
29
  </div>
30
- ${l(this._slots,n,h`<slot name="hint"></slot>`)}
30
+ ${l(this._slots,n,g`<slot name="hint"></slot>`)}
31
31
  </div>
32
- `}};r([_({type:String})],y.prototype,`type`,void 0),r([_({type:String,reflect:!0})],y.prototype,`size`,void 0),r([_({type:String})],y.prototype,`placeholder`,void 0),r([_({type:Boolean})],y.prototype,`required`,void 0),r([_({type:Boolean,reflect:!0})],y.prototype,`focused`,void 0),r([_({type:Boolean})],y.prototype,`invalid`,void 0),r([_({type:Boolean,reflect:!0})],y.prototype,`validated`,void 0),r([_({type:Boolean,reflect:!0})],y.prototype,`disabled`,void 0),r([_({type:String})],y.prototype,`value`,void 0),r([_({type:String,reflect:!0,converter:d})],y.prototype,`name`,void 0),r([_({type:String})],y.prototype,`inputmode`,void 0),r([_({type:String})],y.prototype,`autocomplete`,void 0),r([_({type:String})],y.prototype,`enterkeyhint`,void 0),r([_({type:String,attribute:`spellcheck`})],y.prototype,`fieldSpellcheck`,void 0),r([_({type:String,attribute:`aria-label`})],y.prototype,`fieldLabel`,void 0),y=r([e(`bd-input`)],y);export{y as BdInput};
32
+ `}};r([v({type:String})],b.prototype,`type`,void 0),r([v({type:String,reflect:!0})],b.prototype,`size`,void 0),r([v({type:String})],b.prototype,`placeholder`,void 0),r([v({type:Boolean})],b.prototype,`required`,void 0),r([v({type:Boolean,reflect:!0})],b.prototype,`focused`,void 0),r([v({type:Boolean})],b.prototype,`invalid`,void 0),r([v({type:Boolean,reflect:!0})],b.prototype,`validated`,void 0),r([v({type:Boolean,reflect:!0})],b.prototype,`disabled`,void 0),r([v({type:String})],b.prototype,`value`,void 0),r([v({type:String,reflect:!0,converter:f})],b.prototype,`name`,void 0),r([v({type:String})],b.prototype,`inputmode`,void 0),r([v({type:String})],b.prototype,`autocomplete`,void 0),r([v({type:String})],b.prototype,`enterkeyhint`,void 0),r([v({type:String,attribute:`spellcheck`})],b.prototype,`fieldSpellcheck`,void 0),r([v({type:String,attribute:`aria-label`})],b.prototype,`fieldLabel`,void 0),b=r([e(`bd-input`)],b);export{b as BdInput};
33
33
  //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":["inputCSS","_decorate","__decorate","input_css_default","formFieldCSS","BdInput","ValueControl","LitElement","_args","SlotController","FIELD_SLOTS","l","changed","isOneOf","SIZES","el","input","has","disabled","inputStateClass","tone","end","fieldLabel","keyed","CONTROL_ID","nothing","describedBy","fieldHint","property","omitEmpty","defineElement"],"sources":["../../../../src/components/input/input.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues, type ReactiveElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { keyed } from \"lit/directives/keyed.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport { formFieldCSS } from \"#shared/form-field.css.ts\";\nimport inputCSS from \"./input.css.ts\";\nimport { SIZES, isOneOf, type Size } from \"#shared/prop-vocabulary.ts\";\nimport { CONTROL_ID, FIELD_SLOTS, ValueControl, describedBy, fieldHint, fieldLabel, omitEmpty } from \"#shared/form-control.ts\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\n\n/**\n * A one-line text field.\n *\n * <bd-input name=\"key\" spellcheck=\"false\" required>\n * <span slot=\"label\">Licence key</span>\n * <span slot=\"hint\">It is in the email we sent you.</span>\n * <bd-paste-button slot=\"end\" label=\"Paste from clipboard\"></bd-paste-button>\n * </bd-input>\n *\n * The label and the hint are the page's, in the `label` and `hint` slots, and\n * name and describe the native <input> through references that stay inside\n * this shadow root (shared/form-control.ts). The `end` slot sits over the\n * field's trailing edge, which is where 3.x's clipboard field drew its paste\n * button: that field is this one now, with a bd-paste-button the page writes\n * there.\n *\n * Form-associated (shared/form-control.ts): a <form> around it submits\n * name=value, resets it to its value attribute, holds an empty `required` one\n * and leaves it out under a <fieldset disabled>. It sends the native `input`\n * and `change`, with no detail; a listener reads event.target.value.\n */\n@defineElement(\"bd-input\")\nexport class BdInput extends ValueControl(LitElement) {\n static styles = [formFieldCSS, inputCSS];\n\n @property({ type: String })\n type = \"text\";\n @property({ type: String, reflect: true })\n size: Size = \"md\";\n @property({ type: String })\n placeholder = \"\";\n @property({ type: Boolean })\n required = false;\n @property({ type: Boolean, reflect: true })\n focused = false;\n @property({ type: Boolean })\n invalid = false;\n @property({ type: Boolean, reflect: true })\n validated = false;\n @property({ type: Boolean, reflect: true })\n disabled = false;\n /* The current value. The value ATTRIBUTE is the default a form reset\n returns to, as on a native input: the property does not reflect, so the\n attribute keeps what the page wrote. See ValueControl. */\n @property({ type: String })\n value = \"\";\n // reflected, because a form reads the name off the element\n @property({ type: String, reflect: true, converter: omitEmpty })\n name = \"\";\n // mobile keyboard controls — see the story\n @property({ type: String })\n inputmode = \"\";\n @property({ type: String })\n autocomplete = \"\";\n @property({ type: String })\n enterkeyhint = \"\";\n /* Passed to the <input>: a key or a code usually wants spellcheck=\"false\".\n The attribute is the global one, under its own name; the property is\n not, because HTMLElement already has a spellcheck, a boolean about the\n element itself. Named as fieldLabel is: what is passed to the field. */\n @property({ type: String, attribute: \"spellcheck\" })\n fieldSpellcheck: string | null = null;\n /* The field's name when there is no visible label: aria-label on the\n element is passed to the <input>, which is what a screen reader\n focuses -- on the element itself it named nothing. */\n @property({ type: String, attribute: \"aria-label\" })\n fieldLabel = \"\";\n\n protected _slots = new SlotController(this, { slots: [...FIELD_SLOTS, \"end\"], text: [\"label\"] });\n\n protected get _control(): HTMLInputElement | null {\n return this.renderRoot?.querySelector?.(\"input\");\n }\n\n /* With no label in the label slot, the <input> is named by aria-label on\n the element, or else by the text of a <label for> pointing at the element\n -- FACE gives the element its labels, but a label outside cannot name the\n <input> inside. Past both, the browser falls back on the placeholder. */\n get _accessibleName() {\n if (this._slots.has(\"label\")) return \"\";\n if (this.fieldLabel) return this.fieldLabel;\n return [...(this._internals.labels ?? [])].map(l => l.textContent!.trim()).filter(Boolean)\n .join(\" \");\n }\n\n /**\n * The value follows the <input> before anything hears of it. The native\n * input event is composed: it leaves the shadow root on its own, retargeted\n * to this element, and its listeners on the page run after this one, which\n * runs on the <input> itself -- so event.target.value is what was just\n * typed. It is not sent again; change is (shared/form-control.ts).\n */\n _onInput(e: Event & { target: HTMLInputElement }) {\n this.value = e.target.value;\n // before the event reaches the page, so a handler asking the form about\n // it gets the answer for what was just typed\n this._sync();\n }\n\n _onChange(e: Event & { target: HTMLInputElement }) {\n this.value = e.target.value;\n this._relayChange();\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"size\") && !isOneOf(SIZES, this.size)) this.size = \"md\";\n }\n\n /* focused is the field's real focus, both ways. Setting it moves keyboard\n focus into the <input> and clearing it blurs the field; focusing or\n leaving the field by hand sets it, and it reflects, so the attribute says\n whether the field has focus. It used to add a .focused class that painted\n the focus ring on a field that did not have focus -- a second, false\n indicator on any page that set it. The ring is now only the browser's\n :focus-visible, which a text field shows whenever it is focused. */\n updated(changed: PropertyValues<this>) {\n this._sync();\n this._followFocused(changed);\n /* What sits in the end slot reads this field -- a bd-paste-button is\n disabled with it and described by its label -- and renders only when\n its own properties change. So it is told to look again whenever this\n field renders, which is when either can have moved. A few elements at\n most; nothing cascades back. */\n for (const el of this._slots.elements(\"end\")) (el as Partial<ReactiveElement>).requestUpdate?.();\n }\n\n _followFocused(changed: PropertyValues<this>) {\n if (!changed.has(\"focused\")) return;\n const input = this.shadowRoot!.querySelector(\"input\");\n const has = this.shadowRoot!.activeElement === input;\n if (this.focused && !has) input?.focus();\n if (!this.focused && has) input?.blur();\n }\n\n render() {\n const disabled = this.disabled || this._formDisabled;\n const inputStateClass = disabled\n ? \"form-input--disabled\"\n : this.invalid\n ? \"form-input--error\"\n : this.validated\n ? \"form-input--success\"\n : \"\";\n const tone = this.invalid ? \"error\" : this.validated ? \"success\" : \"default\";\n const end = this._slots.has(\"end\");\n\n // The hint is the field's description, and the state is announced, not\n // only drawn: invalid used to be a red border alone and the hint was never\n // pointed at, so the reason a field was invalid reached a screen reader\n // not at all.\n return html`\n <div class=\"input-container\">\n ${fieldLabel(this._slots, { size: this.size, required: this.required }, html`<slot name=\"label\"></slot>`)}\n <div class=\"control-row\">\n ${keyed(this._resets, html`<input\n id=${CONTROL_ID}\n part=\"input\"\n class=\"form-input-bd input-${this.size} ${inputStateClass} ${this._attempted ? \"form-input--attempted\" : \"\"} ${end ? \"form-input--with-end\" : \"\"}\"\n type=${this.type}\n name=${this.name || nothing}\n placeholder=${this.placeholder || nothing}\n .value=${this.value}\n inputmode=${this.inputmode || nothing}\n autocomplete=${this.autocomplete || nothing}\n spellcheck=${this.fieldSpellcheck ?? nothing}\n enterkeyhint=${this.enterkeyhint || nothing}\n ?required=${this.required}\n ?disabled=${disabled}\n aria-label=${this._accessibleName || nothing}\n aria-invalid=${this.invalid ? \"true\" : nothing}\n aria-describedby=${describedBy(this._slots)}\n @focus=${() => { this.focused = true; }}\n @blur=${() => { this.focused = false; }}\n @input=${this._onInput}\n @change=${this._onChange}\n @keydown=${this._onFieldKeydown}\n />`)}\n <span class=\"end\" part=\"end\" ?hidden=${!end}><slot name=\"end\"></slot></span>\n </div>\n ${fieldHint(this._slots, tone, html`<slot name=\"hint\"></slot>`)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-input\": BdInput;\n }\n}\n"],"mappings":"A,4pBAkCO,IAAMK,EAAN,cAAsBC,EAAaC,CAAU,CAAC,AAAC,C,8BAI7C,KAAA,KAAA,OAEM,KAAA,KAAA,KAEC,KAAA,YAAA,GAEH,KAAA,SAAA,GAED,KAAA,QAAA,GAEA,KAAA,QAAA,GAEE,KAAA,UAAA,GAED,KAAA,SAAA,GAKH,KAAA,MAAA,GAGD,KAAA,KAAA,GAGK,KAAA,UAAA,GAEG,KAAA,aAAA,GAEA,KAAA,aAAA,GAMkB,KAAA,gBAAA,KAKpB,KAAA,WAAA,GAEM,KAAA,OAAA,IAAIE,EAAe,KAAM,CAAE,MAAO,CAAC,GAAGC,EAAa,KAAK,EAAG,KAAM,CAAC,OAAO,CAAE,CAAC,C,QA7C/E,KAAA,OAAA,CAACN,EAAcJ,CAAQ,C,CA+CvC,IAAc,UAAoC,CAChD,OAAO,KAAK,YAAY,gBAAgB,OAAO,CACjD,CAMA,IAAI,iBAAkB,CAGpB,OAFI,KAAK,OAAO,IAAI,OAAO,EAAU,GACjC,KAAK,WAAmB,KAAK,WAC1B,CAAC,GAAI,KAAK,WAAW,QAAU,CAAC,CAAE,CAAC,CAAC,IAAI,GAAKW,EAAE,YAAa,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CACvF,KAAK,GAAG,CACb,CASA,SAAS,EAAyC,CAChD,KAAK,MAAQ,EAAE,OAAO,MAGtB,KAAK,MAAM,CACb,CAEA,UAAU,EAAyC,CACjD,KAAK,MAAQ,EAAE,OAAO,MACtB,KAAK,aAAa,CACpB,CAEA,WAAW,EAA+B,CACpCC,EAAQ,IAAI,MAAM,GAAK,CAACC,EAAQC,EAAO,KAAK,IAAI,IAAG,KAAK,KAAO,KACrE,CASA,QAA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EAG9DJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAvB,EAAA,UAAA,YAAA,IAAA,EAAA,EAEzBJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAvB,EAAA,UAAA,eAAA,IAAA,EAAA,EAEzBJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAvB,EAAA,UAAA,eAAA,IAAA,EAAA,EAMzBJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAvB,EAAA,UAAA,kBAAA,IAAA,EAAA,EAKlDJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAvB,EAAA,UAAA,aAAA,IAAA,EAAA,EA5CpD,EAAAJ,EAAA,CAAA6B,EAAc,UAAU,CAAA,EAAAzB,CAAA,E"}
1
+ {"version":3,"file":"input.js","names":["inputCSS","_decorate","__decorate","input_css_default","formFieldCSS","BdInput","ValueControl","LitElement","_args","SlotController","FIELD_SLOTS","fieldName","changed","isOneOf","SIZES","el","input","has","disabled","inputStateClass","tone","end","fieldLabel","keyed","CONTROL_ID","nothing","describedBy","fieldHint","property","omitEmpty","defineElement"],"sources":["../../../../src/components/input/input.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues, type ReactiveElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { keyed } from \"lit/directives/keyed.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport { formFieldCSS } from \"#shared/form-field.css.ts\";\nimport inputCSS from \"./input.css.ts\";\nimport { SIZES, isOneOf, type Size } from \"#shared/prop-vocabulary.ts\";\nimport { CONTROL_ID, FIELD_SLOTS, ValueControl, describedBy, fieldHint, fieldLabel, fieldName, omitEmpty } from \"#shared/form-control.ts\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\n\n/**\n * A one-line text field.\n *\n * <bd-input name=\"key\" spellcheck=\"false\" required>\n * <span slot=\"label\">Licence key</span>\n * <span slot=\"hint\">It is in the email we sent you.</span>\n * <bd-paste-button slot=\"end\" label=\"Paste from clipboard\"></bd-paste-button>\n * </bd-input>\n *\n * The label and the hint are the page's, in the `label` and `hint` slots, and\n * name and describe the native <input> through references that stay inside\n * this shadow root (shared/form-control.ts). The `end` slot sits over the\n * field's trailing edge, which is where 3.x's clipboard field drew its paste\n * button: that field is this one now, with a bd-paste-button the page writes\n * there.\n *\n * Form-associated (shared/form-control.ts): a <form> around it submits\n * name=value, resets it to its value attribute, holds an empty `required` one\n * and leaves it out under a <fieldset disabled>. It sends the native `input`\n * and `change`, with no detail; a listener reads event.target.value.\n */\n@defineElement(\"bd-input\")\nexport class BdInput extends ValueControl(LitElement) {\n static styles = [formFieldCSS, inputCSS];\n\n @property({ type: String })\n type = \"text\";\n @property({ type: String, reflect: true })\n size: Size = \"md\";\n @property({ type: String })\n placeholder = \"\";\n @property({ type: Boolean })\n required = false;\n @property({ type: Boolean, reflect: true })\n focused = false;\n @property({ type: Boolean })\n invalid = false;\n @property({ type: Boolean, reflect: true })\n validated = false;\n @property({ type: Boolean, reflect: true })\n disabled = false;\n /* The current value. The value ATTRIBUTE is the default a form reset\n returns to, as on a native input: the property does not reflect, so the\n attribute keeps what the page wrote. See ValueControl. */\n @property({ type: String })\n value = \"\";\n // reflected, because a form reads the name off the element\n @property({ type: String, reflect: true, converter: omitEmpty })\n name = \"\";\n // mobile keyboard controls — see the story\n @property({ type: String })\n inputmode = \"\";\n @property({ type: String })\n autocomplete = \"\";\n @property({ type: String })\n enterkeyhint = \"\";\n /* Passed to the <input>: a key or a code usually wants spellcheck=\"false\".\n The attribute is the global one, under its own name; the property is\n not, because HTMLElement already has a spellcheck, a boolean about the\n element itself. Named as fieldLabel is: what is passed to the field. */\n @property({ type: String, attribute: \"spellcheck\" })\n fieldSpellcheck: string | null = null;\n /* The field's name when there is no visible label: aria-label on the\n element is passed to the <input>, which is what a screen reader\n focuses -- on the element itself it named nothing. */\n @property({ type: String, attribute: \"aria-label\" })\n fieldLabel = \"\";\n\n protected _slots = new SlotController(this, { slots: [...FIELD_SLOTS, \"end\"], text: [\"label\"] });\n\n protected get _control(): HTMLInputElement | null {\n return this.renderRoot?.querySelector?.(\"input\");\n }\n\n /* With no label in the label slot, the <input> is named by aria-label on\n the element, or else by the text of a <label for> pointing at the element\n (fieldName, shared/form-control.ts). Past both, the browser falls back on\n the placeholder. */\n get _accessibleName() {\n return fieldName(this._slots, this.fieldLabel, this._internals.labels);\n }\n\n /**\n * The value follows the <input> before anything hears of it. The native\n * input event is composed: it leaves the shadow root on its own, retargeted\n * to this element, and its listeners on the page run after this one, which\n * runs on the <input> itself -- so event.target.value is what was just\n * typed. It is not sent again; change is (shared/form-control.ts).\n */\n _onInput(e: Event & { target: HTMLInputElement }) {\n this.value = e.target.value;\n // before the event reaches the page, so a handler asking the form about\n // it gets the answer for what was just typed\n this._sync();\n }\n\n _onChange(e: Event & { target: HTMLInputElement }) {\n this.value = e.target.value;\n this._relayChange();\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"size\") && !isOneOf(SIZES, this.size)) this.size = \"md\";\n }\n\n /* focused is the field's real focus, both ways. Setting it moves keyboard\n focus into the <input> and clearing it blurs the field; focusing or\n leaving the field by hand sets it, and it reflects, so the attribute says\n whether the field has focus. It used to add a .focused class that painted\n the focus ring on a field that did not have focus -- a second, false\n indicator on any page that set it. The ring is now only the browser's\n :focus-visible, which a text field shows whenever it is focused. */\n updated(changed: PropertyValues<this>) {\n this._sync();\n this._followFocused(changed);\n /* What sits in the end slot reads this field -- a bd-paste-button is\n disabled with it and described by its label -- and renders only when\n its own properties change. So it is told to look again whenever this\n field renders, which is when either can have moved. A few elements at\n most; nothing cascades back. */\n for (const el of this._slots.elements(\"end\")) (el as Partial<ReactiveElement>).requestUpdate?.();\n }\n\n _followFocused(changed: PropertyValues<this>) {\n if (!changed.has(\"focused\")) return;\n const input = this.shadowRoot!.querySelector(\"input\");\n const has = this.shadowRoot!.activeElement === input;\n if (this.focused && !has) input?.focus();\n if (!this.focused && has) input?.blur();\n }\n\n render() {\n const disabled = this.disabled || this._formDisabled;\n const inputStateClass = disabled\n ? \"form-input--disabled\"\n : this.invalid\n ? \"form-input--error\"\n : this.validated\n ? \"form-input--success\"\n : \"\";\n const tone = this.invalid ? \"error\" : this.validated ? \"success\" : \"default\";\n const end = this._slots.has(\"end\");\n\n // The hint is the field's description, and the state is announced, not\n // only drawn: invalid used to be a red border alone and the hint was never\n // pointed at, so the reason a field was invalid reached a screen reader\n // not at all.\n return html`\n <div class=\"input-container\">\n ${fieldLabel(this._slots, { size: this.size, required: this.required }, html`<slot name=\"label\"></slot>`)}\n <div class=\"control-row\">\n ${keyed(this._resets, html`<input\n id=${CONTROL_ID}\n part=\"input\"\n class=\"form-input-bd input-${this.size} ${inputStateClass} ${this._attempted ? \"form-input--attempted\" : \"\"} ${end ? \"form-input--with-end\" : \"\"}\"\n type=${this.type}\n name=${this.name || nothing}\n placeholder=${this.placeholder || nothing}\n .value=${this.value}\n inputmode=${this.inputmode || nothing}\n autocomplete=${this.autocomplete || nothing}\n spellcheck=${this.fieldSpellcheck ?? nothing}\n enterkeyhint=${this.enterkeyhint || nothing}\n ?required=${this.required}\n ?disabled=${disabled}\n aria-label=${this._accessibleName || nothing}\n aria-invalid=${this.invalid ? \"true\" : nothing}\n aria-describedby=${describedBy(this._slots)}\n @focus=${() => { this.focused = true; }}\n @blur=${() => { this.focused = false; }}\n @input=${this._onInput}\n @change=${this._onChange}\n @keydown=${this._onFieldKeydown}\n />`)}\n <span class=\"end\" part=\"end\" ?hidden=${!end}><slot name=\"end\"></slot></span>\n </div>\n ${fieldHint(this._slots, tone, html`<slot name=\"hint\"></slot>`)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-input\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A,EAMzBJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAvB,EAAA,UAAA,kBAAA,IAAA,EAAA,EAKlDJ,EAAA,CAAA2B,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAvB,EAAA,UAAA,aAAA,IAAA,EAAA,EA5CpD,EAAAJ,EAAA,CAAA6B,EAAc,UAAU,CAAA,EAAAzB,CAAA,E"}
@@ -1,2 +1,2 @@
1
- import{css as e}from"lit";var t=e`:host{display:block}.root{align-items:center;gap:var(--spacing-16);display:flex}.viewport{flex:auto;min-width:0;overflow:hidden;mask-image:linear-gradient(90deg,#0000,#000 12% 88%,#0000)}.track{width:max-content;animation:bd-logo-marquee var(--bd-logo-marquee-duration) var(--transition-easing-linear) infinite;display:flex}@keyframes bd-logo-marquee{to{transform:translateX(calc(-100% / var(--bd-logo-marquee-copies)))}}.viewport:hover .track,.viewport:focus-within .track,:host([paused]) .track{animation-play-state:paused}.group{align-items:center;gap:var(--bd-logo-marquee-gap);flex:none;padding-inline-end:var(--bd-logo-marquee-gap);display:flex}::slotted(*),.copy>*{flex:none}::slotted(:is(img,picture,bd-img,bd-picture)),.copy>:is(img,picture,bd-img,bd-picture){background-color:var(--color-surface-mark)}.toggle{flex:none}@media (prefers-reduced-motion:reduce){.viewport{mask-image:none}.track{width:100%;animation:none}.group{flex-wrap:wrap;flex:auto;justify-content:center;padding-inline-end:0}.copy,.toggle{display:none}}`;export{t as logoMarqueeCSS};
1
+ import{css as e}from"lit";var t=e`:host{display:block}.root{align-items:center;gap:var(--spacing-16);display:flex}.viewport{flex:auto;min-width:0;overflow:hidden;mask-image:linear-gradient(90deg,#0000,#000 12% 88%,#0000)}.track{width:max-content;animation:bd-logo-marquee var(--bd-logo-marquee-duration) var(--transition-easing-linear) infinite;display:flex}@keyframes bd-logo-marquee{to{transform:translateX(calc(-100% / var(--bd-logo-marquee-copies)))}}.viewport:hover .track,.viewport:focus-within .track,:host([paused]) .track{animation-play-state:paused}.group{align-items:center;gap:var(--bd-logo-marquee-gap);flex:none;padding-inline-end:var(--bd-logo-marquee-gap);display:flex}::slotted(*),.copy>*{flex:none}::slotted(bd-review),.copy>bd-review{align-self:flex-start;width:320px;height:auto}::slotted(:is(img,picture,bd-img,bd-picture)),.copy>:is(img,picture,bd-img,bd-picture){background-color:var(--color-surface-mark)}.toggle{flex:none}@media (prefers-reduced-motion:reduce){.viewport{mask-image:none}.track{width:100%;animation:none}.group{flex-wrap:wrap;flex:auto;justify-content:center;padding-inline-end:0}.copy,.toggle{display:none}}`;export{t as logoMarqueeCSS};
2
2
  //# sourceMappingURL=logo-marquee.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logo-marquee.css.js","names":["logoMarqueeCSS"],"sources":["../../../../src/components/logo-marquee/logo-marquee.css.ts"],"sourcesContent":["import { css } from \"lit\";\n\n/* The track holds the slotted set and its copies side by side and moves left\n by exactly one of them -- 100% of the track divided by how many there are --\n then starts again. Each set carries the gap after its last logo as padding,\n so the space across the seam is the same as the space inside a set. */\nexport const logoMarqueeCSS = css`\n :host {\n display: block;\n }\n\n .root {\n display: flex;\n align-items: center;\n gap: var(--spacing-16);\n }\n\n .viewport {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n /* no token: a mask is read for its alpha only, so the colour is a\n placeholder for \"opaque\" and carries no ink. Solid from 12% to 88%, the\n fade the Figma Logo marquee draws. */\n mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);\n }\n\n .track {\n display: flex;\n width: max-content;\n animation: bd-logo-marquee var(--bd-logo-marquee-duration) var(--transition-easing-linear) infinite;\n }\n\n @keyframes bd-logo-marquee {\n to {\n transform: translateX(calc(-100% / var(--bd-logo-marquee-copies)));\n }\n }\n\n /* Held while the pointer or focus is on the row, and stopped by the paused\n attribute, which the button sets. */\n .viewport:hover .track,\n .viewport:focus-within .track,\n :host([paused]) .track {\n animation-play-state: paused;\n }\n\n .group {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--bd-logo-marquee-gap);\n padding-inline-end: var(--bd-logo-marquee-gap);\n }\n\n ::slotted(*),\n .copy > * {\n flex: none;\n }\n\n /* A logo is an image in its owner's colours, drawn for a white page -- the\n partners' wordmarks are near-black, an award badge has dark type on a\n transparent ground -- so on a dark page it would sink into the ground.\n Each sits on the mark plate, --color-surface-mark, a light ground in\n every theme, on its own box: on a white page that is the page, so light\n does not move. Words the page sets beside the logos (the trusted line's\n \"#1 most awarded\") are type, follow the theme, and take no plate; nor\n does a bd-mark, which paints its own (icons/mark.ts). */\n ::slotted(:is(img, picture, bd-img, bd-picture)),\n .copy > :is(img, picture, bd-img, bd-picture) {\n background-color: var(--color-surface-mark);\n }\n\n /* the pause button, at the row's inline end, outside the fade */\n .toggle {\n flex: none;\n }\n\n /* Still, and nothing hidden: the set wraps in place, and the copies and\n the fade go. */\n @media (prefers-reduced-motion: reduce) {\n .viewport {\n mask-image: none;\n }\n\n .track {\n width: 100%;\n animation: none;\n }\n\n .group {\n flex: 1 1 auto;\n flex-wrap: wrap;\n justify-content: center;\n padding-inline-end: 0;\n }\n\n .copy {\n display: none;\n }\n\n /* nothing moves, so there is nothing to pause */\n .toggle {\n display: none;\n }\n }\n`;\n"],"mappings":"A,0BAMA,IAAaA,EAAiB,CAAG,2gC"}
1
+ {"version":3,"file":"logo-marquee.css.js","names":["logoMarqueeCSS"],"sources":["../../../../src/components/logo-marquee/logo-marquee.css.ts"],"sourcesContent":["import { css } from \"lit\";\n\n/* The track holds the slotted set and its copies side by side and moves left\n by exactly one of them -- 100% of the track divided by how many there are --\n then starts again. Each set carries the gap after its last logo as padding,\n so the space across the seam is the same as the space inside a set. */\nexport const logoMarqueeCSS = css`\n :host {\n display: block;\n }\n\n .root {\n display: flex;\n align-items: center;\n gap: var(--spacing-16);\n }\n\n .viewport {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n /* no token: a mask is read for its alpha only, so the colour is a\n placeholder for \"opaque\" and carries no ink. Solid from 12% to 88%, the\n fade the Figma Logo marquee draws. */\n mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);\n }\n\n .track {\n display: flex;\n width: max-content;\n animation: bd-logo-marquee var(--bd-logo-marquee-duration) var(--transition-easing-linear) infinite;\n }\n\n @keyframes bd-logo-marquee {\n to {\n transform: translateX(calc(-100% / var(--bd-logo-marquee-copies)));\n }\n }\n\n /* Held while the pointer or focus is on the row, and stopped by the paused\n attribute, which the button sets. */\n .viewport:hover .track,\n .viewport:focus-within .track,\n :host([paused]) .track {\n animation-play-state: paused;\n }\n\n .group {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--bd-logo-marquee-gap);\n padding-inline-end: var(--bd-logo-marquee-gap);\n }\n\n ::slotted(*),\n .copy > * {\n flex: none;\n }\n\n /* A review is a card of text, not a mark: it takes a card's width so its\n quote wraps instead of running the row out on one line, and its own\n height, standing at the top of the row, so reviews of different lengths\n line up along their tops. A review fills its row's height in a grid; in\n the marquee that would stretch every card to the tallest. */\n ::slotted(bd-review),\n .copy > bd-review {\n /* no token: the card width the review row was drawn at; no dimension\n token is a card's width */\n width: 320px;\n height: auto;\n align-self: flex-start;\n }\n\n /* A logo is an image in its owner's colours, drawn for a white page -- the\n partners' wordmarks are near-black, an award badge has dark type on a\n transparent ground -- so on a dark page it would sink into the ground.\n Each sits on the mark plate, --color-surface-mark, a light ground in\n every theme, on its own box: on a white page that is the page, so light\n does not move. Words the page sets beside the logos (the trusted line's\n \"#1 most awarded\") are type, follow the theme, and take no plate; nor\n does a bd-mark, which paints its own (icons/mark.ts). */\n ::slotted(:is(img, picture, bd-img, bd-picture)),\n .copy > :is(img, picture, bd-img, bd-picture) {\n background-color: var(--color-surface-mark);\n }\n\n /* the pause button, at the row's inline end, outside the fade */\n .toggle {\n flex: none;\n }\n\n /* Still, and nothing hidden: the set wraps in place, and the copies and\n the fade go. */\n @media (prefers-reduced-motion: reduce) {\n .viewport {\n mask-image: none;\n }\n\n .track {\n width: 100%;\n animation: none;\n }\n\n .group {\n flex: 1 1 auto;\n flex-wrap: wrap;\n justify-content: center;\n padding-inline-end: 0;\n }\n\n .copy {\n display: none;\n }\n\n /* nothing moves, so there is nothing to pause */\n .toggle {\n display: none;\n }\n }\n`;"],"mappings":"A,0BAMA,IAAaA,EAAiB,CAAG,8lC"}
@@ -8,6 +8,11 @@ import "../icons/play.js";
8
8
  * line ("#1 most awarded" and the partner marks) and the award strip under
9
9
  * Proven. Drawn in the foundation Figma file as Logo marquee.
10
10
  *
11
+ * It takes bd-review cards as well as logos: a review row is the same
12
+ * behaviour (the copies, the loop, the pause), so it is this element rather
13
+ * than a second one. A review takes a card's width and stands at the top of
14
+ * the row; see logo-marquee.css.ts.
15
+ *
11
16
  * The logos are the page's: slot them as they are (an <img> with its width
12
17
  * and height, an icon, a label). To loop without a seam the row has to be
13
18
  * longer than the window, so this element clones the slotted set into its
@@ -22,6 +27,17 @@ import "../icons/play.js";
22
27
  * still holds it. Under prefers-reduced-motion it never moves -- the set
23
28
  * wraps in place instead, so nothing is hidden behind the fade -- and the
24
29
  * button goes with the motion.
30
+ *
31
+ * `without-pause-button` leaves the button out, and that is the page's call,
32
+ * never the default: it takes away the one control that stops the motion,
33
+ * which WCAG 2.2.2 (Pause, Stop, Hide, level A) asks of anything that moves
34
+ * on its own for more than five seconds. What stays does not replace it. The
35
+ * pointer on the row holds it only while it is there, focus only if the row
36
+ * holds something focusable (a row of images holds nothing), and reduced
37
+ * motion only for a reader who has asked their system for it. `paused` still
38
+ * stops it, so a page that leaves the button out and stays within 2.2.2 gives
39
+ * the reader its own control that sets `paused`; without one, the row no
40
+ * longer meets 2.2.2.
25
41
  */
26
42
  export declare class LogoMarquee extends LitElement {
27
43
  label: string;
@@ -30,6 +46,9 @@ export declare class LogoMarquee extends LitElement {
30
46
  paused: boolean;
31
47
  pauseLabel: string;
32
48
  playLabel: string;
49
+ /** No pause button: the page takes the WCAG 2.2.2 control away, and owns
50
+ stopping the motion from then on (see the class comment). */
51
+ withoutPauseButton: boolean;
33
52
  _copies: number;
34
53
  _resize: ResizeObserver;
35
54
  _frame: number;
@@ -1,4 +1,4 @@
1
- import{spacing as e}from"../shared/token-scales.js";import{defineElement as t}from"../shared/define-element.js";import"../../tokens/tokens.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ensembleCSS as r}from"../shared/ensemble.css.js";import"../button/button.js";import"../icons/pause.js";import"../icons/play.js";import{logoMarqueeCSS as i}from"./logo-marquee.css.js";import{LitElement as a,html as o}from"lit";import{property as s,state as c}from"lit/decorators.js";var l=class extends a{static{this.styles=[r,i]}constructor(){super(),this.label=``,this.duration=35,this.gap=`48`,this.paused=!1,this.pauseLabel=`Pause the moving logos`,this.playLabel=`Play the moving logos`,this._copies=1,this._frame=0,this._resize=new ResizeObserver(()=>{cancelAnimationFrame(this._frame),this._frame=requestAnimationFrame(()=>this._measure())})}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._observe()}disconnectedCallback(){super.disconnectedCallback(),this._resize.disconnect(),cancelAnimationFrame(this._frame)}firstUpdated(){this._observe()}_observe(){this._resize.observe(this.renderRoot.querySelector(`.viewport`)),this._resize.observe(this.renderRoot.querySelector(`.group`))}_measure(){let e=this.renderRoot.querySelector(`.viewport`),t=this.renderRoot.querySelector(`.group`);if(!e||!t||!t.offsetWidth)return;let n=Math.max(1,Math.ceil(e.offsetWidth/t.offsetWidth));n!==this._copies&&(this._copies=n)}_onSlotChange(){this._fillCopies(),this._measure()}_fillCopies(){let e=this.renderRoot.querySelector(`slot`);if(!e)return;let t=e.assignedElements({flatten:!0});for(let e of this.renderRoot.querySelectorAll(`.copy`))e.replaceChildren(...t.map(e=>e.cloneNode(!0)))}updated(e){e.has(`_copies`)&&this._fillCopies()}_toggle(){this.paused=!this.paused}render(){let t=Array.from({length:this._copies});return o`
1
+ import{spacing as e}from"../shared/token-scales.js";import{defineElement as t}from"../shared/define-element.js";import"../../tokens/tokens.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ensembleCSS as r}from"../shared/ensemble.css.js";import"../button/button.js";import"../icons/pause.js";import"../icons/play.js";import{logoMarqueeCSS as i}from"./logo-marquee.css.js";import{LitElement as a,html as o,nothing as s}from"lit";import{property as c,state as l}from"lit/decorators.js";var u=class extends a{static{this.styles=[r,i]}constructor(){super(),this.label=``,this.duration=35,this.gap=`48`,this.paused=!1,this.pauseLabel=`Pause the moving logos`,this.playLabel=`Play the moving logos`,this.withoutPauseButton=!1,this._copies=1,this._frame=0,this._resize=new ResizeObserver(()=>{cancelAnimationFrame(this._frame),this._frame=requestAnimationFrame(()=>this._measure())})}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._observe()}disconnectedCallback(){super.disconnectedCallback(),this._resize.disconnect(),cancelAnimationFrame(this._frame)}firstUpdated(){this._observe()}_observe(){this._resize.observe(this.renderRoot.querySelector(`.viewport`)),this._resize.observe(this.renderRoot.querySelector(`.group`))}_measure(){let e=this.renderRoot.querySelector(`.viewport`),t=this.renderRoot.querySelector(`.group`);if(!e||!t||!t.offsetWidth)return;let n=Math.max(1,Math.ceil(e.offsetWidth/t.offsetWidth));n!==this._copies&&(this._copies=n)}_onSlotChange(){this._fillCopies(),this._measure()}_fillCopies(){let e=this.renderRoot.querySelector(`slot`);if(!e)return;let t=e.assignedElements({flatten:!0});for(let e of this.renderRoot.querySelectorAll(`.copy`))e.replaceChildren(...t.map(e=>e.cloneNode(!0)))}updated(e){e.has(`_copies`)&&this._fillCopies()}_toggle(){this.paused=!this.paused}render(){let t=Array.from({length:this._copies});return o`
2
2
  <section
3
3
  class="bd-ensemble root"
4
4
  aria-label="${this.label}"
@@ -10,12 +10,12 @@ import{spacing as e}from"../shared/token-scales.js";import{defineElement as t}fr
10
10
  ${t.map(()=>o`<div class="group copy" aria-hidden="true" inert></div>`)}
11
11
  </div>
12
12
  </div>
13
- <bd-button
14
- class="toggle"
15
- appearance="ghost"
16
- size="sm"
17
- @click=${this._toggle}
18
- >${this.paused?o`<bd-icon name="play" size="sm" label="${this.playLabel}"></bd-icon>`:o`<bd-icon name="pause" size="sm" label="${this.pauseLabel}"></bd-icon>`}</bd-button>
13
+ ${this.withoutPauseButton?s:o`<bd-button
14
+ class="toggle"
15
+ appearance="ghost"
16
+ size="sm"
17
+ @click=${this._toggle}
18
+ >${this.paused?o`<bd-icon name="play" size="sm" label="${this.playLabel}"></bd-icon>`:o`<bd-icon name="pause" size="sm" label="${this.pauseLabel}"></bd-icon>`}</bd-button>`}
19
19
  </section>
20
- `}};n([s({type:String})],l.prototype,`label`,void 0),n([s({type:Number})],l.prototype,`duration`,void 0),n([s({type:String})],l.prototype,`gap`,void 0),n([s({type:Boolean,reflect:!0})],l.prototype,`paused`,void 0),n([s({type:String,attribute:`pause-label`})],l.prototype,`pauseLabel`,void 0),n([s({type:String,attribute:`play-label`})],l.prototype,`playLabel`,void 0),n([c()],l.prototype,`_copies`,void 0),l=n([t(`bd-logo-marquee`)],l);export{l as LogoMarquee};
20
+ `}};n([c({type:String})],u.prototype,`label`,void 0),n([c({type:Number})],u.prototype,`duration`,void 0),n([c({type:String})],u.prototype,`gap`,void 0),n([c({type:Boolean,reflect:!0})],u.prototype,`paused`,void 0),n([c({type:String,attribute:`pause-label`})],u.prototype,`pauseLabel`,void 0),n([c({type:String,attribute:`play-label`})],u.prototype,`playLabel`,void 0),n([c({type:Boolean,attribute:`without-pause-button`})],u.prototype,`withoutPauseButton`,void 0),n([l()],u.prototype,`_copies`,void 0),u=n([t(`bd-logo-marquee`)],u);export{u as LogoMarquee};
21
21
  //# sourceMappingURL=logo-marquee.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logo-marquee.js","names":["_decorate","__decorate","LogoMarquee","LitElement","ensembleCSS","logoMarqueeCSS","viewport","group","copies","slot","items","copy","item","changed","spacing","property","state","defineElement"],"sources":["../../../../src/components/logo-marquee/logo-marquee.ts"],"sourcesContent":["import { LitElement, html, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/icons/pause.ts\";\nimport \"#components/icons/play.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport { spacing } from \"#shared/token-scales.ts\";\nimport { logoMarqueeCSS } from \"./logo-marquee.css.ts\";\n\n/**\n * A row of logos sliding sideways behind an edge fade: the homepage's trusted\n * line (\"#1 most awarded\" and the partner marks) and the award strip under\n * Proven. Drawn in the foundation Figma file as Logo marquee.\n *\n * The logos are the page's: slot them as they are (an <img> with its width\n * and height, an icon, a label). To loop without a seam the row has to be\n * longer than the window, so this element clones the slotted set into its\n * own shadow root as many times as the width needs and moves the whole track\n * by one copy -- the jump back is then exactly one repeat, and invisible. The\n * copies are aria-hidden and inert: a screen reader reads the set once.\n *\n * It moves on its own for longer than five seconds, so it has a pause button\n * (WCAG 2.2.2): holding it on hover or focus was not enough, because the\n * logos are usually images and nothing in the row takes focus. The button\n * sets `paused`, which a page can also set. The pointer or focus on the row\n * still holds it. Under prefers-reduced-motion it never moves -- the set\n * wraps in place instead, so nothing is hidden behind the fade -- and the\n * button goes with the motion.\n */\n@defineElement(\"bd-logo-marquee\")\nexport class LogoMarquee extends LitElement {\n @property({ type: String })\n label = \"\";\n // seconds for one copy to pass: 35 for the partners and the awards alike\n @property({ type: Number })\n duration = 35;\n // a step on the spacing scale, between two logos\n @property({ type: String })\n gap = \"48\";\n @property({ type: Boolean, reflect: true })\n paused = false;\n @property({ type: String, attribute: \"pause-label\" })\n pauseLabel = \"Pause the moving logos\";\n @property({ type: String, attribute: \"play-label\" })\n playLabel = \"Play the moving logos\";\n // copies of the set after the original; at least one, or there is no loop\n @state()\n _copies = 1;\n\n _resize: ResizeObserver;\n _frame = 0;\n\n static styles = [ensembleCSS, logoMarqueeCSS];\n\n /* A resize is measured on the next frame, not inside the observer's\n delivery. A new copy count re-renders the track, and in WebKit that\n resizes a box this observer watches while the delivery is still running:\n Safari reported \"ResizeObserver loop completed with undelivered\n notifications\" on every homepage load. Measured a frame later, the new\n size is an ordinary delivery of its own. */\n constructor() {\n super();\n this._resize = new ResizeObserver(() => {\n cancelAnimationFrame(this._frame);\n this._frame = requestAnimationFrame(() => this._measure());\n });\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.hasUpdated) this._observe();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._resize.disconnect();\n cancelAnimationFrame(this._frame);\n }\n\n firstUpdated() {\n this._observe();\n }\n\n _observe() {\n this._resize.observe(this.renderRoot.querySelector(\".viewport\")!);\n this._resize.observe(this.renderRoot.querySelector(\".group\")!);\n }\n\n /* One copy must cover the window on its own while the original slides out,\n so a set narrower than the window takes more than one. */\n _measure() {\n const viewport = this.renderRoot.querySelector<HTMLElement>(\".viewport\");\n const group = this.renderRoot.querySelector<HTMLElement>(\".group\");\n if (!viewport || !group || !group.offsetWidth) return;\n const copies = Math.max(1, Math.ceil(viewport.offsetWidth / group.offsetWidth));\n if (copies !== this._copies) this._copies = copies;\n }\n\n _onSlotChange() {\n this._fillCopies();\n this._measure();\n }\n\n _fillCopies() {\n const slot = this.renderRoot.querySelector(\"slot\");\n if (!slot) return;\n const items = slot.assignedElements({ flatten: true });\n for (const copy of this.renderRoot.querySelectorAll(\".copy\")) {\n copy.replaceChildren(...items.map(item => item.cloneNode(true)));\n }\n }\n\n updated(changed: PropertyValues<this>) {\n if (changed.has(\"_copies\")) this._fillCopies();\n }\n\n _toggle() {\n this.paused = !this.paused;\n }\n\n render() {\n const copies = Array.from({ length: this._copies });\n return html`\n <section\n class=\"bd-ensemble root\"\n aria-label=\"${this.label}\"\n style=\"--bd-logo-marquee-gap: ${spacing(this.gap) || \"var(--spacing-48)\"}; --bd-logo-marquee-duration: ${this.duration}s; --bd-logo-marquee-copies: ${this._copies + 1};\"\n >\n <div class=\"viewport\">\n <div class=\"track\">\n <div class=\"group\"><slot @slotchange=${this._onSlotChange}></slot></div>\n ${copies.map(() => html`<div class=\"group copy\" aria-hidden=\"true\" inert></div>`)}\n </div>\n </div>\n <bd-button\n class=\"toggle\"\n appearance=\"ghost\"\n size=\"sm\"\n @click=${this._toggle}\n >${this.paused\n ? html`<bd-icon name=\"play\" size=\"sm\" label=\"${this.playLabel}\"></bd-icon>`\n : html`<bd-icon name=\"pause\" size=\"sm\" label=\"${this.pauseLabel}\"></bd-icon>`}</bd-button>\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-logo-marquee\": LogoMarquee;\n }\n}\n"],"mappings":"A,0fAiCO,IAAME,EAAN,cAA0BC,CAAW,C,OAsB1B,KAAA,OAAA,CAACC,EAAaC,CAAc,C,CAQ5C,aAAc,CACZ,MAAM,EA7BA,KAAA,MAAA,GAGG,KAAA,SAAA,GAGL,KAAA,IAAA,KAEG,KAAA,OAAA,GAEI,KAAA,WAAA,yBAED,KAAA,UAAA,wBAGF,KAAA,QAAA,EAGD,KAAA,OAAA,EAYP,KAAK,QAAU,IAAI,mBAAqB,CACtC,qBAAqB,KAAK,MAAM,EAChC,KAAK,OAAS,0BAA4B,KAAK,SAAS,CAAC,CAC3D,CAAC,CACH,CAEA,mBAAoB,CAClB,MAAM,kBAAkB,EACpB,KAAK,YAAY,KAAK,SAAS,CACrC,CAEA,sBAAuB,CACrB,MAAM,qBAAqB,EAC3B,KAAK,QAAQ,WAAW,EACxB,qBAAqB,KAAK,MAAM,CAClC,CAEA,cAAe,CACb,KAAK,SAAS,CAChB,CAEA,UAAW,CACT,KAAK,QAAQ,QAAQ,KAAK,WAAW,cAAc,WAAW,CAAE,EAChE,KAAK,QAAQ,QAAQ,KAAK,WAAW,cAAc,QAAQ,CAAE,CAC/D,CAIA,UAAW,CACT,IAAMC,EAAW,KAAK,WAAW,cAA2B,WAAW,EACjEC,EAAQ,KAAK,WAAW,cAA2B,QAAQ,EACjE,GAAI,CAACD,GAAY,CAAC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AAC,CAAA,EAAAb,EAAA,UAAA,MAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAe,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAb,EAAA,UAAA,SAAA,IAAA,EAAA,EAEzCF,EAAA,CAAAe,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,CAAC,CAAA,EAAAb,EAAA,UAAA,aAAA,IAAA,EAAA,EAEnDF,EAAA,CAAAe,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAb,EAAA,UAAA,YAAA,IAAA,EAAA,EAGlDF,EAAA,CAAAgB,EAAM,CAAA,EAAAd,EAAA,UAAA,UAAA,IAAA,EAAA,EAjBR,EAAAF,EAAA,CAAAiB,EAAc,iBAAiB,CAAA,EAAAf,CAAA,E"}
1
+ {"version":3,"file":"logo-marquee.js","names":["_decorate","__decorate","LogoMarquee","LitElement","ensembleCSS","logoMarqueeCSS","viewport","group","copies","slot","items","copy","item","changed","spacing","nothing","property","state","defineElement"],"sources":["../../../../src/components/logo-marquee/logo-marquee.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/icons/pause.ts\";\nimport \"#components/icons/play.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport { spacing } from \"#shared/token-scales.ts\";\nimport { logoMarqueeCSS } from \"./logo-marquee.css.ts\";\n\n/**\n * A row of logos sliding sideways behind an edge fade: the homepage's trusted\n * line (\"#1 most awarded\" and the partner marks) and the award strip under\n * Proven. Drawn in the foundation Figma file as Logo marquee.\n *\n * It takes bd-review cards as well as logos: a review row is the same\n * behaviour (the copies, the loop, the pause), so it is this element rather\n * than a second one. A review takes a card's width and stands at the top of\n * the row; see logo-marquee.css.ts.\n *\n * The logos are the page's: slot them as they are (an <img> with its width\n * and height, an icon, a label). To loop without a seam the row has to be\n * longer than the window, so this element clones the slotted set into its\n * own shadow root as many times as the width needs and moves the whole track\n * by one copy -- the jump back is then exactly one repeat, and invisible. The\n * copies are aria-hidden and inert: a screen reader reads the set once.\n *\n * It moves on its own for longer than five seconds, so it has a pause button\n * (WCAG 2.2.2): holding it on hover or focus was not enough, because the\n * logos are usually images and nothing in the row takes focus. The button\n * sets `paused`, which a page can also set. The pointer or focus on the row\n * still holds it. Under prefers-reduced-motion it never moves -- the set\n * wraps in place instead, so nothing is hidden behind the fade -- and the\n * button goes with the motion.\n *\n * `without-pause-button` leaves the button out, and that is the page's call,\n * never the default: it takes away the one control that stops the motion,\n * which WCAG 2.2.2 (Pause, Stop, Hide, level A) asks of anything that moves\n * on its own for more than five seconds. What stays does not replace it. The\n * pointer on the row holds it only while it is there, focus only if the row\n * holds something focusable (a row of images holds nothing), and reduced\n * motion only for a reader who has asked their system for it. `paused` still\n * stops it, so a page that leaves the button out and stays within 2.2.2 gives\n * the reader its own control that sets `paused`; without one, the row no\n * longer meets 2.2.2.\n */\n@defineElement(\"bd-logo-marquee\")\nexport class LogoMarquee extends LitElement {\n @property({ type: String })\n label = \"\";\n // seconds for one copy to pass: 35 for the partners and the awards alike\n @property({ type: Number })\n duration = 35;\n // a step on the spacing scale, between two logos\n @property({ type: String })\n gap = \"48\";\n @property({ type: Boolean, reflect: true })\n paused = false;\n @property({ type: String, attribute: \"pause-label\" })\n pauseLabel = \"Pause the moving logos\";\n @property({ type: String, attribute: \"play-label\" })\n playLabel = \"Play the moving logos\";\n /** No pause button: the page takes the WCAG 2.2.2 control away, and owns\n stopping the motion from then on (see the class comment). */\n @property({ type: Boolean, attribute: \"without-pause-button\" })\n withoutPauseButton = false;\n // copies of the set after the original; at least one, or there is no loop\n @state()\n _copies = 1;\n\n _resize: ResizeObserver;\n _frame = 0;\n\n static styles = [ensembleCSS, logoMarqueeCSS];\n\n /* A resize is measured on the next frame, not inside the observer's\n delivery. A new copy count re-renders the track, and in WebKit that\n resizes a box this observer watches while the delivery is still running:\n Safari reported \"ResizeObserver loop completed with undelivered\n notifications\" on every homepage load. Measured a frame later, the new\n size is an ordinary delivery of its own. */\n constructor() {\n super();\n this._resize = new ResizeObserver(() => {\n cancelAnimationFrame(this._frame);\n this._frame = requestAnimationFrame(() => this._measure());\n });\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.hasUpdated) this._observe();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._resize.disconnect();\n cancelAnimationFrame(this._frame);\n }\n\n firstUpdated() {\n this._observe();\n }\n\n _observe() {\n this._resize.observe(this.renderRoot.querySelector(\".viewport\")!);\n this._resize.observe(this.renderRoot.querySelector(\".group\")!);\n }\n\n /* One copy must cover the window on its own while the original slides out,\n so a set narrower than the window takes more than one. */\n _measure() {\n const viewport = this.renderRoot.querySelector<HTMLElement>(\".viewport\");\n const group = this.renderRoot.querySelector<HTMLElement>(\".group\");\n if (!viewport || !group || !group.offsetWidth) return;\n const copies = Math.max(1, Math.ceil(viewport.offsetWidth / group.offsetWidth));\n if (copies !== this._copies) this._copies = copies;\n }\n\n _onSlotChange() {\n this._fillCopies();\n this._measure();\n }\n\n _fillCopies() {\n const slot = this.renderRoot.querySelector(\"slot\");\n if (!slot) return;\n const items = slot.assignedElements({ flatten: true });\n for (const copy of this.renderRoot.querySelectorAll(\".copy\")) {\n copy.replaceChildren(...items.map(item => item.cloneNode(true)));\n }\n }\n\n updated(changed: PropertyValues<this>) {\n if (changed.has(\"_copies\")) this._fillCopies();\n }\n\n _toggle() {\n this.paused = !this.paused;\n }\n\n render() {\n const copies = Array.from({ length: this._copies });\n return html`\n <section\n class=\"bd-ensemble root\"\n aria-label=\"${this.label}\"\n style=\"--bd-logo-marquee-gap: ${spacing(this.gap) || \"var(--spacing-48)\"}; --bd-logo-marquee-duration: ${this.duration}s; --bd-logo-marquee-copies: ${this._copies + 1};\"\n >\n <div class=\"viewport\">\n <div class=\"track\">\n <div class=\"group\"><slot @slotchange=${this._onSlotChange}></slot></div>\n ${copies.map(() => html`<div class=\"group copy\" aria-hidden=\"true\" inert></div>`)}\n </div>\n </div>\n ${this.withoutPauseButton\n ? nothing\n : html`<bd-button\n class=\"toggle\"\n appearance=\"ghost\"\n size=\"sm\"\n @click=${this._toggle}\n >${this.paused\n ? html`<bd-icon name=\"play\" size=\"sm\" label=\"${this.playLabel}\"></bd-icon>`\n : html`<bd-icon name=\"pause\" size=\"sm\" label=\"${this.pauseLabel}\"></bd-icon>`}</bd-button>`}\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-logo-marquee\": LogoMarquee;\n }\n}\n"],"mappings":"A,ugBAiDO,IAAME,EAAN,cAA0BC,CAAW,C,OA0B1B,KAAA,OAAA,CAACC,EAAaC,CAAc,C,CAQ5C,aAAc,CACZ,MAAM,EAjCA,KAAA,MAAA,GAGG,KAAA,SAAA,GAGL,KAAA,IAAA,KAEG,KAAA,OAAA,GAEI,KAAA,WAAA,yBAED,KAAA,UAAA,wBAIS,KAAA,mBAAA,GAGX,KAAA,QAAA,EAGD,KAAA,OAAA,EAYP,KAAK,QAAU,IAAI,mBAAqB,CACtC,qBAAqB,KAAK,MAAM,EAChC,KAAK,OAAS,0BAA4B,KAAK,SAAS,CAAC,CAC3D,CAAC,CACH,CAEA,mBAAoB,CAClB,MAAM,kBAAkB,EACpB,KAAK,YAAY,KAAK,SAAS,CACrC,CAEA,sBAAuB,CACrB,MAAM,qBAAqB,EAC3B,KAAK,QAAQ,WAAW,EACxB,qBAAqB,KAAK,MAAM,CAClC,CAEA,cAAe,CACb,KAAK,SAAS,CAChB,CAEA,UAAW,CACT,KAAK,QAAQ,QAAQ,KAAK,WAAW,cAAc,WAAW,CAAE,EAChE,KAAK,QAAQ,QAAQ,KAAK,WAAW,cAAc,QAAQ,CAAE,CAC/D,CAIA,UAAW,CACT,IAAMC,EAAW,KAAK,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AgB,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAd,EAAA,UAAA,WAAA,IAAA,EAAA,EAGzBF,EAAA,CAAAgB,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAd,EAAA,UAAA,MAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAgB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAd,EAAA,UAAA,SAAA,IAAA,EAAA,EAEzCF,EAAA,CAAAgB,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,CAAC,CAAA,EAAAd,EAAA,UAAA,aAAA,IAAA,EAAA,EAEnDF,EAAA,CAAAgB,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAd,EAAA,UAAA,YAAA,IAAA,EAAA,EAIlDF,EAAA,CAAAgB,EAAS,CAAE,KAAM,QAAS,UAAW,sBAAuB,CAAC,CAAA,EAAAd,EAAA,UAAA,qBAAA,IAAA,EAAA,EAG7DF,EAAA,CAAAiB,EAAM,CAAA,EAAAf,EAAA,UAAA,UAAA,IAAA,EAAA,EArBR,EAAAF,EAAA,CAAAkB,EAAc,iBAAiB,CAAA,EAAAhB,CAAA,E"}
@@ -1,2 +1,2 @@
1
- import{css as e}from"lit";var t=e`:host{height:100%;font-family:var(--typography-fontFamily-sans);box-sizing:border-box;display:block}.bd-review-card{background:var(--status-brand-surface);border-radius:var(--shape-radius-3xl);padding:var(--spacing-28);box-sizing:border-box;flex-direction:column;height:100%;display:flex}:host([background=container]) .bd-review-card{background:var(--color-surface-container)}.bd-review-card>[hidden],.bd-review-meta>[hidden]{display:none}.bd-review-mark{color:var(--color-text-brand);margin-bottom:var(--spacing-8);display:block}.bd-review-quote{color:var(--color-text-primary);font-family:var(--typography-body-regular-fontFamily);font-size:var(--typography-body-regular-fontSize);font-weight:var(--typography-body-regular-fontWeight);line-height:var(--typography-body-regular-lineHeight);letter-spacing:var(--typography-body-regular-letterSpacing);flex-grow:1;margin:0}.bd-review-meta{gap:var(--spacing-16);margin-top:var(--spacing-32);flex-direction:column;display:flex}.bd-review-source{color:var(--color-text-primary);font-family:var(--typography-body-small-fontFamily);font-size:var(--typography-body-small-fontSize);font-weight:var(--typography-fontWeight-bold);line-height:var(--typography-body-small-lineHeight);letter-spacing:var(--typography-body-small-letterSpacing);margin:0}.bd-review-date{color:var(--color-text-muted);font-family:var(--typography-body-small-fontFamily);font-size:var(--typography-body-small-fontSize);font-weight:var(--typography-body-small-fontWeight);line-height:var(--typography-body-small-lineHeight);letter-spacing:var(--typography-body-small-letterSpacing)}`;export{t as default};
1
+ import{css as e}from"lit";var t=e`:host{height:100%;font-family:var(--typography-fontFamily-sans);box-sizing:border-box;display:block}.bd-review-card{background:var(--status-brand-surface);border-radius:var(--shape-radius-3xl);padding:var(--spacing-28);box-sizing:border-box;flex-direction:column;height:100%;display:flex}:host([background=container]) .bd-review-card{background:var(--color-surface-container)}:host([background=none]) .bd-review-card{padding:var(--spacing-0);background:0 0}.bd-review-card>[hidden],.bd-review-meta>[hidden]{display:none}.bd-review-mark{color:var(--color-text-brand);margin-bottom:var(--spacing-8);display:block}.bd-review-quote{color:var(--color-text-primary);font-family:var(--typography-body-regular-fontFamily);font-size:var(--typography-body-regular-fontSize);font-weight:var(--typography-body-regular-fontWeight);line-height:var(--typography-body-regular-lineHeight);letter-spacing:var(--typography-body-regular-letterSpacing);flex-grow:1;margin:0}.bd-review-divider{width:var(--spacing-24);height:var(--spacing-1);margin-top:var(--spacing-16);background:var(--status-brand-accent);flex-shrink:0;display:block}.bd-review-meta{gap:var(--spacing-4);margin-top:var(--spacing-16);flex-direction:column;display:flex}.bd-review-source{color:var(--color-text-primary);font-family:var(--typography-body-small-fontFamily);font-size:var(--typography-body-small-fontSize);font-weight:var(--typography-fontWeight-bold);line-height:var(--typography-body-small-lineHeight);letter-spacing:var(--typography-body-small-letterSpacing);margin:0}.bd-review-date{color:var(--color-text-muted);font-family:var(--typography-body-small-fontFamily);font-size:var(--typography-body-small-fontSize);font-weight:var(--typography-body-small-fontWeight);line-height:var(--typography-body-small-lineHeight);letter-spacing:var(--typography-body-small-letterSpacing)}`;export{t as default};
2
2
  //# sourceMappingURL=review.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.css.js","names":["review_css_default"],"sources":["../../../../src/components/review/review.css.ts"],"sourcesContent":["import { css } from \"lit\";\n\n/* The card 3.x drew, measured against that render: the same ground, corner,\n inset, sizes, inks and distances. 3.x set the quote and the source in bd-p,\n whose <p> carried the 16px flow margin; the distances that margin made are\n spelled here, on the review's own boxes. */\nexport default css`\n :host {\n display: block;\n height: 100%;\n font-family: var(--typography-fontFamily-sans);\n box-sizing: border-box;\n }\n\n .bd-review-card {\n background: var(--status-brand-surface);\n border-radius: var(--shape-radius-3xl);\n padding: var(--spacing-28);\n box-sizing: border-box;\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n :host([background=\"container\"]) .bd-review-card {\n background: var(--color-surface-container);\n }\n\n /* Each part's box is hidden while its slot is empty; the attribute's\n selector outweighs the display a box sets below. */\n .bd-review-card > [hidden],\n .bd-review-meta > [hidden] {\n display: none;\n }\n\n .bd-review-mark {\n display: block;\n color: var(--color-text-brand);\n margin-bottom: var(--spacing-8);\n }\n\n /* The quote, in the body role bd-p's regular appearance drew. It takes the\n card's spare height, so the meta of a row of cards sits at the foot. */\n .bd-review-quote {\n margin: 0;\n flex-grow: 1;\n color: var(--color-text-primary);\n font-family: var(--typography-body-regular-fontFamily);\n font-size: var(--typography-body-regular-fontSize);\n font-weight: var(--typography-body-regular-fontWeight);\n line-height: var(--typography-body-regular-lineHeight);\n letter-spacing: var(--typography-body-regular-letterSpacing);\n }\n\n /* 32 above the meta: the quote paragraph's 16 flow margin and the 16 3.x\n set under it. Above the meta rather than under the quote, so a review\n with no source and no date ends at the card's inset. The 16 between the\n source and the date is the source paragraph's flow margin; as a gap, a\n source with no date under it carries none. */\n .bd-review-meta {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-16);\n margin-top: var(--spacing-32);\n }\n\n /* The source, at body-small in bold, as bd-p small font-weight=\"bold\" drew\n it. */\n .bd-review-source {\n margin: 0;\n color: var(--color-text-primary);\n font-family: var(--typography-body-small-fontFamily);\n font-size: var(--typography-body-small-fontSize);\n /* no role: body-small at bold, which 3.x drew through bd-p's font-weight\n prop; no role carries it, and label-default's medium 500 would lighten\n every source */\n font-weight: var(--typography-fontWeight-bold);\n line-height: var(--typography-body-small-lineHeight);\n letter-spacing: var(--typography-body-small-letterSpacing);\n }\n\n .bd-review-date {\n color: var(--color-text-muted);\n font-family: var(--typography-body-small-fontFamily);\n font-size: var(--typography-body-small-fontSize);\n font-weight: var(--typography-body-small-fontWeight);\n line-height: var(--typography-body-small-lineHeight);\n letter-spacing: var(--typography-body-small-letterSpacing);\n }\n`;\n"],"mappings":"A,0BAMA,IAAAA,EAAe,CAAG,gkD"}
1
+ {"version":3,"file":"review.css.js","names":["review_css_default"],"sources":["../../../../src/components/review/review.css.ts"],"sourcesContent":["import { css } from \"lit\";\n\n/* The card 3.x drew, measured against that render: the same ground, corner,\n inset, sizes, inks and distances. 3.x set the quote and the source in bd-p,\n whose <p> carried the 16px flow margin; the distances that margin made are\n spelled here, on the review's own boxes. */\nexport default css`\n :host {\n display: block;\n height: 100%;\n font-family: var(--typography-fontFamily-sans);\n box-sizing: border-box;\n }\n\n .bd-review-card {\n background: var(--status-brand-surface);\n border-radius: var(--shape-radius-3xl);\n padding: var(--spacing-28);\n box-sizing: border-box;\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n :host([background=\"container\"]) .bd-review-card {\n background: var(--color-surface-container);\n }\n\n :host([background=\"none\"]) .bd-review-card {\n background: none;\n padding: var(--spacing-0);\n }\n\n /* Each part's box is hidden while its slot is empty; the attribute's\n selector outweighs the display a box sets below. */\n .bd-review-card > [hidden],\n .bd-review-meta > [hidden] {\n display: none;\n }\n\n .bd-review-mark {\n display: block;\n color: var(--color-text-brand);\n margin-bottom: var(--spacing-8);\n }\n\n /* The quote, in the body role bd-p's regular appearance drew. It takes the\n card's spare height, so the meta of a row of cards sits at the foot. */\n .bd-review-quote {\n margin: 0;\n flex-grow: 1;\n color: var(--color-text-primary);\n font-family: var(--typography-body-regular-fontFamily);\n font-size: var(--typography-body-regular-fontSize);\n font-weight: var(--typography-body-regular-fontWeight);\n line-height: var(--typography-body-regular-lineHeight);\n letter-spacing: var(--typography-body-regular-letterSpacing);\n }\n\n .bd-review-divider {\n display: block;\n flex-shrink: 0;\n width: var(--spacing-24);\n height: var(--spacing-1);\n margin-top: var(--spacing-16);\n background: var(--status-brand-accent);\n }\n\n /* The brand rule sits 16 under the quote and the meta 16 under the rule,\n 4 between the source and the date: the review as the reviews redesign\n draws it, in a grid and in a marquee alike. The rule and the meta are\n hidden together when neither a source nor a date is slotted, so a quote\n alone ends at the card's inset. */\n .bd-review-meta {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-4);\n margin-top: var(--spacing-16);\n }\n\n /* The source, at body-small in bold, as bd-p small font-weight=\"bold\" drew\n it. */\n .bd-review-source {\n margin: 0;\n color: var(--color-text-primary);\n font-family: var(--typography-body-small-fontFamily);\n font-size: var(--typography-body-small-fontSize);\n /* no role: body-small at bold, which 3.x drew through bd-p's font-weight\n prop; no role carries it, and label-default's medium 500 would lighten\n every source */\n font-weight: var(--typography-fontWeight-bold);\n line-height: var(--typography-body-small-lineHeight);\n letter-spacing: var(--typography-body-small-letterSpacing);\n }\n\n .bd-review-date {\n color: var(--color-text-muted);\n font-family: var(--typography-body-small-fontFamily);\n font-size: var(--typography-body-small-fontSize);\n font-weight: var(--typography-body-small-fontWeight);\n line-height: var(--typography-body-small-lineHeight);\n letter-spacing: var(--typography-body-small-letterSpacing);\n }\n`;"],"mappings":"A,0BAMA,IAAAA,EAAe,CAAG,kzD"}
@@ -3,7 +3,7 @@ import { SlotController } from "../shared/controller.slot.js";
3
3
  import "../../tokens/tokens.js";
4
4
  import "../icons/quote.js";
5
5
  import "../p/p.js";
6
- declare const BACKGROUNDS: readonly ["tint", "container"];
6
+ declare const BACKGROUNDS: readonly ["tint", "container", "none"];
7
7
  type Background = typeof BACKGROUNDS[number];
8
8
  type Part = "" | "caption" | "date";
9
9
  /**
@@ -26,7 +26,7 @@ type Part = "" | "caption" | "date";
26
26
  */
27
27
  export declare class BdReview extends LitElement {
28
28
  static styles: import("lit").CSSResult[];
29
- /** The card's ground: tint (default) | container. */
29
+ /** The card's ground: tint (default) | container | none. */
30
30
  background: Background;
31
31
  _internals: ElementInternals;
32
32
  _slots: SlotController<Part>;
@@ -1,8 +1,9 @@
1
- import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{isOneOf as t}from"../shared/prop-vocabulary.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../p/p.js";import{SlotController as r}from"../shared/controller.slot.js";import"../icons/quote.js";import i from"./review.css.js";import{LitElement as a,html as o}from"lit";import{property as s}from"lit/decorators.js";var c=[`tint`,`container`],l=class extends a{static{this.styles=[i]}constructor(){super(),this.background=`tint`,this._slots=new r(this,{slots:[``,`caption`,`date`]}),this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this._internals.role=this.parentElement?.localName===`bd-review-grid`?`listitem`:null}willUpdate(e){e.has(`background`)&&!t(c,this.background)&&(this.background=`tint`)}render(){let e=e=>this._slots.has(e);return o`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{isOneOf as t}from"../shared/prop-vocabulary.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../p/p.js";import{SlotController as r}from"../shared/controller.slot.js";import"../icons/quote.js";import i from"./review.css.js";import{LitElement as a,html as o}from"lit";import{property as s}from"lit/decorators.js";var c=[`tint`,`container`,`none`],l=class extends a{static{this.styles=[i]}constructor(){super(),this.background=`tint`,this._slots=new r(this,{slots:[``,`caption`,`date`]}),this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this._internals.role=this.parentElement?.localName===`bd-review-grid`?`listitem`:null}willUpdate(e){e.has(`background`)&&!t(c,this.background)&&(this.background=`tint`)}render(){let e=e=>this._slots.has(e),t=e(`caption`)||e(`date`);return o`
2
2
  <div class="bd-review-card">
3
3
  <bd-icon name="quote" class="bd-review-mark" size="xl"></bd-icon>
4
4
  <p class="bd-review-quote" ?hidden=${!e(``)}><slot></slot></p>
5
- <div class="bd-review-meta" ?hidden=${!e(`caption`)&&!e(`date`)}>
5
+ <span class="bd-review-divider" aria-hidden="true" ?hidden=${!t}></span>
6
+ <div class="bd-review-meta" ?hidden=${!t}>
6
7
  <p class="bd-review-source" ?hidden=${!e(`caption`)}><slot name="caption"></slot></p>
7
8
  <div class="bd-review-date" ?hidden=${!e(`date`)}><slot name="date"></slot></div>
8
9
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","names":["reviewCSS","_decorate","__decorate","review_css_default","BACKGROUNDS","BdReview","LitElement","SlotController","changed","isOneOf","has","part","property","defineElement"],"sources":["../../../../src/components/review/review.ts"],"sourcesContent":["import { LitElement, html, type PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport { isOneOf } from \"#shared/prop-vocabulary.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/quote.ts\";\n/* 3.x drew the quote and the source in bd-p, so its module registered it,\n and a page importing only this module still gets it. */\nimport \"#components/p/p.ts\";\nimport reviewCSS from \"./review.css.ts\";\n\n/* The ground the card is drawn on. A ground, not a look (N5): `tint` is the\n brand's lightest wash, --status-brand-surface, so it follows the business\n line's brand; `container` is --color-surface-container, the ground\n bd-card and bd-bento-item draw by default and call by the same word. It\n was `variant`, whose \"neutral\" would read as the meaning neutral, which\n the look and meaning vocabularies keep apart (N6). */\nconst BACKGROUNDS = [\"tint\", \"container\"] as const;\ntype Background = typeof BACKGROUNDS[number];\n\ntype Part = \"\" | \"caption\" | \"date\";\n\n/**\n * A single testimonial: the quote, who said it, and when.\n *\n * <bd-review background=\"tint\">\n * If you're looking to buy a security suite, our experts and readers agree: Bitdefender should be your top choice.\n * <span slot=\"caption\">PCMag</span>\n * <span slot=\"date\">February 3, 2026</span>\n * </bd-review>\n *\n * The quote is the review's content, so it is the default slot (3.x's\n * `quote`), and the source is its `caption` (3.x's `source`). All three are\n * text: the review sets their type and ink -- the quote at body-regular, the\n * source at body-small bold, the date at body-small in muted ink -- so the\n * page writes words, not paragraphs. 3.x drew the quote and source in its own\n * bd-p; the slots sit in its own boxes now. Each part's box is hidden while\n * its slot is empty, and the quote takes the card's spare height, so the\n * sources of a row of reviews line up at the foot.\n */\n@defineElement(\"bd-review\")\nexport class BdReview extends LitElement {\n static styles = [reviewCSS];\n\n /** The card's ground: tint (default) | container. */\n @property({ type: String, attribute: \"background\", reflect: true })\n background: Background = \"tint\";\n\n _internals: ElementInternals;\n\n _slots = new SlotController<Part>(this, { slots: [\"\", \"caption\", \"date\"] });\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n /* In a bd-review-grid, a review is one item of the grid's list -- a list\n whose children are not list items is announced as an empty list, or not\n at all (axe: aria-required-children). The role is the element's own,\n through ElementInternals, as bd-breadcrumb-item's is: the grid used to\n write role=\"listitem\" onto the page's markup, where it stayed after the\n review left the list. A role the page writes on the element still wins,\n and outside a grid a review is no item of anything. */\n connectedCallback() {\n super.connectedCallback();\n this._internals.role = this.parentElement?.localName === \"bd-review-grid\" ? \"listitem\" : null;\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"background\") && !isOneOf(BACKGROUNDS, this.background)) this.background = \"tint\";\n }\n\n render() {\n const has = (part: Part) => this._slots.has(part);\n return html`\n <div class=\"bd-review-card\">\n <bd-icon name=\"quote\" class=\"bd-review-mark\" size=\"xl\"></bd-icon>\n <p class=\"bd-review-quote\" ?hidden=${!has(\"\")}><slot></slot></p>\n <div class=\"bd-review-meta\" ?hidden=${!has(\"caption\") && !has(\"date\")}>\n <p class=\"bd-review-source\" ?hidden=${!has(\"caption\")}><slot name=\"caption\"></slot></p>\n <div class=\"bd-review-date\" ?hidden=${!has(\"date\")}><slot name=\"date\"></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-review\": BdReview;\n }\n}\n"],"mappings":"A,6bAmBA,IAAMI,EAAc,CAAC,OAAQ,WAAW,EAwB3BC,EAAN,cAAuBC,CAAW,C,OACvB,KAAA,OAAA,CAACN,CAAS,C,CAU1B,aAAc,CACZ,MAAM,EAPiB,KAAA,WAAA,OAIhB,KAAA,OAAA,IAAIO,EAAqB,KAAM,CAAE,MAAO,CAAC,GAAI,UAAW,MAAM,CAAE,CAAC,EAIxE,KAAK,WAAa,KAAK,gBAAgB,CACzC,CASA,mBAAoB,CAClB,MAAM,kBAAkB,EACxB,KAAK,WAAW,KAAO,KAAK,eAAe,YAAc,iBAAmB,WAAa,IAC3F,CAEA,WAAW,EAA+B,CACpCC,EAAQ,IAAI,YAAY,GAAK,CAACC,EAAQL,EAAa,KAAK,UAAU,IAAG,KAAK,WAAa,OAC7F,CAEA,QAAS,CACP,IAAMM,EAAO,GAAe,KAAK,OAAO,IAAIC,CAAI,EAChD,MAAO,EAAI;;;6CAG8B,CAACD,EAAI,EAAE,EAAE;8CACR,CAACA,EAAI,SAAS,GAAK,CAACA,EAAI,MAAM,EAAE;gDAC9B,CAACA,EAAI,SAAS,EAAE;gDAChB,CAACA,EAAI,MAAM,EAAE;;;KAI3D,CACF,EAzCGT,EAAA,CAAAW,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,QAAS,EAAK,CAAC,CAAA,EAAAP,EAAA,UAAA,aAAA,IAAA,EAAA,EALnE,EAAAJ,EAAA,CAAAY,EAAc,WAAW,CAAA,EAAAR,CAAA,E"}
1
+ {"version":3,"file":"review.js","names":["reviewCSS","_decorate","__decorate","review_css_default","BACKGROUNDS","BdReview","LitElement","SlotController","changed","isOneOf","has","part","hasMeta","property","defineElement"],"sources":["../../../../src/components/review/review.ts"],"sourcesContent":["import { LitElement, html, type PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport { isOneOf } from \"#shared/prop-vocabulary.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/quote.ts\";\n/* 3.x drew the quote and the source in bd-p, so its module registered it,\n and a page importing only this module still gets it. */\nimport \"#components/p/p.ts\";\nimport reviewCSS from \"./review.css.ts\";\n\n/* The ground the card is drawn on. A ground, not a look (N5): `tint` is the\n brand's lightest wash, --status-brand-surface, so it follows the business\n line's brand; `container` is --color-surface-container, the ground\n bd-card and bd-bento-item draw by default and call by the same word. It\n was `variant`, whose \"neutral\" would read as the meaning neutral, which\n the look and meaning vocabularies keep apart (N6). */\nconst BACKGROUNDS = [\"tint\", \"container\", \"none\"] as const;\ntype Background = typeof BACKGROUNDS[number];\n\ntype Part = \"\" | \"caption\" | \"date\";\n\n/**\n * A single testimonial: the quote, who said it, and when.\n *\n * <bd-review background=\"tint\">\n * If you're looking to buy a security suite, our experts and readers agree: Bitdefender should be your top choice.\n * <span slot=\"caption\">PCMag</span>\n * <span slot=\"date\">February 3, 2026</span>\n * </bd-review>\n *\n * The quote is the review's content, so it is the default slot (3.x's\n * `quote`), and the source is its `caption` (3.x's `source`). All three are\n * text: the review sets their type and ink -- the quote at body-regular, the\n * source at body-small bold, the date at body-small in muted ink -- so the\n * page writes words, not paragraphs. 3.x drew the quote and source in its own\n * bd-p; the slots sit in its own boxes now. Each part's box is hidden while\n * its slot is empty, and the quote takes the card's spare height, so the\n * sources of a row of reviews line up at the foot.\n */\n@defineElement(\"bd-review\")\nexport class BdReview extends LitElement {\n static styles = [reviewCSS];\n\n /** The card's ground: tint (default) | container | none. */\n @property({ type: String, attribute: \"background\", reflect: true })\n background: Background = \"tint\";\n\n _internals: ElementInternals;\n\n _slots = new SlotController<Part>(this, { slots: [\"\", \"caption\", \"date\"] });\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n /* In a bd-review-grid, a review is one item of the grid's list -- a list\n whose children are not list items is announced as an empty list, or not\n at all (axe: aria-required-children). The role is the element's own,\n through ElementInternals, as bd-breadcrumb-item's is: the grid used to\n write role=\"listitem\" onto the page's markup, where it stayed after the\n review left the list. A role the page writes on the element still wins,\n and outside a grid a review is no item of anything. */\n connectedCallback() {\n super.connectedCallback();\n this._internals.role = this.parentElement?.localName === \"bd-review-grid\" ? \"listitem\" : null;\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"background\") && !isOneOf(BACKGROUNDS, this.background)) this.background = \"tint\";\n }\n\n render() {\n const has = (part: Part) => this._slots.has(part);\n const hasMeta = has(\"caption\") || has(\"date\");\n return html`\n <div class=\"bd-review-card\">\n <bd-icon name=\"quote\" class=\"bd-review-mark\" size=\"xl\"></bd-icon>\n <p class=\"bd-review-quote\" ?hidden=${!has(\"\")}><slot></slot></p>\n <span class=\"bd-review-divider\" aria-hidden=\"true\" ?hidden=${!hasMeta}></span>\n <div class=\"bd-review-meta\" ?hidden=${!hasMeta}>\n <p class=\"bd-review-source\" ?hidden=${!has(\"caption\")}><slot name=\"caption\"></slot></p>\n <div class=\"bd-review-date\" ?hidden=${!has(\"date\")}><slot name=\"date\"></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-review\": BdReview;\n }\n}"],"mappings":"A,6bAmBA,IAAMI,EAAc,CAAC,OAAQ,YAAa,MAAM,EAwBnCC,EAAN,cAAuBC,CAAW,C,OACvB,KAAA,OAAA,CAACN,CAAS,C,CAU1B,aAAc,CACZ,MAAM,EAPiB,KAAA,WAAA,OAIhB,KAAA,OAAA,IAAIO,EAAqB,KAAM,CAAE,MAAO,CAAC,GAAI,UAAW,MAAM,CAAE,CAAC,EAIxE,KAAK,WAAa,KAAK,gBAAgB,CACzC,CASA,mBAAoB,CAClB,MAAM,kBAAkB,EACxB,KAAK,WAAW,KAAO,KAAK,eAAe,YAAc,iBAAmB,WAAa,IAC3F,CAEA,WAAW,EAA+B,CACpCC,EAAQ,IAAI,YAAY,GAAK,CAACC,EAAQL,EAAa,KAAK,UAAU,IAAG,KAAK,WAAa,OAC7F,CAEA,QAAS,CACP,IAAMM,EAAO,GAAe,KAAK,OAAO,IAAIC,CAAI,EAC1CC,EAAUF,EAAI,SAAS,GAAKA,EAAI,MAAM,EAC5C,MAAO,EAAI;;;6CAG8B,CAACA,EAAI,EAAE,EAAE;qEACe,CAACE,EAAQ;8CAChC,CAACA,EAAQ;gDACP,CAACF,EAAI,SAAS,EAAE;gDAChB,CAACA,EAAI,MAAM,EAAE;;;KAI3D,CACF,EA3CGT,EAAA,CAAAY,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,QAAS,EAAK,CAAC,CAAA,EAAAR,EAAA,UAAA,aAAA,IAAA,EAAA,EALnE,EAAAJ,EAAA,CAAAa,EAAc,WAAW,CAAA,EAAAT,CAAA,E"}
@@ -32,6 +32,11 @@ declare const BdSelect_base: (new (...args: any[]) => import("../shared/form-con
32
32
  * It is 3.x's bd-custom-dropdown, whose options were a JSON array attribute;
33
33
  * the label and hint are slots, as on bd-input. It sends the native `input`
34
34
  * and `change`, once each for a choice; a listener reads event.target.value.
35
+ *
36
+ * A select with no visible label is named by `aria-label` on the element,
37
+ * which is passed to the <select>, as on bd-input:
38
+ *
39
+ * <bd-select name="plan" aria-label="Plan">…</bd-select>
35
40
  */
36
41
  export declare class BdSelect extends BdSelect_base {
37
42
  static styles: import("lit").CSSResult[];
@@ -43,12 +48,14 @@ export declare class BdSelect extends BdSelect_base {
43
48
  value: string;
44
49
  name: string;
45
50
  placeholder: string;
51
+ fieldLabel: string;
46
52
  _open: boolean;
47
53
  _onWindowFocus: () => void;
48
54
  _onDocPointerDown: (e: PointerEvent) => void;
49
55
  protected _slots: SlotController<"label" | "hint">;
50
56
  protected _options: ObserverController<MutationObserver>;
51
57
  protected get _control(): HTMLSelectElement | null;
58
+ get _accessibleName(): string;
52
59
  /** The bd-select-option children, in order: the choices. */
53
60
  get options(): BdSelectOption[];
54
61
  get _choices(): Choice[];
@@ -1,15 +1,16 @@
1
- import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{SIZES as t,isOneOf as n}from"../shared/prop-vocabulary.js";import r from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ObserverController as i}from"../shared/controller.observer.js";import{flatText as a}from"../shared/flat-text.js";import{SlotController as o}from"../shared/controller.slot.js";import"../icons/arrow-down.js";import{CONTROL_ID as s,FIELD_SLOTS as c,ValueControl as l,describedBy as u,fieldHint as d,fieldLabel as f,omitEmpty as p}from"../shared/form-control.js";import m from"../shared/form-field.css.js";import"./select-option.js";import h from"./select.css.js";import{LitElement as g,html as _,nothing as v}from"lit";import{property as y,state as b}from"lit/decorators.js";import{keyed as x}from"lit/directives/keyed.js";var S={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`value`,`selected`,`disabled`]},C=class extends l(g){constructor(...e){super(...e),this.size=`md`,this.required=!1,this.invalid=!1,this.validated=!1,this.disabled=!1,this.value=``,this.name=``,this.placeholder=``,this._open=!1,this._slots=new o(this,{slots:c}),this._options=new i(this,()=>new MutationObserver(()=>this.requestUpdate()),e=>e.observe(this,S))}static{this.styles=[m,h]}get _control(){return this.renderRoot?.querySelector?.(`select`)}get options(){return[...this.children].filter(e=>e.localName===`bd-select-option`)}get _choices(){return this.options.map(e=>{let t=a(e);return{value:e.getAttribute(`value`)??t,text:t,disabled:e.hasAttribute(`disabled`)}})}get _values(){return[...this.placeholder?[``]:[],...this._choices.map(e=>e.value)]}_defaultValue(){let e=this._values,t=this.getAttribute(`value`);if(t!==null&&e.includes(t))return t;let n=this._choices,r=this.options.findIndex(e=>e.hasAttribute(`selected`));return r>=0?n[r].value:this.placeholder?``:(n.find(e=>!e.disabled)??n[0])?.value??``}connectedCallback(){super.connectedCallback(),this._onWindowFocus=()=>{this._open&&=!1},this._onDocPointerDown=e=>{this._open&&e.composedPath()[0]!==this.shadowRoot?.querySelector(`select`)&&(this._open=!1)},window.addEventListener(`focus`,this._onWindowFocus),document.addEventListener(`pointerdown`,this._onDocPointerDown,!0),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){window.removeEventListener(`focus`,this._onWindowFocus),document.removeEventListener(`pointerdown`,this._onDocPointerDown,!0),super.disconnectedCallback()}_onSelectMouseDown(){this._open=!this._open}_onSelectKeyDown(e){(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`))&&(this._open=!0)}_closePicker(){this._open=!1}willUpdate(e){e.has(`size`)&&!n(t,this.size)&&(this.size=`md`),!this.hasUpdated&&this.value===``&&!this.hasAttribute(`value`)&&(this.value=this._defaultValue()),this._values.includes(this.value)||(this.value=this._defaultValue())}updated(){let e=this.shadowRoot.querySelector(`select`);e&&e.value!==this.value&&(e.value=this.value),this._sync()}_onInput(e){this.value=e.target.value,this._sync()}_onChange(e){this._closePicker(),this.value=e.target.value,this._relayChange()}render(){let e=this.disabled||this._formDisabled,t=e?`form-input--disabled`:this.invalid?`form-input--error`:this.validated?`form-input--success`:``,n=this.invalid?`error`:this.validated?`success`:`default`;return _`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{SIZES as t,isOneOf as n}from"../shared/prop-vocabulary.js";import r from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ObserverController as i}from"../shared/controller.observer.js";import{flatText as a}from"../shared/flat-text.js";import{SlotController as o}from"../shared/controller.slot.js";import"../icons/arrow-down.js";import{CONTROL_ID as s,FIELD_SLOTS as c,ValueControl as l,describedBy as u,fieldHint as d,fieldLabel as f,fieldName as p,omitEmpty as m}from"../shared/form-control.js";import h from"../shared/form-field.css.js";import"./select-option.js";import g from"./select.css.js";import{LitElement as _,html as v,nothing as y}from"lit";import{property as b,state as x}from"lit/decorators.js";import{keyed as S}from"lit/directives/keyed.js";var C={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`value`,`selected`,`disabled`]},w=class extends l(_){constructor(...e){super(...e),this.size=`md`,this.required=!1,this.invalid=!1,this.validated=!1,this.disabled=!1,this.value=``,this.name=``,this.placeholder=``,this.fieldLabel=``,this._open=!1,this._slots=new o(this,{slots:c}),this._options=new i(this,()=>new MutationObserver(()=>this.requestUpdate()),e=>e.observe(this,C))}static{this.styles=[h,g]}get _control(){return this.renderRoot?.querySelector?.(`select`)}get _accessibleName(){return p(this._slots,this.fieldLabel,this._internals.labels)}get options(){return[...this.children].filter(e=>e.localName===`bd-select-option`)}get _choices(){return this.options.map(e=>{let t=a(e);return{value:e.getAttribute(`value`)??t,text:t,disabled:e.hasAttribute(`disabled`)}})}get _values(){return[...this.placeholder?[``]:[],...this._choices.map(e=>e.value)]}_defaultValue(){let e=this._values,t=this.getAttribute(`value`);if(t!==null&&e.includes(t))return t;let n=this._choices,r=this.options.findIndex(e=>e.hasAttribute(`selected`));return r>=0?n[r].value:this.placeholder?``:(n.find(e=>!e.disabled)??n[0])?.value??``}connectedCallback(){super.connectedCallback(),this._onWindowFocus=()=>{this._open&&=!1},this._onDocPointerDown=e=>{this._open&&e.composedPath()[0]!==this.shadowRoot?.querySelector(`select`)&&(this._open=!1)},window.addEventListener(`focus`,this._onWindowFocus),document.addEventListener(`pointerdown`,this._onDocPointerDown,!0),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){window.removeEventListener(`focus`,this._onWindowFocus),document.removeEventListener(`pointerdown`,this._onDocPointerDown,!0),super.disconnectedCallback()}_onSelectMouseDown(){this._open=!this._open}_onSelectKeyDown(e){(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`))&&(this._open=!0)}_closePicker(){this._open=!1}willUpdate(e){e.has(`size`)&&!n(t,this.size)&&(this.size=`md`),!this.hasUpdated&&this.value===``&&!this.hasAttribute(`value`)&&(this.value=this._defaultValue()),this._values.includes(this.value)||(this.value=this._defaultValue())}updated(){let e=this.shadowRoot.querySelector(`select`);e&&e.value!==this.value&&(e.value=this.value),this._sync()}_onInput(e){this.value=e.target.value,this._sync()}_onChange(e){this._closePicker(),this.value=e.target.value,this._relayChange()}render(){let e=this.disabled||this._formDisabled,t=e?`form-input--disabled`:this.invalid?`form-input--error`:this.validated?`form-input--success`:``,n=this.invalid?`error`:this.validated?`success`:`default`;return v`
2
2
  <div class="input-container">
3
- ${f(this._slots,{size:this.size,required:this.required},_`<slot name="label"></slot>`)}
3
+ ${f(this._slots,{size:this.size,required:this.required},v`<slot name="label"></slot>`)}
4
4
  <div class="select-wrap">
5
- ${x(this._resets,_`<select
5
+ ${S(this._resets,v`<select
6
6
  id=${s}
7
7
  part="select"
8
8
  class="form-input-bd input-${this.size} ${t} ${this._attempted?`form-input--attempted`:``} ${this.placeholder&&this.value===``?`form-input--placeholder`:``}"
9
- name=${this.name||v}
9
+ name=${this.name||y}
10
10
  ?required=${this.required}
11
11
  ?disabled=${e}
12
- aria-invalid=${this.invalid?`true`:v}
12
+ aria-label=${this._accessibleName||y}
13
+ aria-invalid=${this.invalid?`true`:y}
13
14
  aria-describedby=${u(this._slots)}
14
15
  @mousedown=${this._onSelectMouseDown}
15
16
  @keydown=${this._onSelectKeyDown}
@@ -17,8 +18,8 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
17
18
  @change=${this._onChange}
18
19
  @blur=${this._closePicker}
19
20
  >
20
- ${this.placeholder?_`<option value="" ?selected=${this.value===``}>${this.placeholder}</option>`:v}
21
- ${this._choices.map(e=>_`<option
21
+ ${this.placeholder?v`<option value="" ?selected=${this.value===``}>${this.placeholder}</option>`:y}
22
+ ${this._choices.map(e=>v`<option
22
23
  value=${e.value}
23
24
  ?selected=${e.value===this.value}
24
25
  ?disabled=${e.disabled}
@@ -29,7 +30,7 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
29
30
  class="select-caret ${this._open?`select-caret--open`:``}"
30
31
  ></bd-icon>
31
32
  </div>
32
- ${d(this._slots,n,_`<slot name="hint"></slot>`)}
33
+ ${d(this._slots,n,v`<slot name="hint"></slot>`)}
33
34
  </div>
34
- `}};r([y({type:String,reflect:!0})],C.prototype,`size`,void 0),r([y({type:Boolean})],C.prototype,`required`,void 0),r([y({type:Boolean})],C.prototype,`invalid`,void 0),r([y({type:Boolean})],C.prototype,`validated`,void 0),r([y({type:Boolean,reflect:!0})],C.prototype,`disabled`,void 0),r([y({type:String})],C.prototype,`value`,void 0),r([y({type:String,reflect:!0,converter:p})],C.prototype,`name`,void 0),r([y({type:String})],C.prototype,`placeholder`,void 0),r([b()],C.prototype,`_open`,void 0),C=r([e(`bd-select`)],C);export{C as BdSelect};
35
+ `}};r([b({type:String,reflect:!0})],w.prototype,`size`,void 0),r([b({type:Boolean})],w.prototype,`required`,void 0),r([b({type:Boolean})],w.prototype,`invalid`,void 0),r([b({type:Boolean})],w.prototype,`validated`,void 0),r([b({type:Boolean,reflect:!0})],w.prototype,`disabled`,void 0),r([b({type:String})],w.prototype,`value`,void 0),r([b({type:String,reflect:!0,converter:m})],w.prototype,`name`,void 0),r([b({type:String})],w.prototype,`placeholder`,void 0),r([b({type:String,attribute:`aria-label`})],w.prototype,`fieldLabel`,void 0),r([x()],w.prototype,`_open`,void 0),w=r([e(`bd-select`)],w);export{w as BdSelect};
35
36
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":["selectCSS","_decorate","__decorate","formFieldCSS","select_css_default","OPTIONS","BdSelect","ValueControl","LitElement","_args","SlotController","FIELD_SLOTS","ObserverController","observer","el","text","flatText","option","c","values","attribute","choices","selected","o","changed","isOneOf","SIZES","select","disabled","inputStateClass","tone","fieldLabel","keyed","CONTROL_ID","nothing","describedBy","choice","fieldHint","property","omitEmpty","state","defineElement"],"sources":["../../../../src/components/select/select.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { keyed } from \"lit/directives/keyed.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/arrow-down.ts\";\nimport { formFieldCSS } from \"#shared/form-field.css.ts\";\nimport selectCSS from \"./select.css.ts\";\nimport { SIZES, isOneOf, type Size } from \"#shared/prop-vocabulary.ts\";\nimport { CONTROL_ID, FIELD_SLOTS, ValueControl, describedBy, fieldHint, fieldLabel, omitEmpty } from \"#shared/form-control.ts\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\nimport { ObserverController } from \"#shared/controller.observer.ts\";\nimport { flatText } from \"#shared/flat-text.ts\";\n// registers bd-select-option too: the ./select export is the pair\nimport \"./select-option.ts\";\nimport type { BdSelectOption } from \"./select-option.ts\";\n\n/* An option as the native <select> is handed it. */\ninterface Choice {\n value : string;\n text : string;\n disabled: boolean;\n}\n\n/* What the options say changed: one added or removed, its words edited, its\n value, selected or disabled set. */\nconst OPTIONS: MutationObserverInit = {\n childList : true,\n subtree : true,\n characterData : true,\n attributes : true,\n attributeFilter: [\"value\", \"selected\", \"disabled\"]\n};\n\n/**\n * A select: a native <select>, drawn as a field, whose options are the\n * bd-select-option children the page writes.\n *\n * <bd-select name=\"country\" placeholder=\"Choose a country\" required>\n * <span slot=\"label\">Country</span>\n * <span slot=\"hint\">Where the licence is used.</span>\n * <bd-select-option value=\"ro\" selected>Romania</bd-select-option>\n * <bd-select-option value=\"de\">Germany</bd-select-option>\n * </bd-select>\n *\n * The options are data, not slotted content: a native <select> takes only\n * <option>s of its own tree, so each bd-select-option becomes one, with the\n * option's words copied in (contract rule 8, docs/adr/0003-copy-in-light-dom.md)\n * and followed when the page edits them. Keeping the native control keeps the\n * operating system's own picker, its keyboard, and the browser's validation.\n *\n * It is 3.x's bd-custom-dropdown, whose options were a JSON array attribute;\n * the label and hint are slots, as on bd-input. It sends the native `input`\n * and `change`, once each for a choice; a listener reads event.target.value.\n */\n@defineElement(\"bd-select\")\nexport class BdSelect extends ValueControl(LitElement) {\n static styles = [formFieldCSS, selectCSS];\n\n @property({ type: String, reflect: true })\n size: Size = \"md\";\n @property({ type: Boolean })\n required = false;\n @property({ type: Boolean })\n invalid = false;\n @property({ type: Boolean })\n validated = false;\n /* Reflected, as on the other fields: a form-associated element is left\n out of a submit by its disabled ATTRIBUTE, so a disabled set as a\n property has to reach it. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n /* The chosen option's value. It always names an option that can be chosen:\n unset, or set to one that is not there, it is the default -- see\n _defaultValue. The value attribute, when there is one, is that default. */\n @property({ type: String })\n value = \"\";\n /* The name it submits under in a form; reflected, because a form reads it\n off the element. */\n @property({ type: String, reflect: true, converter: omitEmpty })\n name = \"\";\n /* A first option with no value, standing for \"nothing chosen yet\". It is\n what makes `required` mean anything here: a select is missing a value\n only while that option is the chosen one. Without it the first real\n option is chosen from the start, and required can never fail. */\n @property({ type: String })\n placeholder = \"\";\n /* Whether the native picker is showing. A best effort, not a fact: a\n <select> renders its popup in the OS, so the page is never told when it\n opens or closes. See _onSelectMouseDown. */\n @state()\n _open = false;\n\n _onWindowFocus! : () => void;\n _onDocPointerDown!: (e: PointerEvent) => void;\n\n protected _slots = new SlotController(this, { slots: FIELD_SLOTS });\n /* The options are not slotted, so no slotchange reports them: a mutation\n observer on the host does, for as long as it is connected. */\n protected _options = new ObserverController(this,\n () => new MutationObserver(() => this.requestUpdate()),\n observer => observer.observe(this, OPTIONS));\n\n protected get _control(): HTMLSelectElement | null {\n return this.renderRoot?.querySelector?.(\"select\");\n }\n\n /** The bd-select-option children, in order: the choices. */\n get options(): BdSelectOption[] {\n return [...this.children].filter((el): el is BdSelectOption => el.localName === \"bd-select-option\");\n }\n\n /* Each option as the <select> gets it. An option with no value is chosen\n by its words, as a native <option> is. */\n get _choices(): Choice[] {\n return this.options.map(option => {\n const text = flatText(option);\n return { value: option.getAttribute(\"value\") ?? text, text, disabled: option.hasAttribute(\"disabled\") };\n });\n }\n\n /** The values the select can hold, in order: the placeholder's, then the options'. */\n get _values() {\n return [...(this.placeholder ? [\"\"] : []), ...this._choices.map(c => c.value)];\n }\n\n /* What a reset returns to, and what an unset or unknown value lands on: the\n value attribute, when it names an option; else the first option marked\n `selected`, as on a native select; else the placeholder's, when there is\n one; else the first option that can be chosen -- a native select skips a\n disabled one there, or a form would submit a value nobody could pick --\n and only when every option is disabled, the first. */\n protected _defaultValue() {\n const values = this._values;\n const attribute = this.getAttribute(\"value\");\n if (attribute !== null && values.includes(attribute)) return attribute;\n const choices = this._choices;\n const selected = this.options.findIndex(o => o.hasAttribute(\"selected\"));\n if (selected >= 0) return choices[selected].value;\n if (this.placeholder) return \"\";\n return (choices.find(c => !c.disabled) ?? choices[0])?.value ?? \"\";\n }\n\n /* WHY THIS IS APPROXIMATED RATHER THAN OBSERVED.\n A native select's picker is drawn by the operating system, so there is no\n event for \"opened\" and no state to read. Chrome 152 does support\n `select:open` and a `toggle` event, but only for a CUSTOMIZABLE select\n (appearance: base-select) -- this field is appearance: none, and Safari and\n Firefox have neither, so a CSS-only answer does not ship.\n\n What is left is inference from the interactions that open a picker, plus\n every signal that proves one has CLOSED. Opening is easy; closing is where\n this gets hard, because dismissing a picker without choosing consumes the\n click inside the popup. The page never sees it and the select keeps focus,\n so `blur` does not arrive until the NEXT click somewhere -- which showed up\n as a chevron stuck pointing up. Hence three closing signals, not one:\n\n change a value was chosen\n blur focus left the field\n window focus the picker is a separate native window, so the browser\n window becomes key again when it closes. This is the\n one that catches dismiss-without-choosing.\n pointerdown anywhere outside this element, capture phase\n\n The last two can only ever fire when the picker is already shut, so they\n add no false closes. Escape remains unobservable on macOS, which does not\n deliver that keystroke to the page while the popup holds the keyboard; the\n window-focus signal covers it only if focus actually moved. */\n connectedCallback() {\n super.connectedCallback();\n this._onWindowFocus = () => { if (this._open) this._open = false; };\n this._onDocPointerDown = e => {\n if (this._open && e.composedPath()[0] !== this.shadowRoot?.querySelector(\"select\")) this._open = false;\n };\n window.addEventListener(\"focus\", this._onWindowFocus);\n document.addEventListener(\"pointerdown\", this._onDocPointerDown, true);\n // the options may have changed while it was out of the page, unobserved\n if (this.hasUpdated) this.requestUpdate();\n }\n\n disconnectedCallback() {\n window.removeEventListener(\"focus\", this._onWindowFocus);\n document.removeEventListener(\"pointerdown\", this._onDocPointerDown, true);\n super.disconnectedCallback();\n }\n\n _onSelectMouseDown() {\n /* clicking an open picker closes it, so this toggles rather than sets */\n this._open = !this._open;\n }\n\n _onSelectKeyDown(e: KeyboardEvent) {\n if (e.key === \"Enter\" || e.key === \" \" || (e.altKey && (e.key === \"ArrowDown\" || e.key === \"ArrowUp\"))) {\n this._open = true;\n }\n }\n\n _closePicker() {\n this._open = false;\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"size\") && !isOneOf(SIZES, this.size)) this.size = \"md\";\n /* It starts on its default unless the page chose: a value attribute, or\n a value set from script before the first render. The placeholder's \"\"\n is also the property's own default, so it cannot say which. */\n if (!this.hasUpdated && this.value === \"\" && !this.hasAttribute(\"value\")) this.value = this._defaultValue();\n if (!this._values.includes(this.value)) this.value = this._defaultValue();\n }\n\n /* The select is told its value after its options exist. A binding on the\n <select> would be committed before the options inside it rendered, and\n an option's selected attribute stops counting once a visitor has chosen,\n so neither could move the selection when value is set from outside. */\n updated() {\n const select = this.shadowRoot!.querySelector(\"select\");\n if (select && select.value !== this.value) select.value = this.value;\n this._sync();\n }\n\n /* ONE CHOICE, ONE input AND ONE change.\n A select commits the moment an option is chosen, and the native control\n fires both. input is composed and reaches the page by itself, retargeted\n to this element; the value follows the <select> here first, on the\n <select> itself, so a listener on the page reads the new\n event.target.value. change is not composed, so it is sent again from the\n host (shared/form-control.ts). 3.x sent bd-input and bd-change instead,\n each with a { value, name } detail. */\n _onInput(e: Event & { target: HTMLSelectElement }) {\n this.value = e.target.value;\n this._sync();\n }\n\n _onChange(e: Event & { target: HTMLSelectElement }) {\n this._closePicker();\n this.value = e.target.value;\n this._relayChange();\n }\n\n render() {\n const disabled = this.disabled || this._formDisabled;\n const inputStateClass = disabled\n ? \"form-input--disabled\"\n : this.invalid\n ? \"form-input--error\"\n : this.validated\n ? \"form-input--success\"\n : \"\";\n const tone = this.invalid ? \"error\" : this.validated ? \"success\" : \"default\";\n\n // The hint is the select's description, and the state is announced, not\n // only drawn, as on bd-input.\n return html`\n <div class=\"input-container\">\n ${fieldLabel(this._slots, { size: this.size, required: this.required }, html`<slot name=\"label\"></slot>`)}\n <div class=\"select-wrap\">\n ${keyed(this._resets, html`<select\n id=${CONTROL_ID}\n part=\"select\"\n class=\"form-input-bd input-${this.size} ${inputStateClass} ${this._attempted ? \"form-input--attempted\" : \"\"} ${this.placeholder && this.value === \"\" ? \"form-input--placeholder\" : \"\"}\"\n name=${this.name || nothing}\n ?required=${this.required}\n ?disabled=${disabled}\n aria-invalid=${this.invalid ? \"true\" : nothing}\n aria-describedby=${describedBy(this._slots)}\n @mousedown=${this._onSelectMouseDown}\n @keydown=${this._onSelectKeyDown}\n @input=${this._onInput}\n @change=${this._onChange}\n @blur=${this._closePicker}\n >\n ${this.placeholder\n ? html`<option value=\"\" ?selected=${this.value === \"\"}>${this.placeholder}</option>`\n : nothing}\n ${this._choices.map(choice => html`<option\n value=${choice.value}\n ?selected=${choice.value === this.value}\n ?disabled=${choice.disabled}\n >${choice.text}</option>`)}\n </select>`)}\n <bd-icon name=\"arrow-down\"\n size=\"sm\"\n class=\"select-caret ${this._open ? \"select-caret--open\" : \"\"}\"\n ></bd-icon>\n </div>\n ${fieldHint(this._slots, tone, html`<slot name=\"hint\"></slot>`)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-select\": BdSelect;\n }\n}\n"],"mappings":"A,01BA2BA,IAAMK,EAAgC,CACpC,UAAiB,GACjB,QAAiB,GACjB,cAAi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CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAAAhC,EAAA,UAAA,OAAA,IAAA,EAAA,EAExCL,EAAA,CAAAqC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAAAhC,EAAA,UAAA,WAAA,IAAA,EAAA,EAE1BL,EAAA,CAAAqC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAAAhC,EAAA,UAAA,UAAA,IAAA,EAAA,EAE1BL,EAAA,CAAAqC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAAAhC,EAAA,UAAA,YAAA,IAAA,EAAA,EAK1BL,EAAA,CAAAqC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAhC,EAAA,UAAA,WAAA,IAAA,EAAA,EAKzCL,EAAA,CAAAqC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAhC,EAAA,UAAA,QAAA,IAAA,EAAA,EAIzBL,EAAA,CAAAqC,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,UAAWC,CAAU,CAAC,CAAA,EAAAjC,EAAA,UAAA,OAAA,IAAA,EAAA,EAM9DL,EAAA,CAAAqC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAhC,EAAA,UAAA,cAAA,IAAA,EAAA,EAKzBL,EAAA,CAAAuC,EAAM,CAAA,EAAAlC,EAAA,UAAA,QAAA,IAAA,EAAA,EAnCR,EAAAL,EAAA,CAAAwC,EAAc,WAAW,CAAA,EAAAnC,CAAA,E"}
1
+ {"version":3,"file":"select.js","names":["selectCSS","_decorate","__decorate","formFieldCSS","select_css_default","OPTIONS","BdSelect","ValueControl","LitElement","_args","SlotController","FIELD_SLOTS","ObserverController","observer","fieldName","el","text","flatText","option","c","values","attribute","choices","selected","o","changed","isOneOf","SIZES","select","disabled","inputStateClass","tone","fieldLabel","keyed","CONTROL_ID","nothing","describedBy","choice","fieldHint","property","omitEmpty","state","defineElement"],"sources":["../../../../src/components/select/select.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { keyed } from \"lit/directives/keyed.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/arrow-down.ts\";\nimport { formFieldCSS } from \"#shared/form-field.css.ts\";\nimport selectCSS from \"./select.css.ts\";\nimport { SIZES, isOneOf, type Size } from \"#shared/prop-vocabulary.ts\";\nimport { CONTROL_ID, FIELD_SLOTS, ValueControl, describedBy, fieldHint, fieldLabel, fieldName, omitEmpty } from \"#shared/form-control.ts\";\nimport { SlotController } from \"#shared/controller.slot.ts\";\nimport { ObserverController } from \"#shared/controller.observer.ts\";\nimport { flatText } from \"#shared/flat-text.ts\";\n// registers bd-select-option too: the ./select export is the pair\nimport \"./select-option.ts\";\nimport type { BdSelectOption } from \"./select-option.ts\";\n\n/* An option as the native <select> is handed it. */\ninterface Choice {\n value : string;\n text : string;\n disabled: boolean;\n}\n\n/* What the options say changed: one added or removed, its words edited, its\n value, selected or disabled set. */\nconst OPTIONS: MutationObserverInit = {\n childList : true,\n subtree : true,\n characterData : true,\n attributes : true,\n attributeFilter: [\"value\", \"selected\", \"disabled\"]\n};\n\n/**\n * A select: a native <select>, drawn as a field, whose options are the\n * bd-select-option children the page writes.\n *\n * <bd-select name=\"country\" placeholder=\"Choose a country\" required>\n * <span slot=\"label\">Country</span>\n * <span slot=\"hint\">Where the licence is used.</span>\n * <bd-select-option value=\"ro\" selected>Romania</bd-select-option>\n * <bd-select-option value=\"de\">Germany</bd-select-option>\n * </bd-select>\n *\n * The options are data, not slotted content: a native <select> takes only\n * <option>s of its own tree, so each bd-select-option becomes one, with the\n * option's words copied in (contract rule 8, docs/adr/0003-copy-in-light-dom.md)\n * and followed when the page edits them. Keeping the native control keeps the\n * operating system's own picker, its keyboard, and the browser's validation.\n *\n * It is 3.x's bd-custom-dropdown, whose options were a JSON array attribute;\n * the label and hint are slots, as on bd-input. It sends the native `input`\n * and `change`, once each for a choice; a listener reads event.target.value.\n *\n * A select with no visible label is named by `aria-label` on the element,\n * which is passed to the <select>, as on bd-input:\n *\n * <bd-select name=\"plan\" aria-label=\"Plan\">…</bd-select>\n */\n@defineElement(\"bd-select\")\nexport class BdSelect extends ValueControl(LitElement) {\n static styles = [formFieldCSS, selectCSS];\n\n @property({ type: String, reflect: true })\n size: Size = \"md\";\n @property({ type: Boolean })\n required = false;\n @property({ type: Boolean })\n invalid = false;\n @property({ type: Boolean })\n validated = false;\n /* Reflected, as on the other fields: a form-associated element is left\n out of a submit by its disabled ATTRIBUTE, so a disabled set as a\n property has to reach it. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n /* The chosen option's value. It always names an option that can be chosen:\n unset, or set to one that is not there, it is the default -- see\n _defaultValue. The value attribute, when there is one, is that default. */\n @property({ type: String })\n value = \"\";\n /* The name it submits under in a form; reflected, because a form reads it\n off the element. */\n @property({ type: String, reflect: true, converter: omitEmpty })\n name = \"\";\n /* A first option with no value, standing for \"nothing chosen yet\". It is\n what makes `required` mean anything here: a select is missing a value\n only while that option is the chosen one. Without it the first real\n option is chosen from the start, and required can never fail. */\n @property({ type: String })\n placeholder = \"\";\n /* The select's name when there is no visible label: aria-label on the\n element is passed to the <select>, which is what a screen reader\n focuses -- on the element itself it named nothing. A name that never\n renders, so an attribute (contract rule 6, docs/adr/0003-copy-in-light-dom.md),\n and the same one bd-input takes. */\n @property({ type: String, attribute: \"aria-label\" })\n fieldLabel = \"\";\n /* Whether the native picker is showing. A best effort, not a fact: a\n <select> renders its popup in the OS, so the page is never told when it\n opens or closes. See _onSelectMouseDown. */\n @state()\n _open = false;\n\n _onWindowFocus! : () => void;\n _onDocPointerDown!: (e: PointerEvent) => void;\n\n protected _slots = new SlotController(this, { slots: FIELD_SLOTS });\n /* The options are not slotted, so no slotchange reports them: a mutation\n observer on the host does, for as long as it is connected. */\n protected _options = new ObserverController(this,\n () => new MutationObserver(() => this.requestUpdate()),\n observer => observer.observe(this, OPTIONS));\n\n protected get _control(): HTMLSelectElement | null {\n return this.renderRoot?.querySelector?.(\"select\");\n }\n\n /* With no label in the label slot, the <select> is named by aria-label on\n the element, or else by the text of a <label for> pointing at the element\n (fieldName, shared/form-control.ts). Past both it has no name. */\n get _accessibleName() {\n return fieldName(this._slots, this.fieldLabel, this._internals.labels);\n }\n\n /** The bd-select-option children, in order: the choices. */\n get options(): BdSelectOption[] {\n return [...this.children].filter((el): el is BdSelectOption => el.localName === \"bd-select-option\");\n }\n\n /* Each option as the <select> gets it. An option with no value is chosen\n by its words, as a native <option> is. */\n get _choices(): Choice[] {\n return this.options.map(option => {\n const text = flatText(option);\n return { value: option.getAttribute(\"value\") ?? text, text, disabled: option.hasAttribute(\"disabled\") };\n });\n }\n\n /** The values the select can hold, in order: the placeholder's, then the options'. */\n get _values() {\n return [...(this.placeholder ? [\"\"] : []), ...this._choices.map(c => c.value)];\n }\n\n /* What a reset returns to, and what an unset or unknown value lands on: the\n value attribute, when it names an option; else the first option marked\n `selected`, as on a native select; else the placeholder's, when there is\n one; else the first option that can be chosen -- a native select skips a\n disabled one there, or a form would submit a value nobody could pick --\n and only when every option is disabled, the first. */\n protected _defaultValue() {\n const values = this._values;\n const attribute = this.getAttribute(\"value\");\n if (attribute !== null && values.includes(attribute)) return attribute;\n const choices = this._choices;\n const selected = this.options.findIndex(o => o.hasAttribute(\"selected\"));\n if (selected >= 0) return choices[selected].value;\n if (this.placeholder) return \"\";\n return (choices.find(c => !c.disabled) ?? choices[0])?.value ?? \"\";\n }\n\n /* WHY THIS IS APPROXIMATED RATHER THAN OBSERVED.\n A native select's picker is drawn by the operating system, so there is no\n event for \"opened\" and no state to read. Chrome 152 does support\n `select:open` and a `toggle` event, but only for a CUSTOMIZABLE select\n (appearance: base-select) -- this field is appearance: none, and Safari and\n Firefox have neither, so a CSS-only answer does not ship.\n\n What is left is inference from the interactions that open a picker, plus\n every signal that proves one has CLOSED. Opening is easy; closing is where\n this gets hard, because dismissing a picker without choosing consumes the\n click inside the popup. The page never sees it and the select keeps focus,\n so `blur` does not arrive until the NEXT click somewhere -- which showed up\n as a chevron stuck pointing up. Hence three closing signals, not one:\n\n change a value was chosen\n blur focus left the field\n window focus the picker is a separate native window, so the browser\n window becomes key again when it closes. This is the\n one that catches dismiss-without-choosing.\n pointerdown anywhere outside this element, capture phase\n\n The last two can only ever fire when the picker is already shut, so they\n add no false closes. Escape remains unobservable on macOS, which does not\n deliver that keystroke to the page while the popup holds the keyboard; the\n window-focus signal covers it only if focus actually moved. */\n connectedCallback() {\n super.connectedCallback();\n this._onWindowFocus = () => { if (this._open) this._open = false; };\n this._onDocPointerDown = e => {\n if (this._open && e.composedPath()[0] !== this.shadowRoot?.querySelector(\"select\")) this._open = false;\n };\n window.addEventListener(\"focus\", this._onWindowFocus);\n document.addEventListener(\"pointerdown\", this._onDocPointerDown, true);\n // the options may have changed while it was out of the page, unobserved\n if (this.hasUpdated) this.requestUpdate();\n }\n\n disconnectedCallback() {\n window.removeEventListener(\"focus\", this._onWindowFocus);\n document.removeEventListener(\"pointerdown\", this._onDocPointerDown, true);\n super.disconnectedCallback();\n }\n\n _onSelectMouseDown() {\n /* clicking an open picker closes it, so this toggles rather than sets */\n this._open = !this._open;\n }\n\n _onSelectKeyDown(e: KeyboardEvent) {\n if (e.key === \"Enter\" || e.key === \" \" || (e.altKey && (e.key === \"ArrowDown\" || e.key === \"ArrowUp\"))) {\n this._open = true;\n }\n }\n\n _closePicker() {\n this._open = false;\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has(\"size\") && !isOneOf(SIZES, this.size)) this.size = \"md\";\n /* It starts on its default unless the page chose: a value attribute, or\n a value set from script before the first render. The placeholder's \"\"\n is also the property's own default, so it cannot say which. */\n if (!this.hasUpdated && this.value === \"\" && !this.hasAttribute(\"value\")) this.value = this._defaultValue();\n if (!this._values.includes(this.value)) this.value = this._defaultValue();\n }\n\n /* The select is told its value after its options exist. A binding on the\n <select> would be committed before the options inside it rendered, and\n an option's selected attribute stops counting once a visitor has chosen,\n so neither could move the selection when value is set from outside. */\n updated() {\n const select = this.shadowRoot!.querySelector(\"select\");\n if (select && select.value !== this.value) select.value = this.value;\n this._sync();\n }\n\n /* ONE CHOICE, ONE input AND ONE change.\n A select commits the moment an option is chosen, and the native control\n fires both. input is composed and reaches the page by itself, retargeted\n to this element; the value follows the <select> here first, on the\n <select> itself, so a listener on the page reads the new\n event.target.value. change is not composed, so it is sent again from the\n host (shared/form-control.ts). 3.x sent bd-input and bd-change instead,\n each with a { value, name } detail. */\n _onInput(e: Event & { target: HTMLSelectElement }) {\n this.value = e.target.value;\n this._sync();\n }\n\n _onChange(e: Event & { target: HTMLSelectElement }) {\n this._closePicker();\n this.value = e.target.value;\n this._relayChange();\n }\n\n render() {\n const disabled = this.disabled || this._formDisabled;\n const inputStateClass = disabled\n ? \"form-input--disabled\"\n : this.invalid\n ? \"form-input--error\"\n : this.validated\n ? \"form-input--success\"\n : \"\";\n const tone = this.invalid ? \"error\" : this.validated ? \"success\" : \"default\";\n\n // The hint is the select's description, and the state is announced, not\n // only drawn, as on bd-input.\n return html`\n <div class=\"input-container\">\n ${fieldLabel(this._slots, { size: this.size, required: this.required }, html`<slot name=\"label\"></slot>`)}\n <div class=\"select-wrap\">\n ${keyed(this._resets, html`<select\n id=${CONTROL_ID}\n part=\"select\"\n class=\"form-input-bd input-${this.size} ${inputStateClass} ${this._attempted ? \"form-input--attempted\" : \"\"} ${this.placeholder && this.value === \"\" ? \"form-input--placeholder\" : \"\"}\"\n name=${this.name || nothing}\n ?required=${this.required}\n ?disabled=${disabled}\n aria-label=${this._accessibleName || nothing}\n aria-invalid=${this.invalid ? \"true\" : nothing}\n aria-describedby=${describedBy(this._slots)}\n @mousedown=${this._onSelectMouseDown}\n @keydown=${this._onSelectKeyDown}\n @input=${this._onInput}\n @change=${this._onChange}\n @blur=${this._closePicker}\n >\n ${this.placeholder\n ? html`<option value=\"\" ?selected=${this.value === \"\"}>${this.placeholder}</option>`\n : nothing}\n ${this._choices.map(choice => html`<option\n value=${choice.value}\n ?selected=${choice.value === this.value}\n ?disabled=${choice.disabled}\n >${choice.text}</option>`)}\n </select>`)}\n <bd-icon name=\"arrow-down\"\n size=\"sm\"\n class=\"select-caret ${this._open ? \"select-caret--open\" : \"\"}\"\n ></bd-icon>\n </div>\n ${fieldHint(this._slots, tone, html`<slot name=\"hint\"></slot>`)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-select\": BdSelect;\n }\n}\n"],"mappings":"A,y2BA2BA,IAAMK,EAAgC,CACpC,UAAiB,GACjB,QAAiB,GACjB,cAAiB,GACjB,WAAiB,GACjB,gBAAiB,CAAC,QAAS,WAAY,UAAU,CACnD,EA6BaC,EAAN,cAAuBC,EAAaC,CAAU,CAAC,AAAC,C,8BAIxC,KAAA,KAAA,KAEF,KAAA,SAAA,GAED,KAAA,QAAA,GAEE,KAAA,UAAA,GAKD,KAAA,SAAA,GAKH,KAAA,MAAA,GAID,KAAA,KAAA,GAMO,KAAA,YAAA,GAOD,KAAA,WAAA,GAKL,KAAA,MAAA,GAKW,KAAA,OAAA,IAAIE,EAAe,KAAM,CAAE,MAAOC,CAAY,CAAC,EAG7C,KAAA,SAAA,IAAIC,EAAmB,SACpC,IAAI,qBAAuB,KAAK,cAAc,CAAC,EACrD,GAAYC,EAAS,QAAQ,KAAMR,CAAO,CAAC,C,QAnD7B,KAAA,OAAA,CAACF,EAAcH,CAAS,C,CAqDxC,IAAc,UAAqC,CACjD,OAAO,KAAK,YAAY,gBAAgB,QAAQ,CAClD,CAKA,IAAI,iBAAkB,CACpB,OAAOc,EAAU,KAAK,OAAQ,KAAK,WAAY,KAAK,WAAW,MAAM,CACvE,CAGA,IAAI,SAA4B,CAC9B,MAAO,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,OAAQ,GAA6BC,EAAG,YAAc,kBAAkB,CACpG,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C,CAAU,CAAC,CAAA,EAAAlC,EAAA,UAAA,OAAA,IAAA,EAAA,EAM9DL,EAAA,CAAAsC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAjC,EAAA,UAAA,cAAA,IAAA,EAAA,EAOzBL,EAAA,CAAAsC,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAjC,EAAA,UAAA,aAAA,IAAA,EAAA,EAKlDL,EAAA,CAAAwC,EAAM,CAAA,EAAAnC,EAAA,UAAA,QAAA,IAAA,EAAA,EA1CR,EAAAL,EAAA,CAAAyC,EAAc,WAAW,CAAA,EAAApC,CAAA,E"}
@@ -87,4 +87,12 @@ export declare function fieldLabel(slots: Slots, { size, required }: {
87
87
  export declare function fieldHint(slots: Slots, tone: 'default' | 'error' | 'success', slot: TemplateResult): TemplateResult<1>;
88
88
  /** The control's aria-describedby: the hint, while there is one. */
89
89
  export declare const describedBy: (slots: Slots) => "hint" | typeof nothing;
90
+ /**
91
+ * The aria-label a field gives its native control: '' while the label slot
92
+ * holds something, else `label` (the field's `aria-label` attribute), else
93
+ * the words of the `<label for>`s pointing at the field.
94
+ *
95
+ * aria-label=${fieldName(this._slots, this.fieldLabel, this._internals.labels) || nothing}
96
+ */
97
+ export declare function fieldName(slots: Slots, label: string, labels: NodeList | null | undefined): string;
90
98
  export {};
@@ -8,5 +8,5 @@ import e from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import
8
8
  part="hint"
9
9
  class="form-help-text form-help-text--${n}"
10
10
  ?hidden=${!e.has(`hint`)}
11
- >${r}</div>`}var p=e=>e.has(`hint`)?l:n;export{c as CONTROL_ID,u as FIELD_SLOTS,o as FormControl,l as HINT_ID,s as ValueControl,p as describedBy,f as fieldHint,d as fieldLabel,i as omitEmpty};
11
+ >${r}</div>`}var p=e=>e.has(`hint`)?l:n;function m(e,t,n){return e.has(`label`)?``:t||[...n??[]].map(e=>e.textContent.trim()).filter(Boolean).join(` `)}export{c as CONTROL_ID,u as FIELD_SLOTS,o as FormControl,l as HINT_ID,s as ValueControl,p as describedBy,f as fieldHint,d as fieldLabel,m as fieldName,i as omitEmpty};
12
12
  //# sourceMappingURL=form-control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-control.js","names":["__decorate","omitEmpty","value","BLOCKS_IMPLICIT_SUBMISSION","FormControl","FormControlElement","Base","args","r","form","elements","button","el","disabled","control","state","ValueControl","ValueControlElement","_args","CONTROL_ID","HINT_ID","FIELD_SLOTS","fieldLabel","size","slots","slot","required","nothing","fieldHint","tone","describedBy"],"sources":["../../../../src/components/shared/form-control.ts"],"sourcesContent":["import { html, nothing, type ComplexAttributeConverter, type LitElement, type TemplateResult } from 'lit';\nimport { state } from 'lit/decorators.js';\n\n/**\n * What makes a bd-* control take part in a <form>.\n *\n * Every control in this package renders its native element inside a shadow\n * root, and a native control there has no form owner: the <form> around the\n * element could not see it. A form submitted none of them, reset none of them\n * and let a required one through empty. Form-associated custom elements are\n * the platform's answer -- Baseline Widely available since 2023 -- so the\n * host joins the form itself through ElementInternals, the way the guide in\n * .claude/skills/modern-web-guidance/guides/html/form-associated-custom-elements.md\n * lays out, with no hidden input.\n *\n * This is the part every control shares: the opt-in, the internals, the\n * read-only surface a native control has (form, validity, checkValidity...),\n * and the two states a control cannot see from inside its shadow root -- a\n * <fieldset disabled> around it, and a submit that failed. What a control\n * submits, when it is valid and what reset puts back are its own.\n *\n * class BdThing extends FormControl(LitElement) { ... }\n */\n\n/* For `name`, which reflects: FACE submits under the host's name ATTRIBUTE, so\n a name set as a property -- what every framework binding does -- has to\n reach it. An empty name submits nothing either way, so it is left off the\n element rather than written as name=\"\" on every control on the page. */\nexport const omitEmpty: ComplexAttributeConverter<string> = { toAttribute: value => value || null };\n\n/* The input types that block implicit submission (HTML, \"implicit\n submission\"): a form with no submit button submits on Enter only while it\n has at most one field of these. A text field here says which type it is\n through its own `type`, so it is counted the same way. */\nconst BLOCKS_IMPLICIT_SUBMISSION = new Set<string | undefined>([\n 'text', 'search', 'url', 'tel', 'email', 'password', 'date', 'month', 'week', 'time',\n 'datetime-local', 'number'\n]);\n\n// Lit's mixin pattern: the class a mixin returns is typed by the declared\n// interfaces below, so its members reach the elements built on it without the\n// anonymous class itself leaking into the published declarations.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor<T = object> = new (...args: any[]) => T;\n\n/** The native element a control renders and stands in for. */\ntype NativeControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement;\n\n/* The members a control's own code reaches are protected: they are how the\n elements built on the mixin talk to it, not part of what a page may call. */\nexport declare class FormControlInterface {\n protected _internals : ElementInternals;\n protected _formDisabled: boolean;\n protected _attempted : boolean;\n protected _fromOutside(e: MouseEvent): boolean;\n protected get _control(): NativeControl | null;\n protected _activate(): void;\n get form(): HTMLFormElement | null;\n get labels(): NodeList;\n get validity(): ValidityState;\n get validationMessage(): string;\n get willValidate(): boolean;\n checkValidity(): boolean;\n reportValidity(): boolean;\n protected _submitImplicitly(): void;\n protected _relayChange(): void;\n formDisabledCallback(disabled: boolean): void;\n formResetCallback(): void;\n protected _mirrorValidity(control: NativeControl | null | undefined): void;\n}\n\nexport declare class ValueControlInterface {\n protected _resets: number;\n value : string;\n protected _sync(): void;\n protected _defaultValue(): string;\n formStateRestoreCallback(state: string | File | FormData | null): void;\n protected _onFieldKeydown(e: KeyboardEvent): void;\n}\n\nexport const FormControl = <T extends Constructor<LitElement>>(Base: T) => {\n class FormControlElement extends Base {\n static formAssociated = true;\n\n /* Disabled as the form sees it: the control's own `disabled`, or a\n <fieldset disabled> it sits in. The platform reports both through\n formDisabledCallback. It is kept here and never written to the host's\n attribute, or a fieldset re-enabled later could not re-enable it. */\n @state() protected _formDisabled = false;\n /* A submit has been tried and found this control invalid. A native\n control turns :user-invalid then, but the native element in here has\n no form owner, so it never learns of the attempt; the `invalid` event\n the form fires at the host is how it hears. checkValidity() fires the\n same event, so a silent check counts too. Reset clears it. */\n @state() protected _attempted = false;\n protected _internals: ElementInternals;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- a mixin constructor must take any[]\n constructor(...args: any[]) {\n super(...args);\n this._internals = this.attachInternals();\n this.addEventListener('invalid', () => { this._attempted = true; });\n /* An outside activation is passed on to the native control, whose own\n click then reaches this element like any other. This one stops here, so\n a click listener on the element hears one click, not two -- one\n el.click() is one click on a native control. Registered in the\n constructor, it runs before any listener the page adds. */\n this.addEventListener('click', e => {\n if (e.composedPath()[0] !== this || !this._fromOutside(e)) return;\n e.stopImmediatePropagation();\n this._activate();\n });\n }\n\n /* A click on the host itself, not on anything inside it, is one of three\n things. A <label for> pointing at this element sends one carrying the\n label's position, and el.click() an untrusted one: the two ways a native\n control is activated from outside, and both activate this one. The third\n is a real click inside the host's own box but on nothing in it -- the\n slack beside a short label when a column stretches the host -- and that\n did nothing before and still does not, or a wide row would toggle from\n across the page. */\n protected _fromOutside(e: MouseEvent) {\n if (!e.isTrusted) return true;\n const r = this.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n }\n\n /** The native element inside; each control says which. */\n protected get _control(): NativeControl | null {\n return null;\n }\n\n /** What an outside activation does: a field takes focus, a checkable control overrides this to toggle. */\n protected _activate() {\n this._control?.focus();\n }\n\n get form() { return this._internals.form; }\n get labels() { return this._internals.labels; }\n get validity() { return this._internals.validity; }\n get validationMessage() { return this._internals.validationMessage; }\n get willValidate() { return this._internals.willValidate; }\n checkValidity() { return this._internals.checkValidity(); }\n reportValidity() { return this._internals.reportValidity(); }\n\n /* Enter in a native text field, checkbox, radio or switch submits its\n form -- implicit submission: the form's default button is clicked, or,\n with none, the form is submitted, unless more than one of its fields\n blocks that (BLOCKS_IMPLICIT_SUBMISSION above). Enter never toggles;\n Space does. The native control in here has no form, so the host does it.\n The default button is the form's first submit button, and a bd-button\n with type=\"submit\" is one: it is in form.elements and its type says so.\n A disabled default button means no submission, as natively. */\n protected _submitImplicitly() {\n const form = this.form;\n if (!form) return;\n const elements = [...form.elements] as Array<HTMLElement & { type?: string }>;\n const button = elements.find(el => el.type === 'submit' || el.type === 'image');\n if (button) {\n if (!button.matches(':disabled')) button.click();\n return;\n }\n const blocking = elements.filter(el => BLOCKS_IMPLICIT_SUBMISSION.has(el.type)).length;\n if (blocking <= 1) form.requestSubmit();\n }\n\n /* THE NATIVE EVENTS, AND WHICH ONE HAS TO BE SENT AGAIN.\n A control sends what its native control sends -- `input` as the value\n moves, `change` when it is committed -- with no detail: a listener reads\n event.target.value, or .checked, off the element, as it would off an\n <input>. (3.x sent bd-input and bd-change with a detail; v4 drops both,\n N8 in docs/adr/0004-web-awesome-naming.md.)\n\n The two do not leave the shadow root alike. `input` is composed, so the\n native one already reaches the page, retargeted to this element, and is\n not sent again: a second would make one keystroke two events. `change`\n is not composed and stops at the shadow root, so the element sends its\n own, once, after its state has followed the native control's. Composed,\n as `input` is, so a form handler above an enclosing component's shadow\n root hears both. */\n protected _relayChange() {\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n }\n\n formResetCallback() {\n this._attempted = false;\n }\n\n /* The native control already knows whether it is valid, and says so in the\n browser's own words and language, so the host repeats it rather than\n re-deriving it. The control is the anchor: reportValidity() and a failed\n submit focus it and point the message at it. A disabled control is out\n of validation altogether, and says so with an empty message that\n setValidity() would refuse; the host is disabled with it. */\n protected _mirrorValidity(control: NativeControl | null | undefined) {\n if (!control?.willValidate || control.validity.valid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(control.validity, control.validationMessage, control);\n }\n }\n }\n return FormControlElement as unknown as Constructor<FormControlInterface> & T;\n};\n\n/**\n * What a control holding a typed or chosen value adds to FormControl --\n * bd-input, bd-textarea and bd-select.\n *\n * The `value` property is the current value and the value ATTRIBUTE is the\n * default a reset returns to, as on a native field (bd-select also takes a\n * `selected` option; see _defaultValue there). A reset also rebuilds the\n * native control -- the subclass keys it on `_resets` -- because it has to\n * forget that the reader touched it (:user-invalid), and only the form it\n * belongs to could tell it that; the control in here has none.\n *\n * class BdField extends ValueControl(LitElement) { ... }\n */\nexport const ValueControl = <T extends Constructor<LitElement>>(Base: T) => {\n class ValueControlElement extends FormControl(Base) {\n @state() protected _resets = 0;\n declare value: string;\n\n /* What a form sees: the value, and whether the native control finds it\n valid -- required, type, and anything else it checks -- in its own\n words. Called after every update, and before a field's own events, so a\n handler asking the form gets the answer for what was just typed. */\n protected _sync() {\n this._internals.setFormValue(this.value);\n this._mirrorValidity(this._control);\n }\n\n /** What a reset returns to: the value attribute, as on a native field. */\n protected _defaultValue() {\n return this.getAttribute('value') ?? '';\n }\n\n formResetCallback() {\n super.formResetCallback();\n this.value = this._defaultValue();\n this._resets++;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = state as string;\n }\n\n /* Enter in a one-line field submits its form, as from a native <input>.\n Not mid-composition: there Enter commits the IME's candidate. */\n protected _onFieldKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter' && !e.isComposing) this._submitImplicitly();\n }\n }\n return ValueControlElement as unknown as Constructor<ValueControlInterface> & Constructor<FormControlInterface> & T;\n};\n\n/* ---------- the field's label and hint ----------\n bd-input, bd-select and bd-textarea draw one field: a label, the control\n and a hint under it. The copy is the page's, in two slots (contract rule 4,\n docs/adr/0003-copy-in-light-dom.md):\n\n <bd-input name=\"email\" type=\"email\" required>\n <span slot=\"label\">Email</span>\n <span slot=\"hint\">Where we send the licence.</span>\n </bd-input>\n\n Each slot is always rendered, and its wrapper hidden while it is empty, so\n an unlabelled field draws no label box and no gap.\n\n The names reach the control inside without copying any text. The label\n slot sits in the <label for> of the native control, and the hint slot in\n the box its aria-describedby names: both references stay inside this\n shadow root, and name computation reads the flattened tree, so the slotted\n words are the control's name and description. The description is only\n pointed at while the hint holds something -- an empty one would describe\n the field as nothing. ids are scoped to the shadow root, so fixed ones are\n safe.\n\n The wrappers are drawn here, once; each field writes its own <slot> into\n them, so the slots a component renders stay in its render, where\n check:manifest reads them:\n\n ${fieldLabel(this._slots, { size, required }, html`<slot name=\"label\"></slot>`)} */\n\n/** The id of the native control a field renders, which its <label for> names. */\nexport const CONTROL_ID = 'control';\n/** The id of the box around the hint slot, which aria-describedby names. */\nexport const HINT_ID = 'hint';\n/** The slots every field renders. */\nexport const FIELD_SLOTS = ['label', 'hint'] as const;\n\n/** What a field asks of the SlotController that follows its slots. */\ninterface Slots { has(name: string): boolean }\n\n/** The size step a field's label class is named for. */\ntype FieldSize = 'sm' | 'md' | 'lg';\n\n/** The field's label: its label slot, inside a <label for> the native control. */\nexport function fieldLabel(slots: Slots, { size, required }: { size: FieldSize; required: boolean }, slot: TemplateResult) {\n return html`<label\n for=${CONTROL_ID}\n part=\"label\"\n class=\"form-label label-${size}\"\n ?hidden=${!slots.has('label')}\n >${slot}${required\n ? html`<span class=\"form-label__required\" aria-hidden=\"true\">*</span>`\n : nothing}</label>`;\n}\n\n/** The field's hint: its hint slot, in the box the control is described by. */\nexport function fieldHint(slots: Slots, tone: 'default' | 'error' | 'success', slot: TemplateResult) {\n return html`<div\n id=${HINT_ID}\n part=\"hint\"\n class=\"form-help-text form-help-text--${tone}\"\n ?hidden=${!slots.has('hint')}\n >${slot}</div>`;\n}\n\n/** The control's aria-describedby: the hint, while there is one. */\nexport const describedBy = (slots: Slots) => (slots.has('hint') ? HINT_ID : nothing);\n"],"mappings":"A,4JA4BA,IAAaC,EAA+C,CAAE,YAAa,GAASC,GAAS,IAAK,EAM5FC,kBAA6B,IAAI,IAAwB,CAC7D,OAAQ,SAAU,MAAO,MAAO,QAAS,WAAY,OAAQ,QAAS,OAAQ,OAC9E,iBAAkB,QACpB,CAAC,EA2CYC,EAAkD,GAAY,CACzE,MAAMC,UAA2BC,CAAK,C,OACZ,KAAA,eAAA,E,CAgBxB,YAAY,GAAGC,EAAa,CAC1B,MAAM,GAAGA,CAAI,EAXoB,KAAA,cAAA,GAMH,KAAA,WAAA,GAM9B,KAAK,WAA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AC7BC,IAAOC,EACN,CAAI,iEACJC,EAAQ,SACd,CAGA,SAAgBC,EAAU,EAAc,EAAuC,EAAsB,CACnG,MAAO,EAAI;SACJR,EAAQ;;4CAE2BS,EAAK;cACnC,CAACL,EAAM,IAAI,MAAM,EAAE;KAC5BC,EAAK,OACV,CAGA,IAAaK,EAAe,GAAkBN,EAAM,IAAI,MAAM,EAAIJ,EAAUO,E"}
1
+ {"version":3,"file":"form-control.js","names":["__decorate","omitEmpty","value","BLOCKS_IMPLICIT_SUBMISSION","FormControl","FormControlElement","Base","args","r","form","elements","button","el","disabled","control","state","ValueControl","ValueControlElement","_args","CONTROL_ID","HINT_ID","FIELD_SLOTS","fieldLabel","size","slots","slot","required","nothing","fieldHint","tone","describedBy","fieldName","label","labels","l"],"sources":["../../../../src/components/shared/form-control.ts"],"sourcesContent":["import { html, nothing, type ComplexAttributeConverter, type LitElement, type TemplateResult } from 'lit';\nimport { state } from 'lit/decorators.js';\n\n/**\n * What makes a bd-* control take part in a <form>.\n *\n * Every control in this package renders its native element inside a shadow\n * root, and a native control there has no form owner: the <form> around the\n * element could not see it. A form submitted none of them, reset none of them\n * and let a required one through empty. Form-associated custom elements are\n * the platform's answer -- Baseline Widely available since 2023 -- so the\n * host joins the form itself through ElementInternals, the way the guide in\n * .claude/skills/modern-web-guidance/guides/html/form-associated-custom-elements.md\n * lays out, with no hidden input.\n *\n * This is the part every control shares: the opt-in, the internals, the\n * read-only surface a native control has (form, validity, checkValidity...),\n * and the two states a control cannot see from inside its shadow root -- a\n * <fieldset disabled> around it, and a submit that failed. What a control\n * submits, when it is valid and what reset puts back are its own.\n *\n * class BdThing extends FormControl(LitElement) { ... }\n */\n\n/* For `name`, which reflects: FACE submits under the host's name ATTRIBUTE, so\n a name set as a property -- what every framework binding does -- has to\n reach it. An empty name submits nothing either way, so it is left off the\n element rather than written as name=\"\" on every control on the page. */\nexport const omitEmpty: ComplexAttributeConverter<string> = { toAttribute: value => value || null };\n\n/* The input types that block implicit submission (HTML, \"implicit\n submission\"): a form with no submit button submits on Enter only while it\n has at most one field of these. A text field here says which type it is\n through its own `type`, so it is counted the same way. */\nconst BLOCKS_IMPLICIT_SUBMISSION = new Set<string | undefined>([\n 'text', 'search', 'url', 'tel', 'email', 'password', 'date', 'month', 'week', 'time',\n 'datetime-local', 'number'\n]);\n\n// Lit's mixin pattern: the class a mixin returns is typed by the declared\n// interfaces below, so its members reach the elements built on it without the\n// anonymous class itself leaking into the published declarations.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor<T = object> = new (...args: any[]) => T;\n\n/** The native element a control renders and stands in for. */\ntype NativeControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement;\n\n/* The members a control's own code reaches are protected: they are how the\n elements built on the mixin talk to it, not part of what a page may call. */\nexport declare class FormControlInterface {\n protected _internals : ElementInternals;\n protected _formDisabled: boolean;\n protected _attempted : boolean;\n protected _fromOutside(e: MouseEvent): boolean;\n protected get _control(): NativeControl | null;\n protected _activate(): void;\n get form(): HTMLFormElement | null;\n get labels(): NodeList;\n get validity(): ValidityState;\n get validationMessage(): string;\n get willValidate(): boolean;\n checkValidity(): boolean;\n reportValidity(): boolean;\n protected _submitImplicitly(): void;\n protected _relayChange(): void;\n formDisabledCallback(disabled: boolean): void;\n formResetCallback(): void;\n protected _mirrorValidity(control: NativeControl | null | undefined): void;\n}\n\nexport declare class ValueControlInterface {\n protected _resets: number;\n value : string;\n protected _sync(): void;\n protected _defaultValue(): string;\n formStateRestoreCallback(state: string | File | FormData | null): void;\n protected _onFieldKeydown(e: KeyboardEvent): void;\n}\n\nexport const FormControl = <T extends Constructor<LitElement>>(Base: T) => {\n class FormControlElement extends Base {\n static formAssociated = true;\n\n /* Disabled as the form sees it: the control's own `disabled`, or a\n <fieldset disabled> it sits in. The platform reports both through\n formDisabledCallback. It is kept here and never written to the host's\n attribute, or a fieldset re-enabled later could not re-enable it. */\n @state() protected _formDisabled = false;\n /* A submit has been tried and found this control invalid. A native\n control turns :user-invalid then, but the native element in here has\n no form owner, so it never learns of the attempt; the `invalid` event\n the form fires at the host is how it hears. checkValidity() fires the\n same event, so a silent check counts too. Reset clears it. */\n @state() protected _attempted = false;\n protected _internals: ElementInternals;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- a mixin constructor must take any[]\n constructor(...args: any[]) {\n super(...args);\n this._internals = this.attachInternals();\n this.addEventListener('invalid', () => { this._attempted = true; });\n /* An outside activation is passed on to the native control, whose own\n click then reaches this element like any other. This one stops here, so\n a click listener on the element hears one click, not two -- one\n el.click() is one click on a native control. Registered in the\n constructor, it runs before any listener the page adds. */\n this.addEventListener('click', e => {\n if (e.composedPath()[0] !== this || !this._fromOutside(e)) return;\n e.stopImmediatePropagation();\n this._activate();\n });\n }\n\n /* A click on the host itself, not on anything inside it, is one of three\n things. A <label for> pointing at this element sends one carrying the\n label's position, and el.click() an untrusted one: the two ways a native\n control is activated from outside, and both activate this one. The third\n is a real click inside the host's own box but on nothing in it -- the\n slack beside a short label when a column stretches the host -- and that\n did nothing before and still does not, or a wide row would toggle from\n across the page. */\n protected _fromOutside(e: MouseEvent) {\n if (!e.isTrusted) return true;\n const r = this.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n }\n\n /** The native element inside; each control says which. */\n protected get _control(): NativeControl | null {\n return null;\n }\n\n /** What an outside activation does: a field takes focus, a checkable control overrides this to toggle. */\n protected _activate() {\n this._control?.focus();\n }\n\n get form() { return this._internals.form; }\n get labels() { return this._internals.labels; }\n get validity() { return this._internals.validity; }\n get validationMessage() { return this._internals.validationMessage; }\n get willValidate() { return this._internals.willValidate; }\n checkValidity() { return this._internals.checkValidity(); }\n reportValidity() { return this._internals.reportValidity(); }\n\n /* Enter in a native text field, checkbox, radio or switch submits its\n form -- implicit submission: the form's default button is clicked, or,\n with none, the form is submitted, unless more than one of its fields\n blocks that (BLOCKS_IMPLICIT_SUBMISSION above). Enter never toggles;\n Space does. The native control in here has no form, so the host does it.\n The default button is the form's first submit button, and a bd-button\n with type=\"submit\" is one: it is in form.elements and its type says so.\n A disabled default button means no submission, as natively. */\n protected _submitImplicitly() {\n const form = this.form;\n if (!form) return;\n const elements = [...form.elements] as Array<HTMLElement & { type?: string }>;\n const button = elements.find(el => el.type === 'submit' || el.type === 'image');\n if (button) {\n if (!button.matches(':disabled')) button.click();\n return;\n }\n const blocking = elements.filter(el => BLOCKS_IMPLICIT_SUBMISSION.has(el.type)).length;\n if (blocking <= 1) form.requestSubmit();\n }\n\n /* THE NATIVE EVENTS, AND WHICH ONE HAS TO BE SENT AGAIN.\n A control sends what its native control sends -- `input` as the value\n moves, `change` when it is committed -- with no detail: a listener reads\n event.target.value, or .checked, off the element, as it would off an\n <input>. (3.x sent bd-input and bd-change with a detail; v4 drops both,\n N8 in docs/adr/0004-web-awesome-naming.md.)\n\n The two do not leave the shadow root alike. `input` is composed, so the\n native one already reaches the page, retargeted to this element, and is\n not sent again: a second would make one keystroke two events. `change`\n is not composed and stops at the shadow root, so the element sends its\n own, once, after its state has followed the native control's. Composed,\n as `input` is, so a form handler above an enclosing component's shadow\n root hears both. */\n protected _relayChange() {\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n }\n\n formResetCallback() {\n this._attempted = false;\n }\n\n /* The native control already knows whether it is valid, and says so in the\n browser's own words and language, so the host repeats it rather than\n re-deriving it. The control is the anchor: reportValidity() and a failed\n submit focus it and point the message at it. A disabled control is out\n of validation altogether, and says so with an empty message that\n setValidity() would refuse; the host is disabled with it. */\n protected _mirrorValidity(control: NativeControl | null | undefined) {\n if (!control?.willValidate || control.validity.valid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(control.validity, control.validationMessage, control);\n }\n }\n }\n return FormControlElement as unknown as Constructor<FormControlInterface> & T;\n};\n\n/**\n * What a control holding a typed or chosen value adds to FormControl --\n * bd-input, bd-textarea and bd-select.\n *\n * The `value` property is the current value and the value ATTRIBUTE is the\n * default a reset returns to, as on a native field (bd-select also takes a\n * `selected` option; see _defaultValue there). A reset also rebuilds the\n * native control -- the subclass keys it on `_resets` -- because it has to\n * forget that the reader touched it (:user-invalid), and only the form it\n * belongs to could tell it that; the control in here has none.\n *\n * class BdField extends ValueControl(LitElement) { ... }\n */\nexport const ValueControl = <T extends Constructor<LitElement>>(Base: T) => {\n class ValueControlElement extends FormControl(Base) {\n @state() protected _resets = 0;\n declare value: string;\n\n /* What a form sees: the value, and whether the native control finds it\n valid -- required, type, and anything else it checks -- in its own\n words. Called after every update, and before a field's own events, so a\n handler asking the form gets the answer for what was just typed. */\n protected _sync() {\n this._internals.setFormValue(this.value);\n this._mirrorValidity(this._control);\n }\n\n /** What a reset returns to: the value attribute, as on a native field. */\n protected _defaultValue() {\n return this.getAttribute('value') ?? '';\n }\n\n formResetCallback() {\n super.formResetCallback();\n this.value = this._defaultValue();\n this._resets++;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = state as string;\n }\n\n /* Enter in a one-line field submits its form, as from a native <input>.\n Not mid-composition: there Enter commits the IME's candidate. */\n protected _onFieldKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter' && !e.isComposing) this._submitImplicitly();\n }\n }\n return ValueControlElement as unknown as Constructor<ValueControlInterface> & Constructor<FormControlInterface> & T;\n};\n\n/* ---------- the field's label and hint ----------\n bd-input, bd-select and bd-textarea draw one field: a label, the control\n and a hint under it. The copy is the page's, in two slots (contract rule 4,\n docs/adr/0003-copy-in-light-dom.md):\n\n <bd-input name=\"email\" type=\"email\" required>\n <span slot=\"label\">Email</span>\n <span slot=\"hint\">Where we send the licence.</span>\n </bd-input>\n\n Each slot is always rendered, and its wrapper hidden while it is empty, so\n an unlabelled field draws no label box and no gap.\n\n The names reach the control inside without copying any text. The label\n slot sits in the <label for> of the native control, and the hint slot in\n the box its aria-describedby names: both references stay inside this\n shadow root, and name computation reads the flattened tree, so the slotted\n words are the control's name and description. The description is only\n pointed at while the hint holds something -- an empty one would describe\n the field as nothing. ids are scoped to the shadow root, so fixed ones are\n safe.\n\n The wrappers are drawn here, once; each field writes its own <slot> into\n them, so the slots a component renders stay in its render, where\n check:manifest reads them:\n\n ${fieldLabel(this._slots, { size, required }, html`<slot name=\"label\"></slot>`)} */\n\n/** The id of the native control a field renders, which its <label for> names. */\nexport const CONTROL_ID = 'control';\n/** The id of the box around the hint slot, which aria-describedby names. */\nexport const HINT_ID = 'hint';\n/** The slots every field renders. */\nexport const FIELD_SLOTS = ['label', 'hint'] as const;\n\n/** What a field asks of the SlotController that follows its slots. */\ninterface Slots { has(name: string): boolean }\n\n/** The size step a field's label class is named for. */\ntype FieldSize = 'sm' | 'md' | 'lg';\n\n/** The field's label: its label slot, inside a <label for> the native control. */\nexport function fieldLabel(slots: Slots, { size, required }: { size: FieldSize; required: boolean }, slot: TemplateResult) {\n return html`<label\n for=${CONTROL_ID}\n part=\"label\"\n class=\"form-label label-${size}\"\n ?hidden=${!slots.has('label')}\n >${slot}${required\n ? html`<span class=\"form-label__required\" aria-hidden=\"true\">*</span>`\n : nothing}</label>`;\n}\n\n/** The field's hint: its hint slot, in the box the control is described by. */\nexport function fieldHint(slots: Slots, tone: 'default' | 'error' | 'success', slot: TemplateResult) {\n return html`<div\n id=${HINT_ID}\n part=\"hint\"\n class=\"form-help-text form-help-text--${tone}\"\n ?hidden=${!slots.has('hint')}\n >${slot}</div>`;\n}\n\n/** The control's aria-describedby: the hint, while there is one. */\nexport const describedBy = (slots: Slots) => (slots.has('hint') ? HINT_ID : nothing);\n\n/* A field with no visible label still needs a name, and the two ways a page\n gives one without drawing it reach the host, not the native control a\n screen reader focuses: aria-label on the host names nothing there, and a\n <label for> outside the shadow root cannot name the control inside it --\n FACE hands the host its labels, nothing more. So the field passes either\n on, as the control's own aria-label. The label slot wins: while it holds\n something, the <label for> above already names the control, and a second\n source for the name could only disagree with the words on the screen. */\n\n/**\n * The aria-label a field gives its native control: '' while the label slot\n * holds something, else `label` (the field's `aria-label` attribute), else\n * the words of the `<label for>`s pointing at the field.\n *\n * aria-label=${fieldName(this._slots, this.fieldLabel, this._internals.labels) || nothing}\n */\nexport function fieldName(slots: Slots, label: string, labels: NodeList | null | undefined) {\n if (slots.has('label')) return '';\n if (label) return label;\n return [...(labels ?? [])].map(l => l.textContent!.trim()).filter(Boolean)\n .join(' ');\n}\n"],"mappings":"A,4JA4BA,IAAaC,EAA+C,CAAE,YAAa,GAASC,GAAS,IAAK,EAM5FC,kBAA6B,IAAI,IAAwB,CAC7D,OAAQ,SAAU,MAAO,MAAO,QAAS,WAAY,OAAQ,QAAS,OAAQ,OAC9E,iBAAkB,QACpB,CAAC,EA2CYC,EAAkD,GAAY,CACzE,MAAMC,UAA2BC,CAAK,C,OACZ,KAAA,eAAA,E,CAgBxB,YAAY,GAAGC,EAAa,CAC1B,MAAM,GAAGA,CAAI,EAXoB,KAAA,cAAA,GAMH,KAAA,WAAA,GAM9B,KAAK,WAAa,KAAK,gBAAgB,EACvC,KAAK,iBAAiB,cAAiB,CAAE,KAAK,WAAa,EAAM,CAAC,EAMlE,KAAK,iBAAiB,QAAS,GAAK,CAC9B,EAAE,aAAa,CAAC,CAAC,KAAO,MAAS,KAAK,aAAa,CAAC,IACxD,EAAE,yBAAyB,EAC3B,KAAK,UAAU,EACjB,CAAC,CACH,CAUA,aAAuB,EAAe,CACpC,GAAI,CAAC,EAAE,UAAW,MAAO,GACzB,IAAMC,EAAI,KAAK,sBAAsB,EACrC,OAAO,EAAE,QAAUA,EAAE,MAAQ,EAAE,QAAUA,EAAE,OAAS,EAAE,QAAUA,EAAE,KAAO,EAAE,QAAUA,EAAE,MACzF,CAGA,IAAc,UAAiC,CAC7C,OAAO,IACT,CAGA,WAAsB,CACpB,KAAK,UAAU,MAAM,CACvB,CAEA,IAAI,MAAO,CAAE,OAAO,KAAK,WAAW,IAAM,CAC1C,IAAI,QAAS,CAAE,OAAO,KAAK,WAAW,MAA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AK,WAAW,aAAa,KAAK,KAAK,EACvC,KAAK,gBAAgB,KAAK,QAAQ,CACpC,CAGA,eAA0B,CACxB,OAAO,KAAK,aAAa,OAAO,GAAK,EACvC,CAEA,mBAAoB,CAClB,MAAM,kBAAkB,EACxB,KAAK,MAAQ,KAAK,cAAc,EAChC,KAAK,SACP,CAEA,yBAAyB,EAAwC,CAC/D,KAAK,MAAQS,CACf,CAIA,gBAA0B,EAAkB,CACtC,EAAE,MAAQ,SAAW,CAAC,EAAE,aAAa,KAAK,kBAAkB,CAClE,CACF,CACA,OAjCGf,EAAA,CAAAe,EAAM,CAAA,EAAAE,EAAA,UAAA,UAAA,IAAA,EAAA,EAiCFA,CACT,EA+BaE,EAAa,UAEbC,EAAU,OAEVC,EAAc,CAAC,QAAS,MAAM,EAS3C,SAAgBC,EAAW,EAAc,CAAE,OAAM,YAAoD,EAAsB,CACzH,MAAO,EAAI;UACHH,EAAW;;8BAESI,EAAK;cACrB,CAACC,EAAM,IAAI,OAAO,EAAE;KAC7BC,IAAOC,EACN,CAAI,iEACJC,EAAQ,SACd,CAGA,SAAgBC,EAAU,EAAc,EAAuC,EAAsB,CACnG,MAAO,EAAI;SACJR,EAAQ;;4CAE2BS,EAAK;cACnC,CAACL,EAAM,IAAI,MAAM,EAAE;KAC5BC,EAAK,OACV,CAGA,IAAaK,EAAe,GAAkBN,EAAM,IAAI,MAAM,EAAIJ,EAAUO,EAkB5E,SAAgBI,EAAU,EAAc,EAAe,EAAqC,CAG1F,OAFIP,EAAM,IAAI,OAAO,EAAU,GAC3BQ,GACG,CAAC,GAAIC,GAAU,CAAC,CAAE,CAAC,CAAC,IAAI,GAAKC,EAAE,YAAa,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CACvE,KAAK,GAAG,CACb,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-system-design",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "description": "Design system based on Web Components.",
5
5
  "author": "Iordache Matei Cezar <miordache@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -490,5 +490,5 @@
490
490
  "volta": {
491
491
  "node": "24.22.1"
492
492
  },
493
- "gitHead": "2cb8077c071d292edd296b039b8a5fb97d5b2678"
493
+ "gitHead": "96654a44cd1a937056eaf2e52110d7a6d24404db"
494
494
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
3
  "package": "@repobit/dex-system-design",
4
- "packageVersion": "4.0.0",
4
+ "packageVersion": "4.2.0",
5
5
  "generatedFrom": [
6
6
  "package.json exports",
7
7
  "Lit reactive properties (static properties or @property/@state)",
@@ -1112,6 +1112,12 @@
1112
1112
  "name": "name",
1113
1113
  "type": "string",
1114
1114
  "description": "The name it submits under in a form: the element is form-associated, so a <form> around it submits name=value."
1115
+ },
1116
+ {
1117
+ "name": "fieldLabel",
1118
+ "type": "string",
1119
+ "attributeName": "aria-label",
1120
+ "description": "The select's accessible name when the label slot is empty: aria-label on the element is passed to the <select>. Without either, a <label for> pointing at the element names it. For a select whose label is elsewhere on the page."
1115
1121
  }
1116
1122
  ],
1117
1123
  "events": [
@@ -4379,7 +4385,7 @@
4379
4385
  "The copy is slotted: <span slot=\"eyebrow\">, <bd-h slot=\"title\" as=\"h2\"> (the page picks the level; the header draws it at the page-section role, heading-h2) and <bd-p slot=\"description\"> (body-regular, body-large from lg). A link in the description is bd-link inline underline. A part whose slot is empty is left out."
4380
4386
  ]
4381
4387
  },
4382
- {
4388
+ {
4383
4389
  "tag": "bd-logo-marquee",
4384
4390
  "packageExport": "./logo-marquee",
4385
4391
  "module": "./dist/src/components/logo-marquee/logo-marquee.js",
@@ -4387,20 +4393,29 @@
4387
4393
  "contentModel": "children",
4388
4394
  "slots": [
4389
4395
  {
4390
- "name": ""
4396
+ "name": "",
4397
+ "accepts": [
4398
+ "img",
4399
+ "picture",
4400
+ "bd-img",
4401
+ "bd-picture",
4402
+ "bd-mark",
4403
+ "span",
4404
+ "bd-review"
4405
+ ]
4391
4406
  }
4392
4407
  ],
4393
4408
  "props": [
4394
4409
  {
4395
4410
  "name": "label",
4396
4411
  "type": "string",
4397
- "description": "Names the region, in the page's language."
4412
+ "description": "Names the region, in the page's language: the row's subject, as \"Partners\" or \"Customer reviews\"."
4398
4413
  },
4399
4414
  {
4400
4415
  "name": "duration",
4401
4416
  "type": "number",
4402
4417
  "default": 35,
4403
- "description": "Seconds for one copy of the set to pass: 35 for the partner line and the award strip alike."
4418
+ "description": "Seconds for one copy of the set to pass: 35 for the partner line and the award strip alike. A row of reviews is several cards wide and takes longer: 60 for six reviews."
4404
4419
  },
4405
4420
  {
4406
4421
  "name": "gap",
@@ -4417,7 +4432,7 @@
4417
4432
  "64"
4418
4433
  ],
4419
4434
  "default": "48",
4420
- "description": "A step on the spacing scale between two logos: 48 for partners, 24 for awards."
4435
+ "description": "A step on the spacing scale between two items: 48 for partners, 24 for awards and for reviews."
4421
4436
  },
4422
4437
  {
4423
4438
  "name": "paused",
@@ -4428,14 +4443,26 @@
4428
4443
  "name": "pauseLabel",
4429
4444
  "type": "string",
4430
4445
  "attributeName": "pause-label",
4431
- "description": "The pause button's accessible name while the logos move."
4446
+ "description": "The pause button's accessible name while the row moves, in the page's language. Its default speaks of logos, so a row of reviews sets it (\"Pause the moving reviews\")."
4432
4447
  },
4433
4448
  {
4434
4449
  "name": "playLabel",
4435
4450
  "type": "string",
4436
4451
  "attributeName": "play-label",
4437
- "description": "The button's accessible name while the logos are paused."
4452
+ "description": "The button's accessible name while the row is paused, in the page's language. Its default speaks of logos, so a row of reviews sets it (\"Play the moving reviews\")."
4453
+ },
4454
+ {
4455
+ "name": "withoutPauseButton",
4456
+ "type": "boolean",
4457
+ "attributeName": "without-pause-button",
4458
+ "default": false,
4459
+ "description": "No pause button. It takes away the control WCAG 2.2.2 asks for on motion longer than five seconds, so it is the page's decision, never the default: the pointer and focus on the row still hold it and reduced motion keeps it still, but a page that sets it gives the reader its own control that sets paused, or the row no longer meets 2.2.2."
4438
4460
  }
4461
+ ],
4462
+ "notes": [
4463
+ "The default slot takes the row's items: logos (an <img>, <picture>, bd-img, bd-picture or bd-mark), a label in a <span>, or bd-review cards. Logos sit on the mark plate; a label is type and follows the theme.",
4464
+ "A bd-review takes a 320px card width and its own height, and stands at the top of the row, so reviews of different lengths line up along their tops.",
4465
+ "A row of reviews sets label, pause-label and play-label in the page's language: the pause button's own defaults speak of logos."
4439
4466
  ]
4440
4467
  },
4441
4468
  {
@@ -4662,10 +4689,11 @@
4662
4689
  "type": "string",
4663
4690
  "enum": [
4664
4691
  "tint",
4665
- "container"
4692
+ "container",
4693
+ "none"
4666
4694
  ],
4667
4695
  "default": "tint",
4668
- "description": "The card's ground. tint: the brand's lightest wash (--status-brand-surface). container: the container grey (--color-surface-container), as bd-card and bd-bento-item name it."
4696
+ "description": "The card's ground. tint: the brand's lightest wash (--status-brand-surface). container: the container grey (--color-surface-container), as bd-card and bd-bento-item name it. none: no ground and no inset, so the text lines up with the content around it."
4669
4697
  }
4670
4698
  ],
4671
4699
  "notes": [