@refineui/react 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +140 -111
- package/dist/index.js.map +1 -1
- package/dist/spec/components/select.json +1 -0
- package/dist/spec/contract-index.json +1 -1
- package/dist/spec/token-trace-v2.json +1 -1
- package/package.json +1 -1
- package/refineui.css +64 -24
- package/spec/components/select.json +1 -0
package/dist/index.cjs
CHANGED
|
@@ -122,7 +122,6 @@ __export(index_exports, {
|
|
|
122
122
|
Divider: () => Divider,
|
|
123
123
|
Drawer: () => Drawer,
|
|
124
124
|
DrawerBody: () => DrawerBody,
|
|
125
|
-
DrawerClose: () => DrawerClose,
|
|
126
125
|
DrawerContent: () => DrawerContent,
|
|
127
126
|
DrawerDescription: () => DrawerDescription,
|
|
128
127
|
DrawerFooter: () => DrawerFooter,
|
|
@@ -3205,13 +3204,26 @@ var selectStyles = {
|
|
|
3205
3204
|
"border-refineui-hairline border-refineui-alias-border-default",
|
|
3206
3205
|
"bg-refineui-alias-background-primary px-refineui-size-medium py-refineui-size-x-small",
|
|
3207
3206
|
"text-refineui-alias-foreground-primary outline-none",
|
|
3208
|
-
"transition-[color,background-color,border-color] duration-[var(--refineui-motion-duration-fast)]"
|
|
3207
|
+
"transition-[color,background-color,border-color,transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
3208
|
+
),
|
|
3209
|
+
/** Ghost plate — same gap/radius as filled, no field border (Button ghost-like). */
|
|
3210
|
+
triggerGhost: (0, import_clsx27.clsx)(
|
|
3211
|
+
"box-border inline-flex cursor-pointer items-center justify-between",
|
|
3212
|
+
"gap-refineui-size-x-small rounded-refineui-large",
|
|
3213
|
+
"border-refineui-none border-transparent bg-transparent",
|
|
3214
|
+
"px-refineui-size-x-small py-refineui-size-xx-small",
|
|
3215
|
+
"text-refineui-alias-foreground-primary outline-none",
|
|
3216
|
+
"transition-[color,background-color,transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
3209
3217
|
),
|
|
3210
3218
|
/** Flush shell — consumer / parent owns padding, radius, surface. */
|
|
3211
|
-
triggerPlain:
|
|
3219
|
+
triggerPlain: (0, import_clsx27.clsx)(
|
|
3220
|
+
"box-border inline-flex cursor-pointer items-center outline-none",
|
|
3221
|
+
"transition-[transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
3222
|
+
),
|
|
3212
3223
|
triggerInner: "min-w-0 flex-1 overflow-hidden text-start",
|
|
3213
3224
|
triggerOpen: "text-refineui-alias-foreground-primary",
|
|
3214
3225
|
triggerDisabled: "cursor-not-allowed border-refineui-alias-border-disabled bg-refineui-alias-background-surface-disabled text-refineui-alias-foreground-disabled",
|
|
3226
|
+
triggerGhostDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
3215
3227
|
triggerPlainDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
3216
3228
|
value: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-start",
|
|
3217
3229
|
iconWrap: "inline-flex size-refineui-icon-xsmall shrink-0 items-center justify-center",
|
|
@@ -3492,9 +3504,12 @@ function Select({
|
|
|
3492
3504
|
}
|
|
3493
3505
|
var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props, forwardedRef) {
|
|
3494
3506
|
const { className, children, style, appearance = "filled", ...triggerRest } = props;
|
|
3495
|
-
const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value
|
|
3496
|
-
const
|
|
3507
|
+
const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value } = useSelectCtx();
|
|
3508
|
+
const isPlaceholder = value === "";
|
|
3497
3509
|
const isPlain = appearance === "plain";
|
|
3510
|
+
const isGhost = appearance === "ghost";
|
|
3511
|
+
const isFilled = appearance === "filled";
|
|
3512
|
+
const [pressed, setPressed] = (0, import_react11.useState)(false);
|
|
3498
3513
|
const setRefs = (0, import_react11.useCallback)(
|
|
3499
3514
|
(node) => {
|
|
3500
3515
|
triggerRef.current = node;
|
|
@@ -3503,6 +3518,7 @@ var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props
|
|
|
3503
3518
|
},
|
|
3504
3519
|
[forwardedRef, triggerRef]
|
|
3505
3520
|
);
|
|
3521
|
+
const clearPressed = (0, import_react11.useCallback)(() => setPressed(false), []);
|
|
3506
3522
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3507
3523
|
"button",
|
|
3508
3524
|
{
|
|
@@ -3515,20 +3531,31 @@ var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props
|
|
|
3515
3531
|
"data-appearance": appearance,
|
|
3516
3532
|
"data-size": size,
|
|
3517
3533
|
"data-state": open ? "open" : "closed",
|
|
3518
|
-
"data-
|
|
3534
|
+
"data-pressed": pressed ? "" : void 0,
|
|
3535
|
+
"data-placeholder": isPlaceholder ? "" : void 0,
|
|
3519
3536
|
disabled,
|
|
3537
|
+
onPointerDown: (event) => {
|
|
3538
|
+
if (disabled || event.button !== 0) return;
|
|
3539
|
+
setPressed(true);
|
|
3540
|
+
},
|
|
3541
|
+
onPointerUp: clearPressed,
|
|
3542
|
+
onPointerLeave: clearPressed,
|
|
3543
|
+
onPointerCancel: clearPressed,
|
|
3520
3544
|
onMouseDown: (event) => {
|
|
3521
3545
|
event.preventDefault();
|
|
3546
|
+
if (disabled) return;
|
|
3522
3547
|
setOpen(!open);
|
|
3523
3548
|
triggerRef.current?.focus();
|
|
3524
3549
|
},
|
|
3525
3550
|
onKeyDown,
|
|
3526
3551
|
className: (0, import_clsx28.clsx)(
|
|
3527
3552
|
"data-[placeholder]:[&_[data-refineui-select-value]]:text-refineui-alias-foreground-placeholder",
|
|
3528
|
-
isPlain
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3553
|
+
isPlain && selectStyles.triggerPlain,
|
|
3554
|
+
isGhost && selectStyles.triggerGhost,
|
|
3555
|
+
isFilled && selectStyles.trigger,
|
|
3556
|
+
(isFilled || isGhost) && selectTriggerSizeClass[size],
|
|
3557
|
+
isFilled && open && selectStyles.triggerOpen,
|
|
3558
|
+
disabled && (isPlain ? selectStyles.triggerPlainDisabled : isGhost ? selectStyles.triggerGhostDisabled : selectStyles.triggerDisabled),
|
|
3532
3559
|
fullWidth && "w-full",
|
|
3533
3560
|
className
|
|
3534
3561
|
),
|
|
@@ -3554,7 +3581,20 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
3554
3581
|
function SelectValue({ placeholder, className, ...props }) {
|
|
3555
3582
|
const { value, getLabelByValue, placeholder: rootPlaceholder } = useSelectCtx();
|
|
3556
3583
|
const label = getLabelByValue(value);
|
|
3557
|
-
|
|
3584
|
+
const isPlaceholder = value === "";
|
|
3585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3586
|
+
"span",
|
|
3587
|
+
{
|
|
3588
|
+
"data-refineui-select-value": "",
|
|
3589
|
+
className: (0, import_clsx28.clsx)(
|
|
3590
|
+
selectStyles.value,
|
|
3591
|
+
isPlaceholder && "text-refineui-alias-foreground-placeholder",
|
|
3592
|
+
className
|
|
3593
|
+
),
|
|
3594
|
+
...props,
|
|
3595
|
+
children: label || placeholder || rootPlaceholder || "Select..."
|
|
3596
|
+
}
|
|
3597
|
+
);
|
|
3558
3598
|
}
|
|
3559
3599
|
function SelectIcon({ children, className, ...props }) {
|
|
3560
3600
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx28.clsx)(selectStyles.iconWrap, className), ...props, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(WebIcon, { name: "chevron-down", size: import_tokens8.iconSizes.xsmall }) });
|
|
@@ -7610,15 +7650,10 @@ var calendarStyles = {
|
|
|
7610
7650
|
dayWrapEndpoint: "box-border flex size-refineui-calendar-day-size items-center justify-center bg-refineui-alias-background-primary-hover",
|
|
7611
7651
|
dayWrapEndpointStart: "rounded-s-refineui-large",
|
|
7612
7652
|
dayWrapEndpointEnd: "rounded-e-refineui-large",
|
|
7613
|
-
root: "box-border flex w-fit min-w-refineui-calendar-min-width flex-col gap-refineui-size-none rounded-refineui-large bg-refineui-alias-background-primary p-refineui-size-x-large",
|
|
7653
|
+
root: "box-border flex w-fit min-w-refineui-calendar-min-width flex-col gap-refineui-size-none rounded-refineui-xx-large border-refineui-thin border-refineui-alias-border-default bg-refineui-alias-background-primary p-refineui-size-x-large",
|
|
7614
7654
|
header: "flex w-full min-w-0 items-center justify-between pb-refineui-size-large",
|
|
7615
7655
|
navButton: "shrink-0 text-refineui-alias-foreground-primary",
|
|
7616
|
-
captionButton:
|
|
7617
|
-
"shrink-0",
|
|
7618
|
-
"border-refineui-none border-transparent bg-transparent",
|
|
7619
|
-
"px-refineui-size-x-small py-refineui-size-xx-small",
|
|
7620
|
-
"text-refineui-alias-foreground-primary"
|
|
7621
|
-
),
|
|
7656
|
+
captionButton: "shrink-0",
|
|
7622
7657
|
body: "flex flex-col gap-refineui-size-small",
|
|
7623
7658
|
weekday: (0, import_clsx58.clsx)(
|
|
7624
7659
|
componentTextClass(componentTypographyTokens.calendar.weekday),
|
|
@@ -7647,12 +7682,15 @@ function normalizeRange(start, end) {
|
|
|
7647
7682
|
function getWeekdayLabels(weekStartsOn) {
|
|
7648
7683
|
return [...WEEKDAYS.slice(weekStartsOn), ...WEEKDAYS.slice(0, weekStartsOn)];
|
|
7649
7684
|
}
|
|
7650
|
-
function
|
|
7685
|
+
function formatMonthLabel(year, month) {
|
|
7686
|
+
return new Intl.DateTimeFormat("en-US", { month: "short" }).format(new Date(year, month, 1));
|
|
7687
|
+
}
|
|
7688
|
+
function formatMonthNameLong(year, month) {
|
|
7651
7689
|
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(new Date(year, month, 1));
|
|
7652
7690
|
}
|
|
7653
7691
|
var MONTH_LABELS = Array.from(
|
|
7654
7692
|
{ length: MONTH_COUNT },
|
|
7655
|
-
(_, monthIndex) =>
|
|
7693
|
+
(_, monthIndex) => formatMonthLabel(2e3, monthIndex)
|
|
7656
7694
|
);
|
|
7657
7695
|
function yearOptionsForView(viewYear) {
|
|
7658
7696
|
const referenceYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
@@ -7673,16 +7711,16 @@ function CalendarCaptionSelect({
|
|
|
7673
7711
|
children
|
|
7674
7712
|
}) {
|
|
7675
7713
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Select, { value, onValueChange, "aria-label": ariaLabel, size: "sm", children: [
|
|
7676
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.
|
|
7714
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7677
7715
|
SelectTrigger,
|
|
7678
7716
|
{
|
|
7679
|
-
appearance: "
|
|
7717
|
+
appearance: "ghost",
|
|
7680
7718
|
"data-calendar-header": header,
|
|
7681
|
-
className:
|
|
7682
|
-
|
|
7683
|
-
"
|
|
7684
|
-
|
|
7685
|
-
|
|
7719
|
+
className: (0, import_clsx59.clsx)(
|
|
7720
|
+
calendarStyles.captionButton,
|
|
7721
|
+
header === "caption-year" && "tabular-nums"
|
|
7722
|
+
),
|
|
7723
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectValue, { placeholder })
|
|
7686
7724
|
}
|
|
7687
7725
|
),
|
|
7688
7726
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectContent, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectGroup, { children }) }) })
|
|
@@ -7738,7 +7776,9 @@ function Calendar({
|
|
|
7738
7776
|
const cells = getMonthGrid(year, month, weekStartsOn);
|
|
7739
7777
|
const weeks = chunkWeeks(cells);
|
|
7740
7778
|
const weekdayLabels = getWeekdayLabels(weekStartsOn);
|
|
7741
|
-
const
|
|
7779
|
+
const monthLabel = formatMonthLabel(year, month);
|
|
7780
|
+
const monthNameLong = formatMonthNameLong(year, month);
|
|
7781
|
+
const yearOptions = yearOptionsForView(year);
|
|
7742
7782
|
const getDateFromCell = (d, monthOffset) => new Date(year, month + monthOffset, d);
|
|
7743
7783
|
const setRange = (start, end) => {
|
|
7744
7784
|
if (onRangeChange) onRangeChange(start, end);
|
|
@@ -7929,8 +7969,8 @@ function Calendar({
|
|
|
7929
7969
|
CalendarCaptionSelect,
|
|
7930
7970
|
{
|
|
7931
7971
|
value: String(month),
|
|
7932
|
-
placeholder:
|
|
7933
|
-
ariaLabel: `Month: ${
|
|
7972
|
+
placeholder: monthLabel,
|
|
7973
|
+
ariaLabel: `Month: ${monthNameLong}`,
|
|
7934
7974
|
header: "caption-month",
|
|
7935
7975
|
onValueChange: (nextMonth) => {
|
|
7936
7976
|
setView(new Date(year, Number.parseInt(nextMonth, 10), 1));
|
|
@@ -7948,7 +7988,7 @@ function Calendar({
|
|
|
7948
7988
|
onValueChange: (nextYear) => {
|
|
7949
7989
|
setView(new Date(Number.parseInt(nextYear, 10), month, 1));
|
|
7950
7990
|
},
|
|
7951
|
-
children:
|
|
7991
|
+
children: yearOptions.map((yearOption) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectItem, { value: String(yearOption), children: String(yearOption) }, yearOption))
|
|
7952
7992
|
}
|
|
7953
7993
|
),
|
|
7954
7994
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
@@ -8650,7 +8690,6 @@ function DrawerContent({
|
|
|
8650
8690
|
function DrawerHeader({
|
|
8651
8691
|
className,
|
|
8652
8692
|
children,
|
|
8653
|
-
showClose = true,
|
|
8654
8693
|
actions,
|
|
8655
8694
|
...props
|
|
8656
8695
|
}) {
|
|
@@ -8666,8 +8705,7 @@ function DrawerHeader({
|
|
|
8666
8705
|
...props,
|
|
8667
8706
|
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: drawerStyles.headerMain, children: [
|
|
8668
8707
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: drawerStyles.headerMainText, children }),
|
|
8669
|
-
hasActions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: drawerStyles.headerActions, children: actions }) : null
|
|
8670
|
-
showClose ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DrawerClose, {}) : null
|
|
8708
|
+
hasActions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: drawerStyles.headerActions, children: actions }) : null
|
|
8671
8709
|
] })
|
|
8672
8710
|
}
|
|
8673
8711
|
);
|
|
@@ -8746,36 +8784,6 @@ function DrawerFooter({ className, ...props }) {
|
|
|
8746
8784
|
}
|
|
8747
8785
|
);
|
|
8748
8786
|
}
|
|
8749
|
-
function DrawerClose({
|
|
8750
|
-
children,
|
|
8751
|
-
onClick,
|
|
8752
|
-
className,
|
|
8753
|
-
type = "button",
|
|
8754
|
-
variant,
|
|
8755
|
-
size,
|
|
8756
|
-
layout,
|
|
8757
|
-
...props
|
|
8758
|
-
}) {
|
|
8759
|
-
const { setOpen } = useDrawerContext("DrawerClose");
|
|
8760
|
-
const iconOnly = children == null;
|
|
8761
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
8762
|
-
Button,
|
|
8763
|
-
{
|
|
8764
|
-
...props,
|
|
8765
|
-
type,
|
|
8766
|
-
variant: variant ?? (iconOnly ? "ghost" : "outline"),
|
|
8767
|
-
size: size ?? "md",
|
|
8768
|
-
layout: layout ?? (iconOnly ? "icon" : "label"),
|
|
8769
|
-
"aria-label": iconOnly ? "Close" : void 0,
|
|
8770
|
-
className,
|
|
8771
|
-
onClick: (e) => {
|
|
8772
|
-
onClick?.(e);
|
|
8773
|
-
if (!e.defaultPrevented) setOpen(false);
|
|
8774
|
-
},
|
|
8775
|
-
children: iconOnly ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(WebIcon, { name: "dismiss", size: import_tokens19.iconSizes.xlarge, color: "currentColor", iconStyle: "regular", "aria-hidden": true }) : children
|
|
8776
|
-
}
|
|
8777
|
-
);
|
|
8778
|
-
}
|
|
8779
8787
|
|
|
8780
8788
|
// src/components/Dropdown/Dropdown.tsx
|
|
8781
8789
|
var import_clsx70 = require("clsx");
|
|
@@ -15538,7 +15546,18 @@ var Collapsible = (0, import_react59.forwardRef)(function Collapsible2({ open: o
|
|
|
15538
15546
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react60.Slot, { ...shared, children }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { ...shared, children }) });
|
|
15539
15547
|
});
|
|
15540
15548
|
var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
15541
|
-
function CollapsibleTrigger2({
|
|
15549
|
+
function CollapsibleTrigger2({
|
|
15550
|
+
asChild = false,
|
|
15551
|
+
onClick,
|
|
15552
|
+
className,
|
|
15553
|
+
children,
|
|
15554
|
+
variant = "ghost",
|
|
15555
|
+
size,
|
|
15556
|
+
layout,
|
|
15557
|
+
fullWidth,
|
|
15558
|
+
type = "button",
|
|
15559
|
+
...props
|
|
15560
|
+
}, ref) {
|
|
15542
15561
|
const { open, toggle, contentId, triggerId } = useCollapsibleContext("CollapsibleTrigger");
|
|
15543
15562
|
const shared = {
|
|
15544
15563
|
...props,
|
|
@@ -15547,7 +15566,6 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15547
15566
|
"aria-expanded": open,
|
|
15548
15567
|
"aria-controls": contentId,
|
|
15549
15568
|
"data-state": open ? "open" : "closed",
|
|
15550
|
-
"data-refineui": "collapsible-trigger",
|
|
15551
15569
|
className,
|
|
15552
15570
|
onClick: (event) => {
|
|
15553
15571
|
onClick?.(event);
|
|
@@ -15555,7 +15573,18 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15555
15573
|
}
|
|
15556
15574
|
};
|
|
15557
15575
|
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react60.Slot, { ...shared, children });
|
|
15558
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15577
|
+
Button,
|
|
15578
|
+
{
|
|
15579
|
+
...shared,
|
|
15580
|
+
type,
|
|
15581
|
+
variant,
|
|
15582
|
+
size,
|
|
15583
|
+
layout,
|
|
15584
|
+
fullWidth,
|
|
15585
|
+
children
|
|
15586
|
+
}
|
|
15587
|
+
);
|
|
15559
15588
|
}
|
|
15560
15589
|
);
|
|
15561
15590
|
var CollapsibleContent = (0, import_react59.forwardRef)(
|
|
@@ -16081,7 +16110,6 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
16081
16110
|
Divider,
|
|
16082
16111
|
Drawer,
|
|
16083
16112
|
DrawerBody,
|
|
16084
|
-
DrawerClose,
|
|
16085
16113
|
DrawerContent,
|
|
16086
16114
|
DrawerDescription,
|
|
16087
16115
|
DrawerFooter,
|