@hashicorp/design-system-components 4.1.1 → 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/dist/_app_/components/hds/alert/types.js +1 -0
- package/dist/_app_/components/hds/card/types.js +1 -0
- package/dist/_app_/components/hds/interactive/types.js +1 -0
- package/dist/_app_/components/hds/link/types.js +1 -0
- package/dist/_app_/components/hds/text/types.js +1 -0
- package/dist/_app_/components/hds/yield/types.js +1 -0
- package/dist/components/hds/alert/description.js +5 -4
- package/dist/components/hds/alert/description.js.map +1 -1
- package/dist/components/hds/alert/index.js +21 -18
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/alert/title.js +5 -4
- package/dist/components/hds/alert/title.js.map +1 -1
- package/dist/components/hds/alert/types.js +17 -0
- package/dist/components/hds/alert/types.js.map +1 -0
- package/dist/components/hds/button/index.js +6 -6
- package/dist/components/hds/button/index.js.map +1 -1
- package/dist/components/hds/card/container.js +25 -24
- package/dist/components/hds/card/container.js.map +1 -1
- package/dist/components/hds/card/types.js +19 -0
- package/dist/components/hds/card/types.js.map +1 -0
- package/dist/components/hds/copy/snippet/index.js +1 -1
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/dismiss-button/index.js.map +1 -1
- package/dist/components/hds/flyout/index.js +2 -8
- package/dist/components/hds/flyout/index.js.map +1 -1
- package/dist/components/hds/interactive/index.js.map +1 -1
- package/dist/components/hds/interactive/types.js +2 -0
- package/dist/components/hds/interactive/types.js.map +1 -0
- package/dist/components/hds/link/inline.js +11 -10
- package/dist/components/hds/link/inline.js.map +1 -1
- package/dist/components/hds/link/standalone.js +16 -15
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/link/types.js +19 -0
- package/dist/components/hds/link/types.js.map +1 -0
- package/dist/components/hds/modal/index.js +2 -8
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/text/body.js +8 -7
- package/dist/components/hds/text/body.js.map +1 -1
- package/dist/components/hds/text/code.js +8 -7
- package/dist/components/hds/text/code.js.map +1 -1
- package/dist/components/hds/text/display.js +19 -12
- package/dist/components/hds/text/display.js.map +1 -1
- package/dist/components/hds/text/index.js +14 -10
- package/dist/components/hds/text/index.js.map +1 -1
- package/dist/components/hds/text/types.js +58 -0
- package/dist/components/hds/text/types.js.map +1 -0
- package/dist/components/hds/yield/index.js +10 -4
- package/dist/components/hds/yield/index.js.map +1 -1
- package/dist/components/hds/yield/types.js +2 -0
- package/dist/components/hds/yield/types.js.map +1 -0
- package/dist/helpers/hds-link-to-models.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +6600 -0
- package/package.json +11 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/alert/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/card/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/interactive/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/link/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/text/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/yield/types";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-alert__description hds-font-weight-regular hds-foreground-primary\" ...attributes>{{yield}}</div>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
class HdsAlertDescriptionComponent extends Component {}
|
|
8
|
+
setComponentTemplate(TEMPLATE, HdsAlertDescriptionComponent);
|
|
8
9
|
|
|
9
|
-
export {
|
|
10
|
+
export { HdsAlertDescriptionComponent as default };
|
|
10
11
|
//# sourceMappingURL=description.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description.js","sources":["../../../../src/components/hds/alert/description.hbs","../../../../src/components/hds/alert/description.
|
|
1
|
+
{"version":3,"file":"description.js","sources":["../../../../src/components/hds/alert/description.hbs","../../../../src/components/hds/alert/description.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-alert__description hds-font-weight-regular hds-foreground-primary\\\" ...attributes>{{yield}}</div>\")","import Component from '@glimmer/component';\nimport type { HdsAlertDescriptionSignature } from './types.ts';\n\nexport default class HdsAlertDescriptionComponent extends Component<HdsAlertDescriptionSignature> {}\n"],"names":["HdsAlertDescriptionComponent","Component","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,kMAAkM;;ACErN,MAAMA,4BAA4B,SAASC,SAAS,CAA+B,EAAA;AAAEC,oBAAA,CAAAC,QAAA,EAA/EH,4BAA4B,CAAA;;;;"}
|
|
@@ -4,28 +4,31 @@ import { action } from '@ember/object';
|
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
5
5
|
import { guidFor } from '@ember/object/internals';
|
|
6
6
|
import { tracked } from '@glimmer/tracking';
|
|
7
|
+
import { HdsAlertTypeValues, HdsAlertColorValues } from './types.js';
|
|
7
8
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
9
|
import { setComponentTemplate } from '@ember/component';
|
|
9
10
|
|
|
10
|
-
var TEMPLATE = precompileTemplate("{{
|
|
11
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div\n class={{this.classNames}}\n role={{this.role}}\n aria-live=\"polite\"\n aria-labelledby={{this.ariaLabelledBy}}\n {{did-insert this.didInsert}}\n ...attributes\n>\n {{#if this.icon}}\n <div class=\"hds-alert__icon\">\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} @isInlineBlock={{false}} />\n </div>\n {{/if}}\n\n <div class=\"hds-alert__content\">\n <div class=\"hds-alert__text {{if (eq @type \'compact\') \'hds-typography-body-100\' \'hds-typography-body-200\'}}\">\n {{yield (hash Title=(component \"hds/alert/title\"))}}\n {{yield (hash Description=(component \"hds/alert/description\"))}}\n </div>\n\n <div class=\"hds-alert__actions\">\n {{yield\n (hash\n Button=(component \"hds/button\" size=\"small\") LinkStandalone=(component \"hds/link/standalone\" size=\"small\")\n )\n }}\n </div>\n {{yield (hash Generic=(component \"hds/yield\"))}}\n </div>\n\n {{#if this.onDismiss}}\n <Hds::DismissButton class=\"hds-alert__dismiss\" {{on \"click\" this.onDismiss}} />\n {{/if}}\n</div>");
|
|
11
12
|
|
|
12
13
|
var _class, _descriptor, _descriptor2;
|
|
13
|
-
const TYPES =
|
|
14
|
-
const DEFAULT_COLOR =
|
|
15
|
-
const COLORS =
|
|
14
|
+
const TYPES = Object.values(HdsAlertTypeValues);
|
|
15
|
+
const DEFAULT_COLOR = HdsAlertColorValues.Neutral;
|
|
16
|
+
const COLORS = Object.values(HdsAlertColorValues);
|
|
16
17
|
const MAPPING_COLORS_TO_ICONS = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
[HdsAlertColorValues.Neutral]: 'info',
|
|
19
|
+
[HdsAlertColorValues.Highlight]: 'info',
|
|
20
|
+
[HdsAlertColorValues.Success]: 'check-circle',
|
|
21
|
+
[HdsAlertColorValues.Warning]: 'alert-triangle',
|
|
22
|
+
[HdsAlertColorValues.Critical]: 'alert-diamond'
|
|
22
23
|
};
|
|
23
24
|
const CONTENT_ELEMENT_SELECTOR = '.hds-alert__content';
|
|
24
25
|
const TITLE_ELEMENT_SELECTOR = '.hds-alert__title';
|
|
25
26
|
const DESCRIPTION_ELEMENT_SELECTOR = '.hds-alert__description';
|
|
27
|
+
|
|
28
|
+
// TODO: Do we need to update this icon type to be a type exported from the icon foundations in the future?
|
|
26
29
|
let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Component {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(
|
|
30
|
+
constructor(owner, args) {
|
|
31
|
+
super(owner, args);
|
|
29
32
|
_initializerDefineProperty(this, "role", _descriptor, this);
|
|
30
33
|
_initializerDefineProperty(this, "ariaLabelledBy", _descriptor2, this);
|
|
31
34
|
assert(`@type for "Hds::Alert" must be one of the following: ${TYPES.join(', ')}; received: ${this.args.type}`, TYPES.includes(this.args.type));
|
|
@@ -38,7 +41,7 @@ let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Comp
|
|
|
38
41
|
* @description Determines the color scheme for the alert.
|
|
39
42
|
*/
|
|
40
43
|
get color() {
|
|
41
|
-
|
|
44
|
+
const {
|
|
42
45
|
color = DEFAULT_COLOR
|
|
43
46
|
} = this.args;
|
|
44
47
|
assert(`@color for "Hds::Alert" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
@@ -52,7 +55,7 @@ let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Comp
|
|
|
52
55
|
* @description The name of the icon to be used.
|
|
53
56
|
*/
|
|
54
57
|
get icon() {
|
|
55
|
-
|
|
58
|
+
const {
|
|
56
59
|
icon
|
|
57
60
|
} = this.args;
|
|
58
61
|
|
|
@@ -81,7 +84,7 @@ let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Comp
|
|
|
81
84
|
* @default () => {}
|
|
82
85
|
*/
|
|
83
86
|
get onDismiss() {
|
|
84
|
-
|
|
87
|
+
const {
|
|
85
88
|
onDismiss
|
|
86
89
|
} = this.args;
|
|
87
90
|
if (typeof onDismiss === 'function') {
|
|
@@ -110,7 +113,7 @@ let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Comp
|
|
|
110
113
|
* @return {string} The "class" attribute to apply to the component.
|
|
111
114
|
*/
|
|
112
115
|
get classNames() {
|
|
113
|
-
|
|
116
|
+
const classes = ['hds-alert'];
|
|
114
117
|
|
|
115
118
|
// Add a class based on the @type argument
|
|
116
119
|
classes.push(`hds-alert--type-${this.args.type}`);
|
|
@@ -120,16 +123,16 @@ let HdsAlertIndexComponent = (_class = class HdsAlertIndexComponent extends Comp
|
|
|
120
123
|
return classes.join(' ');
|
|
121
124
|
}
|
|
122
125
|
didInsert(element) {
|
|
123
|
-
|
|
126
|
+
const actions = element.querySelectorAll(`${CONTENT_ELEMENT_SELECTOR} button, ${CONTENT_ELEMENT_SELECTOR} a`);
|
|
124
127
|
if (actions.length) {
|
|
125
128
|
this.role = 'alertdialog';
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
// `alertdialog` must have an accessible name so we use either the
|
|
129
132
|
// title or the description as label for the alert
|
|
130
|
-
|
|
133
|
+
const label = element.querySelector(TITLE_ELEMENT_SELECTOR) || element.querySelector(DESCRIPTION_ELEMENT_SELECTOR);
|
|
131
134
|
if (label) {
|
|
132
|
-
|
|
135
|
+
const labelId = label.getAttribute('id') || guidFor(element);
|
|
133
136
|
label.setAttribute('id', labelId);
|
|
134
137
|
this.ariaLabelledBy = labelId;
|
|
135
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/alert/index.hbs","../../../../src/components/hds/alert/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div\\n class={{this.classNames}}\\n role={{this.role}}\\n aria-live=\\\"polite\\\"\\n aria-labelledby={{this.ariaLabelledBy}}\\n {{did-insert this.didInsert}}\\n ...attributes\\n>\\n {{#if this.icon}}\\n <div class=\\\"hds-alert__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} @isInlineBlock={{false}} />\\n </div>\\n {{/if}}\\n\\n <div class=\\\"hds-alert__content\\\">\\n <div class=\\\"hds-alert__text {{if (eq @type \\'compact\\') \\'hds-typography-body-100\\' \\'hds-typography-body-200\\'}}\\\">\\n {{yield (hash Title=(component \\\"hds/alert/title\\\"))}}\\n {{yield (hash Description=(component \\\"hds/alert/description\\\"))}}\\n </div>\\n\\n <div class=\\\"hds-alert__actions\\\">\\n {{yield\\n (hash\\n Button=(component \\\"hds/button\\\" size=\\\"small\\\") LinkStandalone=(component \\\"hds/link/standalone\\\" size=\\\"small\\\")\\n )\\n }}\\n </div>\\n {{yield (hash Generic=(component \\\"hds/yield\\\"))}}\\n </div>\\n\\n {{#if this.onDismiss}}\\n <Hds::DismissButton class=\\\"hds-alert__dismiss\\\" {{on \\\"click\\\" this.onDismiss}} />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport { tracked } from '@glimmer/tracking';\n\nexport const TYPES = ['page', 'inline', 'compact'];\nexport const DEFAULT_COLOR = 'neutral';\nexport const COLORS = [\n 'neutral',\n 'highlight',\n 'success',\n 'warning',\n 'critical',\n];\nexport const MAPPING_COLORS_TO_ICONS = {\n neutral: 'info',\n highlight: 'info',\n success: 'check-circle',\n warning: 'alert-triangle',\n critical: 'alert-diamond',\n};\n\nconst CONTENT_ELEMENT_SELECTOR = '.hds-alert__content';\nconst TITLE_ELEMENT_SELECTOR = '.hds-alert__title';\nconst DESCRIPTION_ELEMENT_SELECTOR = '.hds-alert__description';\n\nexport default class HdsAlertIndexComponent extends Component {\n @tracked role = 'alert';\n @tracked ariaLabelledBy;\n\n constructor() {\n super(...arguments);\n\n assert(\n `@type for \"Hds::Alert\" must be one of the following: ${TYPES.join(\n ', '\n )}; received: ${this.args.type}`,\n TYPES.includes(this.args.type)\n );\n }\n\n /**\n * @param color\n * @type {enum}\n * @default neutral\n * @description Determines the color scheme for the alert.\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Alert\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param icon\n * @type {string}\n * @default null\n * @description The name of the icon to be used.\n */\n get icon() {\n let { icon } = this.args;\n\n // If `icon` isn't passed, use the pre-defined one from `color`\n if (icon === undefined) {\n if (this.args.type === 'compact') {\n // for the \"compact\" type by default we use filled icons\n return `${MAPPING_COLORS_TO_ICONS[this.color]}-fill`;\n } else {\n // for all the other types by default we use outlined icons\n return MAPPING_COLORS_TO_ICONS[this.color];\n }\n // If `icon` is set explicitly to false, user doesn't want any icon in the alert\n } else if (icon === false) {\n assert(\n `@icon for \"Hds::Alert\" with @type \"compact\" is required`,\n this.args.type !== 'compact'\n );\n\n return false;\n } else {\n // If a name for `icon` is passed, set FlightIcon to that name\n return icon;\n }\n }\n\n /**\n * @param onDismiss\n * @type {function}\n * @default () => {}\n */\n get onDismiss() {\n let { onDismiss } = this.args;\n\n if (typeof onDismiss === 'function') {\n return onDismiss;\n } else {\n return false;\n }\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.type === 'compact') {\n return '16';\n } else {\n return '24';\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Alert#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-alert'];\n\n // Add a class based on the @type argument\n classes.push(`hds-alert--type-${this.args.type}`);\n\n // Add a class based on the @color argument\n classes.push(`hds-alert--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action\n didInsert(element) {\n let actions = element.querySelectorAll(\n `${CONTENT_ELEMENT_SELECTOR} button, ${CONTENT_ELEMENT_SELECTOR} a`\n );\n if (actions.length) {\n this.role = 'alertdialog';\n }\n\n // `alertdialog` must have an accessible name so we use either the\n // title or the description as label for the alert\n let label =\n element.querySelector(TITLE_ELEMENT_SELECTOR) ||\n element.querySelector(DESCRIPTION_ELEMENT_SELECTOR);\n if (label) {\n let labelId = label.getAttribute('id') || guidFor(element);\n label.setAttribute('id', labelId);\n this.ariaLabelledBy = labelId;\n }\n }\n}\n"],"names":["TYPES","DEFAULT_COLOR","COLORS","MAPPING_COLORS_TO_ICONS","neutral","highlight","success","warning","critical","CONTENT_ELEMENT_SELECTOR","TITLE_ELEMENT_SELECTOR","DESCRIPTION_ELEMENT_SELECTOR","HdsAlertIndexComponent","_class","Component","constructor","arguments","_initializerDefineProperty","_descriptor","_descriptor2","assert","join","args","type","includes","color","icon","undefined","onDismiss","iconSize","classNames","classes","push","didInsert","element","actions","querySelectorAll","length","role","label","querySelector","labelId","getAttribute","guidFor","setAttribute","ariaLabelledBy","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,gtCAAgtC;;;ACU3uC,MAAMA,KAAK,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAC;AAC3C,MAAMC,aAAa,GAAG,UAAS;AACzBC,MAAAA,MAAM,GAAG,CACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACX;AACM,MAAMC,uBAAuB,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,SAAS,EAAE,MAAM;AACjBC,EAAAA,OAAO,EAAE,cAAc;AACvBC,EAAAA,OAAO,EAAE,g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AA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAAjC,MAAA,CAAAkC,SAAA,EA6GPM,WAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA1C,MAAA,CAAAkC,SAAA,EAAA,WAAA,CAAA,EAAAlC,MAAA,CAAAkC,SAAA,IAAAlC,MAAA,EAAA;AA/GkC2C,oBAAA,CAAAC,QAAA,EAAA7C,sBAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/alert/index.hbs","../../../../src/components/hds/alert/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div\\n class={{this.classNames}}\\n role={{this.role}}\\n aria-live=\\\"polite\\\"\\n aria-labelledby={{this.ariaLabelledBy}}\\n {{did-insert this.didInsert}}\\n ...attributes\\n>\\n {{#if this.icon}}\\n <div class=\\\"hds-alert__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} @isInlineBlock={{false}} />\\n </div>\\n {{/if}}\\n\\n <div class=\\\"hds-alert__content\\\">\\n <div class=\\\"hds-alert__text {{if (eq @type \\'compact\\') \\'hds-typography-body-100\\' \\'hds-typography-body-200\\'}}\\\">\\n {{yield (hash Title=(component \\\"hds/alert/title\\\"))}}\\n {{yield (hash Description=(component \\\"hds/alert/description\\\"))}}\\n </div>\\n\\n <div class=\\\"hds-alert__actions\\\">\\n {{yield\\n (hash\\n Button=(component \\\"hds/button\\\" size=\\\"small\\\") LinkStandalone=(component \\\"hds/link/standalone\\\" size=\\\"small\\\")\\n )\\n }}\\n </div>\\n {{yield (hash Generic=(component \\\"hds/yield\\\"))}}\\n </div>\\n\\n {{#if this.onDismiss}}\\n <Hds::DismissButton class=\\\"hds-alert__dismiss\\\" {{on \\\"click\\\" this.onDismiss}} />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport { tracked } from '@glimmer/tracking';\nimport { HdsAlertTypeValues, HdsAlertColorValues } from './types.ts';\nimport type { HdsAlertSignature } from './types.ts';\n\nexport const TYPES: string[] = Object.values(HdsAlertTypeValues);\nexport const DEFAULT_COLOR = HdsAlertColorValues.Neutral;\nexport const COLORS: string[] = Object.values(HdsAlertColorValues);\n\nexport const MAPPING_COLORS_TO_ICONS = {\n [HdsAlertColorValues.Neutral]: 'info',\n [HdsAlertColorValues.Highlight]: 'info',\n [HdsAlertColorValues.Success]: 'check-circle',\n [HdsAlertColorValues.Warning]: 'alert-triangle',\n [HdsAlertColorValues.Critical]: 'alert-diamond',\n} as const;\n\nconst CONTENT_ELEMENT_SELECTOR = '.hds-alert__content';\nconst TITLE_ELEMENT_SELECTOR = '.hds-alert__title';\nconst DESCRIPTION_ELEMENT_SELECTOR = '.hds-alert__description';\n\n// TODO: Do we need to update this icon type to be a type exported from the icon foundations in the future?\n\nexport default class HdsAlertIndexComponent extends Component<HdsAlertSignature> {\n @tracked role = 'alert';\n @tracked ariaLabelledBy?: string;\n\n constructor(owner: unknown, args: HdsAlertSignature['Args']) {\n super(owner, args);\n\n assert(\n `@type for \"Hds::Alert\" must be one of the following: ${TYPES.join(\n ', '\n )}; received: ${this.args.type}`,\n TYPES.includes(this.args.type)\n );\n }\n\n /**\n * @param color\n * @type {enum}\n * @default neutral\n * @description Determines the color scheme for the alert.\n */\n get color() {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Alert\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param icon\n * @type {string}\n * @default null\n * @description The name of the icon to be used.\n */\n get icon() {\n const { icon } = this.args;\n\n // If `icon` isn't passed, use the pre-defined one from `color`\n if (icon === undefined) {\n if (this.args.type === 'compact') {\n // for the \"compact\" type by default we use filled icons\n return `${MAPPING_COLORS_TO_ICONS[this.color]}-fill`;\n } else {\n // for all the other types by default we use outlined icons\n return MAPPING_COLORS_TO_ICONS[this.color];\n }\n // If `icon` is set explicitly to false, user doesn't want any icon in the alert\n } else if (icon === false) {\n assert(\n `@icon for \"Hds::Alert\" with @type \"compact\" is required`,\n this.args.type !== 'compact'\n );\n\n return false;\n } else {\n // If a name for `icon` is passed, set FlightIcon to that name\n return icon;\n }\n }\n\n /**\n * @param onDismiss\n * @type {function}\n * @default () => {}\n */\n get onDismiss() {\n const { onDismiss } = this.args;\n\n if (typeof onDismiss === 'function') {\n return onDismiss;\n } else {\n return false;\n }\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.type === 'compact') {\n return '16';\n } else {\n return '24';\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Alert#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-alert'];\n\n // Add a class based on the @type argument\n classes.push(`hds-alert--type-${this.args.type}`);\n\n // Add a class based on the @color argument\n classes.push(`hds-alert--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action\n didInsert(element: HTMLDivElement) {\n const actions = element.querySelectorAll(\n `${CONTENT_ELEMENT_SELECTOR} button, ${CONTENT_ELEMENT_SELECTOR} a`\n );\n if (actions.length) {\n this.role = 'alertdialog';\n }\n\n // `alertdialog` must have an accessible name so we use either the\n // title or the description as label for the alert\n const label =\n element.querySelector(TITLE_ELEMENT_SELECTOR) ||\n element.querySelector(DESCRIPTION_ELEMENT_SELECTOR);\n if (label) {\n const labelId = label.getAttribute('id') || guidFor(element);\n label.setAttribute('id', labelId);\n this.ariaLabelledBy = labelId;\n }\n }\n}\n"],"names":["TYPES","Object","values","HdsAlertTypeValues","DEFAULT_COLOR","HdsAlertColorValues","Neutral","COLORS","MAPPING_COLORS_TO_ICONS","Highlight","Success","Warning","Critical","CONTENT_ELEMENT_SELECTOR","TITLE_ELEMENT_SELECTOR","DESCRIPTION_ELEMENT_SELECTOR","HdsAlertIndexComponent","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","assert","join","type","includes","color","icon","undefined","onDismiss","iconSize","classNames","classes","push","didInsert","element","actions","querySelectorAll","length","role","label","querySelector","labelId","getAttribute","guidFor","setAttribute","ariaLabelledBy","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,uqCAAuqC;;;ACYlsC,MAAMA,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,kBAAkB,EAAC;AACnDC,MAAAA,aAAa,GAAGC,mBAAmB,CAACC,QAAO;AACjD,MAAMC,MAAgB,GAAGN,MAAM,CAACC,MAAM,CAACG,mBAAmB,EAAC;AAE3D,MAAMG,uBAAuB,GAAG;AACrC,EAAA,CAACH,mBAAmB,CAACC,OAAO,GAAG,MAAM;AACrC,EAAA,CAACD,mBAAmB,CAACI,SAAS,GAAG,MAAM;AACvC,EAAA,CAACJ,mBAAmB,CAACK,OAAO,GAAG,cAAc;AAC7C,EAAA,CAACL,mBAAmB,CAACM,OAAO,GAAG,gBAAgB;EAC/C,CAACN,mBAAmB,CAACO,QAAQ,GAAG,eAAA;AAClC,EAAU;AAEV,MAAMC,wBAAwB,GAAG,qBAAqB,CAAA;AACtD,MAAMC,sBAAsB,GAAG,mBAAmB,CAAA;AAClD,MAAMC,4BAA4B,GAAG,yBAAyB,CAAA;;AAE9D;AAEqBC,IAAAA,sBAAsB,IAAAC,MAAA,GAA5B,MAAMD,sBAAsB,SAASE,SAAS,CAAoB;AAI/EC,EAAA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,CAAA,EAAAlC,MAAA,CAAAkC,SAAA,IAAAlC,MAAA,EAAA;AA/GkC0C,oBAAA,CAAAC,QAAA,EAAA5C,sBAAA,CAAA;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-alert__title hds-font-weight-semibold\" ...attributes>{{yield}}</div>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
class HdsAlertTitleComponent extends Component {}
|
|
8
|
+
setComponentTemplate(TEMPLATE, HdsAlertTitleComponent);
|
|
8
9
|
|
|
9
|
-
export {
|
|
10
|
+
export { HdsAlertTitleComponent as default };
|
|
10
11
|
//# sourceMappingURL=title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.js","sources":["../../../../src/components/hds/alert/title.hbs","../../../../src/components/hds/alert/title.
|
|
1
|
+
{"version":3,"file":"title.js","sources":["../../../../src/components/hds/alert/title.hbs","../../../../src/components/hds/alert/title.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-alert__title hds-font-weight-semibold\\\" ...attributes>{{yield}}</div>\")","import Component from '@glimmer/component';\nimport type { HdsAlertTitleSignature } from './types.ts';\n\nexport default class HdsAlertTitleComponent extends Component<HdsAlertTitleSignature> {}\n"],"names":["HdsAlertTitleComponent","Component","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,sKAAsK;;ACEzL,MAAMA,sBAAsB,SAASC,SAAS,CAAyB,EAAA;AAAEC,oBAAA,CAAAC,QAAA,EAAnEH,sBAAsB,CAAA;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let HdsAlertTypeValues = /*#__PURE__*/function (HdsAlertTypeValues) {
|
|
2
|
+
HdsAlertTypeValues["Page"] = "page";
|
|
3
|
+
HdsAlertTypeValues["Inlne"] = "inline";
|
|
4
|
+
HdsAlertTypeValues["Compact"] = "compact";
|
|
5
|
+
return HdsAlertTypeValues;
|
|
6
|
+
}({});
|
|
7
|
+
let HdsAlertColorValues = /*#__PURE__*/function (HdsAlertColorValues) {
|
|
8
|
+
HdsAlertColorValues["Neutral"] = "neutral";
|
|
9
|
+
HdsAlertColorValues["Highlight"] = "highlight";
|
|
10
|
+
HdsAlertColorValues["Success"] = "success";
|
|
11
|
+
HdsAlertColorValues["Warning"] = "warning";
|
|
12
|
+
HdsAlertColorValues["Critical"] = "critical";
|
|
13
|
+
return HdsAlertColorValues;
|
|
14
|
+
}({});
|
|
15
|
+
|
|
16
|
+
export { HdsAlertColorValues, HdsAlertTypeValues };
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/alert/types.ts"],"sourcesContent":["import type { ComponentLike, WithBoundArgs } from '@glint/template';\nimport type HdsButtonIndexComponent from '../button';\nimport type HdsLinkStandaloneComponent from '../link/standalone';\nimport type { HdsYieldSignature } from '../yield/types';\n\nexport enum HdsAlertTypeValues {\n Page = 'page',\n Inlne = 'inline',\n Compact = 'compact',\n}\nexport type HdsAlertTypes = `${HdsAlertTypeValues}`;\n\nexport enum HdsAlertColorValues {\n Neutral = 'neutral',\n Highlight = 'highlight',\n Success = 'success',\n Warning = 'warning',\n Critical = 'critical',\n}\nexport type HdsAlertColors = `${HdsAlertColorValues}`;\n\nexport interface HdsAlertSignature {\n Args: {\n type: HdsAlertTypes;\n color?: HdsAlertColors;\n icon?: string | false;\n onDismiss?: () => void;\n };\n Blocks: {\n default: [\n {\n Title?: ComponentLike<HdsAlertTitleSignature>;\n Description?: ComponentLike<HdsAlertDescriptionSignature>;\n Generic?: ComponentLike<HdsYieldSignature>;\n LinkStandalone?: WithBoundArgs<\n typeof HdsLinkStandaloneComponent,\n 'size'\n >;\n Button?: WithBoundArgs<typeof HdsButtonIndexComponent, 'size'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport interface HdsAlertDescriptionSignature {\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nexport interface HdsAlertTitleSignature {\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n"],"names":["HdsAlertTypeValues","HdsAlertColorValues"],"mappings":"AAKYA,IAAAA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,MAAA,CAAA,GAAA,MAAA,CAAA;EAAlBA,kBAAkB,CAAA,OAAA,CAAA,GAAA,QAAA,CAAA;EAAlBA,kBAAkB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;AAAA,EAAA,OAAlBA,kBAAkB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOlBC,IAAAA,mBAAmB,0BAAnBA,mBAAmB,EAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAnBA,mBAAmB,CAAA,WAAA,CAAA,GAAA,WAAA,CAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAnBA,mBAAmB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,EAAA,OAAnBA,mBAAmB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
@@ -23,7 +23,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
23
23
|
* @description The text of the button or value of `aria-label` if `isIconOnly` is set to `true`. If no text value is defined an error will be thrown.
|
|
24
24
|
*/
|
|
25
25
|
get text() {
|
|
26
|
-
|
|
26
|
+
const {
|
|
27
27
|
text
|
|
28
28
|
} = this.args;
|
|
29
29
|
assert('@text for "Hds::Button" must have a valid value', text !== undefined);
|
|
@@ -37,7 +37,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
37
37
|
* @description The size of the button; acceptable values are `small`, `medium`, and `large`
|
|
38
38
|
*/
|
|
39
39
|
get size() {
|
|
40
|
-
|
|
40
|
+
const {
|
|
41
41
|
size = DEFAULT_SIZE
|
|
42
42
|
} = this.args;
|
|
43
43
|
assert(`@size for "Hds::Button" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
@@ -51,7 +51,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
51
51
|
* @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `critical`
|
|
52
52
|
*/
|
|
53
53
|
get color() {
|
|
54
|
-
|
|
54
|
+
const {
|
|
55
55
|
color = DEFAULT_COLOR
|
|
56
56
|
} = this.args;
|
|
57
57
|
assert(`@color for "Hds::Button" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
@@ -66,7 +66,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
66
66
|
*/
|
|
67
67
|
get icon() {
|
|
68
68
|
assert(`when the "Hds::Button" @color is "tertiary" an @icon is required`, !(this.color === 'tertiary' && !this.args.icon));
|
|
69
|
-
return this.args.icon ??
|
|
69
|
+
return this.args.icon ?? undefined;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -89,7 +89,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
89
89
|
* @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
|
|
90
90
|
*/
|
|
91
91
|
get iconPosition() {
|
|
92
|
-
|
|
92
|
+
const {
|
|
93
93
|
iconPosition = DEFAULT_ICONPOSITION
|
|
94
94
|
} = this.args;
|
|
95
95
|
assert(`@iconPosition for "Hds::Button" must be one of the following: ${ICONPOSITIONS.join(', ')}; received: ${iconPosition}`, ICONPOSITIONS.includes(iconPosition));
|
|
@@ -126,7 +126,7 @@ class HdsButtonIndexComponent extends Component {
|
|
|
126
126
|
* @return {string} The "class" attribute to apply to the component.
|
|
127
127
|
*/
|
|
128
128
|
get classNames() {
|
|
129
|
-
|
|
129
|
+
const classes = ['hds-button'];
|
|
130
130
|
|
|
131
131
|
// add a class based on the @color argument
|
|
132
132
|
classes.push(`hds-button--color-${this.color}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/button/index.hbs","../../../../src/components/hds/button/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Interactive\\n class={{this.classNames}}\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{@href}}\\n @isHrefExternal={{@isHrefExternal}}\\n ...attributes\\n aria-label={{if this.isIconOnly this.text null}}\\n>\\n {{#if this.isIconOnly}}\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n {{else}}\\n {{#if this.icon}}\\n {{#if (eq this.iconPosition \\\"leading\\\")}}\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n {{else}}\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n {{/if}}\\n {{else}}\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n {{/if}}\\n {{/if}}\\n</Hds::Interactive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { type HdsInteractiveSignature } from '../interactive';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'primary';\nexport const DEFAULT_ICONPOSITION = 'leading';\nexport const SIZES = ['small', 'medium', 'large'] as const;\nexport const COLORS = ['primary', 'secondary', 'tertiary', 'critical'] as const;\nexport const ICONPOSITIONS = ['leading', 'trailing'] as const;\n\nexport type HdsButtonSize = typeof SIZES[number];\nexport type HdsButtonColor = typeof COLORS[number];\nexport type HdsButtonIconPosition = typeof ICONPOSITIONS[number];\n\nexport interface HdsButtonSignature {\n Args: HdsInteractiveSignature['Args'] & {\n size?: HdsButtonSize;\n color?: HdsButtonColor;\n text: string;\n icon?: string;\n iconPosition?: HdsButtonIconPosition;\n isIconOnly?: boolean;\n isInline?: boolean;\n isFullWidth?: boolean;\n };\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsButtonIndexComponent extends Component<HdsButtonSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the button or value of `aria-label` if `isIconOnly` is set to `true`. If no text value is defined an error will be thrown.\n */\n get text() {\n let { text } = this.args;\n\n assert(\n '@text for \"Hds::Button\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small`, `medium`, and `large`\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Button\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `critical`\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Button\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param icon\n * @type {string}\n * @default null\n * @description The name of the icon to be used.\n */\n get icon() {\n assert(\n `when the \"Hds::Button\" @color is \"tertiary\" an @icon is required`,\n !(this.color === 'tertiary' && !this.args.icon)\n );\n\n return this.args.icon ?? null;\n }\n\n /**\n * @param isIconOnly\n * @type {boolean}\n * @default false\n * @description Indicates if the button will only contain an icon; component will also ensure that accessible text is still applied to the component.\n */\n get isIconOnly() {\n if (this.icon) {\n return this.args.isIconOnly ?? false;\n }\n return false;\n }\n\n /**\n * @param iconPosition\n * @type {string}\n * @default leading\n * @description Positions the icon before or after the text; allowed values are `leading` or `trailing`\n */\n get iconPosition() {\n let { iconPosition = DEFAULT_ICONPOSITION } = this.args;\n\n assert(\n `@iconPosition for \"Hds::Button\" must be one of the following: ${ICONPOSITIONS.join(\n ', '\n )}; received: ${iconPosition}`,\n ICONPOSITIONS.includes(iconPosition)\n );\n\n return iconPosition;\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.size === 'large') {\n return '24';\n } else {\n return '16';\n }\n }\n\n /**\n * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that a button should take up the full width of the parent container. The default is false.\n */\n get isFullWidth() {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Button#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-button'];\n\n // add a class based on the @color argument\n classes.push(`hds-button--color-${this.color}`);\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-button--width-full');\n }\n\n // add a class based on isIconOnly argument\n if (this.isIconOnly) {\n classes.push('hds-button--is-icon-only');\n }\n\n // add a class based on the @isInline argument\n if (this.args.isInline) {\n classes.push('hds-button--is-inline');\n }\n\n // add a class based on the @size argument\n classes.push(`hds-button--size-${this.size}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","DEFAULT_ICONPOSITION","SIZES","COLORS","ICONPOSITIONS","HdsButtonIndexComponent","Component","text","args","assert","undefined","size","join","includes","color","icon","isIconOnly","iconPosition","iconSize","isFullWidth","classNames","classes","push","isInline","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,20CAA20C;;ACD72C;AACA;AACA;AACA;;AAMO,MAAMA,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;AAC/B,MAAMC,oBAAoB,GAAG,UAAS;AACtC,MAAMC,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAU;AACnD,MAAMC,MAAM,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAU;MAClEC,aAAa,GAAG,CAAC,SAAS,EAAE,UAAU,EAAU;AAoB9C,MAAMC,uBAAuB,SAASC,SAAS,CAAqB;AACjF;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAExBC,IAAAA,MAAM,CACJ,iDAAiD,EACjDF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAII,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAI,GAAGZ,YAAAA;KAAc,GAAG,IAAI,CAACS,IAAI,CAAA;AAEvCC,IAAAA,MAAM,CACH,CAAwDP,sDAAAA,EAAAA,KAAK,CAACU,IAAI,CACjE,IACF,CAAE,CAAA,YAAA,EAAcD,IAAK,CAAA,CAAC,EACtBT,KAAK,CAACW,QAAQ,CA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"file":"index.js","sources":["../../../../src/components/hds/button/index.hbs","../../../../src/components/hds/button/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Interactive\\n class={{this.classNames}}\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{@href}}\\n @isHrefExternal={{@isHrefExternal}}\\n ...attributes\\n aria-label={{if this.isIconOnly this.text null}}\\n>\\n {{#if this.isIconOnly}}\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n {{else}}\\n {{#if this.icon}}\\n {{#if (eq this.iconPosition \\\"leading\\\")}}\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n {{else}}\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n <span class=\\\"hds-button__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n {{/if}}\\n {{else}}\\n <span class=\\\"hds-button__text\\\">\\n {{this.text}}\\n </span>\\n {{/if}}\\n {{/if}}\\n</Hds::Interactive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport type { HdsInteractiveSignature } from '../interactive/types.ts';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'primary';\nexport const DEFAULT_ICONPOSITION = 'leading';\nexport const SIZES = ['small', 'medium', 'large'] as const;\nexport const COLORS = ['primary', 'secondary', 'tertiary', 'critical'] as const;\nexport const ICONPOSITIONS = ['leading', 'trailing'] as const;\n\nexport type HdsButtonSize = (typeof SIZES)[number];\nexport type HdsButtonColor = (typeof COLORS)[number];\nexport type HdsButtonIconPosition = (typeof ICONPOSITIONS)[number];\n\nexport interface HdsButtonSignature {\n Args: HdsInteractiveSignature['Args'] & {\n size?: HdsButtonSize;\n color?: HdsButtonColor;\n text: string;\n icon?: string;\n iconPosition?: HdsButtonIconPosition;\n isIconOnly?: boolean;\n isInline?: boolean;\n isFullWidth?: boolean;\n };\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsButtonIndexComponent extends Component<HdsButtonSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the button or value of `aria-label` if `isIconOnly` is set to `true`. If no text value is defined an error will be thrown.\n */\n get text() {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Button\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small`, `medium`, and `large`\n */\n get size() {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Button\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `critical`\n */\n get color() {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Button\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param icon\n * @type {string}\n * @default null\n * @description The name of the icon to be used.\n */\n get icon() {\n assert(\n `when the \"Hds::Button\" @color is \"tertiary\" an @icon is required`,\n !(this.color === 'tertiary' && !this.args.icon)\n );\n\n return this.args.icon ?? undefined;\n }\n\n /**\n * @param isIconOnly\n * @type {boolean}\n * @default false\n * @description Indicates if the button will only contain an icon; component will also ensure that accessible text is still applied to the component.\n */\n get isIconOnly() {\n if (this.icon) {\n return this.args.isIconOnly ?? false;\n }\n return false;\n }\n\n /**\n * @param iconPosition\n * @type {string}\n * @default leading\n * @description Positions the icon before or after the text; allowed values are `leading` or `trailing`\n */\n get iconPosition() {\n const { iconPosition = DEFAULT_ICONPOSITION } = this.args;\n\n assert(\n `@iconPosition for \"Hds::Button\" must be one of the following: ${ICONPOSITIONS.join(\n ', '\n )}; received: ${iconPosition}`,\n ICONPOSITIONS.includes(iconPosition)\n );\n\n return iconPosition;\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.size === 'large') {\n return '24';\n } else {\n return '16';\n }\n }\n\n /**\n * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that a button should take up the full width of the parent container. The default is false.\n */\n get isFullWidth() {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Button#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-button'];\n\n // add a class based on the @color argument\n classes.push(`hds-button--color-${this.color}`);\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-button--width-full');\n }\n\n // add a class based on isIconOnly argument\n if (this.isIconOnly) {\n classes.push('hds-button--is-icon-only');\n }\n\n // add a class based on the @isInline argument\n if (this.args.isInline) {\n classes.push('hds-button--is-inline');\n }\n\n // add a class based on the @size argument\n classes.push(`hds-button--size-${this.size}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","DEFAULT_ICONPOSITION","SIZES","COLORS","ICONPOSITIONS","HdsButtonIndexComponent","Component","text","args","assert","undefined","size","join","includes","color","icon","isIconOnly","iconPosition","iconSize","isFullWidth","classNames","classes","push","isInline","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,20CAA20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AA,OAAO,IAAI,CAACX,IAAI,CAACW,WAAW,IAAI,KAAK,CAAA;AACvC,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;AACf,IAAA,MAAMC,OAAO,GAAG,CAAC,YAAY,CAAC,CAAA;;AAE9B;IACAA,OAAO,CAACC,IAAI,CAAE,CAAA,kBAAA,EAAoB,IAAI,CAACR,KAAM,EAAC,CAAC,CAAA;;AAE/C;IACA,IAAI,IAAI,CAACK,WAAW,EAAE;AACpBE,MAAAA,OAAO,CAACC,IAAI,CAAC,wBAAwB,CAAC,CAAA;AACxC,KAAA;;AAEA;IACA,IAAI,IAAI,CAACN,UAAU,EAAE;AACnBK,MAAAA,OAAO,CAACC,IAAI,CAAC,0BAA0B,CAAC,CAAA;AAC1C,KAAA;;AAEA;AACA,IAAA,IAAI,IAAI,CAACd,IAAI,CAACe,QAAQ,EAAE;AACtBF,MAAAA,OAAO,CAACC,IAAI,CAAC,uBAAuB,CAAC,CAAA;AACvC,KAAA;;AAEA;IACAD,OAAO,CAACC,IAAI,CAAE,CAAA,iBAAA,EAAmB,IAAI,CAACX,IAAK,EAAC,CAAC,CAAA;AAE7C,IAAA,OAAOU,OAAO,CAACT,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACY,oBAAA,CAAAC,QAAA,EA7JoBpB,uBAAuB,CAAA;;;;"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsCardLevelValues, HdsCardBackgroundValues, HdsCardOverflowValues } from './types.js';
|
|
3
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
5
|
import { setComponentTemplate } from '@ember/component';
|
|
5
6
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
7
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class={{this.classNames}} ...attributes>\n {{yield}}\n</div>");
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (c) HashiCorp, Inc.
|
|
10
11
|
* SPDX-License-Identifier: MPL-2.0
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
const DEFAULT_LEVEL =
|
|
14
|
-
const DEFAULT_BACKGROUND =
|
|
15
|
-
const DEFAULT_OVERFLOW =
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const DEFAULT_LEVEL = HdsCardLevelValues.Base;
|
|
15
|
+
const DEFAULT_BACKGROUND = HdsCardBackgroundValues.NeutralPrimary;
|
|
16
|
+
const DEFAULT_OVERFLOW = HdsCardOverflowValues.Visible;
|
|
17
|
+
const AVAILABLE_LEVELS = Object.values(HdsCardLevelValues);
|
|
18
|
+
const AVAILABLE_BACKGROUNDS = Object.values(HdsCardBackgroundValues);
|
|
19
|
+
const AVAILABLE_OVERFLOWS = Object.values(HdsCardOverflowValues);
|
|
19
20
|
class HdsCardContainerComponent extends Component {
|
|
20
21
|
/**
|
|
21
22
|
* Sets the "elevation" level for the component
|
|
22
23
|
* Accepted values: base, mid, high
|
|
23
24
|
*
|
|
24
25
|
* @param level
|
|
25
|
-
* @type {
|
|
26
|
+
* @type {HdsCardLevel}
|
|
26
27
|
* @default 'base'
|
|
27
28
|
*/
|
|
28
29
|
get level() {
|
|
29
|
-
|
|
30
|
+
const {
|
|
30
31
|
level = DEFAULT_LEVEL
|
|
31
32
|
} = this.args;
|
|
32
|
-
assert(`@level for "Hds::Card::Container" must be one of the following: ${
|
|
33
|
+
assert(`@level for "Hds::Card::Container" must be one of the following: ${AVAILABLE_LEVELS.join(', ')}; received: ${level}`, AVAILABLE_LEVELS.includes(level));
|
|
33
34
|
return level;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -38,14 +39,14 @@ class HdsCardContainerComponent extends Component {
|
|
|
38
39
|
* Accepted values: base, mid, high
|
|
39
40
|
*
|
|
40
41
|
* @param levelHover
|
|
41
|
-
* @type {
|
|
42
|
+
* @type {HdsCardLevel}
|
|
42
43
|
*/
|
|
43
44
|
get levelHover() {
|
|
44
|
-
|
|
45
|
+
const {
|
|
45
46
|
levelHover
|
|
46
47
|
} = this.args;
|
|
47
48
|
if (levelHover) {
|
|
48
|
-
assert(`@levelHover for "Hds::Card::Container" must be one of the following: ${
|
|
49
|
+
assert(`@levelHover for "Hds::Card::Container" must be one of the following: ${AVAILABLE_LEVELS.join(', ')}; received: ${levelHover}`, AVAILABLE_LEVELS.includes(levelHover));
|
|
49
50
|
}
|
|
50
51
|
return levelHover;
|
|
51
52
|
}
|
|
@@ -55,14 +56,14 @@ class HdsCardContainerComponent extends Component {
|
|
|
55
56
|
* Accepted values: base, mid, high
|
|
56
57
|
*
|
|
57
58
|
* @param levelActive
|
|
58
|
-
* @type {
|
|
59
|
+
* @type {HdsCardLevel}
|
|
59
60
|
*/
|
|
60
61
|
get levelActive() {
|
|
61
|
-
|
|
62
|
+
const {
|
|
62
63
|
levelActive
|
|
63
64
|
} = this.args;
|
|
64
65
|
if (levelActive) {
|
|
65
|
-
assert(`@levelActive for "Hds::Card::Container" must be one of the following: ${
|
|
66
|
+
assert(`@levelActive for "Hds::Card::Container" must be one of the following: ${AVAILABLE_LEVELS.join(', ')}; received: ${levelActive}`, AVAILABLE_LEVELS.includes(levelActive));
|
|
66
67
|
}
|
|
67
68
|
return levelActive;
|
|
68
69
|
}
|
|
@@ -72,14 +73,14 @@ class HdsCardContainerComponent extends Component {
|
|
|
72
73
|
* Accepted values: neutral-primary, neutral-secondary
|
|
73
74
|
*
|
|
74
75
|
* @param background
|
|
75
|
-
* @type {
|
|
76
|
+
* @type {HdsCardBackground}
|
|
76
77
|
* @default 'base'
|
|
77
78
|
*/
|
|
78
79
|
get background() {
|
|
79
|
-
|
|
80
|
+
const {
|
|
80
81
|
background = DEFAULT_BACKGROUND
|
|
81
82
|
} = this.args;
|
|
82
|
-
assert(`@background for "Hds::Card::Container" must be one of the following: ${
|
|
83
|
+
assert(`@background for "Hds::Card::Container" must be one of the following: ${AVAILABLE_BACKGROUNDS.join(', ')}; received: ${background}`, AVAILABLE_BACKGROUNDS.includes(background));
|
|
83
84
|
return background;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -88,14 +89,14 @@ class HdsCardContainerComponent extends Component {
|
|
|
88
89
|
* Accepted values: visible, hidden
|
|
89
90
|
*
|
|
90
91
|
* @param overflow
|
|
91
|
-
* @type {
|
|
92
|
+
* @type {HdsCardOverflow}
|
|
92
93
|
* @default 'visible'
|
|
93
94
|
*/
|
|
94
95
|
get overflow() {
|
|
95
|
-
|
|
96
|
+
const {
|
|
96
97
|
overflow = DEFAULT_OVERFLOW
|
|
97
98
|
} = this.args;
|
|
98
|
-
assert(`@overflow for "Hds::Card::Container" must be one of the following: ${
|
|
99
|
+
assert(`@overflow for "Hds::Card::Container" must be one of the following: ${AVAILABLE_OVERFLOWS.join(', ')}; received: ${overflow}`, AVAILABLE_OVERFLOWS.includes(overflow));
|
|
99
100
|
return overflow;
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -105,7 +106,7 @@ class HdsCardContainerComponent extends Component {
|
|
|
105
106
|
* @return {string} The "class" attribute to apply to the component.
|
|
106
107
|
*/
|
|
107
108
|
get classNames() {
|
|
108
|
-
|
|
109
|
+
const classes = ['hds-card__container'];
|
|
109
110
|
|
|
110
111
|
// add "elevation" classes based on the @level and @hasBorder arguments
|
|
111
112
|
classes.push(`hds-card__container--level-${this.args.hasBorder ? 'surface' : 'elevation'}-${this.level}`);
|
|
@@ -126,5 +127,5 @@ class HdsCardContainerComponent extends Component {
|
|
|
126
127
|
}
|
|
127
128
|
setComponentTemplate(TEMPLATE, HdsCardContainerComponent);
|
|
128
129
|
|
|
129
|
-
export {
|
|
130
|
+
export { AVAILABLE_BACKGROUNDS, AVAILABLE_LEVELS, AVAILABLE_OVERFLOWS, DEFAULT_BACKGROUND, DEFAULT_LEVEL, DEFAULT_OVERFLOW, HdsCardContainerComponent as default };
|
|
130
131
|
//# sourceMappingURL=container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sources":["../../../../src/components/hds/card/container.hbs","../../../../src/components/hds/card/container.
|
|
1
|
+
{"version":3,"file":"container.js","sources":["../../../../src/components/hds/card/container.hbs","../../../../src/components/hds/card/container.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} ...attributes>\\n {{yield}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport {\n HdsCardBackgroundValues,\n HdsCardLevelValues,\n HdsCardOverflowValues,\n} from './types.ts';\nimport type {\n HdsCardBackground,\n HdsCardLevel,\n HdsCardOverflow,\n} from './types.ts';\n\nexport const DEFAULT_LEVEL = HdsCardLevelValues.Base;\nexport const DEFAULT_BACKGROUND = HdsCardBackgroundValues.NeutralPrimary;\nexport const DEFAULT_OVERFLOW = HdsCardOverflowValues.Visible;\nexport const AVAILABLE_LEVELS: string[] = Object.values(HdsCardLevelValues);\nexport const AVAILABLE_BACKGROUNDS: string[] = Object.values(\n HdsCardBackgroundValues\n);\nexport const AVAILABLE_OVERFLOWS: string[] = Object.values(\n HdsCardOverflowValues\n);\n\nexport interface HdsCardContainerSignature {\n Args: {\n level?: HdsCardLevel;\n levelActive?: HdsCardLevel;\n levelHover?: HdsCardLevel;\n background?: HdsCardBackground;\n overflow?: HdsCardOverflow;\n hasBorder?: boolean;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class HdsCardContainerComponent extends Component<HdsCardContainerSignature> {\n /**\n * Sets the \"elevation\" level for the component\n * Accepted values: base, mid, high\n *\n * @param level\n * @type {HdsCardLevel}\n * @default 'base'\n */\n get level(): HdsCardLevel {\n const { level = DEFAULT_LEVEL } = this.args;\n\n assert(\n `@level for \"Hds::Card::Container\" must be one of the following: ${AVAILABLE_LEVELS.join(\n ', '\n )}; received: ${level}`,\n AVAILABLE_LEVELS.includes(level)\n );\n\n return level;\n }\n\n /**\n * Sets the \"elevation\" level for the component on \":hover\" state\n * Accepted values: base, mid, high\n *\n * @param levelHover\n * @type {HdsCardLevel}\n */\n get levelHover(): HdsCardLevel | undefined {\n const { levelHover } = this.args;\n\n if (levelHover) {\n assert(\n `@levelHover for \"Hds::Card::Container\" must be one of the following: ${AVAILABLE_LEVELS.join(\n ', '\n )}; received: ${levelHover}`,\n AVAILABLE_LEVELS.includes(levelHover)\n );\n }\n\n return levelHover;\n }\n\n /**\n * Sets the \"elevation\" level for the component on \":active\" state\n * Accepted values: base, mid, high\n *\n * @param levelActive\n * @type {HdsCardLevel}\n */\n get levelActive(): HdsCardLevel | undefined {\n const { levelActive } = this.args;\n\n if (levelActive) {\n assert(\n `@levelActive for \"Hds::Card::Container\" must be one of the following: ${AVAILABLE_LEVELS.join(\n ', '\n )}; received: ${levelActive}`,\n AVAILABLE_LEVELS.includes(levelActive)\n );\n }\n\n return levelActive;\n }\n\n /**\n * Sets the background for the component\n * Accepted values: neutral-primary, neutral-secondary\n *\n * @param background\n * @type {HdsCardBackground}\n * @default 'base'\n */\n get background(): HdsCardBackground {\n const { background = DEFAULT_BACKGROUND } = this.args;\n\n assert(\n `@background for \"Hds::Card::Container\" must be one of the following: ${AVAILABLE_BACKGROUNDS.join(\n ', '\n )}; received: ${background}`,\n AVAILABLE_BACKGROUNDS.includes(background)\n );\n\n return background;\n }\n\n /**\n * Sets the level for the card\n * Accepted values: visible, hidden\n *\n * @param overflow\n * @type {HdsCardOverflow}\n * @default 'visible'\n */\n get overflow(): HdsCardOverflow {\n const { overflow = DEFAULT_OVERFLOW } = this.args;\n\n assert(\n `@overflow for \"Hds::Card::Container\" must be one of the following: ${AVAILABLE_OVERFLOWS.join(\n ', '\n )}; received: ${overflow}`,\n AVAILABLE_OVERFLOWS.includes(overflow)\n );\n\n return overflow;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Card#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-card__container'];\n\n // add \"elevation\" classes based on the @level and @hasBorder arguments\n classes.push(\n `hds-card__container--level-${\n this.args.hasBorder ? 'surface' : 'elevation'\n }-${this.level}`\n );\n if (this.levelHover) {\n classes.push(\n `hds-card__container--hover-level-${\n this.args.hasBorder ? 'surface' : 'elevation'\n }-${this.levelHover}`\n );\n }\n if (this.levelActive) {\n classes.push(\n `hds-card__container--active-level-${\n this.args.hasBorder ? 'surface' : 'elevation'\n }-${this.levelActive}`\n );\n }\n\n // add a class based on the @background argument\n classes.push(`hds-card__container--background-${this.background}`);\n\n // add a class based on the @overflow argument\n classes.push(`hds-card__container--overflow-${this.overflow}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_LEVEL","HdsCardLevelValues","Base","DEFAULT_BACKGROUND","HdsCardBackgroundValues","NeutralPrimary","DEFAULT_OVERFLOW","HdsCardOverflowValues","Visible","AVAILABLE_LEVELS","Object","values","AVAILABLE_BACKGROUNDS","AVAILABLE_OVERFLOWS","HdsCardContainerComponent","Component","level","args","assert","join","includes","levelHover","levelActive","background","overflow","classNames","classes","push","hasBorder","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,kJAAkJ;;ACDpL;AACA;AACA;AACA;;AAeaA,MAAAA,aAAa,GAAGC,kBAAkB,CAACC,KAAI;AACvCC,MAAAA,kBAAkB,GAAGC,uBAAuB,CAACC,eAAc;AAC3DC,MAAAA,gBAAgB,GAAGC,qBAAqB,CAACC,QAAO;AACtD,MAAMC,gBAA0B,GAAGC,MAAM,CAACC,MAAM,CAACV,kBAAkB,EAAC;AACpE,MAAMW,qBAA+B,GAAGF,MAAM,CAAC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,SAAS,GAAG,SAAS,GAAG,WACnC,CAAA,CAAA,EAAG,IAAI,CAACP,UAAW,EACtB,CAAC,CAAA;AACH,KAAA;IACA,IAAI,IAAI,CAACC,WAAW,EAAE;AACpBI,MAAAA,OAAO,CAACC,IAAI,CACT,qCACC,IAAI,CAACV,IAAI,CAACW,SAAS,GAAG,SAAS,GAAG,WACnC,CAAA,CAAA,EAAG,IAAI,CAACN,WAAY,EACvB,CAAC,CAAA;AACH,KAAA;;AAEA;IACAI,OAAO,CAACC,IAAI,CAAE,CAAA,gCAAA,EAAkC,IAAI,CAACJ,UAAW,EAAC,CAAC,CAAA;;AAElE;IACAG,OAAO,CAACC,IAAI,CAAE,CAAA,8BAAA,EAAgC,IAAI,CAACH,QAAS,EAAC,CAAC,CAAA;AAE9D,IAAA,OAAOE,OAAO,CAACP,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACU,oBAAA,CAAAC,QAAA,EAjJoBhB,yBAAyB,CAAA;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
let HdsCardBackgroundValues = /*#__PURE__*/function (HdsCardBackgroundValues) {
|
|
2
|
+
HdsCardBackgroundValues["NeutralPrimary"] = "neutral-primary";
|
|
3
|
+
HdsCardBackgroundValues["NeutralSecondary"] = "neutral-secondary";
|
|
4
|
+
return HdsCardBackgroundValues;
|
|
5
|
+
}({});
|
|
6
|
+
let HdsCardLevelValues = /*#__PURE__*/function (HdsCardLevelValues) {
|
|
7
|
+
HdsCardLevelValues["Base"] = "base";
|
|
8
|
+
HdsCardLevelValues["Mid"] = "mid";
|
|
9
|
+
HdsCardLevelValues["High"] = "high";
|
|
10
|
+
return HdsCardLevelValues;
|
|
11
|
+
}({});
|
|
12
|
+
let HdsCardOverflowValues = /*#__PURE__*/function (HdsCardOverflowValues) {
|
|
13
|
+
HdsCardOverflowValues["Hidden"] = "hidden";
|
|
14
|
+
HdsCardOverflowValues["Visible"] = "visible";
|
|
15
|
+
return HdsCardOverflowValues;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
export { HdsCardBackgroundValues, HdsCardLevelValues, HdsCardOverflowValues };
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/card/types.ts"],"sourcesContent":["export enum HdsCardBackgroundValues {\n NeutralPrimary = 'neutral-primary',\n NeutralSecondary = 'neutral-secondary',\n}\n\nexport type HdsCardBackground =\n | HdsCardBackgroundValues.NeutralSecondary\n | HdsCardBackgroundValues.NeutralPrimary;\n\nexport enum HdsCardLevelValues {\n Base = 'base',\n Mid = 'mid',\n High = 'high',\n}\n\nexport type HdsCardLevel =\n | HdsCardLevelValues.Base\n | HdsCardLevelValues.Mid\n | HdsCardLevelValues.High;\n\nexport enum HdsCardOverflowValues {\n Hidden = 'hidden',\n Visible = 'visible',\n}\n\nexport type HdsCardOverflow =\n | HdsCardOverflowValues.Hidden\n | HdsCardOverflowValues.Visible;\n"],"names":["HdsCardBackgroundValues","HdsCardLevelValues","HdsCardOverflowValues"],"mappings":"AAAYA,IAAAA,uBAAuB,0BAAvBA,uBAAuB,EAAA;EAAvBA,uBAAuB,CAAA,gBAAA,CAAA,GAAA,iBAAA,CAAA;EAAvBA,uBAAuB,CAAA,kBAAA,CAAA,GAAA,mBAAA,CAAA;AAAA,EAAA,OAAvBA,uBAAuB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AASvBC,IAAAA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,MAAA,CAAA,GAAA,MAAA,CAAA;EAAlBA,kBAAkB,CAAA,KAAA,CAAA,GAAA,KAAA,CAAA;EAAlBA,kBAAkB,CAAA,MAAA,CAAA,GAAA,MAAA,CAAA;AAAA,EAAA,OAAlBA,kBAAkB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAWlBC,IAAAA,qBAAqB,0BAArBA,qBAAqB,EAAA;EAArBA,qBAAqB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAArBA,qBAAqB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;AAAA,EAAA,OAArBA,qBAAqB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
@@ -6,7 +6,7 @@ import { action } from '@ember/object';
|
|
|
6
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
8
|
|
|
9
|
-
var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n type=\"button\"\n class={{this.classNames}}\n {{hds-clipboard text=@textToCopy onSuccess=this.onSuccess onError=this.onError}}\n aria-label={{concat \
|
|
9
|
+
var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n type=\"button\"\n class={{this.classNames}}\n {{hds-clipboard text=@textToCopy onSuccess=this.onSuccess onError=this.onError}}\n aria-label={{concat \"copy \" @textToCopy}}\n ...attributes\n>\n <Hds::Text::Code class=\"hds-copy-snippet__text\" @tag=\"span\" @size=\"100\">\n {{@textToCopy}}\n </Hds::Text::Code>\n <FlightIcon @name={{this.icon}} class=\"hds-copy-snippet__icon\" />\n</button>");
|
|
10
10
|
|
|
11
11
|
var _class, _descriptor, _descriptor2;
|
|
12
12
|
const DEFAULT_COLOR = 'primary';
|