@bolio-ui/core 3.0.0-alpha.1 → 3.0.0-alpha.2

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 (130) hide show
  1. package/dist/ContextMenu/index.js +3 -3
  2. package/dist/CssBaseline/index.js +2 -2
  3. package/dist/DateRangePicker/index.js +2 -2
  4. package/dist/ImageZoom/ImageZoom.d.ts +14 -0
  5. package/dist/ImageZoom/index.d.ts +3 -0
  6. package/dist/ImageZoom/index.js +17 -0
  7. package/dist/Menu/index.js +2 -2
  8. package/dist/Splitter/Splitter.d.ts +14 -0
  9. package/dist/Splitter/SplitterContext.d.ts +6 -0
  10. package/dist/Splitter/SplitterPanel.d.ts +13 -0
  11. package/dist/Splitter/index.d.ts +9 -0
  12. package/dist/Splitter/index.js +14 -0
  13. package/dist/Table/Table.d.ts +11 -1
  14. package/dist/Table/TableBody.d.ts +8 -2
  15. package/dist/Table/TableColumn.d.ts +2 -0
  16. package/dist/Table/TableHead.d.ts +9 -1
  17. package/dist/Table/TableSelectBox.d.ts +9 -0
  18. package/dist/Table/TableTypes.d.ts +8 -0
  19. package/dist/Table/index.d.ts +1 -1
  20. package/dist/Table/index.js +2 -2
  21. package/dist/Tour/Tour.d.ts +26 -0
  22. package/dist/Tour/index.d.ts +3 -0
  23. package/dist/Tour/index.js +23 -0
  24. package/dist/{chunk-AVO2SK2I.js → chunk-3S6G7WGK.js} +2 -2
  25. package/dist/{chunk-GYFW5NLU.js → chunk-BHQRX76X.js} +22 -4
  26. package/dist/chunk-FFEAKF3A.js +220 -0
  27. package/dist/{chunk-XLPOECCE.js → chunk-FL6J36B7.js} +3 -2
  28. package/dist/chunk-REWKR7S3.js +109 -0
  29. package/dist/chunk-STYC6O24.js +232 -0
  30. package/dist/{chunk-TDJGMSGT.js → chunk-WIIDIZYK.js} +3 -1
  31. package/dist/{chunk-TKICX5R6.js → chunk-ZNDN2VPZ.js} +225 -33
  32. package/dist/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  33. package/dist/css/ButtonGroup.css +0 -1
  34. package/dist/css/Calendar.css +0 -1
  35. package/dist/css/Carousel.css +0 -1
  36. package/dist/css/ColorInput.css +0 -2
  37. package/dist/css/ColorPicker.css +0 -3
  38. package/dist/css/Combobox.css +0 -2
  39. package/dist/css/DatePicker.css +0 -3
  40. package/dist/css/DateRangePicker.css +6 -3
  41. package/dist/css/Dropzone.css +0 -3
  42. package/dist/css/Fieldset-FieldsetGroup.css +0 -1
  43. package/dist/css/ImageZoom.css +93 -0
  44. package/dist/css/Input.css +0 -1
  45. package/dist/css/Menu-MenuList.css +0 -1
  46. package/dist/css/NumberInput.css +0 -1
  47. package/dist/css/PinInput.css +0 -1
  48. package/dist/css/Radio.css +0 -1
  49. package/dist/css/SegmentedControl.css +0 -1
  50. package/dist/css/Select-SelectDropdown.css +0 -1
  51. package/dist/css/Select-SelectOption.css +0 -1
  52. package/dist/css/Select.css +0 -1
  53. package/dist/css/Splitter.css +77 -0
  54. package/dist/css/Table-TableBody.css +10 -0
  55. package/dist/css/Table-TableHead.css +41 -0
  56. package/dist/css/Table-TableSelectBox.css +11 -0
  57. package/dist/css/TagsInput.css +0 -2
  58. package/dist/css/Textarea.css +0 -1
  59. package/dist/css/Toggle.css +0 -1
  60. package/dist/css/Tour.css +81 -0
  61. package/dist/css/use-toasts-toast-item.css +0 -1
  62. package/dist/index.d.ts +7 -1
  63. package/dist/index.js +31 -19
  64. package/dist/styles.css +3227 -2939
  65. package/esm/ContextMenu/index.js +2 -2
  66. package/esm/CssBaseline/index.js +1 -1
  67. package/esm/DateRangePicker/index.js +1 -1
  68. package/esm/ImageZoom/ImageZoom.d.ts +14 -0
  69. package/esm/ImageZoom/index.d.ts +3 -0
  70. package/esm/ImageZoom/index.js +17 -0
  71. package/esm/Menu/index.js +1 -1
  72. package/esm/Splitter/Splitter.d.ts +14 -0
  73. package/esm/Splitter/SplitterContext.d.ts +6 -0
  74. package/esm/Splitter/SplitterPanel.d.ts +13 -0
  75. package/esm/Splitter/index.d.ts +9 -0
  76. package/esm/Splitter/index.js +14 -0
  77. package/esm/Table/Table.d.ts +11 -1
  78. package/esm/Table/TableBody.d.ts +8 -2
  79. package/esm/Table/TableColumn.d.ts +2 -0
  80. package/esm/Table/TableHead.d.ts +9 -1
  81. package/esm/Table/TableSelectBox.d.ts +9 -0
  82. package/esm/Table/TableTypes.d.ts +8 -0
  83. package/esm/Table/index.d.ts +1 -1
  84. package/esm/Table/index.js +1 -1
  85. package/esm/Tour/Tour.d.ts +26 -0
  86. package/esm/Tour/index.d.ts +3 -0
  87. package/esm/Tour/index.js +23 -0
  88. package/esm/{chunk-AVO2SK2I.js → chunk-3S6G7WGK.js} +1 -1
  89. package/esm/{chunk-GYFW5NLU.js → chunk-BHQRX76X.js} +22 -4
  90. package/esm/chunk-FFEAKF3A.js +220 -0
  91. package/esm/{chunk-XLPOECCE.js → chunk-FL6J36B7.js} +3 -2
  92. package/esm/chunk-REWKR7S3.js +109 -0
  93. package/esm/chunk-STYC6O24.js +232 -0
  94. package/esm/{chunk-TDJGMSGT.js → chunk-WIIDIZYK.js} +3 -1
  95. package/esm/chunk-ZNDN2VPZ.js +543 -0
  96. package/esm/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  97. package/esm/css/ButtonGroup.css +0 -1
  98. package/esm/css/Calendar.css +0 -1
  99. package/esm/css/Carousel.css +0 -1
  100. package/esm/css/ColorInput.css +0 -2
  101. package/esm/css/ColorPicker.css +0 -3
  102. package/esm/css/Combobox.css +0 -2
  103. package/esm/css/DatePicker.css +0 -3
  104. package/esm/css/DateRangePicker.css +6 -3
  105. package/esm/css/Dropzone.css +0 -3
  106. package/esm/css/Fieldset-FieldsetGroup.css +0 -1
  107. package/esm/css/ImageZoom.css +93 -0
  108. package/esm/css/Input.css +0 -1
  109. package/esm/css/Menu-MenuList.css +0 -1
  110. package/esm/css/NumberInput.css +0 -1
  111. package/esm/css/PinInput.css +0 -1
  112. package/esm/css/Radio.css +0 -1
  113. package/esm/css/SegmentedControl.css +0 -1
  114. package/esm/css/Select-SelectDropdown.css +0 -1
  115. package/esm/css/Select-SelectOption.css +0 -1
  116. package/esm/css/Select.css +0 -1
  117. package/esm/css/Splitter.css +77 -0
  118. package/esm/css/Table-TableBody.css +10 -0
  119. package/esm/css/Table-TableHead.css +41 -0
  120. package/esm/css/Table-TableSelectBox.css +11 -0
  121. package/esm/css/TagsInput.css +0 -2
  122. package/esm/css/Textarea.css +0 -1
  123. package/esm/css/Toggle.css +0 -1
  124. package/esm/css/Tour.css +81 -0
  125. package/esm/css/use-toasts-toast-item.css +0 -1
  126. package/esm/index.d.ts +7 -1
  127. package/esm/index.js +36 -24
  128. package/esm/styles.css +2987 -2699
  129. package/package.json +1 -1
  130. package/esm/chunk-TKICX5R6.js +0 -351
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import {
3
3
  ContextMenu_default
4
- } from "../chunk-AVO2SK2I.js";
5
- import "../chunk-XLPOECCE.js";
4
+ } from "../chunk-3S6G7WGK.js";
5
+ import "../chunk-FL6J36B7.js";
6
6
  import "../chunk-AG2NWQYL.js";
