@refineui/react 0.0.8 → 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 +71 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +71 -30
- 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
|
@@ -3204,13 +3204,26 @@ var selectStyles = {
|
|
|
3204
3204
|
"border-refineui-hairline border-refineui-alias-border-default",
|
|
3205
3205
|
"bg-refineui-alias-background-primary px-refineui-size-medium py-refineui-size-x-small",
|
|
3206
3206
|
"text-refineui-alias-foreground-primary outline-none",
|
|
3207
|
-
"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)]"
|
|
3208
3217
|
),
|
|
3209
3218
|
/** Flush shell — consumer / parent owns padding, radius, surface. */
|
|
3210
|
-
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
|
+
),
|
|
3211
3223
|
triggerInner: "min-w-0 flex-1 overflow-hidden text-start",
|
|
3212
3224
|
triggerOpen: "text-refineui-alias-foreground-primary",
|
|
3213
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",
|
|
3214
3227
|
triggerPlainDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
3215
3228
|
value: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-start",
|
|
3216
3229
|
iconWrap: "inline-flex size-refineui-icon-xsmall shrink-0 items-center justify-center",
|
|
@@ -3491,9 +3504,12 @@ function Select({
|
|
|
3491
3504
|
}
|
|
3492
3505
|
var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props, forwardedRef) {
|
|
3493
3506
|
const { className, children, style, appearance = "filled", ...triggerRest } = props;
|
|
3494
|
-
const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value
|
|
3495
|
-
const
|
|
3507
|
+
const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value } = useSelectCtx();
|
|
3508
|
+
const isPlaceholder = value === "";
|
|
3496
3509
|
const isPlain = appearance === "plain";
|
|
3510
|
+
const isGhost = appearance === "ghost";
|
|
3511
|
+
const isFilled = appearance === "filled";
|
|
3512
|
+
const [pressed, setPressed] = (0, import_react11.useState)(false);
|
|
3497
3513
|
const setRefs = (0, import_react11.useCallback)(
|
|
3498
3514
|
(node) => {
|
|
3499
3515
|
triggerRef.current = node;
|
|
@@ -3502,6 +3518,7 @@ var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props
|
|
|
3502
3518
|
},
|
|
3503
3519
|
[forwardedRef, triggerRef]
|
|
3504
3520
|
);
|
|
3521
|
+
const clearPressed = (0, import_react11.useCallback)(() => setPressed(false), []);
|
|
3505
3522
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3506
3523
|
"button",
|
|
3507
3524
|
{
|
|
@@ -3514,20 +3531,31 @@ var SelectTrigger = (0, import_react11.forwardRef)(function SelectTrigger2(props
|
|
|
3514
3531
|
"data-appearance": appearance,
|
|
3515
3532
|
"data-size": size,
|
|
3516
3533
|
"data-state": open ? "open" : "closed",
|
|
3517
|
-
"data-
|
|
3534
|
+
"data-pressed": pressed ? "" : void 0,
|
|
3535
|
+
"data-placeholder": isPlaceholder ? "" : void 0,
|
|
3518
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,
|
|
3519
3544
|
onMouseDown: (event) => {
|
|
3520
3545
|
event.preventDefault();
|
|
3546
|
+
if (disabled) return;
|
|
3521
3547
|
setOpen(!open);
|
|
3522
3548
|
triggerRef.current?.focus();
|
|
3523
3549
|
},
|
|
3524
3550
|
onKeyDown,
|
|
3525
3551
|
className: (0, import_clsx28.clsx)(
|
|
3526
3552
|
"data-[placeholder]:[&_[data-refineui-select-value]]:text-refineui-alias-foreground-placeholder",
|
|
3527
|
-
isPlain
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
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),
|
|
3531
3559
|
fullWidth && "w-full",
|
|
3532
3560
|
className
|
|
3533
3561
|
),
|
|
@@ -3553,7 +3581,20 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
3553
3581
|
function SelectValue({ placeholder, className, ...props }) {
|
|
3554
3582
|
const { value, getLabelByValue, placeholder: rootPlaceholder } = useSelectCtx();
|
|
3555
3583
|
const label = getLabelByValue(value);
|
|
3556
|
-
|
|
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
|
+
);
|
|
3557
3598
|
}
|
|
3558
3599
|
function SelectIcon({ children, className, ...props }) {
|
|
3559
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 }) });
|
|
@@ -7609,15 +7650,10 @@ var calendarStyles = {
|
|
|
7609
7650
|
dayWrapEndpoint: "box-border flex size-refineui-calendar-day-size items-center justify-center bg-refineui-alias-background-primary-hover",
|
|
7610
7651
|
dayWrapEndpointStart: "rounded-s-refineui-large",
|
|
7611
7652
|
dayWrapEndpointEnd: "rounded-e-refineui-large",
|
|
7612
|
-
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",
|
|
7613
7654
|
header: "flex w-full min-w-0 items-center justify-between pb-refineui-size-large",
|
|
7614
7655
|
navButton: "shrink-0 text-refineui-alias-foreground-primary",
|
|
7615
|
-
captionButton:
|
|
7616
|
-
"shrink-0",
|
|
7617
|
-
"border-refineui-none border-transparent bg-transparent",
|
|
7618
|
-
"px-refineui-size-x-small py-refineui-size-xx-small",
|
|
7619
|
-
"text-refineui-alias-foreground-primary"
|
|
7620
|
-
),
|
|
7656
|
+
captionButton: "shrink-0",
|
|
7621
7657
|
body: "flex flex-col gap-refineui-size-small",
|
|
7622
7658
|
weekday: (0, import_clsx58.clsx)(
|
|
7623
7659
|
componentTextClass(componentTypographyTokens.calendar.weekday),
|
|
@@ -7646,12 +7682,15 @@ function normalizeRange(start, end) {
|
|
|
7646
7682
|
function getWeekdayLabels(weekStartsOn) {
|
|
7647
7683
|
return [...WEEKDAYS.slice(weekStartsOn), ...WEEKDAYS.slice(0, weekStartsOn)];
|
|
7648
7684
|
}
|
|
7649
|
-
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) {
|
|
7650
7689
|
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(new Date(year, month, 1));
|
|
7651
7690
|
}
|
|
7652
7691
|
var MONTH_LABELS = Array.from(
|
|
7653
7692
|
{ length: MONTH_COUNT },
|
|
7654
|
-
(_, monthIndex) =>
|
|
7693
|
+
(_, monthIndex) => formatMonthLabel(2e3, monthIndex)
|
|
7655
7694
|
);
|
|
7656
7695
|
function yearOptionsForView(viewYear) {
|
|
7657
7696
|
const referenceYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
@@ -7672,16 +7711,16 @@ function CalendarCaptionSelect({
|
|
|
7672
7711
|
children
|
|
7673
7712
|
}) {
|
|
7674
7713
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Select, { value, onValueChange, "aria-label": ariaLabel, size: "sm", children: [
|
|
7675
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.
|
|
7714
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7676
7715
|
SelectTrigger,
|
|
7677
7716
|
{
|
|
7678
|
-
appearance: "
|
|
7717
|
+
appearance: "ghost",
|
|
7679
7718
|
"data-calendar-header": header,
|
|
7680
|
-
className:
|
|
7681
|
-
|
|
7682
|
-
"
|
|
7683
|
-
|
|
7684
|
-
|
|
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 })
|
|
7685
7724
|
}
|
|
7686
7725
|
),
|
|
7687
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 }) }) })
|
|
@@ -7737,7 +7776,9 @@ function Calendar({
|
|
|
7737
7776
|
const cells = getMonthGrid(year, month, weekStartsOn);
|
|
7738
7777
|
const weeks = chunkWeeks(cells);
|
|
7739
7778
|
const weekdayLabels = getWeekdayLabels(weekStartsOn);
|
|
7740
|
-
const
|
|
7779
|
+
const monthLabel = formatMonthLabel(year, month);
|
|
7780
|
+
const monthNameLong = formatMonthNameLong(year, month);
|
|
7781
|
+
const yearOptions = yearOptionsForView(year);
|
|
7741
7782
|
const getDateFromCell = (d, monthOffset) => new Date(year, month + monthOffset, d);
|
|
7742
7783
|
const setRange = (start, end) => {
|
|
7743
7784
|
if (onRangeChange) onRangeChange(start, end);
|
|
@@ -7928,8 +7969,8 @@ function Calendar({
|
|
|
7928
7969
|
CalendarCaptionSelect,
|
|
7929
7970
|
{
|
|
7930
7971
|
value: String(month),
|
|
7931
|
-
placeholder:
|
|
7932
|
-
ariaLabel: `Month: ${
|
|
7972
|
+
placeholder: monthLabel,
|
|
7973
|
+
ariaLabel: `Month: ${monthNameLong}`,
|
|
7933
7974
|
header: "caption-month",
|
|
7934
7975
|
onValueChange: (nextMonth) => {
|
|
7935
7976
|
setView(new Date(year, Number.parseInt(nextMonth, 10), 1));
|
|
@@ -7947,7 +7988,7 @@ function Calendar({
|
|
|
7947
7988
|
onValueChange: (nextYear) => {
|
|
7948
7989
|
setView(new Date(Number.parseInt(nextYear, 10), month, 1));
|
|
7949
7990
|
},
|
|
7950
|
-
children:
|
|
7991
|
+
children: yearOptions.map((yearOption) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectItem, { value: String(yearOption), children: String(yearOption) }, yearOption))
|
|
7951
7992
|
}
|
|
7952
7993
|
),
|
|
7953
7994
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|