@sybilion/uilib 1.4.21 → 1.4.22

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.
Files changed (65) hide show
  1. package/assets/globals.css +3 -0
  2. package/dist/agent-glossary/workspace.generated.ts +2 -0
  3. package/dist/agent-glossary/workspace.index.md +2 -0
  4. package/dist/agent-glossary/workspace.md +2 -0
  5. package/dist/esm/components/ui/Checkbox/Checkbox.js +2 -2
  6. package/dist/esm/components/ui/Checkbox/Checkbox.styl.js +2 -2
  7. package/dist/esm/components/ui/DatePicker/Calendar.js +72 -0
  8. package/dist/esm/components/ui/DatePicker/DatePicker.js +81 -0
  9. package/dist/esm/components/ui/DatePicker/DatePicker.styl.js +7 -0
  10. package/dist/esm/components/ui/DatePicker/DatePickerInput.js +70 -0
  11. package/dist/esm/components/ui/DatePicker/DateRangePickerInput.js +130 -0
  12. package/dist/esm/components/ui/DatePicker/dateUtils.js +137 -0
  13. package/dist/esm/components/ui/RadioGroup/RadioGroup.helpers.js +6 -0
  14. package/dist/esm/components/ui/RadioGroup/RadioGroup.js +18 -0
  15. package/dist/esm/components/ui/RadioGroup/RadioGroup.styl.js +7 -0
  16. package/dist/esm/index.js +5 -0
  17. package/dist/esm/types/src/components/ui/Checkbox/Checkbox.d.ts +1 -1
  18. package/dist/esm/types/src/components/ui/Checkbox/Checkbox.types.d.ts +2 -0
  19. package/dist/esm/types/src/components/ui/Checkbox/index.d.ts +1 -1
  20. package/dist/esm/types/src/components/ui/DatePicker/Calendar.d.ts +2 -0
  21. package/dist/esm/types/src/components/ui/DatePicker/DatePicker.d.ts +2 -0
  22. package/dist/esm/types/src/components/ui/DatePicker/DatePicker.types.d.ts +60 -0
  23. package/dist/esm/types/src/components/ui/DatePicker/DatePickerInput.d.ts +2 -0
  24. package/dist/esm/types/src/components/ui/DatePicker/DateRangePickerInput.d.ts +2 -0
  25. package/dist/esm/types/src/components/ui/DatePicker/dateUtils.d.ts +30 -0
  26. package/dist/esm/types/src/components/ui/DatePicker/index.d.ts +6 -0
  27. package/dist/esm/types/src/components/ui/RadioGroup/RadioGroup.d.ts +4 -0
  28. package/dist/esm/types/src/components/ui/RadioGroup/RadioGroup.example.d.ts +1 -0
  29. package/dist/esm/types/src/components/ui/RadioGroup/RadioGroup.helpers.d.ts +3 -0
  30. package/dist/esm/types/src/components/ui/RadioGroup/RadioGroup.types.d.ts +11 -0
  31. package/dist/esm/types/src/components/ui/RadioGroup/index.d.ts +2 -0
  32. package/dist/esm/types/src/docs/pages/DatePickerPage.d.ts +1 -0
  33. package/dist/esm/types/src/docs/pages/RadioGroupPage.d.ts +1 -0
  34. package/dist/esm/types/src/index.d.ts +2 -0
  35. package/package.json +2 -1
  36. package/src/components/ui/Checkbox/AGENT.md +1 -0
  37. package/src/components/ui/Checkbox/Checkbox.styl +26 -2
  38. package/src/components/ui/Checkbox/Checkbox.styl.d.ts +4 -0
  39. package/src/components/ui/Checkbox/Checkbox.tsx +3 -3
  40. package/src/components/ui/Checkbox/Checkbox.types.ts +5 -1
  41. package/src/components/ui/Checkbox/index.ts +1 -1
  42. package/src/components/ui/DatePicker/AGENT.md +45 -0
  43. package/src/components/ui/DatePicker/Calendar.tsx +160 -0
  44. package/src/components/ui/DatePicker/DatePicker.styl +219 -0
  45. package/src/components/ui/DatePicker/DatePicker.styl.d.ts +39 -0
  46. package/src/components/ui/DatePicker/DatePicker.tsx +160 -0
  47. package/src/components/ui/DatePicker/DatePicker.types.ts +91 -0
  48. package/src/components/ui/DatePicker/DatePickerInput.tsx +169 -0
  49. package/src/components/ui/DatePicker/DateRangePickerInput.tsx +276 -0
  50. package/src/components/ui/DatePicker/dateUtils.ts +199 -0
  51. package/src/components/ui/DatePicker/index.ts +13 -0
  52. package/src/components/ui/RadioGroup/AGENT.md +24 -0
  53. package/src/components/ui/RadioGroup/RadioGroup.example.tsx +136 -0
  54. package/src/components/ui/RadioGroup/RadioGroup.helpers.ts +11 -0
  55. package/src/components/ui/RadioGroup/RadioGroup.styl +70 -0
  56. package/src/components/ui/RadioGroup/RadioGroup.styl.d.ts +13 -0
  57. package/src/components/ui/RadioGroup/RadioGroup.tsx +58 -0
  58. package/src/components/ui/RadioGroup/RadioGroup.types.ts +19 -0
  59. package/src/components/ui/RadioGroup/index.ts +6 -0
  60. package/src/docs/pages/CheckboxPage.tsx +129 -18
  61. package/src/docs/pages/DatePickerPage.tsx +183 -0
  62. package/src/docs/pages/FormsOverviewPage.tsx +131 -0
  63. package/src/docs/pages/RadioGroupPage.tsx +21 -0
  64. package/src/docs/registry.ts +12 -0
  65. package/src/index.ts +2 -0