7
7
  import "../chunk-DSX6YDJM.js";
8
8
  import "../chunk-V57PNXMD.js";
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import {
3
3
  CssBaseline_default
4
- } from "../chunk-TDJGMSGT.js";
4
+ } from "../chunk-WIIDIZYK.js";
5
5
  import "../chunk-V5I4ORQQ.js";
6
6
  import "../chunk-FEA5BJ35.js";
7
7
  import "../chunk-X5PGXMVQ.js";
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import {
3
3
  DateRangePicker_default
4
- } from "../chunk-GYFW5NLU.js";
4
+ } from "../chunk-BHQRX76X.js";
5
5
  import "../chunk-KBZEYKCZ.js";
6
6
  import "../chunk-P245HSVB.js";
7
7
  import "../chunk-GJZT47MP.js";
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ImageProps } from '../Image';
3
+ interface Props {
4
+ src: string;
5
+ alt: string;
6
+ zoomSrc?: string;
7
+ caption?: React.ReactNode;
8
+ closeLabel?: string;
9
+ className?: string;
10
+ }
11
+ type NativeAttrs = Omit<ImageProps, keyof Props | 'className'>;
12
+ export type ImageZoomProps = Props & NativeAttrs;
13
+ declare const ImageZoom: React.ForwardRefExoticComponent<Props & NativeAttrs & React.RefAttributes<HTMLButtonElement>>;
14
+ export default ImageZoom;
@@ -0,0 +1,3 @@
1
+ import ImageZoom from './ImageZoom';
2
+ export type { ImageZoomProps } from './ImageZoom';
3
+ export default ImageZoom;
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import {
3
+ ImageZoom_default
4
+ } from "../chunk-REWKR7S3.js";
5
+ import "../chunk-TWIOSRRP.js";
6
+ import "../chunk-WEYAL53O.js";
7
+ import "../chunk-RZBEZ26A.js";
8
+ import "../chunk-MAICNLTY.js";
9
+ import "../chunk-UX2B3G6U.js";
10
+ import "../chunk-V5I4ORQQ.js";
11
+ import "../chunk-FEA5BJ35.js";
12
+ import "../chunk-X5PGXMVQ.js";
13
+ import "../chunk-SZIX7BM5.js";
14
+ import "../chunk-5KUROAEP.js";
15
+ export {
16
+ ImageZoom_default as default
17
+ };
package/esm/Menu/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import {
3
3
  Menu_default
4
- } from "../chunk-XLPOECCE.js";
4
+ } from "../chunk-FL6J36B7.js";
5
5
  import "../chunk-AG2NWQYL.js";
