keystone-design-bootstrap 1.0.8 → 1.0.9
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/package.json +6 -2
- package/src/design_system/elements/avatar/avatar-profile-photo.tsx +4 -1
- package/src/design_system/elements/avatar/avatar.tsx +2 -1
- package/src/design_system/elements/avatar/base-components/avatar-company-icon.tsx +5 -2
- package/src/design_system/elements/badges/avatar.tsx +2 -1
- package/src/design_system/elements/badges/badges.tsx +3 -2
- package/src/design_system/elements/carousel/carousel-base.tsx +62 -31
- package/src/design_system/elements/carousel/carousel.tsx +62 -31
- package/src/design_system/elements/date-picker/date-input.tsx +1 -1
- package/src/design_system/elements/index.tsx +2 -6
- package/src/design_system/elements/input/input.aman.tsx +1 -2
- package/src/design_system/elements/input/input.tsx +1 -3
- package/src/design_system/elements/map/GoogleMap.tsx +88 -30
- package/src/design_system/elements/markdown-renderer/MarkdownRenderer.tsx +40 -28
- package/src/design_system/elements/pagination/pagination-base.tsx +2 -9
- package/src/design_system/elements/photo-fallback/photo-fallback.tsx +25 -12
- package/src/design_system/elements/select/multi-select.tsx +4 -9
- package/src/design_system/elements/select/select.aman.tsx +0 -2
- package/src/design_system/elements/shared-assets/credit-card/credit-card.tsx +2 -2
- package/src/design_system/elements/tooltip/tooltip.tsx +1 -1
- package/src/design_system/elements/video-modal.tsx +1 -1
- package/src/design_system/hooks/use-breakpoint.ts +18 -15
- package/src/design_system/sections/about-home.aman.tsx +2 -2
- package/src/design_system/sections/about-home.tsx +15 -12
- package/src/design_system/sections/blog-cards.tsx +3 -3
- package/src/design_system/sections/blog-gallery.aman.tsx +1 -1
- package/src/design_system/sections/blog-gallery.tsx +3 -3
- package/src/design_system/sections/blog-home.aman.tsx +1 -1
- package/src/design_system/sections/blog-post.aman.tsx +1 -1
- package/src/design_system/sections/blog-post.tsx +30 -20
- package/src/design_system/sections/blog-section.aman.tsx +1 -1
- package/src/design_system/sections/blog-section.tsx +0 -4
- package/src/design_system/sections/contact-home.tsx +2 -2
- package/src/design_system/sections/contact-section.aman.tsx +0 -2
- package/src/design_system/sections/contact-section.tsx +3 -3
- package/src/design_system/sections/faq-grid.aman.tsx +1 -1
- package/src/design_system/sections/faq-home.aman.tsx +1 -1
- package/src/design_system/sections/feature-text.tsx +5 -4
- package/src/design_system/sections/footer-home.aman.tsx +1 -2
- package/src/design_system/sections/footer-home.tsx +26 -25
- package/src/design_system/sections/generic-header-component.tsx +1 -1
- package/src/design_system/sections/header-navigation.aman.tsx +18 -13
- package/src/design_system/sections/header-navigation.tsx +5 -4
- package/src/design_system/sections/hero-home.aman.tsx +2 -2
- package/src/design_system/sections/hero-home.tsx +1 -4
- package/src/design_system/sections/hero-location-detail.aman.tsx +3 -1
- package/src/design_system/sections/home-hero-component.tsx +7 -5
- package/src/design_system/sections/index.tsx +2 -2
- package/src/design_system/sections/job-gallery.aman.tsx +1 -1
- package/src/design_system/sections/job-gallery.tsx +3 -3
- package/src/design_system/sections/location-details-section.aman.tsx +1 -1
- package/src/design_system/sections/location-details-section.tsx +1 -1
- package/src/design_system/sections/location-grid.aman.tsx +1 -1
- package/src/design_system/sections/location-grid.tsx +1 -1
- package/src/design_system/sections/services-home.tsx +1 -1
- package/src/design_system/sections/social-media-grid.aman.tsx +1 -1
- package/src/design_system/sections/social-media-grid.tsx +4 -1
- package/src/design_system/sections/statistics-section.aman.tsx +1 -1
- package/src/design_system/sections/statistics-section.tsx +1 -1
- package/src/design_system/sections/team-grid.aman.tsx +1 -1
- package/src/design_system/sections/testimonials-grid.aman.tsx +2 -2
- package/src/design_system/sections/testimonials-home.aman.tsx +2 -2
- package/src/design_system/sections/values-section.aman.tsx +2 -3
- package/src/lib/component-registry.ts +1 -1
- package/src/lib/hooks/use-breakpoint.ts +18 -15
- package/src/lib/server-api.ts +1 -1
- package/src/pages/.gitkeep +2 -0
- package/src/types/api/blog-post.ts +1 -1
- package/src/types/api/contact.ts +1 -1
- package/src/types/api/team-member.ts +1 -1
- package/src/types/api/website-photos.ts +1 -0
- package/src/utils/countries.tsx +5 -1
- package/src/utils/photo-helpers.ts +4 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keystone-design-bootstrap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Keystone Design Bootstrap - Sections, Elements, and Theme System for customer websites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup",
|
|
33
|
-
"dev": "tsup --watch"
|
|
33
|
+
"dev": "tsup --watch",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix"
|
|
34
36
|
},
|
|
35
37
|
"peerDependencies": {
|
|
36
38
|
"next": ">=15.0.0",
|
|
@@ -53,6 +55,8 @@
|
|
|
53
55
|
"@types/node": "^20",
|
|
54
56
|
"@types/react": "^19",
|
|
55
57
|
"@types/react-dom": "^19",
|
|
58
|
+
"eslint": "^9",
|
|
59
|
+
"eslint-config-next": "16.1.1",
|
|
56
60
|
"tsup": "^8.5.1",
|
|
57
61
|
"typescript": "^5"
|
|
58
62
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
+
import Image from "next/image";
|
|
4
5
|
import { User01 } from "@untitledui/icons";
|
|
5
6
|
import { cx } from '../../../utils/cx';
|
|
6
7
|
import { type AvatarProps } from "./avatar";
|
|
@@ -61,10 +62,12 @@ export const AvatarProfilePhoto = ({
|
|
|
61
62
|
const renderMainContent = () => {
|
|
62
63
|
if (src && !isFailed) {
|
|
63
64
|
return (
|
|
64
|
-
<
|
|
65
|
+
<Image
|
|
65
66
|
src={src}
|
|
66
67
|
alt={alt}
|
|
67
68
|
onError={() => setIsFailed(true)}
|
|
69
|
+
width={100}
|
|
70
|
+
height={100}
|
|
68
71
|
className={cx(
|
|
69
72
|
"size-full rounded-full object-cover",
|
|
70
73
|
contrastBorder && "outline-1 -outline-offset-1 outline-avatar-contrast-border",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { type FC, type ReactNode, useState } from "react";
|
|
4
|
+
import Image from "next/image";
|
|
4
5
|
import { User01 } from "@untitledui/icons";
|
|
5
6
|
import { cx } from '../../../utils/cx';
|
|
6
7
|
import { AvatarOnlineIndicator, VerifiedTick } from "./base-components";
|
|
@@ -81,7 +82,7 @@ export const Avatar = ({
|
|
|
81
82
|
|
|
82
83
|
const renderMainContent = () => {
|
|
83
84
|
if (src && !isFailed) {
|
|
84
|
-
return <
|
|
85
|
+
return <Image data-avatar-img className="size-full rounded-full object-cover" src={src} alt={alt} onError={() => setIsFailed(true)} width={100} height={100} />;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
if (initials) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import Image from "next/image";
|
|
3
4
|
import { cx } from '../../../../utils/cx';
|
|
4
5
|
|
|
5
6
|
const sizes = {
|
|
@@ -18,9 +19,11 @@ interface AvatarCompanyIconProps {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const AvatarCompanyIcon = ({ size, src, alt }: AvatarCompanyIconProps) => (
|
|
21
|
-
<
|
|
22
|
+
<Image
|
|
22
23
|
src={src}
|
|
23
|
-
alt={alt}
|
|
24
|
+
alt={alt || ""}
|
|
25
|
+
width={20}
|
|
26
|
+
height={20}
|
|
24
27
|
className={cx("bg-primary-25 absolute -right-0.5 -bottom-0.5 rounded-full object-cover ring-[1.5px] ring-bg-primary", sizes[size])}
|
|
25
28
|
/>
|
|
26
29
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { type FC, type ReactNode, useState } from "react";
|
|
4
|
+
import Image from "next/image";
|
|
4
5
|
import { User01 } from "@untitledui/icons";
|
|
5
6
|
import { cx } from '../../../utils/cx';
|
|
6
7
|
import { AvatarOnlineIndicator, VerifiedTick } from '../avatar/base-components';
|
|
@@ -81,7 +82,7 @@ export const Avatar = ({
|
|
|
81
82
|
|
|
82
83
|
const renderMainContent = () => {
|
|
83
84
|
if (src && !isFailed) {
|
|
84
|
-
return <
|
|
85
|
+
return <Image data-avatar-img className="size-full rounded-full object-cover" src={src} alt={alt} onError={() => setIsFailed(true)} width={100} height={100} />;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
if (initials) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { MouseEventHandler, ReactNode, HTMLAttributes } from "react";
|
|
4
|
+
import Image from "next/image";
|
|
4
5
|
import { X as CloseX } from "@untitledui/icons";
|
|
5
6
|
import { cx } from '../../../utils/cx';
|
|
6
7
|
import type { BadgeColors, BadgeTypeToColorMap, BadgeTypes, FlagTypes, IconComponentType, Sizes } from "./badge-types";
|
|
@@ -290,7 +291,7 @@ export const BadgeWithFlag = <T extends BadgeTypes>(props: BadgeWithFlagProps<T>
|
|
|
290
291
|
|
|
291
292
|
return (
|
|
292
293
|
<span className={cx(colors.common, sizes[type][size], colors.styles[color].root)}>
|
|
293
|
-
<
|
|
294
|
+
<Image src={`https://www.untitledui.com/images/flags/${flag}.svg`} className="size-4 max-w-none rounded-full" alt={`${flag} flag`} width={16} height={16} />
|
|
294
295
|
{children}
|
|
295
296
|
</span>
|
|
296
297
|
);
|
|
@@ -328,7 +329,7 @@ export const BadgeWithImage = <T extends BadgeTypes>(props: BadgeWithImageProps<
|
|
|
328
329
|
|
|
329
330
|
return (
|
|
330
331
|
<span className={cx(colors.common, sizes[type][size], colors.styles[color].root)}>
|
|
331
|
-
<
|
|
332
|
+
<Image src={imgSrc} className="size-4 max-w-none rounded-full" alt="Badge image" width={16} height={16} />
|
|
332
333
|
{children}
|
|
333
334
|
</span>
|
|
334
335
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { CSSProperties, ComponentPropsWithRef, HTMLAttributes, KeyboardEvent, ReactNode, Ref } from "react";
|
|
4
|
-
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect,
|
|
4
|
+
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
5
5
|
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
6
|
import { cx } from '../../../utils/cx';
|
|
7
7
|
|
|
@@ -52,6 +52,14 @@ export const useCarousel = () => {
|
|
|
52
52
|
return context;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
// Stable default snapshot for SSR - must be a constant to avoid infinite loops
|
|
56
|
+
const DEFAULT_SNAPSHOT = {
|
|
57
|
+
canScrollPrev: false,
|
|
58
|
+
canScrollNext: false,
|
|
59
|
+
selectedIndex: 0,
|
|
60
|
+
scrollSnaps: [] as number[],
|
|
61
|
+
};
|
|
62
|
+
|
|
55
63
|
const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }: ComponentPropsWithRef<"div"> & CarouselProps) => {
|
|
56
64
|
const [carouselRef, api] = useEmblaCarousel(
|
|
57
65
|
{
|
|
@@ -60,24 +68,58 @@ const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, class
|
|
|
60
68
|
},
|
|
61
69
|
plugins,
|
|
62
70
|
);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
71
|
+
|
|
72
|
+
// Cache the snapshot object to avoid creating new objects on every call
|
|
73
|
+
const snapshotRef = useRef(DEFAULT_SNAPSHOT);
|
|
74
|
+
|
|
75
|
+
const getSnapshot = useCallback(() => {
|
|
76
|
+
if (!api) {
|
|
77
|
+
return DEFAULT_SNAPSHOT;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const canScrollPrev = api.canScrollPrev();
|
|
81
|
+
const canScrollNext = api.canScrollNext();
|
|
82
|
+
const selectedIndex = api.selectedScrollSnap();
|
|
83
|
+
const scrollSnaps = api.scrollSnapList();
|
|
84
|
+
|
|
85
|
+
// Only create a new object if values have changed
|
|
86
|
+
if (
|
|
87
|
+
snapshotRef.current.canScrollPrev !== canScrollPrev ||
|
|
88
|
+
snapshotRef.current.canScrollNext !== canScrollNext ||
|
|
89
|
+
snapshotRef.current.selectedIndex !== selectedIndex ||
|
|
90
|
+
snapshotRef.current.scrollSnaps.length !== scrollSnaps.length ||
|
|
91
|
+
snapshotRef.current.scrollSnaps.some((val, idx) => val !== scrollSnaps[idx])
|
|
92
|
+
) {
|
|
93
|
+
snapshotRef.current = {
|
|
94
|
+
canScrollPrev,
|
|
95
|
+
canScrollNext,
|
|
96
|
+
selectedIndex,
|
|
97
|
+
scrollSnaps,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return snapshotRef.current;
|
|
102
|
+
}, [api]);
|
|
67
103
|
|
|
68
|
-
|
|
69
|
-
|
|
104
|
+
// Stable server snapshot - returns the same cached object reference for SSR
|
|
105
|
+
const getServerSnapshot = useCallback(() => DEFAULT_SNAPSHOT, []);
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
107
|
+
const subscribe = useCallback(
|
|
108
|
+
(onStoreChange: () => void) => {
|
|
109
|
+
if (!api) return () => {};
|
|
73
110
|
|
|
74
|
-
|
|
75
|
-
|
|
111
|
+
api.on("select", onStoreChange);
|
|
112
|
+
api.on("reInit", onStoreChange);
|
|
76
113
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
114
|
+
return () => {
|
|
115
|
+
api.off("select", onStoreChange);
|
|
116
|
+
api.off("reInit", onStoreChange);
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
[api],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const { canScrollPrev, canScrollNext, selectedIndex, scrollSnaps } = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
81
123
|
|
|
82
124
|
const scrollPrev = useCallback(() => {
|
|
83
125
|
api?.scrollPrev();
|
|
@@ -106,21 +148,6 @@ const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, class
|
|
|
106
148
|
setApi(api);
|
|
107
149
|
}, [api, setApi]);
|
|
108
150
|
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (!api) return;
|
|
111
|
-
|
|
112
|
-
onInit(api);
|
|
113
|
-
onSelect(api);
|
|
114
|
-
|
|
115
|
-
api.on("reInit", onInit);
|
|
116
|
-
api.on("reInit", onSelect);
|
|
117
|
-
api.on("select", onSelect);
|
|
118
|
-
|
|
119
|
-
return () => {
|
|
120
|
-
api?.off("select", onSelect);
|
|
121
|
-
};
|
|
122
|
-
}, [api, onInit, onSelect]);
|
|
123
|
-
|
|
124
151
|
return (
|
|
125
152
|
<CarouselContext.Provider
|
|
126
153
|
value={{
|
|
@@ -192,7 +219,11 @@ const Trigger = ({ className, children, asChild, direction, style, ...props }: T
|
|
|
192
219
|
const handleClick = () => {
|
|
193
220
|
if (isDisabled) return;
|
|
194
221
|
|
|
195
|
-
direction === "prev"
|
|
222
|
+
if (direction === "prev") {
|
|
223
|
+
scrollPrev();
|
|
224
|
+
} else {
|
|
225
|
+
scrollNext();
|
|
226
|
+
}
|
|
196
227
|
};
|
|
197
228
|
|
|
198
229
|
const computedClassName = typeof className === "function" ? className({ isDisabled }) : className;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { CSSProperties, ComponentPropsWithRef, HTMLAttributes, KeyboardEvent, ReactNode, Ref } from "react";
|
|
4
|
-
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect,
|
|
4
|
+
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useRef, useSyncExternalStore } from "react";
|
|
5
5
|
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
6
|
import { cx } from '../../../utils/cx';
|
|
7
7
|
|
|
@@ -52,6 +52,14 @@ export const useCarousel = () => {
|
|
|
52
52
|
return context;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
// Stable default snapshot for SSR - must be a constant to avoid infinite loops
|
|
56
|
+
const DEFAULT_SNAPSHOT = {
|
|
57
|
+
canScrollPrev: false,
|
|
58
|
+
canScrollNext: false,
|
|
59
|
+
selectedIndex: 0,
|
|
60
|
+
scrollSnaps: [] as number[],
|
|
61
|
+
};
|
|
62
|
+
|
|
55
63
|
const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }: ComponentPropsWithRef<"div"> & CarouselProps) => {
|
|
56
64
|
const [carouselRef, api] = useEmblaCarousel(
|
|
57
65
|
{
|
|
@@ -60,24 +68,58 @@ const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, class
|
|
|
60
68
|
},
|
|
61
69
|
plugins,
|
|
62
70
|
);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
71
|
+
|
|
72
|
+
// Cache the snapshot object to avoid creating new objects on every call
|
|
73
|
+
const snapshotRef = useRef(DEFAULT_SNAPSHOT);
|
|
74
|
+
|
|
75
|
+
const getSnapshot = useCallback(() => {
|
|
76
|
+
if (!api) {
|
|
77
|
+
return DEFAULT_SNAPSHOT;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const canScrollPrev = api.canScrollPrev();
|
|
81
|
+
const canScrollNext = api.canScrollNext();
|
|
82
|
+
const selectedIndex = api.selectedScrollSnap();
|
|
83
|
+
const scrollSnaps = api.scrollSnapList();
|
|
84
|
+
|
|
85
|
+
// Only create a new object if values have changed
|
|
86
|
+
if (
|
|
87
|
+
snapshotRef.current.canScrollPrev !== canScrollPrev ||
|
|
88
|
+
snapshotRef.current.canScrollNext !== canScrollNext ||
|
|
89
|
+
snapshotRef.current.selectedIndex !== selectedIndex ||
|
|
90
|
+
snapshotRef.current.scrollSnaps.length !== scrollSnaps.length ||
|
|
91
|
+
snapshotRef.current.scrollSnaps.some((val, idx) => val !== scrollSnaps[idx])
|
|
92
|
+
) {
|
|
93
|
+
snapshotRef.current = {
|
|
94
|
+
canScrollPrev,
|
|
95
|
+
canScrollNext,
|
|
96
|
+
selectedIndex,
|
|
97
|
+
scrollSnaps,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return snapshotRef.current;
|
|
102
|
+
}, [api]);
|
|
67
103
|
|
|
68
|
-
|
|
69
|
-
|
|
104
|
+
// Stable server snapshot - returns the same cached object reference for SSR
|
|
105
|
+
const getServerSnapshot = useCallback(() => DEFAULT_SNAPSHOT, []);
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
107
|
+
const subscribe = useCallback(
|
|
108
|
+
(onStoreChange: () => void) => {
|
|
109
|
+
if (!api) return () => {};
|
|
73
110
|
|
|
74
|
-
|
|
75
|
-
|
|
111
|
+
api.on("select", onStoreChange);
|
|
112
|
+
api.on("reInit", onStoreChange);
|
|
76
113
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
114
|
+
return () => {
|
|
115
|
+
api.off("select", onStoreChange);
|
|
116
|
+
api.off("reInit", onStoreChange);
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
[api],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const { canScrollPrev, canScrollNext, selectedIndex, scrollSnaps } = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
81
123
|
|
|
82
124
|
const scrollPrev = useCallback(() => {
|
|
83
125
|
api?.scrollPrev();
|
|
@@ -106,21 +148,6 @@ const CarouselRoot = ({ orientation = "horizontal", opts, setApi, plugins, class
|
|
|
106
148
|
setApi(api);
|
|
107
149
|
}, [api, setApi]);
|
|
108
150
|
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (!api) return;
|
|
111
|
-
|
|
112
|
-
onInit(api);
|
|
113
|
-
onSelect(api);
|
|
114
|
-
|
|
115
|
-
api.on("reInit", onInit);
|
|
116
|
-
api.on("reInit", onSelect);
|
|
117
|
-
api.on("select", onSelect);
|
|
118
|
-
|
|
119
|
-
return () => {
|
|
120
|
-
api?.off("select", onSelect);
|
|
121
|
-
};
|
|
122
|
-
}, [api, onInit, onSelect]);
|
|
123
|
-
|
|
124
151
|
return (
|
|
125
152
|
<CarouselContext.Provider
|
|
126
153
|
value={{
|
|
@@ -192,7 +219,11 @@ const Trigger = ({ className, children, asChild, direction, style, ...props }: T
|
|
|
192
219
|
const handleClick = () => {
|
|
193
220
|
if (isDisabled) return;
|
|
194
221
|
|
|
195
|
-
direction === "prev"
|
|
222
|
+
if (direction === "prev") {
|
|
223
|
+
scrollPrev();
|
|
224
|
+
} else {
|
|
225
|
+
scrollNext();
|
|
226
|
+
}
|
|
196
227
|
};
|
|
197
228
|
|
|
198
229
|
const computedClassName = typeof className === "function" ? className({ isDisabled }) : className;
|
|
@@ -4,7 +4,7 @@ import type { DateInputProps as AriaDateInputProps } from "react-aria-components
|
|
|
4
4
|
import { DateInput as AriaDateInput, DateSegment as AriaDateSegment } from "react-aria-components";
|
|
5
5
|
import { cx } from '../../../utils/cx';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type DateInputProps = Omit<AriaDateInputProps, "children">;
|
|
8
8
|
|
|
9
9
|
export const DateInput = (props: DateInputProps) => {
|
|
10
10
|
return (
|
|
@@ -51,14 +51,10 @@ import { AvatarLabelGroup as BaseAvatarLabelGroup } from './avatar/avatar-label-
|
|
|
51
51
|
import { AvatarProfilePhoto as BaseAvatarProfilePhoto } from './avatar/avatar-profile-photo';
|
|
52
52
|
import { VerifiedTick as BaseVerifiedTick } from './avatar/base-components';
|
|
53
53
|
import { Breadcrumb as BaseBreadcrumb } from './breadcrumb/Breadcrumb';
|
|
54
|
-
import { Tabs as BaseTabs } from './tabs/tabs';
|
|
55
|
-
import { TagGroup as BaseTagGroup, TagList as BaseTagList, Tag as BaseTag } from './tags/tags';
|
|
56
54
|
import { FeaturedIcon as BaseFeaturedIcon } from './featured-icon/featured-icon';
|
|
57
55
|
import { ProgressBar as BaseProgressBar } from './progress-indicators/progress-indicators';
|
|
58
56
|
import { ProgressBarCircle as BaseProgressBarCircle } from './progress-indicators/progress-circles';
|
|
59
57
|
import { CircleProgressBar as BaseCircleProgressBar } from './progress-indicators/simple-circle';
|
|
60
|
-
import { SlideoutMenu as BaseSlideoutMenu } from './slideout-menus/slideout-menu';
|
|
61
|
-
import { Pagination as BasePagination } from './pagination/pagination-base';
|
|
62
58
|
import { PaginationDot as BasePaginationDot } from './pagination/pagination-dot';
|
|
63
59
|
import { PaginationLine as BasePaginationLine } from './pagination/pagination-line';
|
|
64
60
|
import { PaginationPageDefault as BasePaginationPageDefault, PaginationPageMinimalCenter as BasePaginationPageMinimalCenter } from './pagination/pagination';
|
|
@@ -74,8 +70,8 @@ import './select/select.aman';
|
|
|
74
70
|
/**
|
|
75
71
|
* Create themed component wrapper
|
|
76
72
|
*/
|
|
77
|
-
function createThemedExport(componentName: string, BaseComponent: React.ComponentType<
|
|
78
|
-
return function ThemedComponent(props:
|
|
73
|
+
function createThemedExport<P extends Record<string, unknown>>(componentName: string, BaseComponent: React.ComponentType<P>) {
|
|
74
|
+
return function ThemedComponent(props: P) {
|
|
79
75
|
const { theme } = useTheme();
|
|
80
76
|
|
|
81
77
|
try {
|
|
@@ -41,9 +41,8 @@ export const InputBase = ({
|
|
|
41
41
|
tooltipClassName,
|
|
42
42
|
inputClassName,
|
|
43
43
|
iconClassName,
|
|
44
|
-
isRequired: _isRequired,
|
|
45
44
|
...inputProps
|
|
46
|
-
}: Omit<InputBaseProps, "label" | "hint">) => {
|
|
45
|
+
}: Omit<InputBaseProps, "label" | "hint" | "isRequired">) => {
|
|
47
46
|
const hasTrailingIcon = tooltip || isInvalid;
|
|
48
47
|
const hasLeadingIcon = Icon;
|
|
49
48
|
const context = useContext(TextFieldContext);
|
|
@@ -49,10 +49,8 @@ export const InputBase = ({
|
|
|
49
49
|
tooltipClassName,
|
|
50
50
|
inputClassName,
|
|
51
51
|
iconClassName,
|
|
52
|
-
// Omit this prop to avoid invalid HTML attribute warning
|
|
53
|
-
isRequired: _isRequired,
|
|
54
52
|
...inputProps
|
|
55
|
-
}: Omit<InputBaseProps, "label" | "hint">) => {
|
|
53
|
+
}: Omit<InputBaseProps, "label" | "hint" | "isRequired">) => {
|
|
56
54
|
// Check if the input has a leading icon or tooltip
|
|
57
55
|
const hasTrailingIcon = tooltip || isInvalid;
|
|
58
56
|
const hasLeadingIcon = Icon;
|