@pega/cosmos-react-core 10.0.0-build.4.2 → 10.0.0-build.4.21
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/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +44 -7
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.d.ts +6 -2
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +36 -18
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppNavigationPanel.js +1 -1
- package/lib/components/AppShell/AppNavigationPanel.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +27 -9
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +1 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +1 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.js +1 -1
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +3 -2
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +87 -48
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Badges/Selection.js +1 -1
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +3 -6
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.js +9 -1
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/components/ComboBox/ComboBoxInput.d.ts +0 -2
- package/lib/components/ComboBox/ComboBoxInput.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBoxInput.js +2 -2
- package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts +4 -6
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +96 -189
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.styles.d.ts +190 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.styles.d.ts.map +1 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.styles.js +72 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.styles.js.map +1 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts +0 -2
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +3 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +19 -12
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/utils.d.ts +8 -0
- package/lib/components/Currency/utils.d.ts.map +1 -1
- package/lib/components/Currency/utils.js +34 -4
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts +2 -2
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +29 -4
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +7 -7
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +8 -2
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +8 -8
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +2 -2
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.js +2 -2
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +3 -3
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js +12 -4
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +2 -2
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +6 -0
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +47 -0
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts +15 -4
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +24 -3
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Dialog/InfoDialogWrapper.d.ts +4 -0
- package/lib/components/Dialog/InfoDialogWrapper.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialogWrapper.js +13 -0
- package/lib/components/Dialog/InfoDialogWrapper.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts +5 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.js +85 -0
- package/lib/components/Dialog/TouchDialog.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.js +62 -0
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts +2 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js +3 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts +42 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.js +2 -0
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts +4 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.js +14 -0
- package/lib/components/Dialog/TouchInfoDialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +4 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +3 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +12 -7
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +28 -25
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +3 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +15 -6
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/CompactList.js +1 -1
- package/lib/components/File/CompactList.js.map +1 -1
- package/lib/components/File/FileItem.d.ts +38 -0
- package/lib/components/File/FileItem.d.ts.map +1 -1
- package/lib/components/File/FileItem.js +167 -23
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileList.d.ts.map +1 -1
- package/lib/components/File/FileList.js +6 -2
- package/lib/components/File/FileList.js.map +1 -1
- package/lib/components/File/index.d.ts +1 -1
- package/lib/components/File/index.d.ts.map +1 -1
- package/lib/components/File/index.js.map +1 -1
- package/lib/components/File/mimeTypes.json +1 -0
- package/lib/components/FormField/FormField.d.ts +9 -1
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +26 -10
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Icon/Icon.d.ts +5 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.js +44 -4
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -0
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +1 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/search-solid.icon.d.ts +1 -1
- package/lib/components/Icon/icons/search-solid.icon.js +3 -3
- package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamlineIconNames.d.ts +1 -0
- package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
- package/lib/components/Icon/streamlineIconNames.js +1 -0
- package/lib/components/Icon/streamlineIconNames.js.map +1 -1
- package/lib/components/Link/Link.d.ts +6 -13
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +1 -1
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +16 -5
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +33 -7
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts +25 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.js +168 -5
- package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts +2 -2
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js +48 -22
- package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +2 -2
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +5 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
- package/lib/components/MultiStepForm/VerticalFormProgress.d.ts +2 -2
- package/lib/components/MultiStepForm/VerticalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/VerticalFormProgress.js +45 -20
- package/lib/components/MultiStepForm/VerticalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts.map +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.js +17 -9
- package/lib/components/MultiStepForm/useFormProgressOverflow.js.map +1 -1
- package/lib/components/Number/utils.js +1 -1
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +1 -1
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/SelectionCard/SelectionCard.d.ts +1 -1
- package/lib/components/SelectionCard/SelectionCard.d.ts.map +1 -1
- package/lib/components/SelectionCard/SelectionCard.js +3 -3
- package/lib/components/SelectionCard/SelectionCard.js.map +1 -1
- package/lib/components/SelectionCard/SelectionCardDisplay.d.ts +5 -0
- package/lib/components/SelectionCard/SelectionCardDisplay.d.ts.map +1 -1
- package/lib/components/SelectionCard/SelectionCardDisplay.js +4 -2
- package/lib/components/SelectionCard/SelectionCardDisplay.js.map +1 -1
- package/lib/components/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/lib/components/SpeechToTextButton/SpeechToTextButton.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +8 -4
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +7 -21
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.styles.d.ts +0 -1
- package/lib/components/TextArea/TextArea.styles.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.styles.js +1 -2
- package/lib/components/TextArea/TextArea.styles.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +13 -9
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +13 -10
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +16 -12
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +13 -9
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +3 -3
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/theme.d.ts +48 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +26 -0
- package/lib/theme/themeOverrides.schema.json +36 -0
- package/lib/theme/themes/aurigaDarkTheme.json +54 -61
- package/lib/theme/themes/aurigaTheme.json +49 -56
- package/lib/theme/themes/virgoTheme.json +3 -3
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isTouchDevice.d.ts +3 -0
- package/lib/utils/isTouchDevice.d.ts.map +1 -0
- package/lib/utils/isTouchDevice.js +4 -0
- package/lib/utils/isTouchDevice.js.map +1 -0
- package/package.json +2 -2
|
@@ -63,6 +63,7 @@ export const StyledFormFieldInfo = styled.div(({ status, infoAbove, theme }) =>
|
|
|
63
63
|
`;
|
|
64
64
|
});
|
|
65
65
|
StyledFormFieldInfo.defaultProps = defaultThemeProp;
|
|
66
|
+
export const StyledHeadingLabel = styled(Text) ``;
|
|
66
67
|
export const StyledLabelRow = styled.div(({ inline }) => {
|
|
67
68
|
if (inline) {
|
|
68
69
|
return css `
|
|
@@ -96,14 +97,17 @@ export const StyledFormField = styled.div(props => {
|
|
|
96
97
|
flex-shrink: 0;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
> ${StyledLabel},
|
|
100
|
+
> :is(${StyledLabel}, ${StyledHeadingLabel}),
|
|
101
|
+
> ${StyledLabelRow}, > ${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})) {
|
|
100
102
|
&:not(:empty) {
|
|
101
103
|
margin-bottom: calc(0.25 * ${spacing});
|
|
102
104
|
min-height: ${hitAreaCompact};
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
> ${StyledLabel},
|
|
108
|
+
> :is(${StyledLabel}, ${StyledHeadingLabel}),
|
|
109
|
+
> ${StyledLabelRow} > :is(${StyledLabel}, ${StyledHeadingLabel}),
|
|
110
|
+
> ${StyledFlex} > :is(${StyledLabel}, ${StyledHeadingLabel}) {
|
|
107
111
|
${required &&
|
|
108
112
|
css `
|
|
109
113
|
&::after {
|
|
@@ -121,11 +125,11 @@ export const StyledFormField = styled.div(props => {
|
|
|
121
125
|
${asFieldset &&
|
|
122
126
|
showAdditionalInfo &&
|
|
123
127
|
css `
|
|
124
|
-
> ${StyledFlex} > ${StyledLabel} {
|
|
128
|
+
> ${StyledFlex} > :is(${StyledLabel}, ${StyledHeadingLabel}) {
|
|
125
129
|
display: block;
|
|
126
130
|
}
|
|
127
131
|
|
|
128
|
-
> ${StyledFlex}:has(> ${StyledLabel}) > ${StyledAdditionalInfo} {
|
|
132
|
+
> ${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})) > ${StyledAdditionalInfo} {
|
|
129
133
|
align-self: flex-start;
|
|
130
134
|
}
|
|
131
135
|
`}
|
|
@@ -137,7 +141,7 @@ export const StyledFormField = styled.div(props => {
|
|
|
137
141
|
grid-template-rows: auto 1fr;
|
|
138
142
|
align-items: start;
|
|
139
143
|
|
|
140
|
-
${StyledFlex}:has(> ${StyledLabel}), ${StyledFlex}:has(> ${StyledLabelRow}) {
|
|
144
|
+
${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})), ${StyledFlex}:has(> ${StyledLabelRow}) {
|
|
141
145
|
grid-row: span 2;
|
|
142
146
|
}
|
|
143
147
|
`}
|
|
@@ -163,7 +167,7 @@ const statusIconMap = { error: 'warn-solid', warning: 'diamond-minus', success:
|
|
|
163
167
|
const FormField = forwardRef(function FormField(props, ref) {
|
|
164
168
|
const uid = useUID();
|
|
165
169
|
const theme = useTheme();
|
|
166
|
-
const { testId, children: controlElement, id = uid, as = 'div', label, labelAs: labelAsProp = 'label', labelFor = id, labelId: labelIdProp, labelHidden = false, labelAfter = false, info, status, suppressAnnouncements, isRadioCheck, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = theme.components['form-field'].layout === 'inline', onClear, actions, container, additionalInfo, suggestion, 'aria-describedby': ariaDescribedBy, className, ...restProps } = props;
|
|
170
|
+
const { testId, children: controlElement, id = uid, as = 'div', label, labelAs: labelAsProp = 'label', labelFor = id, labelId: labelIdProp, labelHidden = false, labelAfter = false, labelVariant = 'default', info, status, suppressAnnouncements, isRadioCheck, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = theme.components['form-field'].layout === 'inline', onClear, actions, container, additionalInfo, suggestion, 'aria-describedby': ariaDescribedBy, className, ...restProps } = props;
|
|
167
171
|
const infoAbove = theme.components['form-field']['helper-text-position'] === 'above';
|
|
168
172
|
const testIds = useTestIds(testId, getFormFieldTestIds);
|
|
169
173
|
const asFieldset = as === 'fieldset' || (typeof as !== 'string' && 'target' in as && as.target === 'fieldset');
|
|
@@ -178,10 +182,22 @@ const FormField = forwardRef(function FormField(props, ref) {
|
|
|
178
182
|
const showAdditionalInfo = !!additionalInfo && !disabled && !labelHidden;
|
|
179
183
|
const labelInline = inline && !isRadioCheck && !labelHidden;
|
|
180
184
|
const labelId = asFieldset && !labelIdProp ? `${id}-label` : labelIdProp;
|
|
181
|
-
const labelContent = (_jsxs(_Fragment, { children: [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
const labelContent = (_jsxs(_Fragment, { children: [(() => {
|
|
186
|
+
const baseLabelProps = {
|
|
187
|
+
'data-testid': testIds.label,
|
|
188
|
+
children: label,
|
|
189
|
+
id: labelId,
|
|
190
|
+
htmlFor: labelAs === 'label' ? labelFor : undefined,
|
|
191
|
+
onClick: (e) => {
|
|
192
|
+
if (readOnly)
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
if (labelVariant === 'default' || labelHidden) {
|
|
197
|
+
return (_jsx(Label, { ...baseLabelProps, as: labelAs, labelHidden: labelHidden, inline: labelInline, ref: labelRef }));
|
|
198
|
+
}
|
|
199
|
+
return (_jsx(StyledHeadingLabel, { ...baseLabelProps, forwardedAs: labelAs, variant: labelVariant, ref: labelRef }));
|
|
200
|
+
})(), showAdditionalInfo && labelText && (_jsx(AdditionalInfo, { "data-testid": testIds.additionalInfo, heading: additionalInfo.heading, contextualLabel: labelText, children: additionalInfo.content }))] }));
|
|
185
201
|
let labelRow;
|
|
186
202
|
if (!isRadioCheck && !asFieldset && !labelHidden) {
|
|
187
203
|
labelRow = (_jsx(Flex, { as: StyledLabelRow, container: { justify: labelInline ? 'start' : 'between', alignItems: 'end' }, item: { alignSelf: labelInline ? 'start' : 'stretch', shrink: labelInline ? 0 : undefined }, inline: labelInline, children: labelContent }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,KAAK,EAAE,EAAE,WAA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AAQ,EACvC,CAAC,QAAQ,IAAI,SAAS,IAAI,WAAW,EACrC,OAAO,EACP,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EACrC,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,WAAW,EACtC,YAAY,IAAI,OAAO,IAAI,CAC1B,KAAC,iBAAiB,IAChB,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;gBACZ,CAAC,YAEA,CAAC,CAAC,iBAAiB,CAAC,GACH,CACrB,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { cloneElement, useEffect, forwardRef, useState, useRef, Children } from 'react';\nimport type { FC, ReactNode, ComponentType, ReactElement, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport AIButton from '../AIButton';\nimport { defaultThemeProp } from '../../theme';\nimport type { Action, ExcludeStrict, ForwardProps, OmitStrict, TestIdProp } from '../../types';\nimport Flex, { StyledFlex } from '../Flex';\nimport type { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport type { FormControlProps } from '../FormControl';\nimport { useConsolidatedRef, useI18n, useLiveLog, useTestIds, useTheme, useUID } from '../../hooks';\nimport Label, { StyledLabel } from '../Label';\nimport type { LabelProps } from '../Label';\nimport { calculateFontSize, getReadableStatusColor } from '../../styles';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { getFocusables, withTestIds, createClassName } from '../../utils';\nimport Button from '../Button';\nimport Text, { StyledText } from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as diamondMinusIcon from '../Icon/icons/diamond-minus.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as polarisSolidIcon from '../Icon/icons/polaris-solid.icon';\nimport AdditionalInfo, { StyledAdditionalInfo } from '../AdditionalInfo';\nimport { StyledRadioCheck, StyledRadioCheckInput } from '../RadioCheck/RadioCheck';\n\nimport { getFormFieldTestIds } from './FormField.test-ids';\nimport type { elements } from './FormField.test-ids';\n\nregisterIcon(warnSolidIcon, diamondMinusIcon, checkIcon, polarisSolidIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'>,\n TestIdProp<typeof elements> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default 'label'\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Property used to check whether input type is radio to handle styling for RadioCheck\n * @default false\n */\n isRadioCheck?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default 'div'\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: ExcludeStrict<FlexProps['container'], true>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n /** Id of additional describing element. */\n 'aria-describedby'?: string;\n /** Callback invoked when the clear button is clicked. If provided will render the clear button. */\n onClear?: () => void;\n /** Suppresses announcements for status changes. */\n suppressAnnouncements?: boolean;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(({\n theme,\n status\n}) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${getReadableStatusColor(theme, status)};\n vertical-align: baseline;\n `;\n});\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nconst StyledClearButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(${theme.base.spacing} / 2);\n align-self: start;\n `;\n});\n\nStyledClearButton.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<\n Pick<FormControlProps, 'status'> & { infoAbove?: boolean }\n>(({ status, infoAbove, theme }) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const infoFontSize = fontSizes.xxs;\n\n return css`\n font-size: ${infoFontSize};\n word-break: break-word;\n\n &:not(:empty) {\n ${infoAbove\n ? css`\n margin-block-end: calc(0.25 * ${spacing});\n `\n : css`\n margin-block-start: calc(0.25 * ${spacing});\n `}\n }\n\n ${status &&\n formField[status] &&\n css`\n color: ${getReadableStatusColor(theme, status)};\n `}\n `;\n});\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledLabelRow = styled.div<{ inline: boolean }>(({ inline }) => {\n if (inline) {\n return css`\n flex-shrink: 0;\n width: 14ch;\n ${StyledAdditionalInfo} {\n align-self: center;\n }\n `;\n }\n});\n\nexport const StyledFormField = styled.div<\n FormFieldProps & {\n asFieldset: boolean;\n showAdditionalInfo: boolean;\n labelInline?: boolean;\n }\n>(props => {\n const {\n asFieldset,\n showAdditionalInfo,\n disabled,\n required,\n labelInline,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing,\n 'hit-area': { 'compact-min': hitAreaCompact }\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n &:has(${StyledRadioCheckInput}:only-of-type) {\n ${StyledFormFieldInfo} {\n min-width: 100%;\n }\n }\n\n ${StyledFlex}:has(${StyledRadioCheck}) {\n flex-shrink: 0;\n }\n\n > ${StyledLabel}, > ${StyledLabelRow}, > ${StyledFlex}:has(> ${StyledLabel}) {\n &:not(:empty) {\n margin-bottom: calc(0.25 * ${spacing});\n min-height: ${hitAreaCompact};\n }\n }\n\n > ${StyledLabel}, > ${StyledLabelRow} > ${StyledLabel}, > ${StyledFlex} > ${StyledLabel} {\n ${required &&\n css`\n &::after {\n content: ${'\"\\\\00a0*\" / \"\"'};\n color: ${urgent};\n }\n `}\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n }\n\n ${asFieldset &&\n showAdditionalInfo &&\n css`\n > ${StyledFlex} > ${StyledLabel} {\n display: block;\n }\n\n > ${StyledFlex}:has(> ${StyledLabel}) > ${StyledAdditionalInfo} {\n align-self: flex-start;\n }\n `}\n\n ${labelInline &&\n css`\n display: grid;\n grid-template-columns: 14ch 1fr;\n grid-template-rows: auto 1fr;\n align-items: start;\n\n ${StyledFlex}:has(> ${StyledLabel}), ${StyledFlex}:has(> ${StyledLabelRow}) {\n grid-row: span 2;\n }\n `}\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst StyledSuggestionWrapper = styled(Flex)<Pick<FormControlProps, 'status'>>(({\n theme,\n status\n}) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: { 'form-control': formControl }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const infoFontSize = fontSizes.xxs;\n\n return css`\n ${StyledText} {\n ${(!status || status === 'pending') &&\n css`\n color: ${formControl['foreground-color']};\n font-size: ${infoFontSize};\n `}\n }\n `;\n});\n\nStyledSuggestionWrapper.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'diamond-minus', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(function FormField(\n props: PropsWithoutRef<FormFieldProps>,\n ref: Ref<HTMLElement>\n) {\n const uid = useUID();\n const theme = useTheme();\n const {\n testId,\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs: labelAsProp = 'label',\n labelFor = id,\n labelId: labelIdProp,\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n suppressAnnouncements,\n isRadioCheck,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = theme.components['form-field'].layout === 'inline',\n onClear,\n actions,\n container,\n additionalInfo,\n suggestion,\n 'aria-describedby': ariaDescribedBy,\n className,\n ...restProps\n } = props;\n\n const infoAbove = theme.components['form-field']['helper-text-position'] === 'above';\n const testIds = useTestIds(testId, getFormFieldTestIds);\n\n const asFieldset =\n as === 'fieldset' || (typeof as !== 'string' && 'target' in as && as.target === 'fieldset');\n const t = useI18n();\n const { announceAssertive } = useLiveLog();\n const labelAs = asFieldset ? 'span' : labelAsProp;\n const hasAutoInputSuggestion = status === 'pending' && !!suggestion && 'onReject' in suggestion;\n const hasSuggestion = hasAutoInputSuggestion || (!!suggestion && 'value' in suggestion);\n const consolidatedRef = useConsolidatedRef(ref);\n const labelRef = useRef<HTMLLabelElement | HTMLLegendElement>(null);\n const [labelText, setLabelText] = useState<string | null>(null);\n\n const showAdditionalInfo = !!additionalInfo && !disabled && !labelHidden;\n const labelInline = inline && !isRadioCheck && !labelHidden;\n const labelId = asFieldset && !labelIdProp ? `${id}-label` : labelIdProp;\n\n const labelContent = (\n <>\n <Label\n data-testid={testIds.label}\n id={labelId}\n as={labelAs}\n htmlFor={labelAs === 'label' ? labelFor : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={labelInline}\n ref={labelRef}\n >\n {label}\n </Label>\n\n {showAdditionalInfo && labelText && (\n <AdditionalInfo\n data-testid={testIds.additionalInfo}\n heading={additionalInfo.heading}\n contextualLabel={labelText}\n >\n {additionalInfo.content}\n </AdditionalInfo>\n )}\n </>\n );\n\n let labelRow: ReactNode;\n if (!isRadioCheck && !asFieldset && !labelHidden) {\n labelRow = (\n <Flex\n as={StyledLabelRow}\n container={{ justify: labelInline ? 'start' : 'between', alignItems: 'end' }}\n item={{ alignSelf: labelInline ? 'start' : 'stretch', shrink: labelInline ? 0 : undefined }}\n inline={labelInline}\n >\n {labelContent}\n </Flex>\n );\n } else if (asFieldset && !labelHidden) {\n labelRow = (\n <Flex\n container={{\n alignItems: 'end',\n justify: showAdditionalInfo && !isRadioCheck ? 'between' : undefined\n }}\n >\n {labelContent}\n </Flex>\n );\n } else {\n labelRow = labelContent;\n }\n\n useEffect(() => {\n setLabelText(labelRef.current?.textContent ?? null);\n }, [label]);\n\n useEffect(() => {\n if (suppressAnnouncements || (status !== 'error' && status !== 'warning')) return;\n\n let message = t(status);\n\n if (typeof info === 'string') message = `${message} ${info}`;\n\n if (labelRef.current?.textContent) message = `${labelRef.current?.textContent} ${message}`;\n\n announceAssertive({ message, type: status });\n }, [status, info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'];\n if (asFieldset || Children.count(controlElement) > 1) {\n content = controlElement;\n } else {\n const controlElementAriaDescribedBy = Children.only(controlElement).props[\n 'aria-describedby'\n ] as string | undefined;\n content = cloneElement(controlElement as ReactElement, {\n 'aria-describedby':\n [controlElementAriaDescribedBy, info && !readOnly ? `${id}-info` : undefined]\n .join(' ')\n .trim() || undefined\n });\n }\n\n if (actions) {\n content = (\n <Flex\n container={{ alignItems: 'center', gap: 0.5 }}\n item={{ grow: labelInline ? 1 : undefined }}\n >\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = (\n <Flex\n id={`${id}-info`}\n data-testid={testIds.info}\n status={status}\n as={StyledFormFieldInfo}\n container={{ alignItems: 'center', gap: 0.5 }}\n infoAbove={infoAbove}\n >\n {status && status !== 'pending' && (\n <>\n <Flex\n item={{ alignSelf: 'start' }}\n as={StyledStatusIcon}\n status={status}\n name={statusIconMap[status]}\n />\n <VisuallyHiddenText>{`${t(status)} `}</VisuallyHiddenText>\n </>\n )}\n {info}\n </Flex>\n );\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n if (hasSuggestion) {\n const focusables = getFocusables(consolidatedRef);\n infoContent = (\n <StyledFormFieldInfo\n data-testid={testIds.info}\n status={status}\n id={`${id}-info`}\n infoAbove={infoAbove}\n >\n {'value' in suggestion && (\n <StyledSuggestionWrapper container={{ alignItems: 'center', gap: 0.2 }} status={status}>\n <Icon size='font-size' name='polaris-solid' />{' '}\n <Text>{`${t('suggestion_suggested_value')}:`}</Text>\n <AIButton\n variant='link'\n icon={null}\n data-testid={testIds.suggestionAccept}\n onClick={() => {\n suggestion.onAccept();\n focusables[0]?.focus();\n }}\n label={suggestion.value}\n aria-label={`${t('accept_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n />\n </StyledSuggestionWrapper>\n )}\n {'onReject' in suggestion &&\n ('previousValue' in suggestion && suggestion.previousValue ? (\n <StyledSuggestionWrapper container={{ alignItems: 'center', gap: 0.2 }} status={status}>\n <Text>{`${t('suggestion_previous_value')}:`}</Text>\n <Button\n variant='link'\n data-testid={testIds.suggestionReject}\n onClick={() => {\n suggestion.onReject();\n focusables[0]?.focus();\n }}\n aria-label={`${t('reject_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n >\n {suggestion.previousValue}\n </Button>\n </StyledSuggestionWrapper>\n ) : (\n <AIButton\n variant='link'\n icon={null}\n data-testid={testIds.suggestionReject}\n onClick={() => {\n suggestion.onReject();\n focusables[0]?.focus();\n }}\n label={t('suggestion_clear')}\n aria-label={`${t('reject_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n />\n ))}\n\n <VisuallyHiddenText aria-live='polite'>{t('suggestion_assist')}</VisuallyHiddenText>\n </StyledFormFieldInfo>\n );\n }\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n const target = e.target as HTMLElement;\n if (!target.closest('button')) {\n e.preventDefault();\n suggestion?.onAccept();\n }\n }\n };\n\n const descriptionIds = [];\n if (ariaDescribedBy) descriptionIds.push(ariaDescribedBy);\n if (asFieldset && info) descriptionIds.push(`${id}-info`);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{\n direction: inline && !labelHidden ? 'row' : 'column',\n alignItems: inline && !labelHidden ? 'center' : undefined,\n wrap: isRadioCheck || inline ? 'wrap' : undefined,\n ...container\n }}\n as={StyledFormField}\n asFieldset={asFieldset}\n isRadioCheck={isRadioCheck}\n showAdditionalInfo={showAdditionalInfo}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n labelInline={labelInline}\n onKeyDown={hasAutoInputSuggestion ? onKeyDown : undefined}\n aria-describedby={descriptionIds.length ? descriptionIds.join(' ') : undefined}\n aria-labelledby={asFieldset ? labelId : undefined}\n ref={consolidatedRef}\n className={createClassName('form-field', className, { status })}\n >\n {(asFieldset || !labelAfter) && labelRow}\n {!readOnly && infoAbove && infoContent}\n {content}\n {!asFieldset && labelAfter && labelRow}\n {!readOnly && !infoAbove && infoContent}\n {isRadioCheck && onClear && (\n <StyledClearButton\n variant='link'\n onClick={() => {\n onClear();\n }}\n >\n {t('clear_selection')}\n </StyledClearButton>\n )}\n </Flex>\n );\n});\n\nexport default withTestIds(FormField, getFormFieldTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EA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EACd,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;gBACZ,CAAC,YAEA,CAAC,CAAC,iBAAiB,CAAC,GACH,CACrB,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { cloneElement, useEffect, forwardRef, useState, useRef, Children } from 'react';\nimport type {\n FC,\n MouseEvent,\n ReactNode,\n ComponentType,\n ReactElement,\n PropsWithoutRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport AIButton from '../AIButton';\nimport { defaultThemeProp } from '../../theme';\nimport type {\n Action,\n ExcludeStrict,\n ForwardProps,\n HeadingTag,\n OmitStrict,\n TestIdProp\n} from '../../types';\nimport Flex, { StyledFlex } from '../Flex';\nimport type { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport type { FormControlProps } from '../FormControl';\nimport { useConsolidatedRef, useI18n, useLiveLog, useTestIds, useTheme, useUID } from '../../hooks';\nimport Label, { StyledLabel } from '../Label';\nimport type { LabelProps } from '../Label';\nimport { calculateFontSize, getReadableStatusColor } from '../../styles';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { getFocusables, withTestIds, createClassName } from '../../utils';\nimport Button from '../Button';\nimport Text, { StyledText } from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as diamondMinusIcon from '../Icon/icons/diamond-minus.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as polarisSolidIcon from '../Icon/icons/polaris-solid.icon';\nimport AdditionalInfo, { StyledAdditionalInfo } from '../AdditionalInfo';\nimport { StyledRadioCheck, StyledRadioCheckInput } from '../RadioCheck/RadioCheck';\n\nimport { getFormFieldTestIds } from './FormField.test-ids';\nimport type { elements } from './FormField.test-ids';\n\nregisterIcon(warnSolidIcon, diamondMinusIcon, checkIcon, polarisSolidIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'>,\n TestIdProp<typeof elements> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default 'label'\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Sets the visual variant/styling of the label.\n * @default 'default'\n */\n labelVariant?: 'default' | HeadingTag;\n /**\n * Property used to check whether input type is radio to handle styling for RadioCheck\n * @default false\n */\n isRadioCheck?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default 'div'\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: ExcludeStrict<FlexProps['container'], true>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n /** Id of additional describing element. */\n 'aria-describedby'?: string;\n /** Callback invoked when the clear button is clicked. If provided will render the clear button. */\n onClear?: () => void;\n /** Suppresses announcements for status changes. */\n suppressAnnouncements?: boolean;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(({\n theme,\n status\n}) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${getReadableStatusColor(theme, status)};\n vertical-align: baseline;\n `;\n});\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nconst StyledClearButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(${theme.base.spacing} / 2);\n align-self: start;\n `;\n});\n\nStyledClearButton.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<\n Pick<FormControlProps, 'status'> & { infoAbove?: boolean }\n>(({ status, infoAbove, theme }) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const infoFontSize = fontSizes.xxs;\n\n return css`\n font-size: ${infoFontSize};\n word-break: break-word;\n\n &:not(:empty) {\n ${infoAbove\n ? css`\n margin-block-end: calc(0.25 * ${spacing});\n `\n : css`\n margin-block-start: calc(0.25 * ${spacing});\n `}\n }\n\n ${status &&\n formField[status] &&\n css`\n color: ${getReadableStatusColor(theme, status)};\n `}\n `;\n});\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledHeadingLabel = styled(Text)``;\n\nexport const StyledLabelRow = styled.div<{ inline: boolean }>(({ inline }) => {\n if (inline) {\n return css`\n flex-shrink: 0;\n width: 14ch;\n ${StyledAdditionalInfo} {\n align-self: center;\n }\n `;\n }\n});\n\nexport const StyledFormField = styled.div<\n FormFieldProps & {\n asFieldset: boolean;\n showAdditionalInfo: boolean;\n labelInline?: boolean;\n }\n>(props => {\n const {\n asFieldset,\n showAdditionalInfo,\n disabled,\n required,\n labelInline,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing,\n 'hit-area': { 'compact-min': hitAreaCompact }\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n &:has(${StyledRadioCheckInput}:only-of-type) {\n ${StyledFormFieldInfo} {\n min-width: 100%;\n }\n }\n\n ${StyledFlex}:has(${StyledRadioCheck}) {\n flex-shrink: 0;\n }\n\n > :is(${StyledLabel}, ${StyledHeadingLabel}),\n > ${StyledLabelRow}, > ${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})) {\n &:not(:empty) {\n margin-bottom: calc(0.25 * ${spacing});\n min-height: ${hitAreaCompact};\n }\n }\n\n > :is(${StyledLabel}, ${StyledHeadingLabel}),\n > ${StyledLabelRow} > :is(${StyledLabel}, ${StyledHeadingLabel}),\n > ${StyledFlex} > :is(${StyledLabel}, ${StyledHeadingLabel}) {\n ${required &&\n css`\n &::after {\n content: ${'\"\\\\00a0*\" / \"\"'};\n color: ${urgent};\n }\n `}\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n }\n\n ${asFieldset &&\n showAdditionalInfo &&\n css`\n > ${StyledFlex} > :is(${StyledLabel}, ${StyledHeadingLabel}) {\n display: block;\n }\n\n > ${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})) > ${StyledAdditionalInfo} {\n align-self: flex-start;\n }\n `}\n\n ${labelInline &&\n css`\n display: grid;\n grid-template-columns: 14ch 1fr;\n grid-template-rows: auto 1fr;\n align-items: start;\n\n ${StyledFlex}:has(> :is(${StyledLabel}, ${StyledHeadingLabel})), ${StyledFlex}:has(> ${StyledLabelRow}) {\n grid-row: span 2;\n }\n `}\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst StyledSuggestionWrapper = styled(Flex)<Pick<FormControlProps, 'status'>>(({\n theme,\n status\n}) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: { 'form-control': formControl }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const infoFontSize = fontSizes.xxs;\n\n return css`\n ${StyledText} {\n ${(!status || status === 'pending') &&\n css`\n color: ${formControl['foreground-color']};\n font-size: ${infoFontSize};\n `}\n }\n `;\n});\n\nStyledSuggestionWrapper.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'diamond-minus', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(function FormField(\n props: PropsWithoutRef<FormFieldProps>,\n ref: Ref<HTMLElement>\n) {\n const uid = useUID();\n const theme = useTheme();\n const {\n testId,\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs: labelAsProp = 'label',\n labelFor = id,\n labelId: labelIdProp,\n labelHidden = false,\n labelAfter = false,\n labelVariant = 'default',\n info,\n status,\n suppressAnnouncements,\n isRadioCheck,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = theme.components['form-field'].layout === 'inline',\n onClear,\n actions,\n container,\n additionalInfo,\n suggestion,\n 'aria-describedby': ariaDescribedBy,\n className,\n ...restProps\n } = props;\n\n const infoAbove = theme.components['form-field']['helper-text-position'] === 'above';\n const testIds = useTestIds(testId, getFormFieldTestIds);\n\n const asFieldset =\n as === 'fieldset' || (typeof as !== 'string' && 'target' in as && as.target === 'fieldset');\n const t = useI18n();\n const { announceAssertive } = useLiveLog();\n const labelAs = asFieldset ? 'span' : labelAsProp;\n const hasAutoInputSuggestion = status === 'pending' && !!suggestion && 'onReject' in suggestion;\n const hasSuggestion = hasAutoInputSuggestion || (!!suggestion && 'value' in suggestion);\n const consolidatedRef = useConsolidatedRef(ref);\n const labelRef = useRef<HTMLLabelElement | HTMLLegendElement>(null);\n const [labelText, setLabelText] = useState<string | null>(null);\n\n const showAdditionalInfo = !!additionalInfo && !disabled && !labelHidden;\n const labelInline = inline && !isRadioCheck && !labelHidden;\n const labelId = asFieldset && !labelIdProp ? `${id}-label` : labelIdProp;\n\n const labelContent = (\n <>\n {(() => {\n const baseLabelProps = {\n 'data-testid': testIds.label,\n children: label,\n id: labelId,\n htmlFor: labelAs === 'label' ? labelFor : undefined,\n onClick: (e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }\n };\n\n if (labelVariant === 'default' || labelHidden) {\n return (\n <Label\n {...baseLabelProps}\n as={labelAs}\n labelHidden={labelHidden}\n inline={labelInline}\n ref={labelRef}\n />\n );\n }\n\n return (\n <StyledHeadingLabel\n {...baseLabelProps}\n forwardedAs={labelAs}\n variant={labelVariant}\n ref={labelRef}\n />\n );\n })()}\n\n {showAdditionalInfo && labelText && (\n <AdditionalInfo\n data-testid={testIds.additionalInfo}\n heading={additionalInfo.heading}\n contextualLabel={labelText}\n >\n {additionalInfo.content}\n </AdditionalInfo>\n )}\n </>\n );\n\n let labelRow: ReactNode;\n if (!isRadioCheck && !asFieldset && !labelHidden) {\n labelRow = (\n <Flex\n as={StyledLabelRow}\n container={{ justify: labelInline ? 'start' : 'between', alignItems: 'end' }}\n item={{ alignSelf: labelInline ? 'start' : 'stretch', shrink: labelInline ? 0 : undefined }}\n inline={labelInline}\n >\n {labelContent}\n </Flex>\n );\n } else if (asFieldset && !labelHidden) {\n labelRow = (\n <Flex\n container={{\n alignItems: 'end',\n justify: showAdditionalInfo && !isRadioCheck ? 'between' : undefined\n }}\n >\n {labelContent}\n </Flex>\n );\n } else {\n labelRow = labelContent;\n }\n\n useEffect(() => {\n setLabelText(labelRef.current?.textContent ?? null);\n }, [label]);\n\n useEffect(() => {\n if (suppressAnnouncements || (status !== 'error' && status !== 'warning')) return;\n\n let message = t(status);\n\n if (typeof info === 'string') message = `${message} ${info}`;\n\n if (labelRef.current?.textContent) message = `${labelRef.current?.textContent} ${message}`;\n\n announceAssertive({ message, type: status });\n }, [status, info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'];\n if (asFieldset || Children.count(controlElement) > 1) {\n content = controlElement;\n } else {\n const controlElementAriaDescribedBy = Children.only(controlElement).props[\n 'aria-describedby'\n ] as string | undefined;\n content = cloneElement(controlElement as ReactElement, {\n 'aria-describedby':\n [controlElementAriaDescribedBy, info && !readOnly ? `${id}-info` : undefined]\n .join(' ')\n .trim() || undefined\n });\n }\n\n if (actions) {\n content = (\n <Flex\n container={{ alignItems: 'center', gap: 0.5 }}\n item={{ grow: labelInline ? 1 : undefined }}\n >\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = (\n <Flex\n id={`${id}-info`}\n data-testid={testIds.info}\n status={status}\n as={StyledFormFieldInfo}\n container={{ alignItems: 'center', gap: 0.5 }}\n infoAbove={infoAbove}\n >\n {status && status !== 'pending' && (\n <>\n <Flex\n item={{ alignSelf: 'start' }}\n as={StyledStatusIcon}\n status={status}\n name={statusIconMap[status]}\n />\n <VisuallyHiddenText>{`${t(status)} `}</VisuallyHiddenText>\n </>\n )}\n {info}\n </Flex>\n );\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n if (hasSuggestion) {\n const focusables = getFocusables(consolidatedRef);\n infoContent = (\n <StyledFormFieldInfo\n data-testid={testIds.info}\n status={status}\n id={`${id}-info`}\n infoAbove={infoAbove}\n >\n {'value' in suggestion && (\n <StyledSuggestionWrapper container={{ alignItems: 'center', gap: 0.2 }} status={status}>\n <Icon size='font-size' name='polaris-solid' />{' '}\n <Text>{`${t('suggestion_suggested_value')}:`}</Text>\n <AIButton\n variant='link'\n icon={null}\n data-testid={testIds.suggestionAccept}\n onClick={() => {\n suggestion.onAccept();\n focusables[0]?.focus();\n }}\n label={suggestion.value}\n aria-label={`${t('accept_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n />\n </StyledSuggestionWrapper>\n )}\n {'onReject' in suggestion &&\n ('previousValue' in suggestion && suggestion.previousValue ? (\n <StyledSuggestionWrapper container={{ alignItems: 'center', gap: 0.2 }} status={status}>\n <Text>{`${t('suggestion_previous_value')}:`}</Text>\n <Button\n variant='link'\n data-testid={testIds.suggestionReject}\n onClick={() => {\n suggestion.onReject();\n focusables[0]?.focus();\n }}\n aria-label={`${t('reject_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n >\n {suggestion.previousValue}\n </Button>\n </StyledSuggestionWrapper>\n ) : (\n <AIButton\n variant='link'\n icon={null}\n data-testid={testIds.suggestionReject}\n onClick={() => {\n suggestion.onReject();\n focusables[0]?.focus();\n }}\n label={t('suggestion_clear')}\n aria-label={`${t('reject_suggestion_button_a11y')}${labelText ? ` - ${labelText}` : ''}`}\n />\n ))}\n\n <VisuallyHiddenText aria-live='polite'>{t('suggestion_assist')}</VisuallyHiddenText>\n </StyledFormFieldInfo>\n );\n }\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n const target = e.target as HTMLElement;\n if (!target.closest('button')) {\n e.preventDefault();\n suggestion?.onAccept();\n }\n }\n };\n\n const descriptionIds = [];\n if (ariaDescribedBy) descriptionIds.push(ariaDescribedBy);\n if (asFieldset && info) descriptionIds.push(`${id}-info`);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{\n direction: inline && !labelHidden ? 'row' : 'column',\n alignItems: inline && !labelHidden ? 'center' : undefined,\n wrap: isRadioCheck || inline ? 'wrap' : undefined,\n ...container\n }}\n as={StyledFormField}\n asFieldset={asFieldset}\n isRadioCheck={isRadioCheck}\n showAdditionalInfo={showAdditionalInfo}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n labelInline={labelInline}\n onKeyDown={hasAutoInputSuggestion ? onKeyDown : undefined}\n aria-describedby={descriptionIds.length ? descriptionIds.join(' ') : undefined}\n aria-labelledby={asFieldset ? labelId : undefined}\n ref={consolidatedRef}\n className={createClassName('form-field', className, { status })}\n >\n {(asFieldset || !labelAfter) && labelRow}\n {!readOnly && infoAbove && infoContent}\n {content}\n {!asFieldset && labelAfter && labelRow}\n {!readOnly && !infoAbove && infoContent}\n {isRadioCheck && onClear && (\n <StyledClearButton\n variant='link'\n onClick={() => {\n onClear();\n }}\n >\n {t('clear_selection')}\n </StyledClearButton>\n )}\n </Flex>\n );\n});\n\nexport default withTestIds(FormField, getFormFieldTestIds);\n"]}
|
|
@@ -8,6 +8,11 @@ type BaseIconProps = NoChildrenProp & {
|
|
|
8
8
|
set?: string;
|
|
9
9
|
/** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */
|
|
10
10
|
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Sets fill style to inverse of theme.base['icon-fill'] if set, has no effect if theme setting is null.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
emphasized?: boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Background & svg size.
|
|
13
18
|
* @default "s" without background, "m" with background.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,aAAa,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,KAAK,EAAE,cAAc,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,aAAa,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,KAAK,EAAE,cAAc,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;AAO9E,KAAK,aAAa,GAAG,cAAc,GAAG;IACpC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,SAAS,GACjB,cAAc,CACZ,KAAK,EACL,aAAa,GAAG;IACd,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B,CACF,GACD,cAAc,CACZ,KAAK,EACL,aAAa,GAAG;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CACF,CAAC;AAEN,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACzB;AAID,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,UAAU,EAAE,SAUlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,GAAG,OAAO,UAAU,EAAE,SAUvD,CAAC;AAEF,eAAO,MAAM,UAAU;WAAuB,SAAS,CAAC,MAAM,CAAC;YAgD7D,CAAC;AAIH,eAAO,MAAM,eAAe;gBACd,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;iBACnC,SAAS,CAAC,YAAY,CAAC;WAC7B,SAAS,CAAC,MAAM,CAAC;YAChB,SAAS,CAAC,OAAO,CAAC;YAiE1B,CAAC;AAMH,QAAA,MAAM,IAAI,EA0JJ,yBAAyB,CAAC,SAAS,CAAC,CAAC;AAE3C,eAAe,IAAI,CAAC"}
|
|
@@ -4,6 +4,8 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import { useTheme } from '../../hooks';
|
|
5
5
|
import { defaultThemeProp } from '../../theme';
|
|
6
6
|
import { readableColor } from '../../styles';
|
|
7
|
+
import { set as budiconSet } from './iconNames';
|
|
8
|
+
import { set as streamlineSet } from './streamlineIconNames';
|
|
7
9
|
const iconRegistry = new Map([]);
|
|
8
10
|
export const registerIcon = (...icons) => {
|
|
9
11
|
icons.forEach(({ set: modSet, name, ...iconDef }) => {
|
|
@@ -128,9 +130,47 @@ export const StyledIconShape = styled.div(({ theme, background, foreground, size
|
|
|
128
130
|
});
|
|
129
131
|
StyledIconShape.defaultProps = defaultThemeProp;
|
|
130
132
|
const emptyIconDefinition = Object.freeze({ Component: () => null });
|
|
131
|
-
const Icon = forwardRef(function Icon({ set: setProp, name, size, 'aria-label': ariaLabel, role, ...restProps }, ref) {
|
|
132
|
-
const { base: { 'icon-set': setTheme } } = useTheme();
|
|
133
|
-
const set =
|
|
133
|
+
const Icon = forwardRef(function Icon({ set: setProp, name: nameProp, emphasized = false, size, 'aria-label': ariaLabel, role, ...restProps }, ref) {
|
|
134
|
+
const { base: { 'icon-set': setTheme, 'icon-fill': fillTheme } } = useTheme();
|
|
135
|
+
const set = (() => {
|
|
136
|
+
const preferredSet = setProp ?? setTheme ?? 'budicon';
|
|
137
|
+
if (preferredSet === 'budicon' && !budiconSet.has(nameProp) && streamlineSet.has(nameProp)) {
|
|
138
|
+
return 'streamline';
|
|
139
|
+
}
|
|
140
|
+
if (preferredSet === 'streamline' && !streamlineSet.has(nameProp) && budiconSet.has(nameProp)) {
|
|
141
|
+
return 'budicon';
|
|
142
|
+
}
|
|
143
|
+
return preferredSet;
|
|
144
|
+
})();
|
|
145
|
+
const fill = (() => {
|
|
146
|
+
if (!fillTheme || (fillTheme !== 'solid' && fillTheme !== 'hollow')) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
if (emphasized) {
|
|
150
|
+
return fillTheme === 'solid' ? 'hollow' : 'solid';
|
|
151
|
+
}
|
|
152
|
+
return fillTheme;
|
|
153
|
+
})();
|
|
154
|
+
const name = (() => {
|
|
155
|
+
if (!fill || (set !== 'budicon' && set !== 'streamline')) {
|
|
156
|
+
return nameProp;
|
|
157
|
+
}
|
|
158
|
+
const knownNames = set === 'budicon' ? budiconSet : streamlineSet;
|
|
159
|
+
const nameIsSolid = nameProp.endsWith('-solid');
|
|
160
|
+
if (nameIsSolid && fill === 'hollow') {
|
|
161
|
+
const hollowName = nameProp.replace(/-solid$/, '');
|
|
162
|
+
if (knownNames.has(hollowName)) {
|
|
163
|
+
return hollowName;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (!nameIsSolid && fill === 'solid') {
|
|
167
|
+
const solidName = `${nameProp}-solid`;
|
|
168
|
+
if (knownNames.has(solidName)) {
|
|
169
|
+
return solidName;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return nameProp;
|
|
173
|
+
})();
|
|
134
174
|
const [iconDef, setIconDef] = useState(iconRegistry.get(set)?.get(name) ?? emptyIconDefinition);
|
|
135
175
|
useEffect(() => {
|
|
136
176
|
if (iconRegistry.get(set)?.has(name)) {
|
|
@@ -178,7 +218,7 @@ const Icon = forwardRef(function Icon({ set: setProp, name, size, 'aria-label':
|
|
|
178
218
|
})();
|
|
179
219
|
return () => controller.abort();
|
|
180
220
|
}, [name, set]);
|
|
181
|
-
return typeof restProps.background === 'string' ? (_jsx(StyledIconShape, { ...restProps, background: restProps.background, foreground: restProps.foreground, shape: restProps.shape, size: size, ref: ref, children: _jsx(StyledIcon, { role: role ?? (ariaLabel === undefined ? 'presentation' : 'img'), "aria-label": ariaLabel, viewBox: iconDef.viewBox, "data-icon-name": name, children: _jsx(iconDef.Component, {}) }) })) : (_jsx(StyledIcon, { ...restProps, role: role ?? (ariaLabel === undefined ? 'presentation' : 'img'), "aria-label": ariaLabel, viewBox: iconDef.viewBox, size: size, "data-icon-name": name, ref: ref, children: _jsx(iconDef.Component, {}) }));
|
|
221
|
+
return typeof restProps.background === 'string' ? (_jsx(StyledIconShape, { ...restProps, background: restProps.background, foreground: restProps.foreground, shape: restProps.shape, size: size, ref: ref, children: _jsx(StyledIcon, { role: role ?? (ariaLabel === undefined ? 'presentation' : 'img'), "aria-label": ariaLabel, viewBox: iconDef.viewBox, "data-icon-set": set, "data-icon-name": name, children: _jsx(iconDef.Component, {}) }) })) : (_jsx(StyledIcon, { ...restProps, role: role ?? (ariaLabel === undefined ? 'presentation' : 'img'), "aria-label": ariaLabel, viewBox: iconDef.viewBox, size: size, "data-icon-set": set, "data-icon-name": name, ref: ref, children: _jsx(iconDef.Component, {}) }));
|
|
182
222
|
});
|
|
183
223
|
export default Icon;
|
|
184
224
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAsD7C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAsC,EAAE,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE;QAClD,MAAM,GAAG,GAAG,MAAM,IAAI,SAAS,CAAC;QAEhC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,C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,EAChC,UAAU,EAAE,SAAS,CAAC,UAAU,EAChC,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAA0B,YAE/B,KAAC,UAAU,IACT,IAAI,EAAE,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,gBACpD,SAAS,EACrB,OAAO,EAAE,OAAO,CAAC,OAAO,oBACR,IAAI,YAEpB,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,GACG,CACnB,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OACL,SAAS,EACb,IAAI,EAAE,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,gBACpD,SAAS,EACrB,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,IAAI,EAAE,IAAI,oBACM,IAAI,EACpB,GAAG,EAAE,GAAyB,YAE9B,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CAAyC,CAAC;AAE3C,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { Ref, PropsWithoutRef, ComponentType, ForwardRefExoticComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useTheme } from '../../hooks';\nimport type { NoChildrenProp, RefElement, WithAttributes } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { readableColor } from '../../styles';\n\ntype BaseIconProps = NoChildrenProp & {\n /**\n * The name of the icon set.\n * @default theme.base['icon-set']\n */\n set?: string;\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /**\n * Background & svg size.\n * @default \"s\" without background, \"m\" with background.\n */\n size?: 's' | 'm' | 'l' | 'font-size';\n};\n\nexport type IconProps =\n | WithAttributes<\n 'div',\n BaseIconProps & {\n /** Background color. */\n background: string;\n /**\n * Foreground color (svg fill).\n * Applies readable color off background if undefined.\n */\n foreground?: string;\n /**\n * Shape of the background.\n * @default 'square'\n */\n shape?: 'square' | 'circle';\n }\n >\n | WithAttributes<\n 'svg',\n BaseIconProps & {\n background?: never;\n foreground?: never;\n shape?: never;\n }\n >;\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n set?: IconProps['set'];\n name: IconProps['name'];\n}\n\nconst iconRegistry = new Map<string, Map<string, IconDefinition>>([]);\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ set: modSet, name, ...iconDef }) => {\n const set = modSet ?? 'budicon';\n\n if (!iconRegistry.has(set)) {\n iconRegistry.set(set, new Map([[name, iconDef]]));\n } else if (!iconRegistry.get(set)!.has(name)) {\n iconRegistry.get(set)!.set(name, iconDef);\n }\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ set: modSet, name, ...iconDef }) => {\n const set = modSet ?? 'budicon';\n\n if (!iconRegistry.has(set)) {\n iconRegistry.set(set, new Map([[name, iconDef]]));\n } else {\n iconRegistry.get(set)!.set(name, iconDef);\n }\n });\n};\n\nexport const StyledIcon = styled.svg<{ size?: IconProps['size'] }>(({ theme, size = 's' }) => {\n const {\n components: {\n icon: {\n size: { s, m, l }\n }\n }\n } = theme;\n return css`\n display: inline-block;\n fill: currentColor;\n vertical-align: middle;\n flex-shrink: 0;\n /* stylelint-disable unit-allowed-list */\n min-width: 14px;\n min-height: 14px;\n /* stylelint-enable unit-allowed-list */\n\n @media (forced-colors: active) {\n fill: CanvasText;\n }\n\n ${size === 's' &&\n css`\n width: ${s};\n height: ${s};\n `}\n\n ${size === 'm' &&\n css`\n width: ${m};\n height: ${m};\n `}\n\n ${size === 'l' &&\n css`\n width: ${l};\n height: ${l};\n `}\n\n ${size === 'font-size' &&\n css`\n min-height: 1em;\n min-width: 1em;\n width: 1em;\n height: 1em;\n `}\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledIconShape = styled.div<{\n background: NonNullable<IconProps['background']>;\n foreground?: IconProps['foreground'];\n size?: IconProps['size'];\n shape?: IconProps['shape'];\n}>(({ theme, background, foreground, size = 'm', shape = 'square' }) => {\n const readableFg = readableColor(background, { level: 'AANonText' });\n\n const {\n base: { 'border-radius': baseRadius },\n components: {\n icon: {\n size: { s, m, l },\n 'border-radius-multiplier': borderRadiusMultiplier\n }\n }\n } = theme;\n\n return css`\n color: ${foreground ?? readableFg};\n background-color: ${background};\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: clip;\n\n ${size === 's' &&\n css`\n width: ${s};\n height: ${s};\n `}\n\n ${size === 'm' &&\n css`\n width: ${m};\n height: ${m};\n `}\n\n ${size === 'l' &&\n css`\n width: ${l};\n height: ${l};\n `}\n\n ${size === 'font-size' &&\n css`\n width: 1em;\n height: 1em;\n `}\n\n ${shape === 'square' &&\n css`\n border-radius: calc(${borderRadiusMultiplier} * ${baseRadius});\n `}\n\n ${shape === 'circle' &&\n css`\n border-radius: 50%;\n `}\n\n ${StyledIcon} {\n width: 50%;\n height: 50%;\n /* stylelint-disable unit-allowed-list */\n min-width: min(14px, 90%);\n min-height: min(14px, 90%);\n /* stylelint-enable unit-allowed-list */\n }\n `;\n});\n\nStyledIconShape.defaultProps = defaultThemeProp;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon = forwardRef<RefElement<IconProps>, PropsWithoutRef<IconProps>>(function Icon(\n {\n set: setProp,\n name,\n size,\n 'aria-label': ariaLabel,\n role,\n ...restProps\n }: PropsWithoutRef<IconProps>,\n ref\n) {\n const {\n base: { 'icon-set': setTheme }\n } = useTheme();\n\n const set = setProp ?? setTheme ?? 'budicon';\n\n const [iconDef, setIconDef] = useState(iconRegistry.get(set)?.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.get(set)?.has(name)) {\n setIconDef(iconRegistry.get(set)!.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n\n (async () => {\n try {\n const encodedName = encodeURIComponent(name);\n let iconSet: string;\n let module: IconModule;\n\n switch (set) {\n case 'streamline':\n iconSet = 'streamline-icons';\n break;\n case 'budicon':\n iconSet = 'icons';\n break;\n default:\n throw new Error('Unknown icon');\n }\n\n // Different extensions are required for different build setups.\n try {\n module = await import(`./${iconSet}/${encodedName}.icon`);\n } catch {\n try {\n module = await import(`./${iconSet}/${encodedName}.icon.tsx`);\n } catch {\n module = await import(`./${iconSet}/${encodedName}.icon.js`);\n }\n }\n\n if (module.name !== name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n } catch {\n registerIcon({ set, name, ...emptyIconDefinition });\n }\n\n if (!controller.signal.aborted) {\n setIconDef(iconRegistry.get(set)!.get(name) ?? emptyIconDefinition);\n }\n })();\n\n return () => controller.abort();\n }, [name, set]);\n\n return typeof restProps.background === 'string' ? (\n <StyledIconShape\n {...restProps}\n background={restProps.background}\n foreground={restProps.foreground}\n shape={restProps.shape}\n size={size}\n ref={ref as Ref<HTMLDivElement>}\n >\n <StyledIcon\n role={role ?? (ariaLabel === undefined ? 'presentation' : 'img')}\n aria-label={ariaLabel}\n viewBox={iconDef.viewBox}\n data-icon-name={name}\n >\n <iconDef.Component />\n </StyledIcon>\n </StyledIconShape>\n ) : (\n <StyledIcon\n {...restProps}\n role={role ?? (ariaLabel === undefined ? 'presentation' : 'img')}\n aria-label={ariaLabel}\n viewBox={iconDef.viewBox}\n size={size}\n data-icon-name={name}\n ref={ref as Ref<SVGSVGElement>}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n}) as ForwardRefExoticComponent<IconProps>;\n\nexport default Icon;\n"]}
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE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AAe,OACV,SAAS,EACb,UAAU,EAAE,SAAS,CAAC,UAAU,EAChC,UAAU,EAAE,SAAS,CAAC,UAAU,EAChC,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAA0B,YAE/B,KAAC,UAAU,IACT,IAAI,EAAE,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,gBACpD,SAAS,EACrB,OAAO,EAAE,OAAO,CAAC,OAAO,mBACT,GAAG,oBACF,IAAI,YAEpB,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,GACG,CACnB,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OACL,SAAS,EACb,IAAI,EAAE,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,gBACpD,SAAS,EACrB,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,IAAI,EAAE,IAAI,mBACK,GAAG,oBACF,IAAI,EACpB,GAAG,EAAE,GAAyB,YAE9B,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CAAyC,CAAC;AAE3C,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { Ref, PropsWithoutRef, ComponentType, ForwardRefExoticComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useTheme } from '../../hooks';\nimport type { NoChildrenProp, RefElement, WithAttributes } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { readableColor } from '../../styles';\n\nimport { set as budiconSet } from './iconNames';\nimport { set as streamlineSet } from './streamlineIconNames';\n\ntype BaseIconProps = NoChildrenProp & {\n /**\n * The name of the icon set.\n * @default theme.base['icon-set']\n */\n set?: string;\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /**\n * Sets fill style to inverse of theme.base['icon-fill'] if set, has no effect if theme setting is null.\n * @default false\n */\n emphasized?: boolean;\n /**\n * Background & svg size.\n * @default \"s\" without background, \"m\" with background.\n */\n size?: 's' | 'm' | 'l' | 'font-size';\n};\n\nexport type IconProps =\n | WithAttributes<\n 'div',\n BaseIconProps & {\n /** Background color. */\n background: string;\n /**\n * Foreground color (svg fill).\n * Applies readable color off background if undefined.\n */\n foreground?: string;\n /**\n * Shape of the background.\n * @default 'square'\n */\n shape?: 'square' | 'circle';\n }\n >\n | WithAttributes<\n 'svg',\n BaseIconProps & {\n background?: never;\n foreground?: never;\n shape?: never;\n }\n >;\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n set?: IconProps['set'];\n name: IconProps['name'];\n}\n\nconst iconRegistry = new Map<string, Map<string, IconDefinition>>([]);\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ set: modSet, name, ...iconDef }) => {\n const set = modSet ?? 'budicon';\n\n if (!iconRegistry.has(set)) {\n iconRegistry.set(set, new Map([[name, iconDef]]));\n } else if (!iconRegistry.get(set)!.has(name)) {\n iconRegistry.get(set)!.set(name, iconDef);\n }\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ set: modSet, name, ...iconDef }) => {\n const set = modSet ?? 'budicon';\n\n if (!iconRegistry.has(set)) {\n iconRegistry.set(set, new Map([[name, iconDef]]));\n } else {\n iconRegistry.get(set)!.set(name, iconDef);\n }\n });\n};\n\nexport const StyledIcon = styled.svg<{ size?: IconProps['size'] }>(({ theme, size = 's' }) => {\n const {\n components: {\n icon: {\n size: { s, m, l }\n }\n }\n } = theme;\n return css`\n display: inline-block;\n fill: currentColor;\n vertical-align: middle;\n flex-shrink: 0;\n /* stylelint-disable unit-allowed-list */\n min-width: 14px;\n min-height: 14px;\n /* stylelint-enable unit-allowed-list */\n\n @media (forced-colors: active) {\n fill: CanvasText;\n }\n\n ${size === 's' &&\n css`\n width: ${s};\n height: ${s};\n `}\n\n ${size === 'm' &&\n css`\n width: ${m};\n height: ${m};\n `}\n\n ${size === 'l' &&\n css`\n width: ${l};\n height: ${l};\n `}\n\n ${size === 'font-size' &&\n css`\n min-height: 1em;\n min-width: 1em;\n width: 1em;\n height: 1em;\n `}\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledIconShape = styled.div<{\n background: NonNullable<IconProps['background']>;\n foreground?: IconProps['foreground'];\n size?: IconProps['size'];\n shape?: IconProps['shape'];\n}>(({ theme, background, foreground, size = 'm', shape = 'square' }) => {\n const readableFg = readableColor(background, { level: 'AANonText' });\n\n const {\n base: { 'border-radius': baseRadius },\n components: {\n icon: {\n size: { s, m, l },\n 'border-radius-multiplier': borderRadiusMultiplier\n }\n }\n } = theme;\n\n return css`\n color: ${foreground ?? readableFg};\n background-color: ${background};\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: clip;\n\n ${size === 's' &&\n css`\n width: ${s};\n height: ${s};\n `}\n\n ${size === 'm' &&\n css`\n width: ${m};\n height: ${m};\n `}\n\n ${size === 'l' &&\n css`\n width: ${l};\n height: ${l};\n `}\n\n ${size === 'font-size' &&\n css`\n width: 1em;\n height: 1em;\n `}\n\n ${shape === 'square' &&\n css`\n border-radius: calc(${borderRadiusMultiplier} * ${baseRadius});\n `}\n\n ${shape === 'circle' &&\n css`\n border-radius: 50%;\n `}\n\n ${StyledIcon} {\n width: 50%;\n height: 50%;\n /* stylelint-disable unit-allowed-list */\n min-width: min(14px, 90%);\n min-height: min(14px, 90%);\n /* stylelint-enable unit-allowed-list */\n }\n `;\n});\n\nStyledIconShape.defaultProps = defaultThemeProp;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon = forwardRef<RefElement<IconProps>, PropsWithoutRef<IconProps>>(function Icon(\n {\n set: setProp,\n name: nameProp,\n emphasized = false,\n size,\n 'aria-label': ariaLabel,\n role,\n ...restProps\n }: PropsWithoutRef<IconProps>,\n ref\n) {\n const {\n base: { 'icon-set': setTheme, 'icon-fill': fillTheme }\n } = useTheme();\n\n const set = (() => {\n const preferredSet = setProp ?? setTheme ?? 'budicon';\n\n if (preferredSet === 'budicon' && !budiconSet.has(nameProp) && streamlineSet.has(nameProp)) {\n return 'streamline';\n }\n\n if (preferredSet === 'streamline' && !streamlineSet.has(nameProp) && budiconSet.has(nameProp)) {\n return 'budicon';\n }\n\n return preferredSet;\n })();\n\n const fill = (() => {\n if (!fillTheme || (fillTheme !== 'solid' && fillTheme !== 'hollow')) {\n return null;\n }\n\n if (emphasized) {\n return fillTheme === 'solid' ? 'hollow' : 'solid';\n }\n\n return fillTheme;\n })();\n\n const name = (() => {\n if (!fill || (set !== 'budicon' && set !== 'streamline')) {\n return nameProp;\n }\n\n const knownNames = set === 'budicon' ? budiconSet : streamlineSet;\n\n const nameIsSolid = nameProp.endsWith('-solid');\n\n if (nameIsSolid && fill === 'hollow') {\n const hollowName = nameProp.replace(/-solid$/, '');\n\n if (knownNames.has(hollowName)) {\n return hollowName;\n }\n } else if (!nameIsSolid && fill === 'solid') {\n const solidName = `${nameProp}-solid`;\n\n if (knownNames.has(solidName)) {\n return solidName;\n }\n }\n\n return nameProp;\n })();\n\n const [iconDef, setIconDef] = useState(iconRegistry.get(set)?.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.get(set)?.has(name)) {\n setIconDef(iconRegistry.get(set)!.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n\n (async () => {\n try {\n const encodedName = encodeURIComponent(name);\n let iconSet: string;\n let module: IconModule;\n\n switch (set) {\n case 'streamline':\n iconSet = 'streamline-icons';\n break;\n case 'budicon':\n iconSet = 'icons';\n break;\n default:\n throw new Error('Unknown icon');\n }\n\n // Different extensions are required for different build setups.\n try {\n module = await import(`./${iconSet}/${encodedName}.icon`);\n } catch {\n try {\n module = await import(`./${iconSet}/${encodedName}.icon.tsx`);\n } catch {\n module = await import(`./${iconSet}/${encodedName}.icon.js`);\n }\n }\n\n if (module.name !== name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n } catch {\n registerIcon({ set, name, ...emptyIconDefinition });\n }\n\n if (!controller.signal.aborted) {\n setIconDef(iconRegistry.get(set)!.get(name) ?? emptyIconDefinition);\n }\n })();\n\n return () => controller.abort();\n }, [name, set]);\n\n return typeof restProps.background === 'string' ? (\n <StyledIconShape\n {...restProps}\n background={restProps.background}\n foreground={restProps.foreground}\n shape={restProps.shape}\n size={size}\n ref={ref as Ref<HTMLDivElement>}\n >\n <StyledIcon\n role={role ?? (ariaLabel === undefined ? 'presentation' : 'img')}\n aria-label={ariaLabel}\n viewBox={iconDef.viewBox}\n data-icon-set={set}\n data-icon-name={name}\n >\n <iconDef.Component />\n </StyledIcon>\n </StyledIconShape>\n ) : (\n <StyledIcon\n {...restProps}\n role={role ?? (ariaLabel === undefined ? 'presentation' : 'img')}\n aria-label={ariaLabel}\n viewBox={iconDef.viewBox}\n size={size}\n data-icon-set={set}\n data-icon-name={name}\n ref={ref as Ref<SVGSVGElement>}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n}) as ForwardRefExoticComponent<IconProps>;\n\nexport default Icon;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const iconNames: readonly ["1-1-solid", "1-1", "a11y", "ai-assist", "align-center", "align-item-center-solid", "align-item-center", "align-item-down-solid", "align-item-down", "align-item-left-solid", "align-item-left", "align-item-right-solid", "align-item-right", "align-item-up-solid", "align-item-up", "align-item-vert-center-solid", "align-item-vert-center", "align-left", "align-right", "amazon", "ambulance-solid", "ambulance", "analytics-bad-solid", "analytics-bad", "analytics-good-solid", "analytics-good", "analytics-neutral-solid", "analytics-neutral", "antenna", "app-solid", "app", "archery", "archive-solid", "archive", "arrow-above-or", "arrow-above-row-left", "arrow-above-row-right", "arrow-below-or", "arrow-below-row-left", "arrow-below-row-right", "arrow-bend-left", "arrow-bend-right", "arrow-between-column-down", "arrow-down-between-left-column", "arrow-down-between-right-column", "arrow-down-row", "arrow-down", "arrow-in", "arrow-left-column", "arrow-left-right", "arrow-left", "arrow-micro-down", "arrow-micro-left-right-reverse", "arrow-micro-left-right", "arrow-micro-left", "arrow-micro-right", "arrow-micro-up-down", "arrow-micro-up", "arrow-out", "arrow-right-between-rows", "arrow-right-column", "arrow-right", "arrow-up-down", "arrow-up-row", "arrow-up", "atom", "automation-call", "backspace-solid", "backspace", "badge-solid", "badge", "bank-solid", "bank", "bars", "battery-charge-solid", "battery-charge", "battery-solid", "battery", "bell-off-solid", "bell-off", "bell-solid", "bell", "blocks-solid", "blocks", "bluetooth", "bolt-solid", "bolt", "book-open-solid", "book-open", "book-solid", "book", "bookmark-solid", "bookmark", "bounding-box-solid", "bounding-box", "box-3-solid", "box-3", "box-4-solid", "box-4", "box-crosshair", "box-dashed-labeled-solid", "box-dashed-labeled", "box-grid", "box-lines-2-solid", "box-lines-2", "box", "brain", "branch", "browser-solid", "browser", "bug-solid", "bug", "building-2-solid", "building-2", "building-3-solid", "building-3", "building-solid", "building", "bulb-solid", "bulb", "calculator-solid", "calculator", "calendar-empty-solid", "calendar-empty", "calendar-now", "calendar-plus-solid", "calendar-plus", "calendar-range", "calendar-solid", "calendar", "camera-solid", "camera", "cancel", "car-solid", "car", "card-stack-solid", "card-stack", "caret-2-left", "caret-2-right", "caret-down", "caret-left", "caret-right", "caret-up", "carrot", "cart-close-solid", "cart-close", "cart-solid", "cart", "case-medical-solid", "case-medical", "case-solid", "case", "chain-solid", "chain-up", "chain", "chat-help-solid", "chat-help", "chat-sentiment-solid", "chat-sentiment", "chat-solid", "chat-typing-solid", "chat-typing", "chat", "chats-ai", "chats-solid", "chats", "check-solid", "check", "checkbook", "chevron-solid", "chevron", "church-solid", "church", "circle-mixed-down", "circle-mixed-left", "circle-mixed-up", "circle-solid", "circle-stacked-mixed", "circle-stacked-solid", "circle-stacked", "circle", "city-solid", "city", "clipboard-check-solid", "clipboard-check", "clipboard-data-solid", "clipboard-data", "clipboard-medical-solid", "clipboard-medical", "clipboard-plus-solid", "clipboard-plus", "clipboard-solid", "clipboard", "clock-sla", "clock-solid", "clock", "cloud-down", "cloud-issue-solid", "cloud-issue", "cloud-solid", "cloud-up", "cloud", "cloudy-solid", "cloudy", "code", "column-delete", "column-insert", "column-no-left", "column-no-right", "column-top-fill", "columns-solid", "columns", "command", "compass-solid", "compass", "condition-critical", "condition-satisfactory", "controller-solid", "controller", "copy-solid", "copy", "credit-solid", "credit", "crop", "crosshairs", "csr-connected", "cuppa-solid", "cuppa", "dataviz-area-multi", "dataviz-area-stacked", "dataviz-area", "dataviz-bar-clustered", "dataviz-bar-stacked", "dataviz-bar", "dataviz-bubble", "dataviz-column-clustered", "dataviz-column-stacked", "dataviz-column", "dataviz-combo", "dataviz-datetime-field", "dataviz-donut", "dataviz-flip-counter", "dataviz-forecast", "dataviz-funnel-solid", "dataviz-funnel", "dataviz-gauge", "dataviz-geo-choropleth", "dataviz-line-multi", "dataviz-line", "dataviz-numeric-field", "dataviz-pareto", "dataviz-pie", "dataviz-pivot-table", "dataviz-radar", "dataviz-scatter", "dataviz-spark", "dataviz-string-field", "dataviz-table-with-bars", "dataviz-table-with-cross", "dataviz-waterfall", "desktop-solid", "desktop", "diamond-minus", "diamond-solid", "diamond", "disc-stack-solid", "disc-stack", "distribute-item-center-solid", "distribute-item-center", "distribute-item-vert-center-solid", "distribute-item-vert-center", "dna", "dock", "document-check-solid", "document-check", "document-compress-solid", "document-compress", "document-data-solid", "document-doc", "document-download-solid", "document-download", "document-minus-solid", "document-minus", "document-pdf", "document-plus-solid", "document-plus", "document-solid", "document-upload-solid", "document-upload", "document-xls", "document", "documents-check-solid", "documents-check", "documents-data-solid", "documents-data", "documents-solid", "documents", "docusign", "dollar-sign-solid", "dollar-sign", "dot-9-solid", "dot-9", "download", "drag", "drink-solid", "drink", "earth-solid", "earth", "edit-shape-solid", "edit-shape", "erase-solid", "erase", "eye-off-solid", "eye-off", "eye-solid", "eye", "face-blank-solid", "face-blank", "face-happy-solid", "face-happy", "face-sad-solid", "face-sad", "facebook", "farm-solid", "farm", "fast-forward-solid", "fast-forward", "field-dot", "filetype-text", "filter-on", "filter", "fire-solid", "fire", "flag-finish", "flag-solid", "flag-wave-solid", "flag-wave", "flag", "flashlight-solid", "flashlight", "folder-close-solid", "folder-close", "folder-closed-solid", "folder-closed", "folder-dollar-solid", "folder-dollar", "folder-hierarchy-solid", "folder-hierarchy", "folder-nested-solid", "folder-nested", "folder-plus-solid", "folder-plus", "folder-solid", "folder", "folders-solid", "folders", "forward-all-solid", "forward-all", "forward-solid", "forward", "freeze-column", "function", "galaxy", "gauge-solid", "gauge", "gear-box-dotted", "gear-solid", "gear", "glasses-solid", "glasses", "globe-solid", "globe", "google", "government-solid", "government", "grad-solid", "grad", "grid-solid", "grid", "hand-solid", "hand", "handshake-solid", "handshake", "hanger", "header", "headline-solid", "headline", "headphone-solid", "headphone", "headset", "heart-mixed", "heart-pulse-solid", "heart-pulse", "heart-solid", "heart", "help-solid", "help", "history-solid", "history", "home-alt-solid", "home-alt", "home-solid", "home", "inbox-data-solid", "inbox-data", "inbox-empty", "inbox-solid", "indent", "infinity", "information-solid", "information", "ink-solid", "ink", "input-pen", "inspect", "interact", "ios-face-id", "ios-finger-id", "key", "keyboard-solid", "keyboard", "knight-solid", "knight", "knobs-alt-solid", "knobs-alt", "knobs-solid", "knobs", "laptop-solid", "laptop", "layers-solid", "layers", "layout-solid", "layout", "leaf-solid", "leaf", "legal", "letter-solid", "letter", "life-ring-solid", "life-ring", "linkedin", "list-number", "list", "live-transcript", "location-check-solid", "location-check", "location-solid", "location", "locations-solid", "locations", "lock-closed-solid", "lock-closed", "lock-open-solid", "lock-open", "magnet-solid", "magnet", "mail-check-solid", "mail-check", "mail-plus-solid", "mail-plus", "mail-solid", "mail", "mailbox-solid", "mailbox", "map-sigma-solid", "map-sigma", "map-solid", "map", "material-finger", "mcp", "medal", "megaphone-solid", "megaphone", "mic-off-solid", "mic-off", "mic-solid", "mic", "minus", "mobile-phone-solid", "mobile-phone", "money-send-solid", "money-send", "money-solid", "money", "monkey-solid", "monkey", "moon-solid", "moon", "more-alt", "more", "move-left-solid", "move-right-solid", "move-up-solid", "moving", "multi-device-solid", "multi-device", "music-solid", "music", "navigation-solid", "navigation", "node-solid", "node", "nodes-down-solid", "nodes-down", "nodes-left-solid", "nodes-left", "nodes-right-solid", "nodes-right", "nodes-up-solid", "nodes-up", "notepad-empty-solid", "notepad-empty", "notepad-solid", "notepad", "notes-solid", "notes", "object-case-multi", "object-case-solid", "object-case", "object-status", "open", "opportunity-solid", "opportunity", "or-delete", "os-android", "os-apple", "os-windows", "paper-clip", "passbook-solid", "passbook", "pause-solid", "pause", "paypal", "peekpanel-arrow-left-solid", "peekpanel-arrow-left", "peekpanel-arrow-right-solid", "peekpanel-arrow-right", "pega", "pegasus", "pen-solid", "pen", "pencil-solid", "pencil", "person-solid", "person", "phone-ai-solid", "phone-ai", "phone-call-solid", "phone-call", "phone-disabled-solid", "phone-disabled", "phone-hangup-solid", "phone-hangup", "phone-in-solid", "phone-in", "phone-list-solid", "phone-list", "phone-merge-solid", "phone-merge", "phone-out-solid", "phone-out", "phone-pause-solid", "phone-pause", "phone-solid", "phone-split-solid", "phone-split", "phone", "picture-solid", "picture", "piggybank-solid", "piggybank", "pin-solid", "pin", "pipeline-solid", "pipeline", "placeholder", "plane-solid", "plane", "plant-solid", "plant", "play-solid", "play", "playbook-solid", "playbook", "plug-solid", "plug", "plus-between-left-column", "plus-between-right-column", "plus-line-above-below", "plus-line-above", "plus-line-below", "plus-line-left", "plus-line-right", "plus", "podium-solid", "podium", "polaris-solid", "polaris", "pong-solid", "pong", "potion-solid", "potion", "power", "preview-bottom", "preview-collapse", "preview-expand", "preview-hide", "preview-rtl", "preview", "print-solid", "print", "processor-solid", "processor", "progress-solid", "progress", "puzzle-solid", "puzzle", "qr", "quill", "rabbit", "radio-solid", "radio", "rain-solid", "rain", "receipt-solid", "receipt", "rectangle-solid", "rectangle", "reply-all-solid", "reply-all", "reply-solid", "reply", "reset", "retweet", "rewind-solid", "rewind", "robot-happy-solid", "robot-happy", "robot-sad-solid", "robot-sad", "robot-solid", "robot", "rocket-solid", "rocket", "roller-solid", "roller", "route-solid", "route", "row-delete", "row-insert", "row-left-fill", "row-right-fill", "row", "scale-down", "scale-up-solid", "scale-up", "school-solid", "school", "scissors", "script-solid", "script", "search-analytics-solid", "search-analytics", "search-case", "search-check", "search-close", "search-minus", "search-org", "search-plus", "search-solid", "search-table", "search", "semitruck-solid", "semitruck", "send-solid", "send", "server-cloud-solid", "server-cloud", "server-solid", "server", "sextant", "share-point-up-solid", "share-point-up", "share-solid", "share", "shield-solid", "shield", "shoe-solid", "shoe", "shuffle", "sigma", "signpost-solid", "signpost", "slideshow-solid", "slideshow", "snail", "snow", "social-solid", "social", "speaker-mute-solid", "speaker-mute", "speaker-on-solid", "speaker-on", "speaker-solid", "speaker", "spellcheck", "square-solid", "square", "star-mixed", "star-solid", "star", "steps-solid", "steps", "stethoscope-solid", "stethoscope", "stoplight-solid", "stoplight", "stopwatch-solid", "stopwatch", "store-solid", "store", "sun-solid", "sun", "swipe-left-solid", "swipe-left", "swipe-right-solid", "swipe-right", "table", "tablet-solid", "tablet", "tag-check-solid", "tag-check", "tag-close-solid", "tag-close", "tag-solid", "tag", "target-solid", "target", "temp-solid", "temp", "thumbs-down-solid", "thumbs-down", "thumbs-up-solid", "thumbs-up", "times", "todo-solid", "todo", "tow-truck-solid", "tow-truck", "tracer-solid", "tracer", "transform", "trash-solid", "trash", "triangle-mixed-left", "triangle-mixed-right", "triangle-solid", "triangle", "tribox-solid", "tribox", "trophy-solid", "trophy", "truck-solid", "truck", "tv-solid", "tv", "twitter", "umbrella-solid", "umbrella", "undo", "undock", "unindent", "unwrap", "upload", "user-check-solid", "user-check", "user-close-solid", "user-close", "user-female-solid", "user-female", "user-laptop", "user-list-solid", "user-list", "user-plus-solid", "user-plus", "user-question-mark-solid", "user-question-mark", "user-search-solid", "user-search", "user-solid", "user-star-solid", "user-star", "user", "users-solid", "users", "video-off", "video-solid", "video", "voicemail", "vr-solid", "vr", "walkie-solid", "walkie", "wallet-solid", "wallet", "wand", "warn-solid", "warn", "watch-solid", "watch", "waypoint-solid", "waypoint", "webcam-solid", "webcam", "whatsapp", "wifi-none", "wifi-off", "wifi", "wizard-solid", "wizard", "wrap", "wrench-solid", "wrench", "youtube"];
|
|
2
2
|
export default iconNames;
|
|
3
|
+
export declare const set: Set<string>;
|
|
3
4
|
export type IconName = (typeof iconNames)[number];
|
|
4
5
|
//# sourceMappingURL=iconNames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/iconNames.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,+3YAyzBL,CAAC;AAEX,eAAe,SAAS,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/iconNames.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,+3YAyzBL,CAAC;AAEX,eAAe,SAAS,CAAC;AAEzB,eAAO,MAAM,GAAG,aAA6B,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC"}
|