6
6
  import "../chunk-DSX6YDJM.js";
7
7
  import "../chunk-V57PNXMD.js";
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export type SplitterDirection = 'horizontal' | 'vertical';
3
+ interface Props {
4
+ direction?: SplitterDirection;
5
+ onResize?: (sizes: Array<number>) => void;
6
+ handleLabel?: string;
7
+ className?: string;
8
+ }
9
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>;
10
+ export type SplitterProps = Props & NativeAttrs;
11
+ declare const Splitter: import("../use-scale/with-scale").ScaleComponent<HTMLDivElement, Props & NativeAttrs & {
12
+ children?: React.ReactNode | undefined;
13
+ } & React.RefAttributes<HTMLDivElement>>;
14
+ export default Splitter;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface SplitterPanelConfig {
3
+ id: string;
4
+ setElement: (element: HTMLDivElement | null) => void;
5
+ }
6
+ export declare const SplitterPanelContext: React.Context<SplitterPanelConfig | null>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ defaultSize?: number;
4
+ minSize?: number;
5
+ maxSize?: number;
6
+ className?: string;
7
+ }
8
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>;
9
+ export type SplitterPanelProps = Props & NativeAttrs;
10
+ declare const SplitterPanel: React.ForwardRefExoticComponent<Props & NativeAttrs & {
11
+ children?: React.ReactNode | undefined;
12
+ } & React.RefAttributes<HTMLDivElement>>;
13
+ export default SplitterPanel;
@@ -0,0 +1,9 @@
1
+ import Splitter from './Splitter';
2
+ import SplitterPanel from './SplitterPanel';
3
+ export type SplitterComponentType = typeof Splitter & {
4
+ Panel: typeof SplitterPanel;
5
+ };
6
+ export type { SplitterProps, SplitterDirection } from './Splitter';
7
+ export type { SplitterPanelProps } from './SplitterPanel';
8
+ declare const _default: SplitterComponentType;
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import {
3
+ Splitter_default
4
+ } from "../chunk-FFEAKF3A.js";
5
+ import "../chunk-MAICNLTY.js";
6
+ import "../chunk-UX2B3G6U.js";
7
+ import "../chunk-V5I4ORQQ.js";
8
+ import "../chunk-FEA5BJ35.js";
9
+ import "../chunk-X5PGXMVQ.js";
10
+ import "../chunk-SZIX7BM5.js";
11
+ import "../chunk-5KUROAEP.js";
12
+ export {
13
+ Splitter_default as default
14
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { TableDataItemBase, TableOnCellClick, TableOnChange, TableOnRowClick, TableRowClassNameHandler } from './TableTypes';
2
+ import { TableDataItemBase, TableKey, TableSort, TableOnCellClick, TableOnChange, TableOnRowClick, TableRowClassNameHandler } from './TableTypes';
3
3
  import { ScaleProps } from '../use-scale';
4
4
  import TableColumn from './TableColumn';
5
5
  import type { AnyElement } from '../utils/types';
@@ -20,6 +20,16 @@ interface Props<TableDataItem extends TableDataItemBase> {
20
20
  pagination?: TablePagination;
21
21
  className?: string;
22
22
  rowClassName?: TableRowClassNameHandler<TableDataItem>;
23
+ sort?: TableSort | null;
24
+ initialSort?: TableSort | null;
25
+ onSortChange?: (sort: TableSort | null) => void;
26
+ selectable?: boolean;
27
+ rowKey?: keyof TableDataItem | ((row: TableDataItem) => TableKey);
28
+ selectedKeys?: Array<TableKey>;
29
+ initialSelectedKeys?: Array<TableKey>;
30
+ onSelectionChange?: (keys: Array<TableKey>, rows: Array<TableDataItem>) => void;
31
+ selectRowLabel?: string;
32
+ selectAllLabel?: string;
23
33
  }
24
34
  type NativeAttrs = Omit<React.TableHTMLAttributes<AnyElement>, keyof Props<TableDataItemBase>>;
25
35
  export type TableProps<TableDataItem extends TableDataItemBase> = Props<TableDataItem> & NativeAttrs;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { TableDataItemBase, TableOnCellClick, TableOnRowClick, TableRowClassNameHandler } from './TableTypes';
2
+ import { TableDataItemBase, TableKey, TableOnCellClick, TableOnRowClick, TableRowClassNameHandler } from './TableTypes';
3
3
  import type { AnyElement } from '../utils/types';
4
4
  interface Props<TableDataItem extends TableDataItemBase> {
5
5
  hover: boolean;
@@ -7,13 +7,19 @@ interface Props<TableDataItem extends TableDataItemBase> {
7
7
  onRow?: TableOnRowClick<TableDataItem>;
8
8
  onCell?: TableOnCellClick<TableDataItem>;
9
9
  data: Array<TableDataItem>;
10
+ keys: Array<TableKey>;
11
+ selection?: {
12
+ keys: Array<TableKey>;
13
+ label: string;
14
+ onToggle: (key: TableKey) => void;
15
+ };
10
16
  className?: string;
11
17
  rowClassName: TableRowClassNameHandler<TableDataItem>;
12
18
  }
13
19
  type NativeAttrs = Omit<React.HTMLAttributes<AnyElement>, keyof Props<TableDataItemBase>>;
14
20
  export type TableBodyProps<TableDataItem extends TableDataItemBase> = Props<TableDataItem> & NativeAttrs;
15
21
  declare const TableBody: {
16
- <TableDataItem extends TableDataItemBase>({ data, hover, emptyText, onRow, onCell, rowClassName }: TableBodyProps<TableDataItem>): React.JSX.Element;
22
+ <TableDataItem extends TableDataItemBase>({ data, keys, selection, hover, emptyText, onRow, onCell, rowClassName }: TableBodyProps<TableDataItem>): React.JSX.Element;
17
23
  displayName: string;
18
24
  };
19
25
  export default TableBody;
@@ -5,6 +5,8 @@ export type TableColumnProps<TableDataItem extends TableDataItemBase> = {
5
5
  label?: string;
6
6
  width?: number;
7
7
  className?: string;
8
+ sortable?: boolean;
9
+ sorter?: (a: TableDataItem, b: TableDataItem) => number;
8
10
  render?: TableColumnRender<TableDataItem>;
9
11
  };
10
12
  declare const TableColumn: {
@@ -1,9 +1,17 @@
1
1
  import React from 'react';
2
- import { TableAbstractColumn, TableDataItemBase } from './TableTypes';
2
+ import { TableAbstractColumn, TableDataItemBase, TableSort } from './TableTypes';
3
3
  import type { AnyElement } from '../utils/types';
4
4
  interface Props<TableDataItem extends TableDataItemBase> {
5
5
  width: number;
6
6
  columns: Array<TableAbstractColumn<TableDataItem>>;
7
+ sort?: TableSort | null;
8
+ onSort?: (prop: string) => void;
9
+ selection?: {
10
+ checked: boolean;
11
+ indeterminate: boolean;
12
+ label: string;
13
+ onToggle: () => void;
14
+ };
7
15
  className?: string;
8
16
  }
9
17
  type NativeAttrs = Omit<React.HTMLAttributes<AnyElement>, keyof Props<TableDataItemBase>>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ checked: boolean;
4
+ indeterminate?: boolean;
5
+ label: string;
6
+ onChange: () => void;
7
+ }
8
+ declare function TableSelectBox({ checked, indeterminate, label, onChange }: Props): React.JSX.Element;
9
+ export default TableSelectBox;
@@ -2,11 +2,19 @@ import React from 'react';
2
2
  import type { AnyObject } from '../utils/types';
3
3
  export type TableDataItemBase = AnyObject;
4
4
  export type TableColumnRender<Item extends TableDataItemBase> = (value: Item[keyof Item], rowData: Item, rowIndex: number) => React.JSX.Element | void;
5
+ export type TableSortDirection = 'asc' | 'desc';
6
+ export type TableSort = {
7
+ prop: string;
8
+ direction: TableSortDirection;
9
+ };
10
+ export type TableKey = string | number;
5
11
  export type TableAbstractColumn<TableDataItem extends TableDataItemBase> = {
6
12
  prop: keyof TableDataItem;
7
13
  label: React.ReactNode | string;
8
14
  className: string;
9
15
  width?: number;
16
+ sortable?: boolean;
17
+ sorter?: (a: TableDataItem, b: TableDataItem) => number;
10
18
  renderHandler: TableColumnRender<TableDataItem>;
11
19
  };
12
20
  export type TableOnRowClick<TableDataItem> = (rowData: TableDataItem, rowIndex: number) => void;
@@ -1,5 +1,5 @@
1
1
  import Table from './Table';
2
2
  export type { TableProps, TablePagination } from './Table';
3
3
  export type { TableColumnProps } from './TableColumn';
4
- export type { TableOnCellClick, TableAbstractColumn, TableOnChange, TableOnRowClick, TableRowClassNameHandler, TableDataItemBase, TableColumnRender } from './TableTypes';
4
+ export type { TableOnCellClick, TableAbstractColumn, TableOnChange, TableOnRowClick, TableRowClassNameHandler, TableDataItemBase, TableColumnRender, TableKey, TableSort, TableSortDirection } from './TableTypes';
5
5
  export default Table;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import {
3
3
  Table_default
4
- } from "../chunk-TKICX5R6.js";
4
+ } from "../chunk-ZNDN2VPZ.js";
5
5
  import "../chunk-E5EDUOQT.js";
6
6
  import "../chunk-JJFOGZ6V.js";
7
7
  import "../chunk-HKOESPKZ.js";
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export interface TourStep {
3
+ target?: string | HTMLElement | (() => HTMLElement | null);
4
+ title: React.ReactNode;
5
+ content: React.ReactNode;
6
+ }
7
+ interface Props {
8
+ steps: Array<TourStep>;
9
+ open: boolean;
10
+ onClose: () => void;
11
+ current?: number;
12
+ initialCurrent?: number;
13
+ onCurrentChange?: (index: number) => void;
14
+ onFinish?: () => void;
15
+ previousLabel?: string;
16
+ nextLabel?: string;
17
+ finishLabel?: string;
18
+ skipLabel?: string;
19
+ stepLabel?: (index: number, count: number) => string;
20
+ spotlightPadding?: number;
21
+ className?: string;
22
+ }
23
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>;
24
+ export type TourProps = Props & NativeAttrs;
25
+ declare const Tour: React.ForwardRefExoticComponent<Props & NativeAttrs & React.RefAttributes<HTMLDivElement>>;
26
+ export default Tour;
@@ -0,0 +1,3 @@
1
+ import Tour from './Tour';
2
+ export type { TourProps, TourStep } from './Tour';
3
+ export default Tour;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ import {
3
+ Tour_default
4
+ } from "../chunk-STYC6O24.js";
5
+ import "../chunk-AXYDJGTN.js";
6
+ import "../chunk-BXDUHMWS.js";
7
+ import "../chunk-ZRORQ2WH.js";
8
+ import "../chunk-DXHNQANX.js";
9
+ import "../chunk-BSDZWWUS.js";
10
+ import "../chunk-GJZT47MP.js";
11
+ import "../chunk-RZBEZ26A.js";
12
+ import "../chunk-LMDBE6T6.js";
13
+ import "../chunk-NDERASK2.js";
14
+ import "../chunk-MAICNLTY.js";
15
+ import "../chunk-UX2B3G6U.js";
16
+ import "../chunk-V5I4ORQQ.js";
17
+ import "../chunk-FEA5BJ35.js";
18
+ import "../chunk-X5PGXMVQ.js";
19
+ import "../chunk-SZIX7BM5.js";
20
+ import "../chunk-5KUROAEP.js";
21
+ export {
22
+ Tour_default as default
23
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Menu_default
3
- } from "./chunk-XLPOECCE.js";
3
+ } from "./chunk-FL6J36B7.js";
4
4
  import {
5
5
  with_scale_default
6
6
  } from "./chunk-MAICNLTY.js";
