@donotdev/components 0.0.9 → 0.0.11
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/atomic/Accordion/index.d.ts +2 -16
- package/dist/atomic/Accordion/index.d.ts.map +1 -1
- package/dist/atomic/Accordion/index.js +4 -25
- package/dist/atomic/Alert/index.d.ts.map +1 -1
- package/dist/atomic/Alert/index.js +1 -1
- package/dist/atomic/AlertDialog/index.d.ts +1 -1
- package/dist/atomic/AlertDialog/index.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/index.js +5 -4
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +1 -1
- package/dist/atomic/CallToAction/index.d.ts.map +1 -1
- package/dist/atomic/CallToAction/index.js +1 -1
- package/dist/atomic/Card/index.js +1 -1
- package/dist/atomic/Collapsible/index.d.ts +12 -16
- package/dist/atomic/Collapsible/index.d.ts.map +1 -1
- package/dist/atomic/Collapsible/index.js +28 -24
- package/dist/atomic/HeroSection/index.js +1 -1
- package/dist/atomic/Section/index.d.ts +25 -1
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.js +23 -4
- package/dist/atomic/Tooltip/index.d.ts.map +1 -1
- package/dist/atomic/Tooltip/index.js +6 -2
- package/dist/atomic/VideoPlayer/index.d.ts.map +1 -1
- package/dist/hooks/useIntersectionObserver.js +3 -1
- package/dist/index.js +4 -4
- package/dist/styles/index.css +162 -27
- package/package.json +1 -1
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Accordion component
|
|
3
|
-
* @description Accessible accordion component built on Radix UI primitives provides a prop based implementation to get rid of Radix internal nesting.
|
|
4
|
-
*
|
|
5
|
-
* @version 0.0.1
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
10
1
|
import type { ReactNode } from 'react';
|
|
11
2
|
export interface AccordionItemType {
|
|
12
3
|
/** The unique value for the accordion item */
|
|
@@ -16,11 +7,7 @@ export interface AccordionItemType {
|
|
|
16
7
|
/** The content to be displayed when expanded */
|
|
17
8
|
content: string | ReactNode;
|
|
18
9
|
}
|
|
19
|
-
|
|
20
|
-
variant?: "default" | "warning" | "success" | "muted" | "primary" | "secondary" | "accent" | "destructive" | null | undefined;
|
|
21
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
|
-
export type AccordionVariant = VariantProps<typeof accordionVariants>['variant'];
|
|
23
|
-
export interface AccordionProps extends VariantProps<typeof accordionVariants> {
|
|
10
|
+
export interface AccordionProps {
|
|
24
11
|
/**
|
|
25
12
|
* The type of accordion.
|
|
26
13
|
* @default 'single'
|
|
@@ -59,7 +46,6 @@ export interface AccordionProps extends VariantProps<typeof accordionVariants> {
|
|
|
59
46
|
* @param {AccordionProps} props - The props for the accordion
|
|
60
47
|
* @returns {JSX.Element} The rendered accordion
|
|
61
48
|
*/
|
|
62
|
-
declare const Accordion: ({ type, collapsible, defaultValue, value, onValueChange, items,
|
|
49
|
+
declare const Accordion: ({ type, collapsible, defaultValue, value, onValueChange, items, className, }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
63
50
|
export default Accordion;
|
|
64
|
-
export { accordionVariants };
|
|
65
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Accordion/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Accordion/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,gDAAgD;IAChD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,kCAAkC;IAClC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,SAAS,GAAI,8EAQhB,cAAc,4CA0DhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -8,28 +8,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
-
import { cva } from 'class-variance-authority';
|
|
12
11
|
import AccordionPrimitive, { AccordionItemPrimitive, AccordionTriggerPrimitive, AccordionContentPrimitive, } from './AccordionPrimitive';
|
|
13
|
-
import { cn
|
|
14
|
-
import { THEME_VARIANT } from '../../utils/constants';
|
|
12
|
+
import { cn } from '../../utils/helpers';
|
|
15
13
|
import { ChevronDown } from 'lucide-react';
|
|
16
|
-
const accordionVariants = cva('dndev-accordion', {
|
|
17
|
-
variants: {
|
|
18
|
-
variant: {
|
|
19
|
-
[THEME_VARIANT.DEFAULT]: '',
|
|
20
|
-
[THEME_VARIANT.MUTED]: '',
|
|
21
|
-
[THEME_VARIANT.PRIMARY]: '',
|
|
22
|
-
[THEME_VARIANT.SECONDARY]: '',
|
|
23
|
-
[THEME_VARIANT.ACCENT]: '',
|
|
24
|
-
[THEME_VARIANT.SUCCESS]: '',
|
|
25
|
-
[THEME_VARIANT.WARNING]: '',
|
|
26
|
-
[THEME_VARIANT.DESTRUCTIVE]: '',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: THEME_VARIANT.DEFAULT,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
14
|
/**
|
|
34
15
|
* A vertically stacked set of interactive headings that each reveal a section of content.
|
|
35
16
|
* Built on Radix UI Accordion.
|
|
@@ -47,13 +28,11 @@ const accordionVariants = cva('dndev-accordion', {
|
|
|
47
28
|
* @param {AccordionProps} props - The props for the accordion
|
|
48
29
|
* @returns {JSX.Element} The rendered accordion
|
|
49
30
|
*/
|
|
50
|
-
const Accordion = ({ type = 'single', collapsible = false, defaultValue, value, onValueChange, items,
|
|
51
|
-
const variantAttrs = getVariantDataAttrs({ variant });
|
|
31
|
+
const Accordion = ({ type = 'single', collapsible = false, defaultValue, value, onValueChange, items, className, }) => {
|
|
52
32
|
// Handle type narrowing for Radix's union types
|
|
53
33
|
if (type === 'multiple') {
|
|
54
|
-
return (_jsx(AccordionPrimitive, { type: "multiple", defaultValue: defaultValue, value: value, onValueChange: onValueChange, className: cn(
|
|
34
|
+
return (_jsx(AccordionPrimitive, { type: "multiple", defaultValue: defaultValue, value: value, onValueChange: onValueChange, className: cn('dndev-accordion', className), children: items.map((item) => (_jsxs(AccordionItemPrimitive, { value: item.value, className: "dndev-accordion-item", children: [_jsxs(AccordionTriggerPrimitive, { className: "dndev-interactive dndev-accordion-header", children: [item.trigger, _jsx(ChevronDown, { className: "dndev-accordion-trigger-icon" })] }), _jsx(AccordionContentPrimitive, { className: "dndev-accordion-content", children: _jsx("div", { className: "dndev-accordion-content-inner", children: item.content }) })] }, item.value))) }));
|
|
55
35
|
}
|
|
56
|
-
return (_jsx(AccordionPrimitive, { type: "single", collapsible: collapsible, defaultValue: defaultValue, value: value, onValueChange: onValueChange, className: cn(
|
|
36
|
+
return (_jsx(AccordionPrimitive, { type: "single", collapsible: collapsible, defaultValue: defaultValue, value: value, onValueChange: onValueChange, className: cn('dndev-accordion', className), children: items.map((item) => (_jsxs(AccordionItemPrimitive, { value: item.value, className: "dndev-accordion-item", children: [_jsxs(AccordionTriggerPrimitive, { className: "dndev-interactive dndev-accordion-header", children: [item.trigger, _jsx(ChevronDown, { className: "dndev-accordion-trigger-icon" })] }), _jsx(AccordionContentPrimitive, { className: "dndev-accordion-content", children: _jsx("div", { className: "dndev-accordion-content-inner", children: item.content }) })] }, item.value))) }));
|
|
57
37
|
};
|
|
58
38
|
export default Accordion;
|
|
59
|
-
export { accordionVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Alert/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,QAAA,MAAM,aAAa;;8EAajB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE9E,MAAM,WAAW,UACf,SACE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EAC7C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,KAAK,GAAI,mFASZ,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Alert/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,QAAA,MAAM,aAAa;;8EAajB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE9E,MAAM,WAAW,UACf,SACE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EAC7C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,KAAK,GAAI,mFASZ,UAAU,4CAsDZ,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -72,7 +72,7 @@ const Alert = ({ className, variant = ALERT_VARIANT.DEFAULT, hideIcon = false, t
|
|
|
72
72
|
const variantAttrs = getVariantDataAttrs({
|
|
73
73
|
variant: getThemeVariant(variant),
|
|
74
74
|
});
|
|
75
|
-
return (_jsxs(Stack, { direction: "row", gap: "medium", role: "alert", className: cn(alertVariants({ variant }), className), ...variantAttrs, title: tooltip, ...props, children: [!hideIcon && (_jsx(Icon, { icon: IconComponent, className: "dndev-size-md dndev-flex-shrink-0", "aria-hidden": "true" })), _jsxs(Stack, { gap: "tight", flex: "1", className: "dndev-min-w-0", children: [title && _jsx("
|
|
75
|
+
return (_jsxs(Stack, { direction: "row", gap: "medium", role: "alert", className: cn(alertVariants({ variant }), className), ...variantAttrs, title: tooltip, ...props, children: [!hideIcon && (_jsx(Icon, { icon: IconComponent, className: "dndev-size-md dndev-flex-shrink-0", "aria-hidden": "true" })), _jsxs(Stack, { gap: "tight", flex: "1", className: "dndev-min-w-0", children: [title && (_jsx("div", { className: "dndev-alert-title dndev-text-h5", children: title })), description && (_jsx("div", { className: "dndev-text-base dndev-alert-description", children: description })), children] })] }));
|
|
76
76
|
};
|
|
77
77
|
export default Alert;
|
|
78
78
|
export { alertVariants };
|
|
@@ -30,7 +30,7 @@ export interface AlertDialogProps {
|
|
|
30
30
|
* @example
|
|
31
31
|
* ```tsx
|
|
32
32
|
* <AlertDialog
|
|
33
|
-
* trigger={<
|
|
33
|
+
* trigger={<Button variant="destructive">Delete</Button>}
|
|
34
34
|
* title="Are you sure?"
|
|
35
35
|
* description="This action cannot be undone."
|
|
36
36
|
* confirmLabel="Delete"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/AlertDialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/AlertDialog/index.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AA+DvD,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,kDAAkD;IAClD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,WAAW,GAAI,sGAUlB,gBAAgB,4CAoClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import VisuallyHidden from '../VisuallyHidden';
|
|
12
|
+
import Button from '../Button';
|
|
12
13
|
import { cn } from '../../utils/helpers';
|
|
13
14
|
import AlertDialogPrimitive, { AlertDialogTriggerPrimitive, AlertDialogContentPrimitive as ContentPrimitive, AlertDialogHeaderPrimitive as HeaderPrimitive, AlertDialogFooterPrimitive as FooterPrimitive, AlertDialogTitlePrimitive as TitlePrimitive, AlertDialogDescriptionPrimitive as DescriptionPrimitive, AlertDialogActionPrimitive as ActionPrimitive, AlertDialogCancelPrimitive as CancelPrimitive, AlertDialogOverlayPrimitive as OverlayPrimitive, AlertDialogPortalPrimitive, } from './AlertDialogPrimitive';
|
|
14
15
|
// Wrapper components that apply dndev-* classes
|
|
@@ -18,8 +19,8 @@ const AlertDialogHeader = ({ className, ...props }) => (_jsx(HeaderPrimitive, {
|
|
|
18
19
|
const AlertDialogFooter = ({ className, ...props }) => (_jsx(FooterPrimitive, { className: cn('dndev-modal-footer', className), ...props }));
|
|
19
20
|
const AlertDialogTitle = ({ className, ...props }) => (_jsx(TitlePrimitive, { className: cn('dndev-modal-title', className), ...props }));
|
|
20
21
|
const AlertDialogDescription = ({ className, ...props }) => (_jsx(DescriptionPrimitive, { className: cn('dndev-modal-description', className), ...props }));
|
|
21
|
-
const AlertDialogAction =
|
|
22
|
-
const AlertDialogCancel =
|
|
22
|
+
const AlertDialogAction = ActionPrimitive;
|
|
23
|
+
const AlertDialogCancel = CancelPrimitive;
|
|
23
24
|
/**
|
|
24
25
|
* A modal dialog that interrupts the user with important content and expects a response.
|
|
25
26
|
* Built on Radix UI AlertDialog.
|
|
@@ -28,7 +29,7 @@ const AlertDialogCancel = ({ className, ...props }) => (_jsx(CancelPrimitive, {
|
|
|
28
29
|
* @example
|
|
29
30
|
* ```tsx
|
|
30
31
|
* <AlertDialog
|
|
31
|
-
* trigger={<
|
|
32
|
+
* trigger={<Button variant="destructive">Delete</Button>}
|
|
32
33
|
* title="Are you sure?"
|
|
33
34
|
* description="This action cannot be undone."
|
|
34
35
|
* confirmLabel="Delete"
|
|
@@ -39,6 +40,6 @@ const AlertDialogCancel = ({ className, ...props }) => (_jsx(CancelPrimitive, {
|
|
|
39
40
|
* @returns {JSX.Element} The rendered alert dialog
|
|
40
41
|
*/
|
|
41
42
|
const AlertDialog = ({ trigger, title, description, cancelLabel = 'Cancel', confirmLabel, onConfirm, onCancel, open, onOpenChange, }) => {
|
|
42
|
-
return (_jsxs(AlertDialogPrimitive, { open: open, onOpenChange: onOpenChange, children: [trigger && (_jsx(AlertDialogTriggerPrimitive, { asChild: true, children: trigger })), _jsxs(AlertDialogContent, { className: "dndev-surface", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), description ? (_jsx(AlertDialogDescription, { children: description })) : (_jsx(VisuallyHidden, { children: _jsx(AlertDialogDescription, { children: "Alert dialog content" }) }))] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { onClick: onCancel, children: cancelLabel }), _jsx(AlertDialogAction, { onClick: onConfirm, children: confirmLabel })] })] })] }));
|
|
43
|
+
return (_jsxs(AlertDialogPrimitive, { open: open, onOpenChange: onOpenChange, children: [trigger && (_jsx(AlertDialogTriggerPrimitive, { asChild: true, children: trigger })), _jsxs(AlertDialogContent, { className: "dndev-surface", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), description ? (_jsx(AlertDialogDescription, { children: description })) : (_jsx(VisuallyHidden, { children: _jsx(AlertDialogDescription, { children: "Alert dialog content" }) }))] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { asChild: true, children: _jsx(Button, { variant: "ghost", onClick: onCancel, children: cancelLabel }) }), _jsx(AlertDialogAction, { asChild: true, children: _jsx(Button, { variant: "accent", onClick: onConfirm, children: confirmLabel }) })] })] })] }));
|
|
43
44
|
};
|
|
44
45
|
export default AlertDialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Button/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAK1D,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAKjB,CAAC;AAEX,QAAA,MAAM,cAAc;;8EAmBlB,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;AAE3E;;;;;;GAMG;AACH,qEAAqE;AACrE,MAAM,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M,OAAO,OAAO,CAAC,CAAC;IACjD,yDAAyD;IACzD,IAAI,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,MAAM,GAAI,wKAcb,WAAW,4UAmFb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -112,7 +112,7 @@ const Button = ({ className, variant, render, display = DISPLAY.AUTO, icon, icon
|
|
|
112
112
|
return (_jsx(Tooltip, { content: tooltip || getAriaLabel() || 'Button', children: buttonElement }));
|
|
113
113
|
}
|
|
114
114
|
if (tooltip) {
|
|
115
|
-
return
|
|
115
|
+
return _jsx(Tooltip, { content: tooltip, children: buttonElement });
|
|
116
116
|
}
|
|
117
117
|
return buttonElement;
|
|
118
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/CallToAction/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,UAAU,oBAAoB;IAC5B;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC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B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAEvE,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,IAC7D,oBAAoB,GAClB,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,oBAAoB,CAAC,CAAC;AAE/D,QAAA,MAAM,YAAY,mIAuDjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -46,7 +46,7 @@ const CallToAction = forwardRef(function CallToAction({ as = 'section', title, s
|
|
|
46
46
|
className: cn('dndev-cta', className),
|
|
47
47
|
'data-tone': tone,
|
|
48
48
|
...props,
|
|
49
|
-
}, _jsxs("div", { className: "dndev-cta-content", "data-text-align": align, children: [title && (_jsx(Text, { as: "h2", style: { fontSize: 'var(--font-size-2xl)' }, children: title })), subtitle && _jsx(Text, { as: "span", level: "h4", children: subtitle }), (primaryAction || secondaryAction) && (_jsxs("div", { className: "dndev-cta-actions", children: [primaryAction, secondaryAction] })), children] }));
|
|
49
|
+
}, _jsxs("div", { className: "dndev-cta-content", "data-text-align": align, children: [title && (_jsx(Text, { as: "div", level: "h2", style: { fontSize: 'var(--font-size-2xl)' }, children: title })), subtitle && (_jsx(Text, { as: "span", level: "h4", children: subtitle })), (primaryAction || secondaryAction) && (_jsxs("div", { className: "dndev-cta-actions", children: [primaryAction, secondaryAction] })), children] }));
|
|
50
50
|
});
|
|
51
51
|
CallToAction.displayName = 'CallToAction';
|
|
52
52
|
export default CallToAction;
|
|
@@ -70,7 +70,7 @@ export function renderCardContent(content) {
|
|
|
70
70
|
export function renderCardHeader(icon, title, subtitle) {
|
|
71
71
|
if (!icon && !title && !subtitle)
|
|
72
72
|
return null;
|
|
73
|
-
return (_jsxs("div", { className: "dndev-card-header", children: [icon && title ? (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Icon, { icon: icon, ariaHidden: true }), _jsx(Text, { as: "h3", className: "dndev-card-title", children: title })] })) : title ? (_jsx(Text, { as: "h3", className: "dndev-card-title", children: title })) : icon ? (_jsx(Icon, { icon: icon, ariaHidden: true })) : null, subtitle && (_jsx(Text, { as: "h4", className: "dndev-card-subtitle", children: subtitle }))] }));
|
|
73
|
+
return (_jsxs("div", { className: "dndev-card-header", children: [icon && title ? (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Icon, { icon: icon, ariaHidden: true }), _jsx(Text, { as: "div", level: "h3", className: "dndev-card-title", children: title })] })) : title ? (_jsx(Text, { as: "div", level: "h3", className: "dndev-card-title", children: title })) : icon ? (_jsx(Icon, { icon: icon, ariaHidden: true })) : null, subtitle && (_jsx(Text, { as: "div", level: "h4", className: "dndev-card-subtitle", children: subtitle }))] }));
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Card variant constants - re-exported from shared SURFACE_VARIANT
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Collapsible component
|
|
3
|
-
* @description Interactive component for expanding/collapsing content built on Radix UI primitives.
|
|
4
|
-
*
|
|
5
|
-
* @version 0.0.1
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
10
1
|
import type { ReactNode } from 'react';
|
|
11
2
|
import './Collapsible.css';
|
|
12
|
-
|
|
13
|
-
variant?: "default" | "warning" | "success" | "muted" | "primary" | "secondary" | "accent" | "destructive" | null | undefined;
|
|
14
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
-
export type CollapsibleVariant = VariantProps<typeof collapsibleVariants>['variant'];
|
|
16
|
-
export interface CollapsibleProps extends VariantProps<typeof collapsibleVariants> {
|
|
3
|
+
export interface CollapsibleProps {
|
|
17
4
|
/** Trigger element (button, text, etc.) */
|
|
18
5
|
trigger?: ReactNode;
|
|
19
6
|
/** Collapsible content */
|
|
@@ -26,6 +13,16 @@ export interface CollapsibleProps extends VariantProps<typeof collapsibleVariant
|
|
|
26
13
|
defaultOpen?: boolean;
|
|
27
14
|
/** Whether the collapsible is disabled */
|
|
28
15
|
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Show icon indicator (Plus/Minus or ChevronDown)
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
showIcon?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Icon style: 'plus-minus' or 'chevron'
|
|
23
|
+
* @default 'plus-minus'
|
|
24
|
+
*/
|
|
25
|
+
iconStyle?: 'plus-minus' | 'chevron';
|
|
29
26
|
/** Additional CSS classes */
|
|
30
27
|
className?: string;
|
|
31
28
|
}
|
|
@@ -43,7 +40,6 @@ export interface CollapsibleProps extends VariantProps<typeof collapsibleVariant
|
|
|
43
40
|
* @param {CollapsibleProps} props - The props for the collapsible
|
|
44
41
|
* @returns {JSX.Element} The rendered collapsible
|
|
45
42
|
*/
|
|
46
|
-
declare function Collapsible({ trigger, children, open, onOpenChange, defaultOpen, disabled,
|
|
43
|
+
declare function Collapsible({ trigger, children, open, onOpenChange, defaultOpen, disabled, showIcon, iconStyle, className, }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
47
44
|
export default Collapsible;
|
|
48
|
-
export { collapsibleVariants };
|
|
49
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Collapsible/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Collapsible/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,mBAAmB,CAAC;AAE3B,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACrC,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,iBAAS,WAAW,CAAC,EACnB,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAgB,EAChB,SAAwB,EACxB,SAAS,GACV,EAAE,gBAAgB,2CAmElB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -8,28 +8,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { Plus, Minus, ChevronDown } from 'lucide-react';
|
|
12
13
|
import CollapsiblePrimitive, { CollapsibleTrigger, CollapsibleContent, } from './CollapsiblePrimitive';
|
|
13
|
-
import { cn
|
|
14
|
-
import
|
|
14
|
+
import { cn } from '../../utils/helpers';
|
|
15
|
+
import Stack from '../Stack';
|
|
15
16
|
import './Collapsible.css';
|
|
16
|
-
const collapsibleVariants = cva('dndev-collapsible', {
|
|
17
|
-
variants: {
|
|
18
|
-
variant: {
|
|
19
|
-
[THEME_VARIANT.DEFAULT]: '',
|
|
20
|
-
[THEME_VARIANT.MUTED]: '',
|
|
21
|
-
[THEME_VARIANT.PRIMARY]: '',
|
|
22
|
-
[THEME_VARIANT.SECONDARY]: '',
|
|
23
|
-
[THEME_VARIANT.ACCENT]: '',
|
|
24
|
-
[THEME_VARIANT.SUCCESS]: '',
|
|
25
|
-
[THEME_VARIANT.WARNING]: '',
|
|
26
|
-
[THEME_VARIANT.DESTRUCTIVE]: '',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: THEME_VARIANT.DEFAULT,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
17
|
/**
|
|
34
18
|
* Accessible collapsible component.
|
|
35
19
|
* Expands and collapses content with smooth animations.
|
|
@@ -44,9 +28,29 @@ const collapsibleVariants = cva('dndev-collapsible', {
|
|
|
44
28
|
* @param {CollapsibleProps} props - The props for the collapsible
|
|
45
29
|
* @returns {JSX.Element} The rendered collapsible
|
|
46
30
|
*/
|
|
47
|
-
function Collapsible({ trigger, children, open, onOpenChange, defaultOpen, disabled,
|
|
48
|
-
const
|
|
49
|
-
|
|
31
|
+
function Collapsible({ trigger, children, open, onOpenChange, defaultOpen, disabled, showIcon = false, iconStyle = 'plus-minus', className, }) {
|
|
32
|
+
const [internalOpen, setInternalOpen] = useState(() => defaultOpen || false);
|
|
33
|
+
const isControlled = open !== undefined;
|
|
34
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
35
|
+
const handleOpenChange = isControlled
|
|
36
|
+
? onOpenChange
|
|
37
|
+
: (newOpen) => {
|
|
38
|
+
setInternalOpen(newOpen);
|
|
39
|
+
onOpenChange?.(newOpen);
|
|
40
|
+
};
|
|
41
|
+
const renderTrigger = () => {
|
|
42
|
+
if (!trigger)
|
|
43
|
+
return null;
|
|
44
|
+
if (showIcon) {
|
|
45
|
+
const IconComponent = iconStyle === 'chevron'
|
|
46
|
+
? ChevronDown
|
|
47
|
+
: isOpen
|
|
48
|
+
? Minus
|
|
49
|
+
: Plus;
|
|
50
|
+
return (_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Stack, { as: "div", direction: "row", align: "center", justify: "between", className: "dndev-collapsible-trigger", children: [trigger, iconStyle === 'chevron' ? (_jsx(ChevronDown, { className: "dndev-collapsible-icon dndev-collapsible-chevron", "aria-hidden": "true" })) : (_jsx(IconComponent, { className: "dndev-collapsible-icon", "aria-hidden": "true" }))] }) }));
|
|
51
|
+
}
|
|
52
|
+
return _jsx(CollapsibleTrigger, { asChild: true, children: trigger });
|
|
53
|
+
};
|
|
54
|
+
return (_jsxs(CollapsiblePrimitive, { open: isControlled ? open : undefined, onOpenChange: handleOpenChange, defaultOpen: isControlled ? undefined : defaultOpen, disabled: disabled, className: cn('dndev-collapsible', className), children: [renderTrigger(), _jsx(CollapsibleContent, { className: cn('dndev-collapsible-content', className), children: children })] }));
|
|
50
55
|
}
|
|
51
56
|
export default Collapsible;
|
|
52
|
-
export { collapsibleVariants };
|
|
@@ -56,7 +56,7 @@ const HeroSection = forwardRef(function HeroSection({ as = 'section', badge, tit
|
|
|
56
56
|
...props.style,
|
|
57
57
|
},
|
|
58
58
|
...props,
|
|
59
|
-
}, _jsxs(Stack, { gap: "medium", children: [badge && _jsx(Badge, { variant: BADGE_VARIANT.ACCENT, children: badge }), title && (_jsx(Text, { as: "
|
|
59
|
+
}, _jsxs(Stack, { gap: "medium", children: [badge && _jsx(Badge, { variant: BADGE_VARIANT.ACCENT, children: badge }), title && (_jsx(Text, { as: "div", level: "h1", className: "dndev-hero-title", "data-gradient-text": variant === 'subtle' ? undefined : variant || 'primary', children: title })), subtitle && (_jsx(Text, { as: "p", level: "body", className: "dndev-hero-subtitle", children: subtitle })), children] }));
|
|
60
60
|
});
|
|
61
61
|
HeroSection.displayName = 'HeroSection';
|
|
62
62
|
export default HeroSection;
|
|
@@ -18,9 +18,15 @@
|
|
|
18
18
|
* <Card />
|
|
19
19
|
* <Card />
|
|
20
20
|
* </Section>
|
|
21
|
+
*
|
|
22
|
+
* // Collapsible section
|
|
23
|
+
* <Section title="Details" collapsible defaultOpen={false}>
|
|
24
|
+
* <Card />
|
|
25
|
+
* <Card />
|
|
26
|
+
* </Section>
|
|
21
27
|
* ```
|
|
22
28
|
*
|
|
23
|
-
* @version 0.0.
|
|
29
|
+
* @version 0.0.5
|
|
24
30
|
* @since 0.0.1
|
|
25
31
|
* @author AMBROISE PARK Consulting
|
|
26
32
|
*/
|
|
@@ -61,6 +67,24 @@ interface SectionOwnProps {
|
|
|
61
67
|
* @default 'medium'
|
|
62
68
|
*/
|
|
63
69
|
gridGap?: 'none' | 'tight' | 'medium' | 'large';
|
|
70
|
+
/**
|
|
71
|
+
* Whether the section is collapsible
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
collapsible?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Controlled open state (when collapsible)
|
|
77
|
+
*/
|
|
78
|
+
open?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Callback when open state changes (when collapsible)
|
|
81
|
+
*/
|
|
82
|
+
onOpenChange?: (open: boolean) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Default open state (uncontrolled, when collapsible)
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
defaultOpen?: boolean;
|
|
64
88
|
}
|
|
65
89
|
/**
|
|
66
90
|
* Polymorphic Section props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Section/index.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Section/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH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AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -20,18 +20,27 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
20
20
|
* <Card />
|
|
21
21
|
* <Card />
|
|
22
22
|
* </Section>
|
|
23
|
+
*
|
|
24
|
+
* // Collapsible section
|
|
25
|
+
* <Section title="Details" collapsible defaultOpen={false}>
|
|
26
|
+
* <Card />
|
|
27
|
+
* <Card />
|
|
28
|
+
* </Section>
|
|
23
29
|
* ```
|
|
24
30
|
*
|
|
25
|
-
* @version 0.0.
|
|
31
|
+
* @version 0.0.5
|
|
26
32
|
* @since 0.0.1
|
|
27
33
|
* @author AMBROISE PARK Consulting
|
|
28
34
|
*/
|
|
29
|
-
import { createElement, forwardRef, } from 'react';
|
|
35
|
+
import { createElement, forwardRef, useState, } from 'react';
|
|
36
|
+
import { Plus, Minus } from 'lucide-react';
|
|
30
37
|
import { GAP_VARIANT } from '../../styles/componentConstants';
|
|
31
38
|
import { cn } from '../../utils/helpers';
|
|
32
39
|
import Grid, {} from '../Grid';
|
|
33
40
|
import Separator, { SEPARATOR_VARIANT } from '../Separator';
|
|
34
41
|
import Text from '../Text';
|
|
42
|
+
import Stack from '../Stack';
|
|
43
|
+
import CollapsiblePrimitive, { CollapsibleTrigger, CollapsibleContent, } from '../Collapsible/CollapsiblePrimitive';
|
|
35
44
|
import './Section.css';
|
|
36
45
|
/**
|
|
37
46
|
* Minimal layout section with title, optional separator, and tone backgrounds.
|
|
@@ -46,9 +55,19 @@ import './Section.css';
|
|
|
46
55
|
* </Section>
|
|
47
56
|
* ```
|
|
48
57
|
*/
|
|
49
|
-
const Section = forwardRef(function Section({ as = 'section', children, title, separator = false, tone = 'base', align: textAlign = 'center', gridCols, gridGap, className, ...props }, ref) {
|
|
58
|
+
const Section = forwardRef(function Section({ as = 'section', children, title, separator = false, tone = 'base', align: textAlign = 'center', gridCols, gridGap, collapsible = false, open, onOpenChange, defaultOpen = false, className, ...props }, ref) {
|
|
50
59
|
const Component = as;
|
|
60
|
+
const [internalOpen, setInternalOpen] = useState(() => collapsible ? defaultOpen : false);
|
|
61
|
+
const isControlled = collapsible && open !== undefined;
|
|
62
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
63
|
+
const handleOpenChange = isControlled
|
|
64
|
+
? onOpenChange
|
|
65
|
+
: setInternalOpen;
|
|
51
66
|
const content = gridCols ? (_jsx(Grid, { cols: gridCols, gap: gridGap || GAP_VARIANT.MEDIUM, children: children })) : (children);
|
|
67
|
+
const titleElement = title && (collapsible ? (_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Stack, { as: "div", direction: "row", align: "center", justify: "between", className: "dndev-section-title-trigger", children: [_jsx(Text, { as: "div", level: "h2", className: "dndev-section-title", children: title }), isOpen ? (_jsx(Minus, { className: "dndev-section-icon", "aria-hidden": "true" })) : (_jsx(Plus, { className: "dndev-section-icon", "aria-hidden": "true" }))] }) })) : (_jsx(Text, { as: "div", level: "h2", className: "dndev-section-title", children: title })));
|
|
68
|
+
const sectionContent = collapsible ? (_jsxs(CollapsiblePrimitive, { ...(isControlled
|
|
69
|
+
? { open: isOpen, onOpenChange: handleOpenChange }
|
|
70
|
+
: { defaultOpen: defaultOpen, onOpenChange: handleOpenChange }), children: [titleElement, _jsx(CollapsibleContent, { className: "dndev-collapsible-content", children: content })] })) : (_jsxs(_Fragment, { children: [titleElement, content] }));
|
|
52
71
|
return createElement(Component, {
|
|
53
72
|
ref,
|
|
54
73
|
'aria-label': props['aria-label'],
|
|
@@ -56,7 +75,7 @@ const Section = forwardRef(function Section({ as = 'section', children, title, s
|
|
|
56
75
|
'data-tone': tone,
|
|
57
76
|
'data-text-align': textAlign,
|
|
58
77
|
...props,
|
|
59
|
-
}, _jsxs(_Fragment, { children: [separator && _jsx(Separator, { variant: SEPARATOR_VARIANT.ACCENT }),
|
|
78
|
+
}, _jsxs(_Fragment, { children: [separator && _jsx(Separator, { variant: SEPARATOR_VARIANT.ACCENT }), _jsx("div", { className: "dndev-section-content", children: sectionContent })] }));
|
|
60
79
|
});
|
|
61
80
|
Section.displayName = 'Section';
|
|
62
81
|
export default Section;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Tooltip/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAyB,EAGvB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Tooltip/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAyB,EAGvB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AA4BD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,OAAO,GAAI,6DAOd,YAAY,4CA0Dd,CAAC;AAEF,eAAe,OAAO,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -27,8 +27,12 @@ function hasVisibleLabel(element) {
|
|
|
27
27
|
if (!(label instanceof HTMLElement))
|
|
28
28
|
return false;
|
|
29
29
|
// Modern browsers: use checkVisibility() - avoids forced reflow
|
|
30
|
-
if ('checkVisibility' in label &&
|
|
31
|
-
|
|
30
|
+
if ('checkVisibility' in label &&
|
|
31
|
+
typeof label.checkVisibility === 'function') {
|
|
32
|
+
return label.checkVisibility({
|
|
33
|
+
checkOpacity: true,
|
|
34
|
+
checkVisibilityCSS: true,
|
|
35
|
+
});
|
|
32
36
|
}
|
|
33
37
|
// Fallback: check if element is in DOM and not display:none
|
|
34
38
|
// offsetParent is null for hidden elements (still forces reflow but only in older browsers)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/VideoPlayer/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,eAAe;IACf,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,GAAG,CAAC,EAAE,MAAM,GA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GG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4JD,QAAA,MAAM,WAAW,GAAI,sGAWlB,gBAAgB,4CAwJlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -174,7 +174,9 @@ function createIntersectionObserver(options) {
|
|
|
174
174
|
const subscribe = (callback) => {
|
|
175
175
|
listeners.add(callback);
|
|
176
176
|
// If element is already set and we're on client, start observing
|
|
177
|
-
if (currentElement &&
|
|
177
|
+
if (currentElement &&
|
|
178
|
+
!intersectionObserver &&
|
|
179
|
+
typeof window !== 'undefined') {
|
|
178
180
|
intersectionObserver = new IntersectionObserver(handleIntersection, {
|
|
179
181
|
threshold,
|
|
180
182
|
root,
|