chop-logic-components 4.1.0 → 4.1.1

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 (159) hide show
  1. package/README.md +11 -0
  2. package/dist/components/atoms/button/Button.d.ts +7 -0
  3. package/dist/components/atoms/button/icon-button/IconButton.d.ts +3 -0
  4. package/dist/components/atoms/button/inner-button/InnerButton.d.ts +3 -0
  5. package/dist/components/atoms/button/primary-button/PrimaryButton.d.ts +3 -0
  6. package/dist/components/atoms/button/secondary-button/SecondaryButton.d.ts +3 -0
  7. package/dist/components/atoms/editable-text/EditView.d.ts +14 -0
  8. package/dist/components/atoms/editable-text/EditableText.d.ts +4 -0
  9. package/dist/components/atoms/editable-text/ReadView.d.ts +10 -0
  10. package/dist/components/atoms/editable-text/useEditModeState.d.ts +6 -0
  11. package/dist/components/atoms/editable-text/useInputFocus.d.ts +2 -0
  12. package/dist/components/atoms/editable-text/useValueState.d.ts +6 -0
  13. package/dist/components/atoms/error-message/ErrorMessage.d.ts +10 -0
  14. package/dist/components/atoms/header/Header.d.ts +4 -0
  15. package/dist/components/atoms/icon/Icon.d.ts +11 -0
  16. package/dist/components/atoms/image/BasicImage.d.ts +13 -0
  17. package/dist/components/atoms/image/FallBackImage.d.ts +2 -0
  18. package/dist/components/atoms/image/Image.d.ts +6 -0
  19. package/dist/components/atoms/image/ResponsivePicture.d.ts +15 -0
  20. package/dist/components/atoms/index.d.ts +11 -0
  21. package/dist/components/atoms/input/Input.d.ts +5 -0
  22. package/dist/components/atoms/label/Label.d.ts +16 -0
  23. package/dist/components/atoms/link/Link.d.ts +4 -0
  24. package/dist/components/atoms/portal/Portal.d.ts +5 -0
  25. package/dist/components/atoms/tooltip/Tooltip.controller.d.ts +19 -0
  26. package/dist/components/atoms/tooltip/Tooltip.d.ts +4 -0
  27. package/dist/components/contexts/form/FormContext.d.ts +7 -0
  28. package/dist/components/contexts/index.d.ts +4 -0
  29. package/dist/components/contexts/theme/ThemeContext.d.ts +8 -0
  30. package/dist/components/contexts/theme/ThemeProvider.d.ts +8 -0
  31. package/dist/components/hocs/index.d.ts +3 -0
  32. package/dist/components/hocs/with-error-boundary/with-error-boundary.d.ts +6 -0
  33. package/dist/components/hocs/with-figure-caption/with-figure-caption.d.ts +6 -0
  34. package/dist/components/hocs/with-tooltip/with-tooltip.d.ts +7 -0
  35. package/dist/components/molecules/accordion/Accordion.d.ts +4 -0
  36. package/dist/components/molecules/accordion/AccordionItem.d.ts +3 -0
  37. package/dist/components/molecules/alert/Alert.d.ts +4 -0
  38. package/dist/components/molecules/alert/Alert.helpers.d.ts +3 -0
  39. package/dist/components/molecules/alert/AlertProgressBar.d.ts +4 -0
  40. package/dist/components/molecules/breadcrumbs/BreadcrumbItem.d.ts +7 -0
  41. package/dist/components/molecules/breadcrumbs/BreadcrumbList.d.ts +6 -0
  42. package/dist/components/molecules/breadcrumbs/Breadcrumbs.d.ts +4 -0
  43. package/dist/components/molecules/checkbox/Checkbox.controller.d.ts +9 -0
  44. package/dist/components/molecules/checkbox/Checkbox.d.ts +9 -0
  45. package/dist/components/molecules/checkbox/Checkbox.helpers.d.ts +6 -0
  46. package/dist/components/molecules/checkbox/CheckboxStateful.d.ts +4 -0
  47. package/dist/components/molecules/checkbox/CheckboxStateless.d.ts +4 -0
  48. package/dist/components/molecules/index.d.ts +10 -0
  49. package/dist/components/molecules/multi-select/MultiSelect.Combobox.d.ts +15 -0
  50. package/dist/components/molecules/multi-select/MultiSelect.Dropdown.d.ts +11 -0
  51. package/dist/components/molecules/multi-select/MultiSelect.controller.d.ts +13 -0
  52. package/dist/components/molecules/multi-select/MultiSelect.d.ts +4 -0
  53. package/dist/components/molecules/multi-select/MultiSelect.helpers.d.ts +9 -0
  54. package/dist/components/molecules/multi-select/MultiSelectComboboxSelectedValues.d.ts +8 -0
  55. package/dist/components/molecules/multi-select/Option.d.ts +8 -0
  56. package/dist/components/molecules/numeric-input/NumericInput.controller.d.ts +22 -0
  57. package/dist/components/molecules/numeric-input/NumericInput.d.ts +9 -0
  58. package/dist/components/molecules/numeric-input/NumericInput.helpers.d.ts +13 -0
  59. package/dist/components/molecules/numeric-input/NumericInputStateful.d.ts +4 -0
  60. package/dist/components/molecules/numeric-input/NumericInputStateless.d.ts +4 -0
  61. package/dist/components/molecules/search/Search.controller.d.ts +12 -0
  62. package/dist/components/molecules/search/Search.d.ts +4 -0
  63. package/dist/components/molecules/select/Select.controller.d.ts +14 -0
  64. package/dist/components/molecules/select/Select.d.ts +4 -0
  65. package/dist/components/molecules/select/Select.helpers.d.ts +7 -0
  66. package/dist/components/molecules/select/combobox/Combobox.d.ts +15 -0
  67. package/dist/components/molecules/select/dropdown/Dropdown.d.ts +14 -0
  68. package/dist/components/molecules/select/option/Option.d.ts +10 -0
  69. package/dist/components/molecules/switch/Switch.controller.d.ts +10 -0
  70. package/dist/components/molecules/switch/Switch.d.ts +4 -0
  71. package/dist/components/molecules/switch/Switch.helpers.d.ts +6 -0
  72. package/dist/components/molecules/text-input/TextInput.controller.d.ts +17 -0
  73. package/dist/components/molecules/text-input/TextInput.d.ts +9 -0
  74. package/dist/components/molecules/text-input/TextInput.helpers.d.ts +11 -0
  75. package/dist/components/molecules/text-input/TextInputButtons.d.ts +11 -0
  76. package/dist/components/molecules/text-input/TextInputStateful.d.ts +4 -0
  77. package/dist/components/molecules/text-input/TextInputStateless.d.ts +4 -0
  78. package/dist/components/organisms/dialog/Dialog.d.ts +4 -0
  79. package/dist/components/organisms/form/Form.controller.d.ts +14 -0
  80. package/dist/components/organisms/form/Form.d.ts +4 -0
  81. package/dist/components/organisms/form/Form.helpers.d.ts +4 -0
  82. package/dist/components/organisms/grid/Grid.controller.d.ts +15 -0
  83. package/dist/components/organisms/grid/Grid.d.ts +4 -0
  84. package/dist/components/organisms/grid/Grid.helpers.d.ts +6 -0
  85. package/dist/components/organisms/grid/body/GridBody.d.ts +13 -0
  86. package/dist/components/organisms/grid/checkbox/GridCheckbox.d.ts +6 -0
  87. package/dist/components/organisms/grid/column-group/GridColumnGroup.d.ts +6 -0
  88. package/dist/components/organisms/grid/data-cell/GridDataCell.d.ts +4 -0
  89. package/dist/components/organisms/grid/grid-row/GridRow.d.ts +13 -0
  90. package/dist/components/organisms/grid/head/GridHead.d.ts +13 -0
  91. package/dist/components/organisms/grid/header-cell/HeaderCell.d.ts +5 -0
  92. package/dist/components/organisms/grid/select-all-grid-rows-cell/SelectAllGridRowsCell.d.ts +10 -0
  93. package/dist/components/organisms/grid/select-grid-row-cell/SelectGridRowCell.d.ts +10 -0
  94. package/dist/components/organisms/index.d.ts +5 -0
  95. package/dist/components/organisms/menu/Menu.d.ts +4 -0
  96. package/dist/components/organisms/menu/leaf/MenuLeaf.d.ts +5 -0
  97. package/dist/components/organisms/menu/list-item/MenuListItem.d.ts +10 -0
  98. package/dist/components/organisms/menu/sub-menu/SubMenu.d.ts +14 -0
  99. package/dist/components/organisms/tabs/Tabs.d.ts +4 -0
  100. package/dist/components/organisms/tabs/button/TabButton.d.ts +18 -0
  101. package/dist/components/organisms/tabs/content/TabContent.d.ts +8 -0
  102. package/dist/components/organisms/tabs/edit-input/TabEditInput.d.ts +14 -0
  103. package/dist/components/organisms/tabs/list/TabList.d.ts +19 -0
  104. package/dist/enums/alert-mode.d.ts +7 -0
  105. package/dist/enums/button-view.d.ts +6 -0
  106. package/dist/enums/element-size.d.ts +8 -0
  107. package/dist/enums/icon-name.d.ts +284 -0
  108. package/dist/enums/index.d.ts +8 -0
  109. package/dist/enums/loader-view.d.ts +11 -0
  110. package/dist/enums/orientation-mode.d.ts +4 -0
  111. package/dist/enums/semantic-color.d.ts +7 -0
  112. package/dist/enums/tooltip-container.d.ts +7 -0
  113. package/dist/hooks/index.d.ts +15 -0
  114. package/dist/hooks/use-auto-close/use-auto-close.d.ts +6 -0
  115. package/dist/hooks/use-click-outside/use-click-outside.d.ts +8 -0
  116. package/dist/hooks/use-container-dimensions/use-container-dimensions.d.ts +8 -0
  117. package/dist/hooks/use-debounce/use-debounce.d.ts +1 -0
  118. package/dist/hooks/use-element-ids/use-element-ids.d.ts +5 -0
  119. package/dist/hooks/use-is-hovered/use-is-hovered.d.ts +2 -0
  120. package/dist/hooks/use-is-mounted/use-is-mounted.d.ts +1 -0
  121. package/dist/hooks/use-is-overflow/use-is-overflow.d.ts +6 -0
  122. package/dist/hooks/use-key-press/use-key-press.d.ts +8 -0
  123. package/dist/hooks/use-modal-focus-trap/use-modal-focus-trap.d.ts +7 -0
  124. package/dist/hooks/use-remaining-timer/use-remaining-timer.d.ts +9 -0
  125. package/dist/hooks/use-reset-form-input/use-reset-form-input.d.ts +1 -0
  126. package/dist/hooks/use-theme/use-theme.d.ts +4 -0
  127. package/dist/hooks/use-tooltip-position/use-tooltip-position.d.ts +12 -0
  128. package/dist/hooks/use-window-dimensions/use-window-dimensions.d.ts +2 -0
  129. package/dist/index.d.ts +2 -924
  130. package/dist/main.d.ts +8 -0
  131. package/dist/types/_common.d.ts +35 -0
  132. package/dist/types/accordion.d.ts +8 -0
  133. package/dist/types/alert.d.ts +11 -0
  134. package/dist/types/breadcrumbs.d.ts +10 -0
  135. package/dist/types/button.d.ts +11 -0
  136. package/dist/types/checkbox.d.ts +9 -0
  137. package/dist/types/dialog.d.ts +9 -0
  138. package/dist/types/editable-text.d.ts +12 -0
  139. package/dist/types/form.d.ts +18 -0
  140. package/dist/types/grid.d.ts +27 -0
  141. package/dist/types/header.d.ts +9 -0
  142. package/dist/types/image.d.ts +21 -0
  143. package/dist/types/index.d.ts +23 -0
  144. package/dist/types/link.d.ts +9 -0
  145. package/dist/types/loader.d.ts +6 -0
  146. package/dist/types/menu.d.ts +17 -0
  147. package/dist/types/multi-select.d.ts +7 -0
  148. package/dist/types/numeric.d.ts +19 -0
  149. package/dist/types/search.d.ts +16 -0
  150. package/dist/types/select.d.ts +7 -0
  151. package/dist/types/switch.d.ts +13 -0
  152. package/dist/types/tabs.d.ts +23 -0
  153. package/dist/types/text.d.ts +17 -0
  154. package/dist/types/tooltip.d.ts +11 -0
  155. package/dist/utils/get-class-name.d.ts +5 -0
  156. package/dist/utils/handle-dropdown-list-key-press.d.ts +7 -0
  157. package/dist/utils/index.d.ts +3 -0
  158. package/dist/utils/move-focus-on-element-by-id.d.ts +1 -0
  159. package/package.json +17 -13
