@luscii-healthtech/web-ui 0.0.0-alpha.ab3fdb2 → 0.0.0-dynamic

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 (50) hide show
  1. package/README.md +116 -46
  2. package/dist/components/AccordionList/AccordionList.d.ts +11 -1
  3. package/dist/components/AccordionList/subcomponents/AccordionListActions.d.ts +18 -0
  4. package/dist/components/Card/Card.d.ts +1 -1
  5. package/dist/components/Checkbox/Checkbox.d.ts +46 -1
  6. package/dist/components/CheckboxList/CheckboxGroup.d.ts +1 -1
  7. package/dist/components/CheckboxList/CheckboxList.d.ts +1 -2
  8. package/dist/components/CheckboxList/CheckboxList.types.d.ts +35 -13
  9. package/dist/components/Container/types/FlexContainerProps.type.d.ts +2 -2
  10. package/dist/components/FilterBar/ActiveFilters.d.ts +9 -0
  11. package/dist/components/FilterBar/FilterBar.d.ts +96 -0
  12. package/dist/components/FilterBar/FilterBar.utils.d.ts +32 -0
  13. package/dist/components/FilterBar/FilterBarProps.type.d.ts +86 -0
  14. package/dist/components/FilterBar/FiltersMenus.d.ts +8 -0
  15. package/dist/components/FilterBar/SortMenu.d.ts +9 -0
  16. package/dist/components/FilterBar/index.d.ts +2 -0
  17. package/dist/components/Form/form.types.d.ts +4 -3
  18. package/dist/components/Icon/Icon.d.ts +1 -1
  19. package/dist/components/Icons/EyeIconSlashed.d.ts +4 -0
  20. package/dist/components/Icons/PageViewIcon.d.ts +4 -0
  21. package/dist/components/Icons/index.d.ts +2 -0
  22. package/dist/components/InfoField/InfoField.d.ts +19 -9
  23. package/dist/components/Input/Input.d.ts +1 -1
  24. package/dist/components/Input/SearchInput.d.ts +23 -3
  25. package/dist/components/Link/Link.d.ts +19 -0
  26. package/dist/components/{ImagePicker → MediaPicker}/ImageCategory.d.ts +2 -2
  27. package/dist/components/MediaPicker/MediaPicker.d.ts +95 -0
  28. package/dist/components/Modal/FullPageModal.d.ts +29 -1
  29. package/dist/components/Modal/FullPageModalHeader.d.ts +6 -0
  30. package/dist/components/Modal/subcomponents/FullPageModalActions.d.ts +18 -0
  31. package/dist/components/PreviewPhone/PreviewPhone.d.ts +1 -1
  32. package/dist/components/Section/Section.d.ts +1 -1
  33. package/dist/components/Select/Select.d.ts +9 -3
  34. package/dist/components/Spinner/Spinner.d.ts +2 -2
  35. package/dist/components/Text/Text.d.ts +78 -29
  36. package/dist/components/TextEditor/TextEditor.d.ts +17 -0
  37. package/dist/components/TextLink/TextLink.d.ts +3 -0
  38. package/dist/components/Timeline/TimelineHeader.d.ts +1 -1
  39. package/dist/components/Toaster/toast-progress-animator.d.ts +1 -1
  40. package/dist/index.d.ts +6 -4
  41. package/dist/index.development.js +5678 -0
  42. package/dist/index.development.js.map +1 -0
  43. package/dist/index.js +1 -1356
  44. package/dist/index.js.map +1 -1
  45. package/dist/web-ui-tailwind.css +907 -474
  46. package/dist/web-ui.esm.js +1 -1356
  47. package/dist/web-ui.esm.js.map +1 -1
  48. package/package.json +44 -49
  49. package/dist/components/CheckboxList/CheckboxListItem.d.ts +0 -3
  50. package/dist/components/ImagePicker/ImagePicker.d.ts +0 -29
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The object used to create a filter dropdown in the component.
3
+ * This is used based on the dataset passed to FilterBar, so we always calculate the filters
4
+ * looking at the data.
5
+ */
6
+ export type FilterGenerator<SortableEntity> = {
7
+ id: string;
8
+ label: string;
9
+ /**
10
+ *
11
+ * @param data the value from the dataset entry that will be used for the filter
12
+ * @returns the string value for the desired filter
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * {
18
+ id: "brand",
19
+ label: "Brand",
20
+ filterValuePredicate: (tshirt: TShirtFromApi) => tshirt.brand,
21
+ }
22
+ * ```
23
+ * in the above, all unique values from `brand` will be used to populate the `Brand` filter.
24
+ */
25
+ filterValuePredicate: (data: SortableEntity) => string;
26
+ };
27
+ /**
28
+ * Allows customization of labels related to filter.
29
+ *
30
+ */
31
+ export type FilterBarLocalization = {
32
+ /**
33
+ * The string prefix displayed when a sorting value is selected in the menu.
34
+ *
35
+ * @default "Sorted by:"
36
+ * @example
37
+ *
38
+ * `sortedByLabel`: "Sorted by: "
39
+ *
40
+ * Example of sorting options
41
+ * - Name
42
+ * - Email (selected)
43
+ * - Date of birth
44
+ *
45
+ * UI shows: `Sorted by: Email`.
46
+ */
47
+ sortedByLabel: string;
48
+ /**
49
+ * The string for unselected state of the sorting options.
50
+ *
51
+ * @default "Sort"
52
+ */
53
+ sortLabel: string;
54
+ /**
55
+ * The string for the active filters and the mobile filter menu label.
56
+ *
57
+ * @default "Filters"
58
+ */
59
+ filtersLabel: string;
60
+ };
61
+ export type TransformedFilterOption = {
62
+ id: string;
63
+ label: string;
64
+ value: string;
65
+ isChecked: boolean;
66
+ };
67
+ export type TransformedFilterOptions = TransformedFilterOption[];
68
+ type CategorizedFilter = {
69
+ key: string;
70
+ label: string;
71
+ options: TransformedFilterOptions;
72
+ };
73
+ export type CategorizedFilters = CategorizedFilter[];
74
+ export type TransformedSortingOption<SortableEntity extends object> = {
75
+ id: string;
76
+ label: string;
77
+ value: string;
78
+ isChecked: boolean;
79
+ sortingCompare: (itemA: SortableEntity, itemB: SortableEntity) => number;
80
+ };
81
+ export type TransformedSortingOptions<SortableEntity extends object> = TransformedSortingOption<SortableEntity>[];
82
+ export type OnFilterBarFilterChange = (params: {
83
+ changedFilterOption: TransformedFilterOption;
84
+ }) => void;
85
+ export type OnFilterBarSortingChange<SortableEntity extends object> = (changedSortingOption: TransformedSortingOption<SortableEntity>) => void;
86
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { CategorizedFilters, OnFilterBarFilterChange } from "./FilterBarProps.type";
3
+ type FiltersMenusProps = {
4
+ filters: CategorizedFilters;
5
+ onFilterOptionChange: OnFilterBarFilterChange;
6
+ };
7
+ export declare const FiltersMenus: React.FC<FiltersMenusProps>;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ReactElement } from "react";
2
+ import { FilterBarLocalization, OnFilterBarSortingChange, TransformedSortingOption } from "./FilterBarProps.type";
3
+ type SortMenuProps<SortableEntity extends object> = {
4
+ localization: FilterBarLocalization;
5
+ sortingOptions: TransformedSortingOption<SortableEntity>[];
6
+ onSortOptionChange: OnFilterBarSortingChange<SortableEntity>;
7
+ };
8
+ export declare const SortMenu: <SortableEntity extends object>(props: SortMenuProps<SortableEntity>) => ReactElement | null;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ export { FilterBar } from "./FilterBar";
2
+ export * as FilterBarUtils from "./FilterBar.utils";
@@ -3,10 +3,9 @@ import React, { HTMLInputTypeAttribute } from "react";
3
3
  import { InputProps } from "../Input/Input";
