@refraction-ui/react 0.14.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 +1186 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1165 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/browser-chrome-mock/index.d.ts +57 -0
- package/dist/internal/kanban-board/index.d.ts +98 -0
- package/dist/internal/mastery-bar/index.d.ts +60 -0
- package/dist/internal/numbered-steps/index.d.ts +71 -0
- package/dist/internal/pricing-card/index.d.ts +61 -0
- package/dist/internal/react-audience-feature-card/index.d.ts +22 -0
- package/dist/internal/react-brand-network-cell/index.d.ts +30 -0
- package/dist/internal/react-browser-chrome-mock/index.d.ts +21 -0
- package/dist/internal/react-kanban-board/index.d.ts +71 -0
- package/dist/internal/react-marquee-strip/index.d.ts +33 -0
- package/dist/internal/react-mastery-bar/index.d.ts +26 -0
- package/dist/internal/react-numbered-steps/index.d.ts +24 -0
- package/dist/internal/react-pricing-card/index.d.ts +40 -0
- package/dist/internal/react-section-head/index.d.ts +27 -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/react-stat-grid/index.d.ts +29 -0
- package/dist/internal/section-head/index.d.ts +36 -0
- package/dist/internal/slot-picker/index.d.ts +77 -0
- package/dist/internal/stat-grid/index.d.ts +45 -0
- package/package.json +13 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SlotDay, SlotSelection } from '../slot-picker/index.js';
|
|
3
|
+
export { SlotDay, SlotSelection } from '../slot-picker/index.js';
|
|
4
|
+
|
|
5
|
+
interface SlotPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'results' | 'color' | 'content' | 'defaultValue' | 'onChange'> {
|
|
6
|
+
/** The list of days to show as chips. */
|
|
7
|
+
days: SlotDay[];
|
|
8
|
+
/** Map of dayId → available time slot strings. */
|
|
9
|
+
slotsByDay: Record<string, string[]>;
|
|
10
|
+
/** Controlled selection value. */
|
|
11
|
+
value?: SlotSelection;
|
|
12
|
+
/** Initial selection for uncontrolled usage. */
|
|
13
|
+
defaultValue?: SlotSelection;
|
|
14
|
+
/** Called when the user picks a day + slot. */
|
|
15
|
+
onChange?: (selection: SlotSelection) => void;
|
|
16
|
+
/** Label shown beside the "Pick a time" heading (e.g. "Eastern Time"). */
|
|
17
|
+
timezoneLabel?: string;
|
|
18
|
+
/** Slot strings that should be rendered as disabled. */
|
|
19
|
+
disabledSlots?: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* SlotPicker — a Calendly-style day + time-slot booking picker.
|
|
23
|
+
*
|
|
24
|
+
* Renders a row of day chips (radiogroup) and a grid of time-slot buttons
|
|
25
|
+
* (radiogroup) for the currently-selected day. Supports controlled (`value`)
|
|
26
|
+
* and uncontrolled (`defaultValue`) usage. Selecting a day clears the slot
|
|
27
|
+
* when the previously-chosen slot is not available on the new day.
|
|
28
|
+
*/
|
|
29
|
+
declare const SlotPicker: React.ForwardRefExoticComponent<SlotPickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
|
|
31
|
+
export { SlotPicker, type SlotPickerProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Props injected into each rendered row via renderItem. */
|
|
4
|
+
interface DragHandleProps {
|
|
5
|
+
/** Must be spread onto the grip element (button). */
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
/** Role is already set inside the component; exposed for convenience. */
|
|
8
|
+
role: 'button';
|
|
9
|
+
tabIndex: number;
|
|
10
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
11
|
+
onDragStart: (event: React.DragEvent<HTMLButtonElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
interface SortableListProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'results' | 'color' | 'content' | 'children'> {
|
|
14
|
+
/** The ordered list of items to render. */
|
|
15
|
+
items: T[];
|
|
16
|
+
/** Return a stable key for each item. */
|
|
17
|
+
getKey: (item: T, index: number) => string | number;
|
|
18
|
+
/**
|
|
19
|
+
* Render the content of a single row.
|
|
20
|
+
* Spread `dragHandleProps` onto your grip button so keyboard + DnD work.
|
|
21
|
+
*/
|
|
22
|
+
renderItem: (item: T, meta: {
|
|
23
|
+
index: number;
|
|
24
|
+
dragHandleProps: DragHandleProps;
|
|
25
|
+
}) => React.ReactNode;
|
|
26
|
+
/** Called when the user reorders an item. Receives the new items array. */
|
|
27
|
+
onReorder?: (items: T[]) => void;
|
|
28
|
+
/** Disables all drag and keyboard reordering. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const SortableList: <T>(props: SortableListProps<T> & {
|
|
32
|
+
ref?: React.ForwardedRef<HTMLDivElement>;
|
|
33
|
+
}) => React.ReactElement | null;
|
|
34
|
+
|
|
35
|
+
export { type DragHandleProps, SortableList, type SortableListProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export { StatItem, statColumns } from '../stat-grid/index.js';
|
|
3
|
+
|
|
4
|
+
interface StatGridItem {
|
|
5
|
+
/** The primary value displayed prominently. Allows rich content in React. */
|
|
6
|
+
value: React.ReactNode;
|
|
7
|
+
/** The descriptive label shown below the value. */
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
interface StatGridProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
11
|
+
/** The stat items to display in the grid. */
|
|
12
|
+
items: StatGridItem[];
|
|
13
|
+
/**
|
|
14
|
+
* Number of columns. Defaults to `statColumns(items.length)`:
|
|
15
|
+
* 1 item → 1, 2 items → 2, 3+ items → 3.
|
|
16
|
+
*/
|
|
17
|
+
columns?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* StatGrid — a marketing-style grid of stat callouts.
|
|
21
|
+
*
|
|
22
|
+
* Each item shows a large bold value and a small muted label. The grid
|
|
23
|
+
* automatically computes the column count from the number of items, or you can
|
|
24
|
+
* override it with `columns`. Uses `role="list"` / `role="listitem"` for
|
|
25
|
+
* accessible enumeration.
|
|
26
|
+
*/
|
|
27
|
+
declare const StatGrid: React.ForwardRefExoticComponent<StatGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
|
|
29
|
+
export { StatGrid, type StatGridItem, type StatGridProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Horizontal alignment of the section head cluster. */
|
|
2
|
+
type SectionHeadAlign = 'center' | 'left';
|
|
3
|
+
interface SectionHeadProps {
|
|
4
|
+
/** Alignment of the kicker, title, and lede. */
|
|
5
|
+
align?: SectionHeadAlign;
|
|
6
|
+
}
|
|
7
|
+
interface SectionHeadAPI {
|
|
8
|
+
/** Data attributes for styling hooks. */
|
|
9
|
+
dataAttributes: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build the framework-agnostic data attributes for a SectionHead.
|
|
13
|
+
*
|
|
14
|
+
* Returns data-align so adapters can apply styles via CSS or Tailwind
|
|
15
|
+
* variants. All visual logic (classes, cva) lives in `section-head.styles.ts`.
|
|
16
|
+
*/
|
|
17
|
+
declare function createSectionHead(props?: SectionHeadProps): SectionHeadAPI;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Container variant that controls the alignment of the whole cluster.
|
|
21
|
+
* Center: auto-margins + text-center + constrained max-width for comfortable
|
|
22
|
+
* line length. Left: no margin constraint, flush left.
|
|
23
|
+
*/
|
|
24
|
+
declare const sectionHeadVariants: (props?: ({
|
|
25
|
+
align?: "center" | "left" | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
className?: string;
|
|
28
|
+
}) | undefined) => string;
|
|
29
|
+
/** Small-caps eyebrow label above the title. */
|
|
30
|
+
declare const sectionHeadKickerClass = "text-[11px] uppercase tracking-widest text-primary font-semibold";
|
|
31
|
+
/** Primary h2 heading. */
|
|
32
|
+
declare const sectionHeadTitleClass = "text-3xl sm:text-4xl font-bold tracking-tight text-foreground";
|
|
33
|
+
/** Optional lede paragraph below the title. */
|
|
34
|
+
declare const sectionHeadLedeClass = "mt-3 text-muted-foreground leading-relaxed";
|
|
35
|
+
|
|
36
|
+
export { type SectionHeadAPI, type SectionHeadAlign, type SectionHeadProps, createSectionHead, sectionHeadKickerClass, sectionHeadLedeClass, sectionHeadTitleClass, sectionHeadVariants };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** A single day chip shown in the day-selector row. */
|
|
2
|
+
type SlotDay = {
|
|
3
|
+
/** Unique identifier for the day (e.g. "2024-06-14"). */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Short weekday label (e.g. "Fri"). */
|
|
6
|
+
weekday: string;
|
|
7
|
+
/** Day-of-month label (e.g. "14" or 14). */
|
|
8
|
+
dayNum: string | number;
|
|
9
|
+
};
|
|
10
|
+
/** The currently-selected day + time slot pair. */
|
|
11
|
+
type SlotSelection = {
|
|
12
|
+
/** The `id` of the selected day. */
|
|
13
|
+
dayId: string;
|
|
14
|
+
/** The selected time slot string (e.g. "10:00 AM"). */
|
|
15
|
+
slot: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Return the list of available time slots for a given day.
|
|
19
|
+
* Returns an empty array when `dayId` has no entry in `slotsByDay`.
|
|
20
|
+
*/
|
|
21
|
+
declare function slotsForDay(slotsByDay: Record<string, string[]>, dayId: string): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Check whether a specific slot in a specific day is currently selected.
|
|
24
|
+
*/
|
|
25
|
+
declare function isSlotSelected(value: SlotSelection | undefined, dayId: string, slot: string): boolean;
|
|
26
|
+
interface SlotPickerAPI {
|
|
27
|
+
/** ARIA attributes to spread on the root group element. */
|
|
28
|
+
ariaProps: {
|
|
29
|
+
role: 'group';
|
|
30
|
+
'aria-label': string;
|
|
31
|
+
};
|
|
32
|
+
/** Data attributes for styling hooks. */
|
|
33
|
+
dataAttributes: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build the framework-agnostic root props for a slot picker.
|
|
37
|
+
*
|
|
38
|
+
* Returns `role="group"` with an accessible label and data attributes.
|
|
39
|
+
* Adapters spread these onto their container element.
|
|
40
|
+
*/
|
|
41
|
+
declare function createSlotPicker(): SlotPickerAPI;
|
|
42
|
+
|
|
43
|
+
/** Root wrapper for the entire slot picker (day row + slots grid). */
|
|
44
|
+
declare const slotPickerVariants: (props?: ({} & {
|
|
45
|
+
className?: string;
|
|
46
|
+
}) | undefined) => string;
|
|
47
|
+
/** Scrollable row of day chips. */
|
|
48
|
+
declare const slotPickerDayRowClass = "flex items-center gap-2 overflow-x-auto pb-1";
|
|
49
|
+
/**
|
|
50
|
+
* Individual day chip.
|
|
51
|
+
*
|
|
52
|
+
* `selected` → primary treatment; `unselected` → card with border.
|
|
53
|
+
*/
|
|
54
|
+
declare const slotPickerDayVariants: (props?: ({
|
|
55
|
+
selected?: "true" | "false" | undefined;
|
|
56
|
+
} & {
|
|
57
|
+
className?: string;
|
|
58
|
+
}) | undefined) => string;
|
|
59
|
+
/** Grid that holds the time-slot buttons. */
|
|
60
|
+
declare const slotPickerGridClass = "grid grid-cols-3 gap-2 sm:grid-cols-4";
|
|
61
|
+
/**
|
|
62
|
+
* Individual time-slot button.
|
|
63
|
+
*
|
|
64
|
+
* `selected` → primary; `disabled` → dimmed regardless of selection.
|
|
65
|
+
*/
|
|
66
|
+
declare const slotPickerSlotVariants: (props?: ({
|
|
67
|
+
selected?: "true" | "false" | undefined;
|
|
68
|
+
disabled?: "true" | "false" | undefined;
|
|
69
|
+
} & {
|
|
70
|
+
className?: string;
|
|
71
|
+
}) | undefined) => string;
|
|
72
|
+
/** Section label above the day row or slot grid (e.g. "Pick a day"). */
|
|
73
|
+
declare const slotPickerSectionLabelClass = "text-sm font-semibold text-foreground";
|
|
74
|
+
/** Timezone label rendered beside the "Pick a time" heading. */
|
|
75
|
+
declare const slotPickerTimezoneClass = "text-xs text-muted-foreground ml-2";
|
|
76
|
+
|
|
77
|
+
export { type SlotDay, type SlotPickerAPI, type SlotSelection, createSlotPicker, isSlotSelected, slotPickerDayRowClass, slotPickerDayVariants, slotPickerGridClass, slotPickerSectionLabelClass, slotPickerSlotVariants, slotPickerTimezoneClass, slotPickerVariants, slotsForDay };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** A single stat callout displayed in the grid. */
|
|
2
|
+
type StatItem = {
|
|
3
|
+
/** The primary value displayed prominently (e.g. "10k+", "$4.2M"). */
|
|
4
|
+
value: string;
|
|
5
|
+
/** The descriptive label shown below the value. */
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
interface StatGridAPI {
|
|
9
|
+
/** ARIA attributes to spread on the grid container element (`role="list"`). */
|
|
10
|
+
ariaProps: {
|
|
11
|
+
role: 'list';
|
|
12
|
+
};
|
|
13
|
+
/** Data attributes for styling hooks. */
|
|
14
|
+
dataAttributes: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Compute the number of grid columns for a stat grid.
|
|
18
|
+
*
|
|
19
|
+
* - 1 item → 1 column
|
|
20
|
+
* - 2 items → 2 columns
|
|
21
|
+
* - 3 or more items → capped at `max` (default 3)
|
|
22
|
+
*/
|
|
23
|
+
declare function statColumns(count: number, max?: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Build the framework-agnostic container props for a stat grid.
|
|
26
|
+
*
|
|
27
|
+
* Returns `role="list"` and data attributes; adapters spread these onto their
|
|
28
|
+
* container element and render the items themselves.
|
|
29
|
+
*/
|
|
30
|
+
declare function createStatGrid(): StatGridAPI;
|
|
31
|
+
|
|
32
|
+
/** Grid container that lays out stat items. */
|
|
33
|
+
declare const statGridVariants: (props?: ({
|
|
34
|
+
columns?: "1" | "2" | "3" | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
className?: string;
|
|
37
|
+
}) | undefined) => string;
|
|
38
|
+
/** Individual stat item container (role="listitem"). */
|
|
39
|
+
declare const statItemClass = "flex flex-col";
|
|
40
|
+
/** The large bold value of the stat. */
|
|
41
|
+
declare const statValueClass = "text-xl sm:text-2xl font-bold text-primary";
|
|
42
|
+
/** The descriptive label below the value. */
|
|
43
|
+
declare const statLabelClass = "mt-1 text-sm text-muted-foreground leading-snug";
|
|
44
|
+
|
|
45
|
+
export { type StatGridAPI, type StatItem, createStatGrid, statColumns, statGridVariants, statItemClass, statLabelClass, statValueClass };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refraction-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "All Refraction UI React components in one package — headless, accessible, zero-dependency",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,13 +54,16 @@
|
|
|
54
54
|
"@refraction-ui/react-analytics": "workspace:*",
|
|
55
55
|
"@refraction-ui/react-animated-text": "workspace:*",
|
|
56
56
|
"@refraction-ui/react-app-shell": "workspace:*",
|
|
57
|
+
"@refraction-ui/react-audience-feature-card": "workspace:*",
|
|
57
58
|
"@refraction-ui/react-audio-room": "workspace:*",
|
|
58
59
|
"@refraction-ui/react-auth": "workspace:*",
|
|
59
60
|
"@refraction-ui/react-avatar": "workspace:*",
|
|
60
61
|
"@refraction-ui/react-avatar-group": "workspace:*",
|
|
61
62
|
"@refraction-ui/react-badge": "workspace:*",
|
|
62
63
|
"@refraction-ui/react-bottom-nav": "workspace:*",
|
|
64
|
+
"@refraction-ui/react-brand-network-cell": "workspace:*",
|
|
63
65
|
"@refraction-ui/react-breadcrumbs": "workspace:*",
|
|
66
|
+
"@refraction-ui/react-browser-chrome-mock": "workspace:*",
|
|
64
67
|
"@refraction-ui/react-button": "workspace:*",
|
|
65
68
|
"@refraction-ui/react-calendar": "workspace:*",
|
|
66
69
|
"@refraction-ui/react-call-controls": "workspace:*",
|
|
@@ -104,6 +107,7 @@
|
|
|
104
107
|
"@refraction-ui/react-input": "workspace:*",
|
|
105
108
|
"@refraction-ui/react-input-group": "workspace:*",
|
|
106
109
|
"@refraction-ui/react-install-prompt": "workspace:*",
|
|
110
|
+
"@refraction-ui/react-kanban-board": "workspace:*",
|
|
107
111
|
"@refraction-ui/react-keyboard-shortcut": "workspace:*",
|
|
108
112
|
"@refraction-ui/react-language-selector": "workspace:*",
|
|
109
113
|
"@refraction-ui/react-link-card": "workspace:*",
|
|
@@ -112,9 +116,12 @@
|
|
|
112
116
|
"@refraction-ui/react-live-transcript": "workspace:*",
|
|
113
117
|
"@refraction-ui/react-logger": "workspace:*",
|
|
114
118
|
"@refraction-ui/react-markdown-renderer": "workspace:*",
|
|
119
|
+
"@refraction-ui/react-marquee-strip": "workspace:*",
|
|
120
|
+
"@refraction-ui/react-mastery-bar": "workspace:*",
|
|
115
121
|
"@refraction-ui/react-mini-map": "workspace:*",
|
|
116
122
|
"@refraction-ui/react-mobile-nav": "workspace:*",
|
|
117
123
|
"@refraction-ui/react-navbar": "workspace:*",
|
|
124
|
+
"@refraction-ui/react-numbered-steps": "workspace:*",
|
|
118
125
|
"@refraction-ui/react-otp-input": "workspace:*",
|
|
119
126
|
"@refraction-ui/react-pagination": "workspace:*",
|
|
120
127
|
"@refraction-ui/react-password-input": "workspace:*",
|
|
@@ -122,6 +129,7 @@
|
|
|
122
129
|
"@refraction-ui/react-popover": "workspace:*",
|
|
123
130
|
"@refraction-ui/react-pre-call-lobby": "workspace:*",
|
|
124
131
|
"@refraction-ui/react-presence-indicator": "workspace:*",
|
|
132
|
+
"@refraction-ui/react-pricing-card": "workspace:*",
|
|
125
133
|
"@refraction-ui/react-progress-display": "workspace:*",
|
|
126
134
|
"@refraction-ui/react-radial-gauge": "workspace:*",
|
|
127
135
|
"@refraction-ui/react-radio": "workspace:*",
|
|
@@ -130,6 +138,7 @@
|
|
|
130
138
|
"@refraction-ui/react-resizable-layout": "workspace:*",
|
|
131
139
|
"@refraction-ui/react-rich-editor": "workspace:*",
|
|
132
140
|
"@refraction-ui/react-search-bar": "workspace:*",
|
|
141
|
+
"@refraction-ui/react-section-head": "workspace:*",
|
|
133
142
|
"@refraction-ui/react-segmented-control": "workspace:*",
|
|
134
143
|
"@refraction-ui/react-select": "workspace:*",
|
|
135
144
|
"@refraction-ui/react-separator": "workspace:*",
|
|
@@ -139,7 +148,10 @@
|
|
|
139
148
|
"@refraction-ui/react-skip-to-content": "workspace:*",
|
|
140
149
|
"@refraction-ui/react-slide-viewer": "workspace:*",
|
|
141
150
|
"@refraction-ui/react-slider": "workspace:*",
|
|
151
|
+
"@refraction-ui/react-slot-picker": "workspace:*",
|
|
142
152
|
"@refraction-ui/react-social-auth-button": "workspace:*",
|
|
153
|
+
"@refraction-ui/react-sortable-list": "workspace:*",
|
|
154
|
+
"@refraction-ui/react-stat-grid": "workspace:*",
|
|
143
155
|
"@refraction-ui/react-status-indicator": "workspace:*",
|
|
144
156
|
"@refraction-ui/react-steps": "workspace:*",
|
|
145
157
|
"@refraction-ui/react-sticky-note": "workspace:*",
|