@drivy/cobalt 0.51.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) 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/Form/Autocomplete/index.js +177 -155
  8. package/components/Form/Autocomplete/index.js.map +1 -1
  9. package/components/Form/Slider.js +40 -19
  10. package/components/Form/Slider.js.map +1 -1
  11. package/components/Form/field.js +9 -1
  12. package/components/Form/field.js.map +1 -1
  13. package/components/Modal/ModalHeader.js +10 -7
  14. package/components/Modal/ModalHeader.js.map +1 -1
  15. package/components/Modal/index.js +33 -97
  16. package/components/Modal/index.js.map +1 -1
  17. package/components/PhotoDropzone/index.js +2 -5
  18. package/components/PhotoDropzone/index.js.map +1 -1
  19. package/components/Tabs/index.js +19 -118
  20. package/components/Tabs/index.js.map +1 -1
  21. package/index.js +3 -3
  22. package/package.json +3 -10
  23. package/src/tokens/zIndexes.js +2 -1
  24. package/src/tokens/zIndexes.js.map +1 -1
  25. package/styles/components/Accordion/index.scss +40 -19
  26. package/styles/components/Alerter/index.scss +42 -42
  27. package/styles/components/Form/Autocomplete/index.scss +52 -74
  28. package/styles/components/Form/RadioWithDetails.scss +2 -12
  29. package/styles/components/Form/Slider.scss +46 -55
  30. package/styles/components/Form/TextInput.scss +4 -0
  31. package/styles/components/Form/field.scss +2 -2
  32. package/styles/components/Modal/index.scss +82 -63
  33. package/styles/components/PhotoDropzone/index.scss +4 -0
  34. package/styles/components/Tabs/index.scss +18 -120
  35. package/styles/core/z-index.scss +1 -0
  36. package/tokens/zIndexes.js +2 -1
  37. package/tokens/zIndexes.js.map +1 -1
  38. package/types/src/components/Accordion/index.d.ts +15 -66
  39. package/types/src/components/Alerter/index.d.ts +8 -19
  40. package/types/src/components/Form/Autocomplete/index.d.ts +38 -37
  41. package/types/src/components/Form/Slider.d.ts +12 -77
  42. package/types/src/components/Form/field.d.ts +16 -1
  43. package/types/src/components/Modal/ModalHeader.d.ts +1 -1
  44. package/types/src/components/Modal/index.d.ts +2 -2
  45. package/types/src/components/Tabs/index.d.ts +9 -6
  46. package/types/src/index.d.ts +1 -1
  47. package/types/src/tokens/index.d.ts +1 -0
  48. package/utilities.css +59 -0
  49. package/utils/getCobaltTailwindcssConfig.js.map +1 -1
  50. package/components/Alerter/Alert.js +0 -47
  51. package/components/Alerter/Alert.js.map +0 -1
  52. package/components/Modal/ModalBody.js +0 -11
  53. package/components/Modal/ModalBody.js.map +0 -1
  54. package/components/utils/Timer.js +0 -24
  55. package/components/utils/Timer.js.map +0 -1
  56. package/components/utils/dom.js +0 -8
  57. package/components/utils/dom.js.map +0 -1
  58. package/components/utils/px.js +0 -5
  59. package/components/utils/px.js.map +0 -1
  60. package/hooks/useElementHeight.js +0 -34
  61. package/hooks/useElementHeight.js.map +0 -1
  62. package/types/src/components/Alerter/Alert.d.ts +0 -9
  63. package/types/src/components/Modal/ModalBody.d.ts +0 -8
