@ni/ok-components 1.14.0 → 1.16.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.
Files changed (37) hide show
  1. package/dist/all-components-bundle.js +1015 -422
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +531 -329
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/custom-elements.json +241 -0
  6. package/dist/custom-elements.md +34 -0
  7. package/dist/esm/fv/all-fv.d.ts +1 -0
  8. package/dist/esm/fv/all-fv.js +1 -0
  9. package/dist/esm/fv/all-fv.js.map +1 -1
  10. package/dist/esm/fv/multi-select/index.d.ts +100 -0
  11. package/dist/esm/fv/multi-select/index.js +367 -0
  12. package/dist/esm/fv/multi-select/index.js.map +1 -0
  13. package/dist/esm/fv/multi-select/models/form-associated.d.ts +16 -0
  14. package/dist/esm/fv/multi-select/models/form-associated.js +17 -0
  15. package/dist/esm/fv/multi-select/models/form-associated.js.map +1 -0
  16. package/dist/esm/fv/multi-select/styles.d.ts +1 -0
  17. package/dist/esm/fv/multi-select/styles.js +241 -0
  18. package/dist/esm/fv/multi-select/styles.js.map +1 -0
  19. package/dist/esm/fv/multi-select/template.d.ts +2 -0
  20. package/dist/esm/fv/multi-select/template.js +171 -0
  21. package/dist/esm/fv/multi-select/template.js.map +1 -0
  22. package/dist/esm/fv/multi-select/types.d.ts +8 -0
  23. package/dist/esm/fv/multi-select/types.js +2 -0
  24. package/dist/esm/fv/multi-select/types.js.map +1 -0
  25. package/dist/esm/fv/split-button/styles.js +45 -5
  26. package/dist/esm/fv/split-button/styles.js.map +1 -1
  27. package/dist/esm/fv/split-button/template.js +3 -1
  28. package/dist/esm/fv/split-button/template.js.map +1 -1
  29. package/dist/esm/fv/split-button-anchor/index.d.ts +2 -2
  30. package/dist/esm/fv/split-button-anchor/index.js +4 -4
  31. package/dist/esm/fv/split-button-anchor/index.js.map +1 -1
  32. package/dist/esm/fv/split-button-anchor/styles.d.ts +1 -1
  33. package/dist/esm/fv/split-button-anchor/styles.js +1 -227
  34. package/dist/esm/fv/split-button-anchor/styles.js.map +1 -1
  35. package/dist/esm/fv/split-button-anchor/template.js +9 -4
  36. package/dist/esm/fv/split-button-anchor/template.js.map +1 -1
  37. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe;;;;;;;yBAOlB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;sBAClB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACvB,OAAO,IAAI,CAAC;AAChB,CAAC;;cAEC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;;;cAIZ,GAAG,CAAC,cAAc,CAAC;;yBAER,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;0BACd,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE;6BAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;sBAElB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;;eAEE,wBAAwB,MAAM,wBAAwB;;;MAG/D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EACX,IAAI,CAAe;eACZ,iBAAiB;;;;;;;;kBAQd,GAAG,CAAC,QAAQ,CAAC;;;;;gBAKf,iBAAiB;SACxB,CACJ;CACJ,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';\nimport { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';\nimport type { FvSplitButton } from '.';\n\nexport const template = html<FvSplitButton>`\n <div\n class=\"split-button-container\"\n >\n <button\n class=\"split-button-primary\"\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n @click=\"${x => {\n x.handlePrimaryClick();\n return true;\n }}\"\n >\n ${x => x.label}\n </button>\n <button\n class=\"split-button-toggle\"\n ${ref('toggleButton')}\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n aria-label=\"${x => `More actions for ${x.label}`}\"\n aria-expanded=\"${x => x.open}\"\n aria-haspopup=\"menu\"\n @click=\"${x => {\n x.handleToggleClick();\n return true;\n }}\"\n >\n <${iconArrowExpanderDownTag}></${iconArrowExpanderDownTag}>\n </button>\n </div>\n ${when(\n x => x.open,\n html<FvSplitButton>`\n <${anchoredRegionTag}\n fixed-placement\n auto-update-mode=\"auto\"\n horizontal-inset\n horizontal-positioning-mode=\"dynamic\"\n horizontal-default-position=\"end\"\n vertical-positioning-mode=\"locktodefault\"\n vertical-default-position=\"bottom\"\n ${ref('region')}\n >\n <span part=\"menu\">\n <slot name=\"menu\"></slot>\n </span>\n </${anchoredRegionTag}>\n `\n )}\n`;"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe;;;;;;;yBAOlB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;sBAClB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACvB,OAAO,IAAI,CAAC;AAChB,CAAC;;;oBAGO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;;;;cAKlB,GAAG,CAAC,cAAc,CAAC;;yBAER,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;0BACd,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE;6BAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;sBAElB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;;eAEE,wBAAwB,MAAM,wBAAwB;;;MAG/D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EACX,IAAI,CAAe;eACZ,iBAAiB;;;;;;;;kBAQd,GAAG,CAAC,QAAQ,CAAC;;;;;gBAKf,iBAAiB;SACxB,CACJ;CACJ,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';\nimport { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';\nimport type { FvSplitButton } from '.';\n\nexport const template = html<FvSplitButton>`\n <div\n class=\"split-button-container\"\n >\n <button\n class=\"split-button-primary\"\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n @click=\"${x => {\n x.handlePrimaryClick();\n return true;\n }}\"\n >\n <slot name=\"start\"></slot>\n <span>${x => x.label}</span>\n <slot name=\"end\"></slot>\n </button>\n <button\n class=\"split-button-toggle\"\n ${ref('toggleButton')}\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n aria-label=\"${x => `More actions for ${x.label}`}\"\n aria-expanded=\"${x => x.open}\"\n aria-haspopup=\"menu\"\n @click=\"${x => {\n x.handleToggleClick();\n return true;\n }}\"\n >\n <${iconArrowExpanderDownTag}></${iconArrowExpanderDownTag}>\n </button>\n </div>\n ${when(\n x => x.open,\n html<FvSplitButton>`\n <${anchoredRegionTag}\n fixed-placement\n auto-update-mode=\"auto\"\n horizontal-inset\n horizontal-positioning-mode=\"dynamic\"\n horizontal-default-position=\"end\"\n vertical-positioning-mode=\"locktodefault\"\n vertical-default-position=\"bottom\"\n ${ref('region')}\n >\n <span part=\"menu\">\n <slot name=\"menu\"></slot>\n </span>\n </${anchoredRegionTag}>\n `\n )}\n`;"]}
