@nascentdigital/funnel-ui 4.5.2 → 4.5.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/dist/Tailwind.d.ts +1 -1
- package/dist/Tailwind.js +70 -24
- package/dist/client/hooks/breakpoint/BreakpointContainer.d.ts +1 -1
- package/dist/client/hooks/breakpoint/BreakpointContainer.js +3 -1
- package/dist/client/interaction/Carousel.d.ts +1 -1
- package/dist/client/interaction/Carousel.js +28 -30
- package/dist/client/interaction/index.d.ts +0 -6
- package/dist/client/interaction/index.js +0 -6
- package/dist/server/Page.d.ts +15 -0
- package/dist/server/Page.js +70 -0
- package/dist/server/blocks/Block.d.ts +4 -2
- package/dist/server/blocks/Block.js +10 -3
- package/dist/server/blocks/Editorial.d.ts +2 -2
- package/dist/server/blocks/Editorial.js +4 -4
- package/dist/server/blocks/Form.d.ts +2 -2
- package/dist/server/blocks/Form.js +3 -3
- package/dist/server/blocks/Message.js +2 -1
- package/dist/server/blocks/Projects.d.ts +29 -37
- package/dist/server/blocks/Projects.js +13 -84
- package/dist/server/blocks/RelatedPages.d.ts +58 -0
- package/dist/server/blocks/RelatedPages.js +99 -0
- package/dist/server/blocks/Stats.d.ts +19 -31
- package/dist/server/blocks/Stats.js +13 -57
- package/dist/server/blocks/Testimonial.d.ts +2 -2
- package/dist/server/blocks/Testimonial.js +17 -14
- package/dist/server/blocks/Testimonials.d.ts +35 -35
- package/dist/server/blocks/Testimonials.js +21 -66
- package/dist/server/blocks/index.d.ts +2 -0
- package/dist/server/blocks/index.js +2 -0
- package/dist/server/entities/previews/MessagePreview.d.ts +2 -2
- package/dist/server/entities/previews/MessagePreview.js +1 -1
- package/dist/server/fields/CallToActions.d.ts +12 -0
- package/dist/server/fields/CallToActions.js +27 -0
- package/dist/server/fields/Caption.js +3 -2
- package/dist/server/fields/Description.js +1 -1
- package/dist/server/fields/FreeFormContent.js +1 -1
- package/dist/server/fields/Headline.js +1 -1
- package/dist/server/fields/Quote.js +1 -1
- package/dist/server/fields/RichText.js +1 -0
- package/dist/server/fields/index.d.ts +1 -0
- package/dist/server/fields/index.js +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/layouts/BentoLayout.d.ts +289 -0
- package/dist/server/layouts/BentoLayout.js +25 -0
- package/dist/server/layouts/index.d.ts +1 -0
- package/dist/server/layouts/index.js +1 -0
- package/dist/server/panels/BlockPanel.js +1 -3
- package/dist/server/panels/ListPanel.d.ts +4 -4
- package/dist/server/panels/ListPanel.js +13 -2
- package/dist/server/panels/MessagePanel.d.ts +2 -6
- package/dist/server/panels/MessagePanel.js +2 -12
- package/dist/server/panels/TestimonialPanel.d.ts +44 -18
- package/dist/server/panels/TestimonialPanel.js +44 -19
- package/dist/server/panels/VisualPanel.d.ts +1 -1
- package/dist/server/panels/VisualPanel.js +0 -2
- package/dist/server/schema/Anchor.d.ts +1 -1
- package/dist/server/schema/Anchor.js +2 -2
- package/dist/server/schema/BlockConfig.js +1 -1
- package/dist/server/schema/ListPanelLayout.d.ts +6 -0
- package/dist/server/schema/ListPanelLayout.js +3 -0
- package/dist/server/utils/ReactUtils.d.ts +6 -0
- package/dist/server/utils/ReactUtils.js +25 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/{client/interaction/modal → server/utils}/index.js +1 -2
- package/dist/styles/Page.css +5 -0
- package/dist/styles/Section.css +52 -0
- package/dist/styles/blocks/Block-spacing.css +31 -38
- package/dist/styles/blocks/Block-theming.css +2 -4
- package/dist/styles/blocks/MediaLayout.css +16 -0
- package/dist/styles/blocks/Projects.css +0 -9
- package/dist/styles/blocks/RelatedPages.css +13 -0
- package/dist/styles/blocks/Stats.css +1 -30
- package/dist/styles/components/Carousel.css +128 -0
- package/dist/styles/components/_index.css +2 -1
- package/dist/styles/entities/Person.css +4 -4
- package/dist/styles/entities/Project.css +8 -2
- package/dist/styles/entities/UniqueSellingPoint.css +3 -3
- package/dist/styles/fields/Caption.css +2 -2
- package/dist/styles/fields/Description.css +2 -2
- package/dist/styles/fields/Icon.css +1 -1
- package/dist/styles/fields/Link.css +1 -1
- package/dist/styles/fields/Quote.css +2 -2
- package/dist/styles/fields/Title.css +1 -1
- package/dist/styles/index.css +2 -0
- package/dist/styles/layouts/BentoLayout.css +41 -0
- package/dist/styles/layouts/_index.css +1 -0
- package/dist/styles/panels/TestimonialPanel.css +4 -0
- package/package.json +2 -3
- package/dist/client/interaction/Popup.d.ts +0 -36
- package/dist/client/interaction/Popup.js +0 -244
- package/dist/client/interaction/Tooltip.d.ts +0 -16
- package/dist/client/interaction/Tooltip.js +0 -122
- package/dist/client/interaction/UILevel.d.ts +0 -1
- package/dist/client/interaction/UILevel.js +0 -2
- package/dist/client/interaction/backdrop/BackdropContainer.d.ts +0 -5
- package/dist/client/interaction/backdrop/BackdropContainer.js +0 -114
- package/dist/client/interaction/backdrop/BackdropContext.d.ts +0 -8
- package/dist/client/interaction/backdrop/BackdropContext.js +0 -6
- package/dist/client/interaction/backdrop/BackdropEvent.d.ts +0 -64
- package/dist/client/interaction/backdrop/BackdropEvent.js +0 -92
- package/dist/client/interaction/backdrop/index.d.ts +0 -4
- package/dist/client/interaction/backdrop/index.js +0 -20
- package/dist/client/interaction/backdrop/useBackdrop.d.ts +0 -13
- package/dist/client/interaction/backdrop/useBackdrop.js +0 -58
- package/dist/client/interaction/backdrop/useBackdropClick.d.ts +0 -2
- package/dist/client/interaction/backdrop/useBackdropClick.js +0 -21
- package/dist/client/interaction/backdrop/useBackdropVisible.d.ts +0 -1
- package/dist/client/interaction/backdrop/useBackdropVisible.js +0 -30
- package/dist/client/interaction/focus/FocusArea.d.ts +0 -10
- package/dist/client/interaction/focus/FocusArea.js +0 -38
- package/dist/client/interaction/focus/FocusContext.d.ts +0 -7
- package/dist/client/interaction/focus/FocusContext.js +0 -7
- package/dist/client/interaction/focus/FocusController.d.ts +0 -9
- package/dist/client/interaction/focus/FocusController.js +0 -40
- package/dist/client/interaction/focus/FocusService.d.ts +0 -20
- package/dist/client/interaction/focus/FocusService.js +0 -204
- package/dist/client/interaction/focus/LinkedList.d.ts +0 -18
- package/dist/client/interaction/focus/LinkedList.js +0 -122
- package/dist/client/interaction/focus/index.d.ts +0 -2
- package/dist/client/interaction/focus/index.js +0 -18
- package/dist/client/interaction/focus/useFocusService.d.ts +0 -2
- package/dist/client/interaction/focus/useFocusService.js +0 -14
- package/dist/client/interaction/modal/Modal.d.ts +0 -29
- package/dist/client/interaction/modal/Modal.js +0 -136
- package/dist/client/interaction/modal/ModalContainer.d.ts +0 -5
- package/dist/client/interaction/modal/ModalContainer.js +0 -104
- package/dist/client/interaction/modal/ModalContext.d.ts +0 -8
- package/dist/client/interaction/modal/ModalContext.js +0 -6
- package/dist/client/interaction/modal/ModalEvent.d.ts +0 -39
- package/dist/client/interaction/modal/ModalEvent.js +0 -53
- package/dist/client/interaction/modal/index.d.ts +0 -2
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
@apply text-pretty break-normal;
|
|
30
30
|
font: var(--nd-person-title-font);
|
|
31
31
|
letter-spacing: var(--nd-person-title-letterspacing);
|
|
32
|
-
color: var(--nd-person-title-color,
|
|
32
|
+
color: var(--nd-person-title-color, currentColor);
|
|
33
33
|
font-variant-numeric: lining-nums proportional-nums;
|
|
34
34
|
|
|
35
35
|
&:not(:last-child):after {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
@apply text-pretty break-normal;
|
|
42
42
|
font: var(--nd-person-name-font);
|
|
43
43
|
letter-spacing: var(--nd-person-name-letterspacing);
|
|
44
|
-
color: var(--nd-person-name-color,
|
|
44
|
+
color: var(--nd-person-name-color, currentColor);
|
|
45
45
|
font-variant-numeric: lining-nums proportional-nums;
|
|
46
46
|
|
|
47
47
|
&:not(:last-child):after {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
@apply text-pretty break-normal;
|
|
54
54
|
font: var(--nd-person-company-font);
|
|
55
55
|
letter-spacing: var(--nd-person-company-letterspacing);
|
|
56
|
-
color: var(--nd-person-company-color,
|
|
56
|
+
color: var(--nd-person-company-color, currentColor);
|
|
57
57
|
font-variant-numeric: lining-nums proportional-nums;
|
|
58
58
|
|
|
59
59
|
&:not(:last-child):after {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
@apply text-pretty break-normal;
|
|
66
66
|
font: var(--nd-person-location-font);
|
|
67
67
|
letter-spacing: var(--nd-person-location-letterspacing);
|
|
68
|
-
color: var(--nd-person-location-color,
|
|
68
|
+
color: var(--nd-person-location-color, currentColor);
|
|
69
69
|
font-variant-numeric: lining-nums proportional-nums;
|
|
70
70
|
|
|
71
71
|
&:not(:last-child):after {
|
|
@@ -4,21 +4,27 @@
|
|
|
4
4
|
--nd-project-bg: unset;
|
|
5
5
|
--nd-project-padding: theme('spacing.l9');
|
|
6
6
|
--nd-project-copy-gap: theme('spacing.l5');
|
|
7
|
+
--nd-project-content-gap: unset;
|
|
7
8
|
--nd-project-client-margin: unset;
|
|
8
9
|
--nd-project-name-margin: unset;
|
|
9
10
|
--nd-project-headline-margin: unset;
|
|
10
11
|
--nd-project-link-margin: unset;
|
|
11
12
|
--nd-project-name-font: normal 500 20px/1 Helvetica, Arial, san-serif;
|
|
12
13
|
--nd-project-name-letterspacing: unset;
|
|
13
|
-
--nd-project-name-color:
|
|
14
|
+
--nd-project-name-color: currentColor;
|
|
14
15
|
--nd-project-headline-font: normal 500 24px/1 Helvetica, Arial, san-serif;
|
|
15
16
|
--nd-project-headline-letterspacing: unset;
|
|
16
|
-
--nd-project-headline-color:
|
|
17
|
+
--nd-project-headline-color: currentColor;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
.nd-Project {
|
|
20
21
|
background: var(--nd-project-bg);
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
.nd-Project-content {
|
|
25
|
+
@apply flex flex-col gap-[--nd-project-content-gap];
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
.nd-Project-copy {
|
|
23
29
|
@apply flex flex-col gap-[var(--nd-project-copy-gap)] p-[var(--nd-project-padding)];
|
|
24
30
|
}
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
--nd-usp-copy-gap: unset;
|
|
10
10
|
--nd-usp-name-font: normal 500 20px/1 Helvetica, Arial, san-serif;
|
|
11
11
|
--nd-usp-name-letterspacing: unset;
|
|
12
|
-
--nd-usp-name-color:
|
|
12
|
+
--nd-usp-name-color: currentColor;
|
|
13
13
|
--nd-usp-name-mb: unset;
|
|
14
14
|
--nd-usp-headline-font: normal 500 24px/1 Helvetica, Arial, san-serif;
|
|
15
15
|
--nd-usp-headline-letterspacing: unset;
|
|
16
|
-
--nd-usp-headline-color:
|
|
16
|
+
--nd-usp-headline-color: currentColor;
|
|
17
17
|
--nd-usp-headline-mb: unset;
|
|
18
18
|
--nd-usp-caption-font: normal 500 24px/1 Helvetica, Arial, san-serif;
|
|
19
19
|
--nd-usp-caption-letterspacing: unset;
|
|
20
|
-
--nd-usp-caption-color:
|
|
20
|
+
--nd-usp-caption-color: currentColor;
|
|
21
21
|
--nd-usp-caption-mb: unset;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
&.nd-RichText {
|
|
13
13
|
--nd-RichText-p-mb: 0;
|
|
14
14
|
--nd-RichText-p-font: var(--nd-caption-font);
|
|
15
|
-
--nd-RichText-p-color: var(--nd-caption-color,
|
|
15
|
+
--nd-RichText-p-color: var(--nd-caption-color, currentColor);
|
|
16
16
|
--nd-RichText-p-letterspacing: var(--nd-caption-letterspacing);
|
|
17
17
|
}
|
|
18
18
|
font: var(--nd-caption-font);
|
|
19
19
|
letter-spacing: var(--nd-caption-letterspacing);
|
|
20
|
-
color: var(--nd-caption-color,
|
|
20
|
+
color: var(--nd-caption-color, currentColor);
|
|
21
21
|
font-variant-numeric: lining-nums proportional-nums;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
&.nd-RichText {
|
|
13
13
|
--nd-RichText-p-mb: 0;
|
|
14
14
|
--nd-RichText-p-font: var(--nd-description-font);
|
|
15
|
-
--nd-RichText-p-color: var(--nd-description-color,
|
|
15
|
+
--nd-RichText-p-color: var(--nd-description-color, currentColor);
|
|
16
16
|
--nd-RichText-p-letterspacing: var(--nd-description-letterspacing);
|
|
17
17
|
}
|
|
18
18
|
font: var(--nd-description-font);
|
|
19
19
|
letter-spacing: var(--nd-description-letterspacing);
|
|
20
|
-
color: var(--nd-description-color,
|
|
20
|
+
color: var(--nd-description-color, currentColor);
|
|
21
21
|
font-variant-numeric: lining-nums proportional-nums;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@apply text-nowrap;
|
|
11
11
|
font: var(--nd-link-font);
|
|
12
12
|
letter-spacing: var(--nd-link-letterspacing);
|
|
13
|
-
color: var(--nd-link-color,
|
|
13
|
+
color: var(--nd-link-color, currentColor);
|
|
14
14
|
font-variant-numeric: lining-nums proportional-nums;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
&.nd-RichText {
|
|
24
24
|
--nd-RichText-p-mb: 0;
|
|
25
25
|
--nd-RichText-p-font: var(--nd-quote-font);
|
|
26
|
-
--nd-RichText-p-color: var(--nd-quote-color,
|
|
26
|
+
--nd-RichText-p-color: var(--nd-quote-color, currentColor);
|
|
27
27
|
--nd-RichText-p-letterspacing: var(--nd-quote-letterspacing);
|
|
28
28
|
--nd-RichText-priority-font: var(--nd-quote-priority-font);
|
|
29
29
|
--nd-RichText-priority-color: var(--nd-quote-priority-color);
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
font: var(--nd-quote-font);
|
|
37
37
|
letter-spacing: var(--nd-quote-letterspacing);
|
|
38
|
-
color: var(--nd-quote-color,
|
|
38
|
+
color: var(--nd-quote-color, currentColor);
|
|
39
39
|
font-variant-numeric: lining-nums proportional-nums;
|
|
40
40
|
|
|
41
41
|
span:first-child:before {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
overflow-wrap: anywhere;
|
|
12
12
|
font: var(--nd-title-font);
|
|
13
13
|
letter-spacing: var(--nd-title-letterspacing);
|
|
14
|
-
color: var(--nd-title-color,
|
|
14
|
+
color: var(--nd-title-color, currentColor);
|
|
15
15
|
font-variant-numeric: lining-nums proportional-nums;
|
|
16
16
|
}
|
|
17
17
|
}
|
package/dist/styles/index.css
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--nd-bento-layout-gap: theme('spacing.l8');
|
|
5
|
+
--nd-bento-layout-gap-x: var(--nd-bento-layout-gap);
|
|
6
|
+
--nd-bento-layout-gap-y: var(--nd-bento-layout-gap);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
._nd-BentoLayout-mobile {
|
|
10
|
+
@apply flex flex-col gap-[--nd-bento-layout-gap-y];
|
|
11
|
+
.nd-MessagePreview-visualWrap {
|
|
12
|
+
--nd-message-preview-visual-aspect: 4/3;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
._nd-BentoLayout-desktop {
|
|
17
|
+
@apply grid grid-cols-12 gap-x-[--nd-bento-layout-gap-x] gap-y-[--nd-bento-layout-gap-y];
|
|
18
|
+
|
|
19
|
+
> * {
|
|
20
|
+
|
|
21
|
+
/* first */
|
|
22
|
+
&:nth-child(3n + 1) {
|
|
23
|
+
@apply col-span-full;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* second */
|
|
27
|
+
&:nth-child(3n + 2) {
|
|
28
|
+
@apply col-span-6;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* third */
|
|
32
|
+
&:nth-child(3n + 3) {
|
|
33
|
+
@apply col-span-6;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.nd-BentoLayout {
|
|
39
|
+
@apply @max-panel-md:_nd-BentoLayout-mobile @panel-md:_nd-BentoLayout-desktop;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
.nd-TestimonialPanel-author {
|
|
42
42
|
@apply not-first:mb-[var(--nd-testimonial-panel-author-mt)] not-last:mb-[var(--nd-testimonial-panel-author-mb)];
|
|
43
43
|
text-align: var(--nd-testimonial-panel-quote-textAlign);
|
|
44
|
+
|
|
45
|
+
.nd-Person-copy > span:not(:last-child)::after {
|
|
46
|
+
content: ",";
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
.nd-TestimonialPanel-ctas {
|
|
46
50
|
@apply flex justify-center flex-wrap gap-[var(--nd-testimonial-panel-ctas-gap)];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-ui",
|
|
3
3
|
"description": "UI components for funnel",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
7
7
|
"access": "restricted"
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"@emotion/is-prop-valid": "^1",
|
|
50
50
|
"@react-hook/resize-observer": "^2",
|
|
51
51
|
"@tailwindcss/aspect-ratio": "^0",
|
|
52
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
53
52
|
"@vimeo/player": "^2.30.1",
|
|
54
53
|
"classnames": "^2",
|
|
55
54
|
"color": "^5.0.0",
|
|
@@ -70,5 +69,5 @@
|
|
|
70
69
|
"react-dom": "^19",
|
|
71
70
|
"ts-jest": "^29.3.2"
|
|
72
71
|
},
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "d3d65564e0935e40c8b1e441316b63a126516bca"
|
|
74
73
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Callback, Frame, Rect } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { Variants } from 'framer-motion';
|
|
3
|
-
import { HTMLAttributes } from 'react';
|
|
4
|
-
import { ClickObserver } from './ClickObserver';
|
|
5
|
-
import { UILevel } from './UILevel';
|
|
6
|
-
export declare function Popup({ className, style, anchor, level, placement, anchorOffset, viewportPadding, animation, dismissTrigger, disableBackground, disabled, bubbleCloseEvent, open, onOpened: onOpenedRaw, onClose, onClosed: onClosedRaw, children, ...props }: Popup.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export declare namespace Popup {
|
|
8
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
9
|
-
anchor?: Rect | Element | string | null | undefined;
|
|
10
|
-
level?: UILevel;
|
|
11
|
-
placement?: Placement;
|
|
12
|
-
anchorOffset?: number;
|
|
13
|
-
viewportPadding?: number;
|
|
14
|
-
animation?: Animation;
|
|
15
|
-
dismissTrigger?: ClickObserver.Trigger | 'none';
|
|
16
|
-
disableBackground?: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
bubbleCloseEvent?: boolean;
|
|
19
|
-
open?: boolean;
|
|
20
|
-
onOpened?: Callback.Void;
|
|
21
|
-
onClose?: Callback.Void;
|
|
22
|
-
onClosed?: Callback.Void;
|
|
23
|
-
};
|
|
24
|
-
type Placement = 'top-start' | 'top' | 'top-end' | 'top-match' | 'bottom-start' | 'bottom' | 'bottom-end' | 'bottom-match' | 'left-start' | 'left' | 'left-end' | 'right-start' | 'right' | 'right-end';
|
|
25
|
-
type Animation = 'in' | 'out' | 'in-out';
|
|
26
|
-
type GetFrameArgs = {
|
|
27
|
-
anchorRect: Rect;
|
|
28
|
-
contentElement: HTMLDivElement;
|
|
29
|
-
placement: Popup.Placement;
|
|
30
|
-
anchorOffset: number;
|
|
31
|
-
viewportPadding: number;
|
|
32
|
-
};
|
|
33
|
-
function getFrame({ anchorRect, contentElement, placement, anchorOffset, viewportPadding }: GetFrameArgs): Partial<Frame>;
|
|
34
|
-
}
|
|
35
|
-
export declare const animations: Variants;
|
|
36
|
-
export declare function getAnchorRect(anchor: Rect | Element | string | null | undefined): Rect | null;
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.animations = void 0;
|
|
18
|
-
exports.Popup = Popup;
|
|
19
|
-
exports.getAnchorRect = getAnchorRect;
|
|
20
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
22
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
23
|
-
const framer_motion_1 = require("framer-motion");
|
|
24
|
-
const react_1 = require("react");
|
|
25
|
-
const react_dom_1 = require("react-dom");
|
|
26
|
-
const react_hotkeys_hook_1 = require("react-hotkeys-hook");
|
|
27
|
-
const hooks_1 = require("../hooks");
|
|
28
|
-
const ClickObserver_1 = require("./ClickObserver");
|
|
29
|
-
// component
|
|
30
|
-
function Popup(_a) {
|
|
31
|
-
var { className, style = {}, anchor, level = 'l1', placement = 'bottom', anchorOffset = 0, viewportPadding = 0, animation = 'in-out', dismissTrigger, disableBackground = false, disabled = false, bubbleCloseEvent = false, open = false, onOpened: onOpenedRaw = funnel_core_1.Fn.NoOp, onClose = funnel_core_1.Fn.NoOp, onClosed: onClosedRaw = funnel_core_1.Fn.NoOp, children } = _a, props = __rest(_a, ["className", "style", "anchor", "level", "placement", "anchorOffset", "viewportPadding", "animation", "dismissTrigger", "disableBackground", "disabled", "bubbleCloseEvent", "open", "onOpened", "onClose", "onClosed", "children"]);
|
|
32
|
-
// bind context
|
|
33
|
-
const [active, setActive] = (0, react_1.useState)(false);
|
|
34
|
-
const openedRef = (0, react_1.useRef)(false);
|
|
35
|
-
const contentRef = (0, react_1.useRef)(null);
|
|
36
|
-
const id = (0, react_1.useId)();
|
|
37
|
-
const anchorRect = getAnchorRect(anchor);
|
|
38
|
-
const onOpenedRef = (0, react_1.useRef)(onOpenedRaw);
|
|
39
|
-
onOpenedRef.current = onOpenedRaw;
|
|
40
|
-
const onClosedRef = (0, react_1.useRef)(onClosedRaw);
|
|
41
|
-
onClosedRef.current = onClosedRaw;
|
|
42
|
-
const closeCallback = (0, react_1.useCallback)(() => {
|
|
43
|
-
if (openedRef.current) {
|
|
44
|
-
onClose();
|
|
45
|
-
}
|
|
46
|
-
}, [onClose]);
|
|
47
|
-
// re-render on window size change
|
|
48
|
-
(0, hooks_1.useViewportSize)();
|
|
49
|
-
// close on escape
|
|
50
|
-
(0, react_hotkeys_hook_1.useHotkeys)('esc', closeCallback);
|
|
51
|
-
// show/hide based on open change
|
|
52
|
-
(0, react_1.useEffect)(() => {
|
|
53
|
-
// raise event on open/close
|
|
54
|
-
let unlock = undefined;
|
|
55
|
-
if (open) {
|
|
56
|
-
// update ref
|
|
57
|
-
openedRef.current = true;
|
|
58
|
-
// activate
|
|
59
|
-
setActive(true);
|
|
60
|
-
// lock keyboard
|
|
61
|
-
unlock = funnel_core_1.Browser.lockFocus(`#${CSS.escape(id)}`);
|
|
62
|
-
}
|
|
63
|
-
// raise event on close (if it was actually opened)
|
|
64
|
-
else if (openedRef.current) {
|
|
65
|
-
// deactivate
|
|
66
|
-
setActive(false);
|
|
67
|
-
// update ref
|
|
68
|
-
openedRef.current = false;
|
|
69
|
-
}
|
|
70
|
-
// on unmount
|
|
71
|
-
return () => {
|
|
72
|
-
// unlock (if locked)
|
|
73
|
-
if (unlock) {
|
|
74
|
-
unlock();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}, [open, id]);
|
|
78
|
-
// skip for SSR
|
|
79
|
-
if (!funnel_core_1.Browser.available) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
// compute popup rect (if visible + ready)
|
|
83
|
-
const contentElement = contentRef.current;
|
|
84
|
-
const popupFrame = active && !!anchorRect && !!contentElement
|
|
85
|
-
? Popup.getFrame({
|
|
86
|
-
anchorRect,
|
|
87
|
-
contentElement,
|
|
88
|
-
placement,
|
|
89
|
-
anchorOffset,
|
|
90
|
-
viewportPadding
|
|
91
|
-
})
|
|
92
|
-
: {};
|
|
93
|
-
// helpers
|
|
94
|
-
const onClickOutside = (e) => {
|
|
95
|
-
// consume click
|
|
96
|
-
if (!bubbleCloseEvent) {
|
|
97
|
-
e.preventDefault();
|
|
98
|
-
e.stopPropagation();
|
|
99
|
-
}
|
|
100
|
-
// close
|
|
101
|
-
onClose();
|
|
102
|
-
};
|
|
103
|
-
const onAnimationComplete = (definition) => {
|
|
104
|
-
if (definition === 'visible') {
|
|
105
|
-
onOpenedRef.current();
|
|
106
|
-
}
|
|
107
|
-
else if (definition === 'exit') {
|
|
108
|
-
onClosedRef.current();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
// render
|
|
112
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: open && !!anchorRect &&
|
|
113
|
-
(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { id: id, className: (0, classnames_1.default)('Popup-wrap', {
|
|
114
|
-
'Popup-disableBg': disableBackground,
|
|
115
|
-
'Popup-disabled': disabled,
|
|
116
|
-
'Popup-l1': level === 'l1',
|
|
117
|
-
'Popup-l2': level === 'l2',
|
|
118
|
-
'Popup-l3': level === 'l3'
|
|
119
|
-
}), variants: exports.animations, initial: animation !== 'out' ? 'hidden' : 'visible', animate: "visible", exit: animation !== 'in' ? 'exit' : 'visible', onAnimationComplete: definition => onAnimationComplete(definition), children: (0, jsx_runtime_1.jsx)(ClickObserver_1.ClickObserver, { trigger: dismissTrigger === 'none' ? 'click' : dismissTrigger, disabled: !open || dismissTrigger === 'none', onClickOutside: onClickOutside, children: (0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { ref: contentRef, style: Object.assign(Object.assign({}, style), popupFrame), className: (0, classnames_1.default)(className, 'Popup-root'), children: children })) }) }, id) }), document.body) }));
|
|
120
|
-
}
|
|
121
|
-
// extension
|
|
122
|
-
(function (Popup) {
|
|
123
|
-
// helpers
|
|
124
|
-
function getFrame({ anchorRect, contentElement, placement, anchorOffset, viewportPadding }) {
|
|
125
|
-
// get geometries
|
|
126
|
-
const viewportRect = new funnel_core_1.Rect(viewportPadding, viewportPadding, window.innerWidth - viewportPadding * 2, window.innerHeight - viewportPadding * 2);
|
|
127
|
-
const contentWidth = contentElement.offsetWidth;
|
|
128
|
-
const contentHeight = contentElement.offsetHeight;
|
|
129
|
-
// horizontal layout if left/right
|
|
130
|
-
const popupFrame = {};
|
|
131
|
-
const [primary, secondary] = placement.split('-');
|
|
132
|
-
if (primary === 'left' || primary === 'right') {
|
|
133
|
-
// determine space to left/right
|
|
134
|
-
const spaceLeft = Math.max(0, anchorRect.left - viewportRect.left - anchorOffset);
|
|
135
|
-
const spaceRight = Math.max(0, viewportRect.right - anchorRect.right - anchorOffset);
|
|
136
|
-
// place left if it fits or it fits better than on the right
|
|
137
|
-
if ((primary === 'left' && (spaceLeft >= contentWidth || spaceLeft > spaceRight))
|
|
138
|
-
|| (primary === 'right' && spaceRight < contentWidth && spaceRight < spaceLeft)) {
|
|
139
|
-
popupFrame.right = viewportRect.right - anchorRect.left + anchorOffset;
|
|
140
|
-
}
|
|
141
|
-
// or place right
|
|
142
|
-
else {
|
|
143
|
-
popupFrame.left = anchorRect.right + anchorOffset;
|
|
144
|
-
}
|
|
145
|
-
// top-align on start
|
|
146
|
-
if (secondary === 'start') {
|
|
147
|
-
popupFrame.top = anchorRect.top;
|
|
148
|
-
}
|
|
149
|
-
// bottom-align on end
|
|
150
|
-
else if (secondary === 'end') {
|
|
151
|
-
popupFrame.bottom = viewportRect.bottom - anchorRect.bottom;
|
|
152
|
-
}
|
|
153
|
-
// or center against anchor
|
|
154
|
-
else {
|
|
155
|
-
// set top bounds so it's centered
|
|
156
|
-
popupFrame.top = Math.max(anchorRect.top + (anchorRect.height - contentHeight) / 2, viewportRect.top);
|
|
157
|
-
// offset if the bottom is bleeding over
|
|
158
|
-
if (popupFrame.top + contentHeight > viewportRect.bottom) {
|
|
159
|
-
popupFrame.top -= popupFrame.top + contentHeight - viewportRect.bottom;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// or standard vertical layout
|
|
164
|
-
else {
|
|
165
|
-
// determine space to top/bottom
|
|
166
|
-
const spaceTop = Math.max(0, anchorRect.top - viewportRect.top - anchorOffset);
|
|
167
|
-
const spaceBottom = Math.max(0, viewportRect.bottom - anchorRect.bottom - anchorOffset);
|
|
168
|
-
// place above if it fits or it fits better than on the right
|
|
169
|
-
if ((primary === 'top' && (spaceTop >= contentHeight || spaceBottom < spaceTop))
|
|
170
|
-
|| (primary === 'bottom' && spaceBottom < contentHeight && spaceBottom < spaceTop)) {
|
|
171
|
-
popupFrame.bottom = viewportRect.bottom - anchorRect.top + anchorOffset;
|
|
172
|
-
}
|
|
173
|
-
// or place below
|
|
174
|
-
else {
|
|
175
|
-
popupFrame.top = anchorRect.bottom + anchorOffset;
|
|
176
|
-
}
|
|
177
|
-
// left-align on start
|
|
178
|
-
if (secondary === 'start') {
|
|
179
|
-
popupFrame.left = anchorRect.left;
|
|
180
|
-
}
|
|
181
|
-
// right-align on end
|
|
182
|
-
else if (secondary === 'end') {
|
|
183
|
-
popupFrame.right = viewportRect.right - anchorRect.right;
|
|
184
|
-
}
|
|
185
|
-
// match width
|
|
186
|
-
else if (secondary === 'match') {
|
|
187
|
-
popupFrame.left = anchorRect.left;
|
|
188
|
-
popupFrame.width = anchorRect.width;
|
|
189
|
-
}
|
|
190
|
-
// or center against anchor
|
|
191
|
-
else {
|
|
192
|
-
// set left bounds so it's centered
|
|
193
|
-
popupFrame.left = Math.max(anchorRect.left + (anchorRect.width - contentWidth) / 2, viewportRect.left);
|
|
194
|
-
// offset if the right is bleeding over
|
|
195
|
-
if (popupFrame.left + contentWidth > viewportRect.right) {
|
|
196
|
-
popupFrame.left -= popupFrame.left + contentWidth - viewportRect.right;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
// return position insets
|
|
201
|
-
return popupFrame;
|
|
202
|
-
}
|
|
203
|
-
Popup.getFrame = getFrame;
|
|
204
|
-
})(Popup || (exports.Popup = Popup = {}));
|
|
205
|
-
// helpers
|
|
206
|
-
exports.animations = {
|
|
207
|
-
hidden: {
|
|
208
|
-
opacity: 0
|
|
209
|
-
},
|
|
210
|
-
visible: {
|
|
211
|
-
opacity: 1,
|
|
212
|
-
transition: {
|
|
213
|
-
ease: 'easeOut',
|
|
214
|
-
duration: 0.5,
|
|
215
|
-
when: 'beforeChildren'
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
exit: {
|
|
219
|
-
opacity: 0,
|
|
220
|
-
transition: {
|
|
221
|
-
ease: 'easeIn',
|
|
222
|
-
duration: 0.15,
|
|
223
|
-
bounce: 0,
|
|
224
|
-
when: 'afterChildren'
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
function getAnchorRect(anchor) {
|
|
229
|
-
// skip if there's no anchor or if we're SSR
|
|
230
|
-
if (!anchor || !funnel_core_1.Browser.available) {
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
// or skip if we already have a rect
|
|
234
|
-
else if (anchor instanceof funnel_core_1.Rect) {
|
|
235
|
-
return anchor;
|
|
236
|
-
}
|
|
237
|
-
// try to coerce anchor into an element (or fail)
|
|
238
|
-
const anchorElement = typeof anchor === 'string'
|
|
239
|
-
? document.querySelector(anchor)
|
|
240
|
-
: anchor;
|
|
241
|
-
return anchorElement
|
|
242
|
-
? funnel_core_1.Rect.fromInsets(anchorElement.getBoundingClientRect())
|
|
243
|
-
: null;
|
|
244
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ReactNode, RefObject } from 'react';
|
|
2
|
-
import { Popup } from './Popup';
|
|
3
|
-
export declare function Tooltip({ delay, scroller, content, children, anchorClassName, popupClassName, onClose, placement, anchorOffset, viewportPadding, disabled }: DelayedPopup.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare namespace DelayedPopup {
|
|
5
|
-
type Props = Pick<Popup.Props, 'anchorOffset' | 'viewportPadding' | 'placement' | 'onClose'> & {
|
|
6
|
-
delay?: number;
|
|
7
|
-
scroller?: string | RefObject<HTMLElement | null>;
|
|
8
|
-
content: ReactNode;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
anchorClassName?: string;
|
|
11
|
-
popupClassName?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
};
|
|
14
|
-
type HoverState = 'inactive' | 'waiting' | 'active';
|
|
15
|
-
type TapState = 'inactive' | 'active';
|
|
16
|
-
}
|