@@ -1,115 +1,134 @@
1
- @import "@reach/dialog/styles.css";
1
+ .cobalt-modal {
2
+ --dialog-margin-top: 10vh;
2
3
 
3
- $reach-ui-dialog-margin-top: 10vh;
4
+ @apply c-p-none c-z-modal;
5
+ position: fixed;
6
+ left: 0;
7
+ top: var(--dialog-margin-top);
4
8
 
5
- .cobalt-modal {
6
9
  display: flex;
7
- flex-direction: column;
8
- padding: spacing(none);
10
+ justify-content: center;
9
11
 
10
- &__overlay[data-reach-dialog-overlay] {
11
- z-index: zx(modal);
12
+ width: 100%;
13
+
14
+ &__overlay {
15
+ @apply c-z-modal-below;
16
+ position: fixed;
12
17
 
13
18
  overflow: hidden;
14
19
 
15
- background-color: fade-out(black, 0.2);
20
+ background-color: rgba(0, 0, 0, 0.8);
21
+ backdrop-filter: blur(4px);
16
22
 
23
+ inset: 0;
17
24
  will-change: opacity;
18
- }
19
-
20
- &[data-reach-dialog-content] {
21
- @include bg-color(secondary);
22
- max-height: calc(100% - 2 * #{$reach-ui-dialog-margin-top});
23
-
24
- box-shadow: 0 6px 36px fade-out(black, 0.8);
25
- }
26
-
27
- &[data-reach-dialog-content]:not(.cobalt-modal--mobile) {
28
- max-width: 38rem;
29
- width: 80vw;
30
- }
31
25
 
32
- &--fullHeight {
33
- &[data-reach-dialog-content] {
34
- height: 100%;
26
+ &[data-state="open"]:not(.cobalt-modal--skipAnimation__enter) {
27
+ animation: c-fade-in 300ms ease-out;
35
28
  }
36
- }
37
29
 
38
- &--fullWidth {
39
- &[data-reach-dialog-content]:not(.cobalt-modal--mobile) {
40
- max-width: unset;
30
+ &[data-state="closed"]:not(.cobalt-modal--skipAnimation__leave) {
31
+ animation: c-fade-out 200ms ease-in;
41
32
  }
42
33
  }
43
34
 
44
- &--desktop {
45
- position: relative;
46
-
47
- border-radius: border-radius(xl);
48
- }
35
+ .cobalt-modal__content {
36
+ @apply c-bg-secondary;
37
+ max-height: calc(100% - 2 * var(--dialog-margin-top));
38
+ width: 80vw;
49
39
 
50
- &--mobile {
51
- position: fixed;
40
+ box-shadow: 0 6px 36px fade-out(black, 0.8);
52
41
 
53
- margin-bottom: spacing(none);
54
- width: 100%;
42
+ @include breakpoint($from: "md") {
43
+ @apply c-rounded-xl;
44
+ max-width: 38rem;
45
+ }
55
46
 
56
- &[data-reach-dialog-content] {
47
+ @include breakpoint($until: "md") {
48
+ position: fixed;
57
49
  bottom: 0;
58
50
 
59
- max-height: calc(100% - #{spacing(xl)});
51
+ width: 100%;
52
+ max-height: calc(100% - theme("spacing.xl"));
60
53
 
61
54
  border-radius: 16px 16px 0 0;
62
55
  }
63
- }
64
56
 
65
- &--overflowHidden {
66
- overflow: hidden;
57
+ &[data-state="open"]:not(.cobalt-modal--skipAnimation__enter) {
58
+ animation: c-slide-in-from-bottom 300ms ease-out;
59
+ @include breakpoint($from: "md") {
60
+ animation: c-slide-in 300ms ease-out;
61
+ }
62
+ }
63
+
64
+ &[data-state="closed"]:not(.cobalt-modal--skipAnimation__leave) {
65
+ animation: c-slide-out-to-bottom 200ms ease-in;
66
+ @include breakpoint($from: "md") {
67
+ animation: c-slide-out 200ms ease-in;
68
+ }
69
+ }
67
70
  }
68
71
 
69
- &-body {
72
+ &--fullHeight {
70
73
  height: 100%;
71
74
 
72
- overflow-y: auto;
73
- overscroll-behavior: contain;
74
-
75
- &--bodySpacing {
76
- padding: spacing(lg) spacing(md);
75
+ .cobalt-modal__content {
76
+ height: 100%;
77
+ }
78
+ }
77
79
 
78
- &.cobalt-modal-body--hasHeader {
79
- padding-top: spacing(sm);
80
- }
80
+ &--fullWidth {
81
+ .cobalt-modal__content {
82
+ max-width: unset;
83
+ }
84
+ }
81
85
 
82
- &.cobalt-modal-body--hasFooter {
83
- padding-bottom: spacing(sm);
84
- }
86
+ &--overflowHidden {
87
+ .cobalt-modal__content {
88
+ overflow: hidden;
85
89
  }
86
90
  }
87
91
 
88
92
  &-footer {
89
- @include border-top(base);
90
- padding: spacing(sm);
93
+ @apply c-border-t c-border-t-base c-p-sm;
91
94
  }
92
95
 
93
96
  &-header {
94
- @include border-bottom(base);
97
+ @apply c-border-b c-border-b-base c-p-md;
95
98
  display: flex;
96
99
  justify-content: space-between;
97
100
  align-items: center;
98
- padding: spacing(md);
99
101
 
100
102
  &__title {
101
- @include c-text-title-md;
102
- @include text-color(base);
103
- margin: spacing(none);
103
+ @apply c-text-title-md c-text-base c-m-none;
104
104
  }
105
105
 
106
106
  &__close-button {
107
+ @apply c-p-none c-cursor-pointer;
107
108
  flex: none;
108
109
  border: 0;
109
- padding: spacing(none);
110
110
 
111
- cursor: cursor(pointer);
112
111
  background-color: transparent;
113
112
  }
113
+
114
+ + .cobalt-modal-body__wrapper
115
+ .cobalt-modal-body.cobalt-modal-body--bodySpacing {
116
+ @apply c-pt-sm;
117
+ }
118
+ }
119
+
120
+ &-body {
121
+ height: 100%;
122
+
123
+ overflow-y: auto;
124
+ overscroll-behavior: contain;
125
+
126
+ &--bodySpacing {
127
+ @apply c-py-lg c-px-md;
128
+
129
+ &.cobalt-modal-body--hasFooter {
130
+ @apply c-pb-sm;
131
+ }
132
+ }
114
133
  }
115
134
  }
@@ -102,6 +102,10 @@
102
102
  pointer-events: initial;
103
103
  }
104
104
 
105
+ .cobalt-photo-dropzone__hidden-input {
106
+ @apply c-sr-only;
107
+ }
108
+
105
109
  @keyframes pop {
106
110
  50% {
107
111
  transform: scale(1.1);
@@ -1,114 +1,25 @@
1
- @import "@reach/tabs/styles.css";
2
-
3
- $scrollButtonWidth: 2rem;
4
-
5
1
  .cobalt-tabs {
6
- @include bg-color(secondary);
2
+ @apply c-bg-secondary;
7
3
  position: relative;
8
4
  }
9
5
 
10
- .cobalt-tabs__nav-prev,
11
- .cobalt-tabs__nav-next {
12
- position: absolute;
13
- top: 0;
14
-
15
- width: $scrollButtonWidth;
16
- // Tab height
17
- height: calc(1rem + #{spacing(md) * 2});
18
- padding: 0;
19
- border: 0;
20
-
21
- cursor: pointer;
22
- background: none;
23
-
24
- .cobalt-tabs__nav-icon {
25
- margin-left: 0;
26
-
27
- transition: margin-left 0.2s;
28
- }
29
-
30
- &[disabled] {
31
- opacity: 0.2;
32
- cursor: not-allowed;
33
-
34
- &:hover .cobalt-tabs__nav-icon,
35
- &:focus .cobalt-tabs__nav-icon {
36
- margin-left: 0;
37
- }
38
- }
39
- }
40
-
41
- .cobalt-tabs__nav-prev {
42
- background: linear-gradient(
43
- 270deg,
44
- transparent,
45
- var(--c-background-secondary) 30%
46
- );
47
-
48
- &:hover .cobalt-tabs__nav-icon,
49
- &:focus .cobalt-tabs__nav-icon {
50
- margin-left: -0.4rem;
51
- }
52
- }
53
-
54
- .cobalt-tabs__nav-next {
55
- right: 0;
56
-
57
- background: linear-gradient(
58
- 90deg,
59
- transparent,
60
- var(--c-background-secondary) 30%
61
- );
62
-
63
- &:hover .cobalt-tabs__nav-icon,
64
- &:focus .cobalt-tabs__nav-icon {
65
- margin-left: 0.4rem;
66
- }
67
- }
68
-
69
6
  .cobalt-tabs__labels {
70
7
  position: relative;
71
8
 
9
+ display: flex;
72
10
  width: 100%;
11
+ overflow-y: auto;
73
12
 
74
13
  background: none;
75
-
76
- &.cobalt-tabs__labels--scrollable {
77
- padding: 0 $scrollButtonWidth;
78
-
79
- overflow-x: scroll;
80
- overflow-y: hidden;
81
-
82
- // Hide horizontal scrolling bar
83
- -webkit-overflow-scrolling: touch;
84
- scrollbar-width: none;
85
- -ms-overflow-style: none;
86
-
87
- &::-webkit-scrollbar {
88
- display: none;
89
- }
90
-
91
- // trick to force a padding-right in the scrollable tab list
92
- &:after {
93
- right: 0;
94
-
95
- min-width: 2rem;
96
- max-width: 2rem;
97
- display: block;
98
-
99
- content: "";
100
- }
101
- }
102
14
  }
103
15
 
104
16
  .cobalt-tabs__label {
105
- @include c-text-section-heading;
106
- @include bg-color(secondaryInteractive);
17
+ @apply c-text-section-heading c-bg-secondaryInteractive;
107
18
  position: relative;
108
19
 
109
20
  display: flex;
110
- flex: 1 0 auto;
111
21
  justify-content: center;
22
+ flex: 1 0 auto;
112
23
  align-items: center;
113
24
  padding: spacing(md);
114
25
  border: 0;
@@ -125,32 +36,19 @@ $scrollButtonWidth: 2rem;
125
36
 
126
37
  transition: 0.2s color;
127
38
 
128
- &:after {
129
- position: absolute;
130
- bottom: 0;
131
- left: 0;
132
- right: 0;
133
-
134
- display: block;
135
- height: 3px;
136
-
137
- content: "";
138
-
139
- background: transparent;
140
-
141
- transform: scaleX(0);
142
- transition: transform ease-out 0.15s;
39
+ &[data-selected] {
40
+ @apply c-text-base;
143
41
  }
42
+ }
144
43
 
145
- &.cobalt-tabs__label--selected {
146
- @include text-color(base);
147
-
148
- &:after {
149
- @include fill-bg-color(accent);
44
+ .cobalt-tabs__indicator {
45
+ @apply c-bg-accent;
46
+ top: calc(100% - 3px);
150
47
 
151
- transform: scaleX(1);
152
- }
153
- }
48
+ width: var(--width);
49
+ height: 3px;
50
+ --transition-duration: 0.15s;
51
+ --transition-timing-function: ease-in-out;
154
52
  }
155
53
 
156
54
  .cobalt-tabs__labels--subLevel {
@@ -158,9 +56,9 @@ $scrollButtonWidth: 2rem;
158
56
  flex: 0 0 auto;
159
57
 
160
58
  text-transform: none;
59
+ }
161
60
 
162
- &:after {
163
- background: transparent;
164
- }
61
+ .cobalt-tabs__indicator {
62
+ @apply c-bg-transparent;
165
63
  }
166
64
  }
@@ -1,4 +1,5 @@
1
1
  $z-index-data: (
2
+ "autocomplete-popover": 2147483647,
2
3
  "below": -1,
3
4
  "base": 0,
4
5
  "above": 1,
@@ -28,7 +28,8 @@ var _zIndexes = {
28
28
  "modal-above": 91,
29
29
  "alert-below": 99,
30
30
  alert: alert,
31
- "alert-above": 101
31
+ "alert-above": 101,
32
+ "autocomplete-popover": 2147483647
32
33
  };
33
34
 
34
35
  export { above, alert, base, below, _zIndexes as default, dropdown, header, modal, nav, sidepanel };
@@ -1 +1 @@
1
- {"version":3,"file":"zIndexes.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"zIndexes.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { AccordionProps as ReachAccordionProps, AccordionItemProps as ReachAccordionItemProps, AccordionButtonProps as ReachAccordionButtonProps, AccordionPanelProps as ReachAccordionPanelProps } from "@reach/accordion";
3
- export { useAccordionItemContext } from "@reach/accordion";
2
+ import { AccordionItemProps as ArkAccordionItemProps, AccordionItemTriggerProps as ArkAccordionItemTriggerProps, AccordionRootProps as ArkAccordionRootProps, AccordionItemContentProps as ArkAccordionItemContentProps, AccordionValueChangeDetails } from "@ark-ui/react";
3
+ export { useAccordionItemContext } from "@ark-ui/react";
4
4
  type HeadingLevelMapType = {
5
5
  h2: 2;
6
6
  h3: 3;
@@ -14,80 +14,29 @@ export type AccordionItemHeaderPropsType = {
14
14
  * To improve the semantics of the markup further, the ARIA guidelines dictate
15
15
  * that each accordion item's button should be wrapped in an element with
16
16
  * role="heading", or more simply, an HTML heading tag.
17
- * https://reach.tech/accordion/#accordion-headings
18
17
  */
19
18
  headingLevel?: HeadingLevelMapType[HeadingTag];
20
19
  className?: string;
21
20
  leftToggleIcon?: boolean;
22
21
  useChevron?: boolean;
23
- } & ReachAccordionButtonProps;
24
- export type AccordionItemPanelPropsType = {
25
- className?: string;
26
- } & ReachAccordionPanelProps;
27
- export type AccordionItemPropsType = {
28
- className?: string;
29
- } & ReachAccordionItemProps;
30
- export type AccordionPropsType = {
31
- className?: string;
32
- collapsible?: ReachAccordionProps["collapsible"];
33
- defaultIndex?: ReachAccordionProps["defaultIndex"];
34
- index?: ReachAccordionProps["index"];
35
- multiple?: ReachAccordionProps["multiple"];
36
- onChange?: ReachAccordionProps["onChange"];
37
- } & ReachAccordionProps;
38
- export declare const AccordionItemHeader: React.ForwardRefExoticComponent<{
39
- /**
40
- * To improve the semantics of the markup further, the ARIA guidelines dictate
41
- * that each accordion item's button should be wrapped in an element with
42
- * role="heading", or more simply, an HTML heading tag.
43
- * https://reach.tech/accordion/#accordion-headings
44
- */
45
- headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined;
46
- className?: string | undefined;
47
- leftToggleIcon?: boolean | undefined;
48
- useChevron?: boolean | undefined;
49
- } & ReachAccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
50
- export declare const AccordionItemPanel: {
51
- ({ children, className, ...props }: AccordionItemPanelPropsType): React.JSX.Element;
52
- displayName: string;
22
+ } & ArkAccordionItemTriggerProps;
23
+ export type AccordionItemPanelPropsType = ArkAccordionItemContentProps;
24
+ export type AccordionItemPropsType = Omit<ArkAccordionItemProps, "value"> & {
25
+ value?: ArkAccordionItemProps["value"];
53
26
  };
54
- export declare const AccordionItem: {
55
- ({ children, className, ...props }: AccordionItemPropsType): React.JSX.Element;
56
- displayName: string;
57
- Header: React.ForwardRefExoticComponent<{
58
- /**
59
- * To improve the semantics of the markup further, the ARIA guidelines dictate
60
- * that each accordion item's button should be wrapped in an element with
61
- * role="heading", or more simply, an HTML heading tag.
62
- * https://reach.tech/accordion/#accordion-headings
63
- */
64
- headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined;
65
- className?: string | undefined;
66
- leftToggleIcon?: boolean | undefined;
67
- useChevron?: boolean | undefined;
68
- } & ReachAccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
69
- Panel: {
70
- ({ children, className, ...props }: AccordionItemPanelPropsType): React.JSX.Element;
71
- displayName: string;
72
- };
27
+ export type AccordionPropsType = Omit<ArkAccordionRootProps, "onValueChange"> & {
28
+ onValueChange?: (value: AccordionValueChangeDetails["value"]) => void;
73
29
  };
74
30
  declare const Accordion: {
75
- ({ className, children, index, collapsible, multiple, ...props }: AccordionPropsType): React.JSX.Element;
31
+ ({ className, children, collapsible, onValueChange, ...props }: AccordionPropsType): React.JSX.Element;
32
+ displayName: string;
76
33
  Item: {
77
- ({ children, className, ...props }: AccordionItemPropsType): React.JSX.Element;
34
+ ({ children, className, value, ...props }: AccordionItemPropsType): React.JSX.Element;
78
35
  displayName: string;
79
- Header: React.ForwardRefExoticComponent<{
80
- /**
81
- * To improve the semantics of the markup further, the ARIA guidelines dictate
82
- * that each accordion item's button should be wrapped in an element with
83
- * role="heading", or more simply, an HTML heading tag.
84
- * https://reach.tech/accordion/#accordion-headings
85
- */
86
- headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined;
87
- className?: string | undefined;
88
- leftToggleIcon?: boolean | undefined;
89
- useChevron?: boolean | undefined;
90
- } & ReachAccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
36
+ Header: {
37
+ ({ children, className, headingLevel, leftToggleIcon, useChevron, ...props }: AccordionItemHeaderPropsType): React.JSX.Element;
38
+ displayName: string;
39
+ };
91
40
  Panel: {
92
41
  ({ children, className, ...props }: AccordionItemPanelPropsType): React.JSX.Element;
93
42
  displayName: string;
@@ -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,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 & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<unknown>>;
52
+ export { Autocomplete };