4
4
  import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
5
5
  import { SelectProps } from "../Select/Select";
6
- import { ImagePickerProps } from "../ImagePicker/ImagePicker";
6
+ import { ImagePickerProps } from "../MediaPicker/MediaPicker";
7
7
  import { PartialProperties } from "../../types/general.types";
8
8
  import { CheckboxProps } from "../Checkbox/Checkbox";
9
- import { CheckboxListProps } from "../CheckboxList/CheckboxList.types";
10
9
  import { TextareaProps } from "../Textarea/Textarea";
11
10
  import { TitleProps } from "../Title/Title";
12
11
  export type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
@@ -74,7 +73,9 @@ export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<O
74
73
  * Omiting `groups` and `onChange` here because these will be handled by
75
74
  * the `Control` component from react-hook-form.
76
75
  */
77
- export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<Pick<CheckboxListProps, "hasDividers" | "className">> {
76
+ export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<{
77
+ className?: string;
78
+ }> {
78
79
  type: "checkboxlist";
79
80
  }
80
81
  /**
@@ -4,7 +4,7 @@ export declare const Icon: React.FC<{
4
4
  name: IconKey;
5
5
  } & IconProps>;
6
6
  /**
7
- * This is a temporary component to transition the way we pass icons to components.
7
+ * This is a temporary component toui-transition the way we pass icons to components.
8
8
  * Once all components are passed an IconKey instead of a function component we can replace it with the Icon component.
9
9
  *
10
10
  * If any expansion or customization must be made for all icons, do it in the iconWrapper.tsx component.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from "./types/IconProps.type";
3
+ declare const _default: (props: IconProps) => JSX.Element;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from "./types/IconProps.type";
3
+ declare const _default: (props: IconProps) => JSX.Element;
4
+ export default _default;
@@ -17,6 +17,7 @@ export { default as EditIcon } from "./EditIcon";
17
17
  export { default as EmptyIcon } from "./EmptyIcon";
18
18
  export { default as EmptyStateDashboardIcon } from "./EmptyStateDashboardIcon";
19
19
  export { default as ExclamationMarkIcon } from "./ExclamationMarkIcon";
20
+ export { default as EyeIconSlashed } from "./EyeIconSlashed";
20
21
  export { default as EyeIcon } from "./EyeIcon";
21
22
  export { default as GearColoredIcon } from "./GearColoredIcon";
22
23
  export { default as GearIcon } from "./GearIcon";
@@ -33,6 +34,7 @@ export { default as LockIcon } from "./LockIcon";
33
34
  export { default as MessagesIcon } from "./MessagesIcon";
34
35
  export { default as MouseIcon } from "./MouseIcon";
35
36
  export { default as NotesIcon } from "./NotesIcon";
37
+ export { default as PageViewIcon } from "./PageViewIcon";
36
38
  export { default as PinIcon } from "./PinIcon";
37
39
  export { default as PrintIcon } from "./PrintIcon";
38
40
  export { default as RightArrowIcon } from "./RightArrowIcon";
@@ -1,18 +1,28 @@
1
1
  /// <reference types="react" />
2
- type InfoFieldLinkType = "none" | "link" | "clipboard" | "tel";
3
2
  interface InfoFieldProps {
4
3
  label: string;
5
4
  value: string;
6
- linkType: InfoFieldLinkType;
5
+ /**
6
+ * Gives the component interactive abilities. The `value` prop
7
+ * is used in conjunction with this.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * // The `value` prop will be used as the `href` attribute of the link. This will open a new tab.
12
+ * <InfoField linkType="link" value="https://www.nos.nl" />
13
+ *
14
+ * // The `value` prop will be copied to the clipboard when the user clicks the component.
15
+ * <InfoField linkType="clipboard" value="14/09/1988" />
16
+ *
17
+ * // A phone call will be triggered based on the phone number in the `value` prop.
18
+ * <InfoField linkType="tel" value="+31612345678" />
19
+ * ```
20
+ */
21
+ linkType: "none" | "link" | "clipboard" | "tel";
7
22
  supportsMultiline?: boolean;
8
- onCopyToClipboard?: () => void;
23
+ onCopyToClipboard?: (value?: string) => void;
9
24
  icon?: JSX.Element;
10
25
  className?: string;
11
26
  }
