@drivy/cobalt 0.51.0 → 1.0.0-beta.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 (66) hide show
  1. package/cjs/tokens/zIndexes.js +2 -1
  2. package/cjs/tokens/zIndexes.js.map +1 -1
  3. package/components/Accordion/index.js +16 -32
  4. package/components/Accordion/index.js.map +1 -1
  5. package/components/Alerter/index.js +45 -77
  6. package/components/Alerter/index.js.map +1 -1
  7. package/components/ContainedIcon/index.js.map +1 -1
  8. package/components/Form/Autocomplete/index.js +176 -155
  9. package/components/Form/Autocomplete/index.js.map +1 -1
  10. package/components/Form/Slider.js +40 -19
  11. package/components/Form/Slider.js.map +1 -1
  12. package/components/Form/field.js +9 -1
  13. package/components/Form/field.js.map +1 -1
  14. package/components/Modal/ModalHeader.js +10 -7
  15. package/components/Modal/ModalHeader.js.map +1 -1
  16. package/components/Modal/index.js +33 -97
  17. package/components/Modal/index.js.map +1 -1
  18. package/components/PhotoDropzone/index.js +2 -5
  19. package/components/PhotoDropzone/index.js.map +1 -1
  20. package/components/Tabs/index.js +19 -118
  21. package/components/Tabs/index.js.map +1 -1
  22. package/index.js +3 -3
  23. package/package.json +5 -12
  24. package/src/tokens/zIndexes.js +2 -1
  25. package/src/tokens/zIndexes.js.map +1 -1
  26. package/styles/components/Accordion/index.scss +40 -19
  27. package/styles/components/Alerter/index.scss +42 -42
  28. package/styles/components/ContainedIcon/index.scss +64 -8
  29. package/styles/components/Form/Autocomplete/index.scss +52 -74
  30. package/styles/components/Form/RadioWithDetails.scss +2 -12
  31. package/styles/components/Form/Slider.scss +46 -55
  32. package/styles/components/Form/TextInput.scss +4 -0
  33. package/styles/components/Form/field.scss +2 -2
  34. package/styles/components/Modal/index.scss +82 -63
  35. package/styles/components/PhotoDropzone/index.scss +4 -0
  36. package/styles/components/Tabs/index.scss +18 -120
  37. package/styles/core/z-index.scss +1 -0
  38. package/tokens/zIndexes.js +2 -1
  39. package/tokens/zIndexes.js.map +1 -1
  40. package/types/src/components/Accordion/index.d.ts +15 -66
  41. package/types/src/components/Alerter/index.d.ts +8 -19
  42. package/types/src/components/ContainedIcon/index.d.ts +1 -1
  43. package/types/src/components/Form/Autocomplete/index.d.ts +38 -37
  44. package/types/src/components/Form/Slider.d.ts +12 -77
  45. package/types/src/components/Form/field.d.ts +16 -1
  46. package/types/src/components/Modal/ModalHeader.d.ts +1 -1
  47. package/types/src/components/Modal/index.d.ts +2 -2
  48. package/types/src/components/Tabs/index.d.ts +9 -6
  49. package/types/src/index.d.ts +1 -1
  50. package/types/src/tokens/index.d.ts +1 -0
  51. package/utilities.css +59 -0
  52. package/utils/getCobaltTailwindcssConfig.js.map +1 -1
  53. package/components/Alerter/Alert.js +0 -47
  54. package/components/Alerter/Alert.js.map +0 -1
  55. package/components/Modal/ModalBody.js +0 -11
  56. package/components/Modal/ModalBody.js.map +0 -1
  57. package/components/utils/Timer.js +0 -24
  58. package/components/utils/Timer.js.map +0 -1
  59. package/components/utils/dom.js +0 -8
  60. package/components/utils/dom.js.map +0 -1
  61. package/components/utils/px.js +0 -5
  62. package/components/utils/px.js.map +0 -1
  63. package/hooks/useElementHeight.js +0 -34
  64. package/hooks/useElementHeight.js.map +0 -1
  65. package/types/src/components/Alerter/Alert.d.ts +0 -9
  66. package/types/src/components/Modal/ModalBody.d.ts +0 -8
@@ -1,22 +1,11 @@
1
- import React from "react";
2
- import { AlertType } from "./Alert";
3
- export { type AlertStatus } from "./Alert";
4
- type AlertPropsType = Parameters<AlertType>[0];
5
- export type AlertReducerActionData = {
6
- id: string;
7
- status: AlertPropsType["status"];
8
- message: AlertPropsType["children"];
9
- dismiss?: AlertPropsType["dismiss"];
10
- };
11
- type SendAlertParameters = Omit<AlertReducerActionData, "dismiss" | "id">;
12
- type AlertsQueue = (Omit<AlertReducerActionData, "dismiss"> & {
13
- dismiss: NonNullable<AlertReducerActionData["dismiss"]>;
14
- })[];
1
+ import React, { type PropsWithChildren } from "react";
2
+ export type AlertStatus = "info" | "success" | "error";
15
3
  export declare const useAlerts: () => {
16
- queue: AlertsQueue;
17
- sendAlert: React.Dispatch<SendAlertParameters>;
4
+ sendAlert: ({ message, status, duration, }: {
5
+ message: React.ReactNode;
6
+ status: AlertStatus;
7
+ duration?: number;
8
+ }) => string | undefined;
18
9
  };
19
- declare const Alerter: (props: {
20
- children: React.ReactNode;
21
- }) => React.JSX.Element;
10
+ declare const Alerter: ({ children }: PropsWithChildren) => React.JSX.Element;
22
11
  export default Alerter;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { IconColorsType } from "../Icon";
3
3
  type Extends<T, U extends T> = U;
