@koobiq/react-components 0.0.1 → 0.1.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.
Files changed (58) hide show
  1. package/dist/components/Button/types.d.ts +0 -10
  2. package/dist/components/Calendar/types.d.ts +3 -41
  3. package/dist/components/Checkbox/Checkbox.d.ts +10 -9
  4. package/dist/components/Checkbox/types.d.ts +4 -33
  5. package/dist/components/Checkbox/types.js +1 -0
  6. package/dist/components/DateInput/DateInput.js +2 -2
  7. package/dist/components/DateSegment/DateSegment.d.ts +7 -0
  8. package/dist/components/DateSegment/DateSegment.js +34 -0
  9. package/dist/components/DateSegment/DateSegment.module.css.js +17 -0
  10. package/dist/components/DateSegment/index.d.ts +1 -0
  11. package/dist/components/DateSegment/intl.json.js +7 -0
  12. package/dist/components/DateSegment/utils.d.ts +3 -0
  13. package/dist/components/DateSegment/utils.js +6 -0
  14. package/dist/components/Dialog/components/DialogCloseButton.d.ts +1 -3
  15. package/dist/components/Divider/types.d.ts +4 -9
  16. package/dist/components/Divider/types.js +1 -3
  17. package/dist/components/IconButton/types.d.ts +1 -6
  18. package/dist/components/Input/Input.d.ts +1 -10
  19. package/dist/components/Input/types.d.ts +1 -31
  20. package/dist/components/InputNumber/InputNumber.d.ts +2 -6
  21. package/dist/components/InputNumber/types.d.ts +4 -21
  22. package/dist/components/Link/types.d.ts +2 -7
  23. package/dist/components/List/List.d.ts +2 -2
  24. package/dist/components/List/types.d.ts +5 -39
  25. package/dist/components/Menu/components/MenuInner/MenuInner.d.ts +1 -1
  26. package/dist/components/Menu/types.d.ts +13 -36
  27. package/dist/components/Popover/types.d.ts +2 -3
  28. package/dist/components/ProgressBar/ProgressBar.js +5 -5
  29. package/dist/components/ProgressBar/types.d.ts +8 -20
  30. package/dist/components/ProgressSpinner/ProgressSpinner.js +5 -5
  31. package/dist/components/ProgressSpinner/types.d.ts +8 -20
  32. package/dist/components/Select/types.d.ts +7 -46
  33. package/dist/components/SkeletonBlock/SkeletonBlock.d.ts +3 -1
  34. package/dist/components/SkeletonTypography/SkeletonTypography.d.ts +3 -1
  35. package/dist/components/Table/types.d.ts +3 -25
  36. package/dist/components/TagGroup/types.d.ts +4 -15
  37. package/dist/components/Textarea/Textarea.d.ts +1 -6
  38. package/dist/components/Textarea/types.d.ts +1 -23
  39. package/dist/components/TimePicker/TimePicker.d.ts +5 -0
  40. package/dist/components/TimePicker/TimePicker.js +112 -0
  41. package/dist/components/TimePicker/TimePicker.module.css.js +11 -0
  42. package/dist/components/TimePicker/index.d.ts +2 -0
  43. package/dist/components/TimePicker/types.d.ts +46 -0
  44. package/dist/components/Toggle/Toggle.d.ts +9 -8
  45. package/dist/components/Toggle/types.d.ts +7 -23
  46. package/dist/components/Tooltip/Tooltip.d.ts +4 -6
  47. package/dist/components/Tooltip/types.d.ts +5 -19
  48. package/dist/components/index.d.ts +2 -1
  49. package/dist/index.js +4 -6
  50. package/dist/style.css +13 -5
  51. package/package.json +5 -5
  52. package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.d.ts +0 -7
  53. package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.js +0 -27
  54. package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.module.css.js +0 -17
  55. package/dist/components/DateInput/components/DateInputSegment/index.d.ts +0 -1
  56. package/dist/components/DateInput/components/index.d.ts +0 -1
  57. package/dist/components/List/types.js +0 -4
  58. package/dist/components/Menu/types.js +0 -4
@@ -1,17 +1,10 @@
1
1
  import type { ComponentPropsWithRef, ComponentRef, CSSProperties, ReactElement, Ref, RefObject } from 'react';
2
+ import type { ExtendableProps } from '@koobiq/react-core';
2
3
  import type { ButtonOptions, AriaMenuProps } from '@koobiq/react-primitives';
