@scalewing/react 0.6.1 → 0.7.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.
@@ -0,0 +1,3 @@
1
+ export declare function isDateOnly(value: string): boolean;
2
+ export declare function assertDateOnly(name: string, value: string, empty?: boolean): void;
3
+ export declare function isOutsideDateRange(value: string, min?: string, max?: string): boolean;
@@ -0,0 +1,31 @@
1
+ const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
2
+ function daysInMonth(year, month) {
3
+ if (month === 2) {
4
+ const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
5
+ return leap ? 29 : 28;
6
+ }
7
+ return [4, 6, 9, 11].includes(month) ? 30 : 31;
8
+ }
9
+ export function isDateOnly(value) {
10
+ const parts = DATE_ONLY.exec(value);
11
+ if (!parts)
12
+ return false;
13
+ const year = Number(parts[1]);
14
+ const month = Number(parts[2]);
15
+ const day = Number(parts[3]);
16
+ return (year >= 1 &&
17
+ month >= 1 &&
18
+ month <= 12 &&
19
+ day >= 1 &&
20
+ day <= daysInMonth(year, month));
21
+ }
22
+ export function assertDateOnly(name, value, empty = false) {
23
+ if (empty && value === '')
24
+ return;
25
+ if (!isDateOnly(value))
26
+ throw new RangeError(`${name} must be a valid YYYY-MM-DD date`);
27
+ }
28
+ export function isOutsideDateRange(value, min, max) {
29
+ return (value !== '' &&
30
+ ((min !== undefined && value < min) || (max !== undefined && value > max)));
31
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,13 @@
1
+ export { ActionMenu, type ActionMenuItem, type ActionMenuProps, } from './components/ActionMenu.js';
1
2
  export { Accordion } from './components/Accordion.js';
2
3
  export type { AccordionProps } from './components/Accordion.js';
4
+ export { Switch, type SwitchProps } from './components/Switch.js';
5
+ export { DateField, type DateFieldProps } from './components/DateField.js';
6
+ export { Checkbox, type CheckboxProps } from './components/Checkbox.js';
7
+ export { Spinner, type SpinnerProps, type SpinnerSize, } from './components/Spinner.js';
8
+ export { Progress, type ProgressProps, type ProgressTone, } from './components/Progress.js';
9
+ export { Tooltip, type TooltipProps } from './components/Tooltip.js';
10
+ export { RadioGroup, type RadioGroupOption, type RadioGroupProps, } from './components/RadioGroup.js';
3
11
  export { AppHeader, type AppHeaderProps } from './components/AppHeader.js';
4
12
  export { Badge, type BadgeProps, type BadgeSize, type BadgeTone, } from './components/Badge.js';
5
13
  export { BarChart, type BarChartItem, type BarChartProps, } from './components/BarChart.js';
@@ -22,3 +30,7 @@ export { Stack, type Align, type Justify, type StackProps, } from './components/
22
30
  export { Table, TableBody, TableCell, TableHeader, TableRow, type TableBodyProps, type TableCellProps, type TableDensity, type TableHeaderProps, type TableProps, type TableRowProps, } from './components/Table.js';
23
31
  export { Text, type TextElement, type TextProps } from './components/Text.js';
24
32
  export { ThemeProvider, useTheme, type ThemeProviderProps, } from './theme/ThemeProvider.js';
33
+ export { Separator } from './components/Separator.js';
34
+ export type { SeparatorOrientation, SeparatorProps, } from './components/Separator.js';
35
+ export { FilterChips } from './components/FilterChips.js';
36
+ export type { FilterChipOption, FilterChipsProps, } from './components/FilterChips.js';
package/dist/index.js CHANGED
@@ -1,4 +1,12 @@
1
+ export { ActionMenu, } from './components/ActionMenu.js';
1
2
  export { Accordion } from './components/Accordion.js';
3
+ export { Switch } from './components/Switch.js';
4
+ export { DateField } from './components/DateField.js';
5
+ export { Checkbox } from './components/Checkbox.js';
6
+ export { Spinner, } from './components/Spinner.js';
7
+ export { Progress, } from './components/Progress.js';
8
+ export { Tooltip } from './components/Tooltip.js';
9
+ export { RadioGroup, } from './components/RadioGroup.js';
2
10
  export { AppHeader } from './components/AppHeader.js';
3
11
  export { Badge, } from './components/Badge.js';
4
12
  export { BarChart, } from './components/BarChart.js';
@@ -17,3 +25,5 @@ export { Stack, } from './components/Stack.js';
17
25
  export { Table, TableBody, TableCell, TableHeader, TableRow, } from './components/Table.js';
18
26
  export { Text } from './components/Text.js';
19
27
  export { ThemeProvider, useTheme, } from './theme/ThemeProvider.js';
28
+ export { Separator } from './components/Separator.js';
29
+ export { FilterChips } from './components/FilterChips.js';