@atlaskit/atlassian-navigation 5.7.1 → 5.7.3
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/CHANGELOG.md +13 -0
- package/afm-cc/tsconfig.json +0 -1
- package/afm-products/tsconfig.json +0 -1
- package/dist/cjs/common/action-section-desktop-css.js +12 -0
- package/dist/cjs/common/action-section-mobile-css.js +12 -0
- package/dist/cjs/common/constants.js +3 -0
- package/dist/cjs/common/styles.js +13 -9
- package/dist/cjs/components/AppSwitcher/app-switcher-nav4.js +61 -0
- package/dist/cjs/components/AppSwitcher/app-switcher.js +79 -0
- package/dist/cjs/components/AppSwitcher/index.js +1 -119
- package/dist/cjs/components/AtlassianNavigation/index.js +6 -0
- package/dist/cjs/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/cjs/components/Create/index.js +2 -0
- package/dist/cjs/components/Help/index.js +2 -0
- package/dist/cjs/components/IconButton/index.js +1 -0
- package/dist/cjs/components/Notifications/index.js +2 -0
- package/dist/cjs/components/PrimaryButton/index.js +2 -0
- package/dist/cjs/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/cjs/components/PrimaryItemsContainer/index.js +5 -4
- package/dist/cjs/components/ProductHome/app-home.js +180 -0
- package/dist/cjs/components/ProductHome/custom-product-home.js +2 -0
- package/dist/cjs/components/ProductHome/product-home.js +21 -110
- package/dist/cjs/components/Profile/index.js +2 -0
- package/dist/cjs/components/Profile/profile.js +74 -0
- package/dist/cjs/components/Search/index.js +2 -0
- package/dist/cjs/components/Settings/index.js +2 -0
- package/dist/cjs/components/SignIn/index.js +2 -0
- package/dist/cjs/controllers/overflow/index.js +2 -0
- package/dist/cjs/controllers/overflow/overflow-context.js +16 -0
- package/dist/cjs/controllers/overflow/overflow-provider.js +27 -0
- package/dist/cjs/controllers/overflow/use-overflow-controller.js +111 -0
- package/dist/cjs/controllers/overflow/use-overflow-status.js +20 -0
- package/dist/cjs/entry-points/app-switcher.js +4 -3
- package/dist/cjs/entry-points/overflow.js +2 -2
- package/dist/cjs/entry-points/profile.js +2 -2
- package/dist/cjs/entry-points/skeleton-help-button.js +2 -1
- package/dist/cjs/index.js +8 -7
- package/dist/cjs/nav4-skeleton-help-button.js +33 -0
- package/dist/cjs/nav4-skeleton-notification-button.js +24 -0
- package/dist/cjs/nav4-skeleton-settings-button.js +23 -0
- package/dist/cjs/nav4-skeleton-switcher-button.js +24 -0
- package/dist/cjs/skeleton-help-button.js +1 -24
- package/dist/cjs/skeleton-notification-button.js +8 -16
- package/dist/cjs/skeleton-settings-button.js +8 -15
- package/dist/cjs/skeleton-switcher-button.js +14 -17
- package/dist/cjs/theme/atlassian-theme.js +16 -0
- package/dist/cjs/theme/convert-hex-shorthand.js +47 -0
- package/dist/cjs/theme/default-theme-brand-refresh.js +10 -0
- package/dist/cjs/theme/default-theme.js +1 -2
- package/dist/cjs/theme/generate-text-color.js +13 -0
- package/dist/cjs/theme/get-box-shadow.js +9 -0
- package/dist/cjs/theme/get-contrast-color.js +12 -0
- package/dist/cjs/theme/hex-to-rgba.js +18 -0
- package/dist/cjs/theme/index.js +2 -2
- package/dist/cjs/theme/theme-context.js +10 -0
- package/dist/cjs/theme/theme-generator.js +28 -18
- package/dist/cjs/theme/theme-helpers.js +10 -5
- package/dist/cjs/theme/theme-provider.js +11 -8
- package/dist/cjs/theme/themes.js +11 -8
- package/dist/cjs/theme/use-theme.js +2 -2
- package/dist/es2019/common/action-section-desktop-css.js +6 -0
- package/dist/es2019/common/action-section-mobile-css.js +6 -0
- package/dist/es2019/common/constants.js +3 -0
- package/dist/es2019/common/styles.js +2 -11
- package/dist/es2019/components/AppSwitcher/app-switcher-nav4.js +52 -0
- package/dist/es2019/components/AppSwitcher/app-switcher.js +70 -0
- package/dist/es2019/components/AppSwitcher/index.js +0 -116
- package/dist/es2019/components/AtlassianNavigation/index.js +6 -0
- package/dist/es2019/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/es2019/components/Create/index.js +2 -0
- package/dist/es2019/components/Help/index.js +2 -0
- package/dist/es2019/components/IconButton/index.js +1 -0
- package/dist/es2019/components/Notifications/index.js +2 -0
- package/dist/es2019/components/PrimaryButton/index.js +2 -0
- package/dist/es2019/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/es2019/components/PrimaryItemsContainer/index.js +2 -1
- package/dist/es2019/components/ProductHome/app-home.js +185 -0
- package/dist/es2019/components/ProductHome/custom-product-home.js +2 -0
- package/dist/es2019/components/ProductHome/product-home.js +5 -110
- package/dist/es2019/components/Profile/index.js +2 -0
- package/dist/es2019/components/Profile/profile.js +65 -0
- package/dist/es2019/components/Search/index.js +2 -0
- package/dist/es2019/components/Settings/index.js +2 -0
- package/dist/es2019/components/SignIn/index.js +2 -0
- package/dist/es2019/controllers/overflow/index.js +2 -0
- package/dist/es2019/controllers/overflow/overflow-context.js +8 -0
- package/dist/es2019/controllers/overflow/overflow-provider.js +18 -0
- package/dist/es2019/controllers/overflow/use-overflow-controller.js +89 -0
- package/dist/es2019/controllers/overflow/use-overflow-status.js +13 -0
- package/dist/es2019/entry-points/app-switcher.js +2 -1
- package/dist/es2019/entry-points/overflow.js +1 -1
- package/dist/es2019/entry-points/profile.js +1 -1
- package/dist/es2019/entry-points/skeleton-help-button.js +2 -1
- package/dist/es2019/index.js +4 -3
- package/dist/es2019/nav4-skeleton-help-button.js +24 -0
- package/dist/es2019/nav4-skeleton-notification-button.js +15 -0
- package/dist/es2019/nav4-skeleton-settings-button.js +14 -0
- package/dist/es2019/nav4-skeleton-switcher-button.js +15 -0
- package/dist/es2019/skeleton-help-button.js +1 -22
- package/dist/es2019/skeleton-notification-button.js +1 -13
- package/dist/es2019/skeleton-settings-button.js +1 -12
- package/dist/es2019/skeleton-switcher-button.js +8 -14
- package/dist/es2019/theme/atlassian-theme.js +10 -0
- package/dist/es2019/theme/convert-hex-shorthand.js +27 -0
- package/dist/es2019/theme/default-theme-brand-refresh.js +3 -0
- package/dist/es2019/theme/default-theme.js +0 -1
- package/dist/es2019/theme/generate-text-color.js +6 -0
- package/dist/es2019/theme/get-box-shadow.js +1 -0
- package/dist/es2019/theme/get-contrast-color.js +3 -0
- package/dist/es2019/theme/hex-to-rgba.js +8 -0
- package/dist/es2019/theme/index.js +1 -1
- package/dist/es2019/theme/theme-context.js +4 -0
- package/dist/es2019/theme/theme-generator.js +12 -2
- package/dist/es2019/theme/theme-helpers.js +3 -5
- package/dist/es2019/theme/theme-provider.js +5 -7
- package/dist/es2019/theme/themes.js +6 -8
- package/dist/es2019/theme/use-theme.js +1 -1
- package/dist/esm/common/action-section-desktop-css.js +5 -0
- package/dist/esm/common/action-section-mobile-css.js +5 -0
- package/dist/esm/common/constants.js +3 -0
- package/dist/esm/common/styles.js +2 -8
- package/dist/esm/components/AppSwitcher/app-switcher-nav4.js +52 -0
- package/dist/esm/components/AppSwitcher/app-switcher.js +70 -0
- package/dist/esm/components/AppSwitcher/index.js +0 -115
- package/dist/esm/components/AtlassianNavigation/index.js +6 -0
- package/dist/esm/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/esm/components/Create/index.js +2 -0
- package/dist/esm/components/Help/index.js +2 -0
- package/dist/esm/components/IconButton/index.js +1 -0
- package/dist/esm/components/Notifications/index.js +2 -0
- package/dist/esm/components/PrimaryButton/index.js +2 -0
- package/dist/esm/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/esm/components/PrimaryItemsContainer/index.js +2 -1
- package/dist/esm/components/ProductHome/app-home.js +172 -0
- package/dist/esm/components/ProductHome/custom-product-home.js +2 -0
- package/dist/esm/components/ProductHome/product-home.js +16 -110
- package/dist/esm/components/Profile/index.js +2 -0
- package/dist/esm/components/Profile/profile.js +65 -0
- package/dist/esm/components/Search/index.js +2 -0
- package/dist/esm/components/Settings/index.js +2 -0
- package/dist/esm/components/SignIn/index.js +2 -0
- package/dist/esm/controllers/overflow/index.js +2 -0
- package/dist/esm/controllers/overflow/overflow-context.js +8 -0
- package/dist/esm/controllers/overflow/overflow-provider.js +19 -0
- package/dist/esm/controllers/overflow/use-overflow-controller.js +103 -0
- package/dist/esm/controllers/overflow/use-overflow-status.js +15 -0
- package/dist/esm/entry-points/app-switcher.js +2 -1
- package/dist/esm/entry-points/overflow.js +1 -1
- package/dist/esm/entry-points/profile.js +1 -1
- package/dist/esm/entry-points/skeleton-help-button.js +2 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/nav4-skeleton-help-button.js +26 -0
- package/dist/esm/nav4-skeleton-notification-button.js +17 -0
- package/dist/esm/nav4-skeleton-settings-button.js +16 -0
- package/dist/esm/nav4-skeleton-switcher-button.js +17 -0
- package/dist/esm/skeleton-help-button.js +0 -23
- package/dist/esm/skeleton-notification-button.js +1 -15
- package/dist/esm/skeleton-settings-button.js +1 -14
- package/dist/esm/skeleton-switcher-button.js +8 -16
- package/dist/esm/theme/atlassian-theme.js +10 -0
- package/dist/esm/theme/convert-hex-shorthand.js +40 -0
- package/dist/esm/theme/default-theme-brand-refresh.js +3 -0
- package/dist/esm/theme/default-theme.js +0 -1
- package/dist/esm/theme/generate-text-color.js +6 -0
- package/dist/esm/theme/get-box-shadow.js +3 -0
- package/dist/esm/theme/get-contrast-color.js +5 -0
- package/dist/esm/theme/hex-to-rgba.js +11 -0
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/theme/theme-context.js +4 -0
- package/dist/esm/theme/theme-generator.js +12 -2
- package/dist/esm/theme/theme-helpers.js +3 -5
- package/dist/esm/theme/theme-provider.js +5 -7
- package/dist/esm/theme/themes.js +6 -8
- package/dist/esm/theme/use-theme.js +1 -1
- package/dist/types/common/action-section-desktop-css.d.ts +5 -0
- package/dist/types/common/action-section-mobile-css.d.ts +5 -0
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/common/styles.d.ts +2 -10
- package/dist/types/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
- package/dist/types/components/AppSwitcher/app-switcher.d.ts +14 -0
- package/dist/types/components/AppSwitcher/index.d.ts +0 -12
- package/dist/types/components/AppSwitcher/types.d.ts +3 -0
- package/dist/types/components/AtlassianNavigation/index.d.ts +2 -0
- package/dist/types/components/AtlassianNavigation/skeleton.d.ts +2 -0
- package/dist/types/components/AtlassianNavigation/types.d.ts +6 -0
- package/dist/types/components/Create/index.d.ts +2 -0
- package/dist/types/components/Help/index.d.ts +2 -0
- package/dist/types/components/IconButton/index.d.ts +1 -0
- package/dist/types/components/Notifications/index.d.ts +2 -0
- package/dist/types/components/PrimaryButton/index.d.ts +2 -0
- package/dist/types/components/PrimaryDropdownButton/index.d.ts +2 -0
- package/dist/types/components/ProductHome/app-home.d.ts +20 -0
- package/dist/types/components/ProductHome/custom-product-home.d.ts +2 -0
- package/dist/types/components/ProductHome/product-home.d.ts +4 -13
- package/dist/types/components/Profile/index.d.ts +2 -0
- package/dist/types/components/Profile/profile.d.ts +14 -0
- package/dist/types/components/Profile/types.d.ts +3 -0
- package/dist/types/components/Search/index.d.ts +2 -0
- package/dist/types/components/Search/types.d.ts +3 -0
- package/dist/types/components/Settings/index.d.ts +2 -0
- package/dist/types/components/Settings/types.d.ts +3 -0
- package/dist/types/components/SignIn/index.d.ts +2 -0
- package/dist/types/components/SignIn/types.d.ts +3 -0
- package/dist/types/components/SkeletonCreateButton/types.d.ts +3 -0
- package/dist/types/components/SkeletonIconButton/types.d.ts +3 -0
- package/dist/types/components/SkeletonPrimaryButton/types.d.ts +3 -0
- package/dist/types/controllers/overflow/index.d.ts +2 -0
- package/dist/types/controllers/overflow/overflow-context.d.ts +17 -0
- package/dist/types/controllers/overflow/overflow-provider.d.ts +3 -0
- package/dist/types/controllers/overflow/use-overflow-controller.d.ts +7 -0
- package/dist/types/controllers/overflow/use-overflow-status.d.ts +11 -0
- package/dist/types/entry-points/app-switcher.d.ts +2 -1
- package/dist/types/entry-points/overflow.d.ts +1 -1
- package/dist/types/entry-points/profile.d.ts +1 -1
- package/dist/types/entry-points/skeleton-help-button.d.ts +2 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/nav4-skeleton-help-button.d.ts +8 -0
- package/dist/types/nav4-skeleton-notification-button.d.ts +9 -0
- package/dist/types/nav4-skeleton-settings-button.d.ts +8 -0
- package/dist/types/nav4-skeleton-switcher-button.d.ts +8 -0
- package/dist/types/skeleton-help-button.d.ts +0 -6
- package/dist/types/skeleton-notification-button.d.ts +1 -7
- package/dist/types/skeleton-settings-button.d.ts +1 -6
- package/dist/types/skeleton-switcher-button.d.ts +6 -6
- package/dist/types/theme/atlassian-theme.d.ts +5 -0
- package/dist/types/theme/convert-hex-shorthand.d.ts +1 -0
- package/dist/types/theme/default-theme-brand-refresh.d.ts +1 -0
- package/dist/types/theme/default-theme.d.ts +0 -1
- package/dist/types/theme/generate-text-color.d.ts +1 -0
- package/dist/types/theme/get-box-shadow.d.ts +1 -0
- package/dist/types/theme/get-contrast-color.d.ts +1 -0
- package/dist/types/theme/hex-to-rgba.d.ts +1 -0
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/theme/theme-context.d.ts +3 -0
- package/dist/types/theme/theme-generator.d.ts +5 -0
- package/dist/types/theme/theme-helpers.d.ts +1 -1
- package/dist/types/theme/theme-provider.d.ts +4 -2
- package/dist/types/theme/themes.d.ts +4 -1
- package/dist/types/theme/types.d.ts +30 -0
- package/dist/types-ts4.5/common/action-section-desktop-css.d.ts +5 -0
- package/dist/types-ts4.5/common/action-section-mobile-css.d.ts +5 -0
- package/dist/types-ts4.5/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/common/styles.d.ts +2 -10
- package/dist/types-ts4.5/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
- package/dist/types-ts4.5/components/AppSwitcher/app-switcher.d.ts +14 -0
- package/dist/types-ts4.5/components/AppSwitcher/index.d.ts +0 -12
- package/dist/types-ts4.5/components/AppSwitcher/types.d.ts +3 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/index.d.ts +2 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/types.d.ts +6 -0
- package/dist/types-ts4.5/components/Create/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Help/index.d.ts +2 -0
- package/dist/types-ts4.5/components/IconButton/index.d.ts +1 -0
- package/dist/types-ts4.5/components/Notifications/index.d.ts +2 -0
- package/dist/types-ts4.5/components/PrimaryButton/index.d.ts +2 -0
- package/dist/types-ts4.5/components/PrimaryDropdownButton/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ProductHome/app-home.d.ts +20 -0
- package/dist/types-ts4.5/components/ProductHome/custom-product-home.d.ts +2 -0
- package/dist/types-ts4.5/components/ProductHome/product-home.d.ts +4 -13
- package/dist/types-ts4.5/components/Profile/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Profile/profile.d.ts +14 -0
- package/dist/types-ts4.5/components/Profile/types.d.ts +3 -0
- package/dist/types-ts4.5/components/Search/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Search/types.d.ts +3 -0
- package/dist/types-ts4.5/components/Settings/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Settings/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SignIn/index.d.ts +2 -0
- package/dist/types-ts4.5/components/SignIn/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonCreateButton/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonIconButton/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonPrimaryButton/types.d.ts +3 -0
- package/dist/types-ts4.5/controllers/overflow/index.d.ts +2 -0
- package/dist/types-ts4.5/controllers/overflow/overflow-context.d.ts +17 -0
- package/dist/types-ts4.5/controllers/overflow/overflow-provider.d.ts +3 -0
- package/dist/types-ts4.5/controllers/overflow/use-overflow-controller.d.ts +7 -0
- package/dist/types-ts4.5/controllers/overflow/use-overflow-status.d.ts +11 -0
- package/dist/types-ts4.5/entry-points/app-switcher.d.ts +2 -1
- package/dist/types-ts4.5/entry-points/overflow.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/profile.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/skeleton-help-button.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +4 -3
- package/dist/types-ts4.5/nav4-skeleton-help-button.d.ts +8 -0
- package/dist/types-ts4.5/nav4-skeleton-notification-button.d.ts +9 -0
- package/dist/types-ts4.5/nav4-skeleton-settings-button.d.ts +8 -0
- package/dist/types-ts4.5/nav4-skeleton-switcher-button.d.ts +8 -0
- package/dist/types-ts4.5/skeleton-help-button.d.ts +0 -6
- package/dist/types-ts4.5/skeleton-notification-button.d.ts +1 -7
- package/dist/types-ts4.5/skeleton-settings-button.d.ts +1 -6
- package/dist/types-ts4.5/skeleton-switcher-button.d.ts +6 -6
- package/dist/types-ts4.5/theme/atlassian-theme.d.ts +5 -0
- package/dist/types-ts4.5/theme/convert-hex-shorthand.d.ts +1 -0
- package/dist/types-ts4.5/theme/default-theme-brand-refresh.d.ts +1 -0
- package/dist/types-ts4.5/theme/default-theme.d.ts +0 -1
- package/dist/types-ts4.5/theme/generate-text-color.d.ts +1 -0
- package/dist/types-ts4.5/theme/get-box-shadow.d.ts +1 -0
- package/dist/types-ts4.5/theme/get-contrast-color.d.ts +1 -0
- package/dist/types-ts4.5/theme/hex-to-rgba.d.ts +1 -0
- package/dist/types-ts4.5/theme/index.d.ts +1 -1
- package/dist/types-ts4.5/theme/theme-context.d.ts +3 -0
- package/dist/types-ts4.5/theme/theme-generator.d.ts +5 -0
- package/dist/types-ts4.5/theme/theme-helpers.d.ts +1 -1
- package/dist/types-ts4.5/theme/theme-provider.d.ts +4 -2
- package/dist/types-ts4.5/theme/themes.d.ts +4 -1
- package/dist/types-ts4.5/theme/types.d.ts +30 -0
- package/package.json +12 -12
- package/afm-jira/tsconfig.json +0 -64
- /package/dist/cjs/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/cjs/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
- /package/dist/es2019/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/es2019/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
- /package/dist/esm/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/esm/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
|
+
|
|
6
|
+
import throttle from 'lodash/throttle';
|
|
7
|
+
var THROTTLE_INTERVAL = 16 * 4;
|
|
8
|
+
var ITEM_APPROX_MINWIDTH = 70;
|
|
9
|
+
var calculateHash = function calculateHash(w, n) {
|
|
10
|
+
return w + '#' + n;
|
|
11
|
+
};
|
|
12
|
+
var updateHashRef = function updateHashRef(currentRef, value) {
|
|
13
|
+
currentRef.unshift(value);
|
|
14
|
+
currentRef.length = 3;
|
|
15
|
+
};
|
|
16
|
+
export var useOverflowController = function useOverflowController(nodes) {
|
|
17
|
+
var items = React.Children.toArray(nodes);
|
|
18
|
+
var _useState = useState(9999),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
width = _useState2[0],
|
|
21
|
+
setWidth = _useState2[1];
|
|
22
|
+
var _useState3 = useState(items.length),
|
|
23
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
+
itemsLimit = _useState4[0],
|
|
25
|
+
setItemsLimit = _useState4[1];
|
|
26
|
+
var _useState5 = useState({}),
|
|
27
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
28
|
+
forceEffectValue = _useState6[0],
|
|
29
|
+
triggerForceEffect = _useState6[1];
|
|
30
|
+
// Storing items approximate width so we can try expanding when there is enough room
|
|
31
|
+
var itemsWidths = useRef([]).current;
|
|
32
|
+
// Storing a couple of width + items count in order to stabilize
|
|
33
|
+
var hashRef = useRef([]);
|
|
34
|
+
|
|
35
|
+
// AFP-2511 TODO: Fix automatic suppressions below
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
var throttleSetWidth = useCallback(throttle(setWidth, THROTTLE_INTERVAL), [setWidth]);
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
var lastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
40
|
+
var wasJustLimited = lastItemWidth < 0;
|
|
41
|
+
var currentHash = calculateHash(width, itemsLimit);
|
|
42
|
+
if (hashRef.current[0] === currentHash) {
|
|
43
|
+
// After removing an item, if width has not changed yet we schedule a force update
|
|
44
|
+
// to handle case where removing an item does not actually trigger width change
|
|
45
|
+
var t = setTimeout(function () {
|
|
46
|
+
updateHashRef(hashRef.current, '');
|
|
47
|
+
triggerForceEffect({});
|
|
48
|
+
}, THROTTLE_INTERVAL * 1.5);
|
|
49
|
+
return function () {
|
|
50
|
+
return clearTimeout(t);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (wasJustLimited) {
|
|
54
|
+
// Width was updated either via resize or after changing the limit
|
|
55
|
+
// we cap the width between ITEM_APPROX_MINWIDTH and 2*ITEM_APPROX_MINWIDTH
|
|
56
|
+
// because width is throttled as when fast expanding/resizing partialWidth
|
|
57
|
+
// will not be reliable (edge case)
|
|
58
|
+
var partialWidth = Math.max(Math.min(width + lastItemWidth, ITEM_APPROX_MINWIDTH * 2), ITEM_APPROX_MINWIDTH);
|
|
59
|
+
itemsWidths[itemsLimit] = partialWidth;
|
|
60
|
+
}
|
|
61
|
+
if (width < ITEM_APPROX_MINWIDTH * 0.9 && itemsLimit) {
|
|
62
|
+
// If current width is less than an item approx width we remove an item
|
|
63
|
+
// marking the width as negative so we will calculate it on width update
|
|
64
|
+
// plus we set the hash to stabilise and not removing more than one element
|
|
65
|
+
// until we are sure width was updated
|
|
66
|
+
var nextHash = calculateHash(width, itemsLimit - 1);
|
|
67
|
+
if (hashRef.current.indexOf(nextHash) === -1) {
|
|
68
|
+
setItemsLimit(itemsLimit - 1);
|
|
69
|
+
itemsWidths[itemsLimit - 1] = -(width || 1);
|
|
70
|
+
updateHashRef(hashRef.current, nextHash);
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* This is not necessarily equal to `lastItemWidth` because the
|
|
77
|
+
* ```js
|
|
78
|
+
* if (wasJustLimited) {}
|
|
79
|
+
* ```
|
|
80
|
+
* branch above modifies `itemsWidths`.
|
|
81
|
+
*
|
|
82
|
+
* Using `lastItemWidth` here can cause collapsing behavior to fail,
|
|
83
|
+
* such as the issue reported in DSP-7329.
|
|
84
|
+
*/
|
|
85
|
+
var currentLastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
86
|
+
if (width - currentLastItemWidth > ITEM_APPROX_MINWIDTH * 1.1 && itemsLimit < items.length) {
|
|
87
|
+
// If we have enough room to accomodate next item width we increase the limit
|
|
88
|
+
// unless it has been recently removed
|
|
89
|
+
var _nextHash = calculateHash(width, itemsLimit + 1);
|
|
90
|
+
if (hashRef.current.indexOf(_nextHash) === -1) {
|
|
91
|
+
setItemsLimit(itemsLimit + 1);
|
|
92
|
+
updateHashRef(hashRef.current, _nextHash);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}, [width, hashRef, itemsLimit, itemsWidths, forceEffectValue, items.length]);
|
|
98
|
+
return {
|
|
99
|
+
visibleItems: items.slice(0, itemsLimit),
|
|
100
|
+
overflowItems: items.slice(itemsLimit),
|
|
101
|
+
updateWidth: throttleSetWidth
|
|
102
|
+
};
|
|
103
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { OverflowContext } from './overflow-context';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* __useOverFlowStatus__
|
|
6
|
+
*
|
|
7
|
+
* Returns the current context value for the nearest OverflowProvider.
|
|
8
|
+
*
|
|
9
|
+
* - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
|
|
10
|
+
*
|
|
11
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
12
|
+
*/
|
|
13
|
+
export var useOverflowStatus = function useOverflowStatus() {
|
|
14
|
+
return useContext(OverflowContext);
|
|
15
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { AppSwitcher
|
|
1
|
+
export { AppSwitcher } from '../components/AppSwitcher/app-switcher';
|
|
2
|
+
export { AppSwitcherNav4 } from '../components/AppSwitcher/app-switcher-nav4';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useOverflowStatus } from '../controllers/overflow/
|
|
1
|
+
export { useOverflowStatus } from '../controllers/overflow/use-overflow-status';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Profile } from '../components/Profile/
|
|
1
|
+
export { Profile } from '../components/Profile/profile';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Nav4SkeletonHelpButton
|
|
1
|
+
export { Nav4SkeletonHelpButton } from '../nav4-skeleton-help-button';
|
|
2
|
+
export { SkeletonHelpButton } from '../skeleton-help-button';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AtlassianNavigation } from './components/AtlassianNavigation';
|
|
2
|
-
export { AppSwitcher
|
|
2
|
+
export { AppSwitcher } from './components/AppSwitcher/app-switcher';
|
|
3
|
+
export { AppSwitcherNav4 } from './components/AppSwitcher/app-switcher-nav4';
|
|
3
4
|
export { Create } from './components/Create';
|
|
4
5
|
export { Help } from './components/Help';
|
|
5
6
|
export { Notifications } from './components/Notifications';
|
|
@@ -7,10 +8,10 @@ export { PrimaryButton } from './components/PrimaryButton';
|
|
|
7
8
|
export { PrimaryDropdownButton } from './components/PrimaryDropdownButton';
|
|
8
9
|
export { IconButton } from './components/IconButton';
|
|
9
10
|
export { CustomProductHome, ProductHome, AppHome } from './components/ProductHome';
|
|
10
|
-
export { Profile } from './components/Profile';
|
|
11
|
+
export { Profile } from './components/Profile/profile';
|
|
11
12
|
export { Search } from './components/Search';
|
|
12
13
|
export { Settings } from './components/Settings';
|
|
13
14
|
export { SignIn } from './components/SignIn';
|
|
14
|
-
export { useOverflowStatus } from './controllers/overflow';
|
|
15
|
+
export { useOverflowStatus } from './controllers/overflow/use-overflow-status';
|
|
15
16
|
export { HORIZONTAL_GLOBAL_NAV_HEIGHT } from './common/constants';
|
|
16
17
|
export { atlassianTheme, generateTheme, ThemeProvider } from './theme';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* nav4-skeleton-help-button.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import "./nav4-skeleton-help-button.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import QuestionCircleIcon from '@atlaskit/icon/core/question-circle';
|
|
6
|
+
import { Flex } from '@atlaskit/primitives/compiled';
|
|
7
|
+
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
8
|
+
var iconSpacingStyles = {
|
|
9
|
+
space050: "_1rjc1b66 _18zr1b66"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Nav 4 skeleton help button__
|
|
14
|
+
*
|
|
15
|
+
* A nav 4 skeleton help button {description}.
|
|
16
|
+
*/
|
|
17
|
+
export var Nav4SkeletonHelpButton = function Nav4SkeletonHelpButton(_ref) {
|
|
18
|
+
var _ref$label = _ref.label,
|
|
19
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
20
|
+
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(Flex, {
|
|
21
|
+
xcss: iconSpacingStyles.space050
|
|
22
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleIcon, {
|
|
23
|
+
label: label,
|
|
24
|
+
color: "var(--ds-icon, #292A2E)"
|
|
25
|
+
})));
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import NotificationIcon from '@atlaskit/icon/core/notification';
|
|
3
|
+
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
4
|
+
/**
|
|
5
|
+
* __Nav 4 skeleton notification button__
|
|
6
|
+
*
|
|
7
|
+
* A nav 4 skeleton notification button.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export var Nav4SkeletonNotificationButton = function Nav4SkeletonNotificationButton(_ref) {
|
|
11
|
+
var _ref$label = _ref.label,
|
|
12
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
13
|
+
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(NotificationIcon, {
|
|
14
|
+
label: label,
|
|
15
|
+
color: "var(--ds-icon, #292A2E)"
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SettingsIcon from '@atlaskit/icon/core/settings';
|
|
3
|
+
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
4
|
+
/**
|
|
5
|
+
* __Nav 4 skeleton settings button__
|
|
6
|
+
*
|
|
7
|
+
* A nav 4 skeleton settings button
|
|
8
|
+
*/
|
|
9
|
+
export var Nav4SkeletonSettingsButton = function Nav4SkeletonSettingsButton(_ref) {
|
|
10
|
+
var _ref$label = _ref.label,
|
|
11
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
12
|
+
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
13
|
+
label: label,
|
|
14
|
+
color: "var(--ds-icon, #292A2E)"
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AppSwitcherIcon from '@atlaskit/icon/core/app-switcher';
|
|
3
|
+
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
4
|
+
/**
|
|
5
|
+
* __Nav 4 skeleton switcher button__
|
|
6
|
+
*
|
|
7
|
+
* A nav 4 skeleton switcher button
|
|
8
|
+
*/
|
|
9
|
+
export var Nav4SkeletonSwitcherButton = function Nav4SkeletonSwitcherButton(_ref) {
|
|
10
|
+
var _ref$label = _ref.label,
|
|
11
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
12
|
+
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(AppSwitcherIcon, {
|
|
13
|
+
label: label,
|
|
14
|
+
spacing: "spacious",
|
|
15
|
+
color: "var(--ds-icon, #292A2E)"
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/* skeleton-help-button.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
-
import "./skeleton-help-button.compiled.css";
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
4
1
|
import React from 'react';
|
|
5
2
|
import QuestionCircleIcon from '@atlaskit/icon/core/question-circle';
|
|
6
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
7
3
|
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
8
|
-
var iconSpacingStyles = {
|
|
9
|
-
space050: "_1rjc1b66 _18zr1b66"
|
|
10
|
-
};
|
|
11
4
|
/**
|
|
12
5
|
* __Skeleton notification button__
|
|
13
6
|
*
|
|
@@ -25,20 +18,4 @@ export var SkeletonHelpButton = function SkeletonHelpButton(_ref) {
|
|
|
25
18
|
label: label,
|
|
26
19
|
color: "currentColor"
|
|
27
20
|
}));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* __Nav 4 skeleton help button__
|
|
32
|
-
*
|
|
33
|
-
* A nav 4 skeleton help button {description}.
|
|
34
|
-
*/
|
|
35
|
-
export var Nav4SkeletonHelpButton = function Nav4SkeletonHelpButton(_ref2) {
|
|
36
|
-
var _ref2$label = _ref2.label,
|
|
37
|
-
label = _ref2$label === void 0 ? '' : _ref2$label;
|
|
38
|
-
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(Flex, {
|
|
39
|
-
xcss: iconSpacingStyles.space050
|
|
40
|
-
}, /*#__PURE__*/React.createElement(QuestionCircleIcon, {
|
|
41
|
-
label: label,
|
|
42
|
-
color: "var(--ds-icon, #292A2E)"
|
|
43
|
-
})));
|
|
44
21
|
};
|
|
@@ -28,18 +28,4 @@ export var SkeletonNotificationButton = function SkeletonNotificationButton(_ref
|
|
|
28
28
|
label: label
|
|
29
29
|
})));
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* __Nav 4 skeleton notification button__
|
|
34
|
-
*
|
|
35
|
-
* A nav 4 skeleton notification button.
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export var Nav4SkeletonNotificationButton = function Nav4SkeletonNotificationButton(_ref2) {
|
|
39
|
-
var _ref2$label = _ref2.label,
|
|
40
|
-
label = _ref2$label === void 0 ? '' : _ref2$label;
|
|
41
|
-
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(NotificationIcon, {
|
|
42
|
-
label: label,
|
|
43
|
-
color: "var(--ds-icon, #292A2E)"
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
31
|
+
export { Nav4SkeletonNotificationButton } from './nav4-skeleton-notification-button';
|
|
@@ -28,17 +28,4 @@ export var SkeletonSettingsButton = function SkeletonSettingsButton(_ref) {
|
|
|
28
28
|
label: label
|
|
29
29
|
})));
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* __Nav 4 skeleton settings button__
|
|
34
|
-
*
|
|
35
|
-
* A nav 4 skeleton settings button
|
|
36
|
-
*/
|
|
37
|
-
export var Nav4SkeletonSettingsButton = function Nav4SkeletonSettingsButton(_ref2) {
|
|
38
|
-
var _ref2$label = _ref2.label,
|
|
39
|
-
label = _ref2$label === void 0 ? '' : _ref2$label;
|
|
40
|
-
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
41
|
-
label: label,
|
|
42
|
-
color: "var(--ds-icon, #292A2E)"
|
|
43
|
-
}));
|
|
44
|
-
};
|
|
31
|
+
export { Nav4SkeletonSettingsButton } from './nav4-skeleton-settings-button';
|
|
@@ -7,8 +7,12 @@ import React from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import AppSwitcherIcon from '@atlaskit/icon/core/app-switcher';
|
|
10
|
-
import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
11
10
|
import { useTheme } from './theme';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
14
|
+
*/
|
|
15
|
+
|
|
12
16
|
var skeletonSwitcherButtonStyles = css({
|
|
13
17
|
margin: 0,
|
|
14
18
|
// eslint-disable-next-line @atlaskit/design-system/no-physical-properties
|
|
@@ -51,6 +55,8 @@ var skeletonSwitcherButtonStyles = css({
|
|
|
51
55
|
*
|
|
52
56
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
|
|
53
57
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
58
|
+
*
|
|
59
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
54
60
|
*/
|
|
55
61
|
export var SkeletonSwitcherButton = function SkeletonSwitcherButton(_ref) {
|
|
56
62
|
var _ref$label = _ref.label,
|
|
@@ -69,18 +75,4 @@ export var SkeletonSwitcherButton = function SkeletonSwitcherButton(_ref) {
|
|
|
69
75
|
label: label
|
|
70
76
|
}));
|
|
71
77
|
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* __Nav 4 skeleton switcher button__
|
|
75
|
-
*
|
|
76
|
-
* A nav 4 skeleton switcher button
|
|
77
|
-
*/
|
|
78
|
-
export var Nav4SkeletonSwitcherButton = function Nav4SkeletonSwitcherButton(_ref2) {
|
|
79
|
-
var _ref2$label = _ref2.label,
|
|
80
|
-
label = _ref2$label === void 0 ? '' : _ref2$label;
|
|
81
|
-
return jsx(SkeletonIconButton, null, jsx(AppSwitcherIcon, {
|
|
82
|
-
label: label,
|
|
83
|
-
spacing: "spacious",
|
|
84
|
-
color: "var(--ds-icon, #292A2E)"
|
|
85
|
-
}));
|
|
86
|
-
};
|
|
78
|
+
export { Nav4SkeletonSwitcherButton } from './nav4-skeleton-switcher-button';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DEFAULT_THEME_NAME } from './default-theme';
|
|
2
|
+
import { generateTheme } from './theme-generator';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
5
|
+
*/
|
|
6
|
+
export var atlassianTheme = generateTheme({
|
|
7
|
+
name: DEFAULT_THEME_NAME,
|
|
8
|
+
backgroundColor: '#FFFFFF',
|
|
9
|
+
highlightColor: '#0052CC'
|
|
10
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
var hex = '[a-z0-9]';
|
|
3
|
+
var shortHandHexColorPattern = new RegExp("#(".concat(hex, ")(").concat(hex, ")(").concat(hex, ")"), 'i');
|
|
4
|
+
var repeat = function repeat(str, times) {
|
|
5
|
+
return _toConsumableArray(Array(times)).map(function () {
|
|
6
|
+
return str;
|
|
7
|
+
}).join('');
|
|
8
|
+
};
|
|
9
|
+
var isShortHexColor = function isShortHexColor(color) {
|
|
10
|
+
return color && color.length === 4;
|
|
11
|
+
};
|
|
12
|
+
var completeHexColor = function completeHexColor(colors) {
|
|
13
|
+
var hex = colors.map(function (color) {
|
|
14
|
+
return repeat(color, 2);
|
|
15
|
+
}).join('');
|
|
16
|
+
return "#".concat(hex);
|
|
17
|
+
};
|
|
18
|
+
var completeTriplet = function completeTriplet(colors) {
|
|
19
|
+
return "#".concat(repeat(colors[1], 6));
|
|
20
|
+
};
|
|
21
|
+
var isTriplet = function isTriplet(colors) {
|
|
22
|
+
return colors[0] === colors[1] && colors[1] === colors[2];
|
|
23
|
+
};
|
|
24
|
+
export var convertHexShorthand = function convertHexShorthand(color) {
|
|
25
|
+
if (isShortHexColor(color)) {
|
|
26
|
+
// when color = '#ccc', matches is structured as ['#ccc', 'c', 'c', 'c', ...]
|
|
27
|
+
var matches = color.match(shortHandHexColorPattern);
|
|
28
|
+
if (matches) {
|
|
29
|
+
var colors = matches.slice(1, 4);
|
|
30
|
+
if (isTriplet(colors)) {
|
|
31
|
+
return completeTriplet(colors);
|
|
32
|
+
} else {
|
|
33
|
+
return completeHexColor(colors);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// return the color as is when it's not hex color shorthand
|
|
39
|
+
return color;
|
|
40
|
+
};
|
|
@@ -131,6 +131,5 @@ var defaultThemeCopy = JSON.parse(JSON.stringify(defaultTheme));
|
|
|
131
131
|
// Update iconColor and textColor in defaultThemeBrandRefresh
|
|
132
132
|
defaultThemeCopy.mode.productHome.iconColor = undefined;
|
|
133
133
|
defaultThemeCopy.mode.productHome.textColor = undefined;
|
|
134
|
-
export var defaultThemeBrandRefresh = defaultThemeCopy;
|
|
135
134
|
export var DEFAULT_THEME_NAME = 'atlassian';
|
|
136
135
|
export default defaultTheme;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import chromatism from 'chromatism';
|
|
2
|
+
import { convertHexShorthand } from './convert-hex-shorthand';
|
|
3
|
+
export var generateTextColor = function generateTextColor(color) {
|
|
4
|
+
var converted = convertHexShorthand(color);
|
|
5
|
+
return chromatism.contrastRatio(converted).hex;
|
|
6
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import chromatism from 'chromatism';
|
|
5
|
+
export var hexToRGBA = function hexToRGBA(hex) {
|
|
6
|
+
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
7
|
+
var rgba = _objectSpread(_objectSpread({}, chromatism.convert(hex).rgb), {}, {
|
|
8
|
+
a: opacity
|
|
9
|
+
});
|
|
10
|
+
return "rgba(".concat(Object.values(rgba).join(', '), ")");
|
|
11
|
+
};
|
package/dist/esm/theme/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export { generateTheme } from './theme-generator';
|
|
|
2
2
|
export { ThemeProvider } from './theme-provider';
|
|
3
3
|
export { atlassianTheme, defaultTheme } from './themes';
|
|
4
4
|
export { useTheme } from './use-theme';
|
|
5
|
-
export { hexToRGBA } from './
|
|
5
|
+
export { hexToRGBA } from './hex-to-rgba';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { DEFAULT_THEME_NAME
|
|
5
|
-
import {
|
|
4
|
+
import { DEFAULT_THEME_NAME } from './default-theme';
|
|
5
|
+
import { defaultThemeBrandRefresh } from './default-theme-brand-refresh';
|
|
6
|
+
import { generateTextColor } from './generate-text-color';
|
|
7
|
+
import { getBoxShadow } from './get-box-shadow';
|
|
8
|
+
import { getContrastColor } from './get-contrast-color';
|
|
9
|
+
import { hexToRGBA } from './hex-to-rgba';
|
|
6
10
|
var generateOpacityValue = function generateOpacityValue(color) {
|
|
7
11
|
return color === '#000000' ? 0.3 : 0.6;
|
|
8
12
|
};
|
|
@@ -59,6 +63,12 @@ var generateCreateButtonColors = function generateCreateButtonColors(_themeBackg
|
|
|
59
63
|
highlightColor: themeHighlight
|
|
60
64
|
};
|
|
61
65
|
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* __generateTheme__
|
|
69
|
+
*
|
|
70
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
71
|
+
*/
|
|
62
72
|
export var generateTheme = function generateTheme(themeColors) {
|
|
63
73
|
var backgroundColor = themeColors.backgroundColor,
|
|
64
74
|
highlightColor = themeColors.highlightColor,
|
|
@@ -5,14 +5,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import chromatism from 'chromatism';
|
|
6
6
|
export var hexToRGBA = function hexToRGBA(hex) {
|
|
7
7
|
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
8
|
-
var rgba = _objectSpread(_objectSpread({}, chromatism.convert(hex).rgb), {
|
|
8
|
+
var rgba = _objectSpread(_objectSpread({}, chromatism.convert(hex).rgb), {}, {
|
|
9
9
|
a: opacity
|
|
10
10
|
});
|
|
11
11
|
return "rgba(".concat(Object.values(rgba).join(', '), ")");
|
|
12
12
|
};
|
|
13
|
-
export var getBoxShadow = function getBoxShadow(color) {
|
|
14
|
-
return "0 0 0 2px ".concat(color);
|
|
15
|
-
};
|
|
16
13
|
var hex = '[a-z0-9]';
|
|
17
14
|
var shortHandHexColorPattern = new RegExp("#(".concat(hex, ")(").concat(hex, ")(").concat(hex, ")"), 'i');
|
|
18
15
|
var repeat = function repeat(str, times) {
|
|
@@ -58,4 +55,5 @@ export var generateTextColor = function generateTextColor(color) {
|
|
|
58
55
|
};
|
|
59
56
|
export var getContrastColor = function getContrastColor(contrastValue, opacityValue, color) {
|
|
60
57
|
return hexToRGBA(chromatism.contrast(contrastValue, color).hex, opacityValue);
|
|
61
|
-
};
|
|
58
|
+
};
|
|
59
|
+
export { getBoxShadow } from './get-box-shadow';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultTheme } from './themes';
|
|
3
|
-
// Internal only
|
|
4
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
5
|
-
export var ThemeContext = /*#__PURE__*/createContext(defaultTheme);
|
|
6
|
-
|
|
1
|
+
import { ThemeContext } from './theme-context';
|
|
7
2
|
/**
|
|
8
3
|
* __Theme provider__
|
|
9
4
|
*
|
|
10
5
|
* A provider for the theme context used by all navigation components.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
11
8
|
*/
|
|
12
|
-
export var ThemeProvider = ThemeContext.Provider;
|
|
9
|
+
export var ThemeProvider = ThemeContext.Provider;
|
|
10
|
+
export { ThemeContext } from './theme-context';
|
package/dist/esm/theme/themes.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
export var defaultTheme = atlassianTheme;
|
|
1
|
+
import { atlassianTheme } from './atlassian-theme';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
4
|
+
*/
|
|
5
|
+
export var defaultTheme = atlassianTheme;
|
|
6
|
+
export { atlassianTheme } from './atlassian-theme';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
3
|
+
*/
|
|
1
4
|
export declare const HORIZONTAL_GLOBAL_NAV_HEIGHT = 56;
|
|
2
5
|
export declare const PRODUCT_HOME_BREAKPOINT = 1280;
|
|
3
6
|
export declare const CREATE_BREAKPOINT = 1130;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
display: string;
|
|
4
|
-
};
|
|
5
|
-
};
|
|
6
|
-
export declare const actionSectionMobileCSS: {
|
|
7
|
-
'@media (min-width: 1130px)': {
|
|
8
|
-
display: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
export { actionSectionDesktopCSS } from './action-section-desktop-css';
|
|
2
|
+
export { actionSectionMobileCSS } from './action-section-mobile-css';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AppSwitcherProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AppSwitcherNav4: React.ForwardRefExoticComponent<React.PropsWithoutRef<AppSwitcherProps> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AppSwitcherProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* _App switcher__
|
|
5
|
+
*
|
|
6
|
+
* An AppSwitcher button that can be passed into `AtlassianNavigation`'s
|
|
7
|
+
* `renderAppSwitcher` prop.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-switcher)
|
|
10
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
11
|
+
*
|
|
12
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AppSwitcher: React.ForwardRefExoticComponent<React.PropsWithoutRef<AppSwitcherProps> & React.RefAttributes<any>>;
|