12
- export declare const InfoField: {
13
- (props: InfoFieldProps): JSX.Element;
14
- defaultProps: {
15
- linkType: string;
16
- };
17
- };
27
+ export declare const InfoField: (props: InfoFieldProps) => JSX.Element;
18
28
  export {};
@@ -53,5 +53,5 @@ export interface InputProps extends CustomHTMLInputProps {
53
53
  */
54
54
  asFormField?: boolean;
55
55
  }
56
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
56
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
57
57
  export default Input;
@@ -1,4 +1,24 @@
1
1
  import React from "react";
2
- import { InputProps } from "./Input";
3
- export type SearchInputProps = Omit<InputProps, "icon" | "withSuffix" | "withPrefix" | "type" | "clearable">;
4
- export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
2
+ import Input from "./Input";
3
+ type InputProps = React.ComponentProps<typeof Input>;
4
+ export type SearchInputProps = Omit<InputProps, "icon" | "type" | "width" | "clearable" | "withSuffix" | "withPrefix" | "asFormField" | "isError"> & {
5
+ /**
6
+ * WARNING: Please note that this value is currently not passed on to the
7
+ * component. It's not deprecated, it will most likely be implemented correctly
8
+ * at a later stage.
9
+ */
10
+ width?: InputProps["width"];
11
+ /**
12
+ * @deprecated
13
+ * A search input should never be used in a form with multiple fields.
14
+ */
15
+ asFormField?: InputProps["asFormField"];
16
+ /**
17
+ * @deprecated
18
+ * A search input should never be in error state, because the
19
+ * user cannot do anything wrong when typing in this field.
20
+ */
21
+ isError?: InputProps["isError"];
22
+ };
23
+ export declare const SearchInput: React.ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
24
+ export {};
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ /**
3
+ * Source for the typing of the `as` prop: https://stackoverflow.com/a/66568474
4
+ */
5
+ type Props<E extends React.ElementType> = React.PropsWithChildren<{
6
+ /**
7
+ * Provide a custom component tag name to render instead of the default `a` tag.
8
+ *
9
+ * @default "a"
10
+ * @example "button"
11
+ */
12
+ as?: E;
13
+ }>;
14
+ /**
15
+ * A bare-bones wrapper around an <a> tag, containing only our preferred styling. This is component
16
+ * can be used for any link and not just text links.
17
+ */
18
+ export declare function Link<T extends React.ElementType = "a">(props: Props<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof Props<T>>): React.JSX.Element;
19
+ export {};
@@ -1,4 +1,4 @@
1
- import { MouseEventHandler } from "react";
1
+ import React, { MouseEventHandler } from "react";
2
2
  export interface CategoryProps {
3
3
  folder: string;
4
4
  key: string;
@@ -10,5 +10,5 @@ interface ImageCategoryProps {
10
10
  handleImageClick: MouseEventHandler<HTMLSpanElement>;
11
11
  isTypeCompact: boolean;
12
12
  }
13
- export declare const ImageCategory: (props: ImageCategoryProps) => JSX.Element;
13
+ export declare const ImageCategory: (props: ImageCategoryProps) => React.JSX.Element;
14
14
  export {};
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import { CategoryProps } from "./ImageCategory";
3
+ export interface TargetProps {
4
+ target: {
5
+ name: string | null | undefined;
6
+ /**
7
+ * It is called imageData, but it can any file that was selected. The name is kept for backwards compatibility for now.
8
+ */
9
+ value: string | null | undefined | {
10
+ imageData: FormData;
11
+ };
12
+ };
13
+ }
14
+ export interface ImagePickerProps {
15
+ name: string;
16
+ images: string[];
17
+ categories: CategoryProps[];
18
+ preselectedImage?: string;
19
+ preselectedMediaType?: "image" | "video";
20
+ /**
21
+ * Array of [valid MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types).
22
+ *
23
+ * If the media the user tries to upload doesn't match one of the
24
+ * MIME types in this array, an error message will be displayed in
25
+ * the UI.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <MediaPicker acceptedMimeTypes={[ "text/*", "image/jpeg", "video/mp4"]} />
30
+ * ```
31
+ */
32
+ acceptedMimeTypes?: string[];
33
+ /**
34
+ * Maximum file size allowed to be uploaded in MB. If undefined, a default limit of 100mb is applied.
35
+ */
36
+ maxFileSize?: number;
37
+ clearImageIndex?: number;
38
+ type?: "normal" | "compact";
39
+ isDisabled?: boolean;
40
+ handleChange: (target: TargetProps) => void;
41
+ isUploadButtonVisible?: boolean;
42
+ isClearButtonVisible?: boolean;
43
+ isUploading?: boolean;
44
+ isErrorUploading?: boolean;
45
+ localisation: Partial<Record<"openModalButton" | "selectButton" | "error" | "uploadImage" | "clearSelection" | "cancel" | "search" | "unsupportedMediaType" | "modalTitle", string>>;
46
+ }
47
+ export declare const ImagePickerInner: React.FC<ImagePickerProps & {
48
+ innerRef?: React.Ref<HTMLButtonElement>;
49
+ }>;
50
+ /**
51
+ * @deprecated Use MediaPicker instead
52
+ */
53
+ export declare const ImagePicker: React.ForwardRefExoticComponent<ImagePickerProps & React.RefAttributes<HTMLButtonElement>>;
54
+ export interface MediaPickerProps {
55
+ name: string;
56
+ media: string[];
57
+ categories: CategoryProps[];
58
+ /**
59
+ * If you add preselectedMedia you must also specify preselectedMediaType, especially if it is not an image.
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * <MediaPicker preselectedMedia="http://www.domain.com/someVideo.mp4" preselectedMediaType="video"/>
64
+ * ```
65
+ */
66
+ preselectedMedia?: string;
67
+ preselectedMediaType?: "image" | "video";
68
+ clearIndex?: number;
69
+ type?: "normal" | "compact";
70
+ /**
71
+ * Array of [valid MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types).
72
+ *
73
+ * If the media the user tries to upload doesn't match one of the
74
+ * MIME types in this array, an error message will be displayed in
75
+ * the UI.
76
+ *
77
+ * @example
78
+ * ```tsx
79
+ * <MediaPicker acceptedMimeTypes={[ "text/*", "image/jpeg", "video/mp4"]} />
80
+ * ```
81
+ */
82
+ acceptedMimeTypes?: string[];
83
+ /**
84
+ * Maximum file size allowed to be uploaded in MB. If undefined, a default limit of 100mb is applied.
85
+ */
86
+ maxFileSize?: number;
87
+ isDisabled?: boolean;
88
+ onChange: (target: TargetProps) => void;
89
+ isUploadButtonVisible?: boolean;
90
+ isClearButtonVisible?: boolean;
91
+ isUploading?: boolean;
92
+ isErrorUploading?: boolean;
93
+ localisation: Partial<Record<"openModalButton" | "selectButton" | "error" | "upload" | "clearSelection" | "cancel" | "search" | "unsupportedMediaType" | "modalTitle", string>>;
94
+ }
95
+ export declare const MediaPicker: (props: MediaPickerProps) => React.JSX.Element;
@@ -1,11 +1,39 @@
1
1
  import React from "react";
2
2
  import { PrimaryButtonProps } from "../ButtonV2/ButtonProps.type";
3
+ import { FullPageModalActions } from "./subcomponents/FullPageModalActions";
3
4
  export type FullPageModalProps = {
4
5
  children: React.ReactNode;
5
6
  isOpen?: boolean;
6
7
  title: string;
7
8
  dataTestId?: string;
9
+ /**
10
+ * @deprecated
11
+ * Use the `actions` prop to render any button(s)
12
+ * or other component(s) automatically in the correct area.
13
+ *
14
+ * This prop will only render a button when the actions prop is omitted.
15
+ * The actions prop takes precedence over this prop if they're both passed.
16
+ */
8
17
  primaryButtonProps?: PrimaryButtonProps;
18
+ /**
19
+ * Render buttons or other action components in the area meant for actions.
20
+ * To correctly space out the actions wrap them in a FullPageModal.Actions component.
21
+ * @usage
22
+ * ```tsx
23
+ * <FullPageModal
24
+ * actions={
25
+ * <FullPageModal.Actions>
26
+ * <PrimaryButton />
27
+ * <SecondaryButton />
28
+ * </FullPageModal.Actions>
29
+ * }
30
+ * />
31
+ */
32
+ actions?: React.ReactNode;
9
33
  onCloseClick: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
10
34
  };
11
- export declare const FullPageModal: React.FC<FullPageModalProps>;
35
+ interface StaticComponents {
36
+ Actions: typeof FullPageModalActions;
37
+ }
38
+ export declare const FullPageModal: React.FC<FullPageModalProps> & StaticComponents;
39
+ export {};
@@ -2,6 +2,12 @@ import React from "react";
2
2
  import { PrimaryButtonProps } from "../ButtonV2/ButtonProps.type";
3
3
  export type FullPageModalHeaderProps = {
4
4
  title: string;
5
+ /**
6
+ * @deprecated
7
+ * Use the `actions` prop to render any button(s)
8
+ * or other component(s) automatically in the correct area.
9
+ */
5
10
  primaryButtonProps?: PrimaryButtonProps;
11
+ actions?: React.ReactNode;
6
12
  };
7
13
  export declare const FullPageModalHeader: React.FC<FullPageModalHeaderProps>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ /**
3
+ * Use in the actions of a FullPageModal. Spaces out the action
4
+ * components correctly in relation to the styling of the FullPageModal component.
5
+ *
6
+ * @usage
7
+ * ```tsx
8
+ * <FullPageModal
9
+ * actions={
10
+ * <FullPageModal.Actions>
11
+ * <PrimaryButton />
12
+ * <SecondaryButton />
13
+ * </FullPageModal.Actions>
14
+ * }
15
+ * />
16
+ * ```
17
+ */
18
+ export declare const FullPageModalActions: React.FC<React.PropsWithChildren>;
@@ -3,5 +3,5 @@ interface PreviewPhoneProps {
3
3
  className?: string;
4
4
  children: React.ReactNode;
5
5
  }
6
- declare const PreviewPhone: ({ className, children }: PreviewPhoneProps) => JSX.Element;
6
+ declare const PreviewPhone: ({ className, children, }: PreviewPhoneProps) => JSX.Element;
7
7
  export default PreviewPhone;
@@ -7,7 +7,7 @@ export interface SectionProps extends RestPropped {
7
7
  title?: string;
8
8
  /**
9
9
  * @deprecated
10
- * Use the `sectionHeaderAside` prop to render any button(s)
10
+ * Use the `headerAside` prop to render any button(s)
11
11
  * or other component(s) automatically in the correct area.
12
12
  */
13
13
  buttons?: ButtonProps[];
@@ -14,7 +14,13 @@ interface OptionMinimal {
14
14
  label?: string;
15
15
  }
16
16
  export interface SelectProps<Option extends OptionMinimal = OptionMinimal, IsMulti extends boolean = any, Group extends GroupBase<Option> = GroupBase<Option>> extends Props<Option, IsMulti, Group> {
17
+ /**
18
+ * Whether to show the component in error state.
19
+ */
17
20
  isError?: boolean;
21
+ /**
22
+ * The maximum width the component will take.
23
+ */
18
24
  width?: FormFieldWidth;
19
25
  /**
20
26
  * REASON: this could be a ticket to fix later on, but react-select has some tricky types to navigate
@@ -27,14 +33,14 @@ export interface SelectProps<Option extends OptionMinimal = OptionMinimal, IsMul
27
33
  /**
28
34
  * A wrapper around react-select to style it according to our design specification.
29
35
  *
30
- * In addition, the value is taken out of the option, instead of returning the complete option.
36
+ * In addition, the value is taken out of the option instead of returning the complete option.
31
37
  *
32
- * Care when using grouped options: the value of the options overspanning all groups need to be unique!
38
+ * Care when using grouped options: The value of the options spanning all groups needs to be unique!
33
39
  * For instance, if you have an option with value "chocolate" in both the groups "flavor" and "dip", then you get unforeseen errors.
34
40
  * This is a problem within react-select itself, not our wrapper.
35
41
  *
36
42
  * Care when using defaultValue: this still requires the complete Option (instead of the value of the Option).
37
- * So far there wasn't a use-case for this.
43
+ * So far there wasn't a use case for this.
38
44
  */
39
45
  export declare const Select: React.ForwardRefExoticComponent<SelectProps<OptionMinimal, boolean, GroupBase<OptionMinimal>> & React.RefAttributes<unknown>>;
40
46
  export {};
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  interface SpinnerProps {
3
3
  className?: string;
4
4
  }
5
- export declare const Spinner: (props: SpinnerProps) => JSX.Element;
5
+ export declare const Spinner: (props: SpinnerProps) => React.JSX.Element;
6
6
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { RestPropped } from "../../types/general.types";
3
3
  import "./Text.css";
4
4
  /**
@@ -8,47 +8,99 @@ import "./Text.css";
8
8
  * https://v1.tailwindcss.com/docs/controlling-file-size
9
9
  */
10
10
  declare const allowedTextStyles: {
11
- sm: string;
12
- "sm-strong": string;
13
- base: string;
14
- strong: string;
15
- lg: string;
16
- "lg-strong": string;
17
- xl: string;
18
- "xl-strong": string;
11
+ readonly sm: "ui-text-xs ui-font-medium";
12
+ readonly "sm-strong": "ui-text-xs ui-font-semibold";
13
+ readonly base: "ui-text-sm";
14
+ readonly strong: "ui-text-sm ui-font-semibold";
15
+ readonly lg: "";
16
+ readonly "lg-strong": "ui-font-semibold";
17
+ readonly xl: "ui-text-lg";
18
+ readonly "xl-strong": "ui-font-semibold ui-text-lg";
19
19
  };
20
20
  export declare const allowedColors: {
21
- readonly base: "text-slate-800";
22
- readonly "slate-500": "text-slate-500";
23
- readonly "slate-200": "text-slate-200";
24
- readonly red: "text-red-700";
25
- readonly green: "text-green-700";
26
- readonly amber: "text-yellow-700";
27
- readonly white: "text-white";
28
- readonly "blue-800": "text-blue-800";
29
- readonly current: "text-current";
21
+ readonly base: "ui-text-slate-800";
22
+ readonly "slate-500": "ui-text-slate-500";
23
+ readonly "slate-200": "ui-text-slate-200";
24
+ readonly red: "ui-text-red-700";
25
+ readonly green: "ui-text-green-700";
26
+ readonly amber: "ui-text-yellow-700";
27
+ readonly white: "ui-text-white";
28
+ readonly "blue-800": "ui-text-blue-800";
29
+ readonly current: "ui-text-current";
30
30
  };
31
31
  declare const allowedHoverColors: {
32
- readonly "blue-900": "hover:text-blue-900";
33
- readonly white: "hover:text-white";
32
+ readonly "blue-900": "hover:ui-text-blue-900";
33
+ readonly white: "hover:ui-text-white";
34
34
  };
35
35
  export type TextColor = keyof typeof allowedColors;
36
36
  export type TextHoverColor = keyof typeof allowedHoverColors;
37
37
  export type TextStyle = keyof typeof allowedTextStyles;
38
- export interface TextProps extends RestPropped {
39
- text: string;
38
+ export interface TextProps extends RestPropped, React.ComponentPropsWithoutRef<"p"> {
39
+ /**
40
+ * @deprecated
41
+ * Use `children` instead, as you would with a regular `<p>` tag.
42
+ */
43
+ text?: string;
44
+ /**
45
+ * @deprecated
46
+ * Use `variant` instead. "type" is a word that is too ambiguous and
47
+ * is also often used as an attribute name in HTML.
48
+ *
49
+ * @default "base"
50
+ */
40
51
  type?: TextStyle;
52
+ /**
53
+ * The styling variant of the text.
54
+ *
55
+ * @default "base"
56
+ */
57
+ variant?: TextStyle;
58
+ /**
59
+ * Changes the component to be rendered inline. This is useful for
60
+ * using this component inside of itself, for example, when you want
61
+ * to render bold text inside of a paragraph rendered by this same component.
62
+ *
63
+ * @default false
64
+ */
41
65
  inline?: boolean;
66
+ /**
67
+ * @default "base"
68
+ */
42
69
  color?: TextColor;
70
+ /**
71
+ * @default "base"
72
+ */
43
73
  hoverColor?: TextHoverColor;
74
+ /**
75
+ * Tailwind class modifier that allows you to apply hover styles on this component
76
+ * based on the styles of its parent.
77
+ * https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-parent-state
78
+ *
79
+ * @deprecated
80
+ * Since this is a Tailwind specific feature we should not expose this to the consumer. We
81
+ * should only use group-hover styles in the components in WebUI instead.
82
+ */
44
83
  hoverInGroup?: boolean;
45
84
  className?: string;
85
+ /**
86
+ * Interpret an HTML string as regular markup, instead of rendering it as a string.
87
+ *
88
+ * @default false
89
+ */
46
90
  containsDangerousHtml?: boolean;
91
+ /**
92
+ * With this prop enabled, text won't wrap to the next line but instead
93
+ * will be truncated with an ellipsis.
94
+ *
95
+ * @default false
96
+ */
47
97
  truncate?: boolean;
48
98
  /**
49
- * When `true` will work together with the `truncate` props
99
+ * When `true` will work together with the `truncate` prop
50
100
  * and allow a max of two lines when breaking text before applying
51
- * elipsis. Defaults to "`false`"
101
+ * ellipsis.
102
+ *
103
+ * @default false
52
104
  */
53
105
  clampLines?: boolean;
54
106
  "data-test-id"?: string;
@@ -56,11 +108,8 @@ export interface TextProps extends RestPropped {
56
108
  export declare const Text: {
57
109
  (props: TextProps): JSX.Element;
58
110
  defaultProps: {
59
- type: string;
60
- inline: boolean;
61
- color: string;
62
- containsDangerousHtml: boolean;
63
- truncate: boolean;
111
+ variant: "base";
112
+ color: "base";
64
113
  };
65
114
  };
66
115
  export default Text;