@@ -20,7 +20,7 @@ export declare class FvSplitButtonAnchor extends FoundationElement {
20
20
  appearance: FvSplitButtonAnchorAppearanceType;
21
21
  appearanceVariant: FvSplitButtonAnchorAppearanceVariantType;
22
22
  /** @internal */
23
- splitButtonContainer?: HTMLDivElement;
23
+ toggleButton?: HTMLButtonElement;
24
24
  /** @internal */
25
25
  region?: AnchoredRegion;
26
26
  /** @internal */
@@ -38,7 +38,7 @@ export declare class FvSplitButtonAnchor extends FoundationElement {
38
38
  /** @internal */
39
39
  regionChanged(prev: AnchoredRegion | undefined, _next: AnchoredRegion | undefined): void;
40
40
  /** @internal */
41
- splitButtonContainerChanged(): void;
41
+ toggleButtonChanged(): void;
42
42
  private readonly documentClickHandler;
43
43
  private readonly keydownHandler;
44
44
  private readonly menuChangeHandler;
@@ -81,14 +81,14 @@ export class FvSplitButtonAnchor extends FoundationElement {
81
81
  prev.removeEventListener('change', this.menuChangeHandler);
82
82
  }
83
83
  if (this.region) {
84
- this.region.anchorElement = this.splitButtonContainer ?? this;
84
+ this.region.anchorElement = this.toggleButton ?? this;
85
85
  this.region.addEventListener('change', this.menuChangeHandler, { capture: true });
86
86
  }
87
87
  }
88
88
  /** @internal */
89
- splitButtonContainerChanged() {
89
+ toggleButtonChanged() {
90
90
  if (this.region) {
91
- this.region.anchorElement = this.splitButtonContainer ?? this;
91
+ this.region.anchorElement = this.toggleButton ?? this;
92
92
  }
93
93
  }
94
94
  setOpen(nextOpen) {
@@ -132,7 +132,7 @@ __decorate([
132
132
  ], FvSplitButtonAnchor.prototype, "appearanceVariant", void 0);
133
133
  __decorate([
134
134
  observable
135
- ], FvSplitButtonAnchor.prototype, "splitButtonContainer", void 0);
135
+ ], FvSplitButtonAnchor.prototype, "toggleButton", void 0);
136
136
  __decorate([
137
137
  observable
138
138
  ], FvSplitButtonAnchor.prototype, "region", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACH,6BAA6B,EAE7B,oCAAoC,EAEvC,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAA1D;;QAEW,UAAK,GAAG,kBAAkB,CAAC;QAG3B,SAAI,GAAG,EAAE,CAAC;QAGV,WAAM,GAAG,EAAE,CAAC;QAGZ,QAAG,GAAG,EAAE,CAAC;QAGT,aAAQ,GAAG,EAAE,CAAC;QAGd,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;QAGb,eAAU,GAAsC,6BAA6B,CAAC,OAAO,CAAC;QAGtF,sBAAiB,GAA6C,oCAAoC,CAAC,OAAO,CAAC;QA2EjG,yBAAoB,GAAG,CAAC,KAAY,EAAQ,EAAE;YAC3D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CA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AAGZ;IADN,IAAI;gDACW;AAGT;IADN,IAAI;qDACgB;AAGd;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;qDACF;AAGjB;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;iDACN;AAGb;IADN,IAAI,EAAE;uDACsF;AAGtF;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;8DACwE;AAI3G;IADN,UAAU;iEACkC;AAItC;IADN,UAAU;mDACoB;AAqGnC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC;IACtD,QAAQ,EAAE,wBAAwB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC","sourcesContent":["import { attr, observable } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport type { AnchoredRegion } from '@ni/nimble-components/dist/esm/anchored-region';\nimport { styles } from './styles';\nimport { template } from './template';\nimport {\n FvSplitButtonAnchorAppearance,\n type FvSplitButtonAnchorAppearance as FvSplitButtonAnchorAppearanceType,\n FvSplitButtonAnchorAppearanceVariant,\n type FvSplitButtonAnchorAppearanceVariant as FvSplitButtonAnchorAppearanceVariantType\n} from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-split-button-anchor': FvSplitButtonAnchor;\n }\n}\n\n/**\n * A split button with an anchor-backed primary action and a secondary expandable menu surface.\n */\nexport class FvSplitButtonAnchor extends FoundationElement {\n @attr\n public label = 'Primary function';\n\n @attr\n public href = '';\n\n @attr\n public target = '';\n\n @attr\n public rel = '';\n\n @attr\n public download = '';\n\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n @attr({ mode: 'boolean' })\n public open = false;\n\n @attr()\n public appearance: FvSplitButtonAnchorAppearanceType = FvSplitButtonAnchorAppearance.outline;\n\n @attr({ attribute: 'appearance-variant' })\n public appearanceVariant: FvSplitButtonAnchorAppearanceVariantType = FvSplitButtonAnchorAppearanceVariant.default;\n\n /** @internal */\n @observable\n public splitButtonContainer?: HTMLDivElement;\n\n /** @internal */\n @observable\n public region?: AnchoredRegion;\n\n /** @internal */\n public disabledChanged(): void {\n if (this.disabled) {\n this.setOpen(false);\n }\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('click', this.documentClickHandler);\n document.addEventListener('keydown', this.keydownHandler);\n }\n\n /** @internal */\n public override disconnectedCallback(): void {\n document.removeEventListener('click', this.documentClickHandler);\n document.removeEventListener('keydown', this.keydownHandler);\n super.disconnectedCallback();\n }\n\n /** @internal */\n public handlePrimaryClick(): void {\n if (this.disabled) {\n return;\n }\n\n this.dispatchEvent(new CustomEvent('trigger', {\n bubbles: true,\n composed: true\n }));\n }\n\n /** @internal */\n public handleToggleClick(): void {\n if (this.disabled) {\n return;\n }\n\n this.setOpen(!this.open);\n }\n\n /** @internal */\n public handleMenuChange(): void {\n this.setOpen(false);\n }\n\n /** @internal */\n public regionChanged(prev: AnchoredRegion | undefined, _next: AnchoredRegion | undefined): void {\n if (prev) {\n prev.removeEventListener('change', this.menuChangeHandler);\n }\n if (this.region) {\n this.region.anchorElement = this.splitButtonContainer ?? this;\n this.region.addEventListener('change', this.menuChangeHandler, { capture: true });\n }\n }\n\n /** @internal */\n public splitButtonContainerChanged(): void {\n if (this.region) {\n this.region.anchorElement = this.splitButtonContainer ?? this;\n }\n }\n\n private readonly documentClickHandler = (event: Event): void => {\n if (!this.open) {\n return;\n }\n\n if (!event.composedPath().includes(this)) {\n this.setOpen(false);\n }\n };\n\n private readonly keydownHandler = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n this.setOpen(false);\n }\n };\n\n private readonly menuChangeHandler = (): void => {\n this.handleMenuChange();\n };\n\n private setOpen(nextOpen: boolean): void {\n if (this.open === nextOpen) {\n return;\n }\n\n this.open = nextOpen;\n this.dispatchEvent(new CustomEvent('toggle', {\n bubbles: true,\n composed: true,\n detail: { open: this.open }\n }));\n }\n}\n\nconst okFvSplitButtonAnchor = FvSplitButtonAnchor.compose({\n baseName: 'fv-split-button-anchor',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSplitButtonAnchor());\nexport const fvSplitButtonAnchorTag = 'ok-fv-split-button-anchor';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACH,6BAA6B,EAE7B,oCAAoC,EAEvC,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAA1D;;QAEW,UAAK,GAAG,kBAAkB,CAAC;QAG3B,SAAI,GAAG,EAAE,CAAC;QAGV,WAAM,GAAG,EAAE,CAAC;QAGZ,QAAG,GAAG,EAAE,CAAC;QAGT,aAAQ,GAAG,EAAE,CAAC;QAGd,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;QAGb,eAAU,GAAsC,6BAA6B,CAAC,OAAO,CAAC;QAGtF,sBAAiB,GAA6C,oCAAoC,CAAC,OAAO,CAAC;QA2EjG,yBAAoB,GAAG,CAAC,KAAY,EAAQ,EAAE;YAC3D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,YAAY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IACR,CAAC;CACJ;AAnIU;IADN,IAAI;kDAC6B;AAG3B;IADN,IAAI;iDACY;AAGV;IADN,IAAI;mDACc;AAGZ;IADN,IAAI;gDACW;AAGT;IADN,IAAI;qDACgB;AAGd;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;qDACF;AAGjB;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;iDACN;AAGb;IADN,IAAI,EAAE;uDACsF;AAGtF;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;8DACwE;AAI3G;IADN,UAAU;yDAC6B;AAIjC;IADN,UAAU;mDACoB;AAqGnC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC;IACtD,QAAQ,EAAE,wBAAwB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC","sourcesContent":["import { attr, observable } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport type { AnchoredRegion } from '@ni/nimble-components/dist/esm/anchored-region';\nimport { styles } from './styles';\nimport { template } from './template';\nimport {\n FvSplitButtonAnchorAppearance,\n type FvSplitButtonAnchorAppearance as FvSplitButtonAnchorAppearanceType,\n FvSplitButtonAnchorAppearanceVariant,\n type FvSplitButtonAnchorAppearanceVariant as FvSplitButtonAnchorAppearanceVariantType\n} from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-split-button-anchor': FvSplitButtonAnchor;\n }\n}\n\n/**\n * A split button with an anchor-backed primary action and a secondary expandable menu surface.\n */\nexport class FvSplitButtonAnchor extends FoundationElement {\n @attr\n public label = 'Primary function';\n\n @attr\n public href = '';\n\n @attr\n public target = '';\n\n @attr\n public rel = '';\n\n @attr\n public download = '';\n\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n @attr({ mode: 'boolean' })\n public open = false;\n\n @attr()\n public appearance: FvSplitButtonAnchorAppearanceType = FvSplitButtonAnchorAppearance.outline;\n\n @attr({ attribute: 'appearance-variant' })\n public appearanceVariant: FvSplitButtonAnchorAppearanceVariantType = FvSplitButtonAnchorAppearanceVariant.default;\n\n /** @internal */\n @observable\n public toggleButton?: HTMLButtonElement;\n\n /** @internal */\n @observable\n public region?: AnchoredRegion;\n\n /** @internal */\n public disabledChanged(): void {\n if (this.disabled) {\n this.setOpen(false);\n }\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('click', this.documentClickHandler);\n document.addEventListener('keydown', this.keydownHandler);\n }\n\n /** @internal */\n public override disconnectedCallback(): void {\n document.removeEventListener('click', this.documentClickHandler);\n document.removeEventListener('keydown', this.keydownHandler);\n super.disconnectedCallback();\n }\n\n /** @internal */\n public handlePrimaryClick(): void {\n if (this.disabled) {\n return;\n }\n\n this.dispatchEvent(new CustomEvent('trigger', {\n bubbles: true,\n composed: true\n }));\n }\n\n /** @internal */\n public handleToggleClick(): void {\n if (this.disabled) {\n return;\n }\n\n this.setOpen(!this.open);\n }\n\n /** @internal */\n public handleMenuChange(): void {\n this.setOpen(false);\n }\n\n /** @internal */\n public regionChanged(prev: AnchoredRegion | undefined, _next: AnchoredRegion | undefined): void {\n if (prev) {\n prev.removeEventListener('change', this.menuChangeHandler);\n }\n if (this.region) {\n this.region.anchorElement = this.toggleButton ?? this;\n this.region.addEventListener('change', this.menuChangeHandler, { capture: true });\n }\n }\n\n /** @internal */\n public toggleButtonChanged(): void {\n if (this.region) {\n this.region.anchorElement = this.toggleButton ?? this;\n }\n }\n\n private readonly documentClickHandler = (event: Event): void => {\n if (!this.open) {\n return;\n }\n\n if (!event.composedPath().includes(this)) {\n this.setOpen(false);\n }\n };\n\n private readonly keydownHandler = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n this.setOpen(false);\n }\n };\n\n private readonly menuChangeHandler = (): void => {\n this.handleMenuChange();\n };\n\n private setOpen(nextOpen: boolean): void {\n if (this.open === nextOpen) {\n return;\n }\n\n this.open = nextOpen;\n this.dispatchEvent(new CustomEvent('toggle', {\n bubbles: true,\n composed: true,\n detail: { open: this.open }\n }));\n }\n}\n\nconst okFvSplitButtonAnchor = FvSplitButtonAnchor.compose({\n baseName: 'fv-split-button-anchor',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSplitButtonAnchor());\nexport const fvSplitButtonAnchorTag = 'ok-fv-split-button-anchor';"]}
@@ -1 +1 @@
1
- export declare const styles: import("@ni/fast-element").ElementStyles;
1
+ export { styles } from '../split-button/styles';
@@ -1,228 +1,2 @@
1
- import { css } from '@ni/fast-element';
2
- import { actionRgbPartialColor, borderHoverColor, borderRgbPartialColor, borderWidth, buttonAccentBlockFontColor, buttonAccentOutlineFontColor, buttonBorderAccentOutlineColor, buttonFillAccentColor, buttonFillPrimaryColor, buttonLabelDisabledFontColor, buttonLabelFont, buttonLabelFontColor, buttonPrimaryFontColor, controlHeight, fillSelectedColor, iconColor, smallDelay, standardPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
- import { display } from '../../utilities/style/display';
4
- export const styles = css `
5
- @layer base, hover, focusVisible, active, disabled, top;
6
-
7
- @layer base {
8
- ${display('inline-block')}
9
-
10
- :host {
11
- --ni-private-ok-fv-split-button-anchor-background-image: none;
12
- --ni-private-ok-fv-split-button-anchor-background-size: 100% 100%;
13
- --ni-private-ok-fv-split-button-anchor-background-size-emphasis: 100% 100%;
14
- --ni-private-ok-fv-split-button-anchor-border: rgba(${actionRgbPartialColor}, 0.3);
15
- --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelFontColor};
16
- position: relative;
17
- height: ${controlHeight};
18
- vertical-align: middle;
19
- }
20
-
21
- :host([appearance='ghost']) {
22
- --ni-private-ok-fv-split-button-anchor-border: transparent;
23
- }
24
-
25
- :host([appearance='block']) {
26
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
27
- rgba(${borderRgbPartialColor}, 0.1),
28
- rgba(${borderRgbPartialColor}, 0.1)
29
- );
30
- --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.1);
31
- --ni-private-ok-fv-split-button-anchor-background-size-emphasis: calc(100% - 4px) calc(100% - 4px);
32
- }
33
-
34
- :host([appearance='outline'][appearance-variant='primary']) {
35
- --ni-private-ok-fv-split-button-anchor-border: rgb(${actionRgbPartialColor});
36
- }
37
-
38
- :host([appearance='outline'][appearance-variant='accent']) {
39
- --ni-private-ok-fv-split-button-anchor-border: ${buttonBorderAccentOutlineColor};
40
- --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentOutlineFontColor};
41
- }
42
-
43
- :host([appearance='block'][appearance-variant='primary']) {
44
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
45
- ${buttonFillPrimaryColor},
46
- ${buttonFillPrimaryColor}
47
- );
48
- --ni-private-ok-fv-split-button-anchor-border: ${buttonFillPrimaryColor};
49
- --ni-private-ok-fv-split-button-anchor-color: ${buttonPrimaryFontColor};
50
- }
51
-
52
- :host([appearance='block'][appearance-variant='accent']) {
53
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
54
- ${buttonFillAccentColor},
55
- ${buttonFillAccentColor}
56
- );
57
- --ni-private-ok-fv-split-button-anchor-border: ${buttonFillAccentColor};
58
- --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentBlockFontColor};
59
- }
60
-
61
- .split-button-container {
62
- position: relative;
63
- display: inline-flex;
64
- align-items: stretch;
65
- height: 100%;
66
- }
67
-
68
- .split-button-primary,
69
- .split-button-toggle {
70
- appearance: none;
71
- position: relative;
72
- z-index: 0;
73
- height: 100%;
74
- box-sizing: border-box;
75
- margin: 0;
76
- border: ${borderWidth} solid var(--ni-private-ok-fv-split-button-anchor-border);
77
- background-color: transparent;
78
- background-image: var(--ni-private-ok-fv-split-button-anchor-background-image);
79
- background-position: center;
80
- background-repeat: no-repeat;
81
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size);
82
- color: var(--ni-private-ok-fv-split-button-anchor-color);
83
- fill: currentcolor;
84
- font: ${buttonLabelFont};
85
- cursor: pointer;
86
- outline: none;
87
- transition:
88
- box-shadow ${smallDelay} ease-in-out,
89
- border-color ${smallDelay} ease-in-out,
90
- background-size ${smallDelay} ease-in-out;
91
- }
92
-
93
- .split-button-primary {
94
- display: inline-flex;
95
- align-items: center;
96
- justify-content: center;
97
- padding: 0 ${standardPadding};
98
- border-inline-end-color: transparent;
99
- white-space: nowrap;
100
- text-decoration: none;
101
- }
102
-
103
- .split-button-primary::before,
104
- .split-button-toggle::before {
105
- content: '';
106
- position: absolute;
107
- inset: 0;
108
- pointer-events: none;
109
- outline: 0px solid transparent;
110
- outline-offset: -3px;
111
- transition: outline ${smallDelay} ease-in-out;
112
- }
113
-
114
- .split-button-toggle {
115
- width: ${controlHeight};
116
- min-width: ${controlHeight};
117
- display: inline-flex;
118
- align-items: center;
119
- justify-content: center;
120
- border-inline-start-color: var(--ni-private-ok-fv-split-button-anchor-border);
121
- margin-inline-start: calc(-1 * ${borderWidth});
122
- }
123
-
124
- .split-button-toggle > * {
125
- color: currentColor;
126
- ${iconColor.cssCustomProperty}: currentColor;
127
- }
128
-
129
- .split-button-primary-disabled {
130
- cursor: default;
131
- }
132
-
133
- :host([appearance='ghost']) .split-button-primary,
134
- :host([appearance='ghost']) .split-button-toggle {
135
- border-color: transparent;
136
- box-shadow: none;
137
- }
138
-
139
- slot[name='menu']::slotted(*) {
140
- min-width: 100%;
141
- margin: 4px 0 0;
142
- }
143
- }
144
-
145
- @layer hover {
146
- .split-button-primary:hover,
147
- .split-button-toggle:hover {
148
- border-color: ${borderHoverColor};
149
- box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
150
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
151
- z-index: 1;
152
- }
153
-
154
- :host([appearance='ghost']) .split-button-primary:hover,
155
- :host([appearance='ghost']) .split-button-toggle:hover {
156
- border-color: ${borderHoverColor};
157
- box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
158
- }
159
- }
160
-
161
- @layer focusVisible {
162
- .split-button-primary:focus-visible,
163
- .split-button-toggle:focus-visible {
164
- border-color: ${borderHoverColor};
165
- box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
166
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
167
- z-index: 1;
168
- }
169
-
170
- .split-button-primary:focus-visible::before,
171
- .split-button-toggle:focus-visible::before {
172
- outline: ${borderWidth} solid ${borderHoverColor};
173
- }
174
-
175
- :host([appearance='ghost']) .split-button-primary:focus-visible,
176
- :host([appearance='ghost']) .split-button-toggle:focus-visible {
177
- border-color: ${borderHoverColor};
178
- box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
179
- }
180
- }
181
-
182
- @layer active {
183
- .split-button-primary:active,
184
- .split-button-toggle:active,
185
- :host([open]) .split-button-toggle {
186
- border-color: ${borderHoverColor};
187
- box-shadow: none;
188
- background-image: linear-gradient(${fillSelectedColor}, ${fillSelectedColor});
189
- background-size: calc(100% - 2px) calc(100% - 2px);
190
- }
191
-
192
- :host([appearance='block']) .split-button-primary:active,
193
- :host([appearance='block']) .split-button-toggle:active,
194
- :host([appearance='block'][open]) .split-button-toggle {
195
- background-size: calc(100% - 4px) calc(100% - 4px);
196
- }
197
-
198
- :host([appearance='outline'][appearance-variant='accent']) .split-button-primary:active,
199
- :host([appearance='outline'][appearance-variant='accent']) .split-button-toggle:active,
200
- :host([appearance='outline'][appearance-variant='accent'][open]) .split-button-toggle {
201
- color: ${buttonAccentOutlineFontColor};
202
- }
203
- }
204
-
205
- @layer disabled {
206
- :host([disabled]) {
207
- --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelDisabledFontColor};
208
- }
209
-
210
- :host([disabled][appearance='outline']) {
211
- --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.3);
212
- }
213
-
214
- :host([disabled]) .split-button-primary,
215
- :host([disabled]) .split-button-toggle {
216
- cursor: default;
217
- box-shadow: none;
218
- }
219
-
220
- :host([disabled][appearance='ghost']) .split-button-primary,
221
- :host([disabled][appearance='ghost']) .split-button-toggle {
222
- border-color: transparent;
223
- }
224
- }
225
-
226
- @layer top {}
227
- `;
1
+ export { styles } from '../split-button/styles';
228
2
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,eAAe,EAClB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;UAIf,OAAO,CAAC,cAAc,CAAC;;;;;;kEAMiC,qBAAqB;4DAC3B,oBAAoB;;sBAE1D,aAAa;;;;;;;;;;uBAUZ,qBAAqB;uBACrB,qBAAqB;;kEAEsB,qBAAqB;;;;;iEAKtB,qBAAqB;;;;6DAIzB,8BAA8B;4DAC/B,4BAA4B;;;;;kBAKtE,sBAAsB;kBACtB,sBAAsB;;6DAEqB,sBAAsB;4DACvB,sBAAsB;;;;;kBAKhE,qBAAqB;kBACrB,qBAAqB;;6DAEsB,qBAAqB;4DACtB,0BAA0B;;;;;;;;;;;;;;;;;;sBAkBhE,WAAW;;;;;;;;oBAQb,eAAe;;;;6BAIN,UAAU;+BACR,UAAU;kCACP,UAAU;;;;;;;yBAOnB,eAAe;;;;;;;;;;;;;;kCAcN,UAAU;;;;qBAIvB,aAAa;yBACT,aAAa;;;;;6CAKO,WAAW;;;;;cAK1C,SAAS,CAAC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;4BAsBb,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;4BAOnC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;4BAOnC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;uBAOxC,WAAW,UAAU,gBAAgB;;;;;4BAKhC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;;4BAQnC,gBAAgB;;gDAEI,iBAAiB,KAAK,iBAAiB;;;;;;;;;;;;;qBAalE,4BAA4B;;;;;;4DAMW,4BAA4B;;;;kEAItB,qBAAqB;;;;;;;;;;;;;;;;CAgBtF,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n actionRgbPartialColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n buttonAccentBlockFontColor,\n buttonAccentOutlineFontColor,\n buttonBorderAccentOutlineColor,\n buttonFillAccentColor,\n buttonFillPrimaryColor,\n buttonLabelDisabledFontColor,\n buttonLabelFont,\n buttonLabelFontColor,\n buttonPrimaryFontColor,\n controlHeight,\n fillSelectedColor,\n iconColor,\n smallDelay,\n standardPadding\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n @layer base, hover, focusVisible, active, disabled, top;\n\n @layer base {\n ${display('inline-block')}\n\n :host {\n --ni-private-ok-fv-split-button-anchor-background-image: none;\n --ni-private-ok-fv-split-button-anchor-background-size: 100% 100%;\n --ni-private-ok-fv-split-button-anchor-background-size-emphasis: 100% 100%;\n --ni-private-ok-fv-split-button-anchor-border: rgba(${actionRgbPartialColor}, 0.3);\n --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelFontColor};\n position: relative;\n height: ${controlHeight};\n vertical-align: middle;\n }\n\n :host([appearance='ghost']) {\n --ni-private-ok-fv-split-button-anchor-border: transparent;\n }\n\n :host([appearance='block']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n rgba(${borderRgbPartialColor}, 0.1),\n rgba(${borderRgbPartialColor}, 0.1)\n );\n --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.1);\n --ni-private-ok-fv-split-button-anchor-background-size-emphasis: calc(100% - 4px) calc(100% - 4px);\n }\n\n :host([appearance='outline'][appearance-variant='primary']) {\n --ni-private-ok-fv-split-button-anchor-border: rgb(${actionRgbPartialColor});\n }\n\n :host([appearance='outline'][appearance-variant='accent']) {\n --ni-private-ok-fv-split-button-anchor-border: ${buttonBorderAccentOutlineColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentOutlineFontColor};\n }\n\n :host([appearance='block'][appearance-variant='primary']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n ${buttonFillPrimaryColor},\n ${buttonFillPrimaryColor}\n );\n --ni-private-ok-fv-split-button-anchor-border: ${buttonFillPrimaryColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonPrimaryFontColor};\n }\n\n :host([appearance='block'][appearance-variant='accent']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n ${buttonFillAccentColor},\n ${buttonFillAccentColor}\n );\n --ni-private-ok-fv-split-button-anchor-border: ${buttonFillAccentColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentBlockFontColor};\n }\n\n .split-button-container {\n position: relative;\n display: inline-flex;\n align-items: stretch;\n height: 100%;\n }\n\n .split-button-primary,\n .split-button-toggle {\n appearance: none;\n position: relative;\n z-index: 0;\n height: 100%;\n box-sizing: border-box;\n margin: 0;\n border: ${borderWidth} solid var(--ni-private-ok-fv-split-button-anchor-border);\n background-color: transparent;\n background-image: var(--ni-private-ok-fv-split-button-anchor-background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size);\n color: var(--ni-private-ok-fv-split-button-anchor-color);\n fill: currentcolor;\n font: ${buttonLabelFont};\n cursor: pointer;\n outline: none;\n transition:\n box-shadow ${smallDelay} ease-in-out,\n border-color ${smallDelay} ease-in-out,\n background-size ${smallDelay} ease-in-out;\n }\n\n .split-button-primary {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0 ${standardPadding};\n border-inline-end-color: transparent;\n white-space: nowrap;\n text-decoration: none;\n }\n\n .split-button-primary::before,\n .split-button-toggle::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n outline: 0px solid transparent;\n outline-offset: -3px;\n transition: outline ${smallDelay} ease-in-out;\n }\n\n .split-button-toggle {\n width: ${controlHeight};\n min-width: ${controlHeight};\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-inline-start-color: var(--ni-private-ok-fv-split-button-anchor-border);\n margin-inline-start: calc(-1 * ${borderWidth});\n }\n\n .split-button-toggle > * {\n color: currentColor;\n ${iconColor.cssCustomProperty}: currentColor;\n }\n\n .split-button-primary-disabled {\n cursor: default;\n }\n\n :host([appearance='ghost']) .split-button-primary,\n :host([appearance='ghost']) .split-button-toggle {\n border-color: transparent;\n box-shadow: none;\n }\n\n slot[name='menu']::slotted(*) {\n min-width: 100%;\n margin: 4px 0 0;\n }\n }\n\n @layer hover {\n .split-button-primary:hover,\n .split-button-toggle:hover {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);\n z-index: 1;\n }\n\n :host([appearance='ghost']) .split-button-primary:hover,\n :host([appearance='ghost']) .split-button-toggle:hover {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n }\n\n @layer focusVisible {\n .split-button-primary:focus-visible,\n .split-button-toggle:focus-visible {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);\n z-index: 1;\n }\n\n .split-button-primary:focus-visible::before,\n .split-button-toggle:focus-visible::before {\n outline: ${borderWidth} solid ${borderHoverColor};\n }\n\n :host([appearance='ghost']) .split-button-primary:focus-visible,\n :host([appearance='ghost']) .split-button-toggle:focus-visible {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n }\n\n @layer active {\n .split-button-primary:active,\n .split-button-toggle:active,\n :host([open]) .split-button-toggle {\n border-color: ${borderHoverColor};\n box-shadow: none;\n background-image: linear-gradient(${fillSelectedColor}, ${fillSelectedColor});\n background-size: calc(100% - 2px) calc(100% - 2px);\n }\n\n :host([appearance='block']) .split-button-primary:active,\n :host([appearance='block']) .split-button-toggle:active,\n :host([appearance='block'][open]) .split-button-toggle {\n background-size: calc(100% - 4px) calc(100% - 4px);\n }\n\n :host([appearance='outline'][appearance-variant='accent']) .split-button-primary:active,\n :host([appearance='outline'][appearance-variant='accent']) .split-button-toggle:active,\n :host([appearance='outline'][appearance-variant='accent'][open]) .split-button-toggle {\n color: ${buttonAccentOutlineFontColor};\n }\n }\n\n @layer disabled {\n :host([disabled]) {\n --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelDisabledFontColor};\n }\n\n :host([disabled][appearance='outline']) {\n --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.3);\n }\n\n :host([disabled]) .split-button-primary,\n :host([disabled]) .split-button-toggle {\n cursor: default;\n box-shadow: none;\n }\n\n :host([disabled][appearance='ghost']) .split-button-primary,\n :host([disabled][appearance='ghost']) .split-button-toggle {\n border-color: transparent;\n }\n }\n\n @layer top {}\n`;"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { styles } from '../split-button/styles';\n"]}
@@ -1,10 +1,14 @@
1
1
  import { html, ref, when } from '@ni/fast-element';
2
2
  import { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';
3
3
  import { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';
4
+ const primaryContent = html `
5
+ <slot name="start"></slot>
6
+ <span>${x => x.label}</span>
7
+ <slot name="end"></slot>
8
+ `;
4
9
  export const template = html `
