@porsche-design-system/components-react 3.28.0-rc.2 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/cjs/lib/components/input-number.wrapper.cjs +29 -0
- package/cjs/public-api.cjs +2 -0
- package/esm/lib/components/index.d.ts +1 -0
- package/esm/lib/components/input-number.wrapper.d.ts +184 -0
- package/esm/lib/components/input-number.wrapper.mjs +27 -0
- package/esm/lib/types.d.ts +12 -2
- package/esm/public-api.mjs +1 -0
- package/package.json +5 -2
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +475 -371
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +0 -14
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/input-number.wrapper.cjs +40 -0
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/toast.wrapper.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs +22 -0
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-number.cjs +42 -0
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-password.cjs +8 -9
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select-option.cjs +12 -6
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.cjs +1 -3
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select-option.cjs +6 -5
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.cjs +2 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/state-message.cjs +6 -2
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/public-api.cjs +2 -0
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +442 -344
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -12
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/input-number.wrapper.mjs +38 -0
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/toast.wrapper.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/banner.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/button-group.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/button-pure.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/button-tile.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/button.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/canvas.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/checkbox-wrapper.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/checkbox.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/content-wrapper.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/crest.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/display.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/divider.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown-item.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown-link.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fieldset-wrapper.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fieldset.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flex-item.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flex.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/grid-item.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/grid.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/heading.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/headline.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/icon.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/inline-notification.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.mjs +20 -0
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-number.mjs +40 -0
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-password.mjs +8 -9
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select-option.mjs +13 -7
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.mjs +2 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select-option.mjs +6 -5
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.mjs +2 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/state-message.mjs +7 -3
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/public-api.mjs +1 -0
- package/ssr/esm/lib/components/index.d.ts +1 -0
- package/ssr/esm/lib/components/input-number.wrapper.d.ts +184 -0
- package/ssr/esm/lib/dsr-components/input-base.d.ts +31 -0
- package/ssr/esm/lib/dsr-components/input-number.d.ts +18 -0
- package/ssr/esm/lib/dsr-components/input-password.d.ts +5 -3
- package/ssr/esm/lib/dsr-components/multi-select.d.ts +0 -1
- package/ssr/esm/lib/dsr-components/select.d.ts +0 -1
- package/ssr/esm/lib/types.d.ts +12 -2
- package/tailwindcss/index.css +409 -0
|
@@ -3290,12 +3290,6 @@ const getListAriaAttributes = (label, isRequired, hasFilter, isOpen, multiple =
|
|
|
3290
3290
|
}),
|
|
3291
3291
|
};
|
|
3292
3292
|
};
|
|
3293
|
-
const getOptionAriaAttributes = (isSelected, isDisabled, isHidden, hasValue) => ({
|
|
3294
|
-
...(!isHidden && { 'aria-selected': isSelected ? 'true' : 'false' }),
|
|
3295
|
-
'aria-disabled': isDisabled ? 'true' : null,
|
|
3296
|
-
'aria-hidden': isHidden ? 'true' : null,
|
|
3297
|
-
'aria-label': hasValue ? null : 'Empty value',
|
|
3298
|
-
});
|
|
3299
3293
|
|
|
3300
3294
|
const borderWidthBase = '2px';
|
|
3301
3295
|
|
|
@@ -3449,10 +3443,6 @@ function debounce(fn, ms = 800) {
|
|
|
3449
3443
|
};
|
|
3450
3444
|
}
|
|
3451
3445
|
|
|
3452
|
-
const getRole = (state) => {
|
|
3453
|
-
return state === 'error' ? 'alert' : state === 'success' ? 'status' : null;
|
|
3454
|
-
};
|
|
3455
|
-
|
|
3456
3446
|
const isWithinForm = (host) => !!getClosestHTMLElement(host, 'form');
|
|
3457
3447
|
|
|
3458
3448
|
const getCDNBaseURL = () => global.PORSCHE_DESIGN_SYSTEM_CDN_URL + "/porsche-design-system";
|
|
@@ -3720,7 +3710,6 @@ const buildImgSrc = (innerManifest) => `${getCDNBaseURL()}/marque/${innerManifes
|
|
|
3720
3710
|
const getSvgUrl = (model) => {
|
|
3721
3711
|
return `${getCDNBaseURL()}/model-signatures/${MODEL_SIGNATURES_MANIFEST[model].src}`;
|
|
3722
3712
|
};
|
|
3723
|
-
const getSelectedOptions = (options) => options.filter((option) => option.selected);
|
|
3724
3713
|
const getSelectedOptionValues = (options) => options.filter((option) => option.selected).map((option) => option.value);
|
|
3725
3714
|
exports.ItemType = void 0;
|
|
3726
3715
|
(function (ItemType) {
|
|
@@ -3954,13 +3943,10 @@ exports.getIconColor = getIconColor;
|
|
|
3954
3943
|
exports.getInlineNotificationIconName = getInlineNotificationIconName;
|
|
3955
3944
|
exports.getInnerManifest = getInnerManifest;
|
|
3956
3945
|
exports.getListAriaAttributes = getListAriaAttributes;
|
|
3957
|
-
exports.getOptionAriaAttributes = getOptionAriaAttributes;
|
|
3958
|
-
exports.getRole = getRole;
|
|
3959
3946
|
exports.getSegmentedControlItemAriaAttributes = getSegmentedControlItemAriaAttributes;
|
|
3960
3947
|
exports.getSelectedOptionMap = getSelectedOptionMap;
|
|
3961
3948
|
exports.getSelectedOptionString = getSelectedOptionString;
|
|
3962
3949
|
exports.getSelectedOptionValues = getSelectedOptionValues;
|
|
3963
|
-
exports.getSelectedOptions = getSelectedOptions;
|
|
3964
3950
|
exports.getStepperHorizontalIconName = getStepperHorizontalIconName;
|
|
3965
3951
|
exports.getSvgUrl = getSvgUrl;
|
|
3966
3952
|
exports.getSwitchButtonAriaAttributes = getSwitchButtonAriaAttributes;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var hooks = require('../../hooks.cjs');
|
|
7
|
+
var utils = require('../../utils.cjs');
|
|
8
|
+
var inputNumber = require('../dsr-components/input-number.cjs');
|
|
9
|
+
|
|
10
|
+
const PInputNumber = /*#__PURE__*/ react.forwardRef(({ autoComplete = '', compact = false, controls = false, description = '', disabled = false, form, hideLabel = false, label = '', max, message = '', min, name, onBlur, onChange, onInput, placeholder = '', readOnly = false, required = false, state = 'none', step = 1, theme, value = '', className, children, ...rest }, ref) => {
|
|
11
|
+
const elementRef = react.useRef(undefined);
|
|
12
|
+
hooks.useEventCallback(elementRef, 'blur', onBlur);
|
|
13
|
+
hooks.useEventCallback(elementRef, 'change', onChange);
|
|
14
|
+
hooks.useEventCallback(elementRef, 'input', onInput);
|
|
15
|
+
const WebComponentTag = hooks.usePrefix('p-input-number');
|
|
16
|
+
const propsToSync = [autoComplete, compact, controls, description, disabled, form, hideLabel, label, max, message, min, name, placeholder, readOnly, required, state, step, theme || hooks.useTheme(), value];
|
|
17
|
+
hooks.useBrowserLayoutEffect(() => {
|
|
18
|
+
const { current } = elementRef;
|
|
19
|
+
['autoComplete', 'compact', 'controls', 'description', 'disabled', 'form', 'hideLabel', 'label', 'max', 'message', 'min', 'name', 'placeholder', 'readOnly', 'required', 'state', 'step', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
20
|
+
}, propsToSync);
|
|
21
|
+
const props = {
|
|
22
|
+
...rest,
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
...(!process.browser
|
|
25
|
+
? {
|
|
26
|
+
children: (jsxRuntime.jsx(inputNumber.DSRInputNumber, { autoComplete, compact, controls, description, disabled, form, hideLabel, label, max, message, min, name, placeholder, readOnly, required, state, step, theme: theme || hooks.useTheme(), value, children })),
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
children,
|
|
30
|
+
suppressHydrationWarning: true,
|
|
31
|
+
}),
|
|
32
|
+
'data-ssr': '',
|
|
33
|
+
class: hooks.useMergedClass(elementRef, className),
|
|
34
|
+
ref: utils.syncRef(elementRef, ref)
|
|
35
|
+
};
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
return jsxRuntime.jsx(WebComponentTag, { ...props });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.PInputNumber = PInputNumber;
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/toast.wrapper.cjs
CHANGED
|
@@ -19,7 +19,7 @@ const PToast = /*#__PURE__*/ react.forwardRef(({ theme, className, ...rest }, re
|
|
|
19
19
|
// @ts-ignore
|
|
20
20
|
...(!process.browser
|
|
21
21
|
? {
|
|
22
|
-
...{ "role": "status"
|
|
22
|
+
...{ "role": "status" },
|
|
23
23
|
children: (jsxRuntime.jsx(toast.DSRToast, { theme: theme || hooks.useTheme() })),
|
|
24
24
|
}
|
|
25
25
|
: {
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var splitChildren = require('../../splitChildren.cjs');
|
|
5
|
+
var label = require('./label.cjs');
|
|
6
|
+
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
|
|
7
|
+
var stateMessage = require('./state-message.cjs');
|
|
8
|
+
|
|
9
|
+
const InputBase = ({ children,
|
|
10
|
+
// host,
|
|
11
|
+
id, label: label$1, description, required, disabled, state, message, theme, readOnly, type, form, placeholder, maxLength, minLength, max, min, value, step, autoComplete, name,
|
|
12
|
+
// onInput,
|
|
13
|
+
onWheel,
|
|
14
|
+
// onChange,
|
|
15
|
+
// onBlur,
|
|
16
|
+
// refElement,
|
|
17
|
+
start, end, }) => {
|
|
18
|
+
const { namedSlotChildren } = splitChildren.splitChildren(children);
|
|
19
|
+
return (jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: !!label$1 || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: !!description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: label$1, description: description, htmlFor: id, isRequired: required, isDisabled: disabled }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("slot", { name: "start" }), start, jsxRuntime.jsx("input", { "aria-describedby": `${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-invalid": state === 'error' ? 'true' : null, id: id, onWheel: onWheel, name: name, form: form, type: type, required: required, placeholder: placeholder, maxLength: maxLength, minLength: minLength, max: max, min: min, step: step, value: value, readOnly: readOnly, autoComplete: autoComplete, disabled: disabled }), end, jsxRuntime.jsx("slot", { name: "end" })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(state), state: state, message: message, theme: theme, host: null })] }));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.InputBase = InputBase;
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-number.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
require('../../provider.cjs');
|
|
6
|
+
var splitChildren = require('../../splitChildren.cjs');
|
|
7
|
+
var minifyCss = require('../../minifyCss.cjs');
|
|
8
|
+
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
|
|
9
|
+
var buttonPure_wrapper = require('../components/button-pure.wrapper.cjs');
|
|
10
|
+
var inputBase = require('./input-base.cjs');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
14
|
+
* @slot {"name": "description", "description": "Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
15
|
+
* @slot {"name": "message", "description": "Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
16
|
+
* @slot {"name": "start", "description": "Shows content at the start of the input (e.g. unit prefix)."}
|
|
17
|
+
* @slot {"name": "end", "description": "Shows content at the end of the input (e.g. toggle button, unit suffix)."}
|
|
18
|
+
*/
|
|
19
|
+
class DSRInputNumber extends react.Component {
|
|
20
|
+
host;
|
|
21
|
+
// The "name" property is reflected as an attribute to ensure compatibility with native form submission.
|
|
22
|
+
// In the React wrapper, all props are synced as properties on the element ref, so reflecting "name" as an attribute ensures it is properly handled in the form submission process.
|
|
23
|
+
internals;
|
|
24
|
+
inputElement;
|
|
25
|
+
defaultValue;
|
|
26
|
+
formResetCallback() {
|
|
27
|
+
this.props.internals?.setFormValue(this.props.defaultValue);
|
|
28
|
+
}
|
|
29
|
+
formDisabledCallback() {
|
|
30
|
+
}
|
|
31
|
+
formStateRestoreCallback() {
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
splitChildren.splitChildren(this.props.children);
|
|
35
|
+
const style = minifyCss.minifyCss(stylesEntry.getInputNumberCss(this.props.disabled, this.props.hideLabel, this.props.state, this.props.compact, this.props.readOnly, this.props.theme, this.props.controls));
|
|
36
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(inputBase.InputBase, { children: this.props.children, host: null, label: this.props.label, description: this.props.description, id: "input-number", onWheel: (e) => (e.target).blur(), name: this.props.name, form: this.props.form, type: "number", required: this.props.required, placeholder: this.props.placeholder, max: this.props.max, min: this.props.min, value: this.props.value, readOnly: this.props.readOnly, autoComplete: this.props.autoComplete, disabled: this.props.disabled, state: this.props.state, message: this.props.message, theme: this.props.theme, step: this.props.step, ...(this.props.controls && {
|
|
37
|
+
end: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(buttonPure_wrapper.PButtonPure, { tabIndex: -1, hideLabel: true, theme: this.props.theme, className: "button", type: "button", icon: "minus", disabled: this.props.disabled || this.props.readOnly, children: ["Decrement value by ", this.props.step] }), jsxRuntime.jsxs(buttonPure_wrapper.PButtonPure, { tabIndex: -1, hideLabel: true, theme: this.props.theme, className: "button", type: "button", icon: "plus", disabled: this.props.disabled || this.props.readOnly, children: ["Increment value by ", this.props.step] })] })),
|
|
38
|
+
}) })] }), this.props.children] }));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.DSRInputNumber = DSRInputNumber;
|
|
@@ -6,15 +6,15 @@ require('../../provider.cjs');
|
|
|
6
6
|
var splitChildren = require('../../splitChildren.cjs');
|
|
7
7
|
var minifyCss = require('../../minifyCss.cjs');
|
|
8
8
|
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
|
|
9
|
-
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
|
|
10
9
|
var buttonPure_wrapper = require('../components/button-pure.wrapper.cjs');
|
|
11
|
-
var
|
|
12
|
-
var stateMessage = require('./state-message.cjs');
|
|
10
|
+
var inputBase = require('./input-base.cjs');
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
|
-
* @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."
|
|
16
|
-
* @slot {"name": "description", "description": "Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."
|
|
17
|
-
* @slot {"name": "message", "description": "Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."
|
|
13
|
+
* @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
14
|
+
* @slot {"name": "description", "description": "Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
15
|
+
* @slot {"name": "message", "description": "Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
16
|
+
* @slot {"name": "start", "description": "Shows content at the start of the input (e.g. unit prefix)."}
|
|
17
|
+
* @slot {"name": "end", "description": "Shows content at the end of the input (e.g. toggle button, unit suffix)."}
|
|
18
18
|
*/
|
|
19
19
|
class DSRInputPassword extends react.Component {
|
|
20
20
|
host;
|
|
@@ -32,10 +32,9 @@ class DSRInputPassword extends react.Component {
|
|
|
32
32
|
formStateRestoreCallback() {
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
|
-
|
|
36
|
-
const id = 'input-password';
|
|
35
|
+
splitChildren.splitChildren(this.props.children);
|
|
37
36
|
const style = minifyCss.minifyCss(stylesEntry.getInputPasswordCss(this.props.disabled, this.props.hideLabel, this.props.state, this.props.toggle, this.props.compact, this.props.readOnly, this.props.theme));
|
|
38
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.
|
|
37
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(inputBase.InputBase, { children: this.props.children, host: null, label: this.props.label, description: this.props.description, id: "input-password", name: this.props.name, form: this.props.form, type: this.props.showPassword ? 'text' : 'password', required: this.props.required, placeholder: this.props.placeholder, maxLength: this.props.maxLength, minLength: this.props.minLength, value: this.props.value, readOnly: this.props.readOnly, autoComplete: this.props.autoComplete, disabled: this.props.disabled, state: this.props.state, message: this.props.message, theme: this.props.theme, end: this.props.toggle && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { hideLabel: true, theme: this.props.theme, className: "button", type: "button", icon: this.props.showPassword ? 'view-off' : 'view', disabled: this.props.disabled, aria: { 'aria-pressed': this.props.showPassword ? 'true' : 'false' }, children: "Toggle password visibility" })) })] }), this.props.children] }));
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
require('../../provider.cjs');
|
|
6
4
|
var splitChildren = require('../../splitChildren.cjs');
|
|
5
|
+
var react = require('react');
|
|
7
6
|
var minifyCss = require('../../minifyCss.cjs');
|
|
8
7
|
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
|
|
9
8
|
|
|
@@ -14,10 +13,17 @@ class DSRMultiSelectOption extends react.Component {
|
|
|
14
13
|
host;
|
|
15
14
|
render() {
|
|
16
15
|
splitChildren.splitChildren(this.props.children);
|
|
17
|
-
const { theme = 'light', selected, highlighted } = this.props;
|
|
18
|
-
this.props.disabled || this.props.disabledParent;
|
|
19
|
-
minifyCss.minifyCss(stylesEntry.getMultiSelectOptionCss(theme));
|
|
20
|
-
return (jsxRuntime.
|
|
16
|
+
const { theme = 'light', selected: isSelected, highlighted, hidden } = this.props;
|
|
17
|
+
const isDisabled = this.props.disabled || this.props.disabledParent;
|
|
18
|
+
const style = minifyCss.minifyCss(stylesEntry.getMultiSelectOptionCss(theme, isDisabled, isSelected));
|
|
19
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } })
|
|
20
|
+
// TODO: get rid of ARIA sprouting and use `elementInternals` API when AXE-CORE supports it: https://github.com/dequelabs/axe-core/issues/4259
|
|
21
|
+
, "// TODO: get rid of ARIA sprouting and use `elementInternals` API when AXE-CORE supports it: https://github.com/dequelabs/axe-core/issues/4259", jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: Object.entries({
|
|
22
|
+
option: true,
|
|
23
|
+
'option--selected': isSelected,
|
|
24
|
+
'option--highlighted': highlighted,
|
|
25
|
+
'option--disabled': isDisabled,
|
|
26
|
+
}).map(([key, value]) => value && key).filter(Boolean).join(' '), children: [jsxRuntime.jsx("span", { className: "checkbox", "aria-hidden": "true" }), jsxRuntime.jsx("slot", { slot: "label" })] }) })] }), this.props.children] }));
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.cjs
CHANGED
|
@@ -25,7 +25,6 @@ class DSRMultiSelect extends react.Component {
|
|
|
25
25
|
// The "name" property is reflected as an attribute to ensure compatibility with native form submission.
|
|
26
26
|
// In the React wrapper, all props are synced as properties on the element ref, so reflecting "name" as an attribute ensures it is properly handled in the form submission process.
|
|
27
27
|
isOpen = false;
|
|
28
|
-
srHighlightedOptionText = '';
|
|
29
28
|
hasFilterResults = true;
|
|
30
29
|
internals;
|
|
31
30
|
defaultValue;
|
|
@@ -58,9 +57,8 @@ class DSRMultiSelect extends react.Component {
|
|
|
58
57
|
const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
|
|
59
58
|
const inputId = 'filter';
|
|
60
59
|
const popoverId = 'list';
|
|
61
|
-
const optionsSelectedId = 'options-selected';
|
|
62
60
|
const style = minifyCss.minifyCss(stylesEntry.getMultiSelectCss(this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.theme));
|
|
63
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: inputId, isRequired: this.props.required, isDisabled: this.props.disabled }),
|
|
61
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: inputId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsxRuntime.jsx("input", { id: inputId, role: "combobox", autoComplete: "off", disabled: this.props.disabled, required: this.props.required, "aria-invalid": this.props.state === 'error' ? 'true' : null }), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, "aria-hidden": "true" }), this.props.currentValue && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { type: "button", className: "button", icon: "close", hideLabel: true, theme: this.props.theme, disabled: this.props.disabled, children: "Reset selection" })), jsxRuntime.jsxs("div", { id: popoverId, popover: "manual", tabIndex: -1, children: [!this.props.hasFilterResults && (jsxRuntime.jsxs("div", { className: "no-results", role: "option", children: [jsxRuntime.jsx("span", { "aria-hidden": "true", children: "---" }), jsxRuntime.jsx("span", { className: "sr-only", children: "No results found" })] })), jsxRuntime.jsx("slot", {})] })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), this.props.children] }));
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select-option.cjs
CHANGED
|
@@ -6,7 +6,6 @@ require('../../provider.cjs');
|
|
|
6
6
|
var splitChildren = require('../../splitChildren.cjs');
|
|
7
7
|
var minifyCss = require('../../minifyCss.cjs');
|
|
8
8
|
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
|
|
9
|
-
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
|
|
10
9
|
var icon_wrapper = require('../components/icon.wrapper.cjs');
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -16,15 +15,17 @@ class DSRSelectOption extends react.Component {
|
|
|
16
15
|
host;
|
|
17
16
|
render() {
|
|
18
17
|
splitChildren.splitChildren(this.props.children);
|
|
19
|
-
const { theme = 'light', selected, highlighted, hidden } = this.props;
|
|
18
|
+
const { theme = 'light', selected: isSelected, highlighted, hidden } = this.props;
|
|
20
19
|
const isDisabled = this.props.disabled || this.props.disabledParent;
|
|
21
20
|
const style = minifyCss.minifyCss(stylesEntry.getSelectOptionCss(theme));
|
|
22
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } })
|
|
21
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } })
|
|
22
|
+
// TODO: get rid of ARIA sprouting and use `elementInternals` API when AXE-CORE supports it: https://github.com/dequelabs/axe-core/issues/4259
|
|
23
|
+
, "// TODO: get rid of ARIA sprouting and use `elementInternals` API when AXE-CORE supports it: https://github.com/dequelabs/axe-core/issues/4259", jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: Object.entries({
|
|
23
24
|
option: true,
|
|
24
|
-
'option--selected':
|
|
25
|
+
'option--selected': isSelected,
|
|
25
26
|
'option--highlighted': highlighted,
|
|
26
27
|
'option--disabled': isDisabled,
|
|
27
|
-
}
|
|
28
|
+
}).map(([key, value]) => value && key).filter(Boolean).join(' '), children: [jsxRuntime.jsx("slot", {}), isSelected && (jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", "aria-hidden": "true", name: "check", color: isDisabled ? 'state-disabled' : 'primary', theme: theme }))] }) })] }), this.props.children] }));
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.cjs
CHANGED
|
@@ -24,7 +24,6 @@ class DSRSelect extends react.Component {
|
|
|
24
24
|
// The "name" property is reflected as an attribute to ensure compatibility with native form submission.
|
|
25
25
|
// In the React wrapper, all props are synced as properties on the element ref, so reflecting "name" as an attribute ensures it is properly handled in the form submission process.
|
|
26
26
|
isOpen = false;
|
|
27
|
-
srHighlightedOptionText = '';
|
|
28
27
|
internals;
|
|
29
28
|
defaultValue;
|
|
30
29
|
buttonElement;
|
|
@@ -50,11 +49,10 @@ class DSRSelect extends react.Component {
|
|
|
50
49
|
const popoverId = 'list';
|
|
51
50
|
const descriptionId = this.props.description ? 'description' : undefined;
|
|
52
51
|
const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
|
|
53
|
-
const
|
|
54
|
-
const ariaDescribedBy = [descriptionId, selectMessageId, initialStatusId].filter(Boolean).join(' ');
|
|
52
|
+
const ariaDescribedBy = [descriptionId, selectMessageId].filter(Boolean).join(' ');
|
|
55
53
|
const selectedOption = utilsEntry.getSelectedOptionString(otherChildren);
|
|
56
54
|
const style = minifyCss.minifyCss(stylesEntry.getSelectCss(this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.compact, this.props.theme, !!this.props.slottedImagePath));
|
|
57
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, utilsEntry.labelId, ariaDescribedBy, popoverId), disabled: this.props.disabled, children: [this.props.slottedImagePath && jsxRuntime.jsx("img", { src: this.props.slottedImagePath, alt: "" }), jsxRuntime.jsx("span", { children: selectedOption }), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" })] }), jsxRuntime.jsx("div", { id: popoverId, popover: "manual", tabIndex: -1, ...utilsEntry.getListAriaAttributes(this.props.label, this.props.required, false, this.props.isOpen), children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })
|
|
55
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, utilsEntry.labelId, ariaDescribedBy, popoverId), disabled: this.props.disabled, children: [this.props.slottedImagePath && jsxRuntime.jsx("img", { src: this.props.slottedImagePath, alt: "" }), jsxRuntime.jsx("span", { children: selectedOption }), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" })] }), jsxRuntime.jsx("div", { id: popoverId, popover: "manual", tabIndex: -1, ...utilsEntry.getListAriaAttributes(this.props.label, this.props.required, false, this.props.isOpen), children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), this.props.children] }));
|
|
58
56
|
}
|
|
59
57
|
getSelectedOptionImagePath = (options) => {
|
|
60
58
|
return (options
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/state-message.cjs
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
require('react');
|
|
5
5
|
require('../../provider.cjs');
|
|
6
|
-
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
|
|
7
6
|
var icon_wrapper = require('../components/icon.wrapper.cjs');
|
|
8
7
|
|
|
9
8
|
const messageId = 'message';
|
|
10
9
|
const StateMessage = ({ hasMessage, state, message, theme }) => {
|
|
11
10
|
const isErrorState = state === 'error';
|
|
12
|
-
return (
|
|
11
|
+
return (
|
|
12
|
+
// needs to be rendered always to have correct behaviour for screen readers
|
|
13
|
+
jsxRuntime.jsx("span", { id: messageId, className: "message", role: state === 'success' ? 'status' : 'alert', children: hasMessage && [
|
|
14
|
+
jsxRuntime.jsx(icon_wrapper.PIcon, { name: isErrorState ? 'exclamation' : 'check', color: isErrorState ? 'notification-error' : 'notification-success', theme: theme, "aria-hidden": "true" }),
|
|
15
|
+
message || jsxRuntime.jsx("slot", { name: "message" }),
|
|
16
|
+
] }));
|
|
13
17
|
};
|
|
14
18
|
|
|
15
19
|
exports.StateMessage = StateMessage;
|
|
@@ -29,6 +29,7 @@ var heading_wrapper = require('./lib/components/heading.wrapper.cjs');
|
|
|
29
29
|
var headline_wrapper = require('./lib/components/headline.wrapper.cjs');
|
|
30
30
|
var icon_wrapper = require('./lib/components/icon.wrapper.cjs');
|
|
31
31
|
var inlineNotification_wrapper = require('./lib/components/inline-notification.wrapper.cjs');
|
|
32
|
+
var inputNumber_wrapper = require('./lib/components/input-number.wrapper.cjs');
|
|
32
33
|
var inputPassword_wrapper = require('./lib/components/input-password.wrapper.cjs');
|
|
33
34
|
var link_wrapper = require('./lib/components/link.wrapper.cjs');
|
|
34
35
|
var linkPure_wrapper = require('./lib/components/link-pure.wrapper.cjs');
|
|
@@ -115,6 +116,7 @@ exports.PHeading = heading_wrapper.PHeading;
|
|
|
115
116
|
exports.PHeadline = headline_wrapper.PHeadline;
|
|
116
117
|
exports.PIcon = icon_wrapper.PIcon;
|
|
117
118
|
exports.PInlineNotification = inlineNotification_wrapper.PInlineNotification;
|
|
119
|
+
exports.PInputNumber = inputNumber_wrapper.PInputNumber;
|
|
118
120
|
exports.PInputPassword = inputPassword_wrapper.PInputPassword;
|
|
119
121
|
exports.PLink = link_wrapper.PLink;
|
|
120
122
|
exports.PLinkPure = linkPure_wrapper.PLinkPure;
|