package/dist/main.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './components/atoms';
2
+ export * from './components/contexts';
3
+ export * from './components/hocs';
4
+ export * from './components/molecules';
5
+ export * from './components/organisms';
6
+ export * from './enums';
7
+ export * from './hooks';
8
+ export * from './types';
@@ -0,0 +1,35 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface ChopLogicComponentProps {
3
+ id?: string;
4
+ className?: string;
5
+ style?: CSSProperties;
6
+ tabIndex?: number;
7
+ title?: string;
8
+ }
9
+ export interface ChopLogicInputProps extends ChopLogicComponentProps {
10
+ label: string;
11
+ name: string;
12
+ disabled?: boolean;
13
+ required?: boolean;
14
+ stateless?: boolean;
15
+ value?: string | number | readonly string[];
16
+ }
17
+ export type SelectValue = {
18
+ id: string;
19
+ label: string;
20
+ } & {
21
+ [key in string]: unknown;
22
+ };
23
+ export type MultiSelectValue = SelectValue & {
24
+ selected: boolean;
25
+ };
26
+ export type NumericInputValidator = (input?: number) => boolean;
27
+ export type TextInputValidator = (input: string) => boolean;
28
+ export type ChopLogicRegExpWithFlags = {
29
+ regexp: string;
30
+ flags?: string;
31
+ };
32
+ export type Dimensions = {
33
+ width: number;
34
+ height: number;
35
+ };
@@ -0,0 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export type AccordionItemProps = PropsWithChildren & {
4
+ summary: string;
5
+ };
6
+ export interface AccordionProps extends ChopLogicComponentProps {
7
+ items: AccordionItemProps[];
8
+ }
@@ -0,0 +1,11 @@
1
+ import { AlertMode, IconName } from '../enums';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export interface AlertProps extends ChopLogicComponentProps {
4
+ isOpened: boolean;
5
+ onClose: () => void;
6
+ message: string;
7
+ mode?: AlertMode;
8
+ icon?: IconName;
9
+ autoClose?: boolean;
10
+ autoCloseDelay?: number;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { IconName } from '../enums';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export interface Breadcrumb {
4
+ label: string;
5
+ icon?: IconName;
6
+ link?: string;
7
+ }
8
+ export interface BreadcrumbsProps extends ChopLogicComponentProps {
9
+ items: Breadcrumb[];
10
+ }
@@ -0,0 +1,11 @@
1
+ import { ButtonView, ElementSize, IconName } from '../enums';
2
+ import { ButtonHTMLAttributes } from 'react';
3
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ view?: ButtonView;
5
+ icon?: IconName;
6
+ text?: string;
7
+ extended?: boolean;
8
+ tooltip?: string;
9
+ label?: string;
10
+ iconSize?: ElementSize;
11
+ }
@@ -0,0 +1,9 @@
1
+ import { ChangeEventHandler } from 'react';
2
+ import { ChopLogicInputProps } from './_common';
3
+ export interface CheckboxProps extends ChopLogicInputProps {
4
+ noLabel?: boolean;
5
+ iconPosition?: 'left' | 'right';
6
+ onChange?: ChangeEventHandler<HTMLInputElement>;
7
+ defaultChecked?: boolean;
8
+ checked?: boolean;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { IconName } from '../enums';
2
+ import { PropsWithChildren } from 'react';
3
+ import { ChopLogicComponentProps } from './_common';
4
+ export interface DialogProps extends ChopLogicComponentProps, PropsWithChildren {
5
+ isOpened: boolean;
6
+ onClose: () => void;
7
+ title: string;
8
+ icon?: IconName;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { MouseEvent } from 'react';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export interface EditableTextProps extends ChopLogicComponentProps {
4
+ value: string;
5
+ autoSelectTextOnEditMode?: boolean;
6
+ isEditMode?: boolean;
7
+ multiline?: boolean;
8
+ onChange?: (value: string) => void;
9
+ onClick?: (event: MouseEvent) => void;
10
+ placeholder?: string;
11
+ readOnly?: boolean;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { FormEventHandler, PropsWithChildren } from 'react';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export type FormValues = {
4
+ [key: string]: unknown;
5
+ };
6
+ export type FormValidationState = [string, boolean][];
7
+ export interface FormInputParams {
8
+ name: string;
9
+ value: unknown;
10
+ valid?: boolean;
11
+ }
12
+ export interface FormProps extends PropsWithChildren, ChopLogicComponentProps {
13
+ initialValues?: FormValues;
14
+ hasReset?: boolean;
15
+ onClickSubmit?: (data: FormValues) => void;
16
+ onReset?: FormEventHandler<HTMLFormElement>;
17
+ onSubmit?: FormEventHandler<HTMLFormElement>;
18
+ }
@@ -0,0 +1,27 @@
1
+ import { ReactElement } from 'react';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export interface GridProps extends ChopLogicComponentProps {
4
+ columns: GridColumn[];
5
+ data: GridItem[];
6
+ caption?: string;
7
+ selectable?: boolean;
8
+ renderDataItem?: RenderDataItemCallback;
9
+ onSelect?: (ids: string[]) => void;
10
+ }
11
+ export type GridColumn = {
12
+ field: string;
13
+ title?: string;
14
+ component?: ReactElement;
15
+ highlighted?: boolean;
16
+ className?: string;
17
+ };
18
+ export type GridItem = {
19
+ id: string;
20
+ disabled?: boolean;
21
+ [key: string]: unknown;
22
+ };
23
+ export type RenderDataItemCallback = (item: GridItem, field: string) => ReactElement;
24
+ export type GridRowValue = {
25
+ field: string;
26
+ value: string | ReactElement;
27
+ };
@@ -0,0 +1,9 @@
1
+ import { IconName } from '../enums';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+ type HeaderLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4
+ export interface HeaderProps extends HTMLAttributes<HTMLHeadingElement> {
5
+ children: ReactNode;
6
+ as?: HeaderLevel;
7
+ icon?: IconName;
8
+ }
9
+ export {};
@@ -0,0 +1,21 @@
1
+ export interface ImageSource {
2
+ src: string;
3
+ descriptor?: string;
4
+ media?: string;
5
+ type?: string;
6
+ }
7
+ export interface ImageProps {
8
+ src: string;
9
+ alt: string;
10
+ sources?: ImageSource[];
11
+ sizes?: string;
12
+ caption?: string;
13
+ width?: number | string;
14
+ height?: number | string;
15
+ aspectRatio?: string;
16
+ loading?: 'lazy' | 'eager';
17
+ decoding?: 'sync' | 'async' | 'auto';
18
+ className?: string;
19
+ decorative?: boolean;
20
+ onError?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
21
+ }
@@ -0,0 +1,23 @@
1
+ export type { ChopLogicComponentProps, ChopLogicInputProps, ChopLogicRegExpWithFlags, Dimensions, MultiSelectValue, NumericInputValidator, SelectValue, TextInputValidator, } from './_common';
2
+ export type { AccordionItemProps, AccordionProps } from './accordion';
3
+ export type { AlertProps } from './alert';
4
+ export type { Breadcrumb, BreadcrumbsProps } from './breadcrumbs';
5
+ export type { ButtonProps } from './button';
6
+ export type { CheckboxProps } from './checkbox';
7
+ export type { DialogProps } from './dialog';
8
+ export type { EditableTextProps } from './editable-text';
9
+ export type { FormInputParams, FormProps, FormValidationState, FormValues } from './form';
10
+ export type { GridColumn, GridItem, GridProps, GridRowValue, RenderDataItemCallback } from './grid';
11
+ export type { HeaderProps } from './header';
12
+ export type { ImageProps, ImageSource } from './image';
13
+ export type { LinkProps } from './link';
14
+ export type { LoaderProps } from './loader';
15
+ export type { MenuItem, MenuProps } from './menu';
16
+ export type { MultiSelectProps } from './multi-select';
17
+ export type { NumericInputProps } from './numeric';
18
+ export type { SearchProps } from './search';
19
+ export type { SelectProps } from './select';
20
+ export type { SwitchProps } from './switch';
21
+ export type { ChopLogicTabItem, TabsProps } from './tabs';
22
+ export type { TextInputProps } from './text';
23
+ export type { TooltipProps } from './tooltip';
@@ -0,0 +1,9 @@
1
+ import { IconName } from '../enums';
2
+ import { AnchorHTMLAttributes, PropsWithChildren } from 'react';
3
+ export interface LinkProps extends PropsWithChildren, AnchorHTMLAttributes<HTMLAnchorElement> {
4
+ href: string;
5
+ icon?: IconName;
6
+ iconPosition?: 'left' | 'right';
7
+ external?: boolean;
8
+ disabled?: boolean;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { LoaderView } from '../enums';
2
+ import { HTMLAttributes } from 'react';
3
+ import { ChopLogicComponentProps } from './_common';
4
+ export interface LoaderProps extends ChopLogicComponentProps, HTMLAttributes<HTMLSpanElement> {
5
+ view?: LoaderView;
6
+ }
@@ -0,0 +1,17 @@
1
+ import { IconName, OrientationMode } from '../enums';
2
+ import { ChopLogicComponentProps } from './_common';
3
+ export interface MenuProps extends ChopLogicComponentProps {
4
+ items: MenuItem[];
5
+ mode?: OrientationMode;
6
+ openedOn?: 'hover' | 'click';
7
+ }
8
+ export interface MenuItem {
9
+ label: string;
10
+ id: string;
11
+ nestedItems?: MenuItem[];
12
+ icon?: IconName;
13
+ link?: string;
14
+ onClick?: () => void;
15
+ onHover?: () => void;
16
+ onFocus?: () => void;
17
+ }
@@ -0,0 +1,7 @@
1
+ import { ChopLogicInputProps, SelectValue } from './_common';
2
+ export interface MultiSelectProps extends ChopLogicInputProps {
3
+ options: SelectValue[];
4
+ onChange?: (values?: SelectValue[]) => void;
5
+ defaultValue?: string | number | readonly string[];
6
+ placeholder?: string;
7
+ }
@@ -0,0 +1,19 @@
1
+ import { ChangeEventHandler, FocusEventHandler } from 'react';
2
+ import { ChopLogicInputProps, NumericInputValidator } from './_common';
3
+ export interface NumericInputProps extends ChopLogicInputProps {
4
+ errorMessage?: string;
5
+ validator?: NumericInputValidator;
6
+ hasSpinButtons?: boolean;
7
+ min?: number;
8
+ max?: number;
9
+ step?: number;
10
+ readOnly?: boolean;
11
+ defaultValue?: number;
12
+ stateless?: boolean;
13
+ value?: number;
14
+ onIncrement?: () => void;
15
+ onDecrement?: () => void;
16
+ onChange?: ChangeEventHandler<HTMLInputElement>;
17
+ onBlur?: FocusEventHandler<HTMLInputElement>;
18
+ onFocus?: FocusEventHandler<HTMLInputElement>;
19
+ }
@@ -0,0 +1,16 @@
1
+ import { FocusEventHandler, HTMLInputAutoCompleteAttribute } from 'react';
2
+ import { ChopLogicInputProps } from './_common';
3
+ export interface SearchProps extends ChopLogicInputProps {
4
+ maxLength?: number;
5
+ minLength?: number;
6
+ placeholder?: string;
7
+ autoComplete?: HTMLInputAutoCompleteAttribute;
8
+ clearable?: boolean;
9
+ spellCheck?: boolean;
10
+ searchMode?: 'automatic' | 'manual';
11
+ onSearch?: (searchTerm: string) => void;
12
+ onClear?: () => void;
13
+ onBlur?: FocusEventHandler<HTMLInputElement>;
14
+ onFocus?: FocusEventHandler<HTMLInputElement>;
15
+ debounceDelay?: number;
16
+ }
@@ -0,0 +1,7 @@
1
+ import { ChopLogicInputProps, SelectValue } from './_common';
2
+ export interface SelectProps extends ChopLogicInputProps {
3
+ options: SelectValue[];
4
+ onChange?: (value?: SelectValue) => void;
5
+ placeholder?: string;
6
+ defaultValue?: string | number | readonly string[];
7
+ }
@@ -0,0 +1,13 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface SwitchProps {
3
+ checked?: boolean;
4
+ onChange?: (checked: boolean) => void;
5
+ value?: string;
6
+ hasIndicator?: boolean;
7
+ label: string;
8
+ name: string;
9
+ disabled?: boolean;
10
+ id?: string;
11
+ className?: string;
12
+ style?: CSSProperties;
13
+ }
@@ -0,0 +1,23 @@
1
+ import { OrientationMode } from '../enums';
2
+ import { ReactElement } from 'react';
3
+ import { ChopLogicComponentProps } from './_common';
4
+ export interface TabsProps extends ChopLogicComponentProps {
5
+ tabs: ChopLogicTabItem[];
6
+ defaultTabId?: string;
7
+ mode?: OrientationMode;
8
+ stretched?: boolean;
9
+ editable?: boolean;
10
+ extendable?: boolean;
11
+ extendedTabLabel?: string;
12
+ extendedTabContent?: ReactElement;
13
+ onTabTitleChange?: (tabId: string, newTitle: string) => void;
14
+ onTabAdd?: () => void;
15
+ onTabSelect?: (id: string) => void;
16
+ onTabDelete?: (id: string) => void;
17
+ }
18
+ export interface ChopLogicTabItem {
19
+ content: ReactElement;
20
+ title: string;
21
+ id: string;
22
+ disabled?: boolean;
23
+ }
@@ -0,0 +1,17 @@
1
+ import { ChangeEventHandler, FocusEventHandler, HTMLInputAutoCompleteAttribute } from 'react';
2
+ import { ChopLogicInputProps, ChopLogicRegExpWithFlags, TextInputValidator } from './_common';
3
+ export interface TextInputProps extends ChopLogicInputProps {
4
+ errorMessage?: string;
5
+ clearable?: boolean;
6
+ readOnly?: boolean;
7
+ type?: 'text' | 'email' | 'password';
8
+ validator?: ChopLogicRegExpWithFlags | TextInputValidator;
9
+ maxLength?: number;
10
+ placeholder?: string;
11
+ defaultValue?: string;
12
+ autoComplete?: HTMLInputAutoCompleteAttribute;
13
+ onClear?: () => void;
14
+ onChange?: ChangeEventHandler<HTMLInputElement>;
15
+ onBlur?: FocusEventHandler<HTMLInputElement>;
16
+ onFocus?: FocusEventHandler<HTMLInputElement>;
17
+ }
@@ -0,0 +1,11 @@
1
+ import { SemanticColor, TooltipContainer } from '../enums';
2
+ import { PropsWithChildren, ReactElement } from 'react';
3
+ import { ChopLogicComponentProps } from './_common';
4
+ export interface TooltipProps extends PropsWithChildren, ChopLogicComponentProps {
5
+ tooltipContent: string | ReactElement;
6
+ containerTag?: TooltipContainer;
7
+ visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
8
+ autoClose?: boolean;
9
+ autoCloseDelay?: number;
10
+ color?: SemanticColor;
11
+ }
@@ -0,0 +1,5 @@
1
+ type ClassNameInput = string | {
2
+ [key in string]: boolean;
3
+ } | undefined | null;
4
+ export declare function getClassName(input: ClassNameInput[]): string;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SelectValue } from '../types';
2
+ import { KeyboardEvent } from 'react';
3
+ export declare function handleDropdownListKeyPress({ e, options, onClose, }: {
4
+ e: KeyboardEvent<HTMLUListElement>;
5
+ options: SelectValue[];
6
+ onClose: () => void;
7
+ }): void;
@@ -0,0 +1,3 @@
1
+ export { getClassName } from './get-class-name';
2
+ export { handleDropdownListKeyPress } from './handle-dropdown-list-key-press';
3
+ export { moveFocusOnElementById } from './move-focus-on-element-by-id';
@@ -0,0 +1 @@
1
+ export declare function moveFocusOnElementById(id: string): void;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/ChopLogic/chop-logic-components.git"
6
6
  },
7
- "version": "4.1.0",
7
+ "version": "4.1.1",
8
8
  "description": "Reusable React components and hooks for the Chop Logic project",
9
9
  "type": "module",
10
10
  "module": "dist/index.es.js",
@@ -85,6 +85,7 @@
85
85
  "typecheck": "tsc --pretty --noEmit",
86
86
  "test": "vitest",
87
87
  "test:ci": "vitest run --passWithNoTests",
88
+ "test:integration": "npm run build:storybook && start-server-and-test 'http-server storybook-static -p 6006 -s' http://127.0.0.1:6006 test-storybook",
88
89
  "test:mutation": "stryker run",
89
90
  "coverage": "vitest run --coverage",
90
91
  "release:version": "node scripts/release-version.js"
@@ -116,12 +117,13 @@
116
117
  },
117
118
  "homepage": "https://choplogic.github.io/chop-logic-components",
118
119
  "devDependencies": {
119
- "@biomejs/biome": "^2.4.12",
120
- "@commitlint/cli": "^20.5.0",
121
- "@commitlint/config-conventional": "^20.5.0",
122
- "@storybook/addon-a11y": "^10.3.5",
123
- "@storybook/addon-docs": "^10.3.5",
124
- "@storybook/react-vite": "^10.3.5",
120
+ "@biomejs/biome": "^2.4.13",
121
+ "@commitlint/cli": "^20.5.3",
122
+ "@commitlint/config-conventional": "^20.5.3",
123
+ "@storybook/addon-a11y": "^10.3.6",
124
+ "@storybook/addon-docs": "^10.3.6",
125
+ "@storybook/react-vite": "^10.3.6",
126
+ "@storybook/test-runner": "^0.24.3",
125
127
  "@stryker-mutator/core": "^9.6.1",
126
128
  "@stryker-mutator/vitest-runner": "^9.6.1",
127
129
  "@testing-library/jest-dom": "^6.9.1",
@@ -129,18 +131,20 @@
129
131
  "@types/node": "^25.6.0",
130
132
  "@types/react": "^19.2.14",
131
133
  "@types/react-dom": "^19.2.3",
132
- "@vitest/coverage-v8": "^4.1.4",
134
+ "@vitest/coverage-v8": "^4.1.5",
135
+ "http-server": "^14.1.1",
133
136
  "husky": "^9.1.7",
134
137
  "husky-init": "^8.0.0",
135
- "jsdom": "^29.0.2",
138
+ "jsdom": "^29.1.1",
136
139
  "prettier": "^3.8.3",
137
140
  "remark-gfm": "^4.0.1",
138
- "storybook": "^10.3.5",
141
+ "start-server-and-test": "^3.0.2",
142
+ "storybook": "^10.3.6",
139
143
  "typescript": "^6.0.3",
140
- "vite": "^8.0.8",
141
- "vite-plugin-dts": "^4.5.4",
144
+ "vite": "^8.0.10",
145
+ "vite-plugin-dts": "^5.0.0",
142
146
  "vite-plugin-lib-inject-css": "^2.2.2",
143
- "vitest": "^4.1.4"
147
+ "vitest": "^4.1.5"
144
148
  },
145
149
  "overrides": {
146
150
  "storybook": "$storybook"