@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.d.cts CHANGED
@@ -6087,9 +6087,10 @@ declare const RadioInput: react.ForwardRefExoticComponent<RadioInputProps & reac
6087
6087
  type SelectSize = "sm" | "md" | "lg";
6088
6088
  /**
6089
6089
  * `filled` — standalone field chrome (border + surface).
6090
- * `plain` — flush trigger for composed surfaces (Footer locale, Calendar caption).
6090
+ * `ghost` — compact chrome without field border (Calendar caption, Button-like ghost).
6091
+ * `plain` — flush trigger; consumer / parent owns padding, radius, surface.
6091
6092
  */
6092
- type SelectTriggerAppearance = "filled" | "plain";
6093
+ type SelectTriggerAppearance = "filled" | "ghost" | "plain";
6093
6094
  interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
6094
6095
  value?: string;
6095
6096
  defaultValue?: string;
@@ -6106,7 +6107,8 @@ interface SelectTriggerProps extends HTMLAttributes<HTMLButtonElement> {
6106
6107
  children?: ReactNode;
6107
6108
  /**
6108
6109
  * `filled` — default field chrome.
6109
- * `plain` — no field chrome; compose visuals via `className` / parent recipe.
6110
+ * `ghost` — no field border; gap + radius + ghost hover plate.
6111
+ * `plain` — no chrome; compose visuals via `className` / parent recipe.
6110
6112
  * @default "filled"
6111
6113
  */
6112
6114
  appearance?: SelectTriggerAppearance;
package/dist/index.d.ts CHANGED
@@ -6087,9 +6087,10 @@ declare const RadioInput: react.ForwardRefExoticComponent<RadioInputProps & reac
6087
6087
  type SelectSize = "sm" | "md" | "lg";
6088
6088
  /**
6089
6089
  * `filled` — standalone field chrome (border + surface).
6090
- * `plain` — flush trigger for composed surfaces (Footer locale, Calendar caption).
6090
+ * `ghost` — compact chrome without field border (Calendar caption, Button-like ghost).
6091
+ * `plain` — flush trigger; consumer / parent owns padding, radius, surface.
6091
6092
  */
6092
- type SelectTriggerAppearance = "filled" | "plain";
6093
+ type SelectTriggerAppearance = "filled" | "ghost" | "plain";
6093
6094
  interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
6094
6095
  value?: string;
6095
6096
  defaultValue?: string;
@@ -6106,7 +6107,8 @@ interface SelectTriggerProps extends HTMLAttributes<HTMLButtonElement> {
6106
6107
  children?: ReactNode;
6107
6108
  /**
6108
6109
  * `filled` — default field chrome.
6109
- * `plain` — no field chrome; compose visuals via `className` / parent recipe.
6110
+ * `ghost` — no field border; gap + radius + ghost hover plate.
6111
+ * `plain` — no chrome; compose visuals via `className` / parent recipe.
6110
6112
  * @default "filled"
6111
6113
  */
6112
6114
  appearance?: SelectTriggerAppearance;
package/dist/index.js CHANGED
@@ -2937,13 +2937,26 @@ var selectStyles = {
2937
2937
  "border-refineui-hairline border-refineui-alias-border-default",
2938
2938
  "bg-refineui-alias-background-primary px-refineui-size-medium py-refineui-size-x-small",
2939
2939
  "text-refineui-alias-foreground-primary outline-none",
2940
- "transition-[color,background-color,border-color] duration-[var(--refineui-motion-duration-fast)]"
2940
+ "transition-[color,background-color,border-color,transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
2941
+ ),
2942
+ /** Ghost plate — same gap/radius as filled, no field border (Button ghost-like). */
2943
+ triggerGhost: clsx27(
2944
+ "box-border inline-flex cursor-pointer items-center justify-between",
2945
+ "gap-refineui-size-x-small rounded-refineui-large",
2946
+ "border-refineui-none border-transparent bg-transparent",
2947
+ "px-refineui-size-x-small py-refineui-size-xx-small",
2948
+ "text-refineui-alias-foreground-primary outline-none",
2949
+ "transition-[color,background-color,transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
2941
2950
  ),
2942
2951
  /** Flush shell — consumer / parent owns padding, radius, surface. */
2943
- triggerPlain: "box-border inline-flex cursor-pointer items-center outline-none",
2952
+ triggerPlain: clsx27(
2953
+ "box-border inline-flex cursor-pointer items-center outline-none",
2954
+ "transition-[transform] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
2955
+ ),
2944
2956
  triggerInner: "min-w-0 flex-1 overflow-hidden text-start",
2945
2957
  triggerOpen: "text-refineui-alias-foreground-primary",
2946
2958
  triggerDisabled: "cursor-not-allowed border-refineui-alias-border-disabled bg-refineui-alias-background-surface-disabled text-refineui-alias-foreground-disabled",
2959
+ triggerGhostDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
2947
2960
  triggerPlainDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
2948
2961
  value: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-start",
2949
2962
  iconWrap: "inline-flex size-refineui-icon-xsmall shrink-0 items-center justify-center",
@@ -3224,9 +3237,12 @@ function Select({
3224
3237
  }
3225
3238
  var SelectTrigger = forwardRef6(function SelectTrigger2(props, forwardedRef) {
3226
3239
  const { className, children, style, appearance = "filled", ...triggerRest } = props;
3227
- const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value, getLabelByValue } = useSelectCtx();
3228
- const hasLabel = Boolean(getLabelByValue(value));
3240
+ const { open, setOpen, triggerRef, onKeyDown, size, fullWidth, disabled, value } = useSelectCtx();
3241
+ const isPlaceholder = value === "";
3229
3242
  const isPlain = appearance === "plain";
3243
+ const isGhost = appearance === "ghost";
3244
+ const isFilled = appearance === "filled";
3245
+ const [pressed, setPressed] = useState5(false);
3230
3246
  const setRefs = useCallback4(
3231
3247
  (node) => {
3232
3248
  triggerRef.current = node;
@@ -3235,6 +3251,7 @@ var SelectTrigger = forwardRef6(function SelectTrigger2(props, forwardedRef) {
3235
3251
  },
3236
3252
  [forwardedRef, triggerRef]
3237
3253
  );
3254
+ const clearPressed = useCallback4(() => setPressed(false), []);
3238
3255
  return /* @__PURE__ */ jsxs4(
3239
3256
  "button",
3240
3257
  {
@@ -3247,20 +3264,31 @@ var SelectTrigger = forwardRef6(function SelectTrigger2(props, forwardedRef) {
3247
3264
  "data-appearance": appearance,
3248
3265
  "data-size": size,
3249
3266
  "data-state": open ? "open" : "closed",
3250
- "data-placeholder": hasLabel ? void 0 : "",
3267
+ "data-pressed": pressed ? "" : void 0,
3268
+ "data-placeholder": isPlaceholder ? "" : void 0,
3251
3269
  disabled,
3270
+ onPointerDown: (event) => {
3271
+ if (disabled || event.button !== 0) return;
3272
+ setPressed(true);
3273
+ },
3274
+ onPointerUp: clearPressed,
3275
+ onPointerLeave: clearPressed,
3276
+ onPointerCancel: clearPressed,
3252
3277
  onMouseDown: (event) => {
3253
3278
  event.preventDefault();
3279
+ if (disabled) return;
3254
3280
  setOpen(!open);
3255
3281
  triggerRef.current?.focus();
3256
3282
  },
3257
3283
  onKeyDown,
3258
3284
  className: clsx28(
3259
3285
  "data-[placeholder]:[&_[data-refineui-select-value]]:text-refineui-alias-foreground-placeholder",
3260
- isPlain ? selectStyles.triggerPlain : selectStyles.trigger,
3261
- !isPlain && selectTriggerSizeClass[size],
3262
- !isPlain && open && selectStyles.triggerOpen,
3263
- disabled && (isPlain ? selectStyles.triggerPlainDisabled : selectStyles.triggerDisabled),
3286
+ isPlain && selectStyles.triggerPlain,
3287
+ isGhost && selectStyles.triggerGhost,
3288
+ isFilled && selectStyles.trigger,
3289
+ (isFilled || isGhost) && selectTriggerSizeClass[size],
3290
+ isFilled && open && selectStyles.triggerOpen,
3291
+ disabled && (isPlain ? selectStyles.triggerPlainDisabled : isGhost ? selectStyles.triggerGhostDisabled : selectStyles.triggerDisabled),
3264
3292
  fullWidth && "w-full",
3265
3293
  className
3266
3294
  ),
@@ -3286,7 +3314,20 @@ SelectTrigger.displayName = "SelectTrigger";
3286
3314
  function SelectValue({ placeholder, className, ...props }) {
3287
3315
  const { value, getLabelByValue, placeholder: rootPlaceholder } = useSelectCtx();
3288
3316
  const label = getLabelByValue(value);
3289
- return /* @__PURE__ */ jsx22("span", { "data-refineui-select-value": "", className: clsx28(selectStyles.value, !label && "text-refineui-alias-foreground-placeholder", className), ...props, children: label || placeholder || rootPlaceholder || "Select..." });
3317
+ const isPlaceholder = value === "";
3318
+ return /* @__PURE__ */ jsx22(
3319
+ "span",
3320
+ {
3321
+ "data-refineui-select-value": "",
3322
+ className: clsx28(
3323
+ selectStyles.value,
3324
+ isPlaceholder && "text-refineui-alias-foreground-placeholder",
3325
+ className
3326
+ ),
3327
+ ...props,
3328
+ children: label || placeholder || rootPlaceholder || "Select..."
3329
+ }
3330
+ );
3290
3331
  }
3291
3332
  function SelectIcon({ children, className, ...props }) {
3292
3333
  return /* @__PURE__ */ jsx22("span", { className: clsx28(selectStyles.iconWrap, className), ...props, children: children ?? /* @__PURE__ */ jsx22(WebIcon, { name: "chevron-down", size: iconSizes4.xsmall }) });
@@ -7394,15 +7435,10 @@ var calendarStyles = {
7394
7435
  dayWrapEndpoint: "box-border flex size-refineui-calendar-day-size items-center justify-center bg-refineui-alias-background-primary-hover",
7395
7436
  dayWrapEndpointStart: "rounded-s-refineui-large",
7396
7437
  dayWrapEndpointEnd: "rounded-e-refineui-large",
7397
- 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",
7438
+ 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",
7398
7439
  header: "flex w-full min-w-0 items-center justify-between pb-refineui-size-large",
7399
7440
  navButton: "shrink-0 text-refineui-alias-foreground-primary",
7400
- captionButton: clsx58(
7401
- "shrink-0",
7402
- "border-refineui-none border-transparent bg-transparent",
7403
- "px-refineui-size-x-small py-refineui-size-xx-small",
7404
- "text-refineui-alias-foreground-primary"
7405
- ),
7441
+ captionButton: "shrink-0",
7406
7442
  body: "flex flex-col gap-refineui-size-small",
7407
7443
  weekday: clsx58(
7408
7444
  componentTextClass(componentTypographyTokens.calendar.weekday),
@@ -7431,12 +7467,15 @@ function normalizeRange(start, end) {
7431
7467
  function getWeekdayLabels(weekStartsOn) {
7432
7468
  return [...WEEKDAYS.slice(weekStartsOn), ...WEEKDAYS.slice(0, weekStartsOn)];
7433
7469
  }
7434
- function formatMonthName(year, month) {
7470
+ function formatMonthLabel(year, month) {
7471
+ return new Intl.DateTimeFormat("en-US", { month: "short" }).format(new Date(year, month, 1));
7472
+ }
7473
+ function formatMonthNameLong(year, month) {
7435
7474
  return new Intl.DateTimeFormat("en-US", { month: "long" }).format(new Date(year, month, 1));
7436
7475
  }
7437
7476
  var MONTH_LABELS = Array.from(
7438
7477
  { length: MONTH_COUNT },
7439
- (_, monthIndex) => formatMonthName(2e3, monthIndex)
7478
+ (_, monthIndex) => formatMonthLabel(2e3, monthIndex)
7440
7479
  );
7441
7480
  function yearOptionsForView(viewYear) {
7442
7481
  const referenceYear = (/* @__PURE__ */ new Date()).getFullYear();
@@ -7457,16 +7496,16 @@ function CalendarCaptionSelect({
7457
7496
  children
7458
7497
  }) {
7459
7498
  return /* @__PURE__ */ jsxs16(Select, { value, onValueChange, "aria-label": ariaLabel, size: "sm", children: [
7460
- /* @__PURE__ */ jsxs16(
7499
+ /* @__PURE__ */ jsx45(
7461
7500
  SelectTrigger,
7462
7501
  {
7463
- appearance: "plain",
7502
+ appearance: "ghost",
7464
7503
  "data-calendar-header": header,
7465
- className: calendarStyles.captionButton,
7466
- children: [
7467
- " ",
7468
- /* @__PURE__ */ jsx45(SelectValue, { placeholder })
7469
- ]
7504
+ className: clsx59(
7505
+ calendarStyles.captionButton,
7506
+ header === "caption-year" && "tabular-nums"
7507
+ ),
7508
+ children: /* @__PURE__ */ jsx45(SelectValue, { placeholder })
7470
7509
  }
7471
7510
  ),
7472
7511
  /* @__PURE__ */ jsx45(SelectPortal, { children: /* @__PURE__ */ jsx45(SelectContent, { children: /* @__PURE__ */ jsx45(SelectGroup, { children }) }) })
@@ -7522,7 +7561,9 @@ function Calendar({
7522
7561
  const cells = getMonthGrid(year, month, weekStartsOn);
7523
7562
  const weeks = chunkWeeks(cells);
7524
7563
  const weekdayLabels = getWeekdayLabels(weekStartsOn);
7525
- const monthName = formatMonthName(year, month);
7564
+ const monthLabel = formatMonthLabel(year, month);
7565
+ const monthNameLong = formatMonthNameLong(year, month);
7566
+ const yearOptions = yearOptionsForView(year);
7526
7567
  const getDateFromCell = (d, monthOffset) => new Date(year, month + monthOffset, d);
7527
7568
  const setRange = (start, end) => {
7528
7569
  if (onRangeChange) onRangeChange(start, end);
@@ -7713,8 +7754,8 @@ function Calendar({
7713
7754
  CalendarCaptionSelect,
7714
7755
  {
7715
7756
  value: String(month),
7716
- placeholder: monthName,
7717
- ariaLabel: `Month: ${monthName}`,
7757
+ placeholder: monthLabel,
7758
+ ariaLabel: `Month: ${monthNameLong}`,
7718
7759
  header: "caption-month",
7719
7760
  onValueChange: (nextMonth) => {
7720
7761
  setView(new Date(year, Number.parseInt(nextMonth, 10), 1));
@@ -7732,7 +7773,7 @@ function Calendar({
7732
7773
  onValueChange: (nextYear) => {
7733
7774
  setView(new Date(Number.parseInt(nextYear, 10), month, 1));
7734
7775
  },
7735
- children: yearOptionsForView(year).map((yearOption) => /* @__PURE__ */ jsx45(SelectItem, { value: String(yearOption), children: String(yearOption) }, yearOption))
7776
+ children: yearOptions.map((yearOption) => /* @__PURE__ */ jsx45(SelectItem, { value: String(yearOption), children: String(yearOption) }, yearOption))
7736
7777
  }
7737
7778
  ),
7738
7779
  /* @__PURE__ */ jsx45(