@@ -18,6 +18,7 @@ import {
18
18
  use_theme_default
19
19
  } from "./chunk-V5I4ORQQ.js";
20
20
  import {
21
+ joinClasses,
21
22
  use_classes_default
22
23
  } from "./chunk-5KUROAEP.js";
23
24
 
@@ -25,10 +26,12 @@ import {
25
26
  import React, { useEffect, useRef, useState } from "react";
26
27
 
27
28
  // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/DateRangePicker/DateRangePicker.module.css.bolio-css-module-source
28
- var DateRangePicker_module_css_default = { "daterange": "DateRangePicker-module_daterange__id9HF", "field": "DateRangePicker-module_field__4UZhH", "input": "DateRangePicker-module_input__h9sDj", "separator": "DateRangePicker-module_separator__StR3E", "toggle": "DateRangePicker-module_toggle__gNukh", "popup": "DateRangePicker-module_popup__hKExw" };
29
+ var DateRangePicker_module_css_default = { "daterange": "DateRangePicker-module_daterange__id9HF", "field": "DateRangePicker-module_field__4UZhH", "input": "DateRangePicker-module_input__h9sDj", "separator": "DateRangePicker-module_separator__StR3E", "toggle": "DateRangePicker-module_toggle__gNukh", "popup": "DateRangePicker-module_popup__hKExw", "alignEnd": "DateRangePicker-module_alignEnd__DgOia" };
29
30
 
30
31
  // core/DateRangePicker/DateRangePicker.tsx
31
32
  import { jsx, jsxs } from "react/jsx-runtime";
33
+ var TWO_MONTHS_EM = 46;
34
+ var ONE_MONTH_EM = 22;
32
35
  var emptyRange = [null, null];
33
36
  var format = (date) => date ? toISO(date) : "";
34
37
  var DateRangePickerComponent = React.forwardRef(
@@ -72,6 +75,7 @@ var DateRangePickerComponent = React.forwardRef(
72
75
  const endText = format(end);
73
76
  const [texts, setTexts] = useState({ start: startText, end: endText });
74
77
  const [open, setOpen] = useState(false);
78
+ const [fit, setFit] = useState({ months: 2, alignEnd: false });
75
79
  useEffect(() => {
76
80
  setTexts({ start: startText, end: endText });
77
81
  }, [startText, endText]);
@@ -97,6 +101,18 @@ var DateRangePickerComponent = React.forwardRef(
97
101
  commit(edge === "start" ? [date, other] : [other, date]);
98
102
  };
99
103
  const blurHandler = () => setTexts({ start: startText, end: endText });
104
+ const toggle = () => {
105
+ const root = rootRef.current;
106
+ if (!open && root) {
107
+ const em = parseFloat(getComputedStyle(root).fontSize) || 16;
108
+ const room = document.documentElement.clientWidth - root.getBoundingClientRect().left;
109
+ setFit({
110
+ months: room >= TWO_MONTHS_EM * em ? 2 : 1,
111
+ alignEnd: room < ONE_MONTH_EM * em
112
+ });
113
+ }
114
+ setOpen((last) => !last);
115
+ };
100
116
  const pick = (next) => {
101
117
  var _a;
102
118
  commit(next);
@@ -195,7 +211,7 @@ var DateRangePickerComponent = React.forwardRef(
195
211
  "aria-haspopup": "dialog",
196
212
  "aria-expanded": open,
197
213
  disabled,
198
- onClick: () => setOpen((last) => !last),
214
+ onClick: toggle,
199
215
  children: /* @__PURE__ */ jsxs(
200
216
  "svg",
201
217
  {
@@ -222,13 +238,15 @@ var DateRangePickerComponent = React.forwardRef(
222
238
  {
223
239
  role: "dialog",
224
240
  "aria-label": calendarLabel,
225
- className: DateRangePicker_module_css_default.popup,
241
+ className: joinClasses(DateRangePicker_module_css_default.popup, {
242
+ [DateRangePicker_module_css_default.alignEnd]: fit.alignEnd
243
+ }),
226
244
  onKeyDown: keyDownHandler,
227
245
  children: /* @__PURE__ */ jsx(
228
246
  Calendar_default,
229
247
  {
230
248
  mode: "range",
231
- numberOfMonths: 2,
249
+ numberOfMonths: fit.months,
232
250
  autoFocus: true,
233
251
  value: range,
234
252
  min,
@@ -0,0 +1,220 @@
1
+ import {
2
+ use_scale_default,
3
+ with_scale_default
4
+ } from "./chunk-MAICNLTY.js";
5
+ import {
6
+ use_theme_default
7
+ } from "./chunk-V5I4ORQQ.js";
8
+ import {
9
+ joinClasses,
10
+ use_classes_default
11
+ } from "./chunk-5KUROAEP.js";
12
+
13
+ // core/Splitter/Splitter.tsx
14
+ import React2, { useId, useRef, useState } from "react";
15
+
16
+ // core/Splitter/SplitterContext.ts
17
+ import React from "react";
18
+ var SplitterPanelContext = React.createContext(null);
19
+
20
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Splitter/Splitter.module.css.bolio-css-module-source
21
+ var Splitter_module_css_default = { "splitter": "Splitter-module_splitter__ZxGeO", "horizontal": "Splitter-module_horizontal__1LuP6", "vertical": "Splitter-module_vertical__APNTT", "panel": "Splitter-module_panel__UyXwt", "handle": "Splitter-module_handle__zkBUq" };
22
+
23
+ // core/Splitter/Splitter.tsx
24
+ import { jsx, jsxs } from "react/jsx-runtime";
25
+ var initialSizes = (panels) => {
26
+ const given = panels.map((panel) => panel.props.defaultSize);
27
+ const used = given.reduce((sum, size) => sum + (size != null ? size : 0), 0);
28
+ const open = given.filter((size) => size === void 0).length;
29
+ return given.map(
30
+ (size) => size === void 0 ? Math.max(0, 100 - used) / open : size
31
+ );
32
+ };
33
+ var SplitterComponent = React2.forwardRef(
34
+ ({
35
+ direction = "horizontal",
36
+ onResize,
37
+ handleLabel = "Resize",
38
+ className = "",
39
+ children,
40
+ style,
41
+ ...props
42
+ }, ref) => {
43
+ const theme = use_theme_default();
44
+ const { SCALES } = use_scale_default();
45
+ const baseId = useId();
46
+ const panels = React2.Children.toArray(children).filter(
47
+ React2.isValidElement
48
+ );
49
+ const horizontal = direction === "horizontal";
50
+ const [sizes, setSizes] = useState(() => initialSizes(panels));
51
+ if (sizes.length !== panels.length) setSizes(initialSizes(panels));
52
+ const elements = useRef([]);
53
+ const drag = useRef(void 0);
54
+ const minOf = (index) => {
55
+ var _a;
56
+ return (_a = panels[index].props.minSize) != null ? _a : 0;
57
+ };
58
+ const maxOf = (index) => {
59
+ var _a;
60
+ return (_a = panels[index].props.maxSize) != null ? _a : 100;
61
+ };
62
+ const move = (index, delta, from) => {
63
+ const [a, b] = [from[index], from[index + 1]];
64
+ const low = Math.max(minOf(index) - a, b - maxOf(index + 1));
65
+ const high = Math.min(maxOf(index) - a, b - minOf(index + 1));
66
+ const applied = Math.min(Math.max(delta, low), high);
67
+ if (!applied && sizes[index] === a) return;
68
+ const next = [...from];
69
+ next[index] = a + applied;
70
+ next[index + 1] = b - applied;
71
+ setSizes(next);
72
+ if (onResize) onResize(next);
73
+ };
74
+ const pointerDown = (event) => {
75
+ var _a, _b;
76
+ (_b = (_a = event.currentTarget).setPointerCapture) == null ? void 0 : _b.call(_a, event.pointerId);
77
+ const room = elements.current.reduce((sum, element) => {
78
+ const rect = element == null ? void 0 : element.getBoundingClientRect();
79
+ return sum + (rect ? horizontal ? rect.width : rect.height : 0);
80
+ }, 0);
81
+ drag.current = {
82
+ from: horizontal ? event.clientX : event.clientY,
83
+ sizes: [...sizes],
84
+ room
85
+ };
86
+ };
87
+ const pointerMove = (event, index) => {
88
+ var _a, _b;
89
+ const start = drag.current;
90
+ if (!start || !start.room) return;
91
+ if (!((_b = (_a = event.currentTarget).hasPointerCapture) == null ? void 0 : _b.call(_a, event.pointerId))) return;
92
+ const travelled = (horizontal ? event.clientX : event.clientY) - start.from;
93
+ move(index, travelled / start.room * 100, start.sizes);
94
+ };
95
+ const keyDown = (event, index) => {
96
+ const step = event.shiftKey ? 10 : 1;
97
+ const [less, more] = horizontal ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
98
+ const deltas = {
99
+ [less]: -step,
100
+ [more]: step,
101
+ Home: -100,
102
+ End: 100
103
+ };
104
+ if (!(event.key in deltas)) return;
105
+ event.preventDefault();
106
+ move(index, deltas[event.key], sizes);
107
+ };
108
+ const template = sizes.map((size) => `minmax(0, ${size}fr)`).join(" auto ");
109
+ const splitterStyle = {
110
+ "--splitter-template": template,
111
+ width: SCALES.width(1, "100%"),
112
+ height: SCALES.height(1, "100%"),
113
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
114
+ "--splitter-line": theme.palette.border,
115
+ "--splitter-active": theme.palette.primary,
116
+ ...style
117
+ };
118
+ return /* @__PURE__ */ jsx(
119
+ "div",
120
+ {
121
+ ref,
122
+ className: use_classes_default(Splitter_module_css_default.splitter, className, {
123
+ [Splitter_module_css_default.horizontal]: horizontal,
124
+ [Splitter_module_css_default.vertical]: !horizontal
125
+ }),
126
+ ...props,
127
+ style: splitterStyle,
128
+ children: panels.map((panel, index) => {
129
+ var _a;
130
+ const [a, b] = [sizes[index], sizes[index + 1]];
131
+ return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
132
+ /* @__PURE__ */ jsx(
133
+ SplitterPanelContext.Provider,
134
+ {
135
+ value: {
136
+ id: `${baseId}-panel-${index}`,
137
+ setElement: (element) => {
138
+ elements.current[index] = element;
139
+ }
140
+ },
141
+ children: panel
142
+ }
143
+ ),
144
+ index < panels.length - 1 && /* @__PURE__ */ jsx(
145
+ "div",
146
+ {
147
+ role: "separator",
148
+ tabIndex: 0,
149
+ "aria-label": handleLabel,
150
+ "aria-orientation": horizontal ? "vertical" : "horizontal",
151
+ "aria-controls": `${baseId}-panel-${index}`,
152
+ "aria-valuenow": Math.round(a),
153
+ "aria-valuemin": Math.round(
154
+ Math.max(minOf(index), a + b - maxOf(index + 1))
155
+ ),
156
+ "aria-valuemax": Math.round(
157
+ Math.min(maxOf(index), a + b - minOf(index + 1))
158
+ ),
159
+ className: joinClasses(Splitter_module_css_default.handle),
160
+ onPointerDown: pointerDown,
161
+ onPointerMove: (event) => pointerMove(event, index),
162
+ onPointerUp: () => drag.current = void 0,
163
+ onPointerCancel: () => drag.current = void 0,
164
+ onKeyDown: (event) => keyDown(event, index)
165
+ }
166
+ )
167
+ ] }, (_a = panel.key) != null ? _a : index);
168
+ })
169
+ }
170
+ );
171
+ }
172
+ );
173
+ SplitterComponent.displayName = "BolioUISplitter";
174
+ var Splitter = with_scale_default(SplitterComponent);
175
+ var Splitter_default = Splitter;
176
+
177
+ // core/Splitter/SplitterPanel.tsx
178
+ import React3, { useContext } from "react";
179
+ import { jsx as jsx2 } from "react/jsx-runtime";
180
+ var SplitterPanel = React3.forwardRef(
181
+ ({
182
+ // read by the Splitter
183
+ /* eslint-disable @typescript-eslint/no-unused-vars */
184
+ defaultSize,
185
+ minSize,
186
+ maxSize,
187
+ /* eslint-enable @typescript-eslint/no-unused-vars */
188
+ className = "",
189
+ children,
190
+ style,
191
+ ...props
192
+ }, ref) => {
193
+ const config = useContext(SplitterPanelContext);
194
+ return /* @__PURE__ */ jsx2(
195
+ "div",
196
+ {
197
+ ref: (element) => {
198
+ config == null ? void 0 : config.setElement(element);
199
+ if (typeof ref === "function") ref(element);
200
+ else if (ref) ref.current = element;
201
+ },
202
+ id: config == null ? void 0 : config.id,
203
+ className: use_classes_default(Splitter_module_css_default.panel, className),
204
+ ...props,
205
+ style,
206
+ children
207
+ }
208
+ );
209
+ }
210
+ );
211
+ SplitterPanel.displayName = "BolioUISplitterPanel";
212
+ var SplitterPanel_default = SplitterPanel;
213
+
214
+ // core/Splitter/index.ts
215
+ Splitter_default.Panel = SplitterPanel_default;
216
+ var Splitter_default2 = Splitter_default;
217
+
218
+ export {
219
+ Splitter_default2 as Splitter_default
220
+ };
@@ -64,10 +64,11 @@ var MenuList = ({
64
64
  };
65
65
  useEffect(() => {
66
66
  var _a, _b;
67
- if (focus === "list") return (_a = listRef.current) == null ? void 0 : _a.focus();
67
+ const options = { preventScroll: true };
68
+ if (focus === "list") return (_a = listRef.current) == null ? void 0 : _a.focus(options);
68
69
  const items = getItems();
69
70
  const target = focus === "first" ? items[0] : items[items.length - 1];
70
- (_b = target != null ? target : listRef.current) == null ? void 0 : _b.focus();
71
+ (_b = target != null ? target : listRef.current) == null ? void 0 : _b.focus(options);
71
72
  }, []);
72
73
  const typeahead = (key, items, index) => {
73
74
  const now = Date.now();