@refraction-ui/react 0.15.0 → 0.16.0
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 +558 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +547 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/kanban-board/index.d.ts +98 -0
- package/dist/internal/react-kanban-board/index.d.ts +71 -0
- package/dist/internal/react-slot-picker/index.d.ts +31 -0
- package/dist/internal/react-sortable-list/index.d.ts +35 -0
- package/dist/internal/slot-picker/index.d.ts +77 -0
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -113,3 +113,6 @@ export * from './internal/react-marquee-strip/index.cjs';
|
|
|
113
113
|
export * from './internal/react-browser-chrome-mock/index.cjs';
|
|
114
114
|
export * from './internal/react-mastery-bar/index.cjs';
|
|
115
115
|
export * from './internal/react-audience-feature-card/index.cjs';
|
|
116
|
+
export * from './internal/react-sortable-list/index.cjs';
|
|
117
|
+
export * from './internal/react-kanban-board/index.cjs';
|
|
118
|
+
export * from './internal/react-slot-picker/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -113,3 +113,6 @@ export * from './internal/react-marquee-strip/index.js';
|
|
|
113
113
|
export * from './internal/react-browser-chrome-mock/index.js';
|
|
114
114
|
export * from './internal/react-mastery-bar/index.js';
|
|
115
115
|
export * from './internal/react-audience-feature-card/index.js';
|
|
116
|
+
export * from './internal/react-sortable-list/index.js';
|
|
117
|
+
export * from './internal/react-kanban-board/index.js';
|
|
118
|
+
export * from './internal/react-slot-picker/index.js';
|
package/dist/index.js
CHANGED
|
@@ -21870,6 +21870,552 @@ var AudienceFeatureCard = React11.forwardRef(({ kicker, title, body, footer, cla
|
|
|
21870
21870
|
});
|
|
21871
21871
|
AudienceFeatureCard.displayName = "AudienceFeatureCard";
|
|
21872
21872
|
|
|
21873
|
-
|
|
21873
|
+
// ../sortable-list/dist/index.js
|
|
21874
|
+
function reorder(items, from, to) {
|
|
21875
|
+
const len = items.length;
|
|
21876
|
+
if (len === 0 || from < 0 || from >= len || to < 0 || to >= len || from === to) {
|
|
21877
|
+
return [...items];
|
|
21878
|
+
}
|
|
21879
|
+
const result = [...items];
|
|
21880
|
+
const [moved] = result.splice(from, 1);
|
|
21881
|
+
result.splice(to, 0, moved);
|
|
21882
|
+
return result;
|
|
21883
|
+
}
|
|
21884
|
+
function getNextOrderIndex(current, key, count) {
|
|
21885
|
+
if (count <= 0) return current;
|
|
21886
|
+
const clamped = Math.max(0, Math.min(current, count - 1));
|
|
21887
|
+
switch (key) {
|
|
21888
|
+
case "ArrowUp":
|
|
21889
|
+
case "ArrowLeft":
|
|
21890
|
+
return Math.max(0, clamped - 1);
|
|
21891
|
+
case "ArrowDown":
|
|
21892
|
+
case "ArrowRight":
|
|
21893
|
+
return Math.min(count - 1, clamped + 1);
|
|
21894
|
+
case "Home":
|
|
21895
|
+
return 0;
|
|
21896
|
+
case "End":
|
|
21897
|
+
return count - 1;
|
|
21898
|
+
default:
|
|
21899
|
+
return clamped;
|
|
21900
|
+
}
|
|
21901
|
+
}
|
|
21902
|
+
function createSortableList() {
|
|
21903
|
+
return {
|
|
21904
|
+
ariaProps: {
|
|
21905
|
+
role: "list"
|
|
21906
|
+
},
|
|
21907
|
+
dataAttributes: {
|
|
21908
|
+
"data-component": "sortable-list"
|
|
21909
|
+
}
|
|
21910
|
+
};
|
|
21911
|
+
}
|
|
21912
|
+
var sortableListVariants = cva({
|
|
21913
|
+
base: "flex flex-col gap-1 w-full",
|
|
21914
|
+
variants: {
|
|
21915
|
+
disabled: {
|
|
21916
|
+
true: "opacity-50 pointer-events-none",
|
|
21917
|
+
false: ""
|
|
21918
|
+
}
|
|
21919
|
+
},
|
|
21920
|
+
defaultVariants: {
|
|
21921
|
+
disabled: "false"
|
|
21922
|
+
}
|
|
21923
|
+
});
|
|
21924
|
+
var sortableListRowVariants = cva({
|
|
21925
|
+
base: [
|
|
21926
|
+
"flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2",
|
|
21927
|
+
"transition-opacity"
|
|
21928
|
+
].join(" "),
|
|
21929
|
+
variants: {
|
|
21930
|
+
dragging: {
|
|
21931
|
+
true: "opacity-50 ring-2 ring-ring",
|
|
21932
|
+
false: ""
|
|
21933
|
+
}
|
|
21934
|
+
},
|
|
21935
|
+
defaultVariants: {
|
|
21936
|
+
dragging: "false"
|
|
21937
|
+
}
|
|
21938
|
+
});
|
|
21939
|
+
var sortableListGripClass = "cursor-grab text-muted-foreground shrink-0 flex items-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded";
|
|
21940
|
+
var sortableListContentClass = "flex-1 min-w-0";
|
|
21941
|
+
function SortableListInner({
|
|
21942
|
+
items,
|
|
21943
|
+
getKey,
|
|
21944
|
+
renderItem,
|
|
21945
|
+
onReorder,
|
|
21946
|
+
disabled = false,
|
|
21947
|
+
className,
|
|
21948
|
+
...props
|
|
21949
|
+
}, ref) {
|
|
21950
|
+
const dragFromRef = React11.useRef(null);
|
|
21951
|
+
const [draggingIndex, setDraggingIndex] = React11.useState(null);
|
|
21952
|
+
const { ariaProps, dataAttributes } = createSortableList();
|
|
21953
|
+
const handleDragStart = (index) => (event) => {
|
|
21954
|
+
if (disabled) {
|
|
21955
|
+
event.preventDefault();
|
|
21956
|
+
return;
|
|
21957
|
+
}
|
|
21958
|
+
dragFromRef.current = index;
|
|
21959
|
+
setDraggingIndex(index);
|
|
21960
|
+
event.dataTransfer.effectAllowed = "move";
|
|
21961
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
21962
|
+
};
|
|
21963
|
+
const handleDragOver = (event) => {
|
|
21964
|
+
event.preventDefault();
|
|
21965
|
+
event.dataTransfer.dropEffect = "move";
|
|
21966
|
+
};
|
|
21967
|
+
const handleDragEnter = (toIndex) => (event) => {
|
|
21968
|
+
event.preventDefault();
|
|
21969
|
+
if (disabled || dragFromRef.current === null || dragFromRef.current === toIndex) return;
|
|
21970
|
+
const next = reorder(items, dragFromRef.current, toIndex);
|
|
21971
|
+
dragFromRef.current = toIndex;
|
|
21972
|
+
setDraggingIndex(toIndex);
|
|
21973
|
+
onReorder?.(next);
|
|
21974
|
+
};
|
|
21975
|
+
const handleDrop = (event) => {
|
|
21976
|
+
event.preventDefault();
|
|
21977
|
+
};
|
|
21978
|
+
const handleDragEnd = () => {
|
|
21979
|
+
dragFromRef.current = null;
|
|
21980
|
+
setDraggingIndex(null);
|
|
21981
|
+
};
|
|
21982
|
+
const handleGripKeyDown = (index) => (event) => {
|
|
21983
|
+
if (disabled) return;
|
|
21984
|
+
const next = getNextOrderIndex(index, event.key, items.length);
|
|
21985
|
+
if (next !== index) {
|
|
21986
|
+
event.preventDefault();
|
|
21987
|
+
onReorder?.(reorder(items, index, next));
|
|
21988
|
+
}
|
|
21989
|
+
};
|
|
21990
|
+
return /* @__PURE__ */ jsx(
|
|
21991
|
+
"div",
|
|
21992
|
+
{
|
|
21993
|
+
ref,
|
|
21994
|
+
className: cn(sortableListVariants({ disabled: disabled ? "true" : "false" }), className),
|
|
21995
|
+
...ariaProps,
|
|
21996
|
+
...dataAttributes,
|
|
21997
|
+
...props,
|
|
21998
|
+
children: items.map((item, index) => {
|
|
21999
|
+
const key = getKey(item, index);
|
|
22000
|
+
const isDragging = draggingIndex === index;
|
|
22001
|
+
const dragHandleProps = {
|
|
22002
|
+
"aria-label": "Reorder item",
|
|
22003
|
+
role: "button",
|
|
22004
|
+
tabIndex: 0,
|
|
22005
|
+
onKeyDown: handleGripKeyDown(index),
|
|
22006
|
+
onDragStart: handleDragStart(index)
|
|
22007
|
+
};
|
|
22008
|
+
return /* @__PURE__ */ jsxs(
|
|
22009
|
+
"div",
|
|
22010
|
+
{
|
|
22011
|
+
role: "listitem",
|
|
22012
|
+
draggable: !disabled,
|
|
22013
|
+
className: sortableListRowVariants({ dragging: isDragging ? "true" : "false" }),
|
|
22014
|
+
onDragOver: handleDragOver,
|
|
22015
|
+
onDragEnter: handleDragEnter(index),
|
|
22016
|
+
onDrop: handleDrop,
|
|
22017
|
+
onDragEnd: handleDragEnd,
|
|
22018
|
+
children: [
|
|
22019
|
+
/* @__PURE__ */ jsx(
|
|
22020
|
+
"button",
|
|
22021
|
+
{
|
|
22022
|
+
type: "button",
|
|
22023
|
+
"aria-label": dragHandleProps["aria-label"],
|
|
22024
|
+
role: dragHandleProps.role,
|
|
22025
|
+
tabIndex: dragHandleProps.tabIndex,
|
|
22026
|
+
onKeyDown: dragHandleProps.onKeyDown,
|
|
22027
|
+
onDragStart: dragHandleProps.onDragStart,
|
|
22028
|
+
className: sortableListGripClass,
|
|
22029
|
+
draggable: !disabled,
|
|
22030
|
+
disabled,
|
|
22031
|
+
children: /* @__PURE__ */ jsx(
|
|
22032
|
+
"svg",
|
|
22033
|
+
{
|
|
22034
|
+
width: "16",
|
|
22035
|
+
height: "16",
|
|
22036
|
+
viewBox: "0 0 16 16",
|
|
22037
|
+
fill: "none",
|
|
22038
|
+
"aria-hidden": "true",
|
|
22039
|
+
children: /* @__PURE__ */ jsx(
|
|
22040
|
+
"path",
|
|
22041
|
+
{
|
|
22042
|
+
d: `M2 4h12M2 8h12M2 12h12`,
|
|
22043
|
+
stroke: "currentColor",
|
|
22044
|
+
strokeWidth: "1.5",
|
|
22045
|
+
strokeLinecap: "round"
|
|
22046
|
+
}
|
|
22047
|
+
)
|
|
22048
|
+
}
|
|
22049
|
+
)
|
|
22050
|
+
}
|
|
22051
|
+
),
|
|
22052
|
+
/* @__PURE__ */ jsx("div", { className: sortableListContentClass, children: renderItem(item, { index, dragHandleProps }) })
|
|
22053
|
+
]
|
|
22054
|
+
},
|
|
22055
|
+
key
|
|
22056
|
+
);
|
|
22057
|
+
})
|
|
22058
|
+
}
|
|
22059
|
+
);
|
|
22060
|
+
}
|
|
22061
|
+
var SortableList = React11.forwardRef(SortableListInner);
|
|
22062
|
+
SortableList.displayName = "SortableList";
|
|
22063
|
+
|
|
22064
|
+
// ../kanban-board/dist/index.js
|
|
22065
|
+
function createKanbanBoard() {
|
|
22066
|
+
return {
|
|
22067
|
+
ariaProps: {
|
|
22068
|
+
role: "group",
|
|
22069
|
+
"aria-label": "Board"
|
|
22070
|
+
},
|
|
22071
|
+
dataAttributes: {
|
|
22072
|
+
"data-component": "kanban-board"
|
|
22073
|
+
}
|
|
22074
|
+
};
|
|
22075
|
+
}
|
|
22076
|
+
function cardsByColumn(cards, getColumnId, columns) {
|
|
22077
|
+
const map = /* @__PURE__ */ new Map();
|
|
22078
|
+
for (const col of columns) {
|
|
22079
|
+
map.set(col.id, []);
|
|
22080
|
+
}
|
|
22081
|
+
for (const card of cards) {
|
|
22082
|
+
const colId = getColumnId(card);
|
|
22083
|
+
const bucket = map.get(colId);
|
|
22084
|
+
if (bucket !== void 0) {
|
|
22085
|
+
bucket.push(card);
|
|
22086
|
+
}
|
|
22087
|
+
}
|
|
22088
|
+
return map;
|
|
22089
|
+
}
|
|
22090
|
+
function visibleAndOverflow(cards, cap = 5) {
|
|
22091
|
+
if (cards.length <= cap) {
|
|
22092
|
+
return { visible: cards, overflow: 0 };
|
|
22093
|
+
}
|
|
22094
|
+
return { visible: cards.slice(0, cap), overflow: cards.length - cap };
|
|
22095
|
+
}
|
|
22096
|
+
var kanbanBoardVariants = cva({
|
|
22097
|
+
base: "flex flex-row gap-4 overflow-x-auto pb-4",
|
|
22098
|
+
variants: {},
|
|
22099
|
+
defaultVariants: {}
|
|
22100
|
+
});
|
|
22101
|
+
var kanbanColumnVariants = cva({
|
|
22102
|
+
base: "flex flex-col min-w-[260px] max-w-[300px] flex-shrink-0 rounded-xl bg-muted/40",
|
|
22103
|
+
variants: {},
|
|
22104
|
+
defaultVariants: {}
|
|
22105
|
+
});
|
|
22106
|
+
var kanbanColumnHeaderClass = "flex items-center gap-2 px-4 pt-4 pb-2";
|
|
22107
|
+
var kanbanColumnTitleClass = "flex-1 text-sm font-semibold text-foreground truncate";
|
|
22108
|
+
var kanbanColumnCountClass = "ml-auto inline-flex items-center justify-center rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";
|
|
22109
|
+
var kanbanAccentBarClass = "h-0.5 w-full";
|
|
22110
|
+
var kanbanNoteBarClass = "mx-4 mb-2 rounded-md bg-muted px-3 py-1.5 text-xs text-muted-foreground";
|
|
22111
|
+
var kanbanColumnBodyClass = "flex flex-col gap-2 px-3 pb-3";
|
|
22112
|
+
var kanbanOverflowButtonClass = [
|
|
22113
|
+
"mt-1 w-full rounded-lg border border-dashed border-border",
|
|
22114
|
+
"py-1.5 text-center text-xs text-muted-foreground",
|
|
22115
|
+
"transition-colors hover:bg-muted hover:text-foreground",
|
|
22116
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
22117
|
+
].join(" ");
|
|
22118
|
+
var kanbanCardVariants = cva({
|
|
22119
|
+
base: "rounded-lg border border-border bg-card p-3 text-sm text-foreground",
|
|
22120
|
+
variants: {
|
|
22121
|
+
clickable: {
|
|
22122
|
+
true: "cursor-pointer transition-colors hover:bg-muted/60",
|
|
22123
|
+
false: ""
|
|
22124
|
+
}
|
|
22125
|
+
},
|
|
22126
|
+
defaultVariants: {
|
|
22127
|
+
clickable: "false"
|
|
22128
|
+
}
|
|
22129
|
+
});
|
|
22130
|
+
var KanbanCard = React11.forwardRef(
|
|
22131
|
+
({ accent, clickable = false, className, style, children, ...props }, ref) => {
|
|
22132
|
+
const accentStyle = accent ? { borderTopColor: accent, borderTopWidth: "2px", ...style } : style ?? {};
|
|
22133
|
+
return /* @__PURE__ */ jsx(
|
|
22134
|
+
"div",
|
|
22135
|
+
{
|
|
22136
|
+
ref,
|
|
22137
|
+
className: cn(
|
|
22138
|
+
kanbanCardVariants({ clickable: clickable ? "true" : "false" }),
|
|
22139
|
+
className
|
|
22140
|
+
),
|
|
22141
|
+
style: accentStyle,
|
|
22142
|
+
...props,
|
|
22143
|
+
children
|
|
22144
|
+
}
|
|
22145
|
+
);
|
|
22146
|
+
}
|
|
22147
|
+
);
|
|
22148
|
+
KanbanCard.displayName = "KanbanCard";
|
|
22149
|
+
var KanbanColumn = React11.forwardRef(
|
|
22150
|
+
({ def, count, className, children, style, ...props }, ref) => {
|
|
22151
|
+
const derivedCount = count !== void 0 ? count : React11.Children.count(children);
|
|
22152
|
+
const colStyle = def.accent ? { "--kanban-accent": def.accent, ...style } : style ?? {};
|
|
22153
|
+
return /* @__PURE__ */ jsxs(
|
|
22154
|
+
"div",
|
|
22155
|
+
{
|
|
22156
|
+
ref,
|
|
22157
|
+
className: cn(kanbanColumnVariants(), className),
|
|
22158
|
+
style: colStyle,
|
|
22159
|
+
...props,
|
|
22160
|
+
children: [
|
|
22161
|
+
/* @__PURE__ */ jsxs("div", { className: kanbanColumnHeaderClass, children: [
|
|
22162
|
+
/* @__PURE__ */ jsx("span", { className: kanbanColumnTitleClass, children: def.title }),
|
|
22163
|
+
/* @__PURE__ */ jsx("span", { className: kanbanColumnCountClass, children: derivedCount })
|
|
22164
|
+
] }),
|
|
22165
|
+
/* @__PURE__ */ jsx(
|
|
22166
|
+
"div",
|
|
22167
|
+
{
|
|
22168
|
+
className: kanbanAccentBarClass,
|
|
22169
|
+
style: def.accent ? { backgroundColor: "var(--kanban-accent)" } : { backgroundColor: "transparent" },
|
|
22170
|
+
"aria-hidden": "true"
|
|
22171
|
+
}
|
|
22172
|
+
),
|
|
22173
|
+
def.note && /* @__PURE__ */ jsx("p", { className: kanbanNoteBarClass, children: def.note }),
|
|
22174
|
+
/* @__PURE__ */ jsx("div", { className: kanbanColumnBodyClass, children })
|
|
22175
|
+
]
|
|
22176
|
+
}
|
|
22177
|
+
);
|
|
22178
|
+
}
|
|
22179
|
+
);
|
|
22180
|
+
KanbanColumn.displayName = "KanbanColumn";
|
|
22181
|
+
function KanbanBoard({
|
|
22182
|
+
columns,
|
|
22183
|
+
cards,
|
|
22184
|
+
getCardColumnId,
|
|
22185
|
+
getCardKey,
|
|
22186
|
+
renderCard,
|
|
22187
|
+
cardCap = 5,
|
|
22188
|
+
onCardClick: _onCardClick,
|
|
22189
|
+
columnHeader,
|
|
22190
|
+
onShowMore,
|
|
22191
|
+
className,
|
|
22192
|
+
...props
|
|
22193
|
+
}) {
|
|
22194
|
+
const { ariaProps, dataAttributes } = createKanbanBoard();
|
|
22195
|
+
const buckets = cardsByColumn(cards, getCardColumnId, columns);
|
|
22196
|
+
return /* @__PURE__ */ jsx(
|
|
22197
|
+
"div",
|
|
22198
|
+
{
|
|
22199
|
+
className: cn(kanbanBoardVariants(), className),
|
|
22200
|
+
...ariaProps,
|
|
22201
|
+
...dataAttributes,
|
|
22202
|
+
...props,
|
|
22203
|
+
children: columns.map((def) => {
|
|
22204
|
+
const colCards = buckets.get(def.id) ?? [];
|
|
22205
|
+
const { visible, overflow } = visibleAndOverflow(colCards, cardCap);
|
|
22206
|
+
const count = colCards.length;
|
|
22207
|
+
const header = columnHeader ? columnHeader(def, count) : null;
|
|
22208
|
+
return /* @__PURE__ */ jsxs(
|
|
22209
|
+
"div",
|
|
22210
|
+
{
|
|
22211
|
+
className: kanbanColumnVariants(),
|
|
22212
|
+
style: def.accent ? { "--kanban-accent": def.accent } : void 0,
|
|
22213
|
+
children: [
|
|
22214
|
+
header ?? /* @__PURE__ */ jsxs("div", { className: kanbanColumnHeaderClass, children: [
|
|
22215
|
+
/* @__PURE__ */ jsx("span", { className: kanbanColumnTitleClass, children: def.title }),
|
|
22216
|
+
/* @__PURE__ */ jsx("span", { className: kanbanColumnCountClass, children: count })
|
|
22217
|
+
] }),
|
|
22218
|
+
/* @__PURE__ */ jsx(
|
|
22219
|
+
"div",
|
|
22220
|
+
{
|
|
22221
|
+
className: kanbanAccentBarClass,
|
|
22222
|
+
style: def.accent ? { backgroundColor: "var(--kanban-accent)" } : { backgroundColor: "transparent" },
|
|
22223
|
+
"aria-hidden": "true"
|
|
22224
|
+
}
|
|
22225
|
+
),
|
|
22226
|
+
def.note && /* @__PURE__ */ jsx("p", { className: kanbanNoteBarClass, children: def.note }),
|
|
22227
|
+
/* @__PURE__ */ jsxs("div", { className: kanbanColumnBodyClass, children: [
|
|
22228
|
+
visible.map((card) => /* @__PURE__ */ jsx(React11.Fragment, { children: renderCard(card, def) }, getCardKey(card))),
|
|
22229
|
+
overflow > 0 && /* @__PURE__ */ jsx(
|
|
22230
|
+
"button",
|
|
22231
|
+
{
|
|
22232
|
+
type: "button",
|
|
22233
|
+
className: kanbanOverflowButtonClass,
|
|
22234
|
+
onClick: () => onShowMore?.(def.id),
|
|
22235
|
+
children: `+${overflow} more`
|
|
22236
|
+
}
|
|
22237
|
+
)
|
|
22238
|
+
] })
|
|
22239
|
+
]
|
|
22240
|
+
},
|
|
22241
|
+
def.id
|
|
22242
|
+
);
|
|
22243
|
+
})
|
|
22244
|
+
}
|
|
22245
|
+
);
|
|
22246
|
+
}
|
|
22247
|
+
|
|
22248
|
+
// ../slot-picker/dist/index.js
|
|
22249
|
+
function slotsForDay(slotsByDay, dayId) {
|
|
22250
|
+
return slotsByDay[dayId] ?? [];
|
|
22251
|
+
}
|
|
22252
|
+
function isSlotSelected(value, dayId, slot) {
|
|
22253
|
+
return value?.dayId === dayId && value?.slot === slot;
|
|
22254
|
+
}
|
|
22255
|
+
function createSlotPicker() {
|
|
22256
|
+
return {
|
|
22257
|
+
ariaProps: {
|
|
22258
|
+
role: "group",
|
|
22259
|
+
"aria-label": "Pick a time"
|
|
22260
|
+
},
|
|
22261
|
+
dataAttributes: {
|
|
22262
|
+
"data-component": "slot-picker"
|
|
22263
|
+
}
|
|
22264
|
+
};
|
|
22265
|
+
}
|
|
22266
|
+
var slotPickerVariants = cva({
|
|
22267
|
+
base: "flex flex-col gap-4",
|
|
22268
|
+
variants: {},
|
|
22269
|
+
defaultVariants: {}
|
|
22270
|
+
});
|
|
22271
|
+
var slotPickerDayRowClass = "flex items-center gap-2 overflow-x-auto pb-1";
|
|
22272
|
+
var slotPickerDayVariants = cva({
|
|
22273
|
+
base: [
|
|
22274
|
+
"inline-flex flex-col items-center justify-center rounded-lg px-3 py-2 min-w-[3.5rem]",
|
|
22275
|
+
"text-sm font-medium cursor-pointer transition-colors",
|
|
22276
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
22277
|
+
"disabled:pointer-events-none disabled:opacity-50"
|
|
22278
|
+
].join(" "),
|
|
22279
|
+
variants: {
|
|
22280
|
+
selected: {
|
|
22281
|
+
true: "bg-primary text-primary-foreground",
|
|
22282
|
+
false: "bg-card border border-input text-foreground hover:bg-muted"
|
|
22283
|
+
}
|
|
22284
|
+
},
|
|
22285
|
+
defaultVariants: {
|
|
22286
|
+
selected: "false"
|
|
22287
|
+
}
|
|
22288
|
+
});
|
|
22289
|
+
var slotPickerGridClass = "grid grid-cols-3 gap-2 sm:grid-cols-4";
|
|
22290
|
+
var slotPickerSlotVariants = cva({
|
|
22291
|
+
base: [
|
|
22292
|
+
"inline-flex items-center justify-center rounded-md border px-3 py-2 text-sm font-medium",
|
|
22293
|
+
"transition-colors cursor-pointer",
|
|
22294
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
22295
|
+
].join(" "),
|
|
22296
|
+
variants: {
|
|
22297
|
+
selected: {
|
|
22298
|
+
true: "bg-primary text-primary-foreground border-primary",
|
|
22299
|
+
false: "bg-card border-input text-foreground hover:bg-muted"
|
|
22300
|
+
},
|
|
22301
|
+
disabled: {
|
|
22302
|
+
true: "opacity-40 pointer-events-none",
|
|
22303
|
+
false: ""
|
|
22304
|
+
}
|
|
22305
|
+
},
|
|
22306
|
+
defaultVariants: {
|
|
22307
|
+
selected: "false",
|
|
22308
|
+
disabled: "false"
|
|
22309
|
+
}
|
|
22310
|
+
});
|
|
22311
|
+
var slotPickerSectionLabelClass = "text-sm font-semibold text-foreground";
|
|
22312
|
+
var slotPickerTimezoneClass = "text-xs text-muted-foreground ml-2";
|
|
22313
|
+
var SlotPicker = React11.forwardRef(
|
|
22314
|
+
({
|
|
22315
|
+
days,
|
|
22316
|
+
slotsByDay,
|
|
22317
|
+
value: valueProp,
|
|
22318
|
+
defaultValue,
|
|
22319
|
+
onChange,
|
|
22320
|
+
timezoneLabel,
|
|
22321
|
+
disabledSlots = [],
|
|
22322
|
+
className,
|
|
22323
|
+
...props
|
|
22324
|
+
}, ref) => {
|
|
22325
|
+
const isControlled = valueProp !== void 0;
|
|
22326
|
+
const [internal, setInternal] = React11.useState(
|
|
22327
|
+
defaultValue
|
|
22328
|
+
);
|
|
22329
|
+
const value = isControlled ? valueProp : internal;
|
|
22330
|
+
const selectedDayId = value?.dayId;
|
|
22331
|
+
const handleDaySelect = React11.useCallback(
|
|
22332
|
+
(dayId) => {
|
|
22333
|
+
const slots = slotsForDay(slotsByDay, dayId);
|
|
22334
|
+
const keepSlot = value?.slot && slots.includes(value.slot) ? value.slot : void 0;
|
|
22335
|
+
const next = keepSlot ? { dayId, slot: keepSlot } : void 0;
|
|
22336
|
+
if (!isControlled) setInternal(next);
|
|
22337
|
+
if (next) onChange?.(next);
|
|
22338
|
+
},
|
|
22339
|
+
[isControlled, onChange, slotsByDay, value]
|
|
22340
|
+
);
|
|
22341
|
+
const handleSlotSelect = React11.useCallback(
|
|
22342
|
+
(slot) => {
|
|
22343
|
+
if (!selectedDayId) return;
|
|
22344
|
+
const next = { dayId: selectedDayId, slot };
|
|
22345
|
+
if (!isControlled) setInternal(next);
|
|
22346
|
+
onChange?.(next);
|
|
22347
|
+
},
|
|
22348
|
+
[isControlled, onChange, selectedDayId]
|
|
22349
|
+
);
|
|
22350
|
+
const api = createSlotPicker();
|
|
22351
|
+
const currentSlots = selectedDayId ? slotsForDay(slotsByDay, selectedDayId) : [];
|
|
22352
|
+
return /* @__PURE__ */ jsxs(
|
|
22353
|
+
"div",
|
|
22354
|
+
{
|
|
22355
|
+
ref,
|
|
22356
|
+
className: cn(slotPickerVariants(), className),
|
|
22357
|
+
...api.ariaProps,
|
|
22358
|
+
...api.dataAttributes,
|
|
22359
|
+
...props,
|
|
22360
|
+
children: [
|
|
22361
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
22362
|
+
/* @__PURE__ */ jsx("p", { className: slotPickerSectionLabelClass, children: "Pick a day" }),
|
|
22363
|
+
/* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": "Pick a day", className: cn(slotPickerDayRowClass, "mt-2"), children: days.map((day) => {
|
|
22364
|
+
const isSelected = selectedDayId === day.id;
|
|
22365
|
+
return /* @__PURE__ */ jsxs(
|
|
22366
|
+
"button",
|
|
22367
|
+
{
|
|
22368
|
+
type: "button",
|
|
22369
|
+
role: "radio",
|
|
22370
|
+
"aria-checked": isSelected,
|
|
22371
|
+
"data-state": isSelected ? "checked" : "unchecked",
|
|
22372
|
+
className: slotPickerDayVariants({
|
|
22373
|
+
selected: isSelected ? "true" : "false"
|
|
22374
|
+
}),
|
|
22375
|
+
onClick: () => handleDaySelect(day.id),
|
|
22376
|
+
children: [
|
|
22377
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs", children: day.weekday }),
|
|
22378
|
+
/* @__PURE__ */ jsx("span", { className: "text-base font-bold leading-none", children: day.dayNum })
|
|
22379
|
+
]
|
|
22380
|
+
},
|
|
22381
|
+
day.id
|
|
22382
|
+
);
|
|
22383
|
+
}) })
|
|
22384
|
+
] }),
|
|
22385
|
+
selectedDayId && /* @__PURE__ */ jsxs("div", { children: [
|
|
22386
|
+
/* @__PURE__ */ jsxs("p", { className: slotPickerSectionLabelClass, children: [
|
|
22387
|
+
"Pick a time",
|
|
22388
|
+
timezoneLabel && /* @__PURE__ */ jsx("span", { className: slotPickerTimezoneClass, children: timezoneLabel })
|
|
22389
|
+
] }),
|
|
22390
|
+
/* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": "Pick a time", className: cn(slotPickerGridClass, "mt-2"), children: currentSlots.map((slot) => {
|
|
22391
|
+
const isSelected = isSlotSelected(value, selectedDayId, slot);
|
|
22392
|
+
const isDisabled = disabledSlots.includes(slot);
|
|
22393
|
+
return /* @__PURE__ */ jsx(
|
|
22394
|
+
"button",
|
|
22395
|
+
{
|
|
22396
|
+
type: "button",
|
|
22397
|
+
role: "radio",
|
|
22398
|
+
"aria-checked": isSelected,
|
|
22399
|
+
"aria-disabled": isDisabled || void 0,
|
|
22400
|
+
"data-state": isSelected ? "checked" : "unchecked",
|
|
22401
|
+
className: slotPickerSlotVariants({
|
|
22402
|
+
selected: isSelected ? "true" : "false",
|
|
22403
|
+
disabled: isDisabled ? "true" : "false"
|
|
22404
|
+
}),
|
|
22405
|
+
onClick: () => !isDisabled && handleSlotSelect(slot),
|
|
22406
|
+
children: slot
|
|
22407
|
+
},
|
|
22408
|
+
slot
|
|
22409
|
+
);
|
|
22410
|
+
}) })
|
|
22411
|
+
] })
|
|
22412
|
+
]
|
|
22413
|
+
}
|
|
22414
|
+
);
|
|
22415
|
+
}
|
|
22416
|
+
);
|
|
22417
|
+
SlotPicker.displayName = "SlotPicker";
|
|
22418
|
+
|
|
22419
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AltHintState, AnalyticsProvider, AnimatedText, AppShell, AudienceFeatureCard, AudioRoom, AuthGuard, AuthProvider, Avatar2 as Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BadgeDisplay, BottomNav, BrandNetworkCell, Breadcrumbs, BrowserChromeMock, Button, CATEGORY_LABELS, CURSOR_COLORS, Calendar, CalendarHeader, CallControlButton, CallControls, Callout, CalloutContent, CalloutDescription, CalloutIcon, CalloutTitle, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselTrigger, Chat, Checkbox, Checklist, CodeBlock, CodeBlockContent, CodeBlockHeader, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, Composer, ConfirmationCard, ContentProtection, CookieConsent, Cursor, DEFAULT_CATEGORIES, DEFAULT_VOICE_PILL_POSITION, DEFAULT_VOICE_PILL_SPEAKER, DEFAULT_WAVEFORM_BAR_COUNT, DEFAULT_WAVEFORM_COLOR, DEFAULT_WAVEFORM_HEIGHT, DEFAULT_WAVEFORM_INTENSITY, DEFAULT_WAVEFORM_SMOOTHING, DataTable, DatePicker, DeviceFrame, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EMOJI_CATEGORIES, EMOJI_DATA, EditorStatusBar, EditorTabs, EmojiPicker, EmptyState, FeedbackButton, FeedbackDialog, FileTree, FileUpload, FloatingReactions, FlowEditor, Footer, GraphView, IconSystem, InfiniteCanvas, InlineEditor, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InstallPrompt, KanbanBoard, KanbanCard, KanbanColumn, KeyboardShortcut, LanguageSelector, LinkCard, LiveCaptions, LiveCursors, LiveTranscript, MarkdownRenderer, MarqueeStrip, MasteryBar, MiniMap, MobileNav, MobileNavContent, MobileNavLink, MobileNavTrigger, Navbar, NumberedSteps, OtpInput, STATUS_COLORS as PRESENCE_STATUS_COLORS, STATUS_LABELS as PRESENCE_STATUS_LABELS, Pagination, PasswordInput, Payment, Popover, PopoverClose, PopoverContent, PopoverTrigger, PreCallLobby, PresenceIndicator, PricingCard, ProgressBar, RadialGauge, RadioGroup, RadioItem, RatingScale, ReactionBar, ReactionBurst, ResizableDivider, ResizableLayout, ResizablePane, SANE_DEFAULTS, STATUS_INDICATOR_COLORS as STATUS_COLORS, STATUS_INDICATOR_LABELS as STATUS_LABELS, STICKY_NOTE_COLORS, SearchBar, SearchResultItem, SearchResults, SectionHead, SegmentedControl, SegmentedControlItem, Select, SelectContent, SelectItem, SelectTrigger, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, ShortcutBadge, ShortcutContext, ShortcutHint, ShortcutProvider, ShortcutRegistry, Sidebar, Skeleton, SkeletonText, SkipToContent, SlideViewer, SlotPicker, SocialAuthButton, SocialAuthRow, SortableList, SpeakingOrb, StatGrid, StatsGrid, StatusIndicator, Step, StepContent, StepDescription, StepIndicator, StepTitle, Steps, StickyNote, Switch, TableOfContents, Tabs, TabsContent, TabsList, TabsTrigger, TelemetryErrorBoundary, TelemetryProvider, Terminal, TestResults, Textarea, ThreadView, Timeline, TimelineItem, Toast, ToastProvider, Toaster, Tooltip, TooltipContent, TooltipTrigger, TypewriterText, VersionSelector, VideoGrid, VideoPlayer, VideoTile, VoicePill, Waveform, Wizard, altHintState, animatedTextVariants, assignCursorColor, avatarFallbackVariants, avatarImageVariants, avatarTokens, avatarVariants, badgeGridVariants, badgeItemVariants, badgeVariants, bottomNavTabVariants, bottomNavVariants, breadcrumbItemVariants, breadcrumbSeparatorStyles, breadcrumbsVariants, buttonTokens, buttonVariants, calendarVariants, canAccessAdmin, canAccessReviewer, cardContentVariants, cardDescriptionVariants, cardFooterVariants, cardHeaderVariants, cardTitleVariants, cardTokens, cardVariants, cellVariants, checkIconPath, checkboxTokens, checkboxVariants, clampVoicePillIntensity, codeEditorTokens, codeEditorVariants, collapsibleContentVariants, comboboxContentVariants, comboboxEmptyVariants, comboboxInputVariants, comboboxItemVariants, comboboxListVariants, comboboxTriggerVariants, commandGroupVariants, commandInputVariants, commandItemVariants, commandVariants, contentProtectionVariants, controlsVariants, createAnalytics, createAppInsightsSink, createConsoleSink, createConversation, createCookieConsent, createGA4ClientSdkSink, createGA4HttpSink, createGA4Sink, createIntensitySamples, createPostHogClientSdkSink, createPostHogHttpSink, createPostHogSink, createPreCallLobby, createSegmentedControl, createSilentSamples, createTelemetry, createVoicePill, createWaveform, dayVariants, deviceFrameVariants, dialogContentVariants, drawWaveform, editorVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, feedbackDialogVariants, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, findMessage, footerVariants, formatFileSize, formatRelativeTime, formatShortcut, formatTimestamp, getAssignableRoles, getDefaultPortal, getInitials, getNextSegmentIndex, getReplyCount, getVoicePillAriaLabel, getVoicePillInitials, getVoicePillPosition, getVoicePillPulseStyle, getVoicePillSpeakerKey, getVoicePillSpeakerLabel, getWaveformPeak, globalShortcutRegistry, hasAllRoles, hasAnyRole, hasRole, headerVariants, indeterminateIconPath, inputGroupAddonVariants, inputGroupButtonVariants, inputGroupTokens, inputGroupVariants, inputVariants, installPromptVariants, isWaveformSampleInput, latestBadgeVariants, markdownRendererTokens, menuContentVariants, menuItemVariants, micLevelToBars, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants, navLinkVariants, navbarVariants, nextStickyColor, normalizeBarCount, normalizeIntensity, normalizeSmoothing, normalizeWaveformConfig, normalizeWaveformSamples, optionVariants, otpInputContainerVariants, otpInputSlotVariants, otpInputTokens, overlayStyles, overlayVariants, playerVariants, popoverContentVariants, prepareWaveformCanvas, previewVariants, progressBarVariants, proseVariants, radioCircleVariants, radioGroupVariants, radioItemVariants, reactionAddButtonStyles, reactionBarStyles, reactionCountStyles, reactionEmojiStyles, reactionPillVariants, resampleWaveformSamples, resizableDividerVariants, resizableLayoutTokens, resizableLayoutVariants, resizablePaneVariants, rootIdOf, rowVariants, scaleWaveformSamples, searchBarVariants, searchResultVariants, segmentedControlItemVariants, segmentedControlVariants, selectContentVariants, selectItemVariants, selectMainTimeline, selectReplies, selectRoots, selectThreadMessages, selectTimelineFromState, selectTokens, selectTriggerVariants, selectorVariants, sheetContentVariants, sheetOverlayStyles, shortcutBadgeStyles, shortcutKeyStyles, shortcutSeparatorStyles, sidebarItemVariants, sidebarVariants, skeletonVariants, slideTypeBadgeVariants, slideViewerProgressBarVariants, slideViewerTokens, slideViewerVariants, smoothWaveformSamples, startSessionReplay, statCardVariants, statColumns, statsGridVariants, statusContainerStyles, statusDotVariants, statusLabelStyles, statusPulseVariants, switchThumbVariants, switchTokens, switchVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, threadAuthorStyles, threadAvatarStyles, threadBodyStyles, threadContainerStyles, threadContentStyles, threadMessageStyles, threadReactionsStyles, threadTimestampStyles, toCssDimension, toastVariants, toolbarVariants, tooltipContentVariants, typewriterVariants, useAnalytics, useAuth, useConversation, useCookieConsent, useFloatingReactions, useLogger, useShortcut, useSpan, useTelemetry, useToast, useTrackEvent, useWizard, versionSelectorOptionVariants, versionSelectorVariants, voicePillAvatarStyles, voicePillAvatarWrapStyles, voicePillLabelStyles, voicePillMuteButtonStyles, voicePillPositionVariants, voicePillPulseRingStyles, voicePillRootStyles, voicePillSpeakerStyles, voicePillSubStyles, voicePillTextStyles, voicePillTokens, watermarkVariants, waveformCanvasVariants, waveformVariants };
|
|
21874
22420
|
//# sourceMappingURL=index.js.map
|
|
21875
22421
|
//# sourceMappingURL=index.js.map
|