@particle-academy/react-fancy 2.6.0 → 2.7.1
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/index.cjs +23 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -6
- package/dist/index.d.ts +38 -6
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/docs/AccordionPanel.md +6 -0
- package/docs/Kanban.md +23 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -96,6 +96,14 @@ interface AccordionPanelSectionProps {
|
|
|
96
96
|
openClassName?: string;
|
|
97
97
|
/** Class applied only when the section is collapsed */
|
|
98
98
|
closedClassName?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Skip the default flex layout (items-center + gap-1 + flex-row/col).
|
|
101
|
+
* Use this for full-bleed panel sections that need their children
|
|
102
|
+
* to stretch (e.g. a chat sidebar where the trigger should fill
|
|
103
|
+
* full panel height). The data attributes, section context, and
|
|
104
|
+
* conditional render of children stay in place.
|
|
105
|
+
*/
|
|
106
|
+
unstyled?: boolean;
|
|
99
107
|
/**
|
|
100
108
|
* Children. Compose with `<AccordionPanel.Trigger>` and
|
|
101
109
|
* `<AccordionPanel.Content>` — Trigger always renders, Content only
|
|
@@ -125,7 +133,7 @@ interface AccordionPanelTriggerProps {
|
|
|
125
133
|
*
|
|
126
134
|
* Pinned sections never collapse and don't need a Trigger.
|
|
127
135
|
*/
|
|
128
|
-
declare function AccordionPanelSection({ id, pinned, className, openClassName, closedClassName, children, }: AccordionPanelSectionProps): react_jsx_runtime.JSX.Element;
|
|
136
|
+
declare function AccordionPanelSection({ id, pinned, className, openClassName, closedClassName, unstyled, children, }: AccordionPanelSectionProps): react_jsx_runtime.JSX.Element;
|
|
129
137
|
declare namespace AccordionPanelSection {
|
|
130
138
|
var displayName: string;
|
|
131
139
|
}
|
|
@@ -153,16 +161,28 @@ declare namespace AccordionPanelTrigger {
|
|
|
153
161
|
interface AccordionPanelContentProps {
|
|
154
162
|
children: ReactNode;
|
|
155
163
|
className?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Skip the default flex-row/flex-col + items-center + gap classes so the
|
|
166
|
+
* consumer can lay out the open-state content however they want (e.g. a
|
|
167
|
+
* full-height chat panel with header/scroll/input rows). The
|
|
168
|
+
* `data-react-fancy-accordion-content` attribute and conditional render
|
|
169
|
+
* (only when the section is open) are kept.
|
|
170
|
+
*/
|
|
171
|
+
unstyled?: boolean;
|
|
156
172
|
}
|
|
157
173
|
/**
|
|
158
174
|
* Wrapper for the open-state content of a Section. Renders its children
|
|
159
175
|
* only when the parent Section is open; returns `null` otherwise.
|
|
160
176
|
*
|
|
161
177
|
* Use this so siblings of `<AccordionPanel.Trigger>` inside a section can
|
|
162
|
-
* cleanly toggle in/out of the DOM.
|
|
163
|
-
*
|
|
178
|
+
* cleanly toggle in/out of the DOM.
|
|
179
|
+
*
|
|
180
|
+
* The default styling assumes an inline cluster — flex row (horizontal
|
|
181
|
+
* orientation) or column (vertical), centered, with a small gap. For panel
|
|
182
|
+
* use cases where the content needs full-bleed layout (chat panes, canvas
|
|
183
|
+
* surfaces, etc.), pass `unstyled` and supply your own className.
|
|
164
184
|
*/
|
|
165
|
-
declare function AccordionPanelContent({ children, className, }: AccordionPanelContentProps): react_jsx_runtime.JSX.Element | null;
|
|
185
|
+
declare function AccordionPanelContent({ children, className, unstyled, }: AccordionPanelContentProps): react_jsx_runtime.JSX.Element | null;
|
|
166
186
|
declare namespace AccordionPanelContent {
|
|
167
187
|
var displayName: string;
|
|
168
188
|
}
|
|
@@ -2049,19 +2069,31 @@ interface KanbanColumnProps {
|
|
|
2049
2069
|
id: string;
|
|
2050
2070
|
title?: string;
|
|
2051
2071
|
className?: string;
|
|
2072
|
+
/**
|
|
2073
|
+
* Skip the column's default visuals (background, padding, min-height, fixed
|
|
2074
|
+
* width) so the consumer can render their own surface around the children.
|
|
2075
|
+
* Drop-target behaviour, drag-over ring, and column id wiring are kept.
|
|
2076
|
+
*/
|
|
2077
|
+
unstyled?: boolean;
|
|
2052
2078
|
}
|
|
2053
2079
|
interface KanbanCardProps {
|
|
2054
2080
|
children: ReactNode;
|
|
2055
2081
|
id: string;
|
|
2056
2082
|
className?: string;
|
|
2083
|
+
/**
|
|
2084
|
+
* Skip the card's default visuals (border, padding, shadow, hover styles).
|
|
2085
|
+
* Drag handlers and the `draggable` attribute remain so a consumer can
|
|
2086
|
+
* wrap their own Card / Surface inside.
|
|
2087
|
+
*/
|
|
2088
|
+
unstyled?: boolean;
|
|
2057
2089
|
}
|
|
2058
2090
|
|
|
2059
|
-
declare function KanbanColumn({ children, id, title, className, }: KanbanColumnProps): react_jsx_runtime.JSX.Element;
|
|
2091
|
+
declare function KanbanColumn({ children, id, title, className, unstyled, }: KanbanColumnProps): react_jsx_runtime.JSX.Element;
|
|
2060
2092
|
declare namespace KanbanColumn {
|
|
2061
2093
|
var displayName: string;
|
|
2062
2094
|
}
|
|
2063
2095
|
|
|
2064
|
-
declare function KanbanCard({ children, id, className }: KanbanCardProps): react_jsx_runtime.JSX.Element;
|
|
2096
|
+
declare function KanbanCard({ children, id, className, unstyled }: KanbanCardProps): react_jsx_runtime.JSX.Element;
|
|
2065
2097
|
declare namespace KanbanCard {
|
|
2066
2098
|
var displayName: string;
|
|
2067
2099
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,14 @@ interface AccordionPanelSectionProps {
|
|
|
96
96
|
openClassName?: string;
|
|
97
97
|
/** Class applied only when the section is collapsed */
|
|
98
98
|
closedClassName?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Skip the default flex layout (items-center + gap-1 + flex-row/col).
|
|
101
|
+
* Use this for full-bleed panel sections that need their children
|
|
102
|
+
* to stretch (e.g. a chat sidebar where the trigger should fill
|
|
103
|
+
* full panel height). The data attributes, section context, and
|
|
104
|
+
* conditional render of children stay in place.
|
|
105
|
+
*/
|
|
106
|
+
unstyled?: boolean;
|
|
99
107
|
/**
|
|
100
108
|
* Children. Compose with `<AccordionPanel.Trigger>` and
|
|
101
109
|
* `<AccordionPanel.Content>` — Trigger always renders, Content only
|
|
@@ -125,7 +133,7 @@ interface AccordionPanelTriggerProps {
|
|
|
125
133
|
*
|
|
126
134
|
* Pinned sections never collapse and don't need a Trigger.
|
|
127
135
|
*/
|
|
128
|
-
declare function AccordionPanelSection({ id, pinned, className, openClassName, closedClassName, children, }: AccordionPanelSectionProps): react_jsx_runtime.JSX.Element;
|
|
136
|
+
declare function AccordionPanelSection({ id, pinned, className, openClassName, closedClassName, unstyled, children, }: AccordionPanelSectionProps): react_jsx_runtime.JSX.Element;
|
|
129
137
|
declare namespace AccordionPanelSection {
|
|
130
138
|
var displayName: string;
|
|
131
139
|
}
|
|
@@ -153,16 +161,28 @@ declare namespace AccordionPanelTrigger {
|
|
|
153
161
|
interface AccordionPanelContentProps {
|
|
154
162
|
children: ReactNode;
|
|
155
163
|
className?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Skip the default flex-row/flex-col + items-center + gap classes so the
|
|
166
|
+
* consumer can lay out the open-state content however they want (e.g. a
|
|
167
|
+
* full-height chat panel with header/scroll/input rows). The
|
|
168
|
+
* `data-react-fancy-accordion-content` attribute and conditional render
|
|
169
|
+
* (only when the section is open) are kept.
|
|
170
|
+
*/
|
|
171
|
+
unstyled?: boolean;
|
|
156
172
|
}
|
|
157
173
|
/**
|
|
158
174
|
* Wrapper for the open-state content of a Section. Renders its children
|
|
159
175
|
* only when the parent Section is open; returns `null` otherwise.
|
|
160
176
|
*
|
|
161
177
|
* Use this so siblings of `<AccordionPanel.Trigger>` inside a section can
|
|
162
|
-
* cleanly toggle in/out of the DOM.
|
|
163
|
-
*
|
|
178
|
+
* cleanly toggle in/out of the DOM.
|
|
179
|
+
*
|
|
180
|
+
* The default styling assumes an inline cluster — flex row (horizontal
|
|
181
|
+
* orientation) or column (vertical), centered, with a small gap. For panel
|
|
182
|
+
* use cases where the content needs full-bleed layout (chat panes, canvas
|
|
183
|
+
* surfaces, etc.), pass `unstyled` and supply your own className.
|
|
164
184
|
*/
|
|
165
|
-
declare function AccordionPanelContent({ children, className, }: AccordionPanelContentProps): react_jsx_runtime.JSX.Element | null;
|
|
185
|
+
declare function AccordionPanelContent({ children, className, unstyled, }: AccordionPanelContentProps): react_jsx_runtime.JSX.Element | null;
|
|
166
186
|
declare namespace AccordionPanelContent {
|
|
167
187
|
var displayName: string;
|
|
168
188
|
}
|
|
@@ -2049,19 +2069,31 @@ interface KanbanColumnProps {
|
|
|
2049
2069
|
id: string;
|
|
2050
2070
|
title?: string;
|
|
2051
2071
|
className?: string;
|
|
2072
|
+
/**
|
|
2073
|
+
* Skip the column's default visuals (background, padding, min-height, fixed
|
|
2074
|
+
* width) so the consumer can render their own surface around the children.
|
|
2075
|
+
* Drop-target behaviour, drag-over ring, and column id wiring are kept.
|
|
2076
|
+
*/
|
|
2077
|
+
unstyled?: boolean;
|
|
2052
2078
|
}
|
|
2053
2079
|
interface KanbanCardProps {
|
|
2054
2080
|
children: ReactNode;
|
|
2055
2081
|
id: string;
|
|
2056
2082
|
className?: string;
|
|
2083
|
+
/**
|
|
2084
|
+
* Skip the card's default visuals (border, padding, shadow, hover styles).
|
|
2085
|
+
* Drag handlers and the `draggable` attribute remain so a consumer can
|
|
2086
|
+
* wrap their own Card / Surface inside.
|
|
2087
|
+
*/
|
|
2088
|
+
unstyled?: boolean;
|
|
2057
2089
|
}
|
|
2058
2090
|
|
|
2059
|
-
declare function KanbanColumn({ children, id, title, className, }: KanbanColumnProps): react_jsx_runtime.JSX.Element;
|
|
2091
|
+
declare function KanbanColumn({ children, id, title, className, unstyled, }: KanbanColumnProps): react_jsx_runtime.JSX.Element;
|
|
2060
2092
|
declare namespace KanbanColumn {
|
|
2061
2093
|
var displayName: string;
|
|
2062
2094
|
}
|
|
2063
2095
|
|
|
2064
|
-
declare function KanbanCard({ children, id, className }: KanbanCardProps): react_jsx_runtime.JSX.Element;
|
|
2096
|
+
declare function KanbanCard({ children, id, className, unstyled }: KanbanCardProps): react_jsx_runtime.JSX.Element;
|
|
2065
2097
|
declare namespace KanbanCard {
|
|
2066
2098
|
var displayName: string;
|
|
2067
2099
|
}
|
package/dist/index.js
CHANGED
|
@@ -2600,6 +2600,7 @@ function AccordionPanelSection({
|
|
|
2600
2600
|
className,
|
|
2601
2601
|
openClassName,
|
|
2602
2602
|
closedClassName,
|
|
2603
|
+
unstyled,
|
|
2603
2604
|
children
|
|
2604
2605
|
}) {
|
|
2605
2606
|
const panel = useAccordionPanel();
|
|
@@ -2624,7 +2625,8 @@ function AccordionPanelSection({
|
|
|
2624
2625
|
"data-pinned": pinned ? "" : void 0,
|
|
2625
2626
|
"data-orientation": orientation,
|
|
2626
2627
|
className: cn(
|
|
2627
|
-
"flex shrink-0
|
|
2628
|
+
"flex shrink-0",
|
|
2629
|
+
!unstyled && "items-center gap-1",
|
|
2628
2630
|
orientation === "horizontal" ? "flex-row" : "flex-col",
|
|
2629
2631
|
className,
|
|
2630
2632
|
open ? openClassName : closedClassName
|
|
@@ -2670,10 +2672,12 @@ function AccordionPanelTrigger({
|
|
|
2670
2672
|
"group relative flex shrink-0 items-center justify-center cursor-pointer",
|
|
2671
2673
|
"text-zinc-500 dark:text-zinc-500",
|
|
2672
2674
|
"hover:text-zinc-900 dark:hover:text-zinc-100",
|
|
2673
|
-
|
|
2674
|
-
"
|
|
2675
|
-
|
|
2676
|
-
"transition-
|
|
2675
|
+
// Wide hitbox + thin visible line (drawn via ::before).
|
|
2676
|
+
orientation === "horizontal" ? "w-3 self-stretch" : "h-3 self-stretch",
|
|
2677
|
+
"before:absolute before:bg-zinc-200 dark:before:bg-zinc-700",
|
|
2678
|
+
"before:transition-colors group-hover:before:bg-zinc-400 dark:group-hover:before:bg-zinc-500",
|
|
2679
|
+
orientation === "horizontal" ? "before:top-0 before:bottom-0 before:w-px before:left-1/2 before:-translate-x-1/2" : "before:left-0 before:right-0 before:h-px before:top-1/2 before:-translate-y-1/2",
|
|
2680
|
+
"transition-colors",
|
|
2677
2681
|
className
|
|
2678
2682
|
),
|
|
2679
2683
|
children: /* @__PURE__ */ jsx(
|
|
@@ -2736,7 +2740,8 @@ function ChevronIcon({
|
|
|
2736
2740
|
}
|
|
2737
2741
|
function AccordionPanelContent({
|
|
2738
2742
|
children,
|
|
2739
|
-
className
|
|
2743
|
+
className,
|
|
2744
|
+
unstyled
|
|
2740
2745
|
}) {
|
|
2741
2746
|
const { open, orientation } = useAccordionSection();
|
|
2742
2747
|
if (!open) return null;
|
|
@@ -2746,8 +2751,8 @@ function AccordionPanelContent({
|
|
|
2746
2751
|
"data-react-fancy-accordion-content": "",
|
|
2747
2752
|
"data-orientation": orientation,
|
|
2748
2753
|
className: cn(
|
|
2749
|
-
"flex items-center gap-1",
|
|
2750
|
-
orientation === "horizontal" ? "flex-row" : "flex-col",
|
|
2754
|
+
!unstyled && "flex items-center gap-1",
|
|
2755
|
+
!unstyled && (orientation === "horizontal" ? "flex-row" : "flex-col"),
|
|
2751
2756
|
className
|
|
2752
2757
|
),
|
|
2753
2758
|
children
|
|
@@ -11108,11 +11113,13 @@ var KanbanColumnContext = createContext("");
|
|
|
11108
11113
|
function useKanbanColumn() {
|
|
11109
11114
|
return useContext(KanbanColumnContext);
|
|
11110
11115
|
}
|
|
11116
|
+
var DEFAULT_COLUMN_CLASSES = "min-h-[200px] w-72 rounded-xl bg-zinc-50 p-3 dark:bg-zinc-800/50";
|
|
11111
11117
|
function KanbanColumn({
|
|
11112
11118
|
children,
|
|
11113
11119
|
id,
|
|
11114
11120
|
title,
|
|
11115
|
-
className
|
|
11121
|
+
className,
|
|
11122
|
+
unstyled
|
|
11116
11123
|
}) {
|
|
11117
11124
|
const { onCardMove, draggedCard, dragSource } = useKanban();
|
|
11118
11125
|
const [dragOver, setDragOver] = useState(false);
|
|
@@ -11139,7 +11146,8 @@ function KanbanColumn({
|
|
|
11139
11146
|
onDragOver: handleDragOver,
|
|
11140
11147
|
onDragLeave: handleDragLeave,
|
|
11141
11148
|
className: cn(
|
|
11142
|
-
"flex
|
|
11149
|
+
"flex flex-col",
|
|
11150
|
+
!unstyled && DEFAULT_COLUMN_CLASSES,
|
|
11143
11151
|
dragOver && "ring-2 ring-blue-400 ring-inset",
|
|
11144
11152
|
className
|
|
11145
11153
|
),
|
|
@@ -11151,7 +11159,8 @@ function KanbanColumn({
|
|
|
11151
11159
|
) });
|
|
11152
11160
|
}
|
|
11153
11161
|
KanbanColumn.displayName = "KanbanColumn";
|
|
11154
|
-
|
|
11162
|
+
var DEFAULT_CARD_CLASSES = "rounded-lg border border-zinc-200 bg-white p-3 shadow-sm transition-shadow hover:shadow-md dark:border-zinc-700 dark:bg-zinc-900";
|
|
11163
|
+
function KanbanCard({ children, id, className, unstyled }) {
|
|
11155
11164
|
const { setDraggedCard, setDragSource } = useKanban();
|
|
11156
11165
|
const columnId = useKanbanColumn();
|
|
11157
11166
|
const handleDragStart = useCallback(() => {
|
|
@@ -11170,7 +11179,9 @@ function KanbanCard({ children, id, className }) {
|
|
|
11170
11179
|
onDragStart: handleDragStart,
|
|
11171
11180
|
onDragEnd: handleDragEnd,
|
|
11172
11181
|
className: cn(
|
|
11173
|
-
|
|
11182
|
+
// Drag affordance — kept even when unstyled so users still see grab cursors.
|
|
11183
|
+
"cursor-grab active:cursor-grabbing",
|
|
11184
|
+
!unstyled && DEFAULT_CARD_CLASSES,
|
|
11174
11185
|
className
|
|
11175
11186
|
),
|
|
11176
11187
|
children
|