@milktop/react-ui 0.3.24 → 0.3.25

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.
@@ -1,3 +1,4 @@
1
+ import { type ButtonProps } from '../button/Button.js';
1
2
  import { type PopoverProps } from '../popover/Popover.js';
2
3
  import { type Classes } from '../utils.js';
3
4
  import '../theme.css';
@@ -14,6 +15,7 @@ export type DateRangeFilterProps = {
14
15
  presets?: (DateRangeKey | DateRangePreset)[];
15
16
  placeholder?: string | null;
16
17
  placement?: PopoverProps['placement'];
18
+ size?: ButtonProps['size'];
17
19
  locale?: string | null;
18
20
  className?: string;
19
21
  classes?: Classes<'trigger' | 'panel' | 'presets' | 'preset' | 'clear' | 'calendar'>;
@@ -37,6 +39,6 @@ export declare const dateRanges: {
37
39
  thisYear: () => Date[];
38
40
  lastYear: () => Date[];
39
41
  };
40
- declare function DateRangeFilterShortcut({ value, defaultValue, onValueChange, presets, placeholder, placement, locale: localeProp, className, classes, }: DateRangeFilterProps): import("react").JSX.Element;
42
+ declare function DateRangeFilterShortcut({ value, defaultValue, onValueChange, presets, placeholder, placement, size, locale: localeProp, className, classes, }: DateRangeFilterProps): import("react").JSX.Element;
41
43
  export declare const DateRangeFilter: typeof DateRangeFilterShortcut;
42
44
  export {};
@@ -12,6 +12,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  * your own (below), mixed in any order
13
13
  * - `placeholder`: the button's text with no dates ("All dates")
14
14
  * - `placement`: where the panel opens ('bottom-end')
15
+ * - `size`: the button's, to sit beside other controls ('sm', 'md' or 'lg')
15
16
  * - `locale`: for the dates on the button and the calendar (the
16
17
  * LocaleProvider's, or 'en-GB')
17
18
  *
@@ -91,7 +92,7 @@ function firstDayOf(locale) {
91
92
  return 1;
92
93
  }
93
94
  }
94
- function DateRangeFilterShortcut({ value, defaultValue, onValueChange, presets = ['today', 'last7', 'last30', 'thisMonth', 'lastMonth', 'thisQuarter', 'lastQuarter', 'thisYear', 'lastYear'], placeholder = null, placement = 'bottom-end', locale: localeProp = null, className, classes, }) {
95
+ function DateRangeFilterShortcut({ value, defaultValue, onValueChange, presets = ['today', 'last7', 'last30', 'thisMonth', 'lastMonth', 'thisQuarter', 'lastQuarter', 'thisYear', 'lastYear'], placeholder = null, placement = 'bottom-end', size = 'md', locale: localeProp = null, className, classes, }) {
95
96
  const t = useMessages();
96
97
  const app = useLocale();
97
98
  const locale = localeProp ?? app ?? 'en-GB';
@@ -130,6 +131,6 @@ function DateRangeFilterShortcut({ value, defaultValue, onValueChange, presets =
130
131
  return (_jsx(Popover, { placement: placement, "data-date-range-filter": "", onOpenChange: (open) => { if (open) {
131
132
  setPicking(dates);
132
133
  setShown((n) => n + 1);
133
- } }, trigger: _jsx(Button, { icon: "lucide:calendar", iconEnd: "lucide:chevron-down", className: cx(className, classes?.trigger), children: label }), children: _jsxs("div", { ...part('panel'), children: [_jsxs("div", { ...part('presets'), children: [items.map((item, i) => (_jsx(Button, { block: true, size: "sm", variant: "ghost", className: classes?.preset, "aria-pressed": matches(item), onClick: () => change(datesOf(item)), children: item.label }, i))), _jsx(Button, { block: true, size: "sm", icon: "lucide:x", className: classes?.clear, "data-clear": "", disabled: !dates.length, onClick: () => change([]), children: t.dateRangeFilter.clear })] }), _jsx(DatePicker, { inline: true, range: true, locale: locale, value: picking, onValueChange: picked, className: classes?.calendar }, shown)] }) }));
134
+ } }, trigger: _jsx(Button, { size: size, icon: "lucide:calendar", iconEnd: "lucide:chevron-down", className: cx(className, classes?.trigger), children: label }), children: _jsxs("div", { ...part('panel'), children: [_jsxs("div", { ...part('presets'), children: [items.map((item, i) => (_jsx(Button, { block: true, size: "sm", variant: "ghost", className: classes?.preset, "aria-pressed": matches(item), onClick: () => change(datesOf(item)), children: item.label }, i))), _jsx(Button, { block: true, size: "sm", icon: "lucide:x", className: classes?.clear, "data-clear": "", disabled: !dates.length, onClick: () => change([]), children: t.dateRangeFilter.clear })] }), _jsx(DatePicker, { inline: true, range: true, locale: locale, value: picking, onValueChange: picked, className: classes?.calendar }, shown)] }) }));
134
135
  }
135
136
  export const DateRangeFilter = DateRangeFilterShortcut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milktop/react-ui",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
4
4
  "description": "React components on Ark UI (Zag state machines), with imba-ui's API and design",
5
5
  "license": "MIT",
6
6
  "author": "André Goldstein",