@hashicorp/design-system-components 6.2.0 → 6.3.0-rc-20260507194626
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/declarations/components/hds/accordion/cds/index.d.ts +35 -0
- package/declarations/components/hds/accordion/cds/item/index.d.ts +61 -0
- package/declarations/components/hds/accordion/hds/index.d.ts +30 -0
- package/declarations/components/hds/accordion/{item → hds/item}/button.d.ts +1 -1
- package/declarations/components/hds/accordion/hds/item/index.d.ts +44 -0
- package/declarations/components/hds/accordion/index.d.ts +13 -6
- package/declarations/components/hds/accordion/item/index.d.ts +11 -14
- package/declarations/components/hds/badge/index.d.ts +8 -0
- package/declarations/components/hds/button/index.d.ts +12 -0
- package/declarations/components/hds/cds-accordion/index.d.ts +10 -0
- package/declarations/components/hds/cds-accordion/item.d.ts +7 -0
- package/declarations/components/hds/cds-badge/index.d.ts +28 -0
- package/declarations/components/hds/cds-button/index.d.ts +60 -0
- package/declarations/components/hds/cds-link/index.d.ts +9 -0
- package/declarations/components/hds/cds-modal/body-content.d.ts +15 -0
- package/declarations/components/hds/cds-modal/body.d.ts +15 -0
- package/declarations/components/hds/cds-modal/close-button.d.ts +17 -0
- package/declarations/components/hds/cds-modal/footer-button.d.ts +55 -0
- package/declarations/components/hds/cds-modal/footer.d.ts +15 -0
- package/declarations/components/hds/cds-modal/header.d.ts +15 -0
- package/declarations/components/hds/cds-modal/heading.d.ts +15 -0
- package/declarations/components/hds/cds-modal/index.d.ts +37 -0
- package/declarations/components/hds/cds-text-input/index.d.ts +12 -0
- package/declarations/components/hds/form/text-input/base.d.ts +12 -0
- package/declarations/components/hds/form/text-input/field.d.ts +4 -1
- package/declarations/components/hds/icon/index.d.ts +1 -1
- package/declarations/components/hds/link/inline.d.ts +13 -0
- package/declarations/components/hds/link/standalone.d.ts +10 -0
- package/declarations/components/hds/modal/cds/index.d.ts +106 -0
- package/declarations/components/hds/modal/hds/index.d.ts +52 -0
- package/declarations/components/hds/modal/index.d.ts +44 -28
- package/declarations/components/hds/modal/types.d.ts +5 -0
- package/declarations/components/hds/stepper/task/indicator.d.ts +1 -1
- package/declarations/components.d.ts +14 -0
- package/declarations/modifiers/hds-anchored-position.d.ts +1 -1
- package/declarations/template-registry.d.ts +0 -3
- package/declarations/utils/create-component.d.ts +23 -0
- package/dist/_app_/components/hds/accordion/cds/item.js +1 -0
- package/dist/_app_/components/hds/accordion/{item/button.js → cds.js} +1 -1
- package/dist/_app_/components/hds/accordion/hds/item/button.js +1 -0
- package/dist/_app_/components/hds/accordion/hds/item.js +1 -0
- package/dist/_app_/components/hds/accordion/hds.js +1 -0
- package/dist/_app_/components/hds/cds-accordion/item.js +1 -0
- package/dist/_app_/components/hds/cds-accordion.js +1 -0
- package/dist/_app_/components/hds/cds-badge.js +1 -0
- package/dist/_app_/components/hds/cds-button.js +1 -0
- package/dist/_app_/components/hds/cds-link.js +1 -0
- package/dist/_app_/components/hds/cds-modal/body-content.js +1 -0
- package/dist/_app_/components/hds/cds-modal/body.js +1 -0
- package/dist/_app_/components/hds/cds-modal/close-button.js +1 -0
- package/dist/_app_/components/hds/cds-modal/footer-button.js +1 -0
- package/dist/_app_/components/hds/cds-modal/footer.js +1 -0
- package/dist/_app_/components/hds/cds-modal/header.js +1 -0
- package/dist/_app_/components/hds/cds-modal/heading.js +1 -0
- package/dist/_app_/components/hds/cds-modal.js +1 -0
- package/dist/_app_/components/hds/cds-text-input.js +1 -0
- package/dist/_app_/components/hds/modal/cds.js +1 -0
- package/dist/_app_/components/hds/modal/hds.js +1 -0
- package/dist/components/hds/accordion/cds/index.js +58 -0
- package/dist/components/hds/accordion/cds/index.js.map +1 -0
- package/dist/components/hds/accordion/cds/item/index.js +142 -0
- package/dist/components/hds/accordion/cds/item/index.js.map +1 -0
- package/dist/components/hds/accordion/hds/index.js +51 -0
- package/dist/components/hds/accordion/hds/index.js.map +1 -0
- package/dist/components/hds/accordion/{item → hds/item}/button.js +2 -2
- package/dist/components/hds/accordion/hds/item/button.js.map +1 -0
- package/dist/components/hds/accordion/hds/item/index.js +101 -0
- package/dist/components/hds/accordion/hds/item/index.js.map +1 -0
- package/dist/components/hds/accordion/index.js +9 -29
- package/dist/components/hds/accordion/index.js.map +1 -1
- package/dist/components/hds/accordion/item/index.js +10 -81
- package/dist/components/hds/accordion/item/index.js.map +1 -1
- package/dist/components/hds/badge/index.js +35 -1
- package/dist/components/hds/badge/index.js.map +1 -1
- package/dist/components/hds/button/index.js +41 -2
- package/dist/components/hds/button/index.js.map +1 -1
- package/dist/components/hds/cds-accordion/index.js +14 -0
- package/dist/components/hds/cds-accordion/index.js.map +1 -0
- package/dist/components/hds/cds-accordion/item.js +11 -0
- package/dist/components/hds/cds-accordion/item.js.map +1 -0
- package/dist/components/hds/cds-badge/index.js +28 -0
- package/dist/components/hds/cds-badge/index.js.map +1 -0
- package/dist/components/hds/cds-button/index.js +26 -0
- package/dist/components/hds/cds-button/index.js.map +1 -0
- package/dist/components/hds/cds-link/index.js +12 -0
- package/dist/components/hds/cds-link/index.js.map +1 -0
- package/dist/components/hds/cds-modal/body-content.js +20 -0
- package/dist/components/hds/cds-modal/body-content.js.map +1 -0
- package/dist/components/hds/cds-modal/body.js +20 -0
- package/dist/components/hds/cds-modal/body.js.map +1 -0
- package/dist/components/hds/cds-modal/close-button.js +20 -0
- package/dist/components/hds/cds-modal/close-button.js.map +1 -0
- package/dist/components/hds/cds-modal/footer-button.js +21 -0
- package/dist/components/hds/cds-modal/footer-button.js.map +1 -0
- package/dist/components/hds/cds-modal/footer.js +20 -0
- package/dist/components/hds/cds-modal/footer.js.map +1 -0
- package/dist/components/hds/cds-modal/header.js +20 -0
- package/dist/components/hds/cds-modal/header.js.map +1 -0
- package/dist/components/hds/cds-modal/heading.js +20 -0
- package/dist/components/hds/cds-modal/heading.js.map +1 -0
- package/dist/components/hds/cds-modal/index.js +23 -0
- package/dist/components/hds/cds-modal/index.js.map +1 -0
- package/dist/components/hds/cds-text-input/index.js +16 -0
- package/dist/components/hds/cds-text-input/index.js.map +1 -0
- package/dist/components/hds/form/text-input/base.js +3 -1
- package/dist/components/hds/form/text-input/base.js.map +1 -1
- package/dist/components/hds/form/text-input/field.js +4 -3
- package/dist/components/hds/form/text-input/field.js.map +1 -1
- package/dist/components/hds/link/inline.js +20 -3
- package/dist/components/hds/link/inline.js.map +1 -1
- package/dist/components/hds/link/standalone.js +31 -3
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/modal/cds/index.js +195 -0
- package/dist/components/hds/modal/cds/index.js.map +1 -0
- package/dist/components/hds/modal/hds/index.js +185 -0
- package/dist/components/hds/modal/hds/index.js.map +1 -0
- package/dist/components/hds/modal/index.js +15 -164
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/modal/types.js +10 -1
- package/dist/components/hds/modal/types.js.map +1 -1
- package/dist/components.js +15 -1
- package/dist/components.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +12 -0
- package/dist/styles/@hashicorp/design-system-components.css.map +1 -1
- package/dist/styles/components/cds-badge.scss +12 -0
- package/dist/styles/components/cds-button.scss +12 -0
- package/dist/styles/components/cds-link.scss +12 -0
- package/dist/styles/components/index.scss +5 -0
- package/dist/utils/create-component.js +98 -0
- package/dist/utils/create-component.js.map +1 -0
- package/package.json +23 -2
- package/dist/components/hds/accordion/item/button.js.map +0 -1
|
@@ -1,185 +1,36 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { assert } from '@ember/debug';
|
|
4
|
-
import { buildWaiter } from '@ember/test-waiters';
|
|
5
|
-
import { modifier } from 'ember-modifier';
|
|
6
2
|
import { hash } from '@ember/helper';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import HdsDialogPrimitiveFooter from '../dialog-primitive/footer.js';
|
|
11
|
-
import HdsDialogPrimitiveWrapper from '../dialog-primitive/wrapper.js';
|
|
12
|
-
import HdsDialogPrimitiveOverlay from '../dialog-primitive/overlay.js';
|
|
13
|
-
import { HdsModalSizeValues, HdsModalColorValues } from './types.js';
|
|
14
|
-
import { getElementId } from '../../../utils/hds-get-element-id.js';
|
|
3
|
+
import HdsModal$2 from './cds/index.js';
|
|
4
|
+
export { COLORS, DEFAULT_COLOR, DEFAULT_SIZE, SIZES } from './cds/index.js';
|
|
5
|
+
import HdsModal$1 from './hds/index.js';
|
|
15
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
16
7
|
import { setComponentTemplate } from '@ember/component';
|
|
17
|
-
import { g, i } from 'decorator-transforms/runtime';
|
|
18
8
|
|
|
19
9
|
/**
|
|
20
10
|
* Copyright IBM Corp. 2021, 2025
|
|
21
11
|
* SPDX-License-Identifier: MPL-2.0
|
|
22
12
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
// Public block API exposed by the wrapper. This is the structural intersection
|
|
14
|
+
// of the public API both implementations already satisfy. The cds implementation
|
|
15
|
+
// yields a local HdsModalHeader/HdsModalFooter; the hds implementation yields
|
|
16
|
+
// `HdsDialogPrimitiveHeader`/`HdsDialogPrimitiveFooter` (with `id`/`onDismiss`/etc.
|
|
17
|
+
// already bound). Either matches this shape from the consumer's perspective.
|
|
18
|
+
|
|
28
19
|
class HdsModal extends Component {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return false;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
#_isOpen = (i(this, "_isOpen"), void 0);
|
|
35
|
-
_element;
|
|
36
|
-
_body;
|
|
37
|
-
_bodyInitialOverflowValue = '';
|
|
38
|
-
_clickOutsideToDismissHandler;
|
|
39
|
-
get isDismissDisabled() {
|
|
40
|
-
return this.args.isDismissDisabled ?? false;
|
|
41
|
-
}
|
|
42
|
-
get size() {
|
|
43
|
-
const {
|
|
44
|
-
size = DEFAULT_SIZE
|
|
45
|
-
} = this.args;
|
|
46
|
-
assert(`@size for "Hds::Modal" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
47
|
-
return size;
|
|
48
|
-
}
|
|
49
|
-
get color() {
|
|
50
|
-
const {
|
|
51
|
-
color = DEFAULT_COLOR
|
|
52
|
-
} = this.args;
|
|
53
|
-
assert(`@color for "Hds::Modal" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
54
|
-
return color;
|
|
55
|
-
}
|
|
56
|
-
get id() {
|
|
57
|
-
return getElementId(this);
|
|
58
|
-
}
|
|
59
|
-
get classNames() {
|
|
60
|
-
const classes = ['hds-modal'];
|
|
61
|
-
// add a class based on the @size argument
|
|
62
|
-
classes.push(`hds-modal--size-${this.size}`);
|
|
63
|
-
// add a class based on the @color argument
|
|
64
|
-
classes.push(`hds-modal--color-${this.color}`);
|
|
65
|
-
return classes.join(' ');
|
|
66
|
-
}
|
|
67
|
-
_performCloseCleanup() {
|
|
68
|
-
this._isOpen = false;
|
|
69
|
-
// Reset page `overflow` property
|
|
70
|
-
if (this._body) {
|
|
71
|
-
this._body.style.removeProperty('overflow');
|
|
72
|
-
if (this._bodyInitialOverflowValue === '') {
|
|
73
|
-
if (this._body.style.length === 0) {
|
|
74
|
-
this._body.removeAttribute('style');
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
this._body.style.setProperty('overflow', this._bodyInitialOverflowValue);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Return focus to a specific element (if provided)
|
|
81
|
-
if (this.args.returnFocusTo) {
|
|
82
|
-
const initiator = document.getElementById(this.args.returnFocusTo);
|
|
83
|
-
if (initiator) {
|
|
84
|
-
initiator.focus();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
20
|
+
get useCds() {
|
|
21
|
+
return this.args.useCds ?? false;
|
|
87
22
|
}
|
|
88
|
-
registerOnCloseCallback = event => {
|
|
89
|
-
if (!this.isDismissDisabled && this.args.onClose && typeof this.args.onClose === 'function') {
|
|
90
|
-
this.args.onClose(event);
|
|
91
|
-
}
|
|
92
|
-
// If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed
|
|
93
|
-
if (this.isDismissDisabled) {
|
|
94
|
-
// If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail
|
|
95
|
-
// so we add this safeguard condition that checks for the `<dialog>` to have a parent
|
|
96
|
-
if (this._element.parentElement) {
|
|
97
|
-
// As there is no way to `preventDefault` on `close` events, we call the `showModal` function
|
|
98
|
-
// preserving the state of the modal dialog
|
|
99
|
-
this._element.showModal();
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
this._performCloseCleanup();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
_registerDialog = modifier(element => {
|
|
106
|
-
// Store references of `<dialog>` and `<body>` elements
|
|
107
|
-
this._element = element;
|
|
108
|
-
this._body = document.body;
|
|
109
|
-
if (this._body) {
|
|
110
|
-
// Store the initial `overflow` value of `<body>` so we can reset to it
|
|
111
|
-
this._bodyInitialOverflowValue = this._body.style.getPropertyValue('overflow');
|
|
112
|
-
}
|
|
113
|
-
// Register "onClose" callback function to be called when a native 'close' event is dispatched
|
|
114
|
-
this._element.addEventListener('close', this.registerOnCloseCallback, true);
|
|
115
|
-
// If the modal dialog is not already open
|
|
116
|
-
if (!this._element.open) {
|
|
117
|
-
this.open();
|
|
118
|
-
}
|
|
119
|
-
// Note: because the Modal has the `@isDismissedDisabled` argument, we need to add our own click outside to dismiss logic. This is because `ember-focus-trap` treats the `focusTrapOptions` as static, so we can't update it dynamically if `@isDismissDisabled` changes.
|
|
120
|
-
this._clickOutsideToDismissHandler = event => {
|
|
121
|
-
// check if the click is outside the modal and the modal is open
|
|
122
|
-
if (!this._element.contains(event.target) && this._isOpen) {
|
|
123
|
-
if (!this.isDismissDisabled) {
|
|
124
|
-
// here we use `void` because `onDismiss` is an async function, but in reality we don't need to handle the result or wait for its completion
|
|
125
|
-
void this.onDismiss();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
document.addEventListener('click', this._clickOutsideToDismissHandler, {
|
|
130
|
-
capture: true,
|
|
131
|
-
passive: false
|
|
132
|
-
});
|
|
133
|
-
return () => {
|
|
134
|
-
// if the <dialog> is removed from the dom while open we emulate the close event
|
|
135
|
-
if (this._isOpen) {
|
|
136
|
-
this._performCloseCleanup();
|
|
137
|
-
}
|
|
138
|
-
this._element?.removeEventListener('close', this.registerOnCloseCallback, true);
|
|
139
|
-
document.removeEventListener('click', this._clickOutsideToDismissHandler, true);
|
|
140
|
-
};
|
|
141
|
-
});
|
|
142
|
-
open = () => {
|
|
143
|
-
// Make modal dialog visible using the native `showModal` method
|
|
144
|
-
this._element.showModal();
|
|
145
|
-
this._isOpen = true;
|
|
146
|
-
// Prevent page from scrolling when the dialog is open
|
|
147
|
-
if (this._body) this._body.style.setProperty('overflow', 'hidden');
|
|
148
|
-
// Call "onOpen" callback function
|
|
149
|
-
if (this.args.onOpen && typeof this.args.onOpen === 'function') {
|
|
150
|
-
this.args.onOpen();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
154
|
-
onDismiss = async () => {
|
|
155
|
-
// allow ember test helpers to be aware of when the `close` event fires
|
|
156
|
-
// when using `click` or other helpers from '@ember/test-helpers'
|
|
157
|
-
if (this._element.open) {
|
|
158
|
-
const token = waiter.beginAsync();
|
|
159
|
-
const listener = () => {
|
|
160
|
-
waiter.endAsync(token);
|
|
161
|
-
this._element.removeEventListener('close', listener);
|
|
162
|
-
};
|
|
163
|
-
this._element.addEventListener('close', listener);
|
|
164
|
-
}
|
|
165
|
-
// Make modal dialog invisible using the native `close` method
|
|
166
|
-
this._element.close();
|
|
167
|
-
};
|
|
168
23
|
static {
|
|
169
|
-
setComponentTemplate(precompileTemplate("
|
|
24
|
+
setComponentTemplate(precompileTemplate("{{#if this.useCds}}\n <HdsModalCds @isDismissDisabled={{@isDismissDisabled}} @size={{@size}} @color={{@color}} @returnFocusTo={{@returnFocusTo}} @onOpen={{@onOpen}} @onClose={{@onClose}} ...attributes>\n <:default as |M|>\n {{yield (hash Header=M.Header Body=M.Body Footer=M.Footer)}}\n </:default>\n </HdsModalCds>\n{{else}}\n <HdsModalHds @isDismissDisabled={{@isDismissDisabled}} @size={{@size}} @color={{@color}} @returnFocusTo={{@returnFocusTo}} @onOpen={{@onOpen}} @onClose={{@onClose}} ...attributes>\n <:default as |M|>\n {{yield (hash Header=M.Header Body=M.Body Footer=M.Footer)}}\n </:default>\n </HdsModalHds>\n{{/if}}", {
|
|
170
25
|
strictMode: true,
|
|
171
26
|
scope: () => ({
|
|
172
|
-
|
|
173
|
-
focusTrap,
|
|
27
|
+
HdsModalCds: HdsModal$2,
|
|
174
28
|
hash,
|
|
175
|
-
|
|
176
|
-
HdsDialogPrimitiveBody,
|
|
177
|
-
HdsDialogPrimitiveFooter,
|
|
178
|
-
HdsDialogPrimitiveOverlay
|
|
29
|
+
HdsModalHds: HdsModal$1
|
|
179
30
|
})
|
|
180
31
|
}), this);
|
|
181
32
|
}
|
|
182
33
|
}
|
|
183
34
|
|
|
184
|
-
export {
|
|
35
|
+
export { HdsModal as default };
|
|
185
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.gts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2021, 2025\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { buildWaiter } from '@ember/test-waiters';\nimport { modifier } from 'ember-modifier';\nimport { hash } from '@ember/helper';\n// @ts-expect-error: missing types https://github.com/josemarluedke/ember-focus-trap/issues/86\nimport focusTrap from 'ember-focus-trap/modifiers/focus-trap';\n\nimport type { WithBoundArgs } from '@glint/template';\n\nimport HdsDialogPrimitiveHeader from '../dialog-primitive/header.gts';\nimport HdsDialogPrimitiveBody from '../dialog-primitive/body.gts';\nimport HdsDialogPrimitiveFooter from '../dialog-primitive/footer.gts';\nimport HdsDialogPrimitiveWrapper from '../dialog-primitive/wrapper.gts';\nimport HdsDialogPrimitiveOverlay from '../dialog-primitive/overlay.gts';\nimport { HdsModalSizeValues, HdsModalColorValues } from './types.ts';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\n\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = HdsModalSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsModalColorValues.Neutral;\n\nexport const SIZES: HdsModalSizes[] = Object.values(HdsModalSizeValues);\nexport const COLORS: HdsModalColors[] = Object.values(HdsModalColorValues);\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeader,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Body?: WithBoundArgs<typeof HdsDialogPrimitiveBody, 'contextualClass'>;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooter,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsModal extends Component<HdsModalSignature> {\n @tracked private _isOpen = false;\n private _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n private _clickOutsideToDismissHandler!: (event: MouseEvent) => void;\n\n get isDismissDisabled(): boolean {\n return this.args.isDismissDisabled ?? false;\n }\n\n get size(): HdsModalSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get color(): HdsModalColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n private _performCloseCleanup(): void {\n this._isOpen = false;\n\n // Reset page `overflow` property\n if (this._body) {\n this._body.style.removeProperty('overflow');\n if (this._bodyInitialOverflowValue === '') {\n if (this._body.style.length === 0) {\n this._body.removeAttribute('style');\n }\n } else {\n this._body.style.setProperty(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n\n registerOnCloseCallback = (event: Event): void => {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose(event);\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this._element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this._element.showModal();\n }\n } else {\n this._performCloseCleanup();\n }\n };\n\n private _registerDialog = modifier((element: HTMLDialogElement) => {\n // Store references of `<dialog>` and `<body>` elements\n this._element = element;\n this._body = document.body;\n\n if (this._body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this._bodyInitialOverflowValue =\n this._body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n\n this._element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the modal dialog is not already open\n if (!this._element.open) {\n this.open();\n }\n\n // Note: because the Modal has the `@isDismissedDisabled` argument, we need to add our own click outside to dismiss logic. This is because `ember-focus-trap` treats the `focusTrapOptions` as static, so we can't update it dynamically if `@isDismissDisabled` changes.\n this._clickOutsideToDismissHandler = (event: MouseEvent) => {\n // check if the click is outside the modal and the modal is open\n if (!this._element.contains(event.target as Node) && this._isOpen) {\n if (!this.isDismissDisabled) {\n // here we use `void` because `onDismiss` is an async function, but in reality we don't need to handle the result or wait for its completion\n void this.onDismiss();\n }\n }\n };\n\n document.addEventListener('click', this._clickOutsideToDismissHandler, {\n capture: true,\n passive: false,\n });\n\n return () => {\n // if the <dialog> is removed from the dom while open we emulate the close event\n if (this._isOpen) {\n this._performCloseCleanup();\n }\n\n this._element?.removeEventListener(\n 'close',\n\n this.registerOnCloseCallback,\n true\n );\n\n document.removeEventListener(\n 'click',\n this._clickOutsideToDismissHandler,\n true\n );\n };\n });\n\n open = (): void => {\n // Make modal dialog visible using the native `showModal` method\n this._element.showModal();\n this._isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this._body) this._body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/require-await\n onDismiss = async (): Promise<void> => {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n if (this._element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this._element.removeEventListener('close', listener);\n };\n this._element.addEventListener('close', listener);\n }\n\n // Make modal dialog invisible using the native `close` method\n this._element.close();\n };\n\n <template>\n <HdsDialogPrimitiveWrapper\n class={{this.classNames}}\n ...attributes\n aria-labelledby={{this.id}}\n {{this._registerDialog}}\n {{focusTrap\n isActive=this._isOpen\n focusTrapOptions=(hash onDeactivate=this.onDismiss)\n }}\n >\n <:header>\n {{yield\n (hash\n Header=(component\n HdsDialogPrimitiveHeader\n id=this.id\n onDismiss=this.onDismiss\n contextualClassPrefix=\"hds-modal\"\n titleTag=\"h1\"\n )\n )\n }}\n </:header>\n <:body>\n {{yield\n (hash\n Body=(component\n HdsDialogPrimitiveBody contextualClass=\"hds-modal__body\"\n )\n )\n }}\n </:body>\n <:footer>\n {{yield\n (hash\n Footer=(component\n HdsDialogPrimitiveFooter\n onDismiss=this.onDismiss\n contextualClass=\"hds-modal__footer\"\n )\n )\n }}\n </:footer>\n </HdsDialogPrimitiveWrapper>\n\n {{#if this._isOpen}}\n <HdsDialogPrimitiveOverlay @contextualClass=\"hds-modal__overlay\" />\n {{/if}}\n </template>\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsModalSizeValues","Medium","DEFAULT_COLOR","HdsModalColorValues","Neutral","SIZES","Object","values","COLORS","HdsModal","Component","g","prototype","tracked","i","_element","_body","_bodyInitialOverflowValue","_clickOutsideToDismissHandler","isDismissDisabled","args","size","assert","join","includes","color","id","getElementId","classNames","classes","push","_performCloseCleanup","_isOpen","style","removeProperty","length","removeAttribute","setProperty","returnFocusTo","initiator","document","getElementById","focus","registerOnCloseCallback","event","onClose","parentElement","showModal","_registerDialog","modifier","element","body","getPropertyValue","addEventListener","open","contains","target","onDismiss","capture","passive","removeEventListener","onOpen","token","beginAsync","listener","endAsync","close","setComponentTemplate","precompileTemplate","strictMode","scope","HdsDialogPrimitiveWrapper","focusTrap","hash","HdsDialogPrimitiveHeader","HdsDialogPrimitiveBody","HdsDialogPrimitiveFooter","HdsDialogPrimitiveOverlay"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;AAGC;AAuBD,MAAMA,SAASC,WAAA,CAAY,2CAAA,CAAA;AAEpB,MAAMC,YAAA,GAAeC,kBAAA,CAAmBC;AACxC,MAAMC,aAAA,GAAgBC,mBAAA,CAAoBC;AAE1C,MAAMC,KAAO,GAAkBC,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C7C,CAAA;MACA,IAAI,CAACjD,QAAQ,CAACsC,gBAAgB,CAAC,OAAA,EAASW,QAAA,CAAA;AAC1C,IAAA;AAEA;AACA,IAAA,IAAI,CAACjD,QAAQ,CAACmD,KAAK,EAAA;EACrB,CAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,oyBAAA,EAiDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,yBAAA;QAAAC,SAAA;QAAAC,IAAA;QAAAC,wBAAA;QAAAC,sBAAA;QAAAC,wBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.gts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2021, 2025\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\n\nimport type { ComponentLike } from '@glint/template';\n\nimport HdsModalCds from './cds/index.gts';\nimport HdsModalHds from './hds/index.gts';\n\nimport type { HdsIconSignature } from '../icon/index.gts';\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nexport { SIZES, COLORS, DEFAULT_SIZE, DEFAULT_COLOR } from './cds/index.gts';\n\n// Public block API exposed by the wrapper. This is the structural intersection\n// of the public API both implementations already satisfy. The cds implementation\n// yields a local HdsModalHeader/HdsModalFooter; the hds implementation yields\n// `HdsDialogPrimitiveHeader`/`HdsDialogPrimitiveFooter` (with `id`/`onDismiss`/etc.\n// already bound). Either matches this shape from the consumer's perspective.\n\ntype HdsModalHeaderLike = ComponentLike<{\n Args: {\n icon?: HdsIconSignature['Args']['name'];\n tagline?: string;\n };\n Blocks: { default: [] };\n Element: Element;\n}>;\n\ntype HdsModalBodyLike = ComponentLike<{\n Args: Record<string, never>;\n Blocks: { default: [] };\n Element: Element;\n}>;\n\ntype HdsModalFooterLike = ComponentLike<{\n Args: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onDismiss?: (event: MouseEvent, ...args: any[]) => void;\n };\n Blocks: {\n default: [\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n close: (event: MouseEvent, ...args: any[]) => void;\n },\n ];\n };\n Element: Element;\n}>;\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n /**\n * When true, renders the Carbon (cds) modal implementation.\n * When false (default), renders the original HDS modal implementation\n * (native `<dialog>` with focus-trap).\n */\n useCds?: boolean;\n };\n Blocks: {\n default: [\n {\n Header?: HdsModalHeaderLike;\n Body?: HdsModalBodyLike;\n Footer?: HdsModalFooterLike;\n },\n ];\n };\n Element: HTMLElement | HTMLDialogElement;\n}\n\nexport default class HdsModal extends Component<HdsModalSignature> {\n get useCds(): boolean {\n return this.args.useCds ?? false;\n }\n\n <template>\n {{#if this.useCds}}\n <HdsModalCds\n @isDismissDisabled={{@isDismissDisabled}}\n @size={{@size}}\n @color={{@color}}\n @returnFocusTo={{@returnFocusTo}}\n @onOpen={{@onOpen}}\n @onClose={{@onClose}}\n ...attributes\n >\n <:default as |M|>\n {{yield (hash Header=M.Header Body=M.Body Footer=M.Footer)}}\n </:default>\n </HdsModalCds>\n {{else}}\n <HdsModalHds\n @isDismissDisabled={{@isDismissDisabled}}\n @size={{@size}}\n @color={{@color}}\n @returnFocusTo={{@returnFocusTo}}\n @onOpen={{@onOpen}}\n @onClose={{@onClose}}\n ...attributes\n >\n <:default as |M|>\n {{yield (hash Header=M.Header Body=M.Body Footer=M.Footer)}}\n </:default>\n </HdsModalHds>\n {{/if}}\n </template>\n}\n"],"names":["HdsModal","Component","useCds","args","setComponentTemplate","precompileTemplate","strictMode","scope","HdsModalCds","hash","HdsModalHds"],"mappings":";;;;;;;;AAAA;;;AAGC;AAeD;AACA;AACA;AACA;AACA;;AA4De,MAAMA,iBAAiBC,SAAA,CAAU;EAC9C,IAAIC,MAAAA,GAAkB;AACpB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,MAAM,IAAI,KAAA;AAC7B,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,kpBAAA,EA8BA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;qBAAAC,UAAA;QAAAC,IAAA;AAAAC,qBAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -15,6 +15,15 @@ let HdsModalColorValues = /*#__PURE__*/function (HdsModalColorValues) {
|
|
|
15
15
|
HdsModalColorValues["Critical"] = "critical";
|
|
16
16
|
return HdsModalColorValues;
|
|
17
17
|
}({});
|
|
18
|
+
/**
|
|
19
|
+
* Maps the Helios `@size` argument values to the corresponding
|
|
20
|
+
* `cds-modal` `size` attribute values.
|
|
21
|
+
*/
|
|
22
|
+
const HDS_MODAL_SIZE_TO_CDS = {
|
|
23
|
+
small: 'sm',
|
|
24
|
+
medium: 'md',
|
|
25
|
+
large: 'lg'
|
|
26
|
+
};
|
|
18
27
|
|
|
19
|
-
export { HdsModalColorValues, HdsModalSizeValues };
|
|
28
|
+
export { HDS_MODAL_SIZE_TO_CDS, HdsModalColorValues, HdsModalSizeValues };
|
|
20
29
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/modal/types.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2021, 2025\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsModalSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\nexport type HdsModalSizes = `${HdsModalSizeValues}`;\n\nexport enum HdsModalColorValues {\n Neutral = 'neutral',\n Warning = 'warning',\n Critical = 'critical',\n}\nexport type HdsModalColors = `${HdsModalColorValues}`;\n"],"names":["HdsModalSizeValues","HdsModalColorValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,IAAYA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,OAAA,CAAA,GAAA,OAAA;EAAlBA,kBAAkB,CAAA,QAAA,CAAA,GAAA,QAAA;EAAlBA,kBAAkB,CAAA,OAAA,CAAA,GAAA,OAAA;AAAA,EAAA,OAAlBA,kBAAkB;AAAA,CAAA,CAAA,EAAA;AAO9B,IAAYC,mBAAmB,0BAAnBA,mBAAmB,EAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA;EAAnBA,mBAAmB,CAAA,UAAA,CAAA,GAAA,UAAA;AAAA,EAAA,OAAnBA,mBAAmB;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/modal/types.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2021, 2025\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsModalSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\nexport type HdsModalSizes = `${HdsModalSizeValues}`;\n\nexport enum HdsModalColorValues {\n Neutral = 'neutral',\n Warning = 'warning',\n Critical = 'critical',\n}\nexport type HdsModalColors = `${HdsModalColorValues}`;\n\n/**\n * Maps the Helios `@size` argument values to the corresponding\n * `cds-modal` `size` attribute values.\n */\nexport const HDS_MODAL_SIZE_TO_CDS: Record<HdsModalSizes, 'sm' | 'md' | 'lg'> =\n {\n small: 'sm',\n medium: 'md',\n large: 'lg',\n };\n"],"names":["HdsModalSizeValues","HdsModalColorValues","HDS_MODAL_SIZE_TO_CDS","small","medium","large"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,IAAYA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,OAAA,CAAA,GAAA,OAAA;EAAlBA,kBAAkB,CAAA,QAAA,CAAA,GAAA,QAAA;EAAlBA,kBAAkB,CAAA,OAAA,CAAA,GAAA,OAAA;AAAA,EAAA,OAAlBA,kBAAkB;AAAA,CAAA,CAAA,EAAA;AAO9B,IAAYC,mBAAmB,0BAAnBA,mBAAmB,EAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA;EAAnBA,mBAAmB,CAAA,SAAA,CAAA,GAAA,SAAA;EAAnBA,mBAAmB,CAAA,UAAA,CAAA,GAAA,UAAA;AAAA,EAAA,OAAnBA,mBAAmB;AAAA,CAAA,CAAA,EAAA;AAO/B;AACA;AACA;AACA;AACO,MAAMC,qBAAgE,GAC3E;AACEC,EAAAA,KAAK,EAAE,IAAI;AACXC,EAAAA,MAAM,EAAE,IAAI;AACZC,EAAAA,KAAK,EAAE;AACT;;;;"}
|
package/dist/components.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export { default as HdsCdsAccordion } from './components/hds/cds-accordion/index.js';
|
|
2
|
+
export { default as HdsCdsAccordionItem } from './components/hds/cds-accordion/item.js';
|
|
3
|
+
export { default as HdsCdsBadge } from './components/hds/cds-badge/index.js';
|
|
4
|
+
export { default as HdsCdsButton } from './components/hds/cds-button/index.js';
|
|
5
|
+
export { default as HdsCdsLink } from './components/hds/cds-link/index.js';
|
|
6
|
+
export { default as HdsCdsModalBody } from './components/hds/cds-modal/body.js';
|
|
7
|
+
export { default as HdsCdsModalBodyContent } from './components/hds/cds-modal/body-content.js';
|
|
8
|
+
export { default as HdsCdsModalCloseButton } from './components/hds/cds-modal/close-button.js';
|
|
9
|
+
export { default as HdsCdsModalFooter } from './components/hds/cds-modal/footer.js';
|
|
10
|
+
export { default as HdsCdsModalFooterButton } from './components/hds/cds-modal/footer-button.js';
|
|
11
|
+
export { default as HdsCdsModalHeader } from './components/hds/cds-modal/header.js';
|
|
12
|
+
export { default as HdsCdsModalHeading } from './components/hds/cds-modal/heading.js';
|
|
13
|
+
export { default as HdsCdsModal } from './components/hds/cds-modal/index.js';
|
|
14
|
+
export { default as HdsCdsTextInput } from './components/hds/cds-text-input/index.js';
|
|
1
15
|
export { default as HdsAccordion } from './components/hds/accordion/index.js';
|
|
2
16
|
export { default as HdsAccordionItem } from './components/hds/accordion/item/index.js';
|
|
3
17
|
export { HdsAccordionForceStateValues, HdsAccordionItemTitleTagValues, HdsAccordionSizeValues, HdsAccordionTypeValues } from './components/hds/accordion/types.js';
|
|
@@ -165,7 +179,7 @@ export { default as HdsLinkInline } from './components/hds/link/inline.js';
|
|
|
165
179
|
export { default as HdsLinkStandalone } from './components/hds/link/standalone.js';
|
|
166
180
|
export { HdsLinkColorValues, HdsLinkIconPositionValues, HdsLinkStandaloneSizeValues } from './components/hds/link/types.js';
|
|
167
181
|
export { default as HdsModal } from './components/hds/modal/index.js';
|
|
168
|
-
export { HdsModalColorValues, HdsModalSizeValues } from './components/hds/modal/types.js';
|
|
182
|
+
export { HDS_MODAL_SIZE_TO_CDS, HdsModalColorValues, HdsModalSizeValues } from './components/hds/modal/types.js';
|
|
169
183
|
export { default as HdsPageHeader } from './components/hds/page-header/index.js';
|
|
170
184
|
export { default as HdsPageHeaderActions } from './components/hds/page-header/actions.js';
|
|
171
185
|
export { default as HdsPageHeaderBadges } from './components/hds/page-header/badges.js';
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -774,6 +774,14 @@
|
|
|
774
774
|
* Copyright IBM Corp. 2021, 2025
|
|
775
775
|
* SPDX-License-Identifier: MPL-2.0
|
|
776
776
|
*/
|
|
777
|
+
/**
|
|
778
|
+
* Copyright IBM Corp. 2021, 2025
|
|
779
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
780
|
+
*/
|
|
781
|
+
/**
|
|
782
|
+
* Copyright IBM Corp. 2021, 2025
|
|
783
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
784
|
+
*/
|
|
777
785
|
.hds-accordion {
|
|
778
786
|
display: flex;
|
|
779
787
|
flex-direction: column;
|
|
@@ -3565,6 +3573,10 @@ button.hds-button[href]::after {
|
|
|
3565
3573
|
* Copyright IBM Corp. 2021, 2025
|
|
3566
3574
|
* SPDX-License-Identifier: MPL-2.0
|
|
3567
3575
|
*/
|
|
3576
|
+
/**
|
|
3577
|
+
* Copyright IBM Corp. 2021, 2025
|
|
3578
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
3579
|
+
*/
|
|
3568
3580
|
.hds-code-block--theme-dark {
|
|
3569
3581
|
--hds-code-block-color-blue: #2d8eff;
|
|
3570
3582
|
--hds-code-block-color-cyan: #32fff7;
|