@okta/odyssey-react-mui 1.40.0 → 1.42.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/Autocomplete.cjs +10 -10
- package/dist/cjs/Autocomplete.cjs.map +1 -1
- package/dist/cjs/Breadcrumbs.cjs +1 -0
- package/dist/cjs/Breadcrumbs.cjs.map +1 -1
- package/dist/cjs/Link.cjs.map +1 -1
- package/dist/cjs/OdysseyCacheProvider.cjs.map +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Select.cjs.map +1 -1
- package/dist/cjs/Tag.cjs +9 -2
- package/dist/cjs/Tag.cjs.map +1 -1
- package/dist/cjs/createContrastColors.cjs +6 -2
- package/dist/cjs/createContrastColors.cjs.map +1 -1
- package/dist/cjs/getLogicalBoundaries.cjs +33 -0
- package/dist/cjs/getLogicalBoundaries.cjs.map +1 -0
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs +15 -4
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs +2 -1
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_eu.cjs +137 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_eu.cjs.map +1 -0
- package/dist/cjs/theme/components.cjs +1 -0
- package/dist/cjs/theme/components.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +0 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +23 -18
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs +4 -3
- package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs +10 -10
- package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +2 -0
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShellProvider.cjs +6 -1
- package/dist/cjs/ui-shell/UiShellProvider.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +4 -2
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/useElementAtContainerEdge.cjs +74 -0
- package/dist/cjs/ui-shell/useElementAtContainerEdge.cjs.map +1 -0
- package/dist/cjs/ui-shell/useScrollState.cjs +4 -2
- package/dist/cjs/ui-shell/useScrollState.cjs.map +1 -1
- package/dist/cjs/useAutocomplete.cjs +2 -2
- package/dist/cjs/useAutocomplete.cjs.map +1 -1
- package/dist/cjs/useMountLifecycleEffect.cjs +3 -3
- package/dist/cjs/useMountLifecycleEffect.cjs.map +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs.map +1 -1
- package/dist/esm/Autocomplete.js +10 -10
- package/dist/esm/Autocomplete.js.map +1 -1
- package/dist/esm/Breadcrumbs.js +1 -0
- package/dist/esm/Breadcrumbs.js.map +1 -1
- package/dist/esm/Link.js.map +1 -1
- package/dist/esm/OdysseyCacheProvider.js.map +1 -1
- package/dist/esm/Select.js +1 -1
- package/dist/esm/Select.js.map +1 -1
- package/dist/esm/Tag.js +9 -2
- package/dist/esm/Tag.js.map +1 -1
- package/dist/esm/createContrastColors.js +6 -2
- package/dist/esm/createContrastColors.js.map +1 -1
- package/dist/esm/getLogicalBoundaries.js +26 -0
- package/dist/esm/getLogicalBoundaries.js.map +1 -0
- package/dist/esm/labs/PageTemplate/PageTemplate.js +16 -5
- package/dist/esm/labs/PageTemplate/PageTemplate.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui.js +2 -1
- package/dist/esm/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_eu.js +131 -0
- package/dist/esm/properties/ts/odyssey-react-mui_eu.js.map +1 -0
- package/dist/esm/theme/components.js +1 -0
- package/dist/esm/theme/components.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +0 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNav.js +23 -18
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js +4 -3
- package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js +10 -10
- package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +2 -0
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/UiShellProvider.js +6 -1
- package/dist/esm/ui-shell/UiShellProvider.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +4 -2
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/useElementAtContainerEdge.js +68 -0
- package/dist/esm/ui-shell/useElementAtContainerEdge.js.map +1 -0
- package/dist/esm/ui-shell/useScrollState.js +4 -2
- package/dist/esm/ui-shell/useScrollState.js.map +1 -1
- package/dist/esm/useAutocomplete.js +2 -2
- package/dist/esm/useAutocomplete.js.map +1 -1
- package/dist/esm/useMountLifecycleEffect.js +3 -3
- package/dist/esm/useMountLifecycleEffect.js.map +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.mjs +1 -1
- package/dist/index.scss +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Autocomplete.d.ts +1 -1
- package/dist/types/Autocomplete.d.ts.map +1 -1
- package/dist/types/Breadcrumbs.d.ts.map +1 -1
- package/dist/types/CssBaseline.d.ts.map +1 -1
- package/dist/types/DataTable/reorderDataRowsLocally.d.ts.map +1 -1
- package/dist/types/DataTable/useRowReordering.d.ts.map +1 -1
- package/dist/types/DataTable/useScrollIndication.d.ts.map +1 -1
- package/dist/types/DatePickers/useOdysseyDateFields.d.ts.map +1 -1
- package/dist/types/Link.d.ts +3 -3
- package/dist/types/Link.d.ts.map +1 -1
- package/dist/types/NativeSelect.d.ts.map +1 -1
- package/dist/types/OdysseyCacheProvider.d.ts.map +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/types/Pagination/usePagination.d.ts.map +1 -1
- package/dist/types/Select.d.ts.map +1 -1
- package/dist/types/Tag.d.ts.map +1 -1
- package/dist/types/addSpecificity.d.ts.map +1 -1
- package/dist/types/createContrastColors.d.ts +5 -1
- package/dist/types/createContrastColors.d.ts.map +1 -1
- package/dist/types/getLogicalBoundaries.d.ts +24 -0
- package/dist/types/getLogicalBoundaries.d.ts.map +1 -0
- package/dist/types/hexToRgb.d.ts.map +1 -1
- package/dist/types/i18n.d.ts +1 -0
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/inputUtils.d.ts.map +1 -1
- package/dist/types/labs/DataView/fetchData.d.ts.map +1 -1
- package/dist/types/labs/DataView/tableConstants.d.ts.map +1 -1
- package/dist/types/labs/DataView/testSupportData.d.ts.map +1 -1
- package/dist/types/labs/DataView/useFilterConversion.d.ts.map +1 -1
- package/dist/types/labs/GroupPicker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/ComposablePicker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/Picker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/PickerVirtualizationListBox.d.ts.map +1 -1
- package/dist/types/labs/PageTemplate/PageTemplate.d.ts.map +1 -1
- package/dist/types/labs/PaginatedTable.d.ts.map +1 -1
- package/dist/types/labs/StaticTable.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_eu.d.ts +131 -0
- package/dist/types/properties/ts/odyssey-react-mui_eu.d.ts.map +1 -0
- package/dist/types/remUtils.d.ts.map +1 -1
- package/dist/types/shadow-dom/shadow-dom.d.ts.map +1 -1
- package/dist/types/test-selectors/getByQuerySelector.d.ts.map +1 -1
- package/dist/types/test-selectors/getComputedAccessibleErrorMessageText.d.ts.map +1 -1
- package/dist/types/test-selectors/getComputedAccessibleText.d.ts.map +1 -1
- package/dist/types/test-selectors/interpolateString.d.ts.map +1 -1
- package/dist/types/test-selectors/linkedHtmlSelectors.d.ts.map +1 -1
- package/dist/types/test-selectors/queryOdysseySelector.d.ts +40 -36
- package/dist/types/test-selectors/queryOdysseySelector.d.ts.map +1 -1
- package/dist/types/test-selectors/querySelector.d.ts +6 -2
- package/dist/types/test-selectors/querySelector.d.ts.map +1 -1
- package/dist/types/test-selectors/sanityChecks.d.ts.map +1 -1
- package/dist/types/theme/components.d.ts.map +1 -1
- package/dist/types/theme/createOdysseyMuiTheme.d.ts.map +1 -1
- package/dist/types/theme/mixins.d.ts.map +1 -1
- package/dist/types/theme/palette.d.ts.map +1 -1
- package/dist/types/theme/pxToRem.d.ts.map +1 -1
- package/dist/types/theme/shape.d.ts.map +1 -1
- package/dist/types/theme/spacing.d.ts.map +1 -1
- package/dist/types/theme/typography.d.ts.map +1 -1
- package/dist/types/theme/useMediaQuery.d.ts.map +1 -1
- package/dist/types/ui-shell/AppSwitcher/AppSwitcherApp.d.ts.map +1 -1
- package/dist/types/ui-shell/InnerAppContainer.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavItemContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavItemLinkContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavToggleButton.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SortableList/SortableItem.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts +1 -1
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShellProvider.d.ts +10 -4
- package/dist/types/ui-shell/UiShellProvider.d.ts.map +1 -1
- package/dist/types/ui-shell/bufferLatest.d.ts.map +1 -1
- package/dist/types/ui-shell/createMessageBus.d.ts.map +1 -1
- package/dist/types/ui-shell/createStore.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +2 -2
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/useElementAtContainerEdge.d.ts +43 -0
- package/dist/types/ui-shell/useElementAtContainerEdge.d.ts.map +1 -0
- package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts.map +1 -1
- package/dist/types/ui-shell/useScrollState.d.ts +6 -2
- package/dist/types/ui-shell/useScrollState.d.ts.map +1 -1
- package/dist/types/ui-shell/useUiShellBreakpoints.d.ts.map +1 -1
- package/dist/types/useAutocomplete.d.ts.map +1 -1
- package/dist/types/useContrastMode.d.ts.map +1 -1
- package/dist/types/useMountLifecycleEffect.d.ts.map +1 -1
- package/dist/types/useNormalizedKey.d.ts.map +1 -1
- package/dist/types/useSessionStorageState.d.ts.map +1 -1
- package/dist/types/useUniqueAlphabeticalId.d.ts.map +1 -1
- package/dist/types/useUniqueId.d.ts.map +1 -1
- package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts +1 -1
- package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts.map +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiShellProvider.cjs","names":["_react","require","_createContrastColors","_OdysseyDesignTokensContext","_createMessageBus","_jsxRuntime","defaultCloseSideNavMessageBus","exports","createMessageBus","defaultSubscribeToCloseRightSideMenu","UiShellContext","createContext","undefined","useUiShellContext","useContext","UiShellProvider","appBackgroundColor","appBackgroundContrastMode","children","closeSideNavMenu","sideNavBackgroundColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","topNavBackgroundColor","odysseyDesignTokens","useOdysseyDesignTokens","defaultedSideNavBackgroundColor","HueNeutralWhite","sideNavContrastColors","generateContrastColors","isAppBackgroundHightContrast","defaultTopAndAppBackgroundColor","HueNeutral50","topNavColor","appContentBackgroundColor","memoizedContextValue","useMemo","publish","subscribe","jsx","Provider","value","MemoizedUiShellProvider","memo"],"sources":["../../../src/ui-shell/UiShellProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 createContext,\n memo,\n PropsWithChildren,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n ContrastColors,\n generateContrastColors,\n} from \"../createContrastColors.js\";\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { createMessageBus, MessageBus } from \"./createMessageBus.js\";\nimport { ContrastMode } from \"../useContrastMode.js\";\n\nexport const defaultCloseSideNavMessageBus = createMessageBus();\nexport const defaultSubscribeToCloseRightSideMenu = () => () => {};\n\nexport type UiShellColors = {\n /**\n *
|
|
1
|
+
{"version":3,"file":"UiShellProvider.cjs","names":["_react","require","_createContrastColors","_OdysseyDesignTokensContext","_createMessageBus","_jsxRuntime","defaultCloseSideNavMessageBus","exports","createMessageBus","defaultSubscribeToCloseRightSideMenu","UiShellContext","createContext","undefined","useUiShellContext","useContext","UiShellProvider","appBackgroundColor","appBackgroundContrastMode","children","closeSideNavMenu","sideNavBackgroundColor","sideNavBackgroundContrastColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","topNavBackgroundColor","odysseyDesignTokens","useOdysseyDesignTokens","defaultedSideNavBackgroundColor","HueNeutralWhite","sideNavContrastColors","generateContrastColors","backgroundColor","backgroundContrastColor","isAppBackgroundHightContrast","defaultTopAndAppBackgroundColor","HueNeutral50","topNavColor","appContentBackgroundColor","memoizedContextValue","useMemo","publish","subscribe","jsx","Provider","value","MemoizedUiShellProvider","memo"],"sources":["../../../src/ui-shell/UiShellProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 createContext,\n memo,\n PropsWithChildren,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n ContrastColors,\n generateContrastColors,\n} from \"../createContrastColors.js\";\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { createMessageBus, MessageBus } from \"./createMessageBus.js\";\nimport { ContrastMode } from \"../useContrastMode.js\";\n\nexport const defaultCloseSideNavMessageBus = createMessageBus();\nexport const defaultSubscribeToCloseRightSideMenu = () => () => {};\n\nexport type UiShellColors = {\n /**\n * Custom background color for the app content area.\n */\n appBackgroundColor: string;\n /**\n * Custom background color for the side nav area.\n */\n sideNavBackgroundColor: string;\n /**\n * Custom color for fonts and other contrasted colors in the side nav area. Other contrast colors are derived from this one.\n *\n * If not passed, it gets computed from Odyssey.\n */\n sideNavBackgroundContrastColor?: string;\n sideNavContrastColors?: ContrastColors;\n /**\n * Custom background color for the top nav area.\n */\n topNavBackgroundColor: string;\n};\n\nexport type UiShellContext = {\n /**\n * This is a callback that publishes a change to all subscribers listening for when to close the side nav.\n */\n closeSideNavMenu: MessageBus<void>[\"publish\"];\n /**\n * This is a callback that provides a subscriber callback to listen for changes to state.\n * It allows UI Shell to listen for a publisher that asks us to close the side nav.\n */\n subscribeToCloseSideNavMenu: MessageBus<void>[\"subscribe\"];\n /**\n * This is a callback that provides a subscriber callback to listen for changes to state.\n * It allows UI Shell to listen for a publisher that asks us to close the right-side menu.\n */\n subscribeToCloseRightSideMenu: MessageBus<void>[\"subscribe\"];\n} & UiShellColors;\n\nconst UiShellContext = createContext<UiShellContext | undefined>(undefined);\n\nexport const useUiShellContext = () => {\n return useContext(UiShellContext);\n};\n\nexport type UiShellProviderProps = {\n /**\n * Sets either a gray or white background color for the app content area.\n */\n appBackgroundContrastMode?: ContrastMode;\n} & Partial<UiShellContext>;\n\nconst UiShellProvider = ({\n appBackgroundColor,\n appBackgroundContrastMode = \"lowContrast\",\n children,\n closeSideNavMenu,\n sideNavBackgroundColor,\n sideNavBackgroundContrastColor,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n topNavBackgroundColor,\n}: PropsWithChildren<UiShellProviderProps>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const defaultedSideNavBackgroundColor =\n sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite;\n\n const sideNavContrastColors =\n defaultedSideNavBackgroundColor !== odysseyDesignTokens.HueNeutralWhite\n ? generateContrastColors({\n backgroundColor:\n sideNavBackgroundColor || defaultedSideNavBackgroundColor,\n backgroundContrastColor: sideNavBackgroundContrastColor,\n odysseyDesignTokens,\n })\n : undefined;\n\n const isAppBackgroundHightContrast =\n appBackgroundContrastMode === \"highContrast\";\n\n const defaultTopAndAppBackgroundColor = isAppBackgroundHightContrast\n ? odysseyDesignTokens.HueNeutralWhite\n : odysseyDesignTokens.HueNeutral50;\n\n const topNavColor = topNavBackgroundColor || defaultTopAndAppBackgroundColor;\n\n const appContentBackgroundColor =\n appBackgroundColor || defaultTopAndAppBackgroundColor;\n\n const memoizedContextValue = useMemo(\n () => ({\n appBackgroundColor: appContentBackgroundColor,\n closeSideNavMenu:\n closeSideNavMenu ?? defaultCloseSideNavMessageBus.publish,\n sideNavBackgroundColor:\n sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite,\n sideNavContrastColors,\n subscribeToCloseSideNavMenu:\n subscribeToCloseSideNavMenu ?? defaultCloseSideNavMessageBus.subscribe,\n subscribeToCloseRightSideMenu:\n subscribeToCloseRightSideMenu ?? defaultSubscribeToCloseRightSideMenu,\n topNavBackgroundColor: topNavColor,\n }),\n [\n appContentBackgroundColor,\n odysseyDesignTokens.HueNeutralWhite,\n closeSideNavMenu,\n sideNavBackgroundColor,\n sideNavContrastColors,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n topNavColor,\n ],\n );\n\n return (\n <UiShellContext.Provider value={memoizedContextValue}>\n {children}\n </UiShellContext.Provider>\n );\n};\n\nconst MemoizedUiShellProvider = memo(UiShellProvider);\n\nexport { MemoizedUiShellProvider as UiShellProvider };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAAqE,IAAAI,WAAA,GAAAJ,OAAA;AAxBrE;AACA;AACA;AACA;AACA;AACA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EAClC,OAAO;IACLvB,kBAAkB,EAAEqB,yBAAyB;IAC7ClB,gBAAgB,EACdA,gBAAgB,IAAIb,6BAA6B,CAACkC,OAAO;IAC3DpB,sBAAsB,EACpBA,sBAAsB,IAAIK,mBAAmB,CAACG,eAAe;IAC/DC,qBAAqB;IACrBN,2BAA2B,EACzBA,2BAA2B,IAAIjB,6BAA6B,CAACmC,SAAS;IACxEnB,6BAA6B,EAC3BA,6BAA6B,IAAIb,oCAAoC;IACvEe,qBAAqB,EAAEY;EACzB,CAAC,CAAC,EACF,CACEC,yBAAyB,EACzBZ,mBAAmB,CAACG,eAAe,EACnCT,gBAAgB,EAChBC,sBAAsB,EACtBS,qBAAqB,EACrBP,6BAA6B,EAC7BC,2BAA2B,EAC3Ba,WAAW,CAEf,CAAC;EAED,OACE,IAAA/B,WAAA,CAAAqC,GAAA,EAAChC,cAAc,CAACiC,QAAQ;IAACC,KAAK,EAAEN,oBAAqB;IAAApB,QAAA,EAClDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAED,MAAM2B,uBAAuB,GAAAtC,OAAA,CAAAQ,eAAA,GAAG,IAAA+B,WAAI,EAAC/B,eAAe,CAAC","ignoreList":[]}
|
|
@@ -42,6 +42,7 @@ const renderUiShell = ({
|
|
|
42
42
|
onRender,
|
|
43
43
|
parentElement,
|
|
44
44
|
sideNavBackgroundColor,
|
|
45
|
+
sideNavBackgroundContrastColor,
|
|
45
46
|
topNavBackgroundColor
|
|
46
47
|
}) => {
|
|
47
48
|
const appElement = providedAppElement || document.createElement("div");
|
|
@@ -93,6 +94,7 @@ const renderUiShell = ({
|
|
|
93
94
|
name: slotName
|
|
94
95
|
})])),
|
|
95
96
|
sideNavBackgroundColor: sideNavBackgroundColor,
|
|
97
|
+
sideNavBackgroundContrastColor: sideNavBackgroundContrastColor,
|
|
96
98
|
subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu,
|
|
97
99
|
subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu,
|
|
98
100
|
subscribeToPropChanges: subscribeToPropChanges,
|
|
@@ -101,8 +103,8 @@ const renderUiShell = ({
|
|
|
101
103
|
uiShellStylesElement: reactRootElements.stylesRootElement
|
|
102
104
|
})
|
|
103
105
|
}),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
webComponentChildren,
|
|
107
|
+
webComponentParentElement: parentElement
|
|
106
108
|
});
|
|
107
109
|
const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(() => {
|
|
108
110
|
unsubscribeFromUnifiedUiShellRendered();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onRender","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","unsubscribeFromUnifiedUiShellRendered","setComponentProps","appendChild"],"sources":["../../../src/ui-shell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest.js\";\nimport { createMessageBus, PublishMessage } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\nexport type SlottedElements = Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n>;\n\nexport type RenderedUiShell = {\n closeRightSideMenu: PublishMessage<void>;\n closeSideNavMenu: PublishMessage<void>;\n setComponentProps: ReturnType<\n typeof bufferLatest<SetStateAction<UiShellNavComponentProps>>\n >;\n slottedElements: SlottedElements;\n uiShellElement: ReturnType<typeof renderReactInWebComponent>;\n} & Partial<Pick<UiShellProps, \"appElement\">>;\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n breakpointConfig,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n onRender,\n parentElement,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n}: {\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * Notify once when React has rendered UI Shell the first time.\n */\n onRender?: (renderedUiShell: RenderedUiShell) => void;\n /**\n * HTML element used as the container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"breakpointConfig\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n parentElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const {\n publish: closeRightSideMenu,\n subscribe: subscribeToCloseRightSideMenu,\n } = createMessageBus();\n\n const { publish: closeSideNavMenu, subscribe: subscribeToCloseSideNavMenu } =\n createMessageBus();\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as SlottedElements;\n\n const webComponentChildren = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n breakpointConfig={breakpointConfig}\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n closeSideNavMenu={closeSideNavMenu}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentParentElement: parentElement,\n webComponentChildren,\n });\n\n const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(\n () => {\n unsubscribeFromUnifiedUiShellRendered();\n\n onRender?.({\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n });\n },\n );\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC,OAAA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AA2B;QAElD4B,kBAAkB,EAAEnB,MAAM,CAACC,WAAW,CACpCD,MAAM,CAACE,OAAO,CAAC3C,0BAA0B,CAAC,CAAC4C,GAAG,CAC5C,CAAC,CAACC,oBAAoB,EAAEC,QAAQ,CAAC,KAAK,CACpCD,oBAAoB,EACpB,IAAA9C,WAAA,CAAAuD,GAAA;UAAMO,IAAI,EAAEf;QAAS,CAAE,CAAC,CAE5B,CACF,CAAE;QACFzB,sBAAsB,EAAEA,sBAAuB;QAC/CgB,6BAA6B,EAAEA,6BAA8B;QAC7DE,2BAA2B,EAAEA,2BAA4B;QACzDT,sBAAsB,EAAEA,sBAAuB;QAC/CR,qBAAqB,EAAEA,qBAAsB;QAC7CwC,iBAAiB,EAAET,iBAAiB,CAACU,cAAe;QACpDC,oBAAoB,EAAEX,iBAAiB,CAACY;MAAkB,CAC3D;IAAC,CACW,CAChB;IACDC,yBAAyB,EAAE9C,aAAa;IACxC4B;EACF,CAAC,CAAC;EAEF,MAAMmB,qCAAqC,GAAGlC,6BAA6B,CACzE,MAAM;IACJkC,qCAAqC,CAAC,CAAC;IAEvChD,QAAQ,GAAG;MACTT,UAAU;MACV0B,kBAAkB;MAClBE,gBAAgB;MAChB8B,iBAAiB,EAAElC,iCAAiC;MACpDM,eAAe;MACfU;IACF,CAAC,CAAC;EACJ,CACF,CAAC;EAED9B,aAAa,CAACiD,WAAW,CAAC3D,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACV0B,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAACjD,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onRender","parentElement","sideNavBackgroundColor","sideNavBackgroundContrastColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","unsubscribeFromUnifiedUiShellRendered","setComponentProps","appendChild"],"sources":["../../../src/ui-shell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest.js\";\nimport { createMessageBus, PublishMessage } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\nexport type SlottedElements = Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n>;\n\nexport type RenderedUiShell = {\n closeRightSideMenu: PublishMessage<void>;\n closeSideNavMenu: PublishMessage<void>;\n setComponentProps: ReturnType<\n typeof bufferLatest<SetStateAction<UiShellNavComponentProps>>\n >;\n slottedElements: SlottedElements;\n uiShellElement: ReturnType<typeof renderReactInWebComponent>;\n} & Partial<Pick<UiShellProps, \"appElement\">>;\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n breakpointConfig,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n onRender,\n parentElement,\n sideNavBackgroundColor,\n sideNavBackgroundContrastColor,\n topNavBackgroundColor,\n}: {\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * Notify once when React has rendered UI Shell the first time.\n */\n onRender?: (renderedUiShell: RenderedUiShell) => void;\n /**\n * HTML element used as the container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"breakpointConfig\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"sideNavBackgroundContrastColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n parentElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const {\n publish: closeRightSideMenu,\n subscribe: subscribeToCloseRightSideMenu,\n } = createMessageBus();\n\n const { publish: closeSideNavMenu, subscribe: subscribeToCloseSideNavMenu } =\n createMessageBus();\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as SlottedElements;\n\n const webComponentChildren = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n breakpointConfig={breakpointConfig}\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n closeSideNavMenu={closeSideNavMenu}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n sideNavBackgroundContrastColor={sideNavBackgroundContrastColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentChildren,\n webComponentParentElement: parentElement,\n });\n\n const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(\n () => {\n unsubscribeFromUnifiedUiShellRendered();\n\n onRender?.({\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n });\n },\n );\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AAA0F,IAAAM,WAAA,GAAAN,OAAA;AApB1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMO,0BAGZ,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EACFE,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,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sB,EAAEA,sBAAuB;QAC/CR,qBAAqB,EAAEA,qBAAsB;QAC7CwC,iBAAiB,EAAET,iBAAiB,CAACU,cAAe;QACpDC,oBAAoB,EAAEX,iBAAiB,CAACY;MAAkB,CAC3D;IAAC,CACW,CAChB;IACDjB,oBAAoB;IACpBkB,yBAAyB,EAAE/C;EAC7B,CAAC,CAAC;EAEF,MAAMgD,qCAAqC,GAAGlC,6BAA6B,CACzE,MAAM;IACJkC,qCAAqC,CAAC,CAAC;IAEvCjD,QAAQ,GAAG;MACTT,UAAU;MACV2B,kBAAkB;MAClBE,gBAAgB;MAChB8B,iBAAiB,EAAElC,iCAAiC;MACpDM,eAAe;MACfU;IACF,CAAC,CAAC;EACJ,CACF,CAAC;EAED/B,aAAa,CAACkD,WAAW,CAAC5D,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACV2B,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAClD,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useElementAtContainerEdge = useElementAtContainerEdge;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _getLogicalBoundaries = require("../getLogicalBoundaries.cjs");
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
11
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
12
|
+
*
|
|
13
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
16
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
*
|
|
18
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const defaultEdgeState = {
|
|
22
|
+
isAtContainerInlineStart: null,
|
|
23
|
+
isAtContainerInlineEnd: null,
|
|
24
|
+
isAtContainerBlockStart: null,
|
|
25
|
+
isAtContainerBlockEnd: null
|
|
26
|
+
};
|
|
27
|
+
function useElementAtContainerEdge({
|
|
28
|
+
containerElement,
|
|
29
|
+
element,
|
|
30
|
+
monitoringElement
|
|
31
|
+
}) {
|
|
32
|
+
const [edgeState, setEdgeState] = (0, _react.useState)(defaultEdgeState);
|
|
33
|
+
const requestedAnimationFrameIdRef = (0, _react.useRef)(0);
|
|
34
|
+
const resolvedMonitoringElement = monitoringElement ?? element?.parentElement;
|
|
35
|
+
const updateEdgeState = (0, _react.useCallback)(() => {
|
|
36
|
+
cancelAnimationFrame(requestedAnimationFrameIdRef.current);
|
|
37
|
+
requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {
|
|
38
|
+
if (element) {
|
|
39
|
+
const elementBoundaries = (0, _getLogicalBoundaries.getLogicalBoundaries)(element);
|
|
40
|
+
const containerBoundaries = (0, _getLogicalBoundaries.getLogicalBoundaries)(containerElement ?? document.body);
|
|
41
|
+
setEdgeState({
|
|
42
|
+
isAtContainerInlineStart: elementBoundaries.left === containerBoundaries.left,
|
|
43
|
+
isAtContainerInlineEnd: elementBoundaries.right === containerBoundaries.right,
|
|
44
|
+
isAtContainerBlockStart: elementBoundaries.top === containerBoundaries.top,
|
|
45
|
+
isAtContainerBlockEnd: elementBoundaries.bottom === containerBoundaries.bottom
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
setEdgeState(defaultEdgeState);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}, [containerElement, element]);
|
|
52
|
+
(0, _react.useEffect)(() => {
|
|
53
|
+
const mutationObserver = new MutationObserver(() => {
|
|
54
|
+
updateEdgeState();
|
|
55
|
+
});
|
|
56
|
+
if (resolvedMonitoringElement) {
|
|
57
|
+
mutationObserver.observe(resolvedMonitoringElement, {
|
|
58
|
+
attributes: true,
|
|
59
|
+
attributeFilter: ["style"],
|
|
60
|
+
childList: true,
|
|
61
|
+
subtree: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
window.addEventListener("resize", updateEdgeState);
|
|
65
|
+
updateEdgeState();
|
|
66
|
+
return () => {
|
|
67
|
+
cancelAnimationFrame(requestedAnimationFrameIdRef.current);
|
|
68
|
+
mutationObserver.disconnect();
|
|
69
|
+
window.removeEventListener("resize", updateEdgeState);
|
|
70
|
+
};
|
|
71
|
+
}, [resolvedMonitoringElement, updateEdgeState]);
|
|
72
|
+
return edgeState;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=useElementAtContainerEdge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElementAtContainerEdge.cjs","names":["_react","require","_getLogicalBoundaries","defaultEdgeState","isAtContainerInlineStart","isAtContainerInlineEnd","isAtContainerBlockStart","isAtContainerBlockEnd","useElementAtContainerEdge","containerElement","element","monitoringElement","edgeState","setEdgeState","useState","requestedAnimationFrameIdRef","useRef","resolvedMonitoringElement","parentElement","updateEdgeState","useCallback","cancelAnimationFrame","current","requestAnimationFrame","elementBoundaries","getLogicalBoundaries","containerBoundaries","document","body","left","right","top","bottom","useEffect","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","window","addEventListener","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useElementAtContainerEdge.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-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 { useEffect, useState, useRef, useCallback } from \"react\";\nimport { getLogicalBoundaries } from \"../getLogicalBoundaries.js\";\n\nconst defaultEdgeState = {\n isAtContainerInlineStart: null,\n isAtContainerInlineEnd: null,\n isAtContainerBlockStart: null,\n isAtContainerBlockEnd: null,\n};\n\ntype EdgeState =\n | {\n isAtContainerInlineStart: null;\n isAtContainerInlineEnd: null;\n isAtContainerBlockStart: null;\n isAtContainerBlockEnd: null;\n }\n | {\n isAtContainerInlineStart: boolean;\n isAtContainerInlineEnd: boolean;\n isAtContainerBlockStart: boolean;\n isAtContainerBlockEnd: boolean;\n };\n\n/**\n * Determines if an element is at the edge of its container.\n *\n * If `element` is `null`, all returned edge state values will be `null`.\n */\nexport function useElementAtContainerEdge({\n containerElement,\n element,\n monitoringElement,\n}: {\n /**\n * The container element against which the edges are checked. If not provided, it defaults to the document body.\n */\n containerElement?: HTMLElement | null;\n /**\n * The element whose edges you want to track.\n */\n element?: HTMLElement | null;\n /**\n * The element whose mutations you want to track. If not provided, it defaults to the parent element of the `element`.\n */\n monitoringElement?: HTMLElement | null;\n}) {\n const [edgeState, setEdgeState] = useState<EdgeState>(defaultEdgeState);\n\n const requestedAnimationFrameIdRef = useRef(0);\n\n const resolvedMonitoringElement = monitoringElement ?? element?.parentElement;\n\n // will check the position of the element and update state accordingly\n const updateEdgeState = useCallback(() => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n\n requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {\n if (element) {\n const elementBoundaries = getLogicalBoundaries(element);\n const containerBoundaries = getLogicalBoundaries(\n containerElement ?? document.body,\n );\n\n setEdgeState({\n isAtContainerInlineStart:\n elementBoundaries.left === containerBoundaries.left,\n isAtContainerInlineEnd:\n elementBoundaries.right === containerBoundaries.right,\n isAtContainerBlockStart:\n elementBoundaries.top === containerBoundaries.top,\n isAtContainerBlockEnd:\n elementBoundaries.bottom === containerBoundaries.bottom,\n });\n } else {\n setEdgeState(defaultEdgeState);\n }\n });\n }, [containerElement, element]);\n\n useEffect(() => {\n // Listen for mutations that might affect position\n const mutationObserver = new MutationObserver(() => {\n updateEdgeState();\n });\n\n if (resolvedMonitoringElement) {\n mutationObserver.observe(resolvedMonitoringElement, {\n attributes: true,\n attributeFilter: [\"style\"],\n childList: true,\n subtree: true,\n });\n }\n\n // Listen for window resize, which can affect position\n window.addEventListener(\"resize\", updateEdgeState);\n\n // Initial check\n updateEdgeState();\n\n // cleanup function to remove listeners and observer\n return () => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n mutationObserver.disconnect();\n window.removeEventListener(\"resize\", updateEdgeState);\n };\n }, [resolvedMonitoringElement, updateEdgeState]);\n\n return edgeState;\n}\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAME,gBAAgB,GAAG;EACvBC,wBAAwB,EAAE,IAAI;EAC9BC,sBAAsB,EAAE,IAAI;EAC5BC,uBAAuB,EAAE,IAAI;EAC7BC,qBAAqB,EAAE;AACzB,CAAC;AAqBM,SAASC,yBAAyBA,CAAC;EACxCC,gBAAgB;EAChBC,OAAO;EACPC;AAcF,CAAC,EAAE;EACD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAYX,gBAAgB,CAAC;EAEvE,MAAMY,4BAA4B,GAAG,IAAAC,aAAM,EAAC,CAAC,CAAC;EAE9C,MAAMC,yBAAyB,GAAGN,iBAAiB,IAAID,OAAO,EAAEQ,aAAa;EAG7E,MAAMC,eAAe,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACxCC,oBAAoB,CAACN,4BAA4B,CAACO,OAAO,CAAC;IAE1DP,4BAA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MAAM,CAACG,mBAAmB,CAAC,QAAQ,EAAEzB,eAAe,CAAC;IACvD,CAAC;EACH,CAAC,EAAE,CAACF,yBAAyB,EAAEE,eAAe,CAAC,CAAC;EAEhD,OAAOP,SAAS;AAClB","ignoreList":[]}
|
|
@@ -38,7 +38,7 @@ const getNestedScrollContainers = containerElement => Array.from(containerElemen
|
|
|
38
38
|
element
|
|
39
39
|
})).filter(scrollHeightElement => getIsYAxisScrollContainer(scrollHeightElement));
|
|
40
40
|
exports.getNestedScrollContainers = getNestedScrollContainers;
|
|
41
|
-
const fakeDefaultContainerElement = exports.fakeDefaultContainerElement = document.createElement("div");
|
|
41
|
+
const fakeDefaultContainerElement = exports.fakeDefaultContainerElement = typeof window === "undefined" ? null : document.createElement("div");
|
|
42
42
|
const useScrollState = containerElement => {
|
|
43
43
|
const [isScrolled, setIsScrolled] = (0, _react.useState)(false);
|
|
44
44
|
const requestedAnimationFrameIdRef = (0, _react.useRef)(0);
|
|
@@ -61,7 +61,9 @@ const useScrollState = containerElement => {
|
|
|
61
61
|
}, [updateScrollState]);
|
|
62
62
|
const updateScrollableElements = (0, _react.useCallback)(() => {
|
|
63
63
|
const computedContainerElement = containerElement || fakeDefaultContainerElement;
|
|
64
|
-
|
|
64
|
+
if (computedContainerElement) {
|
|
65
|
+
scrollableElementsRef.current = getNestedScrollContainers(computedContainerElement).concat(computedContainerElement);
|
|
66
|
+
}
|
|
65
67
|
}, [containerElement]);
|
|
66
68
|
const updateScrollListeners = (0, _react.useCallback)(() => {
|
|
67
69
|
removeScrollEventListeners();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollState.cjs","names":["_react","require","getIsScrollHeightElement","containerElement","element","containerElementHeight","getBoundingClientRect","height","elementHeight","exports","getIsYAxisScrollContainer","overflowY","window","getComputedStyle","getIsYAxisScrolling","scrollHeight","clientHeight","getNestedScrollContainers","Array","from","querySelectorAll","filter","scrollHeightElement","fakeDefaultContainerElement","document","createElement","useScrollState","isScrolled","setIsScrolled","useState","requestedAnimationFrameIdRef","useRef","scrollableElementsRef","updateScrollState","useCallback","cancelAnimationFrame","current","requestAnimationFrame","reduce","scrollableElement","scrollTop","addScrollEventListeners","forEach","addEventListener","removeScrollEventListeners","removeEventListener","updateScrollableElements","computedContainerElement","concat","updateScrollListeners","useEffect","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","disconnect","isContentScrolled"],"sources":["../../../src/ui-shell/useScrollState.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const getIsScrollHeightElement = ({\n containerElement,\n element,\n}: {\n containerElement: HTMLElement;\n element: HTMLElement;\n}) => {\n const containerElementHeight =\n containerElement.getBoundingClientRect().height;\n const elementHeight = element.getBoundingClientRect().height;\n\n return elementHeight - containerElementHeight >= 0;\n};\n\nexport const getIsYAxisScrollContainer = (element: HTMLElement) => {\n const overflowY = window.getComputedStyle(element).overflowY;\n\n return overflowY === \"auto\" || overflowY === \"scroll\";\n};\n\nexport const getIsYAxisScrolling = (element: HTMLElement) =>\n element.scrollHeight > element.clientHeight\n ? getIsYAxisScrollContainer(element)\n : false;\n\nexport const getNestedScrollContainers = (containerElement: HTMLElement) =>\n Array.from(containerElement.querySelectorAll<HTMLElement>(\"*\"))\n .filter((element) =>\n getIsScrollHeightElement({\n containerElement,\n element,\n }),\n )\n .filter((scrollHeightElement) =>\n getIsYAxisScrollContainer(scrollHeightElement),\n );\n\nexport const fakeDefaultContainerElement
|
|
1
|
+
{"version":3,"file":"useScrollState.cjs","names":["_react","require","getIsScrollHeightElement","containerElement","element","containerElementHeight","getBoundingClientRect","height","elementHeight","exports","getIsYAxisScrollContainer","overflowY","window","getComputedStyle","getIsYAxisScrolling","scrollHeight","clientHeight","getNestedScrollContainers","Array","from","querySelectorAll","filter","scrollHeightElement","fakeDefaultContainerElement","document","createElement","useScrollState","isScrolled","setIsScrolled","useState","requestedAnimationFrameIdRef","useRef","scrollableElementsRef","updateScrollState","useCallback","cancelAnimationFrame","current","requestAnimationFrame","reduce","scrollableElement","scrollTop","addScrollEventListeners","forEach","addEventListener","removeScrollEventListeners","removeEventListener","updateScrollableElements","computedContainerElement","concat","updateScrollListeners","useEffect","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","disconnect","isContentScrolled"],"sources":["../../../src/ui-shell/useScrollState.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const getIsScrollHeightElement = ({\n containerElement,\n element,\n}: {\n containerElement: HTMLElement;\n element: HTMLElement;\n}) => {\n const containerElementHeight =\n containerElement.getBoundingClientRect().height;\n const elementHeight = element.getBoundingClientRect().height;\n\n return elementHeight - containerElementHeight >= 0;\n};\n\nexport const getIsYAxisScrollContainer = (element: HTMLElement) => {\n const overflowY = window.getComputedStyle(element).overflowY;\n\n return overflowY === \"auto\" || overflowY === \"scroll\";\n};\n\nexport const getIsYAxisScrolling = (element: HTMLElement) =>\n element.scrollHeight > element.clientHeight\n ? getIsYAxisScrollContainer(element)\n : false;\n\nexport const getNestedScrollContainers = (containerElement: HTMLElement) =>\n Array.from(containerElement.querySelectorAll<HTMLElement>(\"*\"))\n .filter((element) =>\n getIsScrollHeightElement({\n containerElement,\n element,\n }),\n )\n .filter((scrollHeightElement) =>\n getIsYAxisScrollContainer(scrollHeightElement),\n );\n\nexport const fakeDefaultContainerElement =\n typeof window === \"undefined\" ? null : document.createElement(\"div\");\n\nexport const useScrollState = <\n ContainerElement extends HTMLElement = HTMLDivElement,\n>(\n /**\n * The element containing a scroll area.\n */\n containerElement: ContainerElement | null,\n) => {\n const [isScrolled, setIsScrolled] = useState(false);\n\n const requestedAnimationFrameIdRef = useRef(0);\n const scrollableElementsRef = useRef<HTMLElement[]>([]);\n\n const updateScrollState = useCallback(() => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n\n requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {\n setIsScrolled(\n scrollableElementsRef.current.reduce(\n (isScrolled, scrollableElement) =>\n isScrolled || scrollableElement.scrollTop > 0,\n false,\n ),\n );\n });\n }, []);\n\n const addScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.addEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const removeScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.removeEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const updateScrollableElements = useCallback(() => {\n const computedContainerElement =\n containerElement || fakeDefaultContainerElement;\n\n if (computedContainerElement) {\n scrollableElementsRef.current = getNestedScrollContainers(\n computedContainerElement,\n ).concat(computedContainerElement);\n }\n }, [containerElement]);\n\n const updateScrollListeners = useCallback(() => {\n removeScrollEventListeners();\n updateScrollableElements();\n addScrollEventListeners();\n updateScrollState();\n }, [\n addScrollEventListeners,\n removeScrollEventListeners,\n updateScrollableElements,\n updateScrollState,\n ]);\n\n useEffect(() => {\n const mutationObserver = new MutationObserver(() => {\n updateScrollListeners();\n });\n\n if (containerElement) {\n mutationObserver.observe(containerElement, {\n attributes: true,\n attributeFilter: [\"style\"],\n childList: true,\n subtree: true,\n });\n }\n\n updateScrollListeners();\n\n return () => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n removeScrollEventListeners();\n mutationObserver.disconnect();\n };\n }, [containerElement, removeScrollEventListeners, updateScrollListeners]);\n\n return {\n isContentScrolled: isScrolled,\n };\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,wBAAwB,GAAGA,CAAC;EACvCC,gBAAgB;EAChBC;AAIF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAC1BF,gBAAgB,CAACG,qBAAqB,CAAC,CAAC,CAACC,MAAM;EACjD,MAAMC,aAAa,GAAGJ,OAAO,CAACE,qBAAqB,CAAC,CAAC,CAACC,MAAM;EAE5D,OAAOC,aAAa,GAAGH,sBAAsB,IAAI,CAAC;AACpD,CAAC;AAACI,OAAA,CAAAP,wBAAA,GAAAA,wBAAA;AAEK,MAAMQ,yBAAyB,GAAIN,OAAoB,IAAK;EACjE,MAAMO,SAAS,GAAGC,MAAM,CAACC,gBAAgB,CAACT,OAAO,CAAC,CAACO,SAAS;EAE5D,OAAOA,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,QAAQ;AACvD,CAAC;AAACF,OAAA,CAAAC,yBAAA,GAAAA,yBAAA;AAEK,MAAMI,mBAAmB,GAAIV,OAAoB,IACtDA,OAAO,CAACW,YAAY,GAAGX,OAAO,CAACY,YAAY,GACvCN,yBAAyB,CAACN,OAAO,CAAC,GAClC,KAAK;AAACK,OAAA,CAAAK,mBAAA,GAAAA,mBAAA;AAEL,MAAMG,yBAAyB,GAAId,gBAA6B,IACrEe,KAAK,CAACC,IAAI,CAAChB,gBAAgB,CAACiB,gBAAgB,CAAc,GAAG,CAA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C1DQ,0BAA0B,CAAC,CAAC;MAC5BO,gBAAgB,CAACO,UAAU,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,CAACvD,gBAAgB,EAAEyC,0BAA0B,EAAEK,qBAAqB,CAAC,CAAC;EAEzE,OAAO;IACLU,iBAAiB,EAAEhC;EACrB,CAAC;AACH,CAAC;AAAClB,OAAA,CAAAiB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -54,9 +54,9 @@ const useAutocomplete = ({
|
|
|
54
54
|
return value === undefined ? defaultValue : undefined;
|
|
55
55
|
}, [defaultValue, hasMultipleChoices, value]);
|
|
56
56
|
const valueProps = (0, _inputUtils.useInputValues)({
|
|
57
|
+
controlState: controlledStateRef.current,
|
|
57
58
|
defaultValue: defaultValueProp,
|
|
58
|
-
value
|
|
59
|
-
controlState: controlledStateRef.current
|
|
59
|
+
value
|
|
60
60
|
});
|
|
61
61
|
const inputValueProp = (0, _react.useMemo)(() => {
|
|
62
62
|
if (controlledStateRef.current === _inputUtils.ComponentControlledState.CONTROLLED) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutocomplete.cjs","names":["_react","require","_Field","_inputUtils","_jsxRuntime","_interopRequireDefault","e","__esModule","default","useAutocomplete","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","hint","HintLinkComponent","inputValue","isFullWidth","isOptional","isVirtualized","isVirtualizedProp","label","name","nameOverride","testId","value","controlledStateRef","useRef","getControlState","controlledValue","uncontrolledValue","isVirtualizedRef","Boolean","defaultValueProp","useMemo","undefined","valueProps","useInputValues","controlState","current","inputValueProp","ComponentControlledState","CONTROLLED","renderInput","useCallback","InputLabelProps","InputProps","params","jsx","Field","fieldType","hasVisibleLabel","id","htmlFor","renderFieldComponent","errorMessageElementId","labelElementId","_InputBase2","inputProps","required","exports"],"sources":["../../src/useAutocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { useCallback, useMemo, useRef } from \"react\";\nimport {\n InputBase,\n AutocompleteValue,\n AutocompleteRenderInputParams,\n} from \"@mui/material\";\n\nimport { AutocompleteProps } from \"./Autocomplete.js\";\nimport { Field } from \"./Field.js\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils.js\";\n\nexport type UseAutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = Pick<\n AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n | \"ariaDescribedBy\"\n | \"defaultValue\"\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hasMultipleChoices\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"inputValue\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"isVirtualized\"\n | \"label\"\n | \"name\"\n | \"testId\"\n | \"value\"\n>;\n\nexport const useAutocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized: isVirtualizedProp,\n label,\n name: nameOverride,\n testId,\n value,\n}: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n\n const isVirtualizedRef = useRef(Boolean(isVirtualizedProp));\n\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n
|
|
1
|
+
{"version":3,"file":"useAutocomplete.cjs","names":["_react","require","_Field","_inputUtils","_jsxRuntime","_interopRequireDefault","e","__esModule","default","useAutocomplete","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","hint","HintLinkComponent","inputValue","isFullWidth","isOptional","isVirtualized","isVirtualizedProp","label","name","nameOverride","testId","value","controlledStateRef","useRef","getControlState","controlledValue","uncontrolledValue","isVirtualizedRef","Boolean","defaultValueProp","useMemo","undefined","valueProps","useInputValues","controlState","current","inputValueProp","ComponentControlledState","CONTROLLED","renderInput","useCallback","InputLabelProps","InputProps","params","jsx","Field","fieldType","hasVisibleLabel","id","htmlFor","renderFieldComponent","errorMessageElementId","labelElementId","_InputBase2","inputProps","required","exports"],"sources":["../../src/useAutocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { useCallback, useMemo, useRef } from \"react\";\nimport {\n InputBase,\n AutocompleteValue,\n AutocompleteRenderInputParams,\n} from \"@mui/material\";\n\nimport { AutocompleteProps } from \"./Autocomplete.js\";\nimport { Field } from \"./Field.js\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils.js\";\n\nexport type UseAutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = Pick<\n AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n | \"ariaDescribedBy\"\n | \"defaultValue\"\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hasMultipleChoices\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"inputValue\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"isVirtualized\"\n | \"label\"\n | \"name\"\n | \"testId\"\n | \"value\"\n>;\n\nexport const useAutocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized: isVirtualizedProp,\n label,\n name: nameOverride,\n testId,\n value,\n}: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n\n const isVirtualizedRef = useRef(Boolean(isVirtualizedProp));\n\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n controlState: controlledStateRef.current,\n defaultValue: defaultValueProp,\n value,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({\n InputLabelProps,\n InputProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n //@ts-expect-error htmlFor exists on `InputLabelProps`, but not the type.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n id={InputLabelProps.htmlFor}\n isFullWidth={isFullWidth}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n \"data-se\": testId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isFullWidth,\n isOptional,\n label,\n nameOverride,\n testId,\n ],\n );\n\n return {\n inputValueProp,\n isVirtualizedRef,\n renderInput,\n valueProps,\n };\n};\n"],"mappings":";;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIyB,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAzBzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwCO,MAAMG,eAAe,GAAGA,CAI7B;EACAC,eAAe;EACfC,YAAY;EACZC,YAAY;EACZC,gBAAgB;EAChBC,kBAAkB;EAClB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,eAAe,EAAEA,eAAgB;IACjCE,YAAY,EAAEA,YAAa;IAC3BC,gBAAgB,EAAEA,gBAAiB;IACnCsC,SAAS,EAAC,QAAQ;IAClBC,eAAe;IAGfC,EAAE,EAAEP,eAAe,CAACQ,OAAQ;IAC5BpC,WAAW,EAAEA,WAAY;IACzBH,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCM,KAAK,EAAEA,KAAM;IACbH,UAAU,EAAEA,UAAW;IACvBoC,oBAAoB,EAAEA,CAAC;MACrB7C,eAAe;MACf2C,EAAE;MACFG,qBAAqB;MACrBC;IACF,CAAC,KACC,IAAArD,WAAA,CAAA6C,GAAA,EAAAS,WAAA,CAAAlD,OAAA;MAAA,GACMwC,MAAM;MAAA,GACND,UAAU;MACdY,UAAU,EAAE;QACV,GAAGX,MAAM,CAACW,UAAU;QACpB,mBAAmB,EAAEH,qBAAqB;QAC1C,iBAAiB,EAAEC,cAAc;QACjC,SAAS,EAAEhC;MACb,CAAE;MACF,oBAAkBf,eAAgB;MAClC2C,EAAE,EAAEA,EAAG;MACP9B,IAAI,EAAEC,YAAY,IAAI6B,EAAG;MACzBO,QAAQ,EAAE,CAACzC;IAAW,CACvB;EACD,CACH,CACF,EACD,CACET,eAAe,EACfE,YAAY,EACZC,gBAAgB,EAChBE,IAAI,EACJC,iBAAiB,EACjBE,WAAW,EACXC,UAAU,EACVG,KAAK,EACLE,YAAY,EACZC,MAAM,CAEV,CAAC;EAED,OAAO;IACLgB,cAAc;IACdT,gBAAgB;IAChBY,WAAW;IACXP;EACF,CAAC;AACH,CAAC;AAACwB,OAAA,CAAApD,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -21,13 +21,13 @@ const useMountLifecycleEffect = ({
|
|
|
21
21
|
onMount,
|
|
22
22
|
onUpdate
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
24
|
+
const isMounted = (0, _react.useRef)(false);
|
|
25
25
|
const onMountRef = (0, _react.useRef)(onMount);
|
|
26
26
|
(0, _react.useEffect)(() => {
|
|
27
|
-
if (
|
|
27
|
+
if (isMounted.current) {
|
|
28
28
|
onUpdate?.();
|
|
29
29
|
} else {
|
|
30
|
-
|
|
30
|
+
isMounted.current = true;
|
|
31
31
|
onMountRef.current?.();
|
|
32
32
|
}
|
|
33
33
|
}, [onUpdate]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMountLifecycleEffect.cjs","names":["_react","require","useMountLifecycleEffect","onMount","onUpdate","
|
|
1
|
+
{"version":3,"file":"useMountLifecycleEffect.cjs","names":["_react","require","useMountLifecycleEffect","onMount","onUpdate","isMounted","useRef","onMountRef","useEffect","current","exports"],"sources":["../../src/useMountLifecycleEffect.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-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 { useEffect, useRef } from \"react\";\n\nexport const useMountLifecycleEffect = ({\n onMount,\n onUpdate,\n}: {\n onMount?: () => void;\n onUpdate?: () => void;\n}) => {\n const isMounted = useRef(false);\n const onMountRef = useRef(onMount);\n\n useEffect(() => {\n if (isMounted.current) {\n onUpdate?.();\n } else {\n isMounted.current = true;\n onMountRef.current?.();\n }\n }, [onUpdate]);\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,OAAO;EACPC;AAIF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAC/B,MAAMC,UAAU,GAAG,IAAAD,aAAM,EAACH,OAAO,CAAC;EAElC,IAAAK,gBAAS,EAAC,MAAM;IACd,IAAIH,SAAS,CAACI,OAAO,EAAE;MACrBL,QAAQ,GAAG,CAAC;IACd,CAAC,MAAM;MACLC,SAAS,CAACI,OAAO,GAAG,IAAI;MACxBF,UAAU,CAACE,OAAO,GAAG,CAAC;IACxB;EACF,CAAC,EAAE,CAACL,QAAQ,CAAC,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAR,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -15,5 +15,5 @@ exports.default = void 0;
|
|
|
15
15
|
*
|
|
16
16
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default = exports.default = "
|
|
18
|
+
var _default = exports.default = "1-42-0";
|
|
19
19
|
//# sourceMappingURL=odysseyWebComponentVersion.generated.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odysseyWebComponentVersion.generated.cjs","names":["_default","exports","default"],"sources":["../../../src/web-component/odysseyWebComponentVersion.generated.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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\n/**\n * DO NOT UPDATE THIS FILE MANUALLY\n * This file is managed by scripts/updateWebComponentVersion.ts and any changes made will be overwritten\n * This script only needs to be run during release, and shouldn't be used during local development.\n */\nexport default \"
|
|
1
|
+
{"version":3,"file":"odysseyWebComponentVersion.generated.cjs","names":["_default","exports","default"],"sources":["../../../src/web-component/odysseyWebComponentVersion.generated.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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\n/**\n * DO NOT UPDATE THIS FILE MANUALLY\n * This file is managed by scripts/updateWebComponentVersion.ts and any changes made will be overwritten\n * This script only needs to be run during release, and shouldn't be used during local development.\n */\n\nexport default \"1-42-0\";\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAkBe,QAAQ","ignoreList":[]}
|
package/dist/esm/Autocomplete.js
CHANGED
|
@@ -51,8 +51,11 @@ const Autocomplete = ({
|
|
|
51
51
|
defaultValue,
|
|
52
52
|
errorMessage,
|
|
53
53
|
errorMessageList,
|
|
54
|
+
getIsOptionEqualToValue,
|
|
54
55
|
getOptionLabel,
|
|
55
56
|
hasMultipleChoices,
|
|
57
|
+
hint,
|
|
58
|
+
HintLinkComponent,
|
|
56
59
|
id: idOverride,
|
|
57
60
|
inputValue,
|
|
58
61
|
isCustomValueAllowed,
|
|
@@ -62,20 +65,17 @@ const Autocomplete = ({
|
|
|
62
65
|
isOptional = false,
|
|
63
66
|
isReadOnly,
|
|
64
67
|
isVirtualized = false,
|
|
65
|
-
hint,
|
|
66
|
-
HintLinkComponent,
|
|
67
68
|
label,
|
|
68
69
|
name: nameOverride,
|
|
69
70
|
noOptionsText,
|
|
70
71
|
onBlur,
|
|
71
72
|
onChange,
|
|
72
|
-
onInputChange,
|
|
73
73
|
onFocus,
|
|
74
|
+
onInputChange,
|
|
74
75
|
options,
|
|
75
|
-
value,
|
|
76
|
-
getIsOptionEqualToValue,
|
|
77
76
|
testId,
|
|
78
|
-
translate
|
|
77
|
+
translate,
|
|
78
|
+
value
|
|
79
79
|
}) => {
|
|
80
80
|
const {
|
|
81
81
|
t
|
|
@@ -113,23 +113,23 @@ const Autocomplete = ({
|
|
|
113
113
|
closeText: t("close.text"),
|
|
114
114
|
disableCloseOnSelect: hasMultipleChoices,
|
|
115
115
|
disabled: isDisabled,
|
|
116
|
-
freeSolo: isCustomValueAllowed,
|
|
117
116
|
filterSelectedOptions: true,
|
|
117
|
+
freeSolo: isCustomValueAllowed,
|
|
118
|
+
fullWidth: isFullWidth,
|
|
118
119
|
getOptionLabel: getOptionLabel,
|
|
119
120
|
id: idOverride,
|
|
120
|
-
|
|
121
|
+
isOptionEqualToValue: getIsOptionEqualToValue,
|
|
121
122
|
loading: isLoading,
|
|
122
123
|
multiple: hasMultipleChoices,
|
|
123
124
|
noOptionsText: noOptionsText || t("autocomplete.nooptions"),
|
|
124
125
|
onBlur: onBlur,
|
|
125
126
|
onChange: onChange,
|
|
126
|
-
onInputChange: onInputChange,
|
|
127
127
|
onFocus: onFocus,
|
|
128
|
+
onInputChange: onInputChange,
|
|
128
129
|
openText: t("open.text"),
|
|
129
130
|
options: options,
|
|
130
131
|
readOnly: isReadOnly,
|
|
131
132
|
renderInput: renderInput,
|
|
132
|
-
isOptionEqualToValue: getIsOptionEqualToValue,
|
|
133
133
|
translate: translate
|
|
134
134
|
});
|
|
135
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","names":["memo","useTranslation","PickerVirtualizationListBox","useAutocomplete","jsx","_jsx","AutocompleteTestSelector","accessibleText","errorMessage","hint","label","children","list","listItem","elementSelector","method","options","role","isControlledElement","Autocomplete","ariaDescribedBy","defaultValue","errorMessageList","getOptionLabel","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","HintLinkComponent","name","nameOverride","noOptionsText","onBlur","onChange","onInputChange","onFocus","value","getIsOptionEqualToValue","testId","translate","t","inputValueProp","isVirtualizedRef","renderInput","valueProps","_Autocomplete","current","ListboxComponent","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","loading","multiple","openText","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../../src/Autocomplete.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 { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n UseAutocompleteProps as MuiUseAutocompleteProps,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps.js\";\nimport type { HtmlProps } from \"./HtmlProps.js\";\nimport { PickerVirtualizationListBox } from \"./labs/OdysseyPickers/PickerVirtualizationListBox.js\";\nimport { useAutocomplete } from \"./useAutocomplete.js\";\nimport { TestSelector } from \"./test-selectors/index.js\";\n\nexport const AutocompleteTestSelector = {\n accessibleText: {\n errorMessage: \"errorMessage\",\n hint: \"description\",\n label: \"label\",\n },\n children: {\n list: {\n children: {\n listItem: {\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"option\",\n },\n },\n },\n isControlledElement: true,\n },\n },\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"combobox\",\n },\n} as const satisfies TestSelector;\n// type SetItemSize = (size: number) => void;\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Used to determine the string value for a given option. It's used to fill the input (and the list box options if renderOption is not provided). If used in free solo mode, it must accept both the type of the options and a string.\n *\n * `function(option: Value) => string`\n */\n getOptionLabel?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n\n /** Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * If this component is required to display a virtualized list of options,\n * then this value needs to be set to true.\n * It is recommended if you're options are on the order of 10's of hundreds or more.\n */\n isVirtualized?: boolean;\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The text to display when no options are available\n *\n * default: \"No options\"\n */\n noOptionsText?: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getOptionLabel,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n noOptionsText,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const { t } = useTranslation();\n const { inputValueProp, isVirtualizedRef, renderInput, valueProps } =\n useAutocomplete<OptionType, HasMultipleChoices, IsCustomValueAllowed>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized,\n label,\n name: nameOverride,\n testId,\n value,\n });\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualizedRef.current && {\n ListboxComponent: PickerVirtualizationListBox,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n getOptionLabel={getOptionLabel}\n id={idOverride}\n fullWidth={isFullWidth}\n loading={isLoading}\n multiple={hasMultipleChoices}\n noOptionsText={noOptionsText || t(\"autocomplete.nooptions\")}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n openText={t(\"open.text\")}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport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A,WAAY;IACzBgB,oBAAoB,EAAEtB,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMqB,oBAAoB,GAAGnE,IAAI,CAACmB,YAAY,CAAwB;AAEtEgD,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIhD,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","names":["memo","useTranslation","PickerVirtualizationListBox","useAutocomplete","jsx","_jsx","AutocompleteTestSelector","accessibleText","errorMessage","hint","label","children","list","listItem","elementSelector","method","options","role","isControlledElement","Autocomplete","ariaDescribedBy","defaultValue","errorMessageList","getIsOptionEqualToValue","getOptionLabel","hasMultipleChoices","HintLinkComponent","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","name","nameOverride","noOptionsText","onBlur","onChange","onFocus","onInputChange","testId","translate","value","t","inputValueProp","isVirtualizedRef","renderInput","valueProps","_Autocomplete","current","ListboxComponent","clearText","closeText","disableCloseOnSelect","disabled","filterSelectedOptions","freeSolo","fullWidth","isOptionEqualToValue","loading","multiple","openText","readOnly","MemoizedAutocomplete","displayName"],"sources":["../../src/Autocomplete.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 { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n UseAutocompleteProps as MuiUseAutocompleteProps,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps.js\";\nimport type { HtmlProps } from \"./HtmlProps.js\";\nimport { PickerVirtualizationListBox } from \"./labs/OdysseyPickers/PickerVirtualizationListBox.js\";\nimport { useAutocomplete } from \"./useAutocomplete.js\";\nimport { TestSelector } from \"./test-selectors/index.js\";\n\nexport const AutocompleteTestSelector = {\n accessibleText: {\n errorMessage: \"errorMessage\",\n hint: \"description\",\n label: \"label\",\n },\n children: {\n list: {\n children: {\n listItem: {\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"option\",\n },\n },\n },\n isControlledElement: true,\n },\n },\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"combobox\",\n },\n} as const satisfies TestSelector;\n// type SetItemSize = (size: number) => void;\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Used to determine the string value for a given option. It's used to fill the input (and the list box options if renderOption is not provided). If used in free solo mode, it must accept both the type of the options and a string.\n *\n * `function(option: Value) => string`\n */\n getOptionLabel?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n\n /** Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * If this component is required to display a virtualized list of options,\n * then this value needs to be set to true.\n * It is recommended if you're options are on the order of 10's of hundreds or more.\n */\n isVirtualized?: boolean;\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The text to display when no options are available\n *\n * default: \"No options\"\n */\n noOptionsText?: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: MuiUseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n getOptionLabel,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized = false,\n label,\n name: nameOverride,\n noOptionsText,\n onBlur,\n onChange,\n onFocus,\n onInputChange,\n options,\n testId,\n translate,\n value,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const { t } = useTranslation();\n const { inputValueProp, isVirtualizedRef, renderInput, valueProps } =\n useAutocomplete<OptionType, HasMultipleChoices, IsCustomValueAllowed>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized,\n label,\n name: nameOverride,\n testId,\n value,\n });\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualizedRef.current && {\n ListboxComponent: PickerVirtualizationListBox,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n filterSelectedOptions={true}\n freeSolo={isCustomValueAllowed}\n fullWidth={isFullWidth}\n getOptionLabel={getOptionLabel}\n id={idOverride}\n isOptionEqualToValue={getIsOptionEqualToValue}\n loading={isLoading}\n multiple={hasMultipleChoices}\n noOptionsText={noOptionsText || t(\"autocomplete.nooptions\")}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n onInputChange={onInputChange}\n openText={t(\"open.text\")}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,cAAc,QAAQ,eAAe;AAS9C,SAASC,2BAA2B,QAAQ,sDAAsD;AAClG,SAASC,eAAe,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGvD,OAAO,MAAMC,wBAAwB,GAAG;EACtCC,cAAc,EAAE;IACdC,YAAY,EAAE,cAAc;IAC5BC,IAAI,EAAE,aAAa;IACnBC,KAAK,EAAE;EACT,CAAC;EACDC,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJD,QAAQ,EAAE;QACRE,QAAQ,EAAE;UACRC,eAAe,EAAE;YACfC,MAAM,EAAE,QAAQ;YAChBC,OAAO,EAAE;cACPN,KAAK,EAAE;YACT,CAAC;YACDO,IAAI,EAAE;UACR;QACF;MACF,CAAC;MACDC,mBAAmB,EAAE;IACvB;EACF,CAAC;EACDJ,eAAe,EAAE;IACfC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE;MACPN,KAAK,EAAE;IACT,CAAC;IAC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