@okta/odyssey-react-mui 1.33.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Buttons/BaseButton.cjs +1 -1
- package/dist/cjs/Buttons/BaseButton.cjs.map +1 -1
- package/dist/cjs/Dialog.cjs +9 -1
- package/dist/cjs/Dialog.cjs.map +1 -1
- package/dist/cjs/Select.cjs +3 -1
- package/dist/cjs/Select.cjs.map +1 -1
- package/dist/cjs/Typography.cjs +8 -4
- package/dist/cjs/Typography.cjs.map +1 -1
- package/dist/cjs/labs/DatePickers/DateTimePicker.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/PickerWithOptionAdornment.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/SearchDropdown.cjs +269 -0
- package/dist/cjs/labs/OdysseyPickers/SearchDropdown.cjs.map +1 -0
- package/dist/cjs/labs/OdysseyPickers/index.cjs +9 -1
- package/dist/cjs/labs/OdysseyPickers/index.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +19 -6
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +2 -2
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs +3 -3
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +6 -0
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShellProvider.cjs +11 -8
- package/dist/cjs/ui-shell/UiShellProvider.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +2 -2
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +13 -0
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs +2 -1
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs.map +1 -1
- package/dist/esm/Buttons/BaseButton.js +1 -1
- package/dist/esm/Buttons/BaseButton.js.map +1 -1
- package/dist/esm/Dialog.js +9 -1
- package/dist/esm/Dialog.js.map +1 -1
- package/dist/esm/Select.js +3 -1
- package/dist/esm/Select.js.map +1 -1
- package/dist/esm/Typography.js +8 -4
- package/dist/esm/Typography.js.map +1 -1
- package/dist/esm/labs/DatePickers/DateTimePicker.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/PickerWithOptionAdornment.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/SearchDropdown.js +263 -0
- package/dist/esm/labs/OdysseyPickers/SearchDropdown.js.map +1 -0
- package/dist/esm/labs/OdysseyPickers/index.js +1 -0
- package/dist/esm/labs/OdysseyPickers/index.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +20 -7
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNav.js +2 -2
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js +3 -3
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +6 -0
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/UiShellProvider.js +9 -7
- package/dist/esm/ui-shell/UiShellProvider.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +13 -0
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/uiShellSharedConstants.js +1 -0
- package/dist/esm/ui-shell/uiShellSharedConstants.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.scss +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/types/Buttons/BaseButton.d.ts +1 -1
- package/dist/types/Dialog.d.ts.map +1 -1
- package/dist/types/Select.d.ts +1 -0
- package/dist/types/Select.d.ts.map +1 -1
- package/dist/types/Typography.d.ts +6 -2
- package/dist/types/Typography.d.ts.map +1 -1
- package/dist/types/labs/DatePickers/DateTimePicker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/SearchDropdown.d.ts +33 -0
- package/dist/types/labs/OdysseyPickers/SearchDropdown.d.ts.map +1 -0
- package/dist/types/labs/OdysseyPickers/index.d.ts +2 -0
- package/dist/types/labs/OdysseyPickers/index.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts +5 -20
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShellProvider.d.ts +33 -6
- package/dist/types/ui-shell/UiShellProvider.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +2 -0
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts +1 -0
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerWithOptionAdornment.cjs","names":["_react","require","_styled","_interopRequireDefault","_Box","_ComposablePicker","_OdysseyDesignTokensContext","_Picker","_Typography","_Tag","_jsxRuntime","e","__esModule","default","OptionAdornmentContainer","styled","shouldForwardProp","prop","adornmentSize","isTagContainer","odysseyDesignTokens","position","bottom","alignSelf","width","Spacing5","height","overflow","marginInlineEnd","Spacing3","svg","img","top","left","transform","Spacing8","Spacing4","maxHeight","Spacing2","display","OptionAdornment","adornment","isImageAdornment","jsx","children","src","alt","role","OptionWithLabelDescriptionOnly","muiProps","option","description","label","value","jsxs","Option","hasAdornment","OptionLabelContainer","Heading6","component","OptionDescriptionComponent","OptionWithLabelDescriptionMetadata","metaData","OptionMetadataComponent","TagAdornment","useOdysseyDesignTokens","PickerWithOptionAdornment","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","groupOptionsBy","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","testId","translate","customTagRender","useCallback","values","getTagProps","map","index","key","onDelete","Box","sx","margin","Spacing1","Tag","icon","onRemove","customOptionRender","hasMetadata","ComposablePicker","renderOption","renderTags","MemoizedPickerWithOptionAdornment","exports","memo","displayName"],"sources":["../../../../src/labs/OdysseyPickers/PickerWithOptionAdornment.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n ReactNode,\n useCallback,\n} from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { Box } from \"../../Box.js\";\nimport {\n ComposablePicker,\n ComposablePickerProps,\n type AdornmentSize,\n type BasePickerProps,\n type BasePickerType,\n} from \"./ComposablePicker.js\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport {\n type BaseOptionProps,\n type LabelDescription,\n type Metadata,\n Option,\n OptionDescriptionComponent,\n OptionLabelContainer,\n OptionMetadataComponent,\n OptionProps,\n} from \"./Picker.js\";\nimport { Heading6 } from \"../../Typography.js\";\nimport { Tag } from \"../../Tag.js\";\n\ntype Adornment = ReactNode | string;\n\ntype AdornmentLabelDescription = LabelDescription & {\n adornment: Adornment;\n};\n\ntype AdornmentLabelDescriptionMetadata = AdornmentLabelDescription & Metadata;\n\nexport type AdornmentOptionType =\n | AdornmentLabelDescription\n | AdornmentLabelDescriptionMetadata;\n\nconst OptionAdornmentContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"adornmentSize\" &&\n prop !== \"isTagContainer\",\n})<{\n adornmentSize?: AdornmentSize;\n isTagContainer?: boolean;\n odysseyDesignTokens: DesignTokens;\n}>(\n ({\n adornmentSize = \"small\",\n isTagContainer = false,\n odysseyDesignTokens,\n }) => ({\n position: \"relative\",\n // push icon up by one px for better visual alignment\n bottom: \"1px\",\n alignSelf: \"flex-start\",\n width: odysseyDesignTokens.Spacing5,\n height: odysseyDesignTokens.Spacing5,\n overflow: \"hidden\",\n marginInlineEnd: odysseyDesignTokens.Spacing3,\n\n svg: {\n width: \"100%\",\n height: \"auto\",\n },\n\n img: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"100%\",\n transform: \"translate(-50%, -50%)\",\n },\n\n ...(adornmentSize === \"large\" &&\n !isTagContainer && {\n bottom: 0,\n width: odysseyDesignTokens.Spacing8,\n height: odysseyDesignTokens.Spacing8,\n }),\n\n ...(isTagContainer && {\n bottom: 0,\n alignSelf: \"center\",\n width: odysseyDesignTokens.Spacing4,\n height: \"auto\",\n maxHeight: odysseyDesignTokens.Spacing4,\n marginInlineEnd: odysseyDesignTokens.Spacing2,\n\n svg: {\n display: \"flex\",\n width: \"100%\",\n height: \"auto\",\n },\n }),\n }),\n);\n\ntype OptionAdornmentProps = {\n adornment: Adornment;\n adornmentSize: AdornmentSize;\n odysseyDesignTokens: DesignTokens;\n};\n\nconst OptionAdornment = ({\n adornment,\n adornmentSize,\n odysseyDesignTokens,\n}: OptionAdornmentProps) => {\n const isImageAdornment = typeof adornment === \"string\";\n\n if (isImageAdornment) {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {/* NOTE: Intentionally leaving alt as an empty string here so screen readers will ignore this image */}\n {/* Image should be suffciently described by the adjacent title and/or description of the option */}\n <img src={adornment} alt=\"\" role=\"presentation\" />\n </OptionAdornmentContainer>\n );\n } else {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {adornment}\n </OptionAdornmentContainer>\n );\n }\n};\n\nconst OptionWithLabelDescriptionOnly = <\n OptionType extends AdornmentLabelDescription,\n>({\n adornmentSize,\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps &\n OptionProps<OptionType> & { adornmentSize: AdornmentSize }) => {\n const { adornment, description, label, value } = option;\n return (\n <Option hasAdornment key={value} muiProps={muiProps}>\n <OptionAdornment\n adornment={adornment}\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n </Option>\n );\n};\n\nconst OptionWithLabelDescriptionMetadata = <\n OptionType extends AdornmentLabelDescriptionMetadata,\n>({\n adornmentSize,\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps &\n OptionProps<OptionType> & {\n adornmentSize: AdornmentSize;\n }) => {\n const { adornment, description, label, metaData, value } = option;\n\n return (\n <Option hasAdornment key={value} muiProps={muiProps}>\n <OptionAdornment\n adornment={adornment}\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <div>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n <OptionMetadataComponent\n metaData={metaData}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </div>\n </Option>\n );\n};\n\ntype TagAdornmentProps = {\n adornment: Adornment;\n};\n\nconst TagAdornment = ({ adornment }: TagAdornmentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const isImageAdornment = typeof adornment === \"string\";\n\n if (isImageAdornment) {\n return (\n <OptionAdornmentContainer\n isTagContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <img src={adornment} alt=\"\" role=\"presentation\" />\n </OptionAdornmentContainer>\n );\n }\n\n return (\n <OptionAdornmentContainer\n isTagContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {adornment}\n </OptionAdornmentContainer>\n );\n};\n\nexport type PickerWithOptionAdornmentProps<\n OptionType extends AdornmentOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n};\n\ntype PickerWithOptionAdornmentComponentType = {\n <\n OptionType extends AdornmentLabelDescription,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n <\n OptionType extends AdornmentLabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n};\n\nconst PickerWithOptionAdornment: PickerWithOptionAdornmentComponentType = <\n OptionType extends AdornmentOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n adornmentSize = \"small\",\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n groupOptionsBy,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n testId,\n translate,\n}: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const customTagRender = useCallback<\n NonNullable<\n ComposablePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >[\"renderTags\"]\n >\n >(\n (values, getTagProps) =>\n values.map((value, index) => {\n const { key, onDelete } = getTagProps({ index });\n const { adornment, label } = value;\n\n return (\n <Box\n key={key}\n sx={{\n margin: odysseyDesignTokens.Spacing1,\n marginInlineEnd: 0,\n }}\n >\n <Tag\n icon={<TagAdornment adornment={adornment} />}\n label={label}\n onRemove={onDelete}\n />\n </Box>\n );\n }),\n [odysseyDesignTokens],\n );\n\n const customOptionRender = useCallback<\n (props: HTMLAttributes<HTMLLIElement>, option: OptionType) => ReactNode\n >(\n (muiProps, option) => {\n const hasMetadata = \"metaData\" in option && option.metaData;\n\n if (hasMetadata) {\n return (\n <OptionWithLabelDescriptionMetadata\n adornmentSize={adornmentSize}\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n }\n\n return (\n <OptionWithLabelDescriptionOnly\n adornmentSize={adornmentSize}\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n },\n [adornmentSize, odysseyDesignTokens],\n );\n\n return (\n <ComposablePicker<OptionType, HasMultipleChoices, IsCustomValueAllowed>\n ariaDescribedBy={ariaDescribedBy}\n defaultValue={defaultValue}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n getIsOptionEqualToValue={getIsOptionEqualToValue}\n groupOptionsBy={groupOptionsBy}\n hasMultipleChoices={hasMultipleChoices}\n id={idOverride}\n inputValue={inputValue}\n isCustomValueAllowed={isCustomValueAllowed}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n isOptional={isOptional}\n isReadOnly={isReadOnly}\n isVirtualized={isVirtualizedProp}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n name={nameOverride}\n onBlur={onBlur}\n onChange={onChangeProp}\n onInputChange={onInputChangeProp}\n onFocus={onFocus}\n options={options}\n renderOption={customOptionRender}\n renderTags={customTagRender}\n value={value}\n testId={testId}\n translate={translate}\n />\n );\n};\n\n// Need the `as BasePickerType` because generics don't get passed through\nconst MemoizedPickerWithOptionAdornment = memo(\n PickerWithOptionAdornment,\n) as BasePickerType;\n\nMemoizedPickerWithOptionAdornment.displayName = \"PickerWithOptionAdornment\";\n\nexport { MemoizedPickerWithOptionAdornment as PickerWithOptionAdornment };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAOA,IAAAK,2BAAA,GAAAL,OAAA;AAIA,IAAAM,OAAA,GAAAN,OAAA;AAUA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AAAmC,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAE,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA5C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A,MAAO;IACfC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMqB,iCAAiC,GAAAC,OAAA,CAAArD,yBAAA,GAAG,IAAAsD,WAAI,EAC5CtD,yBACF,CAAmB;AAEnBoD,iCAAiC,CAACG,WAAW,GAAG,2BAA2B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PickerWithOptionAdornment.cjs","names":["_react","require","_styled","_interopRequireDefault","_Box","_ComposablePicker","_OdysseyDesignTokensContext","_Picker","_Typography","_Tag","_jsxRuntime","e","__esModule","default","OptionAdornmentContainer","styled","shouldForwardProp","prop","adornmentSize","isTagContainer","odysseyDesignTokens","position","bottom","alignSelf","width","Spacing5","height","overflow","marginInlineEnd","Spacing3","svg","img","top","left","transform","Spacing8","Spacing4","maxHeight","Spacing2","display","OptionAdornment","adornment","isImageAdornment","jsx","children","src","alt","role","OptionWithLabelDescriptionOnly","muiProps","option","description","label","value","jsxs","Option","hasAdornment","OptionLabelContainer","Heading6","component","OptionDescriptionComponent","OptionWithLabelDescriptionMetadata","metaData","OptionMetadataComponent","TagAdornment","useOdysseyDesignTokens","PickerWithOptionAdornment","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","groupOptionsBy","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","testId","translate","customTagRender","useCallback","values","getTagProps","map","index","key","onDelete","Box","sx","margin","Spacing1","Tag","icon","onRemove","customOptionRender","hasMetadata","ComposablePicker","renderOption","renderTags","MemoizedPickerWithOptionAdornment","exports","memo","displayName"],"sources":["../../../../src/labs/OdysseyPickers/PickerWithOptionAdornment.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n ReactNode,\n useCallback,\n} from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { Box } from \"../../Box.js\";\nimport {\n ComposablePicker,\n ComposablePickerProps,\n type AdornmentSize,\n type BasePickerProps,\n type BasePickerType,\n} from \"./ComposablePicker.js\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport {\n type BaseOptionProps,\n type LabelDescription,\n type Metadata,\n Option,\n OptionDescriptionComponent,\n OptionLabelContainer,\n OptionMetadataComponent,\n OptionProps,\n} from \"./Picker.js\";\nimport { Heading6 } from \"../../Typography.js\";\nimport { Tag } from \"../../Tag.js\";\n\ntype Adornment = ReactNode | string;\n\ntype AdornmentLabelDescription = LabelDescription & {\n adornment: Adornment;\n};\n\ntype AdornmentLabelDescriptionMetadata = AdornmentLabelDescription & Metadata;\n\nexport type AdornmentOptionType =\n | AdornmentLabelDescription\n | AdornmentLabelDescriptionMetadata;\n\nconst OptionAdornmentContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"adornmentSize\" &&\n prop !== \"isTagContainer\",\n})<{\n adornmentSize?: AdornmentSize;\n isTagContainer?: boolean;\n odysseyDesignTokens: DesignTokens;\n}>(\n ({\n adornmentSize = \"small\",\n isTagContainer = false,\n odysseyDesignTokens,\n }) => ({\n position: \"relative\",\n // push icon up by one px for better visual alignment\n bottom: \"1px\",\n alignSelf: \"flex-start\",\n width: odysseyDesignTokens.Spacing5,\n height: odysseyDesignTokens.Spacing5,\n overflow: \"hidden\",\n marginInlineEnd: odysseyDesignTokens.Spacing3,\n\n svg: {\n width: \"100%\",\n height: \"auto\",\n },\n\n img: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"100%\",\n transform: \"translate(-50%, -50%)\",\n },\n\n ...(adornmentSize === \"large\" &&\n !isTagContainer && {\n bottom: 0,\n width: odysseyDesignTokens.Spacing8,\n height: odysseyDesignTokens.Spacing8,\n }),\n\n ...(isTagContainer && {\n bottom: 0,\n alignSelf: \"center\",\n width: odysseyDesignTokens.Spacing4,\n height: \"auto\",\n maxHeight: odysseyDesignTokens.Spacing4,\n marginInlineEnd: odysseyDesignTokens.Spacing2,\n\n svg: {\n display: \"flex\",\n width: \"100%\",\n height: \"auto\",\n },\n }),\n }),\n);\n\ntype OptionAdornmentProps = {\n adornment: Adornment;\n adornmentSize: AdornmentSize;\n odysseyDesignTokens: DesignTokens;\n};\n\nconst OptionAdornment = ({\n adornment,\n adornmentSize,\n odysseyDesignTokens,\n}: OptionAdornmentProps) => {\n const isImageAdornment = typeof adornment === \"string\";\n\n if (isImageAdornment) {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {/* NOTE: Intentionally leaving alt as an empty string here so screen readers will ignore this image */}\n {/* Image should be sufficiently described by the adjacent title and/or description of the option */}\n <img src={adornment} alt=\"\" role=\"presentation\" />\n </OptionAdornmentContainer>\n );\n } else {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {adornment}\n </OptionAdornmentContainer>\n );\n }\n};\n\nconst OptionWithLabelDescriptionOnly = <\n OptionType extends AdornmentLabelDescription,\n>({\n adornmentSize,\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps &\n OptionProps<OptionType> & { adornmentSize: AdornmentSize }) => {\n const { adornment, description, label, value } = option;\n return (\n <Option hasAdornment key={value} muiProps={muiProps}>\n <OptionAdornment\n adornment={adornment}\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n </Option>\n );\n};\n\nconst OptionWithLabelDescriptionMetadata = <\n OptionType extends AdornmentLabelDescriptionMetadata,\n>({\n adornmentSize,\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps &\n OptionProps<OptionType> & {\n adornmentSize: AdornmentSize;\n }) => {\n const { adornment, description, label, metaData, value } = option;\n\n return (\n <Option hasAdornment key={value} muiProps={muiProps}>\n <OptionAdornment\n adornment={adornment}\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <div>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n <OptionMetadataComponent\n metaData={metaData}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </div>\n </Option>\n );\n};\n\ntype TagAdornmentProps = {\n adornment: Adornment;\n};\n\nconst TagAdornment = ({ adornment }: TagAdornmentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const isImageAdornment = typeof adornment === \"string\";\n\n if (isImageAdornment) {\n return (\n <OptionAdornmentContainer\n isTagContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <img src={adornment} alt=\"\" role=\"presentation\" />\n </OptionAdornmentContainer>\n );\n }\n\n return (\n <OptionAdornmentContainer\n isTagContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {adornment}\n </OptionAdornmentContainer>\n );\n};\n\nexport type PickerWithOptionAdornmentProps<\n OptionType extends AdornmentOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n};\n\ntype PickerWithOptionAdornmentComponentType = {\n <\n OptionType extends AdornmentLabelDescription,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n <\n OptionType extends AdornmentLabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n};\n\nconst PickerWithOptionAdornment: PickerWithOptionAdornmentComponentType = <\n OptionType extends AdornmentOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n adornmentSize = \"small\",\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n groupOptionsBy,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n testId,\n translate,\n}: PickerWithOptionAdornmentProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const customTagRender = useCallback<\n NonNullable<\n ComposablePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >[\"renderTags\"]\n >\n >(\n (values, getTagProps) =>\n values.map((value, index) => {\n const { key, onDelete } = getTagProps({ index });\n const { adornment, label } = value;\n\n return (\n <Box\n key={key}\n sx={{\n margin: odysseyDesignTokens.Spacing1,\n marginInlineEnd: 0,\n }}\n >\n <Tag\n icon={<TagAdornment adornment={adornment} />}\n label={label}\n onRemove={onDelete}\n />\n </Box>\n );\n }),\n [odysseyDesignTokens],\n );\n\n const customOptionRender = useCallback<\n (props: HTMLAttributes<HTMLLIElement>, option: OptionType) => ReactNode\n >(\n (muiProps, option) => {\n const hasMetadata = \"metaData\" in option && option.metaData;\n\n if (hasMetadata) {\n return (\n <OptionWithLabelDescriptionMetadata\n adornmentSize={adornmentSize}\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n }\n\n return (\n <OptionWithLabelDescriptionOnly\n adornmentSize={adornmentSize}\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n },\n [adornmentSize, odysseyDesignTokens],\n );\n\n return (\n <ComposablePicker<OptionType, HasMultipleChoices, IsCustomValueAllowed>\n ariaDescribedBy={ariaDescribedBy}\n defaultValue={defaultValue}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n getIsOptionEqualToValue={getIsOptionEqualToValue}\n groupOptionsBy={groupOptionsBy}\n hasMultipleChoices={hasMultipleChoices}\n id={idOverride}\n inputValue={inputValue}\n isCustomValueAllowed={isCustomValueAllowed}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n isOptional={isOptional}\n isReadOnly={isReadOnly}\n isVirtualized={isVirtualizedProp}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n name={nameOverride}\n onBlur={onBlur}\n onChange={onChangeProp}\n onInputChange={onInputChangeProp}\n onFocus={onFocus}\n options={options}\n renderOption={customOptionRender}\n renderTags={customTagRender}\n value={value}\n testId={testId}\n translate={translate}\n />\n );\n};\n\n// Need the `as BasePickerType` because generics don't get passed through\nconst MemoizedPickerWithOptionAdornment = memo(\n PickerWithOptionAdornment,\n) as BasePickerType;\n\nMemoizedPickerWithOptionAdornment.displayName = \"PickerWithOptionAdornment\";\n\nexport { Memoiz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EAAEA,WAAY;IACzBC,SAAS,EAAEA,SAAU;IACrBC,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBC,aAAa,EAAEC,iBAAkB;IACjCC,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrClC,KAAK,EAAEA,KAAM;IACbmC,IAAI,EAAEC,YAAa;IACnBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEC,YAAa;IACvBC,aAAa,EAAEC,iBAAkB;IACjCC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBqB,YAAY,EAAEH,kBAAmB;IACjCI,UAAU,EAAEnB,eAAgB;IAC5B7C,KAAK,EAAEA,KAAM;IACb2C,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMqB,iCAAiC,GAAAC,OAAA,CAAArD,yBAAA,GAAG,IAAAsD,WAAI,EAC5CtD,yBACF,CAAmB;AAEnBoD,iCAAiC,CAACG,WAAW,GAAG,2BAA2B","ignoreList":[]}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SearchDropdown = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _ComposablePicker = require("./ComposablePicker.cjs");
|
|
10
|
+
var _OdysseyDesignTokensContext = require("../../OdysseyDesignTokensContext.cjs");
|
|
11
|
+
var _Picker = require("./Picker.cjs");
|
|
12
|
+
var _Typography = require("../../Typography.cjs");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
/*!
|
|
16
|
+
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
17
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
18
|
+
*
|
|
19
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
22
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
*
|
|
24
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const OptionAdornmentContainer = (0, _styled.default)("div", {
|
|
28
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "adornmentSize" && prop !== "isTagContainer"
|
|
29
|
+
})(({
|
|
30
|
+
adornmentSize = "small",
|
|
31
|
+
isTagContainer = false,
|
|
32
|
+
odysseyDesignTokens,
|
|
33
|
+
position = "left"
|
|
34
|
+
}) => ({
|
|
35
|
+
position: "relative",
|
|
36
|
+
bottom: "1px",
|
|
37
|
+
alignSelf: "flex-start",
|
|
38
|
+
width: odysseyDesignTokens.Spacing5,
|
|
39
|
+
height: odysseyDesignTokens.Spacing5,
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
...(position === "left" && {
|
|
42
|
+
marginInlineEnd: odysseyDesignTokens.Spacing3
|
|
43
|
+
}),
|
|
44
|
+
...(position === "right" && {
|
|
45
|
+
marginInlineStart: odysseyDesignTokens.Spacing3
|
|
46
|
+
}),
|
|
47
|
+
svg: {
|
|
48
|
+
width: "100%",
|
|
49
|
+
height: "auto"
|
|
50
|
+
},
|
|
51
|
+
img: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: "50%",
|
|
54
|
+
left: "50%",
|
|
55
|
+
width: "100%",
|
|
56
|
+
transform: "translate(-50%, -50%)"
|
|
57
|
+
},
|
|
58
|
+
...(adornmentSize === "large" && !isTagContainer && {
|
|
59
|
+
bottom: 0,
|
|
60
|
+
width: odysseyDesignTokens.Spacing8,
|
|
61
|
+
height: odysseyDesignTokens.Spacing8
|
|
62
|
+
}),
|
|
63
|
+
...(isTagContainer && {
|
|
64
|
+
bottom: 0,
|
|
65
|
+
alignSelf: "center",
|
|
66
|
+
width: odysseyDesignTokens.Spacing4,
|
|
67
|
+
height: "auto",
|
|
68
|
+
maxHeight: odysseyDesignTokens.Spacing4,
|
|
69
|
+
marginInlineEnd: odysseyDesignTokens.Spacing2,
|
|
70
|
+
svg: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
width: "100%",
|
|
73
|
+
height: "auto"
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}));
|
|
77
|
+
const CustomOptionContainer = (0, _styled.default)("div", {
|
|
78
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
79
|
+
})(() => ({
|
|
80
|
+
display: "flex",
|
|
81
|
+
justifyContent: "space-between",
|
|
82
|
+
width: "100%"
|
|
83
|
+
}));
|
|
84
|
+
const CustomOptionLeftContainer = (0, _styled.default)("div", {
|
|
85
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
86
|
+
})(() => ({
|
|
87
|
+
display: "flex"
|
|
88
|
+
}));
|
|
89
|
+
const OptionAdornment = ({
|
|
90
|
+
adornment,
|
|
91
|
+
adornmentSize,
|
|
92
|
+
odysseyDesignTokens
|
|
93
|
+
}) => {
|
|
94
|
+
const isImageAdornment = typeof adornment === "string";
|
|
95
|
+
if (isImageAdornment) {
|
|
96
|
+
return (0, _jsxRuntime.jsx)(OptionAdornmentContainer, {
|
|
97
|
+
adornmentSize: adornmentSize,
|
|
98
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
99
|
+
children: (0, _jsxRuntime.jsx)("img", {
|
|
100
|
+
src: adornment,
|
|
101
|
+
alt: "",
|
|
102
|
+
role: "presentation"
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
return (0, _jsxRuntime.jsx)(OptionAdornmentContainer, {
|
|
107
|
+
adornmentSize: adornmentSize,
|
|
108
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
109
|
+
children: adornment
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const Extra = ({
|
|
114
|
+
content,
|
|
115
|
+
size,
|
|
116
|
+
odysseyDesignTokens,
|
|
117
|
+
onClick
|
|
118
|
+
}) => {
|
|
119
|
+
const handleClick = (0, _react.useCallback)(event => {
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
onClick();
|
|
122
|
+
}, [onClick]);
|
|
123
|
+
return (0, _jsxRuntime.jsx)(OptionAdornmentContainer, {
|
|
124
|
+
adornmentSize: size,
|
|
125
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
126
|
+
onClick: handleClick,
|
|
127
|
+
children: content
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const CustomOption = ({
|
|
131
|
+
adornmentSize,
|
|
132
|
+
muiProps,
|
|
133
|
+
odysseyDesignTokens,
|
|
134
|
+
option
|
|
135
|
+
}) => {
|
|
136
|
+
const {
|
|
137
|
+
adornment,
|
|
138
|
+
description,
|
|
139
|
+
label,
|
|
140
|
+
metaData,
|
|
141
|
+
extra,
|
|
142
|
+
value,
|
|
143
|
+
onClick,
|
|
144
|
+
isInteractive = true
|
|
145
|
+
} = option;
|
|
146
|
+
const handleOptionClick = (0, _react.useCallback)(event => {
|
|
147
|
+
if (!isInteractive) {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
event.stopPropagation();
|
|
152
|
+
onClick?.();
|
|
153
|
+
}, [onClick, isInteractive]);
|
|
154
|
+
const extendedMuiProps = (0, _react.useMemo)(() => {
|
|
155
|
+
return {
|
|
156
|
+
...muiProps,
|
|
157
|
+
onClick: isInteractive ? handleOptionClick : undefined,
|
|
158
|
+
"aria-disabled": !isInteractive ? "true" : undefined,
|
|
159
|
+
role: "option"
|
|
160
|
+
};
|
|
161
|
+
}, [muiProps, isInteractive, handleOptionClick]);
|
|
162
|
+
return (0, _jsxRuntime.jsx)(_Picker.Option, {
|
|
163
|
+
hasAdornment: true,
|
|
164
|
+
muiProps: extendedMuiProps,
|
|
165
|
+
children: (0, _jsxRuntime.jsxs)(CustomOptionContainer, {
|
|
166
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
167
|
+
children: [(0, _jsxRuntime.jsxs)(CustomOptionLeftContainer, {
|
|
168
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
169
|
+
children: [(0, _jsxRuntime.jsx)(OptionAdornment, {
|
|
170
|
+
adornment: adornment,
|
|
171
|
+
adornmentSize: adornmentSize,
|
|
172
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
173
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
174
|
+
children: [(0, _jsxRuntime.jsxs)(_Picker.OptionLabelContainer, {
|
|
175
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
176
|
+
children: [(0, _jsxRuntime.jsx)(_Typography.Heading6, {
|
|
177
|
+
component: "p",
|
|
178
|
+
children: label
|
|
179
|
+
}), (0, _jsxRuntime.jsx)(_Picker.OptionDescriptionComponent, {
|
|
180
|
+
description: description,
|
|
181
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
182
|
+
})]
|
|
183
|
+
}), metaData && (0, _jsxRuntime.jsx)(_Picker.OptionMetadataComponent, {
|
|
184
|
+
metaData: metaData,
|
|
185
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
186
|
+
})]
|
|
187
|
+
})]
|
|
188
|
+
}), extra && (0, _jsxRuntime.jsx)(Extra, {
|
|
189
|
+
content: extra.content,
|
|
190
|
+
size: extra.size || adornmentSize,
|
|
191
|
+
onClick: extra.onClick,
|
|
192
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
193
|
+
})]
|
|
194
|
+
})
|
|
195
|
+
}, value);
|
|
196
|
+
};
|
|
197
|
+
const SearchDropdown = ({
|
|
198
|
+
adornmentSize = "small",
|
|
199
|
+
ariaDescribedBy,
|
|
200
|
+
defaultValue,
|
|
201
|
+
errorMessage,
|
|
202
|
+
errorMessageList,
|
|
203
|
+
getIsOptionEqualToValue,
|
|
204
|
+
groupOptionsBy,
|
|
205
|
+
id: idOverride,
|
|
206
|
+
inputValue,
|
|
207
|
+
isCustomValueAllowed,
|
|
208
|
+
isDisabled,
|
|
209
|
+
isFullWidth = false,
|
|
210
|
+
isLoading,
|
|
211
|
+
isOptional = false,
|
|
212
|
+
isReadOnly,
|
|
213
|
+
isVirtualized: isVirtualizedProp = false,
|
|
214
|
+
hint,
|
|
215
|
+
HintLinkComponent,
|
|
216
|
+
label,
|
|
217
|
+
name: nameOverride,
|
|
218
|
+
onBlur,
|
|
219
|
+
onChange: onChangeProp,
|
|
220
|
+
onInputChange: onInputChangeProp,
|
|
221
|
+
onFocus,
|
|
222
|
+
options,
|
|
223
|
+
value,
|
|
224
|
+
testId,
|
|
225
|
+
translate
|
|
226
|
+
}) => {
|
|
227
|
+
const odysseyDesignTokens = (0, _OdysseyDesignTokensContext.useOdysseyDesignTokens)();
|
|
228
|
+
const customOptionRender = (0, _react.useCallback)((muiProps, option) => {
|
|
229
|
+
return (0, _jsxRuntime.jsx)(CustomOption, {
|
|
230
|
+
adornmentSize: adornmentSize,
|
|
231
|
+
muiProps: muiProps,
|
|
232
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
233
|
+
option: option
|
|
234
|
+
});
|
|
235
|
+
}, [adornmentSize, odysseyDesignTokens]);
|
|
236
|
+
return (0, _jsxRuntime.jsx)(_ComposablePicker.ComposablePicker, {
|
|
237
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
238
|
+
defaultValue: defaultValue,
|
|
239
|
+
errorMessage: errorMessage,
|
|
240
|
+
errorMessageList: errorMessageList,
|
|
241
|
+
getIsOptionEqualToValue: getIsOptionEqualToValue,
|
|
242
|
+
groupOptionsBy: groupOptionsBy,
|
|
243
|
+
id: idOverride,
|
|
244
|
+
inputValue: inputValue,
|
|
245
|
+
isCustomValueAllowed: isCustomValueAllowed,
|
|
246
|
+
isDisabled: isDisabled,
|
|
247
|
+
isFullWidth: isFullWidth,
|
|
248
|
+
isLoading: isLoading,
|
|
249
|
+
isOptional: isOptional,
|
|
250
|
+
isReadOnly: isReadOnly,
|
|
251
|
+
isVirtualized: isVirtualizedProp,
|
|
252
|
+
hint: hint,
|
|
253
|
+
HintLinkComponent: HintLinkComponent,
|
|
254
|
+
label: label,
|
|
255
|
+
name: nameOverride,
|
|
256
|
+
onBlur: onBlur,
|
|
257
|
+
onChange: onChangeProp,
|
|
258
|
+
onInputChange: onInputChangeProp,
|
|
259
|
+
onFocus: onFocus,
|
|
260
|
+
options: options,
|
|
261
|
+
renderOption: customOptionRender,
|
|
262
|
+
value: value,
|
|
263
|
+
testId: testId,
|
|
264
|
+
translate: translate
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
const MemoizedSearchDropdown = exports.SearchDropdown = (0, _react.memo)(SearchDropdown);
|
|
268
|
+
MemoizedSearchDropdown.displayName = "MemoizedSearchDropdown";
|
|
269
|
+
//# sourceMappingURL=SearchDropdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchDropdown.cjs","names":["_react","require","_styled","_interopRequireDefault","_ComposablePicker","_OdysseyDesignTokensContext","_Picker","_Typography","_jsxRuntime","e","__esModule","default","OptionAdornmentContainer","styled","shouldForwardProp","prop","adornmentSize","isTagContainer","odysseyDesignTokens","position","bottom","alignSelf","width","Spacing5","height","overflow","marginInlineEnd","Spacing3","marginInlineStart","svg","img","top","left","transform","Spacing8","Spacing4","maxHeight","Spacing2","display","CustomOptionContainer","justifyContent","CustomOptionLeftContainer","OptionAdornment","adornment","isImageAdornment","jsx","children","src","alt","role","Extra","content","size","onClick","handleClick","useCallback","event","stopPropagation","CustomOption","muiProps","option","description","label","metaData","extra","value","isInteractive","handleOptionClick","preventDefault","extendedMuiProps","useMemo","undefined","Option","hasAdornment","jsxs","OptionLabelContainer","Heading6","component","OptionDescriptionComponent","OptionMetadataComponent","SearchDropdown","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","groupOptionsBy","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","testId","translate","useOdysseyDesignTokens","customOptionRender","ComposablePicker","renderOption","MemoizedSearchDropdown","exports","memo","displayName"],"sources":["../../../../src/labs/OdysseyPickers/SearchDropdown.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n ReactNode,\n useCallback,\n useMemo,\n} from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport {\n ComposablePicker,\n type AdornmentSize,\n type BasePickerProps,\n type BasePickerType,\n} from \"./ComposablePicker.js\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport {\n type BaseOptionProps,\n type LabelDescription,\n type Metadata,\n Option,\n OptionDescriptionComponent,\n OptionLabelContainer,\n OptionMetadataComponent,\n OptionProps,\n} from \"./Picker.js\";\nimport { Heading6 } from \"../../Typography.js\";\n\ntype Adornment = ReactNode | string;\ntype ExtraType = {\n content: ReactNode | string;\n size?: AdornmentSize;\n onClick: () => void;\n};\n\ntype AdornmentLabelDescription = LabelDescription & {\n adornment: Adornment;\n extra?: ExtraType;\n onClick?: () => void;\n isInteractive?: boolean;\n};\n\nexport type CustomOptionType = AdornmentLabelDescription & Partial<Metadata>;\n\nconst OptionAdornmentContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"adornmentSize\" &&\n prop !== \"isTagContainer\",\n})<{\n adornmentSize?: AdornmentSize;\n isTagContainer?: boolean;\n odysseyDesignTokens: DesignTokens;\n position?: \"left\" | \"right\";\n}>(\n ({\n adornmentSize = \"small\",\n isTagContainer = false,\n\n odysseyDesignTokens,\n position = \"left\",\n }) => ({\n position: \"relative\",\n // push icon up by one px for better visual alignment\n bottom: \"1px\",\n alignSelf: \"flex-start\",\n width: odysseyDesignTokens.Spacing5,\n height: odysseyDesignTokens.Spacing5,\n overflow: \"hidden\",\n\n ...(position === \"left\" && {\n marginInlineEnd: odysseyDesignTokens.Spacing3,\n }),\n ...(position === \"right\" && {\n marginInlineStart: odysseyDesignTokens.Spacing3,\n }),\n\n svg: {\n width: \"100%\",\n height: \"auto\",\n },\n\n img: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"100%\",\n transform: \"translate(-50%, -50%)\",\n },\n\n ...(adornmentSize === \"large\" &&\n !isTagContainer && {\n bottom: 0,\n width: odysseyDesignTokens.Spacing8,\n height: odysseyDesignTokens.Spacing8,\n }),\n\n ...(isTagContainer && {\n bottom: 0,\n alignSelf: \"center\",\n width: odysseyDesignTokens.Spacing4,\n height: \"auto\",\n maxHeight: odysseyDesignTokens.Spacing4,\n marginInlineEnd: odysseyDesignTokens.Spacing2,\n\n svg: {\n display: \"flex\",\n width: \"100%\",\n height: \"auto\",\n },\n }),\n }),\n);\n\ntype OptionAdornmentProps = {\n adornment: Adornment;\n adornmentSize: AdornmentSize;\n odysseyDesignTokens: DesignTokens;\n};\n\ntype ExtraProps = {\n content: Adornment;\n size?: AdornmentSize;\n odysseyDesignTokens: DesignTokens;\n onClick: () => void;\n};\n\nconst CustomOptionContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(() => ({\n display: \"flex\",\n justifyContent: \"space-between\",\n width: \"100%\",\n}));\n\nconst CustomOptionLeftContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(() => ({\n display: \"flex\",\n}));\n\nconst OptionAdornment = ({\n adornment,\n adornmentSize,\n odysseyDesignTokens,\n}: OptionAdornmentProps) => {\n const isImageAdornment = typeof adornment === \"string\";\n\n if (isImageAdornment) {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <img src={adornment} alt=\"\" role=\"presentation\" />\n </OptionAdornmentContainer>\n );\n } else {\n return (\n <OptionAdornmentContainer\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {adornment}\n </OptionAdornmentContainer>\n );\n }\n};\n\nconst Extra = ({ content, size, odysseyDesignTokens, onClick }: ExtraProps) => {\n const handleClick = useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation();\n onClick();\n },\n [onClick],\n );\n\n return (\n <OptionAdornmentContainer\n adornmentSize={size}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={handleClick}\n >\n {content}\n </OptionAdornmentContainer>\n );\n};\n\nconst CustomOption = <OptionType extends CustomOptionType>({\n adornmentSize,\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps &\n OptionProps<OptionType> & {\n adornmentSize: AdornmentSize;\n }) => {\n const {\n adornment,\n description,\n label,\n metaData,\n extra,\n value,\n onClick,\n isInteractive = true,\n } = option;\n\n const handleOptionClick = useCallback(\n (event: React.MouseEvent) => {\n if (!isInteractive) {\n event.preventDefault();\n return;\n }\n event.stopPropagation();\n onClick?.();\n },\n [onClick, isInteractive],\n );\n\n const extendedMuiProps = useMemo(() => {\n return {\n ...muiProps,\n onClick: isInteractive ? handleOptionClick : undefined,\n \"aria-disabled\": !isInteractive ? \"true\" : undefined,\n role: \"option\",\n } as HTMLAttributes<HTMLLIElement>;\n }, [muiProps, isInteractive, handleOptionClick]);\n\n return (\n <Option hasAdornment key={value} muiProps={extendedMuiProps}>\n <CustomOptionContainer odysseyDesignTokens={odysseyDesignTokens}>\n <CustomOptionLeftContainer odysseyDesignTokens={odysseyDesignTokens}>\n <OptionAdornment\n adornment={adornment}\n adornmentSize={adornmentSize}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <div>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n {metaData && (\n <OptionMetadataComponent\n metaData={metaData}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n )}\n </div>\n </CustomOptionLeftContainer>\n {extra && (\n <Extra\n content={extra.content}\n size={extra.size || adornmentSize}\n onClick={extra.onClick}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n )}\n </CustomOptionContainer>\n </Option>\n );\n};\n\nexport type SearchDropdownProps<\n OptionType extends CustomOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n};\n\ntype PickerWithOptionAdornmentComponentType = {\n <\n OptionType extends CustomOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: SearchDropdownProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n <\n OptionType extends CustomOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: SearchDropdownProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactElement;\n};\n\nconst SearchDropdown: PickerWithOptionAdornmentComponentType = <\n OptionType extends CustomOptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n adornmentSize = \"small\",\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n groupOptionsBy,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n testId,\n translate,\n}: SearchDropdownProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const customOptionRender = useCallback<\n (props: HTMLAttributes<HTMLLIElement>, option: OptionType) => ReactNode\n >(\n (muiProps, option) => {\n return (\n <CustomOption\n adornmentSize={adornmentSize}\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n },\n [adornmentSize, odysseyDesignTokens],\n );\n\n return (\n <ComposablePicker<OptionType, HasMultipleChoices, IsCustomValueAllowed>\n ariaDescribedBy={ariaDescribedBy}\n defaultValue={defaultValue}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n getIsOptionEqualToValue={getIsOptionEqualToValue}\n groupOptionsBy={groupOptionsBy}\n id={idOverride}\n inputValue={inputValue}\n isCustomValueAllowed={isCustomValueAllowed}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n isOptional={isOptional}\n isReadOnly={isReadOnly}\n isVirtualized={isVirtualizedProp}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n name={nameOverride}\n onBlur={onBlur}\n onChange={onChangeProp}\n onInputChange={onInputChangeProp}\n onFocus={onFocus}\n options={options}\n renderOption={customOptionRender}\n value={value}\n testId={testId}\n translate={translate}\n />\n );\n};\n\n// Need the `as BasePickerType` because generics don't get passed through\nconst MemoizedSearchDropdown = memo(SearchDropdown) as BasePickerType;\n\nMemoizedSearchDropdown.displayName = \"MemoizedSearchDropdown\";\n\nexport { MemoizedSearchDropdown as SearchDropdown };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,2BAAA,GAAAJ,OAAA;AAIA,IAAAK,OAAA,GAAAL,OAAA;AAUA,IAAAM,WAAA,GAAAN,OAAA;AAA+C,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAE,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA1C/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkDA,MAAMG,wBAAwB,GAAG,IAAAC,eAAM,EAAC,KAAK,EAAE;EAC7CC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAC9BA,IAAI,KAAK,eAAe,IACxBA,IAAI,KAAK;AACb,CAAC,CAAC,CAMA,CAAC;EACCC,aAAa,GAAG,OAAO;EACvBC,cAAc,GAAG,KAAK;EAEtBC,mBAAmB;EACnBC,QAAQ,GAAG;AACb,CAAC,MAAM;EACLA,QAAQ,EAAE,UAAU;EAEpBC,MAAM,EAAE,KAAK;EACbC,SAAS,EAAE,YAAY;EACvBC,KAAK,EAAEJ,mBAAmB,CAACK,QAAQ;EACnCC,MAAM,EAAEN,mBAAmB,CAACK,QAAQ;EACpCE,QAAQ,EAAE,QAAQ;EAElB,IAAIN,QAAQ,KAAK,MAAM,IAAI;IACzBO,eAAe,EAAER,mBAAmB,CAACS;EACvC,CAAC,CAAC;EACF,IAAIR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BC,OAAO,EAAEA,OAAQ;IACjBM,YAAY,EAAEF,kBAAmB;IACjC/C,KAAK,EAAEA,KAAM;IACb4C,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMK,sBAAsB,GAAAC,OAAA,CAAApC,cAAA,GAAG,IAAAqC,WAAI,EAACrC,cAAc,CAAmB;AAErEmC,sBAAsB,CAACG,WAAW,GAAG,wBAAwB","ignoreList":[]}
|
|
@@ -4,8 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
adornmentSizeValues: true
|
|
7
|
+
adornmentSizeValues: true,
|
|
8
|
+
SearchDropdown: true
|
|
8
9
|
};
|
|
10
|
+
Object.defineProperty(exports, "SearchDropdown", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _SearchDropdown.SearchDropdown;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
9
16
|
Object.defineProperty(exports, "adornmentSizeValues", {
|
|
10
17
|
enumerable: true,
|
|
11
18
|
get: function () {
|
|
@@ -37,4 +44,5 @@ Object.keys(_PickerWithOptionAdornment).forEach(function (key) {
|
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
46
|
});
|
|
47
|
+
var _SearchDropdown = require("./SearchDropdown.cjs");
|
|
40
48
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["_ComposablePicker","require","_Picker","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_PickerWithOptionAdornment"],"sources":["../../../../src/labs/OdysseyPickers/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport { adornmentSizeValues } from \"./ComposablePicker.js\";\nexport * from \"./Picker.js\";\nexport * from \"./PickerWithOptionAdornment.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["_ComposablePicker","require","_Picker","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_PickerWithOptionAdornment","_SearchDropdown"],"sources":["../../../../src/labs/OdysseyPickers/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport { adornmentSizeValues } from \"./ComposablePicker.js\";\nexport * from \"./Picker.js\";\nexport * from \"./PickerWithOptionAdornment.js\";\nexport { SearchDropdown } from \"./SearchDropdown.js\";\nexport type {\n SearchDropdownProps,\n CustomOptionType,\n} from \"./SearchDropdown.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,0BAAA,GAAAd,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAW,0BAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,0BAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,0BAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,eAAA,GAAAf,OAAA","ignoreList":[]}
|
|
@@ -224,11 +224,15 @@ const NarrowUiShellContent = ({
|
|
|
224
224
|
setIsRightSideMenuOpen(false);
|
|
225
225
|
}, []);
|
|
226
226
|
(0, _react.useEffect)(() => {
|
|
227
|
-
const
|
|
227
|
+
const unsubscribeFromCloseRightSideMenu = uiShellContext?.subscribeToCloseRightSideMenu(() => {
|
|
228
|
+
closeSideMenus();
|
|
229
|
+
});
|
|
230
|
+
const unsubscribeFromSideNavItemClicked = uiShellContext?.subscribeToCloseSideNavMenu(() => {
|
|
228
231
|
closeSideMenus();
|
|
229
232
|
});
|
|
230
233
|
return () => {
|
|
231
|
-
|
|
234
|
+
unsubscribeFromCloseRightSideMenu?.();
|
|
235
|
+
unsubscribeFromSideNavItemClicked?.();
|
|
232
236
|
};
|
|
233
237
|
}, [closeSideMenus, uiShellContext]);
|
|
234
238
|
const toggleLeftSideMenu = (0, _react.useCallback)(() => {
|
|
@@ -269,9 +273,10 @@ const NarrowUiShellContent = ({
|
|
|
269
273
|
topNavBackgroundColor: uiShellContext?.sideNavBackgroundColor,
|
|
270
274
|
children: [(0, _jsxRuntime.jsxs)(StyledMenuLogo, {
|
|
271
275
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
272
|
-
children: [(0, _jsxRuntime.jsx)(_Button.Button, {
|
|
276
|
+
children: [(sideNavProps?.isCollapsible || !sideNavProps?.isCollapsed) && (0, _jsxRuntime.jsx)(_Button.Button, {
|
|
273
277
|
onClick: toggleLeftSideMenu,
|
|
274
278
|
startIcon: (0, _jsxRuntime.jsx)(_HamburgerMenuIcon.HamburgerMenuIcon, {}),
|
|
279
|
+
testId: "sidenav-menu--icon",
|
|
275
280
|
variant: "floating"
|
|
276
281
|
}), (0, _jsxRuntime.jsx)(StyledLogoContainer, {
|
|
277
282
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
@@ -286,6 +291,7 @@ const NarrowUiShellContent = ({
|
|
|
286
291
|
}), optionalComponents?.rightSideMenu && (0, _jsxRuntime.jsx)(_Button.Button, {
|
|
287
292
|
onClick: toggleRightSideMenu,
|
|
288
293
|
startIcon: isRightSideMenuOpen ? (0, _jsxRuntime.jsx)(_Close.CloseIcon, {}) : (0, _jsxRuntime.jsx)(_More.MoreIcon, {}),
|
|
294
|
+
testId: "userprofile-menu--icon",
|
|
289
295
|
variant: "floating"
|
|
290
296
|
})]
|
|
291
297
|
}), optionalComponents?.topNavLeftSide && (0, _jsxRuntime.jsx)(StyledTopNavSearch, {
|
|
@@ -294,9 +300,16 @@ const NarrowUiShellContent = ({
|
|
|
294
300
|
})]
|
|
295
301
|
})
|
|
296
302
|
}), (0, _jsxRuntime.jsxs)(StyledAppContentArea, {
|
|
297
|
-
children: [(0, _jsxRuntime.
|
|
303
|
+
children: [(0, _jsxRuntime.jsxs)(StyledLeftSideContainer, {
|
|
298
304
|
isOpen: isLeftSideMenuOpen,
|
|
299
|
-
children: sideNavProps && (0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
305
|
+
children: [initialVisibleSections?.includes("SideNav") && sideNavProps === undefined && (0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
306
|
+
fallback: null,
|
|
307
|
+
onError: onError,
|
|
308
|
+
children: (0, _jsxRuntime.jsx)(_SideNav.SideNav, {
|
|
309
|
+
isLoading: true,
|
|
310
|
+
sideNavItems: _uiShellSharedConstants.emptySideNavItems
|
|
311
|
+
})
|
|
312
|
+
}), sideNavProps && (0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
300
313
|
fallback: null,
|
|
301
314
|
onError: onError,
|
|
302
315
|
children: (0, _jsxRuntime.jsx)(StyledSideNavContainer, {
|
|
@@ -319,7 +332,7 @@ const NarrowUiShellContent = ({
|
|
|
319
332
|
isObtrusive: true
|
|
320
333
|
})
|
|
321
334
|
})
|
|
322
|
-
})
|
|
335
|
+
})]
|
|
323
336
|
}), (0, _jsxRuntime.jsx)(StyledRightSideContainer, {
|
|
324
337
|
isOpen: isRightSideMenuOpen,
|
|
325
338
|
odysseyDesignTokens: odysseyDesignTokens,
|