@aquera/nile-elements 2.0.21 → 2.0.22

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 (46) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +120 -47
  3. package/dist/nile-empty-state/nile-empty-state.cjs.js +1 -1
  4. package/dist/nile-empty-state/nile-empty-state.cjs.js.map +1 -1
  5. package/dist/nile-empty-state/nile-empty-state.esm.js +4 -4
  6. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  7. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  8. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  9. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  10. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  11. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  12. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +73 -1
  13. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +3 -2
  14. package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
  15. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
  16. package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
  17. package/dist/src/nile-empty-state/nile-empty-state.d.ts +5 -0
  18. package/dist/src/nile-empty-state/nile-empty-state.js +11 -2
  19. package/dist/src/nile-empty-state/nile-empty-state.js.map +1 -1
  20. package/dist/src/nile-empty-state/nile-empty-state.test.js +31 -0
  21. package/dist/src/nile-empty-state/nile-empty-state.test.js.map +1 -1
  22. package/dist/src/nile-wysiwyg-editor/index.d.ts +2 -1
  23. package/dist/src/nile-wysiwyg-editor/index.js +1 -1
  24. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
  25. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +75 -0
  26. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  27. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +20 -0
  28. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +37 -1
  29. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  30. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +108 -0
  31. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  32. package/dist/src/nile-wysiwyg-editor/types.d.ts +8 -0
  33. package/dist/src/nile-wysiwyg-editor/types.js +50 -0
  34. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
  35. package/dist/src/version.js +1 -1
  36. package/dist/src/version.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/src/nile-empty-state/nile-empty-state.test.ts +24 -0
  40. package/src/nile-empty-state/nile-empty-state.ts +12 -2
  41. package/src/nile-wysiwyg-editor/index.ts +2 -1
  42. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +76 -0
  43. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +132 -0
  44. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +40 -1
  45. package/src/nile-wysiwyg-editor/types.ts +52 -0
  46. package/vscode-html-custom-data.json +23 -2
