carbon-react 128.0.0 → 128.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/README.md +1 -1
- package/esm/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
- package/esm/__internal__/checkable-input/checkable-input.component.js +4 -2
- package/esm/__internal__/fieldset/fieldset.style.js +7 -6
- package/esm/__internal__/form-field/form-field.component.d.ts +1 -1
- package/esm/__internal__/form-field/form-field.component.js +1 -0
- package/esm/__internal__/label/label.style.js +6 -5
- package/esm/__spec_helper__/test-utils.d.ts +5 -9
- package/esm/__spec_helper__/test-utils.js +2 -0
- package/esm/components/alert/alert.component.d.ts +1 -1
- package/esm/components/alert/alert.component.js +3 -1
- package/esm/components/button-minor/button-minor.component.d.ts +1 -1
- package/esm/components/button-minor/button-minor.component.js +5 -1
- package/esm/components/checkbox/{checkbox-group.component.d.ts → checkbox-group/checkbox-group.component.d.ts} +3 -1
- package/esm/components/checkbox/{checkbox-group.component.js → checkbox-group/checkbox-group.component.js} +14 -11
- package/esm/components/checkbox/{checkbox-group.style.js → checkbox-group/checkbox-group.style.js} +5 -5
- package/esm/components/checkbox/checkbox.component.js +4 -1
- package/esm/components/checkbox/index.d.ts +2 -2
- package/esm/components/checkbox/index.js +1 -1
- package/esm/components/date-range/date-range.component.d.ts +5 -1
- package/esm/components/date-range/date-range.component.js +5 -1
- package/esm/components/decimal/decimal.component.d.ts +0 -2
- package/esm/components/decimal/decimal.component.js +1 -2
- package/esm/components/definition-list/{dd.component.js → dd/dd.component.js} +2 -2
- package/esm/components/definition-list/dl.component.js +13 -11
- package/esm/components/definition-list/{dt.component.js → dt/dt.component.js} +2 -2
- package/esm/components/definition-list/index.d.ts +4 -4
- package/esm/components/definition-list/index.js +2 -2
- package/esm/components/dialog/dialog.component.d.ts +3 -1
- package/esm/components/dialog/dialog.component.js +11 -3
- package/esm/components/dialog-full-screen/dialog-full-screen.component.d.ts +4 -1
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +7 -3
- package/esm/components/draggable/{internal → __internal__}/drop-target.component.js +1 -1
- package/esm/components/draggable/draggable-container.component.js +2 -2
- package/esm/components/draggable/{draggable-item.component.js → draggable-item/draggable-item.component.js} +1 -1
- package/{lib/components/draggable → esm/components/draggable/draggable-item}/draggable-item.style.d.ts +1 -1
- package/esm/components/draggable/{draggable-item.style.js → draggable-item/draggable-item.style.js} +2 -2
- package/esm/components/draggable/index.d.ts +2 -2
- package/esm/components/draggable/index.js +1 -1
- package/esm/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.js +5 -3
- package/esm/components/fieldset/fieldset.component.d.ts +8 -3
- package/esm/components/fieldset/fieldset.component.js +16 -2
- package/esm/components/fieldset/fieldset.style.d.ts +4 -0
- package/esm/components/fieldset/fieldset.style.js +29 -2
- package/esm/components/file-input/file-input.component.d.ts +4 -0
- package/esm/components/file-input/file-input.component.js +3 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.d.ts +0 -3
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +1 -4
- package/esm/components/flat-table/sort/sort.component.d.ts +1 -1
- package/esm/components/flat-table/sort/sort.component.js +1 -1
- package/esm/components/form/index.d.ts +1 -0
- package/esm/components/form/index.js +2 -1
- package/esm/components/form/required-fields-indicator/index.d.ts +1 -0
- package/esm/components/form/required-fields-indicator/index.js +1 -0
- package/esm/components/form/required-fields-indicator/required-fields-indicator.component.d.ts +7 -0
- package/esm/components/form/required-fields-indicator/required-fields-indicator.component.js +20 -0
- package/esm/components/hr/hr.component.d.ts +0 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/esm/components/inline-inputs/inline-inputs.component.js +13 -3
- package/esm/components/link/link.component.js +1 -16
- package/esm/components/modal/__internal__/modal-manager.js +2 -2
- package/esm/components/number/number.component.js +10 -1
- package/esm/components/numeral-date/numeral-date.component.d.ts +3 -1
- package/esm/components/numeral-date/numeral-date.component.js +4 -3
- package/esm/components/pager/__internal__/pager-navigation.component.d.ts +1 -1
- package/esm/components/pager/pager.component.d.ts +2 -2
- package/esm/components/popover-container/popover-container.component.d.ts +6 -2
- package/esm/components/popover-container/popover-container.component.js +11 -5
- package/esm/components/portal/portal.d.ts +1 -1
- package/esm/components/portal/portal.js +1 -1
- package/esm/components/preview/preview.component.d.ts +1 -0
- package/esm/components/radio-button/index.d.ts +3 -1
- package/esm/components/radio-button/index.js +1 -1
- package/esm/components/radio-button/{radio-button-group.component.d.ts → radio-button-group/radio-button-group.component.d.ts} +3 -1
- package/esm/components/radio-button/{radio-button-group.component.js → radio-button-group/radio-button-group.component.js} +17 -15
- package/esm/components/radio-button/radio-button.component.d.ts +1 -2
- package/esm/components/radio-button/radio-button.component.js +1 -3
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +4 -0
- package/esm/components/select/filterable-select/filterable-select.component.js +5 -0
- package/esm/components/select/multi-select/multi-select.component.d.ts +2 -0
- package/esm/components/select/multi-select/multi-select.component.js +5 -0
- package/esm/components/select/select-textbox/select-textbox.component.d.ts +2 -0
- package/esm/components/select/select-textbox/select-textbox.component.js +3 -0
- package/esm/components/select/simple-select/simple-select.component.d.ts +4 -0
- package/esm/components/select/simple-select/simple-select.component.js +6 -0
- package/esm/components/switch/switch.component.js +1 -0
- package/esm/components/text-editor/text-editor.component.d.ts +3 -1
- package/esm/components/text-editor/text-editor.component.js +16 -2
- package/esm/components/textarea/textarea.component.d.ts +2 -2
- package/esm/components/textarea/textarea.component.js +7 -2
- package/esm/components/textbox/textbox.component.d.ts +6 -2
- package/esm/components/textbox/textbox.component.js +8 -4
- package/esm/components/tile/flex-tile-divider/flex-tile-divider.component.d.ts +0 -1
- package/esm/components/tile-select/index.d.ts +2 -2
- package/esm/components/tile-select/index.js +1 -1
- package/{lib/components/tile-select → esm/components/tile-select/tile-select-group}/tile-select-group.component.d.ts +1 -1
- package/esm/components/tile-select/{tile-select-group.component.js → tile-select-group/tile-select-group.component.js} +4 -4
- package/esm/components/tile-select/tile-select.style.d.ts +1 -1
- package/esm/components/toast/toast.component.d.ts +3 -0
- package/esm/components/toast/toast.component.js +10 -3
- package/esm/components/vertical-divider/vertical-divider.component.d.ts +0 -1
- package/esm/components/vertical-menu/index.d.ts +6 -6
- package/esm/components/vertical-menu/index.js +3 -3
- package/{lib/components/vertical-menu → esm/components/vertical-menu/vertical-menu-full-screen}/vertical-menu-full-screen.component.d.ts +1 -1
- package/esm/components/vertical-menu/{vertical-menu-full-screen.component.js → vertical-menu-full-screen/vertical-menu-full-screen.component.js} +10 -10
- package/{lib/components/vertical-menu → esm/components/vertical-menu/vertical-menu-item}/vertical-menu-item.component.d.ts +2 -2
- package/esm/components/vertical-menu/{vertical-menu-item.component.js → vertical-menu-item/vertical-menu-item.component.js} +4 -4
- package/esm/components/vertical-menu/{vertical-menu-trigger.component.d.ts → vertical-menu-trigger/vertical-menu-trigger.component.d.ts} +1 -1
- package/esm/components/vertical-menu/{vertical-menu-trigger.component.js → vertical-menu-trigger/vertical-menu-trigger.component.js} +3 -3
- package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +0 -1
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.js +2 -2
- package/esm/locales/__internal__/es-es.d.ts +3 -0
- package/esm/locales/__internal__/es-es.js +193 -0
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
- package/lib/__internal__/checkable-input/checkable-input.component.js +4 -2
- package/lib/__internal__/fieldset/fieldset.style.js +7 -6
- package/lib/__internal__/form-field/form-field.component.d.ts +1 -1
- package/lib/__internal__/form-field/form-field.component.js +1 -0
- package/lib/__internal__/label/label.style.js +6 -5
- package/lib/__spec_helper__/test-utils.d.ts +5 -9
- package/lib/__spec_helper__/test-utils.js +2 -0
- package/lib/components/alert/alert.component.d.ts +1 -1
- package/lib/components/alert/alert.component.js +3 -1
- package/lib/components/button-minor/button-minor.component.d.ts +1 -1
- package/lib/components/button-minor/button-minor.component.js +5 -1
- package/lib/components/checkbox/{checkbox-group.component.d.ts → checkbox-group/checkbox-group.component.d.ts} +3 -1
- package/lib/components/checkbox/{checkbox-group.component.js → checkbox-group/checkbox-group.component.js} +14 -11
- package/lib/components/checkbox/{checkbox-group.style.js → checkbox-group/checkbox-group.style.js} +5 -5
- package/lib/components/checkbox/checkbox.component.js +4 -1
- package/lib/components/checkbox/index.d.ts +2 -2
- package/lib/components/checkbox/index.js +1 -1
- package/lib/components/date-range/date-range.component.d.ts +5 -1
- package/lib/components/date-range/date-range.component.js +5 -1
- package/lib/components/decimal/decimal.component.d.ts +0 -2
- package/lib/components/decimal/decimal.component.js +1 -2
- package/lib/components/definition-list/{dd.component.js → dd/dd.component.js} +2 -2
- package/lib/components/definition-list/dl.component.js +13 -11
- package/lib/components/definition-list/{dt.component.js → dt/dt.component.js} +2 -2
- package/lib/components/definition-list/index.d.ts +4 -4
- package/lib/components/definition-list/index.js +2 -2
- package/lib/components/dialog/dialog.component.d.ts +3 -1
- package/lib/components/dialog/dialog.component.js +11 -3
- package/lib/components/dialog-full-screen/dialog-full-screen.component.d.ts +4 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +7 -3
- package/lib/components/draggable/{internal → __internal__}/drop-target.component.js +1 -1
- package/lib/components/draggable/draggable-container.component.js +2 -2
- package/lib/components/draggable/{draggable-item.component.js → draggable-item/draggable-item.component.js} +1 -1
- package/{esm/components/draggable → lib/components/draggable/draggable-item}/draggable-item.style.d.ts +1 -1
- package/lib/components/draggable/{draggable-item.style.js → draggable-item/draggable-item.style.js} +2 -2
- package/lib/components/draggable/index.d.ts +2 -2
- package/lib/components/draggable/index.js +1 -1
- package/lib/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.js +5 -3
- package/lib/components/fieldset/fieldset.component.d.ts +8 -3
- package/lib/components/fieldset/fieldset.component.js +18 -2
- package/lib/components/fieldset/fieldset.style.d.ts +4 -0
- package/lib/components/fieldset/fieldset.style.js +31 -2
- package/lib/components/file-input/file-input.component.d.ts +4 -0
- package/lib/components/file-input/file-input.component.js +3 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.d.ts +0 -3
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +1 -4
- package/lib/components/flat-table/sort/sort.component.d.ts +1 -1
- package/lib/components/flat-table/sort/sort.component.js +2 -1
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/form/index.js +7 -0
- package/lib/components/form/required-fields-indicator/index.d.ts +1 -0
- package/lib/components/form/required-fields-indicator/index.js +13 -0
- package/lib/components/form/required-fields-indicator/package.json +6 -0
- package/lib/components/form/required-fields-indicator/required-fields-indicator.component.d.ts +7 -0
- package/lib/components/form/required-fields-indicator/required-fields-indicator.component.js +28 -0
- package/lib/components/hr/hr.component.d.ts +0 -1
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/lib/components/inline-inputs/inline-inputs.component.js +14 -4
- package/lib/components/link/link.component.js +1 -16
- package/lib/components/modal/__internal__/modal-manager.js +2 -2
- package/lib/components/number/number.component.js +10 -1
- package/lib/components/numeral-date/numeral-date.component.d.ts +3 -1
- package/lib/components/numeral-date/numeral-date.component.js +4 -3
- package/lib/components/pager/__internal__/pager-navigation.component.d.ts +1 -1
- package/lib/components/pager/pager.component.d.ts +2 -2
- package/lib/components/popover-container/popover-container.component.d.ts +6 -2
- package/lib/components/popover-container/popover-container.component.js +11 -5
- package/lib/components/portal/portal.d.ts +1 -1
- package/lib/components/portal/portal.js +2 -1
- package/lib/components/preview/preview.component.d.ts +1 -0
- package/lib/components/radio-button/index.d.ts +3 -1
- package/lib/components/radio-button/index.js +1 -1
- package/lib/components/radio-button/{radio-button-group.component.d.ts → radio-button-group/radio-button-group.component.d.ts} +3 -1
- package/lib/components/radio-button/{radio-button-group.component.js → radio-button-group/radio-button-group.component.js} +17 -15
- package/lib/components/radio-button/radio-button.component.d.ts +1 -2
- package/lib/components/radio-button/radio-button.component.js +1 -3
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +4 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +5 -0
- package/lib/components/select/multi-select/multi-select.component.d.ts +2 -0
- package/lib/components/select/multi-select/multi-select.component.js +5 -0
- package/lib/components/select/select-textbox/select-textbox.component.d.ts +2 -0
- package/lib/components/select/select-textbox/select-textbox.component.js +3 -0
- package/lib/components/select/simple-select/simple-select.component.d.ts +4 -0
- package/lib/components/select/simple-select/simple-select.component.js +6 -0
- package/lib/components/switch/switch.component.js +1 -0
- package/lib/components/text-editor/text-editor.component.d.ts +3 -1
- package/lib/components/text-editor/text-editor.component.js +16 -2
- package/lib/components/textarea/textarea.component.d.ts +2 -2
- package/lib/components/textarea/textarea.component.js +7 -2
- package/lib/components/textbox/textbox.component.d.ts +6 -2
- package/lib/components/textbox/textbox.component.js +9 -5
- package/lib/components/tile/flex-tile-divider/flex-tile-divider.component.d.ts +0 -1
- package/lib/components/tile-select/index.d.ts +2 -2
- package/lib/components/tile-select/index.js +1 -1
- package/{esm/components/tile-select → lib/components/tile-select/tile-select-group}/tile-select-group.component.d.ts +1 -1
- package/lib/components/tile-select/{tile-select-group.component.js → tile-select-group/tile-select-group.component.js} +4 -4
- package/lib/components/tile-select/tile-select.style.d.ts +1 -1
- package/lib/components/toast/toast.component.d.ts +3 -0
- package/lib/components/toast/toast.component.js +10 -3
- package/lib/components/vertical-divider/vertical-divider.component.d.ts +0 -1
- package/lib/components/vertical-menu/index.d.ts +6 -6
- package/lib/components/vertical-menu/index.js +3 -3
- package/{esm/components/vertical-menu → lib/components/vertical-menu/vertical-menu-full-screen}/vertical-menu-full-screen.component.d.ts +1 -1
- package/lib/components/vertical-menu/{vertical-menu-full-screen.component.js → vertical-menu-full-screen/vertical-menu-full-screen.component.js} +10 -10
- package/{esm/components/vertical-menu → lib/components/vertical-menu/vertical-menu-item}/vertical-menu-item.component.d.ts +2 -2
- package/lib/components/vertical-menu/{vertical-menu-item.component.js → vertical-menu-item/vertical-menu-item.component.js} +4 -4
- package/lib/components/vertical-menu/{vertical-menu-trigger.component.d.ts → vertical-menu-trigger/vertical-menu-trigger.component.d.ts} +1 -1
- package/lib/components/vertical-menu/{vertical-menu-trigger.component.js → vertical-menu-trigger/vertical-menu-trigger.component.js} +3 -3
- package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +0 -1
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +2 -2
- package/lib/locales/__internal__/es-es.d.ts +3 -0
- package/lib/locales/__internal__/es-es.js +199 -0
- package/package.json +30 -26
- package/esm/locales/__internal__/pl-pl.d.ts +0 -5
- package/esm/locales/__internal__/pl-pl.js +0 -231
- package/lib/locales/__internal__/pl-pl.d.ts +0 -5
- package/lib/locales/__internal__/pl-pl.js +0 -237
- /package/esm/components/checkbox/{checkbox-group.style.d.ts → checkbox-group/checkbox-group.style.d.ts} +0 -0
- /package/esm/components/definition-list/{dd.component.d.ts → dd/dd.component.d.ts} +0 -0
- /package/esm/components/definition-list/{dt.component.d.ts → dt/dt.component.d.ts} +0 -0
- /package/esm/components/draggable/{internal → __internal__}/drop-target.component.d.ts +0 -0
- /package/esm/components/draggable/{draggable-item.component.d.ts → draggable-item/draggable-item.component.d.ts} +0 -0
- /package/esm/components/radio-button/{radio-button-group.style.d.ts → radio-button-group/radio-button-group.style.d.ts} +0 -0
- /package/esm/components/radio-button/{radio-button-group.style.js → radio-button-group/radio-button-group.style.js} +0 -0
- /package/esm/components/vertical-menu/{vertical-menu-full-screen.context.d.ts → vertical-menu-full-screen/vertical-menu-full-screen.context.d.ts} +0 -0
- /package/esm/components/vertical-menu/{vertical-menu-full-screen.context.js → vertical-menu-full-screen/vertical-menu-full-screen.context.js} +0 -0
- /package/lib/components/checkbox/{checkbox-group.style.d.ts → checkbox-group/checkbox-group.style.d.ts} +0 -0
- /package/lib/components/definition-list/{dd.component.d.ts → dd/dd.component.d.ts} +0 -0
- /package/lib/components/definition-list/{dt.component.d.ts → dt/dt.component.d.ts} +0 -0
- /package/lib/components/draggable/{internal → __internal__}/drop-target.component.d.ts +0 -0
- /package/lib/components/draggable/{draggable-item.component.d.ts → draggable-item/draggable-item.component.d.ts} +0 -0
- /package/lib/components/radio-button/{radio-button-group.style.d.ts → radio-button-group/radio-button-group.style.d.ts} +0 -0
- /package/lib/components/radio-button/{radio-button-group.style.js → radio-button-group/radio-button-group.style.js} +0 -0
- /package/lib/components/vertical-menu/{vertical-menu-full-screen.context.d.ts → vertical-menu-full-screen/vertical-menu-full-screen.context.d.ts} +0 -0
- /package/lib/components/vertical-menu/{vertical-menu-full-screen.context.js → vertical-menu-full-screen/vertical-menu-full-screen.context.js} +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Carbon is a [React](https://react.dev/) component library developed by Sage.
|
|
|
4
4
|
|
|
5
5
|
## Getting started
|
|
6
6
|
|
|
7
|
-
Our [getting started guide](https://carbon.sage.com/?path=/
|
|
7
|
+
Our [getting started guide](https://carbon.sage.com/?path=/docs/getting-started-installation--docs) provides instructions on how to install and use the Carbon library.
|
|
8
8
|
|
|
9
9
|
## Examples
|
|
10
10
|
|
|
@@ -27,6 +27,8 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
27
27
|
labelWidth?: number;
|
|
28
28
|
/** Flag to configure component as mandatory */
|
|
29
29
|
required?: boolean;
|
|
30
|
+
/** Flag to configure component as optional. */
|
|
31
|
+
isOptional?: boolean;
|
|
30
32
|
/** If true the label switches position with the input */
|
|
31
33
|
reverse?: boolean;
|
|
32
34
|
/** Size of the component */
|
|
@@ -32,6 +32,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
32
32
|
onChange,
|
|
33
33
|
onFocus,
|
|
34
34
|
required,
|
|
35
|
+
isOptional,
|
|
35
36
|
reverse = false,
|
|
36
37
|
validationOnLabel,
|
|
37
38
|
warning,
|
|
@@ -53,7 +54,6 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
53
54
|
label,
|
|
54
55
|
fieldHelp
|
|
55
56
|
});
|
|
56
|
-
const isRadio = type === "radio";
|
|
57
57
|
const formFieldProps = {
|
|
58
58
|
disabled,
|
|
59
59
|
loading,
|
|
@@ -74,7 +74,8 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
74
74
|
validationIconId: validationId,
|
|
75
75
|
// We don't want an asterisk on each radio control, only the legend
|
|
76
76
|
// However, we still want the input element to receive the required prop
|
|
77
|
-
isRequired:
|
|
77
|
+
isRequired: required,
|
|
78
|
+
isOptional,
|
|
78
79
|
useValidationIcon: validationOnLabel
|
|
79
80
|
};
|
|
80
81
|
const inputProps = {
|
|
@@ -203,6 +204,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
203
204
|
"inputMode": PropTypes.oneOf(["decimal", "email", "none", "numeric", "search", "tel", "text", "url"]),
|
|
204
205
|
"inputWidth": PropTypes.number,
|
|
205
206
|
"is": PropTypes.string,
|
|
207
|
+
"isOptional": PropTypes.bool,
|
|
206
208
|
"itemID": PropTypes.string,
|
|
207
209
|
"itemProp": PropTypes.string,
|
|
208
210
|
"itemRef": PropTypes.string,
|
|
@@ -26,11 +26,10 @@ const StyledLegendContent = styled.span`
|
|
|
26
26
|
content: "*";
|
|
27
27
|
line-height: 24px;
|
|
28
28
|
color: var(--colorsSemanticNegative500);
|
|
29
|
-
font-weight:
|
|
30
|
-
margin-left: var(--
|
|
29
|
+
font-weight: var(--fontWeights700);
|
|
30
|
+
margin-left: var(--spacing050);
|
|
31
31
|
position: relative;
|
|
32
32
|
top: 1px;
|
|
33
|
-
left: -4px;
|
|
34
33
|
}
|
|
35
34
|
`}
|
|
36
35
|
|
|
@@ -39,8 +38,9 @@ const StyledLegendContent = styled.span`
|
|
|
39
38
|
}) => isOptional && css`
|
|
40
39
|
::after {
|
|
41
40
|
content: "(optional)";
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
color: var(--colorsUtilityYin055);
|
|
42
|
+
font-weight: var(--fontWeights400);
|
|
43
|
+
margin-left: var(--spacing050);
|
|
44
44
|
}
|
|
45
45
|
`}
|
|
46
46
|
|
|
@@ -58,7 +58,8 @@ const StyledLegend = styled.legend`
|
|
|
58
58
|
align-items: center;
|
|
59
59
|
margin-bottom: var(--spacing100);
|
|
60
60
|
padding: 0;
|
|
61
|
-
font-weight:
|
|
61
|
+
font-weight: var(--fontWeights700);
|
|
62
|
+
color: var(--colorsUtilityYin090);
|
|
62
63
|
${({
|
|
63
64
|
inline,
|
|
64
65
|
width,
|
|
@@ -53,7 +53,7 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
|
|
|
53
53
|
fieldHelpInline?: boolean;
|
|
54
54
|
/** Id of the element a label should be bound to */
|
|
55
55
|
id: string;
|
|
56
|
-
/**
|
|
56
|
+
/** Flag to configure component as optional in Form */
|
|
57
57
|
isOptional?: boolean;
|
|
58
58
|
/** Flag to configure component as mandatory */
|
|
59
59
|
isRequired?: boolean;
|
|
@@ -50,6 +50,7 @@ const FormField = ({
|
|
|
50
50
|
return Object.keys(validationProps).find(propName => validationProps[propName]);
|
|
51
51
|
}, [error, warning, info, disabled]);
|
|
52
52
|
!(invalidValidationProp === undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Prop \`${invalidValidationProp}\` cannot be used in conjunction with \`disabled\`. ` + "Use `readOnly` if you require users to see validations with a non-interactive field") : invariant(false) : void 0;
|
|
53
|
+
!!(isRequired && isOptional) ? process.env.NODE_ENV !== "production" ? invariant(false, "an input cannot be set to both required and optional at the same time") : invariant(false) : void 0;
|
|
53
54
|
const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
|
|
54
55
|
let inlineLabel = labelInline;
|
|
55
56
|
if (adaptiveLabelBreakpoint) {
|
|
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
const StyledLabel = styled.label`
|
|
3
3
|
color: var(--colorsUtilityYin090);
|
|
4
4
|
display: block;
|
|
5
|
-
font-weight:
|
|
5
|
+
font-weight: var(--fontWeights700);
|
|
6
6
|
|
|
7
7
|
${({
|
|
8
8
|
isRequired
|
|
@@ -10,8 +10,8 @@ const StyledLabel = styled.label`
|
|
|
10
10
|
::after {
|
|
11
11
|
content: "*";
|
|
12
12
|
color: var(--colorsSemanticNegative500);
|
|
13
|
-
font-weight:
|
|
14
|
-
margin-left: var(--
|
|
13
|
+
font-weight: var(--fontWeights700);
|
|
14
|
+
margin-left: var(--spacing050);
|
|
15
15
|
}
|
|
16
16
|
`}
|
|
17
17
|
|
|
@@ -51,8 +51,9 @@ export const StyledLabelContainer = styled.div`
|
|
|
51
51
|
}) => optional && css`
|
|
52
52
|
::after {
|
|
53
53
|
content: "(optional)";
|
|
54
|
-
font-weight:
|
|
55
|
-
margin-left:
|
|
54
|
+
font-weight: var(--fontWeights400);
|
|
55
|
+
margin-left: var(--spacing050);
|
|
56
|
+
color: var(--colorsUtilityYin055);
|
|
56
57
|
}
|
|
57
58
|
`}
|
|
58
59
|
`;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { ReactWrapper, ShallowWrapper } from "enzyme";
|
|
1
|
+
import { ReactWrapper } from "enzyme";
|
|
3
2
|
import { LayoutProps, FlexboxProps, BackgroundProps, PositionProps, GridProps } from "styled-system";
|
|
4
|
-
import { ReactTestRendererJSON } from "react-test-renderer";
|
|
5
3
|
import { mockMatchMedia } from "./mock-match-media";
|
|
6
4
|
declare const toCSSCase: (str: string) => string;
|
|
7
|
-
declare const assertStyleMatch:
|
|
8
|
-
[key: string]: string | number | undefined;
|
|
9
|
-
}, component: HTMLElement | ReactWrapper<Props, {}, import("react").Component<{}, {}, any>> | ShallowWrapper<Props, {}, import("react").Component<{}, {}, any>> | ReactTestRendererJSON | ReactTestRendererJSON[] | null, opts?: jest.Options) => void;
|
|
5
|
+
declare const assertStyleMatch: any;
|
|
10
6
|
declare const makeArrayKeys: (n: number) => number[];
|
|
11
7
|
declare const keyboard: Record<string, () => void>;
|
|
12
8
|
declare const simulate: {
|
|
@@ -14,10 +10,10 @@ declare const simulate: {
|
|
|
14
10
|
shiftKey: boolean;
|
|
15
11
|
} | undefined) => void>;
|
|
16
12
|
};
|
|
17
|
-
declare const listFrom: (wrapper: ReactWrapper) => ReactWrapper
|
|
18
|
-
declare const childrenFrom: (node: ReactWrapper) => ReactWrapper
|
|
13
|
+
declare const listFrom: (wrapper: ReactWrapper) => ReactWrapper;
|
|
14
|
+
declare const childrenFrom: (node: ReactWrapper) => ReactWrapper;
|
|
19
15
|
declare const hoverList: (wrapper: ReactWrapper) => (item: number) => void;
|
|
20
|
-
declare const click:
|
|
16
|
+
declare const click: unknown;
|
|
21
17
|
declare const selectedItemOf: (wrapper: ReactWrapper) => number;
|
|
22
18
|
declare const assertKeyboardTraversal: ({ num, nonSelectables, }: {
|
|
23
19
|
num: number;
|
|
@@ -11,6 +11,8 @@ const humpToDash = (acc, char) => `${acc}${isUpper(char) ? `-${char.toLowerCase(
|
|
|
11
11
|
const toCSSCase = str => {
|
|
12
12
|
return str.split("").reduce(humpToDash, "");
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
16
|
const assertStyleMatch = (styleSpec, component, opts) => {
|
|
15
17
|
Object.entries(styleSpec).forEach(([attr, value]) => {
|
|
16
18
|
expect(component).toHaveStyleRule(toCSSCase(attr), value, opts);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DialogProps } from "../dialog";
|
|
3
|
-
export declare const Alert: ({ children, size, topModalOverride, ...rest }: DialogProps) => React.JSX.Element;
|
|
3
|
+
export declare const Alert: ({ children, size, topModalOverride, closeButtonDataProps, ...rest }: DialogProps) => React.JSX.Element;
|
|
4
4
|
export default Alert;
|
|
@@ -6,11 +6,13 @@ export const Alert = ({
|
|
|
6
6
|
children,
|
|
7
7
|
size = "extra-small",
|
|
8
8
|
topModalOverride,
|
|
9
|
+
closeButtonDataProps,
|
|
9
10
|
...rest
|
|
10
11
|
}) => /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
11
12
|
"data-component": "alert",
|
|
12
13
|
role: "alertdialog",
|
|
13
14
|
size: size,
|
|
14
|
-
topModalOverride: topModalOverride
|
|
15
|
+
topModalOverride: topModalOverride,
|
|
16
|
+
closeButtonDataProps: closeButtonDataProps
|
|
15
17
|
}, rest), children);
|
|
16
18
|
export default Alert;
|
|
@@ -5,7 +5,7 @@ export interface ButtonMinorProps extends ButtonProps {
|
|
|
5
5
|
isInPassword?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const ButtonMinor: {
|
|
8
|
-
({ buttonType: buttonTypeProp, size: sizeProp, iconPosition: iconPositionProp, fullWidth: fullWidthProp, ...rest }: ButtonMinorProps): React.JSX.Element;
|
|
8
|
+
({ buttonType: buttonTypeProp, disabled, destructive, size: sizeProp, iconPosition: iconPositionProp, fullWidth: fullWidthProp, ...rest }: ButtonMinorProps): React.JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
export default ButtonMinor;
|
|
@@ -5,6 +5,8 @@ import StyledButtonMinor from "./button-minor.style";
|
|
|
5
5
|
import { ButtonBarContext } from "../button-bar/button-bar.component";
|
|
6
6
|
export const ButtonMinor = ({
|
|
7
7
|
buttonType: buttonTypeProp = "secondary",
|
|
8
|
+
disabled = false,
|
|
9
|
+
destructive = false,
|
|
8
10
|
size: sizeProp = "medium",
|
|
9
11
|
iconPosition: iconPositionProp = "before",
|
|
10
12
|
fullWidth: fullWidthProp = false,
|
|
@@ -25,7 +27,9 @@ export const ButtonMinor = ({
|
|
|
25
27
|
size: size,
|
|
26
28
|
fullWidth: fullWidth,
|
|
27
29
|
iconPosition: iconPosition,
|
|
28
|
-
buttonType: buttonType
|
|
30
|
+
buttonType: buttonType,
|
|
31
|
+
disabled: disabled,
|
|
32
|
+
destructive: destructive
|
|
29
33
|
}, rest));
|
|
30
34
|
};
|
|
31
35
|
ButtonMinor.displayName = "ButtonMinor";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
-
import { ValidationProps } from "
|
|
3
|
+
import { ValidationProps } from "../../../__internal__/validations";
|
|
4
4
|
export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
5
5
|
/** The content for the CheckboxGroup Legend */
|
|
6
6
|
legend?: string;
|
|
@@ -20,6 +20,8 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
20
20
|
labelSpacing?: 1 | 2;
|
|
21
21
|
/** Flag to configure component as mandatory */
|
|
22
22
|
required?: boolean;
|
|
23
|
+
/** Flag to configure component as optional. */
|
|
24
|
+
isOptional?: boolean;
|
|
23
25
|
/** Overrides the default tooltip */
|
|
24
26
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
25
27
|
/** When true, Checkboxes are in line */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import tagComponent from "
|
|
4
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
5
|
import StyledCheckboxGroup, { StyledHintText } from "./checkbox-group.style";
|
|
6
|
-
import Fieldset from "
|
|
7
|
-
import { filterStyledSystemMarginProps } from "
|
|
8
|
-
import { TooltipProvider } from "
|
|
9
|
-
import FormSpacingProvider from "
|
|
10
|
-
import { NewValidationContext } from "
|
|
11
|
-
import ValidationMessage from "
|
|
12
|
-
import Box from "../../
|
|
13
|
-
import { ErrorBorder } from "../../
|
|
6
|
+
import Fieldset from "../../../__internal__/fieldset";
|
|
7
|
+
import { filterStyledSystemMarginProps } from "../../../style/utils";
|
|
8
|
+
import { TooltipProvider } from "../../../__internal__/tooltip-provider";
|
|
9
|
+
import FormSpacingProvider from "../../../__internal__/form-spacing-provider";
|
|
10
|
+
import { NewValidationContext } from "../../carbon-provider/carbon-provider.component";
|
|
11
|
+
import ValidationMessage from "../../../__internal__/validation-message/validation-message.component";
|
|
12
|
+
import Box from "../../box";
|
|
13
|
+
import { ErrorBorder } from "../../textbox/textbox.style";
|
|
14
14
|
export const CheckboxGroupContext = /*#__PURE__*/React.createContext({});
|
|
15
15
|
export const CheckboxGroup = props => {
|
|
16
16
|
const {
|
|
@@ -23,6 +23,7 @@ export const CheckboxGroup = props => {
|
|
|
23
23
|
warning,
|
|
24
24
|
info,
|
|
25
25
|
required,
|
|
26
|
+
isOptional,
|
|
26
27
|
legendInline,
|
|
27
28
|
legendWidth,
|
|
28
29
|
legendAlign,
|
|
@@ -40,7 +41,8 @@ export const CheckboxGroup = props => {
|
|
|
40
41
|
error: error,
|
|
41
42
|
warning: warning,
|
|
42
43
|
info: info,
|
|
43
|
-
isRequired: required
|
|
44
|
+
isRequired: required,
|
|
45
|
+
isOptional: isOptional
|
|
44
46
|
}, tagComponent("checkboxgroup", props), {
|
|
45
47
|
blockGroupBehaviour: !(error || warning)
|
|
46
48
|
}, filterStyledSystemMarginProps(props)), legendHelp && /*#__PURE__*/React.createElement(StyledHintText, null, legendHelp), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -73,7 +75,8 @@ export const CheckboxGroup = props => {
|
|
|
73
75
|
error: error,
|
|
74
76
|
warning: warning,
|
|
75
77
|
info: info,
|
|
76
|
-
isRequired: required
|
|
78
|
+
isRequired: required,
|
|
79
|
+
isOptional: isOptional
|
|
77
80
|
}, tagComponent("checkboxgroup", props), {
|
|
78
81
|
blockGroupBehaviour: !(error || warning || info)
|
|
79
82
|
}, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
|
package/esm/components/checkbox/{checkbox-group.style.js → checkbox-group/checkbox-group.style.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import StyledFormField from "
|
|
3
|
-
import StyledIcon from "
|
|
4
|
-
import CheckboxStyle from "
|
|
5
|
-
import { StyledLabelContainer } from "
|
|
6
|
-
import StyledValidationIcon from "
|
|
2
|
+
import StyledFormField from "../../../__internal__/form-field/form-field.style";
|
|
3
|
+
import StyledIcon from "../../icon/icon.style";
|
|
4
|
+
import CheckboxStyle from "../checkbox.style";
|
|
5
|
+
import { StyledLabelContainer } from "../../../__internal__/label/label.style";
|
|
6
|
+
import StyledValidationIcon from "../../../__internal__/validations/validation-icon.style";
|
|
7
7
|
export const StyledHintText = styled.div`
|
|
8
8
|
margin-top: -4px;
|
|
9
9
|
margin-bottom: 8px;
|
|
@@ -6,7 +6,7 @@ import CheckableInput from "../../__internal__/checkable-input/checkable-input.c
|
|
|
6
6
|
import CheckboxSvg from "./checkbox-svg.component";
|
|
7
7
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
8
8
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
9
|
-
import { CheckboxGroupContext } from "./checkbox-group.component";
|
|
9
|
+
import { CheckboxGroupContext } from "./checkbox-group/checkbox-group.component";
|
|
10
10
|
import Logger from "../../__internal__/utils/logger";
|
|
11
11
|
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
12
12
|
import { NewValidationContext } from "../carbon-provider/carbon-provider.component";
|
|
@@ -30,6 +30,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
30
30
|
labelWidth,
|
|
31
31
|
adaptiveSpacingBreakpoint,
|
|
32
32
|
required,
|
|
33
|
+
isOptional,
|
|
33
34
|
error,
|
|
34
35
|
warning,
|
|
35
36
|
info,
|
|
@@ -84,6 +85,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
84
85
|
labelHelp,
|
|
85
86
|
labelSpacing,
|
|
86
87
|
required,
|
|
88
|
+
isOptional,
|
|
87
89
|
fieldHelpInline,
|
|
88
90
|
checked,
|
|
89
91
|
disabled,
|
|
@@ -225,6 +227,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
225
227
|
})]),
|
|
226
228
|
"inputWidth": PropTypes.number,
|
|
227
229
|
"is": PropTypes.string,
|
|
230
|
+
"isOptional": PropTypes.bool,
|
|
228
231
|
"itemID": PropTypes.string,
|
|
229
232
|
"itemProp": PropTypes.string,
|
|
230
233
|
"itemRef": PropTypes.string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as CheckboxGroup } from "./checkbox-group.component";
|
|
2
|
-
export type { CheckboxGroupProps } from "./checkbox-group.component";
|
|
1
|
+
export { default as CheckboxGroup } from "./checkbox-group/checkbox-group.component";
|
|
2
|
+
export type { CheckboxGroupProps } from "./checkbox-group/checkbox-group.component";
|
|
3
3
|
export { default as Checkbox } from "./checkbox.component";
|
|
4
4
|
export type { CheckboxProps } from "./checkbox.component";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as CheckboxGroup } from "./checkbox-group.component";
|
|
1
|
+
export { default as CheckboxGroup } from "./checkbox-group/checkbox-group.component";
|
|
2
2
|
export { default as Checkbox } from "./checkbox.component";
|
|
@@ -80,9 +80,13 @@ export interface DateRangeProps extends StyledDateRangeProps, MarginProps, TagPr
|
|
|
80
80
|
validationOnLabel?: boolean;
|
|
81
81
|
/** Overrides the default tooltip position */
|
|
82
82
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
83
|
+
/** Flag to configure component as mandatory. */
|
|
84
|
+
required?: boolean;
|
|
85
|
+
/** Flag to configure component as optional. */
|
|
86
|
+
isOptional?: boolean;
|
|
83
87
|
}
|
|
84
88
|
export declare const DateRange: {
|
|
85
|
-
({ endDateProps, id, labelsInline, name, onBlur, onChange, startDateProps, tooltipPosition, validationOnLabel, value, startRef, endRef, ...rest }: DateRangeProps): React.JSX.Element;
|
|
89
|
+
({ endDateProps, id, labelsInline, name, onBlur, onChange, startDateProps, tooltipPosition, validationOnLabel, value, startRef, endRef, required, isOptional, ...rest }: DateRangeProps): React.JSX.Element;
|
|
86
90
|
displayName: string;
|
|
87
91
|
};
|
|
88
92
|
export default DateRange;
|
|
@@ -24,6 +24,8 @@ export const DateRange = ({
|
|
|
24
24
|
value,
|
|
25
25
|
startRef,
|
|
26
26
|
endRef,
|
|
27
|
+
required,
|
|
28
|
+
isOptional,
|
|
27
29
|
...rest
|
|
28
30
|
}) => {
|
|
29
31
|
const l = useLocale();
|
|
@@ -186,7 +188,9 @@ export const DateRange = ({
|
|
|
186
188
|
onBlur: handleOnBlur,
|
|
187
189
|
onChange: onChangeCallback,
|
|
188
190
|
onKeyDown: ev => handleOnKeyDown(ev, propsKey),
|
|
189
|
-
...props
|
|
191
|
+
...props,
|
|
192
|
+
required,
|
|
193
|
+
isOptional
|
|
190
194
|
};
|
|
191
195
|
};
|
|
192
196
|
return /*#__PURE__*/React.createElement(StyledDateRange, _extends({}, tagComponent("date-range", rest), {
|
|
@@ -33,8 +33,6 @@ export interface DecimalProps extends Omit<CommonTextboxProps, "onChange" | "onB
|
|
|
33
33
|
precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
34
34
|
/** If true, the component will be read-only */
|
|
35
35
|
readOnly?: boolean;
|
|
36
|
-
/** Flag to configure component as mandatory */
|
|
37
|
-
required?: boolean;
|
|
38
36
|
/** The value of the input if it's used as a controlled component */
|
|
39
37
|
value?: string;
|
|
40
38
|
/** The locale string - default en */
|
|
@@ -20,7 +20,6 @@ const Decimal = /*#__PURE__*/React.forwardRef(({
|
|
|
20
20
|
id,
|
|
21
21
|
name,
|
|
22
22
|
allowEmptyValue = false,
|
|
23
|
-
required,
|
|
24
23
|
locale,
|
|
25
24
|
value,
|
|
26
25
|
inputRef,
|
|
@@ -177,7 +176,6 @@ const Decimal = /*#__PURE__*/React.forwardRef(({
|
|
|
177
176
|
onKeyPress: onKeyPress,
|
|
178
177
|
align: align,
|
|
179
178
|
readOnly: readOnly,
|
|
180
|
-
required: required,
|
|
181
179
|
inputWidth: inputWidth,
|
|
182
180
|
onChange: handleOnChange,
|
|
183
181
|
onBlur: handleOnBlur,
|
|
@@ -304,6 +302,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
304
302
|
"inputRef": PropTypes.func,
|
|
305
303
|
"inputWidth": PropTypes.number,
|
|
306
304
|
"is": PropTypes.string,
|
|
305
|
+
"isOptional": PropTypes.bool,
|
|
307
306
|
"itemID": PropTypes.string,
|
|
308
307
|
"itemProp": PropTypes.string,
|
|
309
308
|
"itemRef": PropTypes.string,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { StyledDd } from "
|
|
5
|
-
import DlContext from "
|
|
4
|
+
import { StyledDd } from "../definition-list.style";
|
|
5
|
+
import DlContext from "../__internal__/dl.context";
|
|
6
6
|
const Dd = ({
|
|
7
7
|
children,
|
|
8
8
|
...rest
|
|
@@ -10,16 +10,18 @@ const Dl = ({
|
|
|
10
10
|
ddTextAlign = "left",
|
|
11
11
|
asSingleColumn = false,
|
|
12
12
|
...rest
|
|
13
|
-
}) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/React.createElement(StyledDl, _extends({
|
|
15
|
+
w: w,
|
|
16
|
+
"data-component": "dl",
|
|
17
|
+
asSingleColumn: asSingleColumn
|
|
18
|
+
}, rest), /*#__PURE__*/React.createElement(DlContext.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
asSingleColumn,
|
|
21
|
+
dtTextAlign,
|
|
22
|
+
ddTextAlign
|
|
23
|
+
}
|
|
24
|
+
}, children));
|
|
25
|
+
};
|
|
24
26
|
Dl.displayName = "Dl";
|
|
25
27
|
export default Dl;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { StyledDt } from "
|
|
5
|
-
import DlContext from "
|
|
4
|
+
import { StyledDt } from "../definition-list.style";
|
|
5
|
+
import DlContext from "../__internal__/dl.context";
|
|
6
6
|
const Dt = ({
|
|
7
7
|
children,
|
|
8
8
|
...rest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { DlProps } from "./dl.component";
|
|
2
2
|
export { default as Dl } from "./dl.component";
|
|
3
|
-
export type { DtProps } from "./dt.component";
|
|
4
|
-
export { default as Dt } from "./dt.component";
|
|
5
|
-
export type { DdProps } from "./dd.component";
|
|
6
|
-
export { default as Dd } from "./dd.component";
|
|
3
|
+
export type { DtProps } from "./dt/dt.component";
|
|
4
|
+
export { default as Dt } from "./dt/dt.component";
|
|
5
|
+
export type { DdProps } from "./dd/dd.component";
|
|
6
|
+
export { default as Dd } from "./dd/dd.component";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as Dl } from "./dl.component";
|
|
2
|
-
export { default as Dt } from "./dt.component";
|
|
3
|
-
export { default as Dd } from "./dd.component";
|
|
2
|
+
export { default as Dt } from "./dt/dt.component";
|
|
3
|
+
export { default as Dd } from "./dd/dd.component";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ModalProps } from "../modal";
|
|
3
|
-
import { TagProps } from "../../__internal__/utils/helpers/tags
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { DialogSizes } from "./dialog.config";
|
|
5
5
|
import { CustomRefObject } from "../../__internal__/focus-trap";
|
|
6
6
|
declare const PADDING_VALUES: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
@@ -46,6 +46,8 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
46
46
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
47
47
|
/** Determines if the close icon is shown */
|
|
48
48
|
showCloseIcon?: boolean;
|
|
49
|
+
/** Data tag prop bag for close Button */
|
|
50
|
+
closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
|
|
49
51
|
/** Size of dialog, default size is 750px */
|
|
50
52
|
size?: DialogSizes;
|
|
51
53
|
/** Subtitle displayed at top of dialog */
|
|
@@ -4,6 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
5
5
|
import Modal from "../modal";
|
|
6
6
|
import Heading from "../heading";
|
|
7
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
7
8
|
import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
|
|
8
9
|
import { StyledDialog, StyledDialogTitle, StyledDialogContent, StyledDialogInnerContent } from "./dialog.style";
|
|
9
10
|
import { TOP_MARGIN } from "./dialog.config";
|
|
@@ -36,6 +37,7 @@ const Dialog = /*#__PURE__*/forwardRef(({
|
|
|
36
37
|
greyBackground = false,
|
|
37
38
|
focusableContainers,
|
|
38
39
|
topModalOverride,
|
|
40
|
+
closeButtonDataProps,
|
|
39
41
|
...rest
|
|
40
42
|
}, ref) => {
|
|
41
43
|
const locale = useLocale();
|
|
@@ -110,12 +112,14 @@ const Dialog = /*#__PURE__*/forwardRef(({
|
|
|
110
112
|
}, [centerDialog, open, height]);
|
|
111
113
|
const closeIcon = () => {
|
|
112
114
|
if (!showCloseIcon || !onCancel) return null;
|
|
113
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
114
|
-
"data-element": "close",
|
|
115
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
115
116
|
"aria-label": locale.dialog.ariaLabels.close(),
|
|
116
117
|
onClick: onCancel,
|
|
117
118
|
disabled: disableClose
|
|
118
|
-
},
|
|
119
|
+
}, tagComponent("close", {
|
|
120
|
+
"data-element": "close",
|
|
121
|
+
...closeButtonDataProps
|
|
122
|
+
})), /*#__PURE__*/React.createElement(Icon, {
|
|
119
123
|
type: "close"
|
|
120
124
|
}));
|
|
121
125
|
};
|
|
@@ -193,6 +197,10 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
193
197
|
"bespokeFocusTrap": PropTypes.func,
|
|
194
198
|
"children": PropTypes.node,
|
|
195
199
|
"className": PropTypes.string,
|
|
200
|
+
"closeButtonDataProps": PropTypes.shape({
|
|
201
|
+
"data-element": PropTypes.string,
|
|
202
|
+
"data-role": PropTypes.string
|
|
203
|
+
}),
|
|
196
204
|
"contentPadding": PropTypes.shape({
|
|
197
205
|
"p": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
|
|
198
206
|
"px": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ModalProps } from "../modal";
|
|
3
3
|
import { CustomRefObject } from "../../__internal__/focus-trap";
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
5
|
export interface DialogFullScreenProps extends ModalProps {
|
|
5
6
|
/** Prop to specify the aria-describedby property of the DialogFullscreen component */
|
|
6
7
|
"aria-describedby"?: string;
|
|
@@ -39,6 +40,8 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
39
40
|
pagesStyling?: boolean;
|
|
40
41
|
/** Determines if the close icon is shown */
|
|
41
42
|
showCloseIcon?: boolean;
|
|
43
|
+
/** Data tag prop bag for close Button */
|
|
44
|
+
closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
|
|
42
45
|
/** Subtitle displayed at top of dialog */
|
|
43
46
|
subtitle?: string;
|
|
44
47
|
/** Title displayed at top of dialog */
|
|
@@ -52,5 +55,5 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
52
55
|
/** A custom close event handler */
|
|
53
56
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
54
57
|
}
|
|
55
|
-
export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, ...rest }: DialogFullScreenProps) => React.JSX.Element;
|
|
58
|
+
export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, ...rest }: DialogFullScreenProps) => React.JSX.Element;
|
|
56
59
|
export default DialogFullScreen;
|
|
@@ -13,6 +13,7 @@ import Icon from "../icon";
|
|
|
13
13
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
14
14
|
import useIsStickyFooterForm from "../../hooks/__internal__/useIsStickyFooterForm";
|
|
15
15
|
import useModalAria from "../../hooks/__internal__/useModalAria/useModalAria";
|
|
16
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
16
17
|
export const DialogFullScreen = ({
|
|
17
18
|
"aria-describedby": ariaDescribedBy,
|
|
18
19
|
"aria-label": ariaLabel,
|
|
@@ -36,6 +37,7 @@ export const DialogFullScreen = ({
|
|
|
36
37
|
focusableContainers,
|
|
37
38
|
focusableSelectors,
|
|
38
39
|
topModalOverride,
|
|
40
|
+
closeButtonDataProps,
|
|
39
41
|
...rest
|
|
40
42
|
}) => {
|
|
41
43
|
const locale = useLocale();
|
|
@@ -51,11 +53,13 @@ export const DialogFullScreen = ({
|
|
|
51
53
|
const isTopModal = useModalAria(dialogRef);
|
|
52
54
|
const closeIcon = () => {
|
|
53
55
|
if (!showCloseIcon || !onCancel) return null;
|
|
54
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
55
|
-
"data-element": "close",
|
|
56
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
56
57
|
"aria-label": locale.dialogFullScreen.ariaLabels.close(),
|
|
57
58
|
onClick: onCancel
|
|
58
|
-
},
|
|
59
|
+
}, tagComponent("close", {
|
|
60
|
+
"data-element": "close",
|
|
61
|
+
...closeButtonDataProps
|
|
62
|
+
})), /*#__PURE__*/React.createElement(Icon, {
|
|
59
63
|
type: "close"
|
|
60
64
|
}));
|
|
61
65
|
};
|