4
- type ContainedIconColorType = Extends<IconColorsType, "base" | "accent" | "disabled" | "error" | "info" | "success" | "connect">;
4
+ type ContainedIconColorType = Extends<IconColorsType, "base" | "accent" | "disabled" | "error" | "info" | "success" | "connect" | "keyExchange" | "rideshare" | "accentAlt" | "disabledAlt" | "errorAlt" | "infoAlt" | "successAlt" | "connectAlt"> | "baseAlt";
5
5
  export type ContainedIconPropsType = {
6
6
  icon: React.JSX.Element;
7
7
  color?: ContainedIconColorType;
@@ -1,51 +1,52 @@
1
1
  import React from "react";
2
2
  import { IconSources } from "../../Icon";
3
3
  import { FormElement } from "../form";
4
- export interface AutocompleteItem {
4
+ export type AutocompleteItemInput = string | {
5
5
  [x: string]: any;
6
- }
7
- type Props = {
8
6
  icon?: IconSources;
9
- items: (AutocompleteItem | string)[];
10
- minQueryLength?: number;
11
- autoFilter?: boolean;
12
- selectedItem?: AutocompleteItem;
13
- focusOnInit?: boolean;
14
- autocomplete?: boolean;
15
- valueKey?: string;
16
- inputRef?: React.RefObject<HTMLInputElement>;
17
- autocompleteRef?: React.RefObject<HTMLDivElement>;
18
- onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;
19
- onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
20
- onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
21
- onQueryChange?: (term: string) => void;
22
- onSelectItem?: (item: AutocompleteItem, term: string) => boolean;
23
- renderItem?: (item: AutocompleteItem, term: string) => React.ReactNode;
24
- } & FormElement & React.InputHTMLAttributes<HTMLInputElement>;
25
- declare const wrappedComponent: React.ComponentClass<{
26
- icon?: "map" | "search" | "video" | "filter" | "accountDetails" | "addPicture" | "airConditioning" | "airport" | "android" | "antique" | "arrowLeftCircleFilled" | "arrowLeft" | "arrowRightCircleFilled" | "arrowRightCircle" | "arrowRight" | "audioInput" | "babySeat" | "bank" | "battery" | "bell" | "bikeRack" | "bin" | "bluetooth" | "briefcase" | "bulb" | "cable" | "cabriolet" | "calendarCheck" | "calendarClock" | "calendarEnd" | "calendarStart" | "calendar" | "cameraAdd" | "camera" | "campervan" | "carAdd" | "carCheck" | "carDamages" | "carDrivyOpen" | "carGroup" | "carLock" | "carPlay" | "carReturn" | "carSearch" | "carTypeAntique" | "carTypeCabriolet" | "carTypeCampervan" | "carTypeCity" | "carTypeConvertible" | "carTypeCoupe" | "carTypeFamily" | "carTypeFourFour" | "carTypeMinibus" | "carTypeSedan" | "carTypeUtility" | "car" | "card" | "cdPlayer" | "certificate" | "chains" | "checkCircleFilled" | "checkCircle" | "check" | "checklist" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "circledArrowLeft" | "circledArrowRight" | "city" | "cleaning" | "clockAlert" | "clockBackwards" | "clockForwards" | "clock" | "closeCircleFilled" | "close" | "collapse" | "connectCar" | "contactMail" | "contactPhone" | "contextualPaperclip" | "contextualQuestion" | "contextualWarningCircleFilled" | "contextualWarningCircle" | "contract" | "convertible" | "copy" | "coupe" | "creditCardAdd" | "creditCardError" | "creditCard" | "cruiseControl" | "dashcam" | "directions" | "document" | "dotHorizontal" | "dotVertical" | "dotsHorizontal" | "dotsVertical" | "download" | "earning" | "earth" | "edit" | "electric" | "evBattery" | "evCable" | "evCharger" | "expand" | "externalLink" | "eyeClosed" | "eyeOpened" | "eye" | "faceRecognition" | "facebook" | "family" | "fileFilled" | "filepdf" | "filexls" | "filters" | "flag" | "fourByFour" | "fourWheelDrive" | "fuelTank" | "geolocation" | "gift" | "gps" | "graphUp" | "healing" | "heart" | "hitch" | "home" | "idCard" | "incident" | "infoCircleFilled" | "infoCircle" | "infoFilled" | "info" | "instant" | "invoice" | "keyConnect" | "key" | "licenceCheck" | "licencePaper" | "licence" | "lifeBuoy" | "linkedin" | "loading" | "locality" | "locationMap" | "locationParking" | "locationPin" | "location" | "lockCheck" | "locked" | "login" | "logout" | "mailCheck" | "mail" | "mapAlt" | "meetDriver" | "meetOwner" | "menuList" | "messages" | "mileage" | "minibus" | "minusCircleFilled" | "minus" | "miscGift" | "nearbyDevice" | "notification" | "number1Circle" | "number2Circle" | "number3Circle" | "number4Circle" | "number5Circle" | "okHand" | "optionAirConditioning" | "optionAndroidAuto" | "optionAppleCarplay" | "optionAudioInput" | "optionBabySeat" | "optionBikeRack" | "optionBluetoothAudio" | "optionCdPlayer" | "optionChains" | "optionCruiseControl" | "optionDashcam" | "optionGps" | "optionHasTrailer" | "optionHitch" | "optionRoofBox" | "optionSkiRack" | "optionSnowTire" | "optionWheelchairAccessible" | "paperclip" | "parking" | "passport" | "payments" | "pencil" | "peopleUser" | "percentage" | "performance" | "phoneLink" | "phone" | "photos" | "pickupTruck" | "pig" | "pin" | "plug" | "plusCircleFilled" | "plus" | "position" | "pricingFlat" | "pricingVariable" | "profilePicture" | "questionCircleFilled" | "questionCircle" | "question" | "raceFlag" | "recenter" | "refresh" | "reorder" | "replacementCar" | "reply" | "reset" | "ride" | "roofBox" | "rotate" | "sealCheck" | "searchCar" | "searchPeople" | "sedan" | "serviceBattery" | "serviceCleaning" | "serviceFuel" | "serviceHealing" | "serviceLocked" | "serviceTolls" | "serviceUnlocked" | "settings" | "shareAndroid" | "shareIos" | "share" | "shieldCheck" | "shield" | "shop" | "skiRack" | "slider" | "smartphone" | "snowTire" | "socialFacebook" | "socialLinkedin" | "socialTwitter" | "socialWhatsapp" | "starHalf" | "star" | "stars" | "subway" | "suitcase" | "support" | "suv" | "synch" | "tag" | "timeAlert" | "timeBackwards" | "timeCalendar" | "timeForward" | "tolls" | "trailer" | "train" | "triangleDown" | "triangleRight" | "triangleUp" | "twitter" | "twoPeople" | "uber" | "unfold" | "unlocked" | "userCheck" | "userQuestion" | "userShield" | "userSwitch" | "user" | "utilityVanLarge" | "utilityVanMedium" | "utilityVanSmall" | "verifiedSeal" | "walk" | "wallet" | "warningCircleFilled" | "warningCircle" | "warning" | "whatsapp" | "wheel" | "wheelchair" | "wrench" | "yingyang" | undefined;
27
- items: (AutocompleteItem | string)[];
7
+ label?: string;
8
+ value: string;
9
+ disabled?: boolean;
10
+ };
11
+ export type AutocompleteItem = {
12
+ [x: string]: any;
13
+ icon?: IconSources;
14
+ label: string;
15
+ value: string;
16
+ disabled?: boolean;
17
+ };
18
+ export type AutocompleteRefType = {
19
+ query: string;
20
+ input: HTMLInputElement;
21
+ open: () => void;
22
+ focus: () => void;
23
+ clearValue: () => void;
24
+ setSelectedItem: (item: AutocompleteItemInput) => void;
25
+ };
26
+ type AutocompleteMatchHighlightPropsType = {
27
+ label: string;
28
+ query: string;
29
+ matchClassName?: string;
30
+ };
31
+ export declare const AutocompleteMatchHighlight: ({ label, query, matchClassName, }: AutocompleteMatchHighlightPropsType) => string | React.JSX.Element;
32
+ declare const Autocomplete: React.ForwardRefExoticComponent<{
33
+ className?: string | undefined;
34
+ label?: string | undefined;
35
+ hint?: string | undefined;
36
+ fullWidth?: boolean | undefined;
37
+ icon?: "accountDetails" | "addPicture" | "airConditioning" | "airport" | "android" | "antique" | "arrowLeftCircleFilled" | "arrowLeft" | "arrowRightCircleFilled" | "arrowRightCircle" | "arrowRight" | "audioInput" | "babySeat" | "bank" | "battery" | "bell" | "bikeRack" | "bin" | "bluetooth" | "briefcase" | "bulb" | "cable" | "cabriolet" | "calendarCheck" | "calendarClock" | "calendarEnd" | "calendarStart" | "calendar" | "cameraAdd" | "camera" | "campervan" | "carAdd" | "carCheck" | "carDamages" | "carDrivyOpen" | "carGroup" | "carLock" | "carPlay" | "carReturn" | "carSearch" | "carTypeAntique" | "carTypeCabriolet" | "carTypeCampervan" | "carTypeCity" | "carTypeConvertible" | "carTypeCoupe" | "carTypeFamily" | "carTypeFourFour" | "carTypeMinibus" | "carTypeSedan" | "carTypeUtility" | "car" | "card" | "cdPlayer" | "certificate" | "chains" | "checkCircleFilled" | "checkCircle" | "check" | "checklist" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "circledArrowLeft" | "circledArrowRight" | "city" | "cleaning" | "clockAlert" | "clockBackwards" | "clockForwards" | "clock" | "closeCircleFilled" | "close" | "collapse" | "connectCar" | "contactMail" | "contactPhone" | "contextualPaperclip" | "contextualQuestion" | "contextualWarningCircleFilled" | "contextualWarningCircle" | "contract" | "convertible" | "copy" | "coupe" | "creditCardAdd" | "creditCardError" | "creditCard" | "cruiseControl" | "dashcam" | "directions" | "document" | "dotHorizontal" | "dotVertical" | "dotsHorizontal" | "dotsVertical" | "download" | "earning" | "earth" | "edit" | "electric" | "evBattery" | "evCable" | "evCharger" | "expand" | "externalLink" | "eyeClosed" | "eyeOpened" | "eye" | "faceRecognition" | "facebook" | "family" | "fileFilled" | "filepdf" | "filexls" | "filter" | "filters" | "flag" | "fourByFour" | "fourWheelDrive" | "fuelTank" | "geolocation" | "gift" | "gps" | "graphUp" | "healing" | "heart" | "hitch" | "home" | "idCard" | "incident" | "infoCircleFilled" | "infoCircle" | "infoFilled" | "info" | "instant" | "invoice" | "keyConnect" | "key" | "licenceCheck" | "licencePaper" | "licence" | "lifeBuoy" | "linkedin" | "loading" | "locality" | "locationMap" | "locationParking" | "locationPin" | "location" | "lockCheck" | "locked" | "login" | "logout" | "mailCheck" | "mail" | "mapAlt" | "map" | "meetDriver" | "meetOwner" | "menuList" | "messages" | "mileage" | "minibus" | "minusCircleFilled" | "minus" | "miscGift" | "nearbyDevice" | "notification" | "number1Circle" | "number2Circle" | "number3Circle" | "number4Circle" | "number5Circle" | "okHand" | "optionAirConditioning" | "optionAndroidAuto" | "optionAppleCarplay" | "optionAudioInput" | "optionBabySeat" | "optionBikeRack" | "optionBluetoothAudio" | "optionCdPlayer" | "optionChains" | "optionCruiseControl" | "optionDashcam" | "optionGps" | "optionHasTrailer" | "optionHitch" | "optionRoofBox" | "optionSkiRack" | "optionSnowTire" | "optionWheelchairAccessible" | "paperclip" | "parking" | "passport" | "payments" | "pencil" | "peopleUser" | "percentage" | "performance" | "phoneLink" | "phone" | "photos" | "pickupTruck" | "pig" | "pin" | "plug" | "plusCircleFilled" | "plus" | "position" | "pricingFlat" | "pricingVariable" | "profilePicture" | "questionCircleFilled" | "questionCircle" | "question" | "raceFlag" | "recenter" | "refresh" | "reorder" | "replacementCar" | "reply" | "reset" | "ride" | "roofBox" | "rotate" | "sealCheck" | "searchCar" | "searchPeople" | "search" | "sedan" | "serviceBattery" | "serviceCleaning" | "serviceFuel" | "serviceHealing" | "serviceLocked" | "serviceTolls" | "serviceUnlocked" | "settings" | "shareAndroid" | "shareIos" | "share" | "shieldCheck" | "shield" | "shop" | "skiRack" | "slider" | "smartphone" | "snowTire" | "socialFacebook" | "socialLinkedin" | "socialTwitter" | "socialWhatsapp" | "starHalf" | "star" | "stars" | "subway" | "suitcase" | "support" | "suv" | "synch" | "tag" | "timeAlert" | "timeBackwards" | "timeCalendar" | "timeForward" | "tolls" | "trailer" | "train" | "triangleDown" | "triangleRight" | "triangleUp" | "twitter" | "twoPeople" | "uber" | "unfold" | "unlocked" | "userCheck" | "userQuestion" | "userShield" | "userSwitch" | "user" | "utilityVanLarge" | "utilityVanMedium" | "utilityVanSmall" | "verifiedSeal" | "video" | "walk" | "wallet" | "warningCircleFilled" | "warningCircle" | "warning" | "whatsapp" | "wheel" | "wheelchair" | "wrench" | "yingyang" | undefined;
38
+ items: AutocompleteItemInput[];
39
+ popoverClassName?: string | undefined;
28
40
  minQueryLength?: number | undefined;
29
41
  autoFilter?: boolean | undefined;
30
- selectedItem?: AutocompleteItem | undefined;
31
42
  focusOnInit?: boolean | undefined;
32
43
  autocomplete?: boolean | undefined;
33
- valueKey?: string | undefined;
34
- inputRef?: React.RefObject<HTMLInputElement> | undefined;
35
44
  autocompleteRef?: React.RefObject<HTMLDivElement> | undefined;
45
+ onClearValue?: (() => void) | undefined;
36
46
  onKeyDown?: ((event: React.KeyboardEvent<HTMLElement>) => void) | undefined;
37
- onBlur?: ((event: React.FocusEvent<HTMLInputElement>) => void) | undefined;
38
- onFocus?: ((event: React.FocusEvent<HTMLInputElement>) => void) | undefined;
39
47
  onQueryChange?: ((term: string) => void) | undefined;
40
48
  onSelectItem?: ((item: AutocompleteItem, term: string) => boolean) | undefined;
41
49
  renderItem?: ((item: AutocompleteItem, term: string) => React.ReactNode) | undefined;
42
- } & FormElement & React.InputHTMLAttributes<HTMLInputElement> & {
43
- id?: string | undefined;
44
- label?: string | undefined;
45
- hint?: string | undefined;
46
- fieldClassName?: string | undefined;
47
- fullWidth?: boolean | undefined;
48
- }, any> & {
49
- Raw: React.ComponentType<Props>;
50
- };
51
- export { wrappedComponent as Autocomplete };
50
+ allowCustomValue?: boolean | undefined;
51
+ } & FormElement & Omit<React.InputHTMLAttributes<HTMLInputElement>, "id"> & React.RefAttributes<unknown>>;
52
+ export { Autocomplete };
@@ -1,22 +1,13 @@
1
- import React from "react";
2
- import { FormElement } from "./form";
3
- import { SliderProps as ReachSliderProps } from "@reach/slider";
4
- type NativeEventType = "onPointerDown" | "onPointerUp" | "onMouseDown" | "onMouseMove" | "onMouseUp" | "onTouchStart" | "onTouchMove" | "onTouchEnd";
5
- export type SliderPropsType = {
1
+ import React, { PropsWithChildren } from "react";
2
+ import { SliderRootProps } from "@ark-ui/react";
3
+ import { FieldWrapperProps } from "./field";
4
+ export type SliderPropsType<T extends number | number[]> = {
6
5
  /**
7
6
  * mandatory for A11y
8
7
  */
8
+ value?: T;
9
+ defaultValue?: T;
9
10
  ariaLabel: string;
10
- value?: number;
11
- defaultValue?: number;
12
- /**
13
- * minimum selectable value (default is 0)
14
- */
15
- min?: number;
16
- /**
17
- * maximum selectable value (default is 100)
18
- */
19
- max?: number;
20
11
  /**
21
12
  * values interval
22
13
  */
@@ -25,69 +16,13 @@ export type SliderPropsType = {
25
16
  /**
26
17
  * Listener called when the value is changed
27
18
  */
28
- onChange?: (newValue: number) => void;
19
+ onValueChange?: (newValue: T) => void;
29
20
  /**
30
21
  * Function used to visually display the slider value
31
22
  */
32
- renderValue?: (value: number, status: FormElement["status"]) => React.ReactElement;
33
- onPointerDown?: ReachSliderProps["onPointerDown"];
34
- onPointerUp?: ReachSliderProps["onPointerUp"];
35
- onMouseDown?: ReachSliderProps["onMouseDown"];
36
- onMouseMove?: ReachSliderProps["onMouseMove"];
37
- onMouseUp?: ReachSliderProps["onMouseUp"];
38
- onTouchStart?: ReachSliderProps["onTouchStart"];
39
- onTouchMove?: ReachSliderProps["onTouchMove"];
40
- onTouchEnd?: ReachSliderProps["onTouchEnd"];
23
+ renderValue?: (value: T, status: FieldWrapperProps["status"]) => React.ReactElement;
41
24
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
42
- } & FormElement & Omit<React.InputHTMLAttributes<HTMLInputElement>, NativeEventType | "css" | "enterKeyHint" | "onChange">;
43
- declare const wrappedComponent: React.ComponentClass<{
44
- /**
45
- * mandatory for A11y
46
- */
47
- ariaLabel: string;
48
- value?: number | undefined;
49
- defaultValue?: number | undefined;
50
- /**
51
- * minimum selectable value (default is 0)
52
- */
53
- min?: number | undefined;
54
- /**
55
- * maximum selectable value (default is 100)
56
- */
57
- max?: number | undefined;
58
- /**
59
- * values interval
60
- */
61
- step?: number | undefined;
62
- disabled?: boolean | undefined;
63
- /**
64
- * Listener called when the value is changed
65
- */
66
- onChange?: ((newValue: number) => void) | undefined;
67
- /**
68
- * Function used to visually display the slider value
69
- */
70
- renderValue?: ((value: number, status: FormElement["status"]) => React.ReactElement) | undefined;
71
- onPointerDown?: ReachSliderProps["onPointerDown"];
72
- onPointerUp?: ReachSliderProps["onPointerUp"];
73
- onMouseDown?: ReachSliderProps["onMouseDown"];
74
- onMouseMove?: ReachSliderProps["onMouseMove"];
75
- onMouseUp?: ReachSliderProps["onMouseUp"];
76
- onTouchStart?: ReachSliderProps["onTouchStart"];
77
- onTouchMove?: ReachSliderProps["onTouchMove"];
78
- onTouchEnd?: ReachSliderProps["onTouchEnd"];
79
- onFocus?: ((event: React.FocusEvent<HTMLInputElement>) => void) | undefined;
80
- } & FormElement & Omit<React.InputHTMLAttributes<HTMLInputElement>, NativeEventType | "css" | "enterKeyHint" | "onChange"> & {
81
- id?: string | undefined;
82
- label?: string | undefined;
83
- hint?: string | undefined;
84
- fieldClassName?: string | undefined;
85
- fullWidth?: boolean | undefined;
86
- }, any> & {
87
- Raw: React.ComponentType<SliderPropsType>;
88
- };
89
- export default wrappedComponent;
90
- type SliderValueMetaProps = {
91
- children: React.ReactNode;
92
- };
93
- export declare const SliderValueMeta: ({ children }: SliderValueMetaProps) => React.JSX.Element;
25
+ } & FieldWrapperProps & Omit<SliderRootProps, "value" | "defaultValue" | "onValueChange">;
26
+ declare const Slider: <T extends number | number[]>({ defaultValue: _defaultValue, value: _value, min, max, disabled, onValueChange, renderValue, ariaLabel, hint, label, status, ...restProps }: SliderPropsType<T>) => React.JSX.Element;
27
+ export default Slider;
28
+ export declare const SliderValueMeta: ({ children }: PropsWithChildren) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { FormElement } from "./form";
3
3
  type InjectedProps = {
4
4
  id?: string;
@@ -10,4 +10,19 @@ type InjectedProps = {
10
10
  export declare const withFieldLabelAndHint: <OriginalProps>(WrappedComponent: React.ComponentType<OriginalProps>) => React.ComponentClass<OriginalProps & InjectedProps> & {
11
11
  Raw: React.ComponentType<OriginalProps>;
12
12
  };
13
+ export type FieldWrapperProps = {
14
+ label?: string;
15
+ hint?: string;
16
+ fullWidth?: boolean;
17
+ status?: FormElement["status"];
18
+ };
19
+ export declare const FieldWrapper: {
20
+ ({ label, hint, fullWidth, status, children, }: PropsWithChildren<{
21
+ label?: string;
22
+ fullWidth?: boolean;
23
+ status?: FormElement["status"];
24
+ hint?: string;
25
+ }>): React.JSX.Element;
26
+ labelClassName: string;
27
+ };
13
28
  export {};
@@ -2,5 +2,5 @@ import React from "react";
2
2
  declare const ModalHeader: ({ title, close, }: {
3
3
  title?: string;
4
4
  close?: () => void;
5
- }) => React.JSX.Element;
5
+ }) => React.JSX.Element | null;
6
6
  export default ModalHeader;
@@ -67,7 +67,7 @@ export type ModalPropsType = {
67
67
  };
68
68
  export declare const ModalFooterAPI: (_props: ModalFooterPropsType) => null;
69
69
  export declare const isModalFooterAPIComponent: (component: React.ReactNode) => component is React.ReactElement<ModalFooterPropsType, string | React.JSXElementConstructor<any>>;
70
- declare const Modal: React.ForwardRefExoticComponent<ModalPropsType & React.RefAttributes<HTMLDivElement>> & {
70
+ declare const _default: React.ForwardRefExoticComponent<ModalPropsType & React.RefAttributes<HTMLDivElement>> & {
71
71
  Footer: (_props: ModalFooterPropsType) => null;
72
72
  };
73
- export default Modal;
73
+ export default _default;
@@ -4,11 +4,11 @@ export type TabsPropsType = {
4
4
  /**
5
5
  * Index of the initial actived tab (first tab by default)
6
6
  */
7
- defaultTabIndex?: number;
7
+ defaultTabId?: string;
8
8
  /**
9
9
  * Method to be run on tab change
10
10
  */
11
- onChange?: (index: number) => void;
11
+ onChange?: (id: string) => void;
12
12
  /**
13
13
  * Left aligned tabs with no uppercased labels
14
14
  */
@@ -16,10 +16,14 @@ export type TabsPropsType = {
16
16
  };
17
17
  type TabPropsType = {
18
18
  children?: React.ReactNode;
19
+ /**
20
+ * Unique id of the tab
21
+ */
22
+ id: string;
19
23
  /**
20
24
  * Label/title of the tab
21
25
  */
22
- label: string | React.ReactNode | ((isSelected?: boolean) => React.ReactNode);
26
+ label: string | React.ReactNode;
23
27
  /**
24
28
  * Hypertext link. If provided, the tab will be an anchor
25
29
  */
@@ -29,12 +33,11 @@ export declare const Tab: {
29
33
  (_props: TabPropsType): null;
30
34
  displayName: string;
31
35
  };
32
- export declare const Tabs: {
33
- ({ children, defaultTabIndex, onChange, subLevel, }: TabsPropsType): React.JSX.Element;
36
+ declare const Tabs: {
37
+ ({ defaultTabId, subLevel, children, onChange, }: TabsPropsType): React.JSX.Element;
34
38
  Tab: {
35
39
  (_props: TabPropsType): null;
36
40
  displayName: string;
37
41
  };
38
- displayName: string;
39
42
  };
40
43
  export default Tabs;
@@ -28,7 +28,7 @@ export { ProgressBar } from "./components/ProgressBar";
28
28
  export { ProgressCircular } from "./components/ProgressCircular";
29
29
  export { ProgressBanner } from "./components/ProgressBanner";
30
30
  export { Sidepanel } from "./components/Sidepanel";
31
- export { Tabs, Tab } from "./components/Tabs";
31
+ export { default as Tabs, Tab } from "./components/Tabs";
32
32
  export { Tag } from "./components/Tag";
33
33
  export { Chip } from "./components/Chip";
34
34
  export { Autocomplete, AutocompleteItem } from "./components/Form/Autocomplete";
@@ -380,6 +380,7 @@ export declare const zIndexes: {
380
380
  "alert-below": number;
381
381
  alert: number;
382
382
  "alert-above": number;
383
+ "autocomplete-popover": number;
383
384
  };
384
385
  export declare const palette: {
385
386
  white: string;
package/utilities.css CHANGED
@@ -3,3 +3,62 @@
3
3
 
4
4
  @tailwind base;
5
5
  @tailwind utilities;
6
+
7
+ @layer base {
8
+ @keyframes c-fade-in {
9
+ from {
10
+ opacity: 0;
11
+ }
12
+ to {
13
+ opacity: 1;
14
+ }
15
+ }
16
+ @keyframes c-fade-out {
17
+ from {
18
+ opacity: 1;
19
+ }
20
+ to {
21
+ opacity: 0;
22
+ }
23
+ }
24
+ @keyframes c-slide-in {
25
+ 0% {
26
+ opacity: 0;
27
+ transform: translateY(-32px);
28
+ }
29
+ 100% {
30
+ opacity: 1;
31
+ transform: translateY(0);
32
+ }
33
+ }
34
+ @keyframes c-slide-out {
35
+ 0% {
36
+ opacity: 1;
37
+ transform: translateY(0);
38
+ }
39
+ 100% {
40
+ opacity: 0;
41
+ transform: translateY(-32px);
42
+ }
43
+ }
44
+ @keyframes c-slide-in-from-bottom {
45
+ 0% {
46
+ opacity: 0;
47
+ transform: translateY(100%);
48
+ }
49
+ 100% {
50
+ opacity: 1;
51
+ transform: translateY(0);
52
+ }
53
+ }
54
+ @keyframes c-slide-out-to-bottom {
55
+ 0% {
56
+ opacity: 1;
57
+ transform: translateY(0);
58
+ }
59
+ 100% {
60
+ opacity: 0;
61
+ transform: translateY(100%);
62
+ }
63
+ }
64
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getCobaltTailwindcssConfig.js","sources":["../../utils/getCobaltTailwindcssConfig.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireGetCobaltTailwindcssConfig } from \"/Users/thibaudesnouf/sources/cobalt/utils/getCobaltTailwindcssConfig.js\";\nvar getCobaltTailwindcssConfigExports = requireGetCobaltTailwindcssConfig();\nexport { getCobaltTailwindcssConfigExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(getCobaltTailwindcssConfigExports);"],"names":[],"mappings":";;;AAEA,IAAI,iCAAiC,GAAG,iCAAiC,EAAE,CAAC;AAE5E,iCAAe,aAAa,uBAAuB,CAAC,iCAAiC,CAAC;;;;"}
1
+ {"version":3,"file":"getCobaltTailwindcssConfig.js","sources":["../../utils/getCobaltTailwindcssConfig.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireGetCobaltTailwindcssConfig } from \"/Users/cedric/Dev/drivy/cobalt/utils/getCobaltTailwindcssConfig.js\";\nvar getCobaltTailwindcssConfigExports = requireGetCobaltTailwindcssConfig();\nexport { getCobaltTailwindcssConfigExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(getCobaltTailwindcssConfigExports);"],"names":[],"mappings":";;;AAEA,IAAI,iCAAiC,GAAG,iCAAiC,EAAE,CAAC;AAE5E,iCAAe,aAAa,uBAAuB,CAAC,iCAAiC,CAAC;;;;"}
@@ -1,47 +0,0 @@
1
- import React, { useMemo, useEffect } from 'react';
2
- import ReachAlert from '@reach/alert';
3
- import cx from 'classnames';
4
- import { Icon } from '../Icon/index.js';
5
- import 'lodash.throttle';
6
- import Timer from '../utils/Timer.js';
7
-
8
- const ALERT_TIMEOUT = 3000;
9
- const STATUS_ICONS_MAP = {
10
- info: "infoFilled",
11
- success: "checkCircle",
12
- error: "contextualWarningCircleFilled",
13
- };
14
- const STATUS_ICON_COLOR_MAP = {
15
- info: "infoAlt",
16
- success: "success",
17
- error: "error",
18
- };
19
- const STATUS_ICON_CLASS_MAP = {
20
- info: "cobalt-alert--info",
21
- success: "cobalt-alert--success",
22
- error: "cobalt-alert--error",
23
- };
24
- const Alert = ({ children, status = "info", dismiss }) => {
25
- const icon = STATUS_ICONS_MAP[status]
26
- ? STATUS_ICONS_MAP[status]
27
- : "infoFilled";
28
- const iconColor = STATUS_ICON_COLOR_MAP[status]
29
- ? STATUS_ICON_COLOR_MAP[status]
30
- : "infoAlt";
31
- const className = STATUS_ICON_CLASS_MAP[status]
32
- ? STATUS_ICON_CLASS_MAP[status]
33
- : "cobalt-alert--info";
34
- const alertTimer = useMemo(() => new Timer(dismiss, ALERT_TIMEOUT), []);
35
- useEffect(() => {
36
- alertTimer.run();
37
- }, []);
38
- const onMouseEnter = () => alertTimer.pause();
39
- const onMouseLeave = () => alertTimer.run();
40
- return (React.createElement(ReachAlert, { className: cx("cobalt-alert", className), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
41
- React.createElement("div", { className: "cobalt-alert__wrapper" },
42
- React.createElement(Icon, { source: icon, size: 20, color: iconColor, className: "cobalt-alert__icon" }),
43
- React.createElement("span", { className: "cobalt-alert__content" }, children))));
44
- };
45
-
46
- export { Alert as default };
47
- //# sourceMappingURL=Alert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../src/components/Alerter/Alert.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\"\nimport ReachAlert from \"@reach/alert\"\nimport cx from \"classnames\"\n\nimport { Icon, IconColorsType, IconSources } from \"../Icon\"\nimport { Timer } from \"../utils\"\n\nexport type AlertStatus = \"info\" | \"success\" | \"error\"\n\nexport type AlertType = (props: {\n children?: React.ReactNode\n status?: AlertStatus\n dismiss: () => void\n}) => React.ReactElement\n\nconst ALERT_TIMEOUT = 3000\n\nconst STATUS_ICONS_MAP: { [k in AlertStatus]: IconSources } = {\n info: \"infoFilled\",\n success: \"checkCircle\",\n error: \"contextualWarningCircleFilled\",\n}\n\nconst STATUS_ICON_COLOR_MAP: { [k in AlertStatus]: IconColorsType } = {\n info: \"infoAlt\",\n success: \"success\",\n error: \"error\",\n}\n\nconst STATUS_ICON_CLASS_MAP: { [k in AlertStatus]: string } = {\n info: \"cobalt-alert--info\",\n success: \"cobalt-alert--success\",\n error: \"cobalt-alert--error\",\n}\n\nconst Alert: AlertType = ({ children, status = \"info\", dismiss }) => {\n const icon = STATUS_ICONS_MAP[status]\n ? STATUS_ICONS_MAP[status]\n : \"infoFilled\"\n\n const iconColor: IconColorsType = STATUS_ICON_COLOR_MAP[status]\n ? STATUS_ICON_COLOR_MAP[status]\n : \"infoAlt\"\n\n const className = STATUS_ICON_CLASS_MAP[status]\n ? STATUS_ICON_CLASS_MAP[status]\n : \"cobalt-alert--info\"\n\n const alertTimer = useMemo(() => new Timer(dismiss, ALERT_TIMEOUT), [])\n\n useEffect(() => {\n alertTimer.run()\n }, [])\n\n const onMouseEnter = () => alertTimer.pause()\n const onMouseLeave = () => alertTimer.run()\n\n return (\n <ReachAlert\n className={cx(\"cobalt-alert\", className)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n <div className=\"cobalt-alert__wrapper\">\n <Icon\n source={icon}\n size={20}\n color={iconColor}\n className=\"cobalt-alert__icon\"\n />\n <span className=\"cobalt-alert__content\">{children}</span>\n </div>\n </ReachAlert>\n )\n}\n\nexport default Alert\n"],"names":[],"mappings":";;;;;;;AAeA,MAAM,aAAa,GAAG,IAAI,CAAA;AAE1B,MAAM,gBAAgB,GAAwC;AAC5D,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,OAAO,EAAE,aAAa;AACtB,IAAA,KAAK,EAAE,+BAA+B;CACvC,CAAA;AAED,MAAM,qBAAqB,GAA2C;AACpE,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,KAAK,EAAE,OAAO;CACf,CAAA;AAED,MAAM,qBAAqB,GAAmC;AAC5D,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,OAAO,EAAE,uBAAuB;AAChC,IAAA,KAAK,EAAE,qBAAqB;CAC7B,CAAA;AAED,MAAM,KAAK,GAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,KAAI;AAClE,IAAA,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACnC,UAAE,gBAAgB,CAAC,MAAM,CAAC;UACxB,YAAY,CAAA;AAEhB,IAAA,MAAM,SAAS,GAAmB,qBAAqB,CAAC,MAAM,CAAC;AAC7D,UAAE,qBAAqB,CAAC,MAAM,CAAC;UAC7B,SAAS,CAAA;AAEb,IAAA,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC;AAC7C,UAAE,qBAAqB,CAAC,MAAM,CAAC;UAC7B,oBAAoB,CAAA;AAExB,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC,CAAA;IAEvE,SAAS,CAAC,MAAK;QACb,UAAU,CAAC,GAAG,EAAE,CAAA;KACjB,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;IAC7C,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAA;AAE3C,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,UAAU,IACT,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,EACxC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAA;QAE1B,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAA;AACpC,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EACH,EAAA,MAAM,EAAE,IAAI,EACZ,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,SAAS,EAChB,SAAS,EAAC,oBAAoB,EAC9B,CAAA;YACF,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAA,EAAE,QAAQ,CAAQ,CACrD,CACK,EACd;AACH;;;;"}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
-
4
- const ModalBody = ({ children, bodySpacing = true, hasHeader, hasFooter, }) => (React.createElement("div", { className: cx("cobalt-modal-body", {
5
- "cobalt-modal-body--bodySpacing": bodySpacing,
6
- "cobalt-modal-body--hasHeader": hasHeader,
7
- "cobalt-modal-body--hasFooter": hasFooter,
8
- }) }, children));
9
-
10
- export { ModalBody as default };
11
- //# sourceMappingURL=ModalBody.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModalBody.js","sources":["../../../src/components/Modal/ModalBody.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\n\nconst ModalBody = ({\n children,\n bodySpacing = true,\n hasHeader,\n hasFooter,\n}: {\n children?: React.ReactNode\n bodySpacing?: boolean\n hasHeader: boolean\n hasFooter: boolean\n}) => (\n <div\n className={cx(\"cobalt-modal-body\", {\n \"cobalt-modal-body--bodySpacing\": bodySpacing,\n \"cobalt-modal-body--hasHeader\": hasHeader,\n \"cobalt-modal-body--hasFooter\": hasFooter,\n })}\n >\n {children}\n </div>\n)\n\nexport default ModalBody\n"],"names":[],"mappings":";;;AAGM,MAAA,SAAS,GAAG,CAAC,EACjB,QAAQ,EACR,WAAW,GAAG,IAAI,EAClB,SAAS,EACT,SAAS,GAMV,MACC,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE;AACjC,QAAA,gCAAgC,EAAE,WAAW;AAC7C,QAAA,8BAA8B,EAAE,SAAS;AACzC,QAAA,8BAA8B,EAAE,SAAS;AAC1C,KAAA,CAAC,EAED,EAAA,QAAQ,CACL;;;;"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Timer object enhancing setTimeout with start, pause, resume features *
3
- */
4
- class Timer {
5
- constructor(callback, delay) {
6
- this.pause = () => {
7
- if (this.start) {
8
- window.clearTimeout(this.timerID);
9
- this.remaining -= Number(new Date()) - this.start;
10
- }
11
- };
12
- this.run = () => {
13
- this.start = Number(new Date());
14
- if (this.timerID)
15
- window.clearTimeout(this.timerID);
16
- this.timerID = window.setTimeout(this.callback, this.remaining);
17
- };
18
- this.remaining = delay;
19
- this.callback = callback;
20
- }
21
- }
22
-
23
- export { Timer as default };
24
- //# sourceMappingURL=Timer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Timer.js","sources":["../../../src/components/utils/Timer.ts"],"sourcesContent":["/**\n * Timer object enhancing setTimeout with start, pause, resume features *\n */\nclass Timer {\n private timerID?: number\n private start?: number\n private remaining: number\n private callback: (...args: any) => any\n\n constructor(callback: (...args: any) => any, delay: number) {\n this.remaining = delay\n this.callback = callback\n }\n\n pause = () => {\n if (this.start) {\n window.clearTimeout(this.timerID)\n this.remaining -= Number(new Date()) - this.start\n }\n }\n\n run = () => {\n this.start = Number(new Date())\n if (this.timerID) window.clearTimeout(this.timerID)\n this.timerID = window.setTimeout(this.callback, this.remaining)\n }\n}\n\nexport default Timer\n"],"names":[],"mappings":"AAAA;;AAEG;AACH,MAAM,KAAK,CAAA;IAMT,WAAY,CAAA,QAA+B,EAAE,KAAa,EAAA;QAK1D,IAAK,CAAA,KAAA,GAAG,MAAK;AACX,YAAA,IAAI,IAAI,CAAC,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACjC,gBAAA,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAA;aAClD;AACH,SAAC,CAAA;QAED,IAAG,CAAA,GAAA,GAAG,MAAK;YACT,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;YAC/B,IAAI,IAAI,CAAC,OAAO;AAAE,gBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACnD,YAAA,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;AACjE,SAAC,CAAA;AAfC,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;AACtB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;KACzB;AAcF;;;;"}
@@ -1,8 +0,0 @@
1
- function getScrollbarWidth() {
2
- const documentWidth = document.documentElement.clientWidth;
3
- const windowWidth = window.innerWidth;
4
- return windowWidth - documentWidth;
5
- }
6
-
7
- export { getScrollbarWidth };
8
- //# sourceMappingURL=dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.js","sources":["../../../src/components/utils/dom.ts"],"sourcesContent":["export function getScrollbarWidth() {\n const documentWidth = document.documentElement.clientWidth\n const windowWidth = window.innerWidth\n return windowWidth - documentWidth\n}\n"],"names":[],"mappings":"SAAgB,iBAAiB,GAAA;AAC/B,IAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAA;AAC1D,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAA;IACrC,OAAO,WAAW,GAAG,aAAa,CAAA;AACpC;;;;"}
@@ -1,5 +0,0 @@
1
- const DEFAULT_FONT_SIZE = 16;
2
- const remToPx = (rem) => rem * DEFAULT_FONT_SIZE;
3
-
4
- export { remToPx };
5
- //# sourceMappingURL=px.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"px.js","sources":["../../../src/components/utils/px.ts"],"sourcesContent":["const DEFAULT_FONT_SIZE = 16\n\nexport const remToPx = (rem: number) => rem * DEFAULT_FONT_SIZE\n"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAErB,MAAM,OAAO,GAAG,CAAC,GAAW,KAAK,GAAG,GAAG;;;;"}
@@ -1,34 +0,0 @@
1
- import { useRef, useState, useEffect } from 'react';
2
- import { ResizeObserver as ResizeObserver$1 } from '@juggle/resize-observer';
3
-
4
- // https://caniuse.com/resizeobserver
5
- const ResizeObserver = window
6
- .ResizeObserver || ResizeObserver$1;
7
- /**
8
- * Hook to listen the giving element resize events (using ResizeObserver)
9
- * and returning the updated height of that element according to those events
10
- *
11
- * Useful to animated using react-spring an element that we can't know the
12
- * actual size since it's computed from the child elements
13
- */
14
- const useElementHeight = () => {
15
- const ref = useRef(null);
16
- const [height, setHeight] = useState(0);
17
- useEffect(() => {
18
- const resizeObserver = new ResizeObserver(([entry]) => {
19
- requestAnimationFrame(() => {
20
- if (!entry)
21
- return;
22
- setHeight(entry.target.getBoundingClientRect().height);
23
- });
24
- });
25
- if (ref.current) {
26
- resizeObserver.observe(ref.current);
27
- }
28
- return () => resizeObserver.disconnect();
29
- }, []);
30
- return { ref, height };
31
- };
32
-
33
- export { useElementHeight as default };
34
- //# sourceMappingURL=useElementHeight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useElementHeight.js","sources":["../../src/hooks/useElementHeight.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from \"react\"\nimport { ResizeObserver as ROPolyfill } from \"@juggle/resize-observer\"\n\n// https://caniuse.com/resizeobserver\nconst ResizeObserver =\n (window as { ResizeObserver: typeof ROPolyfill } & typeof window)\n .ResizeObserver || ROPolyfill\n\n/**\n * Hook to listen the giving element resize events (using ResizeObserver)\n * and returning the updated height of that element according to those events\n *\n * Useful to animated using react-spring an element that we can't know the\n * actual size since it's computed from the child elements\n */\nconst useElementHeight = <ElementType extends HTMLElement>() => {\n const ref = useRef<ElementType>(null)\n const [height, setHeight] = useState(0)\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(([entry]) => {\n requestAnimationFrame(() => {\n if (!entry) return\n setHeight(entry.target.getBoundingClientRect().height)\n })\n })\n\n if (ref.current) {\n resizeObserver.observe(ref.current)\n }\n\n return () => resizeObserver.disconnect()\n }, [])\n\n return { ref, height }\n}\n\nexport default useElementHeight\n"],"names":["ROPolyfill"],"mappings":";;;AAGA;AACA,MAAM,cAAc,GACjB,MAAgE;KAC9D,cAAc,IAAIA,gBAAU,CAAA;AAEjC;;;;;;AAMG;AACG,MAAA,gBAAgB,GAAG,MAAsC;AAC7D,IAAA,MAAM,GAAG,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEvC,SAAS,CAAC,MAAK;QACb,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,KAAI;YACpD,qBAAqB,CAAC,MAAK;AACzB,gBAAA,IAAI,CAAC,KAAK;oBAAE,OAAM;gBAClB,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,CAAA;AACxD,aAAC,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AAEF,QAAA,IAAI,GAAG,CAAC,OAAO,EAAE;AACf,YAAA,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;SACpC;AAED,QAAA,OAAO,MAAM,cAAc,CAAC,UAAU,EAAE,CAAA;KACzC,EAAE,EAAE,CAAC,CAAA;AAEN,IAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACxB;;;;"}
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- export type AlertStatus = "info" | "success" | "error";
3
- export type AlertType = (props: {
4
- children?: React.ReactNode;
5
- status?: AlertStatus;
6
- dismiss: () => void;
7
- }) => React.ReactElement;
8
- declare const Alert: AlertType;
9
- export default Alert;
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- declare const ModalBody: ({ children, bodySpacing, hasHeader, hasFooter, }: {
3
- children?: React.ReactNode;
4
- bodySpacing?: boolean;
5
- hasHeader: boolean;
6
- hasFooter: boolean;
7
- }) => React.JSX.Element;
8
- export default ModalBody;