@@ -1 +1 @@
1
- {"version":3,"file":"nile-empty-state.js","sourceRoot":"","sources":["../../../src/nile-empty-state/nile-empty-state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,WAAW,MA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O,EAAE,IAAI,EAAE,CAAC;8CAAwC;AACtD;IAA5C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;4CAAe;AACE;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAA2B;AAC1C;IAA5C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;kDAAoB;AAKnB;IAA5C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;mDAAsB;AACrB;IAA5C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDAAsB;AAOlE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;0CAG3C;AAUD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;0CAG3C;AAUD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;6CAGjD;AASD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAG1D;AAvEU,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAiM1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, nothing, CSSResultArray, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-empty-state.css';\nimport NileElement from '../internal/nile-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\n/** What happened. Selects an icon, tone, default copy and ARIA role. */\nexport type NileEmptyStateStatus =\n | 'empty'\n | 'no-results'\n | 'not-found'\n | 'no-access'\n | 'error'\n | 'offline';\n\n/** How loud the state looks. Defaults from `status`, always overridable. */\nexport type NileEmptyStateTone = 'neutral' | 'info' | 'warning' | 'error';\n\n/** What shape the state occupies. */\nexport type NileEmptyStateLayout = 'stack' | 'inline' | 'page';\n\ninterface StatusPreset {\n icon: string;\n tone: NileEmptyStateTone;\n text: string;\n subText: string;\n role: 'status' | 'alert';\n live: 'polite' | 'assertive';\n}\n\nconst STATUS_PRESETS: Record<NileEmptyStateStatus, StatusPreset> = {\n 'empty': {\n icon: 'ng-database', tone: 'neutral', role: 'status', live: 'polite',\n text: 'No data yet', subText: `Rows appear here once there's something to show.`,\n },\n 'no-results': {\n icon: 'ng-search-lg', tone: 'neutral', role: 'status', live: 'polite',\n text: 'No matches', subText: 'Try removing a filter or broadening your search.',\n },\n 'not-found': {\n icon: 'ng-file-06', tone: 'warning', role: 'status', live: 'polite',\n text: `We couldn't find that`, subText: 'It may have been moved or deleted.',\n },\n 'no-access': {\n icon: 'ng-lock', tone: 'warning', role: 'status', live: 'polite',\n text: `You don't have access`, subText: 'Ask an admin to grant you access to this resource.',\n },\n 'error': {\n icon: 'ng-alert-circle', tone: 'error', role: 'alert', live: 'assertive',\n text: 'Something went wrong', subText: `We couldn't load this. Try again.`,\n },\n 'offline': {\n icon: 'ng-cloud-off', tone: 'error', role: 'alert', live: 'assertive',\n text: 'Connection lost', subText: 'Check your connection and try again.',\n },\n};\n\nconst TONE_GLYPH_COLOR: Record<NileEmptyStateTone, string | undefined> = {\n neutral: undefined,\n info: 'var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600))',\n warning: 'var(--nile-colors-yellow-700, var(--ng-colors-fg-warning-primary))',\n error: 'var(--nile-colors-red-700, var(--ng-colors-fg-error-primary))',\n};\n\nconst DEFAULT_ICON = 'ng-x-circle';\nconst DEFAULT_TEXT = 'Empty State';\nconst DEFAULT_SUB_TEXT = 'No Data';\n\n/**\n * Nile empty-state component.\n *\n * @tag nile-empty-state\n *\n */\n@customElement('nile-empty-state')\nexport class NileEmptyState extends NileElement {\n\n /**\n * The styles for nile-empty-state\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, attribute: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ type: String, attribute: true }) variant:\n | 'flat'\n | 'content'\n | 'tonal' = 'tonal';\n\n @property({ type: String, attribute: true, reflect: true }) status?: NileEmptyStateStatus;\n @property({ type: String, attribute: true, reflect: true }) layout: NileEmptyStateLayout = 'stack';\n @property({ type: String, attribute: true }) code?: string;\n @property({ type: Boolean, attribute: true, reflect: true }) bordered: boolean = false;\n @property({ type: String, attribute: true }) svgIconUrl: string;\n /**\n * Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\n * the SVG matches whatever size the current variant/layout draws at.\n */\n @property({ type: Number, attribute: true }) svgIconSize?: number;\n @property({ type: String, attribute: true }) svgIconColor: string;\n\n private _icon?: string;\n private _text?: string;\n private _subText?: string;\n private _tone?: NileEmptyStateTone;\n @property({ type: String, attribute: true })\n get icon(): string {\n return this._icon ?? this.preset?.icon ?? DEFAULT_ICON;\n }\n\n set icon(value: string | null) {\n const old = this.icon;\n this._icon = value ?? undefined;\n this.requestUpdate('icon', old);\n }\n\n /** Headline. Resolves through the `status` preset to `DEFAULT_TEXT`. */\n @property({ type: String, attribute: true })\n get text(): string {\n return this._text ?? this.preset?.text ?? DEFAULT_TEXT;\n }\n\n set text(value: string | null) {\n const old = this.text;\n this._text = value ?? undefined;\n this.requestUpdate('text', old);\n }\n\n /** Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`. */\n @property({ type: String, attribute: 'sub-text' })\n get subText(): string {\n return this._subText ?? this.preset?.subText ?? DEFAULT_SUB_TEXT;\n }\n\n set subText(value: string | null) {\n const old = this.subText;\n this._subText = value ?? undefined;\n this.requestUpdate('subText', old);\n }\n\n @property({ type: String, attribute: true, reflect: true })\n get tone(): NileEmptyStateTone {\n return this._tone ?? this.preset?.tone ?? 'neutral';\n }\n\n set tone(value: NileEmptyStateTone | null) {\n const old = this.tone;\n this._tone = value ?? undefined;\n this.requestUpdate('tone', old);\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /** The preset backing the current `status`, or undefined when none is set. */\n private get preset(): StatusPreset | undefined {\n return this.status ? STATUS_PRESETS[this.status] : undefined;\n }\n\n private get glyphColor(): string | undefined {\n return this.svgIconColor ?? TONE_GLYPH_COLOR[this.tone];\n }\n\n /** ARIA wiring */\n private get liveRegion(): { role: string; live: string } | undefined {\n const preset = this.preset;\n if (!preset) return undefined;\n return { role: preset.role, live: preset.live };\n }\n\n private renderGlyph(size: number | string): TemplateResult {\n const color = this.glyphColor;\n return this.svgIconUrl ? html`\n <nile-glyph\n customSvgPath=\"${this.svgIconUrl}\"\n size=\"${this.svgIconSize ?? size}\"\n method=\"stroke\"\n color=\"${ifDefined(color)}\"\n noFill\n ></nile-glyph>\n ` : html`\n <nile-glyph\n name=\"${this.icon}\"\n method=\"stroke\"\n size=\"${size}\"\n color=\"${ifDefined(color)}\"\n ></nile-glyph>\n `;\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n const live = this.liveRegion;\n const inline = this.layout === 'inline';\n\n return html`\n <div part=\"container\" class=\"${classMap({\n 'empty-state': true,\n 'empty-state--sm': this.size == 'sm',\n 'empty-state--md': this.size == 'md',\n 'empty-state--lg': this.size == 'lg',\n 'empty-state--stack': this.layout === 'stack',\n 'empty-state--inline': inline,\n 'empty-state--page': this.layout === 'page',\n 'empty-state--bordered': this.bordered,\n [`empty-state--tone-${this.tone}`]: true,\n })}\"\n role=\"${ifDefined(live?.role)}\"\n aria-live=\"${ifDefined(live?.live)}\"\n >\n <div part=\"body\" class=\"${classMap({ 'empty-state__body': true })}\">\n\n ${inline ? html`\n <span part=\"inline-icon icon-chrome\" class=\"empty-state__body--inline\">\n ${this.renderGlyph(20)}\n </span>` : nothing\n }\n\n ${!inline && this.variant == 'content' ? html`\n <div part=\"content-image\" class=\"empty-state__body--content\">\n ${!this.icon && !this.svgIconUrl ? nothing : html`\n <div part=\"icon-wrapper icon-chrome\" class=\"empty-state__img__icon\">\n ${\n this.renderGlyph(this.size == 'lg' ? 28 : 24)}\n </div>`\n }\n </div>`: nothing\n }\n\n ${!inline && this.variant == 'tonal' ? html`\n <div part=\"tonal-body icon-chrome\" class=\"empty-state__body--tonal\">\n ${this.renderGlyph(40)}\n </div>`: nothing\n }\n\n ${!inline && this.variant == 'flat' ? html`\n <div part=\"flat-body\" class=\"empty-state__body--flat\">\n\t\t\t\t\t<span part=\"icon-chrome\" class=\"nile-flat-type-icon\">\n\t\t\t\t\t\t${this.renderGlyph(this.size == 'lg' ? 28 : 24)}\n\t\t\t\t\t</span>\n </div>`: nothing\n }\n\n <div part=\"text-section\" class=\"empty__state__text-section\">\n ${this.code ? html`\n <div part=\"code\" class=\"empty-state__code\">${this.code}</div>\n ` : nothing}\n <div part=\"text\" class=\"empty-state__text\">${this.text}</div>\n <div part=\"subtitle\" class=\"empty-state__subtext\">${this.subText}</div>\n </div>\n </div>\n\n <div part=\"actions\" class=\"empty-state-actions\">\n <slot></slot>\n </div>\n\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileEmptyState;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-empty-state': NileEmptyState;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-empty-state.js","sourceRoot":"","sources":["../../../src/nile-empty-state/nile-empty-state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,aAAa,E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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;6CAGjD;AASD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAG1D;AAxEU,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAwM1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, nothing, CSSResultArray, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-empty-state.css';\nimport NileElement from '../internal/nile-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\n/** What happened. Selects an icon, tone, default copy and ARIA role. */\nexport type NileEmptyStateStatus =\n | 'empty'\n | 'no-results'\n | 'not-found'\n | 'no-access'\n | 'error'\n | 'offline';\n\n/** How loud the state looks. Defaults from `status`, always overridable. */\nexport type NileEmptyStateTone = 'neutral' | 'info' | 'warning' | 'error';\n\n/** What shape the state occupies. */\nexport type NileEmptyStateLayout = 'stack' | 'inline' | 'page';\n\n/** How the glyph is drawn: outlined (`stroke`, the default) or filled (`fill`). */\nexport type NileEmptyStateIconMethod = 'stroke' | 'fill';\n\ninterface StatusPreset {\n icon: string;\n tone: NileEmptyStateTone;\n text: string;\n subText: string;\n role: 'status' | 'alert';\n live: 'polite' | 'assertive';\n}\n\nconst STATUS_PRESETS: Record<NileEmptyStateStatus, StatusPreset> = {\n 'empty': {\n icon: 'ng-database', tone: 'neutral', role: 'status', live: 'polite',\n text: 'No data yet', subText: `Rows appear here once there's something to show.`,\n },\n 'no-results': {\n icon: 'ng-search-lg', tone: 'neutral', role: 'status', live: 'polite',\n text: 'No matches', subText: 'Try removing a filter or broadening your search.',\n },\n 'not-found': {\n icon: 'ng-file-06', tone: 'warning', role: 'status', live: 'polite',\n text: `We couldn't find that`, subText: 'It may have been moved or deleted.',\n },\n 'no-access': {\n icon: 'ng-lock', tone: 'warning', role: 'status', live: 'polite',\n text: `You don't have access`, subText: 'Ask an admin to grant you access to this resource.',\n },\n 'error': {\n icon: 'ng-alert-circle', tone: 'error', role: 'alert', live: 'assertive',\n text: 'Something went wrong', subText: `We couldn't load this. Try again.`,\n },\n 'offline': {\n icon: 'ng-cloud-off', tone: 'error', role: 'alert', live: 'assertive',\n text: 'Connection lost', subText: 'Check your connection and try again.',\n },\n};\n\nconst TONE_GLYPH_COLOR: Record<NileEmptyStateTone, string | undefined> = {\n neutral: undefined,\n info: 'var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600))',\n warning: 'var(--nile-colors-yellow-700, var(--ng-colors-fg-warning-primary))',\n error: 'var(--nile-colors-red-700, var(--ng-colors-fg-error-primary))',\n};\n\nconst DEFAULT_ICON = 'ng-x-circle';\nconst DEFAULT_TEXT = 'Empty State';\nconst DEFAULT_SUB_TEXT = 'No Data';\n\n/**\n * Nile empty-state component.\n *\n * @tag nile-empty-state\n *\n */\n@customElement('nile-empty-state')\nexport class NileEmptyState extends NileElement {\n\n /**\n * The styles for nile-empty-state\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, attribute: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ type: String, attribute: true }) variant:\n | 'flat'\n | 'content'\n | 'tonal' = 'tonal';\n\n @property({ type: String, attribute: true, reflect: true }) status?: NileEmptyStateStatus;\n @property({ type: String, attribute: true, reflect: true }) layout: NileEmptyStateLayout = 'stack';\n @property({ type: String, attribute: true }) code?: string;\n @property({ type: Boolean, attribute: true, reflect: true }) bordered: boolean = false;\n @property({ type: String, attribute: true }) svgIconUrl: string;\n /**\n * Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\n * the SVG matches whatever size the current variant/layout draws at.\n */\n @property({ type: Number, attribute: true }) svgIconSize?: number;\n @property({ type: String, attribute: true }) svgIconColor: string;\n @property({ type: String, attribute: true }) iconMethod: NileEmptyStateIconMethod = 'stroke';\n\n private _icon?: string;\n private _text?: string;\n private _subText?: string;\n private _tone?: NileEmptyStateTone;\n @property({ type: String, attribute: true })\n get icon(): string {\n return this._icon ?? this.preset?.icon ?? DEFAULT_ICON;\n }\n\n set icon(value: string | null) {\n const old = this.icon;\n this._icon = value ?? undefined;\n this.requestUpdate('icon', old);\n }\n\n /** Headline. Resolves through the `status` preset to `DEFAULT_TEXT`. */\n @property({ type: String, attribute: true })\n get text(): string {\n return this._text ?? this.preset?.text ?? DEFAULT_TEXT;\n }\n\n set text(value: string | null) {\n const old = this.text;\n this._text = value ?? undefined;\n this.requestUpdate('text', old);\n }\n\n /** Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`. */\n @property({ type: String, attribute: 'sub-text' })\n get subText(): string {\n return this._subText ?? this.preset?.subText ?? DEFAULT_SUB_TEXT;\n }\n\n set subText(value: string | null) {\n const old = this.subText;\n this._subText = value ?? undefined;\n this.requestUpdate('subText', old);\n }\n\n @property({ type: String, attribute: true, reflect: true })\n get tone(): NileEmptyStateTone {\n return this._tone ?? this.preset?.tone ?? 'neutral';\n }\n\n set tone(value: NileEmptyStateTone | null) {\n const old = this.tone;\n this._tone = value ?? undefined;\n this.requestUpdate('tone', old);\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /** The preset backing the current `status`, or undefined when none is set. */\n private get preset(): StatusPreset | undefined {\n return this.status ? STATUS_PRESETS[this.status] : undefined;\n }\n\n /** `fill` only when asked for explicitly; anything else keeps today's `stroke`. */\n private get glyphMethod(): NileEmptyStateIconMethod {\n return this.iconMethod === 'fill' ? 'fill' : 'stroke';\n }\n\n private get glyphColor(): string | undefined {\n return this.svgIconColor ?? TONE_GLYPH_COLOR[this.tone];\n }\n\n /** ARIA wiring */\n private get liveRegion(): { role: string; live: string } | undefined {\n const preset = this.preset;\n if (!preset) return undefined;\n return { role: preset.role, live: preset.live };\n }\n\n private renderGlyph(size: number | string): TemplateResult {\n const color = this.glyphColor;\n const method = this.glyphMethod;\n return this.svgIconUrl ? html`\n <nile-glyph\n customSvgPath=\"${this.svgIconUrl}\"\n size=\"${this.svgIconSize ?? size}\"\n method=\"${method}\"\n color=\"${ifDefined(color)}\"\n noFill\n ></nile-glyph>\n ` : html`\n <nile-glyph\n name=\"${this.icon}\"\n method=\"${method}\"\n size=\"${size}\"\n color=\"${ifDefined(color)}\"\n ></nile-glyph>\n `;\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n const live = this.liveRegion;\n const inline = this.layout === 'inline';\n\n return html`\n <div part=\"container\" class=\"${classMap({\n 'empty-state': true,\n 'empty-state--sm': this.size == 'sm',\n 'empty-state--md': this.size == 'md',\n 'empty-state--lg': this.size == 'lg',\n 'empty-state--stack': this.layout === 'stack',\n 'empty-state--inline': inline,\n 'empty-state--page': this.layout === 'page',\n 'empty-state--bordered': this.bordered,\n [`empty-state--tone-${this.tone}`]: true,\n })}\"\n role=\"${ifDefined(live?.role)}\"\n aria-live=\"${ifDefined(live?.live)}\"\n >\n <div part=\"body\" class=\"${classMap({ 'empty-state__body': true })}\">\n\n ${inline ? html`\n <span part=\"inline-icon icon-chrome\" class=\"empty-state__body--inline\">\n ${this.renderGlyph(20)}\n </span>` : nothing\n }\n\n ${!inline && this.variant == 'content' ? html`\n <div part=\"content-image\" class=\"empty-state__body--content\">\n ${!this.icon && !this.svgIconUrl ? nothing : html`\n <div part=\"icon-wrapper icon-chrome\" class=\"empty-state__img__icon\">\n ${\n this.renderGlyph(this.size == 'lg' ? 28 : 24)}\n </div>`\n }\n </div>`: nothing\n }\n\n ${!inline && this.variant == 'tonal' ? html`\n <div part=\"tonal-body icon-chrome\" class=\"empty-state__body--tonal\">\n ${this.renderGlyph(40)}\n </div>`: nothing\n }\n\n ${!inline && this.variant == 'flat' ? html`\n <div part=\"flat-body\" class=\"empty-state__body--flat\">\n\t\t\t\t\t<span part=\"icon-chrome\" class=\"nile-flat-type-icon\">\n\t\t\t\t\t\t${this.renderGlyph(this.size == 'lg' ? 28 : 24)}\n\t\t\t\t\t</span>\n </div>`: nothing\n }\n\n <div part=\"text-section\" class=\"empty__state__text-section\">\n ${this.code ? html`\n <div part=\"code\" class=\"empty-state__code\">${this.code}</div>\n ` : nothing}\n <div part=\"text\" class=\"empty-state__text\">${this.text}</div>\n <div part=\"subtitle\" class=\"empty-state__subtext\">${this.subText}</div>\n </div>\n </div>\n\n <div part=\"actions\" class=\"empty-state-actions\">\n <slot></slot>\n </div>\n\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileEmptyState;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-empty-state': NileEmptyState;\n }\n}\n"]}
@@ -278,5 +278,36 @@ describe('NileEmptyState', () => {
278
278
  it('190. svgIconSize overrides the layout size', async () => { const el = await fixture(html `<nile-empty-state layout="inline" svgIconUrl="/p.svg" .svgIconSize=${60}></nile-empty-state>`); expect(glyph(el).getAttribute('size')).to.equal('60'); });
279
279
  it('191. svgIconSize does not affect a catalogue glyph', async () => { const el = await fixture(html `<nile-empty-state layout="inline" .svgIconSize=${60}></nile-empty-state>`); expect(glyph(el).getAttribute('size')).to.equal('20'); });
280
280
  it('165. full new-API integration', async () => { const el = await fixture(html `<nile-empty-state status="not-found" layout="page" size="lg" code="Error 404" bordered><button>Go back</button></nile-empty-state>`); expect(el.text).to.contain(`couldn't find that`); expect(el.tone).to.equal('warning'); expect(container(el).getAttribute('role')).to.equal('status'); expect(container(el).classList.contains('empty-state--page')).to.be.true; expect(container(el).classList.contains('empty-state--bordered')).to.be.true; expect(el.shadowRoot.querySelector('[part="code"]').textContent).to.contain('Error 404'); expect(el.querySelector('button')).to.exist; });
281
+ // iconMethod: stroke stays the default everywhere; fill is opt-in.
282
+ it('192. iconMethod defaults to stroke', async () => { const el = await fixture(html `<nile-empty-state></nile-empty-state>`); expect(el.iconMethod).to.equal('stroke'); });
283
+ it('193. default glyph method is stroke in every variant and layout', async () => {
284
+ for (const t of [
285
+ html `<nile-empty-state variant="tonal"></nile-empty-state>`,
286
+ html `<nile-empty-state variant="content"></nile-empty-state>`,
287
+ html `<nile-empty-state variant="flat"></nile-empty-state>`,
288
+ html `<nile-empty-state layout="inline"></nile-empty-state>`,
289
+ html `<nile-empty-state svgIconUrl="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E"></nile-empty-state>`,
290
+ ]) {
291
+ const el = await fixture(t);
292
+ expect(glyph(el).getAttribute('method')).to.equal('stroke');
293
+ }
294
+ });
295
+ it('194. iconMethod is not reflected, so existing hosts gain no attribute', async () => { const el = await fixture(html `<nile-empty-state></nile-empty-state>`); expect(el.hasAttribute('iconmethod')).to.be.false; });
296
+ it('195. iconMethod="fill" passes method="fill" in every variant and layout', async () => {
297
+ for (const t of [
298
+ html `<nile-empty-state iconMethod="fill" variant="tonal"></nile-empty-state>`,
299
+ html `<nile-empty-state iconMethod="fill" variant="content"></nile-empty-state>`,
300
+ html `<nile-empty-state iconMethod="fill" variant="flat"></nile-empty-state>`,
301
+ html `<nile-empty-state iconMethod="fill" layout="inline"></nile-empty-state>`,
302
+ ]) {
303
+ const el = await fixture(t);
304
+ expect(glyph(el).getAttribute('method')).to.equal('fill');
305
+ }
306
+ });
307
+ it('196. iconMethod="fill" with svgIconUrl keeps noFill so the SVG keeps its own colours', async () => { const el = await fixture(html `<nile-empty-state iconMethod="fill" svgIconUrl="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E"></nile-empty-state>`); expect(glyph(el).getAttribute('method')).to.equal('fill'); expect(glyph(el).hasAttribute('nofill')).to.be.true; });
308
+ it('197. unknown iconMethod falls back to stroke', async () => { const el = await fixture(html `<nile-empty-state iconMethod="bogus"></nile-empty-state>`); expect(glyph(el).getAttribute('method')).to.equal('stroke'); });
309
+ it('198. iconMethod can be toggled at runtime', async () => { const el = await fixture(html `<nile-empty-state></nile-empty-state>`); el.iconMethod = 'fill'; await el.updateComplete; expect(glyph(el).getAttribute('method')).to.equal('fill'); el.iconMethod = 'stroke'; await el.updateComplete; expect(glyph(el).getAttribute('method')).to.equal('stroke'); });
310
+ it('199. iconMethod does not change icon, size or colour', async () => { const a = await fixture(html `<nile-empty-state status="error"></nile-empty-state>`); const b = await fixture(html `<nile-empty-state status="error" iconMethod="fill"></nile-empty-state>`); for (const attr of ['name', 'size', 'color'])
311
+ expect(glyph(b).getAttribute(attr), attr).to.equal(glyph(a).getAttribute(attr)); });
281
312
  });
282
313
  //# sourceMappingURL=nile-empty-state.test.js.map