@@ -0,0 +1,7 @@
1
+ import styleInject from 'style-inject';
2
+
3
+ var css_248z = ".RadioGroup_groupRoot__-1xDP{display:grid;grid-gap:var(--p-2);gap:var(--p-2)}.RadioGroup_groupRoot__-1xDP[data-orientation=horizontal]{display:flex;flex-direction:row;flex-wrap:wrap;gap:var(--p-4)}.RadioGroup_radioRoot__WutEB{align-items:center;background:transparent;border:1px solid var(--input);border-radius:50%;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;outline:none;transition:box-shadow .15s ease-in-out}.RadioGroup_dark__1WqhQ .RadioGroup_radioRoot__WutEB{background-color:var(--input-30)}.RadioGroup_radioRoot__WutEB[data-state=checked]{border-color:var(--primary);color:var(--primary)}.RadioGroup_dark__1WqhQ .RadioGroup_radioRoot__WutEB[data-state=checked]{border-color:var(--primary)}.RadioGroup_radioRoot__WutEB:focus-visible{border-color:var(--ring);box-shadow:0 0 0 3px var(--ring-50)}.RadioGroup_radioRoot__WutEB[aria-invalid=true]{border-color:var(--destructive);box-shadow:0 0 0 3px var(--destructive-200)}.RadioGroup_dark__1WqhQ .RadioGroup_radioRoot__WutEB[aria-invalid=true]{box-shadow:0 0 0 3px var(--destructive-400)}.RadioGroup_radioRoot__WutEB:disabled{cursor:not-allowed;opacity:.5}.RadioGroup_radioIndicator__5-PXc{background-color:currentColor;border-radius:50%;color:currentColor;height:calc(100% - var(--dot-gap));transition:none;width:calc(100% - var(--dot-gap))}.RadioGroup_size-sm__15x--{--dot-gap:3px;height:var(--icon-size-sm);width:var(--icon-size-sm)}.RadioGroup_size-md__tKOM-{--dot-gap:4px;height:var(--icon-size-md);width:var(--icon-size-md)}.RadioGroup_size-lg__SV78n{--dot-gap:5px;height:var(--icon-size-lg);width:var(--icon-size-lg)}";
4
+ var S = {"groupRoot":"RadioGroup_groupRoot__-1xDP","radioRoot":"RadioGroup_radioRoot__WutEB","dark":"RadioGroup_dark__1WqhQ","radioIndicator":"RadioGroup_radioIndicator__5-PXc","size-sm":"RadioGroup_size-sm__15x--","size-md":"RadioGroup_size-md__tKOM-","size-lg":"RadioGroup_size-lg__SV78n"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
package/dist/esm/index.js CHANGED
@@ -47,6 +47,10 @@ export { MessageRole } from './components/ui/Chat/Chat.types.js';
47
47
  export { CsvIcon } from './components/icons/CsvIcon/CsvIcon.js';
48
48
  export { Checkbox } from './components/ui/Checkbox/Checkbox.js';
49
49
  export { Confirm } from './components/ui/Confirm/Confirm.js';
50
+ export { Calendar } from './components/ui/DatePicker/Calendar.js';
51
+ export { DatePicker } from './components/ui/DatePicker/DatePicker.js';
52
+ export { DatePickerInput } from './components/ui/DatePicker/DatePickerInput.js';
53
+ export { DateRangePickerInput } from './components/ui/DatePicker/DateRangePickerInput.js';
50
54
  export { Dialog } from './components/ui/Dialog/Dialog.js';
51
55
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from './components/ui/Drawer/Drawer.js';
52
56
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from './components/ui/DropdownMenu/DropdownMenu.js';
@@ -88,6 +92,7 @@ export { PageTabs } from './components/ui/Page/PageTabs/PageTabs.js';
88
92
  export { PageColumns } from './components/ui/Page/PageColumns/PageColumns.js';
89
93
  export { SectionHeader } from './components/ui/Page/SectionHeader/SectionHeader.js';
90
94
  export { Progress } from './components/ui/Progress/Progress.js';
95
+ export { RadioGroup, RadioGroupItem } from './components/ui/RadioGroup/RadioGroup.js';
91
96
  export { RegionSelector } from './components/ui/RegionCoords/RegionSelector.js';
92
97
  export { Renamer } from './components/ui/Renamer/Renamer.js';
93
98
  export { Select, SelectContent, SelectGroup, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/Select/Select.js';
@@ -1,3 +1,3 @@
1
1
  import type { CheckboxProps } from './Checkbox.types';
2
- declare function Checkbox({ className, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function Checkbox({ className, size, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
3
3
  export { Checkbox };
@@ -1,3 +1,5 @@
1
1
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
2
+ export type CheckboxSize = 'sm' | 'md' | 'lg';
2
3
  export interface CheckboxProps extends React.ComponentProps<typeof CheckboxPrimitive.Root> {
4
+ size?: CheckboxSize;
3
5
  }
@@ -1,2 +1,2 @@
1
1
  export { Checkbox } from './Checkbox';
2
- export type { CheckboxProps } from './Checkbox.types';
2
+ export type { CheckboxProps, CheckboxSize } from './Checkbox.types';
@@ -0,0 +1,2 @@
1
+ import type { CalendarProps } from './DatePicker.types';
2
+ export declare function Calendar({ className, mode, value, rangeStart, rangeEnd, rangeHover, viewMonth, onViewMonthChange, onSelect, onDayHover, startOfWeek, minDate, maxDate, disabledDate, size, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { DatePickerProps } from './DatePicker.types';
2
+ export declare function DatePicker({ className, mode, value, onChange, rangeValue, onRangeChange, size, calendarProps, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import type { DateRangeValue, MonthView } from './dateUtils';
2
+ export type DatePickerSize = 'sm' | 'md' | 'lg';
3
+ export type DatePickerMode = 'single' | 'range';
4
+ export type CalendarProps = {
5
+ className?: string;
6
+ mode?: DatePickerMode;
7
+ value?: string;
8
+ rangeStart?: string;
9
+ rangeEnd?: string;
10
+ rangeHover?: string;
11
+ viewMonth?: MonthView;
12
+ onViewMonthChange?: (viewMonth: MonthView) => void;
13
+ onSelect?: (value: string) => void;
14
+ onDayHover?: (value: string | undefined) => void;
15
+ startOfWeek?: 0 | 1;
16
+ minDate?: string;
17
+ maxDate?: string;
18
+ disabledDate?: (date: string) => boolean;
19
+ size?: DatePickerSize;
20
+ };
21
+ export type DatePickerProps = {
22
+ className?: string;
23
+ mode?: DatePickerMode;
24
+ value?: string;
25
+ onChange?: (value: string) => void;
26
+ rangeValue?: DateRangeValue | null;
27
+ onRangeChange?: (value: DateRangeValue | null) => void;
28
+ size?: DatePickerSize;
29
+ calendarProps?: Omit<CalendarProps, 'value' | 'onSelect' | 'size' | 'mode' | 'rangeStart' | 'rangeEnd' | 'rangeHover' | 'onDayHover'>;
30
+ };
31
+ export type DateRangePickerInputProps = Omit<React.ComponentProps<'input'>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'size'> & {
32
+ value?: DateRangeValue | null;
33
+ defaultValue?: DateRangeValue | null;
34
+ onChange?: (value: DateRangeValue | null) => void;
35
+ size?: DatePickerSize;
36
+ variant?: 'default' | 'clean';
37
+ startPlaceholder?: string;
38
+ endPlaceholder?: string;
39
+ minDate?: string;
40
+ maxDate?: string;
41
+ disabledDate?: (date: string) => boolean;
42
+ calendarProps?: Omit<CalendarProps, 'value' | 'onSelect' | 'size' | 'mode' | 'rangeStart' | 'rangeEnd' | 'rangeHover' | 'onDayHover'>;
43
+ open?: boolean;
44
+ onOpenChange?: (open: boolean) => void;
45
+ };
46
+ export type DatePickerInputProps = Omit<React.ComponentProps<'input'>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'size'> & {
47
+ value?: string;
48
+ defaultValue?: string;
49
+ onChange?: (value: string | undefined) => void;
50
+ size?: DatePickerSize;
51
+ variant?: 'default' | 'clean';
52
+ placeholder?: string;
53
+ displayFormat?: string;
54
+ minDate?: string;
55
+ maxDate?: string;
56
+ disabledDate?: (date: string) => boolean;
57
+ calendarProps?: Omit<CalendarProps, 'value' | 'onSelect' | 'size'>;
58
+ open?: boolean;
59
+ onOpenChange?: (open: boolean) => void;
60
+ };
@@ -0,0 +1,2 @@
1
+ import type { DatePickerInputProps } from './DatePicker.types';
2
+ export declare function DatePickerInput({ className, value: controlledValue, defaultValue, onChange, size, placeholder, disabled, minDate, maxDate, disabledDate, calendarProps, open: controlledOpen, onOpenChange, id: idProp, displayFormat: _displayFormat, variant, ...inputProps }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { DateRangePickerInputProps } from './DatePicker.types';
2
+ export declare function DateRangePickerInput({ className, value: controlledValue, defaultValue, onChange, size, startPlaceholder, endPlaceholder, disabled, minDate, maxDate, disabledDate, calendarProps, open: controlledOpen, onOpenChange, id: idProp, variant, ...inputProps }: DateRangePickerInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ export type DateParts = {
2
+ year: number;
3
+ month: number;
4
+ day: number;
5
+ };
6
+ export type MonthView = Pick<DateParts, 'year' | 'month'>;
7
+ export declare function parseDateString(value: string | undefined | null): DateParts | null;
8
+ export declare function formatDateString(parts: DateParts): string;
9
+ export declare function toUtcTimestamp(parts: DateParts): number;
10
+ export declare function isSameDate(a: DateParts, b: DateParts): boolean;
11
+ export declare function isBeforeDate(a: DateParts, b: DateParts): boolean;
12
+ export declare function isAfterDate(a: DateParts, b: DateParts): boolean;
13
+ export declare function addMonths(parts: MonthView, delta: number): MonthView;
14
+ export declare function getTodayParts(): DateParts;
15
+ export declare function getMonthMatrix(year: number, month: number, startOfWeek: 0 | 1): DateParts[];
16
+ export declare function formatDisplayDate(value: string | undefined, locale?: string): string;
17
+ export declare function formatMonthYear(year: number, month: number, locale?: string): string;
18
+ export declare function getWeekdayLabels(startOfWeek: 0 | 1, locale?: string): string[];
19
+ export type DateRangeValue = {
20
+ start: string;
21
+ end: string;
22
+ };
23
+ export declare function normalizeDateRange(start: string, end: string): DateRangeValue;
24
+ export declare function isBetweenDates(parts: DateParts, start: DateParts, end: DateParts): boolean;
25
+ export declare function formatDisplayDateRange(value: DateRangeValue | null | undefined, locale?: string): string;
26
+ export declare function isDateDisabled(parts: DateParts, options: {
27
+ minDate?: string;
28
+ maxDate?: string;
29
+ disabledDate?: (date: string) => boolean;
30
+ }): boolean;
@@ -0,0 +1,6 @@
1
+ export { Calendar } from './Calendar';
2
+ export { DatePicker } from './DatePicker';
3
+ export { DatePickerInput } from './DatePickerInput';
4
+ export { DateRangePickerInput } from './DateRangePickerInput';
5
+ export type { CalendarProps, DatePickerInputProps, DatePickerMode, DatePickerProps, DatePickerSize, DateRangePickerInputProps, } from './DatePicker.types';
6
+ export type { DateRangeValue } from './dateUtils';
@@ -0,0 +1,4 @@
1
+ import type { RadioGroupItemProps, RadioGroupProps } from './RadioGroup.types';
2
+ declare function RadioGroup({ className, size, children, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function RadioGroupItem({ className, size, ...props }: RadioGroupItemProps): import("react/jsx-runtime").JSX.Element;
4
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1 @@
1
+ export declare function RadioGroupExample(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { RadioGroupContextValue, RadioGroupSize } from './RadioGroup.types';
2
+ export declare const getRadioGroupContextValues: (context: RadioGroupContextValue, itemSize?: RadioGroupSize) => RadioGroupSize;
3
+ export declare const getDefaultRadioGroupContextValues: () => RadioGroupContextValue;
@@ -0,0 +1,11 @@
1
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
2
+ export type RadioGroupSize = 'sm' | 'md' | 'lg';
3
+ export interface RadioGroupContextValue {
4
+ size?: RadioGroupSize;
5
+ }
6
+ export interface RadioGroupProps extends React.ComponentProps<typeof RadioGroupPrimitive.Root> {
7
+ size?: RadioGroupSize;
8
+ }
9
+ export interface RadioGroupItemProps extends React.ComponentProps<typeof RadioGroupPrimitive.Item> {
10
+ size?: RadioGroupSize;
11
+ }
@@ -0,0 +1,2 @@
1
+ export { RadioGroup, RadioGroupItem } from './RadioGroup';
2
+ export type { RadioGroupItemProps, RadioGroupProps, RadioGroupSize, } from './RadioGroup.types';
@@ -0,0 +1 @@
1
+ export default function DatePickerPage(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function RadioGroupPage(): import("react/jsx-runtime").JSX.Element;
@@ -28,6 +28,7 @@ export * from './components/ui/BarChart';
28
28
  export * from './components/ui/Chat';
29
29
  export * from './components/ui/Checkbox';
30
30
  export * from './components/ui/Confirm';
31
+ export * from './components/ui/DatePicker';
31
32
  export * from './components/ui/Dialog';
32
33
  export * from './components/ui/Drawer';
33
34
  export * from './components/ui/DropdownMenu';
@@ -53,6 +54,7 @@ export * from './components/ui/NavUserHeader';
53
54
  export * from './components/ui/NumberControl';
54
55
  export * from './components/ui/Page';
55
56
  export * from './components/ui/Progress';
57
+ export * from './components/ui/RadioGroup';
56
58
  export * from './components/ui/RegionCoords';
57
59
  export * from './components/ui/Renamer';
58
60
  export * from './components/ui/Select';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -92,6 +92,7 @@
92
92
  "@radix-ui/react-dropdown-menu": "^2.1.16",
93
93
  "@radix-ui/react-label": "^2.1.7",
94
94
  "@radix-ui/react-progress": "^1.1.7",
95
+ "@radix-ui/react-radio-group": "^1.3.7",
95
96
  "@radix-ui/react-select": "^2.2.6",
96
97
  "@radix-ui/react-separator": "^1.1.7",
97
98
  "@radix-ui/react-slider": "^1.3.6",
@@ -14,3 +14,4 @@ Checkbox is a binary control for selecting or deselecting an option. Pair it wit
14
14
  ## Do
15
15
 
16
16
  - Write labels positively, such as “Send notifications” rather than “Do not send notifications”.
17
+ - Use `size="sm"` in dense tables or compact lists; `size="lg"` when the control should read larger than body text. Default is `md` (16px).
@@ -1,7 +1,5 @@
1
1
  .checkboxRoot
2
2
  cursor pointer
3
- width 16px
4
- height 16px
5
3
  flex-shrink 0
6
4
  border-radius var(--radius-2)
7
5
  border 1px solid var(--input)
@@ -33,6 +31,30 @@
33
31
  cursor not-allowed
34
32
  opacity 0.5
35
33
 
34
+ .size-sm
35
+ width var(--icon-size-sm)
36
+ height var(--icon-size-sm)
37
+
38
+ .checkIcon
39
+ width 10px
40
+ height 10px
41
+
42
+ .size-md
43
+ width var(--icon-size-md)
44
+ height var(--icon-size-md)
45
+
46
+ .checkIcon
47
+ width 12px
48
+ height 12px
49
+
50
+ .size-lg
51
+ width var(--icon-size-lg)
52
+ height var(--icon-size-lg)
53
+
54
+ .checkIcon
55
+ width var(--icon-size-sm)
56
+ height var(--icon-size-sm)
57
+
36
58
  .checkboxIndicator
37
59
  display flex
38
60
  align-items center
@@ -40,3 +62,5 @@
40
62
  color currentColor
41
63
  transition none
42
64
 
65
+ .checkIcon
66
+ flex-shrink 0
@@ -1,9 +1,13 @@
1
1
  // This file is automatically generated.
2
2
  // Please do not change this file!
3
3
  interface CssExports {
4
+ 'checkIcon': string;
4
5
  'checkboxIndicator': string;
5
6
  'checkboxRoot': string;
6
7
  'dark': string;
8
+ 'size-lg': string;
9
+ 'size-md': string;
10
+ 'size-sm': string;
7
11
  }
8
12
  export const cssExports: CssExports;
9
13
  export default cssExports;
@@ -6,18 +6,18 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
6
6
  import S from './Checkbox.styl';
7
7
  import type { CheckboxProps } from './Checkbox.types';
8
8
 
9
- function Checkbox({ className, ...props }: CheckboxProps) {
9
+ function Checkbox({ className, size = 'md', ...props }: CheckboxProps) {
10
10
  return (
11
11
  <CheckboxPrimitive.Root
12
12
  data-slot="checkbox"
13
- className={cn(S.checkboxRoot, className)}
13
+ className={cn(S.checkboxRoot, S[`size-${size}`], className)}
14
14
  {...props}
15
15
  >
16
16
  <CheckboxPrimitive.Indicator
17
17
  data-slot="checkbox-indicator"
18
18
  className={S.checkboxIndicator}
19
19
  >
20
- <CheckIcon className="size-3.5" />
20
+ <CheckIcon className={S.checkIcon} />
21
21
  </CheckboxPrimitive.Indicator>
22
22
  </CheckboxPrimitive.Root>
23
23
  );
@@ -1,5 +1,9 @@
1
1
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
2
2
 
3
+ export type CheckboxSize = 'sm' | 'md' | 'lg';
4
+
3
5
  export interface CheckboxProps extends React.ComponentProps<
4
6
  typeof CheckboxPrimitive.Root
5
- > {}
7
+ > {
8
+ size?: CheckboxSize;
9
+ }
@@ -1,2 +1,2 @@
1
1
  export { Checkbox } from './Checkbox';
2
- export type { CheckboxProps } from './Checkbox.types';
2
+ export type { CheckboxProps, CheckboxSize } from './Checkbox.types';
@@ -0,0 +1,45 @@
1
+ DatePickerInput is the primary date field for forms: a text input with a calendar icon that opens a month grid for single-date selection. DateRangePickerInput adds start/end fields with shared calendar range selection (Carbon-style). Values use ISO `YYYY-MM-DD`; pair with Label for accessible forms.
2
+
3
+ ## When to use
4
+
5
+ - `DatePickerInput` — one calendar date in a form or filter.
6
+ - `DateRangePickerInput` — a start/end interval (reporting windows, booking spans, filter ranges).
7
+ - When users benefit from both typed entry and a visual month picker.
8
+
9
+ ## When not to use
10
+
11
+ - For time-of-day selection; combine with a time input.
12
+ - For relative dates ("in 3 days"); use Select or dedicated controls.
13
+
14
+ ## Do
15
+
16
+ - Pass `minDate`, `maxDate`, or `disabledDate` to constrain selectable days.
17
+ - Use `calendarProps.startOfWeek` when the locale starts weeks on Monday (`1`).
18
+ - Label range fields clearly (start/end placeholders or visible Labels).
19
+
20
+ ## Don't
21
+
22
+ - Use placeholder text as the only label; associate visible Labels via `id` / `htmlFor`.
23
+ - Use single `DatePickerInput` for intervals; use `DateRangePickerInput` instead.
24
+
25
+ ## Range selection UX
26
+
27
+ - First calendar click sets start; second click sets end (auto-swaps if end is before start).
28
+ - Hover previews the tentative range before the second click.
29
+ - Calendar closes when both dates are selected.
30
+ - Each text field accepts manual ISO entry independently.
31
+
32
+ ## API
33
+
34
+ ```tsx
35
+ import { DateRangePickerInput, type DateRangeValue } from '@sybilion/uilib';
36
+
37
+ const [range, setRange] = useState<DateRangeValue | null>({
38
+ start: '2026-07-01',
39
+ end: '2026-07-31',
40
+ });
41
+
42
+ <DateRangePickerInput value={range} onChange={setRange} />
43
+ ```
44
+
45
+ Low-level calendar: `<DatePicker mode="range" rangeValue={range} onRangeChange={setRange} />`.
@@ -0,0 +1,160 @@
1
+ import cn from 'classnames';
2
+ import { useMemo } from 'react';
3
+
4
+ import { Button } from '../Button';
5
+ import S from './DatePicker.styl';
6
+ import type { CalendarProps } from './DatePicker.types';
7
+ import {
8
+ formatDateString,
9
+ getMonthMatrix,
10
+ getTodayParts,
11
+ getWeekdayLabels,
12
+ isBetweenDates,
13
+ isDateDisabled,
14
+ isSameDate,
15
+ normalizeDateRange,
16
+ parseDateString,
17
+ } from './dateUtils';
18
+
19
+ export function Calendar({
20
+ className,
21
+ mode = 'single',
22
+ value,
23
+ rangeStart,
24
+ rangeEnd,
25
+ rangeHover,
26
+ viewMonth,
27
+ onViewMonthChange,
28
+ onSelect,
29
+ onDayHover,
30
+ startOfWeek = 0,
31
+ minDate,
32
+ maxDate,
33
+ disabledDate,
34
+ size = 'md',
35
+ }: CalendarProps) {
36
+ const selected = parseDateString(value);
37
+ const today = getTodayParts();
38
+ const visibleMonth = viewMonth ?? {
39
+ year: selected?.year ?? today.year,
40
+ month: selected?.month ?? today.month,
41
+ };
42
+
43
+ const rangeBounds = useMemo(() => {
44
+ if (mode !== 'range') {
45
+ return null;
46
+ }
47
+ const start = parseDateString(rangeStart);
48
+ const tentativeEnd = parseDateString(rangeEnd ?? rangeHover);
49
+ if (!start || !tentativeEnd) {
50
+ if (start) {
51
+ return { start, end: start };
52
+ }
53
+ return null;
54
+ }
55
+ const normalized = normalizeDateRange(
56
+ formatDateString(start),
57
+ formatDateString(tentativeEnd),
58
+ );
59
+ const end = parseDateString(normalized.end);
60
+ return end ? { start: parseDateString(normalized.start)!, end } : null;
61
+ }, [mode, rangeEnd, rangeHover, rangeStart]);
62
+
63
+ const days = useMemo(
64
+ () => getMonthMatrix(visibleMonth.year, visibleMonth.month, startOfWeek),
65
+ [visibleMonth.month, visibleMonth.year, startOfWeek],
66
+ );
67
+ const weekdayLabels = useMemo(
68
+ () => getWeekdayLabels(startOfWeek),
69
+ [startOfWeek],
70
+ );
71
+ const isSelectingRange = mode === 'range' && rangeStart && !rangeEnd;
72
+
73
+ return (
74
+ <div
75
+ className={cn(S.calendar, S[`calendarSize-${size}`], className)}
76
+ data-slot="calendar"
77
+ data-mode={mode}
78
+ onMouseLeave={() => onDayHover?.(undefined)}
79
+ >
80
+ <div className={S.weekdayRow} role="row">
81
+ {weekdayLabels.map(label => (
82
+ <div key={label} className={S.weekdayCell} role="columnheader">
83
+ {label}
84
+ </div>
85
+ ))}
86
+ </div>
87
+ <div className={S.dayGrid} role="grid">
88
+ {days.map(day => {
89
+ const inCurrentMonth = day.month === visibleMonth.month;
90
+ const isSelected =
91
+ mode === 'single' && selected ? isSameDate(day, selected) : false;
92
+ const isToday = isSameDate(day, today);
93
+ const disabled = isDateDisabled(day, {
94
+ minDate,
95
+ maxDate,
96
+ disabledDate,
97
+ });
98
+ const dateValue = formatDateString(day);
99
+
100
+ const isRangeStart =
101
+ rangeBounds && isSameDate(day, rangeBounds.start);
102
+ const isRangeEnd = rangeBounds && isSameDate(day, rangeBounds.end);
103
+ const isInRange =
104
+ rangeBounds &&
105
+ isBetweenDates(day, rangeBounds.start, rangeBounds.end) &&
106
+ !isRangeStart &&
107
+ !isRangeEnd;
108
+ const isPreview =
109
+ isSelectingRange &&
110
+ isInRange &&
111
+ rangeHover &&
112
+ !parseDateString(rangeEnd);
113
+
114
+ return (
115
+ <Button
116
+ size={size}
117
+ key={dateValue}
118
+ type="button"
119
+ role="gridcell"
120
+ aria-selected={isSelected || isRangeStart || isRangeEnd}
121
+ aria-current={isToday ? 'date' : undefined}
122
+ aria-disabled={disabled || undefined}
123
+ disabled={disabled}
124
+ className={cn(
125
+ S.dayCell,
126
+ !inCurrentMonth && S.dayOutsideMonth,
127
+ isSelected && S.daySelected,
128
+ isToday && S.dayToday,
129
+ isInRange && S.dayInRange,
130
+ isPreview && S.dayInRangePreview,
131
+ isRangeStart && S.dayRangeStart,
132
+ isRangeEnd && S.dayRangeEnd,
133
+ )}
134
+ onMouseEnter={() => {
135
+ if (disabled || mode !== 'range') {
136
+ return;
137
+ }
138
+ onDayHover?.(dateValue);
139
+ }}
140
+ onClick={() => {
141
+ if (disabled) {
142
+ return;
143
+ }
144
+ onSelect?.(dateValue);
145
+ if (
146
+ day.month !== visibleMonth.month ||
147
+ day.year !== visibleMonth.year
148
+ ) {
149
+ onViewMonthChange?.({ year: day.year, month: day.month });
150
+ }
151
+ }}
152
+ >
153
+ {day.day}
154
+ </Button>
155
+ );
156
+ })}
157
+ </div>
158
+ </div>
159
+ );
160
+ }