3
- import type { PopoverBaseProps, PopoverPropPlacement } from '../Popover';
4
+ import type { PopoverProps, PopoverPropPlacement } from '../Popover';
4
5
  export type MenuPropControl = (props: ButtonOptions & {
5
6
  ref?: Ref<HTMLButtonElement>;
6
7
  }) => ReactElement;
7
- export type MenuPropChildren<T extends object> = AriaMenuProps<T>['children'];
8
- export type MenuPropItems<T extends object> = AriaMenuProps<T>['items'];
9
- export declare const menuPropSelectionMode: readonly ["none", "single", "multiple"];
10
- export type MenuPropSelectionMode = (typeof menuPropSelectionMode)[number];
11
- export type MenuPropOnAction<T extends object> = AriaMenuProps<T>['onAction'];
12
- export type MenuPropSelected<T extends object> = AriaMenuProps<T>['selectedKeys'];
13
- export type MenuPropSelectionChange<T extends object> = AriaMenuProps<T>['onSelectionChange'];
14
- export type MenuPropDisabledKeys<T extends object> = AriaMenuProps<T>['disabledKeys'];
15
8
  export type MenuPropPlacement = PopoverPropPlacement;
16
9
  type MenuDeprecatedProps = {
17
10
  /**
@@ -21,37 +14,21 @@ type MenuDeprecatedProps = {
21
14
  */
22
15
  open?: boolean;
23
16
  };
24
- export type MenuProps<T extends object> = {
17
+ export type MenuProps<T> = ExtendableProps<{
18
+ /** Whether the overlay is open by default (controlled). */
19
+ isOpen?: boolean;
20
+ /** Whether the overlay is open by default (uncontrolled). */
21
+ defaultOpen?: boolean;
22
+ /** Handler that is called when the overlay's open state changes. */
23
+ onOpenChange?: (isOpen: boolean) => void;
25
24
  /** Additional CSS-classes. */
26
25
  className?: string;
27
26
  /** Unique identifier for testing purposes. */
28
27
  'data-testid'?: string | number;
29
28
  /** Inline styles. */
30
29
  style?: CSSProperties;
31
- /** The contents of the collection. */
32
- children?: MenuPropChildren<T>;
33
30
  /** The render function of the control for displaying the modal window. */
34
31
  control?: MenuPropControl;
35
- /** Whether the overlay is open by default (controlled). */
36
- isOpen?: boolean;
37
- /** Whether the overlay is open by default (uncontrolled). */
38
- defaultOpen?: boolean;
39
- /** Handler that is called when the overlay's open state changes. */
40
- onOpenChange?: (isOpen: boolean) => void;
41
- /** Item objects in the collection. */
42
- items?: MenuPropItems<T>;
43
- /** The type of selection that is allowed in the collection. */
44
- selectionMode?: MenuPropSelectionMode;
45
- /**
46
- * Handler that is called when a user performs an action on an item. The exact user event depends on
47
- * the collection's `selectionBehavior` prop and the interaction modality.
48
- */
49
- onAction?: MenuPropOnAction<T>;
50
- /** The currently selected keys in the collection (controlled). */
51
- selectedKeys?: MenuPropSelected<T>;
52
- /** Handler that is called when the selection changes. */
53
- onSelectionChange?: MenuPropSelectionChange<T>;
54
- disabledKeys?: MenuPropDisabledKeys<T>;
55
32
  /** The ref for the element which the popover positions itself with respect to. */
56
33
  anchorRef?: RefObject<HTMLElement | null>;
57
34
  /**
@@ -59,14 +36,14 @@ export type MenuProps<T extends object> = {
59
36
  * @default 'bottom start'
60
37
  */
61
38
  placement?: MenuPropPlacement;
62
- /** Ref to the popover */
39
+ /** Ref to the popover. */
63
40
  ref?: Ref<HTMLDivElement>;
64
41
  /** The props used for each slot inside. */
65
42
  slotProps?: {
66
- popover?: PopoverBaseProps;
43
+ popover?: PopoverProps;
67
44
  list?: ComponentPropsWithRef<'ul'>;
68
45
  };
69
- } & MenuDeprecatedProps;
70
- export type MenuComponent = <T extends object>(props: MenuProps<T>) => ReactElement | null;
46
+ } & MenuDeprecatedProps, AriaMenuProps<T>>;
47
+ export type MenuComponent = <T>(props: MenuProps<T>) => ReactElement | null;
71
48
  export type MenuRef = ComponentRef<'div'>;
72
49
  export {};
@@ -22,7 +22,7 @@ type PopoverDeprecatedProps = {
22
22
  */
23
23
  open?: boolean;
24
24
  };
