@atlaskit/smart-card 46.10.2 → 46.10.4
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 +29 -0
- package/analytics.spec.yaml +2 -39
- package/compass.yml +3 -0
- package/dist/cjs/messages.js +15 -45
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/get-icon-for-file-type.js +14 -0
- package/dist/cjs/utils/lazy-component.js +81 -0
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +14 -2
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +1 -9
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +14 -5
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +4 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -9
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +31 -1
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +13 -2
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +23 -4
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/messages.js +15 -57
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/get-icon-for-file-type.js +14 -0
- package/dist/es2019/utils/lazy-component.js +65 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +10 -2
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +1 -9
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.js +12 -5
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -10
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +21 -1
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +13 -2
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +23 -4
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/messages.js +15 -45
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/get-icon-for-file-type.js +14 -0
- package/dist/esm/utils/lazy-component.js +73 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +12 -2
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +1 -9
- package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.js +14 -5
- package/dist/esm/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +4 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -9
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +27 -1
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +13 -2
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +23 -4
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +1 -17
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/utils/lazy-component.d.ts +36 -0
- package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/actions/action/action-dropdown-item/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/action/action-dropdown-item/types.d.ts +1 -0
- package/package.json +9 -9
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-dropbox-in-atlas-slide1--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide1--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide2--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide3--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide1--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide2--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide3--default.png +0 -3
- package/dist/cjs/view/EmbedCard/components/carousel/CarouselSlide.compiled.css +0 -64
- package/dist/cjs/view/EmbedCard/components/carousel/CarouselSlide.js +0 -158
- package/dist/cjs/view/EmbedCard/components/carousel/index.compiled.css +0 -12
- package/dist/cjs/view/EmbedCard/components/carousel/index.js +0 -127
- package/dist/cjs/view/EmbedCard/components/carousel/types.js +0 -5
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/UnauthorizedCarouselView.js +0 -207
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.compiled.css +0 -7
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.js +0 -31
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoChatBenefitImage.js +0 -16
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoSearchBenefitImage.js +0 -16
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.compiled.css +0 -6
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.js +0 -22
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/ProductIcon.js +0 -47
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/RovoChatBenefitImage.js +0 -359
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/RovoSearchBenefitImage.js +0 -281
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/SmartLinkBenefitImage.js +0 -364
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/carousel-images/assets/rovo-chat-avatar.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-dropbox-in-atlas-slide1--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide1--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide2--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide3--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide1--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide2--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide3--default.png +0 -3
- package/dist/es2019/view/EmbedCard/components/carousel/CarouselSlide.compiled.css +0 -64
- package/dist/es2019/view/EmbedCard/components/carousel/CarouselSlide.js +0 -145
- package/dist/es2019/view/EmbedCard/components/carousel/index.compiled.css +0 -12
- package/dist/es2019/view/EmbedCard/components/carousel/index.js +0 -105
- package/dist/es2019/view/EmbedCard/components/carousel/types.js +0 -1
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/UnauthorizedCarouselView.js +0 -200
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.compiled.css +0 -7
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.js +0 -25
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoChatBenefitImage.js +0 -3
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoSearchBenefitImage.js +0 -3
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.compiled.css +0 -6
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.js +0 -13
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/ProductIcon.js +0 -40
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/RovoChatBenefitImage.js +0 -353
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/RovoSearchBenefitImage.js +0 -269
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/SmartLinkBenefitImage.js +0 -358
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/carousel-images/assets/rovo-chat-avatar.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-dropbox-in-atlas-slide1--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide1--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide2--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-figma-in-trello-slide3--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide1--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide2--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-unauthorized-carousel-google-in-confluence-slide3--default.png +0 -3
- package/dist/esm/view/EmbedCard/components/carousel/CarouselSlide.compiled.css +0 -64
- package/dist/esm/view/EmbedCard/components/carousel/CarouselSlide.js +0 -149
- package/dist/esm/view/EmbedCard/components/carousel/index.compiled.css +0 -12
- package/dist/esm/view/EmbedCard/components/carousel/index.js +0 -118
- package/dist/esm/view/EmbedCard/components/carousel/types.js +0 -1
- package/dist/esm/view/EmbedCard/views/unauthorized-view/UnauthorizedCarouselView.js +0 -198
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.compiled.css +0 -7
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.js +0 -24
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoChatBenefitImage.js +0 -5
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoSearchBenefitImage.js +0 -5
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.compiled.css +0 -6
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.js +0 -15
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/ProductIcon.js +0 -40
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/RovoChatBenefitImage.js +0 -352
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/RovoSearchBenefitImage.js +0 -274
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/SmartLinkBenefitImage.js +0 -357
- package/dist/esm/view/EmbedCard/views/unauthorized-view/carousel-images/assets/rovo-chat-avatar.png +0 -0
- package/dist/types/view/EmbedCard/components/carousel/CarouselSlide.d.ts +0 -39
- package/dist/types/view/EmbedCard/components/carousel/index.d.ts +0 -26
- package/dist/types/view/EmbedCard/components/carousel/types.d.ts +0 -32
- package/dist/types/view/EmbedCard/views/unauthorized-view/UnauthorizedCarouselView.d.ts +0 -4
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/IconSlot.d.ts +0 -14
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoChatBenefitImage.d.ts +0 -3
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/LazyRovoSearchBenefitImage.d.ts +0 -3
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/NoAuthAvailableImage.d.ts +0 -7
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/ProductIcon.d.ts +0 -9
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/RovoChatBenefitImage.d.ts +0 -8
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/RovoSearchBenefitImage.d.ts +0 -8
- package/dist/types/view/EmbedCard/views/unauthorized-view/carousel-images/SmartLinkBenefitImage.d.ts +0 -7
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/automation-modal-header/{smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-false.png → smart-card-automation-modal-header-title--default.png} +0 -0
- /package/dist/{cjs/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-true.png → es2019/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default.png} +0 -0
- /package/dist/{es2019/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default--platform-dst-modal-dialog-use-modal-title-false.png → esm/__tests__/vr-tests/__snapshots__/automation-modal-header/smart-card-automation-modal-header-title--default.png} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ComponentType, type LazyExoticComponent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `.catch` handler for a lazy loader: renders nothing if the chunk fails to load, instead of
|
|
4
|
+
* throwing to the nearest error boundary (matches `react-loadable` with `loading: () => null`).
|
|
5
|
+
*
|
|
6
|
+
* @example lazy(() => import('./Foo').catch(renderNothingOnLoadError))
|
|
7
|
+
*/
|
|
8
|
+
export declare const renderNothingOnLoadError: () => {
|
|
9
|
+
default: never;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a `React.lazy` component in its own `<Suspense fallback={null}>`, so it renders nothing
|
|
13
|
+
* while its chunk loads and never suspends (and blanks out) an ancestor such as the card itself.
|
|
14
|
+
*
|
|
15
|
+
* Call `lazy(() => import('...'))` inline at module scope and pass the result here, rather than
|
|
16
|
+
* passing a loader into a helper that calls `lazy()` for you. Product SSR tooling (e.g.
|
|
17
|
+
* Confluence's LoadableReactLazyBabelPlugin) only tracks and preloads `lazy()` calls whose loader
|
|
18
|
+
* reads no function parameters or other render-time values.
|
|
19
|
+
*/
|
|
20
|
+
export declare const withSuspense: <P extends object>(LazyComponent: ComponentType<P> | LazyExoticComponent<ComponentType<P>>, displayName?: string) => ComponentType<P>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a lazily loaded icon component for a dynamic icon import.
|
|
23
|
+
*
|
|
24
|
+
* Callers resolve the icon on every render, so the component is cached by `cacheKey` to keep a
|
|
25
|
+
* stable component identity across renders (otherwise React would remount and re-suspend the
|
|
26
|
+
* icon on every render). The cache entry is dropped if the chunk fails to load, so the next
|
|
27
|
+
* render retries the import.
|
|
28
|
+
*
|
|
29
|
+
* Prefer an inline module-scope `lazy(() => import('...'))` with `withSuspense` where the set of
|
|
30
|
+
* components is known up front, so product SSR tooling can preload the chunks. This helper is a
|
|
31
|
+
* deliberate exception for open-ended icon sets (any Atlaskit icon / file type) that cannot be
|
|
32
|
+
* enumerated statically: its loader reads render-time values, so SSR tooling cannot preload it.
|
|
33
|
+
*
|
|
34
|
+
* @param cacheKey Must uniquely identify the module `importFn` resolves to.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getLazyIconComponent: (cacheKey: string, importFn: () => Promise<any>) => ComponentType<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type UnauthorizedViewProps } from './types';
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
3
|
+
declare const UnauthorizedView: ({ context, extensionKey, isProductIntegrationSupported, onAuthorize, testId, ...unresolvedViewProps }: UnauthorizedViewProps) => React.JSX.Element;
|
|
4
|
+
export default UnauthorizedView;
|
package/dist/types/view/FlexibleCard/components/actions/action/action-dropdown-item/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ActionDropdownItemProps } from './types';
|
|
3
|
-
declare const ActionDropdownItem: ({ content, iconAfter, iconBefore, isLoading, onClick, testId, }: ActionDropdownItemProps) => React.JSX.Element;
|
|
3
|
+
declare const ActionDropdownItem: ({ ariaLabel, content, iconAfter, iconBefore, isLoading, onClick, testId, }: ActionDropdownItemProps) => React.JSX.Element;
|
|
4
4
|
export default ActionDropdownItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "46.10.
|
|
3
|
+
"version": "46.10.4",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/docs": "^12.3.0",
|
|
54
54
|
"@atlaskit/dropdown-menu": "^21.0.0",
|
|
55
55
|
"@atlaskit/embedded-confluence": "^6.4.0",
|
|
56
|
-
"@atlaskit/feature-gate-js-client": "^7.
|
|
56
|
+
"@atlaskit/feature-gate-js-client": "^7.1.0",
|
|
57
57
|
"@atlaskit/flag": "^19.0.0",
|
|
58
58
|
"@atlaskit/form": "^18.3.0",
|
|
59
59
|
"@atlaskit/frontend-utilities": "^5.1.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
70
70
|
"@atlaskit/link-test-helpers": "^11.2.0",
|
|
71
71
|
"@atlaskit/linking-common": "^13.0.0",
|
|
72
|
-
"@atlaskit/linking-types": "^16.
|
|
72
|
+
"@atlaskit/linking-types": "^16.1.0",
|
|
73
73
|
"@atlaskit/logo": "^23.3.0",
|
|
74
74
|
"@atlaskit/lozenge": "^17.0.0",
|
|
75
75
|
"@atlaskit/menu": "^11.0.0",
|
|
@@ -80,24 +80,24 @@
|
|
|
80
80
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
81
81
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
82
82
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
83
|
-
"@atlaskit/popup": "^10.
|
|
83
|
+
"@atlaskit/popup": "^10.1.0",
|
|
84
84
|
"@atlaskit/primitives": "^22.6.0",
|
|
85
85
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
86
86
|
"@atlaskit/react-ufo": "^8.3.0",
|
|
87
|
-
"@atlaskit/rovo-triggers": "^12.
|
|
87
|
+
"@atlaskit/rovo-triggers": "^12.11.0",
|
|
88
88
|
"@atlaskit/section-message": "^10.2.0",
|
|
89
89
|
"@atlaskit/select": "^23.1.0",
|
|
90
90
|
"@atlaskit/spinner": "^20.4.0",
|
|
91
91
|
"@atlaskit/tabs": "^21.3.0",
|
|
92
92
|
"@atlaskit/tag": "^17.0.0",
|
|
93
|
-
"@atlaskit/textarea": "^10.
|
|
94
|
-
"@atlaskit/textfield": "^10.
|
|
93
|
+
"@atlaskit/textarea": "^10.3.0",
|
|
94
|
+
"@atlaskit/textfield": "^10.3.0",
|
|
95
95
|
"@atlaskit/theme": "^28.2.0",
|
|
96
96
|
"@atlaskit/tile": "^5.0.0",
|
|
97
|
-
"@atlaskit/tmp-editor-statsig": "^248.
|
|
97
|
+
"@atlaskit/tmp-editor-statsig": "^248.1.0",
|
|
98
98
|
"@atlaskit/tokens": "^20.8.0",
|
|
99
99
|
"@atlaskit/tooltip": "^24.4.0",
|
|
100
|
-
"@atlaskit/top-layer": "^
|
|
100
|
+
"@atlaskit/top-layer": "^7.0.0",
|
|
101
101
|
"@atlaskit/ufo": "^2.0.0",
|
|
102
102
|
"@atlaskit/width-detector": "^7.2.0",
|
|
103
103
|
"@babel/runtime": "^7.0.0",
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
2
|
-
._2rko1rr0{border-radius:var(--ds-radius-full,9999px)}
|
|
3
|
-
._zulp1ejb{gap:var(--ds-space-300,24px)}
|
|
4
|
-
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
5
|
-
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
6
|
-
._zulpze3t{gap:var(--ds-space-0,0)}._154iidpf{top:0}
|
|
7
|
-
._16jlkb7n{flex-grow:1}
|
|
8
|
-
._18m915vq{overflow-y:hidden}
|
|
9
|
-
._18m91wug{overflow-y:auto}
|
|
10
|
-
._19bv1jfw{padding-left:var(--ds-space-500,40px)}
|
|
11
|
-
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
12
|
-
._19bvze3t{padding-left:var(--ds-space-0,0)}
|
|
13
|
-
._1bah1h6o{justify-content:center}
|
|
14
|
-
._1bah1y6m{justify-content:flex-start}
|
|
15
|
-
._1bah1yb4{justify-content:space-between}
|
|
16
|
-
._1bsb1osq{width:100%}
|
|
17
|
-
._1bsb1tcg{width:24px}
|
|
18
|
-
._1bsb7vkz{width:1pc}
|
|
19
|
-
._1bsbftgi{width:8px}
|
|
20
|
-
._1e0c1txw{display:flex}
|
|
21
|
-
._1e0c1ule{display:block}
|
|
22
|
-
._1ltvidpf{left:0}
|
|
23
|
-
._1n261g80{flex-wrap:wrap}
|
|
24
|
-
._1n261q9c{flex-wrap:nowrap}
|
|
25
|
-
._1o9zidpf{flex-shrink:0}
|
|
26
|
-
._1o9zkb7n{flex-shrink:1}
|
|
27
|
-
._1oecfnf5{transition-duration:.2s}
|
|
28
|
-
._1reo15vq{overflow-x:hidden}
|
|
29
|
-
._1reo1wug{overflow-x:auto}
|
|
30
|
-
._1tkeidpf{min-height:0}
|
|
31
|
-
._1ul9idpf{min-width:0}
|
|
32
|
-
._2lx21bp4{flex-direction:column}
|
|
33
|
-
._2lx2vrvc{flex-direction:row}
|
|
34
|
-
._4cvr1fhb{align-items:stretch}
|
|
35
|
-
._4cvr1h6o{align-items:center}
|
|
36
|
-
._4cvr1y6m{align-items:flex-start}
|
|
37
|
-
._4t3i1osq{height:100%}
|
|
38
|
-
._4t3i1tcg{height:24px}
|
|
39
|
-
._4t3i7vkz{height:1pc}
|
|
40
|
-
._4t3iftgi{height:8px}
|
|
41
|
-
._5ral1f51{object-fit:contain}
|
|
42
|
-
._6fl45ucs{transition-timing-function:ease}
|
|
43
|
-
._bfhk9pm7{background-color:var(--ds-background-information-subtle,#8fb8f6)}
|
|
44
|
-
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
45
|
-
._bfhkjmqp{background-color:var(--ds-background-selected-bold,#1868db)}
|
|
46
|
-
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
47
|
-
._c71l1wdt{max-height:220px}
|
|
48
|
-
._ca0q1jfw{padding-top:var(--ds-space-500,40px)}
|
|
49
|
-
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
50
|
-
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
51
|
-
._i0dlghg7{flex-basis:240px}
|
|
52
|
-
._i0dluuw1{flex-basis:200px}
|
|
53
|
-
._k8m01k61{transition-property:background-color}
|
|
54
|
-
._kqswh2mm{position:relative}
|
|
55
|
-
._kqswstnw{position:absolute}
|
|
56
|
-
._lcxvglyw{pointer-events:none}
|
|
57
|
-
._n3td1jfw{padding-bottom:var(--ds-space-500,40px)}
|
|
58
|
-
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
59
|
-
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
60
|
-
._rsufaqso{object-position:center center}
|
|
61
|
-
._u5f31jfw{padding-right:var(--ds-space-500,40px)}
|
|
62
|
-
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
63
|
-
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
64
|
-
._vchhusvi{box-sizing:border-box}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/* CarouselSlide.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
require("./CarouselSlide.compiled.css");
|
|
11
|
-
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _reactIntl = require("react-intl");
|
|
14
|
-
var _button = _interopRequireDefault(require("@atlaskit/button/default/button"));
|
|
15
|
-
var _css = require("@atlaskit/css");
|
|
16
|
-
var _heading = _interopRequireDefault(require("@atlaskit/heading/heading"));
|
|
17
|
-
var _smartLink = _interopRequireDefault(require("@atlaskit/icon/core/smart-link"));
|
|
18
|
-
var _iconTile = _interopRequireDefault(require("@atlaskit/icon/icon-tile"));
|
|
19
|
-
var _image = _interopRequireDefault(require("@atlaskit/image"));
|
|
20
|
-
var _box = require("@atlaskit/primitives/compiled/box");
|
|
21
|
-
var _pressable = require("@atlaskit/primitives/compiled/pressable");
|
|
22
|
-
var _text = require("@atlaskit/primitives/compiled/text");
|
|
23
|
-
var _messages = require("../../../../messages");
|
|
24
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
|
-
var styles = {
|
|
26
|
-
columnImage: "_16jlkb7n _1o9zkb7n _i0dlghg7 _1reo15vq _18m915vq _1e0c1txw _4cvr1fhb _1bah1y6m _1tkeidpf _1ul9idpf _bfhk9pm7",
|
|
27
|
-
imageContainer: "_kqswh2mm _1bsb1osq _4t3i1osq",
|
|
28
|
-
imageAbsolute: "_kqswstnw _154iidpf _1ltvidpf _1bsb1osq",
|
|
29
|
-
columnContent: "_zulp1ejb _16jlkb7n _1o9zkb7n _i0dluuw1 _1reo1wug _18m91wug _1e0c1txw _2lx21bp4 _1tkeidpf _ca0q1jfw _u5f31jfw _n3td1jfw _19bv1jfw _4cvr1y6m _1bah1yb4",
|
|
30
|
-
columnContentTop: "_zulppxbi _1e0c1txw _2lx21bp4 _4cvr1y6m _1bsb1osq",
|
|
31
|
-
columnContentBody: "_zulp1ejb _1e0c1txw _2lx21bp4 _4cvr1y6m _1bsb1osq",
|
|
32
|
-
columnContentCompact: "_ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi",
|
|
33
|
-
dot: "_2rko1rr0 _1bsbftgi _4t3iftgi _bfhki8nm _1oecfnf5 _k8m01k61 _6fl45ucs _lcxvglyw",
|
|
34
|
-
dotActive: "_bfhkjmqp",
|
|
35
|
-
dotPassable: "_2rko1rr0 _1e0c1txw _4cvr1h6o _1bah1h6o _1bsb7vkz _4t3i7vkz _bfhksm61 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
|
|
36
|
-
icon: "_2rko12b0 _1reo15vq _18m915vq _1o9zidpf _1bsb1tcg _4t3i1tcg _1e0c1txw _4cvr1h6o _1bah1h6o",
|
|
37
|
-
iconImage: "_1bsb1osq _4t3i1osq _5ral1f51",
|
|
38
|
-
image: "_1bsb1osq _c71l1wdt _5ral1f51 _rsufaqso _1e0c1ule",
|
|
39
|
-
rowButton: "_zulpu2gc _1e0c1txw _2lx2vrvc _1n261g80 _4cvr1h6o",
|
|
40
|
-
rowButtonCompact: "_1bsb1osq",
|
|
41
|
-
rowDot: "_zulpze3t _1e0c1txw _2lx2vrvc _4cvr1h6o",
|
|
42
|
-
rowIcon: "_zulpu2gc _1e0c1txw _4cvr1h6o",
|
|
43
|
-
slide: "_1reo15vq _18m915vq _1e0c1txw _1n261q9c _1bsb1osq _4t3i1osq _4cvr1fhb _vchhusvi"
|
|
44
|
-
};
|
|
45
|
-
var CarouselSlide = function CarouselSlide(_ref) {
|
|
46
|
-
var icon = _ref.icon,
|
|
47
|
-
_ref$iconLabel = _ref.iconLabel,
|
|
48
|
-
iconLabel = _ref$iconLabel === void 0 ? '' : _ref$iconLabel,
|
|
49
|
-
title = _ref.title,
|
|
50
|
-
description = _ref.description,
|
|
51
|
-
image = _ref.image,
|
|
52
|
-
primaryButtonLabel = _ref.primaryButtonLabel,
|
|
53
|
-
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
54
|
-
onDotClick = _ref.onDotClick,
|
|
55
|
-
onNextClick = _ref.onNextClick,
|
|
56
|
-
slideIndex = _ref.slideIndex,
|
|
57
|
-
totalSlides = _ref.totalSlides,
|
|
58
|
-
size = _ref.size,
|
|
59
|
-
_ref$testId = _ref.testId,
|
|
60
|
-
testId = _ref$testId === void 0 ? 'embed-card-carousel-slide' : _ref$testId;
|
|
61
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
62
|
-
formatMessage = _useIntl.formatMessage;
|
|
63
|
-
var isCompact = size !== 'full';
|
|
64
|
-
var showPrimaryButton = typeof onPrimaryButtonClick === 'function';
|
|
65
|
-
var showNavigation = totalSlides > 1;
|
|
66
|
-
var renderedIcon = (0, _react.useMemo)(function () {
|
|
67
|
-
if (typeof icon === 'string') {
|
|
68
|
-
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
69
|
-
xcss: styles.icon
|
|
70
|
-
}, /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
71
|
-
src: icon,
|
|
72
|
-
alt: iconLabel,
|
|
73
|
-
className: (0, _runtime.ax)([styles.iconImage])
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
if (icon) {
|
|
77
|
-
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
78
|
-
xcss: styles.icon
|
|
79
|
-
}, icon);
|
|
80
|
-
}
|
|
81
|
-
return /*#__PURE__*/_react.default.createElement(_iconTile.default, {
|
|
82
|
-
appearance: "blue",
|
|
83
|
-
icon: _smartLink.default,
|
|
84
|
-
label: iconLabel,
|
|
85
|
-
size: "small",
|
|
86
|
-
testId: "embed-card-fallback-icon"
|
|
87
|
-
});
|
|
88
|
-
}, [icon, iconLabel]);
|
|
89
|
-
var renderedImage = image == null ? null : typeof image === 'string' ? /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
90
|
-
src: image,
|
|
91
|
-
alt: title,
|
|
92
|
-
className: (0, _runtime.ax)([styles.image])
|
|
93
|
-
}) : image;
|
|
94
|
-
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
95
|
-
xcss: styles.slide,
|
|
96
|
-
testId: testId
|
|
97
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
98
|
-
xcss: (0, _css.cx)(styles.columnContent, isCompact && styles.columnContentCompact)
|
|
99
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
100
|
-
xcss: styles.columnContentTop
|
|
101
|
-
}, showPrimaryButton && isCompact && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
102
|
-
xcss: (0, _css.cx)(styles.rowButton, styles.rowButtonCompact)
|
|
103
|
-
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
104
|
-
appearance: "primary",
|
|
105
|
-
onClick: onPrimaryButtonClick,
|
|
106
|
-
shouldFitContainer: true,
|
|
107
|
-
testId: "".concat(testId, "-connect-compact")
|
|
108
|
-
}, primaryButtonLabel)), renderedIcon && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
109
|
-
xcss: styles.rowIcon
|
|
110
|
-
}, renderedIcon), /*#__PURE__*/_react.default.createElement(_box.Box, null, /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
111
|
-
size: "medium",
|
|
112
|
-
testId: "".concat(testId, "-title")
|
|
113
|
-
}, title)), /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
114
|
-
xcss: styles.columnContentBody
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, null, /*#__PURE__*/_react.default.createElement(_text.Text, {
|
|
116
|
-
testId: "".concat(testId, "-description")
|
|
117
|
-
}, description)), (showPrimaryButton && !isCompact || showNavigation && onNextClick) && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
118
|
-
xcss: styles.rowButton
|
|
119
|
-
}, showPrimaryButton && !isCompact && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
120
|
-
appearance: "primary",
|
|
121
|
-
onClick: onPrimaryButtonClick,
|
|
122
|
-
testId: "".concat(testId, "-connect")
|
|
123
|
-
}, primaryButtonLabel), showNavigation && onNextClick && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
124
|
-
appearance: "subtle",
|
|
125
|
-
onClick: onNextClick,
|
|
126
|
-
testId: "".concat(testId, "-next")
|
|
127
|
-
}, formatMessage(_messages.messages.connect_link_account_embed_carousel_button_next))))), showNavigation && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
128
|
-
xcss: styles.rowDot,
|
|
129
|
-
role: "group",
|
|
130
|
-
"aria-label": formatMessage(_messages.messages.connect_link_account_embed_carousel_dot_row_label)
|
|
131
|
-
}, Array.from({
|
|
132
|
-
length: totalSlides
|
|
133
|
-
}, function (_, i) {
|
|
134
|
-
return /*#__PURE__*/_react.default.createElement(_pressable.Pressable, {
|
|
135
|
-
key: i,
|
|
136
|
-
xcss: styles.dotPassable,
|
|
137
|
-
onClick: function onClick() {
|
|
138
|
-
return onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(i);
|
|
139
|
-
},
|
|
140
|
-
"aria-label": formatMessage(_messages.messages.connect_link_account_embed_carousel_dot_label, {
|
|
141
|
-
index: i + 1,
|
|
142
|
-
total: totalSlides
|
|
143
|
-
}),
|
|
144
|
-
"aria-current": i === slideIndex ? 'true' : undefined,
|
|
145
|
-
testId: "".concat(testId, "-dot-").concat(i)
|
|
146
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
147
|
-
xcss: (0, _css.cx)(styles.dot, i === slideIndex && styles.dotActive)
|
|
148
|
-
}));
|
|
149
|
-
}))), !isCompact && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
150
|
-
xcss: styles.columnImage,
|
|
151
|
-
testId: "".concat(testId, "-image-panel-").concat(slideIndex)
|
|
152
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
153
|
-
xcss: styles.imageContainer
|
|
154
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
155
|
-
xcss: styles.imageAbsolute
|
|
156
|
-
}, renderedImage))));
|
|
157
|
-
};
|
|
158
|
-
var _default = exports.default = CarouselSlide;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
._18m915vq{overflow-y:hidden}
|
|
2
|
-
._1bsb1osq{width:100%}
|
|
3
|
-
._1e0c1txw{display:flex}
|
|
4
|
-
._1o511hrf{animation-fill-mode:both}
|
|
5
|
-
._1pglafbj{animation-timing-function:cubic-bezier(.25,.46,.45,.94)}
|
|
6
|
-
._1reo15vq{overflow-x:hidden}
|
|
7
|
-
._4t3i1osq{height:100%}
|
|
8
|
-
._5sagjx92{animation-duration:.28s}
|
|
9
|
-
._j7hq1wwu{animation-name:kgnpaw5}
|
|
10
|
-
._kqswh2mm{position:relative}
|
|
11
|
-
@keyframes kgnpaw5{0%{opacity:0}to{opacity:1}}
|
|
12
|
-
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._2hwzhgkh{animation-duration:.01ms}}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
require("./index.compiled.css");
|
|
11
|
-
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
-
var _box = require("@atlaskit/primitives/compiled/box");
|
|
15
|
-
var _CarouselSlide = _interopRequireDefault(require("./CarouselSlide"));
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
|
-
var styles = {
|
|
18
|
-
carousel: "_1reo15vq _18m915vq _1e0c1txw _1bsb1osq _4t3i1osq _kqswh2mm"
|
|
19
|
-
};
|
|
20
|
-
var fadeIn = null;
|
|
21
|
-
var slideWrapperMap = {
|
|
22
|
-
static: "_1bsb1osq _4t3i1osq",
|
|
23
|
-
animated: "_1bsb1osq _4t3i1osq _j7hq1wwu _5sagjx92 _1pglafbj _1o511hrf _bl8aglyw _2hwzhgkh"
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Derives layout size bucket from pixel dimensions.
|
|
27
|
-
* Used instead of CSS @container queries (which are blocked by the linter)
|
|
28
|
-
* to control which elements are shown at different card sizes.
|
|
29
|
-
*/
|
|
30
|
-
var getSize = function getSize(width, height) {
|
|
31
|
-
if (width < 200 || height < 100) {
|
|
32
|
-
return 'minimal';
|
|
33
|
-
}
|
|
34
|
-
if (width < 400 || height < 140) {
|
|
35
|
-
return 'compact';
|
|
36
|
-
}
|
|
37
|
-
return 'full';
|
|
38
|
-
};
|
|
39
|
-
var Carousel = function Carousel(_ref) {
|
|
40
|
-
var icon = _ref.icon,
|
|
41
|
-
iconLabel = _ref.iconLabel,
|
|
42
|
-
_ref$initialSlideInde = _ref.initialSlideIndex,
|
|
43
|
-
initialSlideIndex = _ref$initialSlideInde === void 0 ? 0 : _ref$initialSlideInde,
|
|
44
|
-
items = _ref.items,
|
|
45
|
-
onNextClick = _ref.onNextClick,
|
|
46
|
-
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
47
|
-
primaryButtonLabel = _ref.primaryButtonLabel,
|
|
48
|
-
_ref$testId = _ref.testId,
|
|
49
|
-
testId = _ref$testId === void 0 ? 'embed-card-teaser-carousel' : _ref$testId;
|
|
50
|
-
var _useState = (0, _react.useState)(initialSlideIndex),
|
|
51
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
|
-
activeIndex = _useState2[0],
|
|
53
|
-
setActiveIndex = _useState2[1];
|
|
54
|
-
var _useState3 = (0, _react.useState)('full'),
|
|
55
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
56
|
-
size = _useState4[0],
|
|
57
|
-
setSize = _useState4[1];
|
|
58
|
-
|
|
59
|
-
// Tracks whether the user has navigated at least once.
|
|
60
|
-
// The first slide is rendered statically (no animation) to avoid any
|
|
61
|
-
// CSS animation running during SSR or on the initial paint.
|
|
62
|
-
var hasNavigated = (0, _react.useRef)(false);
|
|
63
|
-
var containerRef = (0, _react.useRef)(null);
|
|
64
|
-
|
|
65
|
-
// Observe the carousel container's size and update the layout bucket.
|
|
66
|
-
(0, _react.useEffect)(function () {
|
|
67
|
-
var el = containerRef.current;
|
|
68
|
-
if (!el) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var observer = new ResizeObserver(function (_ref2) {
|
|
72
|
-
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
73
|
-
entry = _ref3[0];
|
|
74
|
-
var _entry$contentRect = entry.contentRect,
|
|
75
|
-
width = _entry$contentRect.width,
|
|
76
|
-
height = _entry$contentRect.height;
|
|
77
|
-
setSize(getSize(width, height));
|
|
78
|
-
});
|
|
79
|
-
observer.observe(el);
|
|
80
|
-
return function () {
|
|
81
|
-
return observer.disconnect();
|
|
82
|
-
};
|
|
83
|
-
}, []);
|
|
84
|
-
var goNext = (0, _react.useCallback)(function () {
|
|
85
|
-
hasNavigated.current = true;
|
|
86
|
-
onNextClick === null || onNextClick === void 0 || onNextClick(items[activeIndex].id);
|
|
87
|
-
setActiveIndex(function (current) {
|
|
88
|
-
return (current + 1) % items.length;
|
|
89
|
-
});
|
|
90
|
-
}, [items, activeIndex, onNextClick]);
|
|
91
|
-
var goTo = (0, _react.useCallback)(function (index) {
|
|
92
|
-
if (index === activeIndex) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
hasNavigated.current = true;
|
|
96
|
-
setActiveIndex(index);
|
|
97
|
-
}, [activeIndex]);
|
|
98
|
-
var handlePrimaryButtonClick = (0, _react.useCallback)(function () {
|
|
99
|
-
onPrimaryButtonClick === null || onPrimaryButtonClick === void 0 || onPrimaryButtonClick(items[activeIndex].id);
|
|
100
|
-
}, [onPrimaryButtonClick, items, activeIndex]);
|
|
101
|
-
var currentSlide = items[activeIndex];
|
|
102
|
-
var isLastSlide = activeIndex === items.length - 1;
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
104
|
-
ref: containerRef,
|
|
105
|
-
xcss: styles.carousel,
|
|
106
|
-
testId: testId
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
108
|
-
key: activeIndex,
|
|
109
|
-
xcss: slideWrapperMap[hasNavigated.current ? 'animated' : 'static'],
|
|
110
|
-
"aria-live": "polite"
|
|
111
|
-
}, /*#__PURE__*/_react.default.createElement(_CarouselSlide.default, {
|
|
112
|
-
primaryButtonLabel: primaryButtonLabel,
|
|
113
|
-
description: currentSlide.description,
|
|
114
|
-
icon: icon,
|
|
115
|
-
iconLabel: iconLabel,
|
|
116
|
-
image: currentSlide.image,
|
|
117
|
-
title: currentSlide.title,
|
|
118
|
-
onPrimaryButtonClick: onPrimaryButtonClick ? handlePrimaryButtonClick : undefined,
|
|
119
|
-
onDotClick: goTo,
|
|
120
|
-
onNextClick: !isLastSlide ? goNext : undefined,
|
|
121
|
-
size: size,
|
|
122
|
-
slideIndex: activeIndex,
|
|
123
|
-
testId: "".concat(testId, "-slide"),
|
|
124
|
-
totalSlides: items.length
|
|
125
|
-
})));
|
|
126
|
-
};
|
|
127
|
-
var _default = exports.default = Carousel;
|