5
10
  <div
6
11
  class="split-button-container"
7
- ${ref('splitButtonContainer')}
8
12
  >
9
13
  ${when(x => !x.disabled && x.href.length > 0, html `
10
14
  <a
@@ -18,7 +22,7 @@ export const template = html `
18
22
  return true;
19
23
  }}"
20
24
  >
21
- ${x => x.label}
25
+ ${primaryContent}
22
26
  </a>
23
27
  `)}
24
28
  ${when(x => x.disabled || x.href.length === 0, html `
@@ -26,11 +30,12 @@ export const template = html `
26
30
  class="split-button-primary split-button-primary-disabled"
27
31
  aria-disabled="${x => x.disabled}"
28
32
  >
29
- ${x => x.label}
33
+ ${primaryContent}
30
34
  </span>
31
35
  `)}
32
36
  <button
33
37
  class="split-button-toggle"
38
+ ${ref('toggleButton')}
34
39
  type="button"
35
40
  ?disabled="${x => x.disabled}"
36
41
  aria-label="${x => `More actions for ${x.label}`}"
@@ -50,9 +55,9 @@ export const template = html `
50
55
  auto-update-mode="auto"
51
56
  horizontal-inset
52
57
  horizontal-positioning-mode="dynamic"
58
+ horizontal-default-position="end"
53
59
  vertical-positioning-mode="locktodefault"
54
60
  vertical-default-position="bottom"
55
- horizontal-scaling="anchor"
56
61
  ${ref('region')}
57
62
  >
58
63
  <span part="menu">
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;;eAEE,wBAAwB,MAAM,wBAAwB;;;MAG/D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EACX,IAAI,CAAqB;eAClB,iBAAiB;;;;;;;;kBAQd,GAAG,CAAC,QAAQ,CAAC;;;;;gBAKf,iBAAiB;SACxB,CACJ;CACJ,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';\nimport { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';\nimport type { FvSplitButtonAnchor } from '.';\n\nexport const template = html<FvSplitButtonAnchor>`\n <div\n class=\"split-button-container\"\n ${ref('splitButtonContainer')}\n >\n ${when(\n x => !x.disabled && x.href.length > 0,\n html<FvSplitButtonAnchor>`\n <a\n class=\"split-button-primary\"\n href=\"${x => x.href}\"\n target=\"${x => x.target || undefined}\"\n rel=\"${x => x.rel || undefined}\"\n download=\"${x => x.download || undefined}\"\n @click=\"${x => {\n x.handlePrimaryClick();\n return true;\n }}\"\n >\n ${x => x.label}\n </a>\n `\n )}\n ${when(\n x => x.disabled || x.href.length === 0,\n html<FvSplitButtonAnchor>`\n <span\n class=\"split-button-primary split-button-primary-disabled\"\n aria-disabled=\"${x => x.disabled}\"\n >\n ${x => x.label}\n </span>\n `\n )}\n <button\n class=\"split-button-toggle\"\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n aria-label=\"${x => `More actions for ${x.label}`}\"\n aria-expanded=\"${x => x.open}\"\n aria-haspopup=\"menu\"\n @click=\"${x => {\n x.handleToggleClick();\n return true;\n }}\"\n >\n <${iconArrowExpanderDownTag}></${iconArrowExpanderDownTag}>\n </button>\n </div>\n ${when(\n x => x.open,\n html<FvSplitButtonAnchor>`\n <${anchoredRegionTag}\n fixed-placement\n auto-update-mode=\"auto\"\n horizontal-inset\n horizontal-positioning-mode=\"dynamic\"\n vertical-positioning-mode=\"locktodefault\"\n vertical-default-position=\"bottom\"\n horizontal-scaling=\"anchor\"\n ${ref('region')}\n >\n <span part=\"menu\">\n <slot name=\"menu\"></slot>\n </span>\n </${anchoredRegionTag}>\n `\n )}\n`;"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,cAAc,GAAG,IAAI,CAAqB;;YAEpC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;CAEvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAqB;;;;UAIvC,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EACrC,IAAI,CAAqB;;;4BAGT,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;8BACT,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,SAAS;2BAC7B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS;gCAClB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,SAAS;8BAC9B,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACvB,OAAO,IAAI,CAAC;AAChB,CAAC;;sBAEC,cAAc;;aAEvB,CACJ;UACC,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EACtC,IAAI,CAAqB;;;qCAGA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;sBAE9B,cAAc;;aAEvB,CACJ;;;cAGK,GAAG,CAAC,cAAc,CAAC;;yBAER,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;0BACd,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE;6BAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;sBAElB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;;eAEE,wBAAwB,MAAM,wBAAwB;;;MAG/D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EACX,IAAI,CAAqB;eAClB,iBAAiB;;;;;;;;kBAQd,GAAG,CAAC,QAAQ,CAAC;;;;;gBAKf,iBAAiB;SACxB,CACJ;CACJ,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';\nimport { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';\nimport type { FvSplitButtonAnchor } from '.';\n\nconst primaryContent = html<FvSplitButtonAnchor>`\n <slot name=\"start\"></slot>\n <span>${x => x.label}</span>\n <slot name=\"end\"></slot>\n`;\n\nexport const template = html<FvSplitButtonAnchor>`\n <div\n class=\"split-button-container\"\n >\n ${when(\n x => !x.disabled && x.href.length > 0,\n html<FvSplitButtonAnchor>`\n <a\n class=\"split-button-primary\"\n href=\"${x => x.href}\"\n target=\"${x => x.target || undefined}\"\n rel=\"${x => x.rel || undefined}\"\n download=\"${x => x.download || undefined}\"\n @click=\"${x => {\n x.handlePrimaryClick();\n return true;\n }}\"\n >\n ${primaryContent}\n </a>\n `\n )}\n ${when(\n x => x.disabled || x.href.length === 0,\n html<FvSplitButtonAnchor>`\n <span\n class=\"split-button-primary split-button-primary-disabled\"\n aria-disabled=\"${x => x.disabled}\"\n >\n ${primaryContent}\n </span>\n `\n )}\n <button\n class=\"split-button-toggle\"\n ${ref('toggleButton')}\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n aria-label=\"${x => `More actions for ${x.label}`}\"\n aria-expanded=\"${x => x.open}\"\n aria-haspopup=\"menu\"\n @click=\"${x => {\n x.handleToggleClick();\n return true;\n }}\"\n >\n <${iconArrowExpanderDownTag}></${iconArrowExpanderDownTag}>\n </button>\n </div>\n ${when(\n x => x.open,\n html<FvSplitButtonAnchor>`\n <${anchoredRegionTag}\n fixed-placement\n auto-update-mode=\"auto\"\n horizontal-inset\n horizontal-positioning-mode=\"dynamic\"\n horizontal-default-position=\"end\"\n vertical-positioning-mode=\"locktodefault\"\n vertical-default-position=\"bottom\"\n ${ref('region')}\n >\n <span part=\"menu\">\n <slot name=\"menu\"></slot>\n </span>\n </${anchoredRegionTag}>\n `\n )}\n`;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/ok-components",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "NI Ok Components",
5
5
  "scripts": {
6
6
  "build": "npm run build:components && npm run build:cem",