25
- export type PopoverBaseProps = {
25
+ export type PopoverProps = {
26
26
  /** If `true`, the component is shown. */
27
27
  isOpen?: boolean;
28
28
  /** The default open state. Use when the component is not controlled. */
@@ -132,6 +132,5 @@ export type PopoverBaseProps = {
132
132
  export type PopoverInnerProps = {
133
133
  state: OverlayTriggerState;
134
134
  popoverRef?: Ref<HTMLDivElement>;
135
- } & Omit<PopoverBaseProps, 'ref'>;
136
- export type PopoverProps = PopoverBaseProps;
135
+ } & Omit<PopoverProps, 'ref'>;
137
136
  export {};
@@ -16,9 +16,9 @@ const ProgressBar = forwardRef(
16
16
  style,
17
17
  ...other
18
18
  } = props;
19
- const indeterminate = variant === "indeterminate" || !isNotNil(value);
19
+ const isIndeterminate = variant === "indeterminate" || !isNotNil(value);
20
20
  const setProgressTrackStyles = () => {
21
- if (indeterminate) return void 0;
21
+ if (isIndeterminate) return void 0;
22
22
  const translateX = Math.max(
23
23
  -maxValue,
24
24
  Math.min(minValue, (value || minValue) - maxValue)
@@ -33,10 +33,10 @@ const ProgressBar = forwardRef(
33
33
  value,
34
34
  minValue,
35
35
  maxValue,
36
- indeterminate,
37
- "data-variant": indeterminate ? "indeterminate" : "determinate",
36
+ isIndeterminate,
37
+ "data-variant": isIndeterminate ? "indeterminate" : "determinate",
38
38
  style: { ...style, ...setProgressTrackStyles() },
39
- className: clsx(s.base, indeterminate && s.indeterminate, className),
39
+ className: clsx(s.base, isIndeterminate && s.indeterminate, className),
40
40
  ...other,
41
41
  ref,
42
42
  children: /* @__PURE__ */ jsx(
@@ -1,26 +1,14 @@
1
- import type { ComponentPropsWithRef } from 'react';
2
- import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
1
+ import type { ComponentPropsWithRef, CSSProperties } from 'react';
2
+ import type { ExtendableComponentPropsWithRef, ExtendableProps } from '@koobiq/react-core';
3
+ import type { ProgressBarBaseProps as ProgressBarBasePrimitiveProps } from '@koobiq/react-primitives';
3
4
  export declare const progressBarPropVariant: readonly ["indeterminate", "determinate"];
4
5
  export type ProgressBarPropVariant = (typeof progressBarPropVariant)[number];
5
- export type ProgressBarBaseProps = {
6
+ export type ProgressBarBaseProps = ExtendableComponentPropsWithRef<{
6
7
  children?: never;
7
- /**
8
- * The current value (controlled).
9
- * @default 0
10
- */
11
- value?: number;
12
- /**
13
- * The smallest value allowed for the input.
14
- * @default 0
15
- */
16
- minValue?: number;
17
- /**
18
- * The largest value allowed for the input.
19
- * @default 100
20
- */
21
- maxValue?: number;
22
8
  /** Additional CSS-classes. */
23
9
  className?: string;
10
+ /** Inline styles. */
11
+ style?: CSSProperties;
24
12
  /**
25
13
  * The variant to use. Use indeterminate or query when there is no progress value.
26
14
  * @default 'determinate'
@@ -30,5 +18,5 @@ export type ProgressBarBaseProps = {
30
18
  slotProps?: {
31
19
  fill?: ComponentPropsWithRef<'span'>;
32
20
  };
33
- };
34
- export type ProgressBarProps = ExtendableComponentPropsWithRef<ProgressBarBaseProps, 'div'>;
21
+ }, 'div'>;
22
+ export type ProgressBarProps = ExtendableProps<ProgressBarBaseProps, Omit<ProgressBarBasePrimitiveProps, 'children' | 'isIndeterminate' | 'label' | 'formatOptions' | 'valueLabel'>>;
@@ -16,7 +16,7 @@ const ProgressSpinner = forwardRef((props, ref) => {
16
16
  slotProps,
17
17
  ...other
18
18
  } = props;
19
- const indeterminate = variant === "indeterminate" || !isNotNil(value);
19
+ const isIndeterminate = variant === "indeterminate" || !isNotNil(value);
20
20
  const [sizeOfPixels, strokeWidth, radius, strokeDasharray] = useMemo(
21
21
  () => getSvgParamsBySize(size),
22
22
  [size]
@@ -28,13 +28,13 @@ const ProgressSpinner = forwardRef((props, ref) => {
28
28
  "data-size": size,
29
29
  minValue,
30
30
  maxValue,
31
- indeterminate,
32
- "data-variant": indeterminate ? "indeterminate" : "determinate",
33
- className: clsx(s.base, indeterminate && s.indeterminate, className),
31
+ isIndeterminate,
32
+ "data-variant": isIndeterminate ? "indeterminate" : "determinate",
33
+ className: clsx(s.base, isIndeterminate && s.indeterminate, className),
34
34
  ...other,
35
35
  ref,
36
36
  children: ({ percentage = 0 }) => {
37
- const progress = indeterminate ? 75 : percentage;
37
+ const progress = isIndeterminate ? 75 : percentage;
38
38
  return /* @__PURE__ */ jsx(
39
39
  "svg",
40
40
  {
@@ -1,33 +1,21 @@
1
- import type { ComponentPropsWithRef } from 'react';
2
- import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
1
+ import type { ComponentPropsWithRef, CSSProperties } from 'react';
2
+ import type { ExtendableComponentPropsWithRef, ExtendableProps } from '@koobiq/react-core';
3
+ import type { ProgressBarBaseProps as ProgressBarBasePrimitiveProps } from '@koobiq/react-primitives';
3
4
  export declare const progressSpinnerPropSize: readonly ["compact", "big"];
4
5
  export type ProgressSpinnerPropSize = (typeof progressSpinnerPropSize)[number];
5
6
  export declare const progressSpinnerPropVariant: readonly ["indeterminate", "determinate"];
6
7
  export type ProgressSpinnerPropVariant = (typeof progressSpinnerPropVariant)[number];
7
- export type ProgressSpinnerBaseProps = {
8
+ export type ProgressSpinnerBaseProps = ExtendableComponentPropsWithRef<{
8
9
  children?: never;
9
- /**
10
- * The current value (controlled).
11
- * @default 0
12
- */
13
- value?: number;
14
10
  /**
15
11
  * Size.
16
12
  * @default 'compact'
17
13
  */
18
14
  size?: ProgressSpinnerPropSize;
19
- /**
20
- * The smallest value allowed for the input.
21
- * @default 0
22
- */
23
- minValue?: number;
24
- /**
25
- * The largest value allowed for the input.
26
- * @default 100
27
- */
28
- maxValue?: number;
29
15
  /** Additional CSS-classes. */
30
16
  className?: string;
17
+ /** Inline styles. */
18
+ style?: CSSProperties;
31
19
  /**
32
20
  * The variant to use. Use indeterminate or query when there is no progress value.
33
21
  * @default 'determinate'
@@ -37,5 +25,5 @@ export type ProgressSpinnerBaseProps = {
37
25
  slotProps?: {
38
26
  spin?: ComponentPropsWithRef<'svg'>;
39
27
  };
40
- };
41
- export type ProgressSpinnerProps = ExtendableComponentPropsWithRef<ProgressSpinnerBaseProps, 'div'>;
28
+ }, 'div'>;
29
+ export type ProgressSpinnerProps = ExtendableProps<ProgressSpinnerBaseProps, Omit<ProgressBarBasePrimitiveProps, 'children' | 'isIndeterminate' | 'label' | 'formatOptions' | 'valueLabel'>>;
@@ -1,11 +1,10 @@
1
1
  import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
- import type { Node } from '@koobiq/react-core';
2
+ import type { ExtendableProps, Node } from '@koobiq/react-core';
3
3
  import type { AriaSelectProps } from '@koobiq/react-primitives';
4
4
  import type { FieldErrorProps, FieldLabelProps, FieldSelectProps, FieldCaptionProps, FieldInputGroupProps } from '../FieldComponents';
5
- import type { ListPropItems, ListPropChildren, ListPropDisabledKeys } from '../List';
5
+ import type { ListProps } from '../List';
6
6
  import type { PopoverProps } from '../Popover';
7
7
  export type SelectKey = string | number;
8
- export type SelectPropOnSelectionChange<T> = AriaSelectProps<T>['onSelectionChange'];
9
8
  type SelectDeprecatedProps = {
10
9
  /**
11
10
  * If `true`, the component is disabled.
@@ -42,29 +41,16 @@ type SelectDeprecatedProps = {
42
41
  */
43
42
  hiddenLabel?: boolean;
44
43
  };
45
- export type SelectProps<T extends object> = {
44
+ export type SelectProps<T> = ExtendableProps<{
46
45
  /** Additional CSS-classes. */
47
46
  className?: string;
48
- /** The content to display as the label. */
49
- label?: ReactNode;
50
- /** The contents of the collection. */
51
- children?: ListPropChildren<T>;
52
- /** Item objects in the collection. */
53
- items?: ListPropItems<T>;
54
47
  /** Addon placed before the children. */
55
48
  startAddon?: ReactNode;
56
49
  /** Addon placed after the children. */
57
50
  endAddon?: ReactNode;
58
51
  /** Inline styles. */
59
52
  style?: CSSProperties;
60
- /** The text appears in a control until the user puts focus on the field. */
61
- placeholder?: string;
62
- /**
63
- * If `true`, the input will indicate an error.
64
- * @default false
65
- */
66
- isInvalid?: boolean;
67
- /** Message for the error state */
53
+ /** An error message for the field. */
68
54
  errorMessage?: ReactNode;
69
55
  /**
70
56
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
@@ -78,48 +64,23 @@ export type SelectProps<T extends object> = {
78
64
  * @default false
79
65
  */
80
66
  fullWidth?: boolean;
81
- /**
82
- * If `true`, the component is disabled.
83
- * @default false
84
- */
85
- isDisabled?: boolean;
86
- /**
87
- * If `true`, the label is displayed as required and the input element is required.
88
- * @default false
89
- */
90
- isRequired?: boolean;
91
67
  /** Unique identifier for testing purposes. */
92
68
  'data-testid'?: string | number;
93
69
  /** Ref to the control */
94
70
  ref?: Ref<HTMLButtonElement>;
95
- /** The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. */
96
- disabledKeys?: ListPropDisabledKeys<T>;
97
- /** The initial selected key in the collection (uncontrolled). */
98
- defaultSelectedKey?: SelectKey;
99
- /** The currently selected key in the collection (controlled). */
100
- selectedKey?: SelectKey | null;
101
- /** Handler that is called when the selection changes. */
102
- onSelectionChange?: SelectPropOnSelectionChange<T>;
103
- /** Sets the open state of the menu. */
104
- isOpen?: boolean;
105
- /** Sets the default open state of the menu. */
106
- defaultOpen?: boolean;
107
- /** Method that is called when the open state of the menu changes. */
108
- onOpenChange?: (isOpen: boolean) => void;
109
71
  /** A render function for displaying the selected value. */
110
72
  renderValue?: (props: Node<T> | null) => ReactElement;
111
- name?: string;
112
73
  /** The props used for each slot inside. */
113
74
  slotProps?: {
114
75
  popover?: PopoverProps;
115
76
  label?: FieldLabelProps;
116
- list?: ListPropChildren<T>;
77
+ list?: ListProps<T>;
117
78
  control?: FieldSelectProps;
118
79
  caption?: FieldCaptionProps;
119
80
  group?: FieldInputGroupProps;
120
81
  errorMessage?: FieldErrorProps;
121
82
  };
122
- } & SelectDeprecatedProps;
123
- export type SelectComponent = <T extends object>(props: SelectProps<T>) => ReactElement | null;
83
+ } & SelectDeprecatedProps, Omit<AriaSelectProps<T>, 'description' | 'validationState'>>;
84
+ export type SelectComponent = <T>(props: SelectProps<T>) => ReactElement | null;
124
85
  export type SelectRef = ComponentRef<'button'>;
125
86
  export {};
@@ -1,2 +1,4 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
1
2
  import type { SkeletonBlockBaseProps } from './index';
2
- export declare const SkeletonBlock: import("@koobiq/react-core").PolyForwardComponent<"span", SkeletonBlockBaseProps, import("react").ElementType>;
3
+ export declare const SkeletonBlock: import("@koobiq/react-core").PolyForwardComponent<"span", SkeletonBlockBaseProps, ElementType>;
4
+ export type SkeletonBlockProps<As extends ElementType = 'span'> = ComponentPropsWithRef<typeof SkeletonBlock<As>>;
@@ -1,2 +1,4 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
1
2
  import type { SkeletonTypographyBaseProps } from './index';
2
- export declare const SkeletonTypography: import("@koobiq/react-core").PolyForwardComponent<"span", SkeletonTypographyBaseProps, import("react").ElementType>;
3
+ export declare const SkeletonTypography: import("@koobiq/react-core").PolyForwardComponent<"span", SkeletonTypographyBaseProps, ElementType>;
4
+ export type SkeletonTypographyProps<As extends ElementType = 'span'> = ComponentPropsWithRef<typeof SkeletonTypography<As>>;
@@ -1,35 +1,13 @@
1
1
  import type { ComponentPropsWithRef, ComponentRef, CSSProperties, ReactElement, Ref } from 'react';
2
- import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
3
2
  import type { TableStateProps } from '@koobiq/react-primitives';
4
3
  import type { Key } from '@react-types/shared';
5
4
  export declare const tablePropDivider: readonly ["none", "row"];
6
5
  export type TablePropDivider = (typeof tablePropDivider)[number];
7
6
  export type TablePropChildren<T> = TableStateProps<T>['children'];
8
- export type TablePropSelectionMode<T> = TableStateProps<T>['selectionMode'];
9
- export type TablePropSelectionBehavior<T> = TableStateProps<T>['selectionBehavior'];
10
- export type TablePropOnSelectionChange<T> = TableStateProps<T>['onSelectionChange'];
11
- export type TablePropSelectedKeys<T> = TableStateProps<T>['selectedKeys'];
12
- export type TablePropDefaultSelectedKeys<T> = TableStateProps<T>['defaultSelectedKeys'];
13
- export type TablePropDisabledBehavior<T> = TableStateProps<T>['disabledBehavior'];
14
- export type TablePropDisabledKeys<T> = TableStateProps<T>['disabledKeys'];
15
7
  export type TablePropBlockSize = CSSProperties['blockSize'];
16
8
  export type TablePropMinBlockSize = CSSProperties['minBlockSize'];
17
9
  export type TablePropMaxBlockSize = CSSProperties['maxInlineSize'];
18
- export type TableProps<T> = ExtendableComponentPropsWithRef<{
19
- /** How multiple selection should behave in the collection. */
20
- selectionBehavior?: TablePropSelectionBehavior<T>;
21
- /** The type of selection that is allowed in the collection. */
22
- selectionMode?: TablePropSelectionMode<T>;
23
- /** The currently selected keys in the collection (controlled). */
24
- selectedKeys?: TablePropSelectedKeys<T>;
25
- /** The initial selected keys in the collection (uncontrolled). */
26
- defaultSelectedKeys?: TablePropDefaultSelectedKeys<T>;
27
- /** Handler that is called when the selection changes. */
28
- onSelectionChange?: TablePropOnSelectionChange<T>;
29
- /** A list of row keys to disable. */
30
- disabledKeys?: TablePropDisabledKeys<T>;
31
- /** Whether `disabledKeys` applies to all interactions, or only selection. */
32
- disabledBehavior?: TablePropDisabledBehavior<T>;
10
+ export type TableProps<T> = Pick<TableStateProps<T>, 'selectionBehavior' | 'selectionMode' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'disabledKeys' | 'disabledBehavior'> & {
33
11
  /** Handler that is called when a user performs an action on the row. */
34
12
  onRowAction?: (key: Key) => void;
35
13
  /** Handler that is called when a user performs an action on the cell. */
@@ -66,6 +44,6 @@ export type TableProps<T> = ExtendableComponentPropsWithRef<{
66
44
  container?: ComponentPropsWithRef<'div'>;
67
45
  table?: ComponentPropsWithRef<'table'>;
68
46
  };
69
- }, 'div'>;
70
- export type TableComponent = <T extends object>(props: TableProps<T>) => ReactElement | null;
47
+ };
48
+ export type TableComponent = <T>(props: TableProps<T>) => ReactElement | null;
71
49
  export type TableRef = ComponentRef<'table'>;
@@ -1,25 +1,14 @@
1
1
  import type { ComponentPropsWithRef, ComponentRef, CSSProperties, ReactElement, Ref } from 'react';
2
+ import type { ExtendableProps } from '@koobiq/react-core';
2
3
  import type { AriaTagGroupProps } from '@koobiq/react-primitives';
3
- export type TagGroupPropChildren<T extends object> = AriaTagGroupProps<T>['children'];
4
- export type TagGroupPropItems<T extends object> = AriaTagGroupProps<T>['items'];
5
- export type TagGroupPropOnRemove<T extends object> = AriaTagGroupProps<T>['onRemove'];
6
- export type TagGroupPropDisabledKeys<T extends object> = AriaTagGroupProps<T>['disabledKeys'];
7
4
  export declare const tagGroupPropVariant: readonly ["theme-fade", "contrast-fade", "error-fade", "warning-fade"];
8
5
  export type TagGroupPropVariant = (typeof tagGroupPropVariant)[number];
9
- export type TagGroupProps<T extends object> = {
10
- /** The contents of the collection. */
11
- children?: TagGroupPropChildren<T>;
12
- /** Item objects in the collection. */
13
- items?: TagGroupPropItems<T>;
14
- /** Handler that is called when a user deletes a tag. */
15
- onRemove?: TagGroupPropOnRemove<T>;
6
+ export type TagGroupProps<T> = ExtendableProps<{
16
7
  /**
17
8
  * The variant to use.
18
9
  * @default 'theme-fade'
19
10
  */
20
11
  variant?: TagGroupPropVariant;
21
- /** The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. */
22
- disabledKeys?: TagGroupPropDisabledKeys<T>;
23
12
  /** Ref to the HTML ul-element. */
24
13
  ref?: Ref<HTMLElement>;
25
14
  /** Additional CSS-classes. */
@@ -32,6 +21,6 @@ export type TagGroupProps<T extends object> = {
32
21
  slotProps?: {
33
22
  root?: ComponentPropsWithRef<'div'>;
34
23
  };
35
- };
36
- export type TagGroupComponent = <T extends object>(props: TagGroupProps<T>) => ReactElement | null;
24
+ }, Omit<AriaTagGroupProps<T>, 'label' | 'errorMessage' | 'description' | 'onSelectionChange' | 'selectedKeys' | 'selectionMode' | 'selectionBehavior' | 'shouldSelectOnPressUp' | 'disallowEmptySelection' | 'defaultSelectedKeys'>>;
25
+ export type TagGroupComponent = <T>(props: TagGroupProps<T>) => ReactElement | null;
37
26
  export type TagGroupRef = ComponentRef<'div'>;
@@ -4,18 +4,13 @@ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<{
4
4
  required?: boolean;
5
5
  hiddenLabel?: boolean;
6
6
  readonly?: boolean;
7
- } & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationState" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "label" | "className" | "cols" | "rows" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isReadOnly" | "isRequired" | "errorMessage" | "isLabelHidden" | "expand"> & {
8
- label?: import("react").ReactNode;
7
+ } & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationState" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "className" | "cols" | "rows" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "errorMessage" | "isLabelHidden" | "expand"> & {
9
8
  className?: string;
10
9
  variant?: import("./types").TextareaPropVariant;
11
- isInvalid?: boolean;
12
- isReadOnly?: boolean;
13
10
  errorMessage?: import("react").ReactNode;
14
11
  fullWidth?: boolean;
15
- isDisabled?: boolean;
16
12
  isLabelHidden?: boolean;
17
13
  caption?: import("react").ReactNode;
18
- isRequired?: boolean;
19
14
  rows?: number;
20
15
  cols?: number;
21
16
  expand?: import("./types").TextareaPropExpand;
@@ -44,8 +44,6 @@ type TextareaDeprecatedProps = {
44
44
  readonly?: boolean;
45
45
  };
46
46
  export type TextareaProps = ExtendableProps<{
47
- /** The content to display as the label. */
48
- label?: ReactNode;
49
47
  /** Additional CSS-classes. */
50
48
  className?: string;
51
49
  /**
@@ -53,28 +51,13 @@ export type TextareaProps = ExtendableProps<{
53
51
  * @default 'filled'
54
52
  */
55
53
  variant?: TextareaPropVariant;
56
- /**
57
- * If `true`, the input will indicate an error.
58
- * @default false
59
- */
60
- isInvalid?: boolean;
61
- /**
62
- * If `true`, the input can be selected but not changed by the user.
63
- * @default false
64
- */
65
- isReadOnly?: boolean;
66
- /** Message for the error state */
54
+ /** An error message for the field. */
67
55
  errorMessage?: ReactNode;
68
56
  /**
69
57
  * If true, the input will take up the full width of its container.
70
58
  * @default false
71
59
  */
72
60
  fullWidth?: boolean;
73
- /**
74
- * If `true`, the component is disabled.
75
- * @default false
76
- */
77
- isDisabled?: boolean;
78
61
  /**
79
62
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
80
63
  * @default false
@@ -82,11 +65,6 @@ export type TextareaProps = ExtendableProps<{
82
65
  isLabelHidden?: boolean;
83
66
  /** The helper text content. */
84
67
  caption?: ReactNode;
85
- /**
86
- * If `true`, the label is displayed as required and the input element is required.
87
- * @default false
88
- */
89
- isRequired?: boolean;
90
68
  /** The rows property specifies the visible height of a text area, in lines. */
91
69
  rows?: number;
92
70
  /** The cols property specifies the visible width of a text area. */
@@ -0,0 +1,5 @@
1
+ import { type Ref } from 'react';
2
+ import type { TimeValue } from '@koobiq/react-primitives';
3
+ import type { TimePickerComponent, TimePickerProps, TimePickerRef } from './types';
4
+ export declare function TimePickerRender<T extends TimeValue>(props: Omit<TimePickerProps<T>, 'ref'>, ref: Ref<TimePickerRef>): import("react/jsx-runtime").JSX.Element;
5
+ export declare const TimePicker: TimePickerComponent;
@@ -0,0 +1,112 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useLocale, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
4
+ import { IconClock16 } from "@koobiq/react-icons";
5
+ import { useTimeFieldState, removeDataAttributes, useTimeField } from "@koobiq/react-primitives";
6
+ import s from "./TimePicker.module.css.js";
7
+ import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
8
+ import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
9
+ import { FieldInputGroup } from "../FieldComponents/FieldInputGroup/FieldInputGroup.js";
10
+ import { FieldInputDate } from "../FieldComponents/FieldInputDate/FieldInputDate.js";
11
+ import { DateSegment } from "../DateSegment/DateSegment.js";
12
+ import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
13
+ import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
14
+ function TimePickerRender(props, ref) {
15
+ const { locale } = useLocale();
16
+ const domRef = useDOMRef(ref);
17
+ const {
18
+ isLabelHidden,
19
+ caption,
20
+ label,
21
+ slotProps,
22
+ style,
23
+ fullWidth,
24
+ variant,
25
+ className,
26
+ endAddon,
27
+ startAddon,
28
+ errorMessage,
29
+ "data-testid": testId
30
+ } = props;
31
+ const state = useTimeFieldState({
32
+ ...removeDataAttributes(props),
33
+ locale
34
+ });
35
+ const {
36
+ labelProps: labelPropReactAria,
37
+ fieldProps,
38
+ descriptionProps,
39
+ errorMessageProps,
40
+ ...validation
41
+ } = useTimeField(removeDataAttributes(props), state, domRef);
42
+ const { isInvalid, isDisabled, isRequired, isReadOnly } = state;
43
+ const rootProps = mergeProps(
44
+ {
45
+ style,
46
+ fullWidth,
47
+ "data-testid": testId,
48
+ "data-variant": variant,
49
+ "data-invalid": isInvalid,
50
+ "data-disabled": isDisabled,
51
+ "data-fullwidth": fullWidth,
52
+ "data-required": isRequired,
53
+ "data-readonly": isReadOnly,
54
+ className: clsx(s.base, className)
55
+ },
56
+ slotProps?.root
57
+ );
58
+ const groupProps = mergeProps(
59
+ {
60
+ startAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ startAddon,
62
+ /* @__PURE__ */ jsx(IconClock16, {})
63
+ ] }),
64
+ isInvalid,
65
+ isDisabled,
66
+ endAddon
67
+ },
68
+ slotProps?.group
69
+ );
70
+ const controlProps = mergeProps(
71
+ {
72
+ variant,
73
+ isInvalid,
74
+ isDisabled,
75
+ ref: domRef
76
+ },
77
+ slotProps?.inputDate,
78
+ fieldProps
79
+ );
80
+ const labelProps = mergeProps(
81
+ { isHidden: isLabelHidden, children: label, isRequired },
82
+ labelPropReactAria,
83
+ slotProps?.label
84
+ );
85
+ const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
86
+ const errorProps = mergeProps(
87
+ {
88
+ isInvalid,
89
+ children: typeof errorMessage === "function" ? errorMessage({ ...validation }) : errorMessage
90
+ },
91
+ slotProps?.errorMessage,
92
+ errorMessageProps
93
+ );
94
+ return /* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
95
+ /* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
96
+ /* @__PURE__ */ jsx(
97
+ FieldInputGroup,
98
+ {
99
+ ...groupProps,
100
+ slotProps: { start: { className: s.startAddon } },
101
+ children: /* @__PURE__ */ jsx(FieldInputDate, { ...controlProps, children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)) })
102
+ }
103
+ ),
104
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
105
+ /* @__PURE__ */ jsx(FieldError, { ...errorProps })
106
+ ] });
107
+ }
108
+ const TimePicker = forwardRef(TimePickerRender);
109
+ export {
110
+ TimePicker,
111
+ TimePickerRender
112
+ };
@@ -0,0 +1,11 @@
1
+ const base = "kbq-timepicker-a6e9f3";
2
+ const startAddon = "kbq-timepicker-startAddon-46c835";
3
+ const s = {
4
+ base,
5
+ startAddon
6
+ };
7
+ export {
8
+ base,
9
+ s as default,
10
+ startAddon
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './TimePicker';
2
+ export * from './types';