@pega/cosmos-react-core 9.36.1 → 9.37.1
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/AIRewrite/AIRewrite.d.ts +1 -1
- package/lib/components/AIRewrite/AIRewrite.d.ts.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.js +7 -3
- package/lib/components/AIRewrite/AIRewrite.js.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.styles.d.ts +32 -4
- package/lib/components/AIRewrite/AIRewrite.styles.d.ts.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.styles.js +5 -2
- package/lib/components/AIRewrite/AIRewrite.styles.js.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.types.d.ts +2 -0
- package/lib/components/AIRewrite/AIRewrite.types.d.ts.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.types.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/AppShell/TouchAppShell.styles.d.ts +4 -2
- package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.js +18 -3
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +1 -1
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +1 -1
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +1 -1
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.d.ts +37 -9
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +36 -34
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/FormDialogWrapper.d.ts +5 -0
- package/lib/components/Dialog/FormDialogWrapper.d.ts.map +1 -0
- package/lib/components/Dialog/FormDialogWrapper.js +13 -0
- package/lib/components/Dialog/FormDialogWrapper.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts +1 -1
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.js +14 -10
- package/lib/components/Dialog/TouchDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.d.ts +2 -2
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.js +32 -31
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.d.ts +13 -6
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -1
- package/lib/components/Dialog/TouchFormDialog.d.ts +5 -0
- package/lib/components/Dialog/TouchFormDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.js +53 -0
- package/lib/components/Dialog/TouchFormDialog.js.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchFormDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.styles.js +39 -0
- package/lib/components/Dialog/TouchFormDialog.styles.js.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts.map +1 -1
- package/lib/components/Dialog/TouchInfoDialog.js +12 -5
- package/lib/components/Dialog/TouchInfoDialog.js.map +1 -1
- package/lib/components/Dialog/index.d.ts +2 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +2 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/InlineEdit/InlineEdit.d.ts +13 -4
- package/lib/components/InlineEdit/InlineEdit.d.ts.map +1 -1
- package/lib/components/InlineEdit/InlineEdit.js +2 -2
- package/lib/components/InlineEdit/InlineEdit.js.map +1 -1
- package/lib/components/InlineEdit/InlineEdit.styles.d.ts +32 -4
- package/lib/components/InlineEdit/InlineEdit.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +1 -7
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +32 -4
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +9 -6
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +1 -1
- 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 +19 -10
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AIRewriteProps } from './AIRewrite.types';
|
|
2
|
-
declare const AIRewrite: ({ target, testId, onGenerate, onSubmit, onCancel, isGenerating, suggestion, suggestionEditor }: AIRewriteProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const AIRewrite: ({ target, testId, onGenerate, onSubmit, onCancel, onAfterClose, isGenerating, suggestion, suggestionEditor }: AIRewriteProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default AIRewrite;
|
|
4
4
|
//# sourceMappingURL=AIRewrite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAQlE,QAAA,MAAM,SAAS,GAAI,
|
|
1
|
+
{"version":3,"file":"AIRewrite.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAQlE,QAAA,MAAM,SAAS,GAAI,8GAUhB,cAAc,4CAoHhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -9,7 +9,7 @@ import TextArea from '../TextArea';
|
|
|
9
9
|
import { useI18n, useTestIds } from '../../hooks';
|
|
10
10
|
import { getAIRewriteTestIds } from './AIRewrite.test-ids';
|
|
11
11
|
import { StyledAIRewriteDialog, StyledFormSection, StyledInstructionsWrapper } from './AIRewrite.styles';
|
|
12
|
-
const AIRewrite = ({ target, testId, onGenerate, onSubmit, onCancel, isGenerating, suggestion, suggestionEditor }) => {
|
|
12
|
+
const AIRewrite = ({ target, testId, onGenerate, onSubmit, onCancel, onAfterClose, isGenerating, suggestion, suggestionEditor }) => {
|
|
13
13
|
const t = useI18n();
|
|
14
14
|
const testIds = useTestIds(testId, getAIRewriteTestIds);
|
|
15
15
|
const [selectedAction, setSelectedAction] = useState('improve');
|
|
@@ -29,11 +29,15 @@ const AIRewrite = ({ target, testId, onGenerate, onSubmit, onCancel, isGeneratin
|
|
|
29
29
|
const handleCancel = () => {
|
|
30
30
|
target.focus();
|
|
31
31
|
onCancel();
|
|
32
|
+
return true;
|
|
32
33
|
};
|
|
33
34
|
return (_jsx(StyledAIRewriteDialog, { target: target, heading: t('ai_rewrite_title'), onCancel: handleCancel, onSubmit: {
|
|
34
35
|
disabled: !suggestion?.trim() || isGenerating,
|
|
35
|
-
handler:
|
|
36
|
-
|
|
36
|
+
handler: () => {
|
|
37
|
+
onSubmit();
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}, onAfterClose: onAfterClose, children: _jsxs(Flex, { container: { direction: 'column', rowGap: 2 }, children: [_jsx(StyledFormSection, { children: _jsxs(Flex, { container: { direction: 'column', rowGap: 2 }, children: [_jsxs(RadioButtonGroup, { name: 'aiAction', label: t('ai_rewrite_label'), required: true, inline: true, children: [_jsx(RadioButton, { value: 'improve', label: t('ai_rewrite_improve'), checked: selectedAction === 'improve', onChange: handleActionChange, "data-testid": testIds.radioClearer }), _jsx(RadioButton, { value: 'shorter', label: t('ai_rewrite_shorter'), checked: selectedAction === 'shorter', onChange: handleActionChange, "data-testid": testIds.radioShorter }), _jsx(RadioButton, { value: 'professional', label: t('ai_rewrite_professional'), checked: selectedAction === 'professional', onChange: handleActionChange, "data-testid": testIds.radioProfessional }), _jsx(RadioButton, { value: 'friendly', label: t('ai_rewrite_friendly'), checked: selectedAction === 'friendly', onChange: handleActionChange, "data-testid": testIds.radioFriendly })] }), _jsx(StyledInstructionsWrapper, { children: _jsx(TextArea, { label: t('ai_rewrite_instructions_label'), info: t('ai_rewrite_instructions_info'), value: additionalInstructions, onChange: e => setAdditionalInstructions(e.target.value), maxLength: 200, rows: 1, autoResize: false, "data-testid": testIds.instructionsInput }) }), _jsx("div", { children: _jsx(Button, { type: 'button', onClick: handleGenerate, disabled: isGenerating, "data-testid": testIds.generateButton, children: t('ai_rewrite_generate') }) })] }) }), _jsxs(Flex, { container: { direction: 'column', rowGap: 0.5 }, children: [_jsx(Text, { variant: 'h4', children: t('ai_rewrite_result_label') }), suggestionEditor ?? (_jsx(TextArea, { label: t('ai_rewrite_result_label'), labelHidden: true, value: suggestion ?? '', readOnly: true, disabled: !suggestion }))] })] }) }));
|
|
37
41
|
};
|
|
38
42
|
export default AIRewrite;
|
|
39
43
|
//# sourceMappingURL=AIRewrite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,O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,CAAC,yBAAyB,CAAC,GAAQ,EACvD,gBAAgB,IAAI,CACnB,KAAC,QAAQ,IACP,KAAK,EAAE,CAAC,CAAC,yBAAyB,CAAC,EACnC,WAAW,QACX,KAAK,EAAE,UAAU,IAAI,EAAE,EACvB,QAAQ,QACR,QAAQ,EAAE,CAAC,UAAU,GACrB,CACH,IACI,IACF,GACe,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useState } from 'react';\nimport type { ChangeEvent } from 'react';\n\nimport Button from '../Button';\nimport Flex from '../Flex';\nimport RadioButton from '../RadioButton';\nimport RadioButtonGroup from '../RadioButtonGroup';\nimport Text from '../Text';\nimport TextArea from '../TextArea';\nimport { useI18n, useTestIds } from '../../hooks';\n\nimport type { AIRewriteProps, AIAction } from './AIRewrite.types';\nimport { getAIRewriteTestIds } from './AIRewrite.test-ids';\nimport {\n StyledAIRewriteDialog,\n StyledFormSection,\n StyledInstructionsWrapper\n} from './AIRewrite.styles';\n\nconst AIRewrite = ({\n target,\n testId,\n onGenerate,\n onSubmit,\n onCancel,\n onAfterClose,\n isGenerating,\n suggestion,\n suggestionEditor\n}: AIRewriteProps) => {\n const t = useI18n();\n const testIds = useTestIds(testId, getAIRewriteTestIds);\n const [selectedAction, setSelectedAction] = useState<AIAction>('improve');\n const [additionalInstructions, setAdditionalInstructions] = useState('');\n\n const handleActionChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newAction = e.target.value;\n if (\n newAction === 'improve' ||\n newAction === 'shorter' ||\n newAction === 'professional' ||\n newAction === 'friendly'\n ) {\n setSelectedAction(newAction);\n }\n };\n\n const handleGenerate = () => {\n onGenerate(selectedAction, additionalInstructions);\n };\n\n const handleCancel = () => {\n target.focus();\n onCancel();\n return true;\n };\n\n return (\n <StyledAIRewriteDialog\n target={target}\n heading={t('ai_rewrite_title')}\n onCancel={handleCancel}\n onSubmit={{\n disabled: !suggestion?.trim() || isGenerating,\n handler: () => {\n onSubmit();\n return true;\n }\n }}\n onAfterClose={onAfterClose}\n >\n <Flex container={{ direction: 'column', rowGap: 2 }}>\n <StyledFormSection>\n <Flex container={{ direction: 'column', rowGap: 2 }}>\n <RadioButtonGroup name='aiAction' label={t('ai_rewrite_label')} required inline>\n <RadioButton\n value='improve'\n label={t('ai_rewrite_improve')}\n checked={selectedAction === 'improve'}\n onChange={handleActionChange}\n data-testid={testIds.radioClearer}\n />\n <RadioButton\n value='shorter'\n label={t('ai_rewrite_shorter')}\n checked={selectedAction === 'shorter'}\n onChange={handleActionChange}\n data-testid={testIds.radioShorter}\n />\n <RadioButton\n value='professional'\n label={t('ai_rewrite_professional')}\n checked={selectedAction === 'professional'}\n onChange={handleActionChange}\n data-testid={testIds.radioProfessional}\n />\n <RadioButton\n value='friendly'\n label={t('ai_rewrite_friendly')}\n checked={selectedAction === 'friendly'}\n onChange={handleActionChange}\n data-testid={testIds.radioFriendly}\n />\n </RadioButtonGroup>\n\n <StyledInstructionsWrapper>\n <TextArea\n label={t('ai_rewrite_instructions_label')}\n info={t('ai_rewrite_instructions_info')}\n value={additionalInstructions}\n onChange={e => setAdditionalInstructions(e.target.value)}\n maxLength={200}\n rows={1}\n autoResize={false}\n data-testid={testIds.instructionsInput}\n />\n </StyledInstructionsWrapper>\n <div>\n <Button\n type='button'\n onClick={handleGenerate}\n disabled={isGenerating}\n data-testid={testIds.generateButton}\n >\n {t('ai_rewrite_generate')}\n </Button>\n </div>\n </Flex>\n </StyledFormSection>\n\n <Flex container={{ direction: 'column', rowGap: 0.5 }}>\n <Text variant='h4'>{t('ai_rewrite_result_label')}</Text>\n {suggestionEditor ?? (\n <TextArea\n label={t('ai_rewrite_result_label')}\n labelHidden\n value={suggestion ?? ''}\n readOnly\n disabled={!suggestion}\n />\n )}\n </Flex>\n </Flex>\n </StyledAIRewriteDialog>\n );\n};\n\nexport default AIRewrite;\n"]}
|
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
export declare const StyledAIRewriteDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
|
|
2
2
|
onDismiss?: () => void;
|
|
3
|
-
onCancel: import("../Dialog/Dialog.types").FormAction;
|
|
4
3
|
onSubmit: import("../Dialog/Dialog.types").FormAction;
|
|
5
4
|
} & {
|
|
6
5
|
heading: string;
|
|
7
6
|
additionalInfo?: import("../AdditionalInfo").AdditionalInfoProps;
|
|
8
7
|
'aria-label'?: never;
|
|
9
|
-
} &
|
|
8
|
+
} & {
|
|
9
|
+
onAfterClose?: () => void;
|
|
10
|
+
onCancel: import("../Dialog/Dialog.types").FormAction | undefined;
|
|
11
|
+
} & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onAfterClose" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
+
}) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
|
|
14
|
+
onDismiss?: () => void;
|
|
15
|
+
onSubmit: import("../Dialog/Dialog.types").FormAction;
|
|
16
|
+
} & {
|
|
17
|
+
heading: string;
|
|
18
|
+
additionalInfo?: import("../AdditionalInfo").AdditionalInfoProps;
|
|
19
|
+
'aria-label'?: never;
|
|
20
|
+
} & {
|
|
21
|
+
onAfterClose: () => void;
|
|
22
|
+
onCancel?: import("../Dialog/Dialog.types").FormAction;
|
|
23
|
+
} & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onAfterClose" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
24
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
25
|
}) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
|
|
12
26
|
onDismiss?: () => void;
|
|
13
|
-
onCancel: import("../Dialog/Dialog.types").FormAction;
|
|
14
27
|
onSubmit: import("../Dialog/Dialog.types").FormAction;
|
|
15
28
|
} & {
|
|
16
29
|
heading?: never;
|
|
17
30
|
'aria-label': string;
|
|
18
31
|
additionalInfo?: never;
|
|
19
|
-
} &
|
|
32
|
+
} & {
|
|
33
|
+
onAfterClose?: () => void;
|
|
34
|
+
onCancel: import("../Dialog/Dialog.types").FormAction | undefined;
|
|
35
|
+
} & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onAfterClose" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
36
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
37
|
+
}) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
|
|
38
|
+
onDismiss?: () => void;
|
|
39
|
+
onSubmit: import("../Dialog/Dialog.types").FormAction;
|
|
40
|
+
} & {
|
|
41
|
+
heading?: never;
|
|
42
|
+
'aria-label': string;
|
|
43
|
+
additionalInfo?: never;
|
|
44
|
+
} & {
|
|
45
|
+
onAfterClose: () => void;
|
|
46
|
+
onCancel?: import("../Dialog/Dialog.types").FormAction;
|
|
47
|
+
} & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onAfterClose" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
20
48
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
21
49
|
}), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("../Dialog").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
22
50
|
export declare const StyledFormSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AIRewrite.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uRAMhC,CAAC;AAIH,eAAO,MAAM,iBAAiB,6NAM5B,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAIrC,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { defaultThemeProp } from '../../theme';
|
|
3
|
-
import FormDialog from '../Dialog
|
|
3
|
+
import { FormDialog } from '../Dialog';
|
|
4
|
+
import { StyledTouchDialog } from '../Dialog/TouchDialog.styles';
|
|
4
5
|
export const StyledAIRewriteDialog = styled(FormDialog)(({ theme }) => {
|
|
5
6
|
return css `
|
|
6
|
-
|
|
7
|
+
&:not(${StyledTouchDialog}) {
|
|
8
|
+
min-width: min(${theme.base['content-width'].xl}, calc(100vw - 2rem));
|
|
9
|
+
}
|
|
7
10
|
`;
|
|
8
11
|
});
|
|
9
12
|
StyledAIRewriteDialog.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.styles.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"AIRewrite.styles.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpE,OAAO,GAAG,CAAA;YACA,iBAAiB;uBACN,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;;GAElD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;kBACM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;qBACvC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;wBACxB,KAAK,CAAC,IAAI,CAAC,OAAO;GACvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIlD,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { FormDialog } from '../Dialog';\nimport { StyledTouchDialog } from '../Dialog/TouchDialog.styles';\n\nexport const StyledAIRewriteDialog = styled(FormDialog)(({ theme }) => {\n return css`\n &:not(${StyledTouchDialog}) {\n min-width: min(${theme.base['content-width'].xl}, calc(100vw - 2rem));\n }\n `;\n});\n\nStyledAIRewriteDialog.defaultProps = defaultThemeProp;\n\nexport const StyledFormSection = styled.div(({ theme }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border-radius: ${theme.base['border-radius']};\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledFormSection.defaultProps = defaultThemeProp;\n\nexport const StyledInstructionsWrapper = styled.div`\n textarea {\n min-height: unset;\n }\n`;\n\nStyledInstructionsWrapper.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -11,6 +11,8 @@ export interface AIRewriteProps extends TestIdProp {
|
|
|
11
11
|
onSubmit: () => void;
|
|
12
12
|
/** Called when the user cancels or dismisses the popover */
|
|
13
13
|
onCancel: () => void;
|
|
14
|
+
/** Called after the popover has completely closed and is safe to unmount. */
|
|
15
|
+
onAfterClose?: () => void;
|
|
14
16
|
/** When true, the AI is generating a suggestion. Disables the Generate button. */
|
|
15
17
|
isGenerating?: boolean;
|
|
16
18
|
/** The AI-generated suggestion text. When provided, Submit is enabled. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.types.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8BAA8B;AAC9B,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,oDAAoD;IACpD,MAAM,EAAE,WAAW,CAAC;IAEpB,+EAA+E;IAC/E,UAAU,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qHAAqH;IACrH,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B"}
|
|
1
|
+
{"version":3,"file":"AIRewrite.types.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8BAA8B;AAC9B,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,oDAAoD;IACpD,MAAM,EAAE,WAAW,CAAC;IAEpB,+EAA+E;IAC/E,UAAU,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAE1B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qHAAqH;IACrH,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRewrite.types.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { TestIdProp } from '../../types';\n\n/** AI rewrite action types */\nexport type AIAction = 'improve' | 'shorter' | 'professional' | 'friendly';\n\nexport interface AIRewriteProps extends TestIdProp {\n /** The button element that triggered the popover */\n target: HTMLElement;\n\n /** Called when the user clicks the Generate button to request an AI rewrite */\n onGenerate: (rewriteAction: AIAction, additionalInstructions: string) => void;\n\n /** Called when the user clicks Submit to apply the suggestion */\n onSubmit: () => void;\n\n /** Called when the user cancels or dismisses the popover */\n onCancel: () => void;\n\n /** When true, the AI is generating a suggestion. Disables the Generate button. */\n isGenerating?: boolean;\n\n /** The AI-generated suggestion text. When provided, Submit is enabled. */\n suggestion?: string;\n\n /** Custom editor to render in the suggestion area. When not provided, the raw suggestion text is shown read-only. */\n suggestionEditor?: ReactNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AIRewrite.types.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { TestIdProp } from '../../types';\n\n/** AI rewrite action types */\nexport type AIAction = 'improve' | 'shorter' | 'professional' | 'friendly';\n\nexport interface AIRewriteProps extends TestIdProp {\n /** The button element that triggered the popover */\n target: HTMLElement;\n\n /** Called when the user clicks the Generate button to request an AI rewrite */\n onGenerate: (rewriteAction: AIAction, additionalInstructions: string) => void;\n\n /** Called when the user clicks Submit to apply the suggestion */\n onSubmit: () => void;\n\n /** Called when the user cancels or dismisses the popover */\n onCancel: () => void;\n\n /** Called after the popover has completely closed and is safe to unmount. */\n onAfterClose?: () => void;\n\n /** When true, the AI is generating a suggestion. Disables the Generate button. */\n isGenerating?: boolean;\n\n /** The AI-generated suggestion text. When provided, Submit is enabled. */\n suggestion?: string;\n\n /** Custom editor to render in the suggestion area. When not provided, the raw suggestion text is shown read-only. */\n suggestionEditor?: ReactNode;\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import { useDirection, useEscape, useOuterEvent, useTheme, useUID } from '../../
|
|
|
7
7
|
import Text, { StyledText } from '../Text';
|
|
8
8
|
import Tooltip from '../Tooltip';
|
|
9
9
|
import Popover from '../Popover';
|
|
10
|
-
import
|
|
10
|
+
import TouchDialog from '../Dialog/TouchDialog';
|
|
11
11
|
import { StyledTouchDialogHeader, StyledExpandCollapse } from '../Dialog/TouchDialog.styles';
|
|
12
12
|
import Menu from '../Menu';
|
|
13
13
|
import { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MA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;wBACtB,CAAC,EACD,YAAY,EAAE,YAAY,YAEzB,WAAW,GACJ,CACX,IACA,CACJ,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useContext, useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, FC, MouseEvent as ReactMouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { tryCatch, createStringMatcher, isInstance, isTouchDevice } from '../../utils';\nimport { useDirection, useEscape, useOuterEvent, useTheme, useUID } from '../../hooks';\nimport Text, { StyledText } from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport { TouchDialog } from '../Dialog/TouchDialog';\nimport { StyledTouchDialogHeader, StyledExpandCollapse } from '../Dialog/TouchDialog.styles';\nimport Menu from '../Menu';\nimport { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledIcon } from '../Icon';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport { StyledChildrenWrap } from '../Dialog/Dialog.styles';\n\nimport type { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors } from './style-utils';\n\nconst navigationMenuStyles = ({ theme }: { theme: DefaultTheme }) => {\n const { hoverBg, foreground, backgroundColor } = navContrastColors(theme);\n\n return css`\n display: flex;\n background: ${backgroundColor};\n\n ${StyledMenu} {\n display: flex;\n flex-direction: column;\n }\n\n ${StyledMenuListWrapper} {\n overflow: auto;\n }\n\n ${StyledMenuListContainer} {\n background: ${backgroundColor};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foreground};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n background-color: ${hoverBg};\n }\n }\n\n ${StyledEmptyState} {\n ${StyledIcon}, ${StyledText} {\n color: ${foreground};\n }\n }\n `;\n};\n\nconst StyledNavigationPopover = styled.div<{ mobileNavBar?: boolean }>(\n ({ theme, mobileNavBar }) => {\n const { foreground } = navContrastColors(theme);\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n ${navigationMenuStyles}\n\n ${StyledMenu} {\n ${mobileNavBar &&\n css`\n width: calc(100vw - (2 * ${theme.base.spacing}));\n `}\n }\n\n ${StyledMenu} > header {\n color: ${foreground};\n border-bottom: none;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n `;\n }\n);\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst StyledNavigationTouchDialog = styled(TouchDialog)(({ theme }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n ${navigationMenuStyles({ theme })}\n\n ${StyledMenu} {\n width: 100%;\n }\n\n ${StyledMenu} > header {\n border-bottom: none;\n }\n\n ${StyledTouchDialogHeader},\n ${StyledExpandCollapse} {\n color: ${foreground};\n }\n\n ${StyledChildrenWrap} {\n padding-inline: 0;\n }\n `;\n});\n\nStyledNavigationTouchDialog.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items,\n filterAt = 5,\n content,\n onMenuToggle,\n mobileNavBar\n } = props;\n const { isMobileNav, navOpen, collapsedHoverMenus, headerEl } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const filterElRef = useRef<HTMLInputElement>(null);\n const isMenu = (Array.isArray(items) && items.length > 0) || !!content;\n const renderFilter = Array.isArray(items) && items.length >= filterAt;\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [filterValue, setFilterValue] = useState('');\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n const theme = useTheme();\n\n const closePopover = (focusChildEl: boolean = false) => {\n if (popoverOpen) {\n setFilterValue('');\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', isMenu ? [popoverRef, childElementRef] : [], () => closePopover());\n\n useEffect(() => {\n const onClick = () => {\n if (isMenu) {\n if ((isMobileNav || !navOpen) && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(true);\n }, 0);\n }\n }\n };\n\n const openCollapsedMenuPopover = () => {\n if (isMenu && collapsedHoverMenus && !navOpen && !popoverOpen) {\n setPopoverOpen(true);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n } else if (e.key === 'Enter') {\n openCollapsedMenuPopover();\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n\n const tag = (e.relatedTarget as HTMLElement | null)?.tagName.toLowerCase();\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (tag && ['a', 'button', 'form'].includes(tag)) {\n closePopover();\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover();\n }\n }, 1000);\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (isInstance(e.relatedTarget, Node) && popoverRef.current?.contains(e.relatedTarget)) {\n return;\n }\n closePopover();\n };\n\n childElementRef.current?.addEventListener('blur', onBlur);\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', openCollapsedMenuPopover);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n } else {\n childElementRef.current?.addEventListener('click', onClick);\n }\n return () => {\n childElementRef.current?.removeEventListener('blur', onBlur);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', openCollapsedMenuPopover);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n } else {\n childElementRef.current?.removeEventListener('click', onClick);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [isMenu, navOpen, closePopover, collapsedHoverMenus, popoverOpen, isMobileNav]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEscape(() => closePopover(true), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(true), popoverRef, [popoverRef]);\n\n const searchListId = useUID();\n\n const itemsToRender = renderFilter\n ? items.filter(item => {\n return filterRegex.test(item.primary);\n })\n : items ?? [];\n const useTouchDialog = mobileNavBar && isTouchDevice;\n\n const filterInputProps = renderFilter\n ? {\n value: filterValue,\n ref: filterElRef,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value),\n autoFocus: !useTouchDialog\n }\n : undefined;\n\n const menuContent = content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n listId={searchListId}\n filterInputProps={filterInputProps}\n items={itemsToRender.map(item => {\n const itemText = 'text' in item && typeof item.text === 'string' ? item.text : '';\n const itemTextValue = item.primary || itemText;\n\n return {\n id: itemTextValue,\n primary: itemTextValue,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={mobileNavBar ? undefined : <Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n );\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={mobileNavBar ? 'top' : end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {useTouchDialog && isMenu && (\n <StyledNavigationTouchDialog\n open={popoverOpen}\n onDismiss={() => closePopover(true)}\n onAfterClose={() => closePopover(true)}\n heading={label}\n ref={popoverRef}\n >\n {menuContent}\n </StyledNavigationTouchDialog>\n )}\n {!useTouchDialog && popoverOpen && isMenu && (\n <Popover\n target={childElementRef.current}\n placement={`${mobileNavBar ? 'top' : end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n strategy={mobileNavBar ? 'absolute' : 'fixed'}\n modifiers={[\n ...(headerEl\n ? [\n {\n name: 'preventOverflow',\n options: {\n padding: {\n top: headerEl.offsetHeight + 8,\n right: 8,\n bottom: 8,\n left: 8\n }\n }\n }\n ]\n : []),\n ...(mobileNavBar\n ? [\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => 5.5 + Number(stripUnit(remToPx(theme.base.spacing))),\n () => 5.5 + 8\n )\n ]\n }\n }\n ]\n : [])\n ]}\n onClick={(e: ReactMouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n }}\n mobileNavBar={mobileNavBar}\n >\n {menuContent}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,M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B,WAAW,GACJ,CACX,IACA,CACJ,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useContext, useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, FC, MouseEvent as ReactMouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { tryCatch, createStringMatcher, isInstance, isTouchDevice } from '../../utils';\nimport { useDirection, useEscape, useOuterEvent, useTheme, useUID } from '../../hooks';\nimport Text, { StyledText } from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport TouchDialog from '../Dialog/TouchDialog';\nimport { StyledTouchDialogHeader, StyledExpandCollapse } from '../Dialog/TouchDialog.styles';\nimport Menu from '../Menu';\nimport { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledIcon } from '../Icon';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport { StyledChildrenWrap } from '../Dialog/Dialog.styles';\n\nimport type { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors } from './style-utils';\n\nconst navigationMenuStyles = ({ theme }: { theme: DefaultTheme }) => {\n const { hoverBg, foreground, backgroundColor } = navContrastColors(theme);\n\n return css`\n display: flex;\n background: ${backgroundColor};\n\n ${StyledMenu} {\n display: flex;\n flex-direction: column;\n }\n\n ${StyledMenuListWrapper} {\n overflow: auto;\n }\n\n ${StyledMenuListContainer} {\n background: ${backgroundColor};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foreground};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n background-color: ${hoverBg};\n }\n }\n\n ${StyledEmptyState} {\n ${StyledIcon}, ${StyledText} {\n color: ${foreground};\n }\n }\n `;\n};\n\nconst StyledNavigationPopover = styled.div<{ mobileNavBar?: boolean }>(\n ({ theme, mobileNavBar }) => {\n const { foreground } = navContrastColors(theme);\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n ${navigationMenuStyles}\n\n ${StyledMenu} {\n ${mobileNavBar &&\n css`\n width: calc(100vw - (2 * ${theme.base.spacing}));\n `}\n }\n\n ${StyledMenu} > header {\n color: ${foreground};\n border-bottom: none;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n `;\n }\n);\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst StyledNavigationTouchDialog = styled(TouchDialog)(({ theme }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n ${navigationMenuStyles({ theme })}\n\n ${StyledMenu} {\n width: 100%;\n }\n\n ${StyledMenu} > header {\n border-bottom: none;\n }\n\n ${StyledTouchDialogHeader},\n ${StyledExpandCollapse} {\n color: ${foreground};\n }\n\n ${StyledChildrenWrap} {\n padding-inline: 0;\n }\n `;\n});\n\nStyledNavigationTouchDialog.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items,\n filterAt = 5,\n content,\n onMenuToggle,\n mobileNavBar\n } = props;\n const { isMobileNav, navOpen, collapsedHoverMenus, headerEl } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const filterElRef = useRef<HTMLInputElement>(null);\n const isMenu = (Array.isArray(items) && items.length > 0) || !!content;\n const renderFilter = Array.isArray(items) && items.length >= filterAt;\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [filterValue, setFilterValue] = useState('');\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n const theme = useTheme();\n\n const closePopover = (focusChildEl: boolean = false) => {\n if (popoverOpen) {\n setFilterValue('');\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', isMenu ? [popoverRef, childElementRef] : [], () => closePopover());\n\n useEffect(() => {\n const onClick = () => {\n if (isMenu) {\n if ((isMobileNav || !navOpen) && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(true);\n }, 0);\n }\n }\n };\n\n const openCollapsedMenuPopover = () => {\n if (isMenu && collapsedHoverMenus && !navOpen && !popoverOpen) {\n setPopoverOpen(true);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n } else if (e.key === 'Enter') {\n openCollapsedMenuPopover();\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n\n const tag = (e.relatedTarget as HTMLElement | null)?.tagName.toLowerCase();\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (tag && ['a', 'button', 'form'].includes(tag)) {\n closePopover();\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover();\n }\n }, 1000);\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (isInstance(e.relatedTarget, Node) && popoverRef.current?.contains(e.relatedTarget)) {\n return;\n }\n closePopover();\n };\n\n childElementRef.current?.addEventListener('blur', onBlur);\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', openCollapsedMenuPopover);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n } else {\n childElementRef.current?.addEventListener('click', onClick);\n }\n return () => {\n childElementRef.current?.removeEventListener('blur', onBlur);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', openCollapsedMenuPopover);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n } else {\n childElementRef.current?.removeEventListener('click', onClick);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [isMenu, navOpen, closePopover, collapsedHoverMenus, popoverOpen, isMobileNav]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEscape(() => closePopover(true), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(true), popoverRef, [popoverRef]);\n\n const searchListId = useUID();\n\n const itemsToRender = renderFilter\n ? items.filter(item => {\n return filterRegex.test(item.primary);\n })\n : items ?? [];\n const useTouchDialog = mobileNavBar && isTouchDevice;\n\n const filterInputProps = renderFilter\n ? {\n value: filterValue,\n ref: filterElRef,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value),\n autoFocus: !useTouchDialog\n }\n : undefined;\n\n const menuContent = content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n listId={searchListId}\n filterInputProps={filterInputProps}\n items={itemsToRender.map(item => {\n const itemText = 'text' in item && typeof item.text === 'string' ? item.text : '';\n const itemTextValue = item.primary || itemText;\n\n return {\n id: itemTextValue,\n primary: itemTextValue,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={mobileNavBar ? undefined : <Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n );\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={mobileNavBar ? 'top' : end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {useTouchDialog && isMenu && (\n <StyledNavigationTouchDialog\n open={popoverOpen}\n onDismiss={() => closePopover(true)}\n onAfterClose={() => closePopover(true)}\n heading={label}\n ref={popoverRef}\n >\n {menuContent}\n </StyledNavigationTouchDialog>\n )}\n {!useTouchDialog && popoverOpen && isMenu && (\n <Popover\n target={childElementRef.current}\n placement={`${mobileNavBar ? 'top' : end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n strategy={mobileNavBar ? 'absolute' : 'fixed'}\n modifiers={[\n ...(headerEl\n ? [\n {\n name: 'preventOverflow',\n options: {\n padding: {\n top: headerEl.offsetHeight + 8,\n right: 8,\n bottom: 8,\n left: 8\n }\n }\n }\n ]\n : []),\n ...(mobileNavBar\n ? [\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => 5.5 + Number(stripUnit(remToPx(theme.base.spacing))),\n () => 5.5 + 8\n )\n ]\n }\n }\n ]\n : [])\n ]}\n onClick={(e: ReactMouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n }}\n mobileNavBar={mobileNavBar}\n >\n {menuContent}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
@@ -10,9 +10,11 @@ export declare const StyledMainTouchAppShell: import("styled-components/dist/typ
|
|
|
10
10
|
export declare const StyledSplitViewPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
11
11
|
active?: boolean;
|
|
12
12
|
}>> & string;
|
|
13
|
-
export declare const StyledPortalTouchDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
13
|
+
export declare const StyledPortalTouchDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "size" | "progress" | "open" | "footer" | "ref" | "className" | "aria-label" | "children" | "heading" | "testId" | "onBeforeOpen" | "onAfterOpen" | "onAfterClose" | "outerClickAction"> & Required<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "onBeforeClose">> & Partial<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "onDismiss">>, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("../..").ForwardProps, "ref"> & {
|
|
14
14
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
15
|
-
},
|
|
15
|
+
}) | (Omit<Omit<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "size" | "progress" | "open" | "footer" | "ref" | "className" | "aria-label" | "children" | "heading" | "testId" | "onBeforeOpen" | "onAfterOpen" | "onAfterClose" | "outerClickAction"> & Required<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "onDismiss">> & Partial<Pick<import("../Dialog/TouchDialog.types").TouchDialogPropsBase, "onBeforeClose">>, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("../..").ForwardProps, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
17
|
+
}), import("styled-components/dist/types").BaseObject>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Dialog").TouchDialogProps>, keyof import("react").Component<any, {}, any>>;
|
|
16
18
|
export declare const StyledMobileMoreMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>, "ref"> & {
|
|
17
19
|
ref?: ((instance: HTMLElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
18
20
|
}, never>> & string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchAppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAA0B,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA8BtF,eAAO,MAAM,wBAAwB;0BACb,OAAO;kBACf,OAAO;YACb,YAAY;EAarB,CAAC;AAEF,eAAO,MAAM,uBAAuB;aAAyB,OAAO;YAOnE,CAAC;AAIF,eAAO,MAAM,oBAAoB;aAAyB,OAAO;YAY/D,CAAC;AAIH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"TouchAppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAA0B,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA8BtF,eAAO,MAAM,wBAAwB;0BACb,OAAO;kBACf,OAAO;YACb,YAAY;EAarB,CAAC;AAEF,eAAO,MAAM,uBAAuB;aAAyB,OAAO;YAOnE,CAAC;AAIF,eAAO,MAAM,oBAAoB;aAAyB,OAAO;YAY/D,CAAC;AAIH,eAAO,MAAM,uBAAuB;;;;6MAqBnC,CAAC;AAIF,eAAO,MAAM,oBAAoB;;mBAShC,CAAC;AAIF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAwC,OAAO;gJAqFzE,CAAC;AAIH,eAAO,MAAM,0BAA0B;;2JAgDrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeInput.d.ts","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"CompositeInput.d.ts","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;0BAqK1D,CAAC,SAAS,MAAM,SAAS,mBAAmB,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI;;;AAhK9E,wBAkKE"}
|
|
@@ -26,6 +26,21 @@ export default withTestIds(forwardRef(function CompositeInput(props, ref) {
|
|
|
26
26
|
setOpen(false);
|
|
27
27
|
buttonRef.current?.focus();
|
|
28
28
|
};
|
|
29
|
+
const runDialogAction = (action) => {
|
|
30
|
+
let pending = true;
|
|
31
|
+
let shouldClose = false;
|
|
32
|
+
action({
|
|
33
|
+
close: () => {
|
|
34
|
+
// Late calls cannot be reported as a result, so close immediately.
|
|
35
|
+
if (pending)
|
|
36
|
+
shouldClose = true;
|
|
37
|
+
else
|
|
38
|
+
closePopover();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
pending = false;
|
|
42
|
+
return shouldClose;
|
|
43
|
+
};
|
|
29
44
|
const labelId = `${id}-label`;
|
|
30
45
|
const Comp = (_jsxs(Flex, { as: StyledCompositeInput, forwardedAs: StyledFormControl, container: { alignItems: 'center' }, status: status, disabled: disabled, ref: containerRef, children: [_jsxs(Flex, { container: { alignItems: 'center' }, item: { grow: 1 }, as: StyledInputContainer, children: [_jsx(StyledInputButton, { "data-testid": testIds.control, ...restProps, id: id, disabled: disabled, "aria-haspopup": 'dialog', "aria-describedby": info ? `${id}-info` : undefined, "aria-controls": open ? `${id}-dialog` : undefined, className: createClassName('composite-input', className), readOnly: true, required: required, onClick: () => {
|
|
31
46
|
if (!disabled) {
|
|
@@ -43,10 +58,10 @@ export default withTestIds(forwardRef(function CompositeInput(props, ref) {
|
|
|
43
58
|
}, "aria-label": t(open ? 'composite_input_close_button_a11y' : 'composite_input_open_button_a11y'), disabled: disabled, tabIndex: '-1', children: _jsx(Icon, { name: open ? 'caret-up' : 'caret-down' }) }), onClear && (_jsx(StyledClearButton, { icon: true, variant: 'simple', label: t('clear'), onClick: () => {
|
|
44
59
|
onClear();
|
|
45
60
|
buttonRef.current?.focus();
|
|
46
|
-
}, disabled: disabled, children: _jsx(Icon, { name: 'times' }) }))] }), open && containerRef.current && (_jsx(FormDialog, { arrow: false, "aria-label": label, target: containerRef.current, placement: 'bottom-start', onCancel: () => onCancel
|
|
61
|
+
}, disabled: disabled, children: _jsx(Icon, { name: 'times' }) }))] }), open && containerRef.current && (_jsx(FormDialog, { arrow: false, "aria-label": label, target: containerRef.current, placement: 'bottom-start', onCancel: () => runDialogAction(onCancel), onSubmit: {
|
|
47
62
|
text: t('apply'),
|
|
48
|
-
handler: () => onApply
|
|
49
|
-
}, id: `${id}-dialog`, children: _jsx(Flex, { container: { direction: 'column' }, children: _jsx(Renderer, { ...rendererProps }) }) }))] }));
|
|
63
|
+
handler: () => runDialogAction(onApply)
|
|
64
|
+
}, onAfterClose: closePopover, id: `${id}-dialog`, children: _jsx(Flex, { container: { direction: 'column' }, children: _jsx(Renderer, { ...rendererProps }) }) }))] }));
|
|
50
65
|
return label ? (_jsx(FormField, { testId: testIds, label: label, labelHidden: labelHidden, id: id, info: info, status: status, required: required, disabled: disabled, labelId: labelId, additionalInfo: additionalInfo, children: Comp })) : (Comp);
|
|
51
66
|
}), getCompositeInputTestIds);
|
|
52
67
|
//# sourceMappingURL=CompositeInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeInput.js","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,YAAY,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAEpD,eAAe,WAAW,CACxB,UAA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AAC,CACyE,EAC5E,wBAAwB,CACzB,CAAC","sourcesContent":["import { forwardRef, useRef, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport Icon, { registerIcon } from '../Icon';\nimport * as caretDownIcon from '../Icon/icons/caret-down.icon';\nimport * as caretUpIcon from '../Icon/icons/caret-up.icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport type { RefElement } from '../../types';\nimport { useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport { StyledFormControl } from '../FormControl';\nimport { createClassName, withTestIds } from '../../utils';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport FormField from '../FormField';\nimport { FormDialog } from '../Dialog';\n\nimport {\n StyledClearButton,\n StyledCompositeInput,\n StyledInputButton,\n StyledInputContainer\n} from './CompositeInput.styles';\nimport type { CompositeInputProps } from './CompositeInput.types';\nimport { getCompositeInputTestIds } from './CompositeInput.test-ids';\n\nregisterIcon(caretDownIcon, caretUpIcon, timesIcon);\n\nexport default withTestIds(\n forwardRef<RefElement<CompositeInputProps>, PropsWithoutRef<CompositeInputProps>>(\n function CompositeInput(props, ref) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n disabled,\n value,\n onClear,\n required,\n status,\n info,\n label,\n labelHidden,\n additionalInfo,\n dialog: { renderer: Renderer, rendererProps, onApply, onCancel },\n className,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getCompositeInputTestIds);\n const t = useI18n();\n\n const [open, setOpen] = useState(false);\n\n const containerRef = useConsolidatedRef<HTMLDivElement>(ref);\n const buttonRef = useRef<HTMLInputElement>(null);\n\n const closePopover = () => {\n setOpen(false);\n buttonRef.current?.focus();\n };\n\n const labelId = `${id}-label`;\n\n const Comp = (\n <Flex\n as={StyledCompositeInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center' }}\n status={status}\n disabled={disabled}\n ref={containerRef}\n >\n <Flex container={{ alignItems: 'center' }} item={{ grow: 1 }} as={StyledInputContainer}>\n <StyledInputButton\n data-testid={testIds.control}\n {...restProps}\n id={id}\n disabled={disabled}\n aria-haspopup='dialog'\n aria-describedby={info ? `${id}-info` : undefined}\n aria-controls={open ? `${id}-dialog` : undefined}\n className={createClassName('composite-input', className)}\n readOnly\n required={required}\n onClick={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n e.preventDefault();\n setOpen(true);\n }\n }}\n value={value ?? ''}\n ref={buttonRef}\n />\n <Button\n icon\n variant='simple'\n onClick={() => {\n setOpen(!open);\n }}\n onMouseDown={(e: MouseEvent) => {\n e.preventDefault();\n }}\n aria-label={t(\n open ? 'composite_input_close_button_a11y' : 'composite_input_open_button_a11y'\n )}\n disabled={disabled}\n tabIndex='-1'\n >\n <Icon name={open ? 'caret-up' : 'caret-down'} />\n </Button>\n {onClear && (\n <StyledClearButton\n icon\n variant='simple'\n label={t('clear')}\n onClick={() => {\n onClear();\n buttonRef.current?.focus();\n }}\n disabled={disabled}\n >\n <Icon name='times' />\n </StyledClearButton>\n )}\n </Flex>\n\n {open && containerRef.current && (\n <FormDialog\n arrow={false}\n // FIXME: The wrath of optional labels, as a ReactNode, strikes again...\n aria-label={label as string}\n target={containerRef.current}\n placement='bottom-start'\n onCancel={() => onCancel({ close: closePopover })}\n onSubmit={{\n text: t('apply'),\n handler: () => onApply({ close: closePopover })\n }}\n id={`${id}-dialog`}\n >\n <Flex container={{ direction: 'column' }}>\n <Renderer {...rendererProps} />\n </Flex>\n </FormDialog>\n )}\n </Flex>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n labelId={labelId}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n ) as <P extends object>(props: CompositeInputProps<P>) => JSX.Element | null,\n getCompositeInputTestIds\n);\n"]}
|
|
1
|
+
{"version":3,"file":"CompositeInput.js","sourceRoot":"","sources":["../../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AI,CACL,CAAC;AACJ,CAAC,CACyE,EAC5E,wBAAwB,CACzB,CAAC","sourcesContent":["import { forwardRef, useRef, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport Icon, { registerIcon } from '../Icon';\nimport * as caretDownIcon from '../Icon/icons/caret-down.icon';\nimport * as caretUpIcon from '../Icon/icons/caret-up.icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport type { RefElement } from '../../types';\nimport { useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport { StyledFormControl } from '../FormControl';\nimport { createClassName, withTestIds } from '../../utils';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport FormField from '../FormField';\nimport { FormDialog } from '../Dialog';\n\nimport {\n StyledClearButton,\n StyledCompositeInput,\n StyledInputButton,\n StyledInputContainer\n} from './CompositeInput.styles';\nimport type { CompositeInputProps } from './CompositeInput.types';\nimport { getCompositeInputTestIds } from './CompositeInput.test-ids';\n\nregisterIcon(caretDownIcon, caretUpIcon, timesIcon);\n\nexport default withTestIds(\n forwardRef<RefElement<CompositeInputProps>, PropsWithoutRef<CompositeInputProps>>(\n function CompositeInput(props, ref) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n disabled,\n value,\n onClear,\n required,\n status,\n info,\n label,\n labelHidden,\n additionalInfo,\n dialog: { renderer: Renderer, rendererProps, onApply, onCancel },\n className,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getCompositeInputTestIds);\n const t = useI18n();\n\n const [open, setOpen] = useState(false);\n\n const containerRef = useConsolidatedRef<HTMLDivElement>(ref);\n const buttonRef = useRef<HTMLInputElement>(null);\n\n const closePopover = () => {\n setOpen(false);\n buttonRef.current?.focus();\n };\n\n const runDialogAction = (action: (args: { close: () => void }) => void) => {\n let pending = true;\n let shouldClose = false;\n action({\n close: () => {\n // Late calls cannot be reported as a result, so close immediately.\n if (pending) shouldClose = true;\n else closePopover();\n }\n });\n pending = false;\n return shouldClose;\n };\n\n const labelId = `${id}-label`;\n\n const Comp = (\n <Flex\n as={StyledCompositeInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center' }}\n status={status}\n disabled={disabled}\n ref={containerRef}\n >\n <Flex container={{ alignItems: 'center' }} item={{ grow: 1 }} as={StyledInputContainer}>\n <StyledInputButton\n data-testid={testIds.control}\n {...restProps}\n id={id}\n disabled={disabled}\n aria-haspopup='dialog'\n aria-describedby={info ? `${id}-info` : undefined}\n aria-controls={open ? `${id}-dialog` : undefined}\n className={createClassName('composite-input', className)}\n readOnly\n required={required}\n onClick={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n e.preventDefault();\n setOpen(true);\n }\n }}\n value={value ?? ''}\n ref={buttonRef}\n />\n <Button\n icon\n variant='simple'\n onClick={() => {\n setOpen(!open);\n }}\n onMouseDown={(e: MouseEvent) => {\n e.preventDefault();\n }}\n aria-label={t(\n open ? 'composite_input_close_button_a11y' : 'composite_input_open_button_a11y'\n )}\n disabled={disabled}\n tabIndex='-1'\n >\n <Icon name={open ? 'caret-up' : 'caret-down'} />\n </Button>\n {onClear && (\n <StyledClearButton\n icon\n variant='simple'\n label={t('clear')}\n onClick={() => {\n onClear();\n buttonRef.current?.focus();\n }}\n disabled={disabled}\n >\n <Icon name='times' />\n </StyledClearButton>\n )}\n </Flex>\n\n {open && containerRef.current && (\n <FormDialog\n arrow={false}\n // FIXME: The wrath of optional labels, as a ReactNode, strikes again...\n aria-label={label as string}\n target={containerRef.current}\n placement='bottom-start'\n onCancel={() => runDialogAction(onCancel)}\n onSubmit={{\n text: t('apply'),\n handler: () => runDialogAction(onApply)\n }}\n onAfterClose={closePopover}\n id={`${id}-dialog`}\n >\n <Flex container={{ direction: 'column' }}>\n <Renderer {...rendererProps} />\n </Flex>\n </FormDialog>\n )}\n </Flex>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n labelId={labelId}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n ) as <P extends object>(props: CompositeInputProps<P>) => JSX.Element | null,\n getCompositeInputTestIds\n);\n"]}
|
|
@@ -7,7 +7,7 @@ import FormField, { StyledFormFieldInfo } from '../../FormField';
|
|
|
7
7
|
import Flex from '../../Flex';
|
|
8
8
|
import Icon, { registerIcon } from '../../Icon';
|
|
9
9
|
import * as calendarIcon from '../../Icon/icons/calendar.icon';
|
|
10
|
-
import
|
|
10
|
+
import TouchDialog from '../../Dialog/TouchDialog';
|
|
11
11
|
import DatePicker from '../Picker/DatePicker';
|
|
12
12
|
import { StyledFormControl } from '../../FormControl';
|
|
13
13
|
import { createClassName, isInstance, isTouchDevice, withTestIds } from '../../../utils';
|