freemium-ui 1.0.174 → 1.0.178
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.
- package/lib/index.cjs.js +265 -128
- package/lib/index.esm.js +267 -130
- package/lib/types/components/Dropdown/index.d.ts +1 -0
- package/lib/types/components/Pickers/DatePicker.d.ts +17 -0
- package/lib/types/components/Pickers/DateTimePicker.d.ts +16 -0
- package/lib/types/components/Pickers/index.d.ts +2 -0
- package/lib/types/components/Pickers/styles.d.ts +2 -0
- package/lib/types/index.d.ts +1 -1
- package/package.json +5 -1
- package/0001-chore-Adding-popper-support-to-dropdown.patch +0 -304
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TimePickerProps } from '@blueprintjs/datetime';
|
|
3
|
+
import '@blueprintjs/datetime/lib/css/blueprint-datetime.css';
|
|
4
|
+
export declare type MonthYearLocation = 'start' | 'end' | 'center';
|
|
5
|
+
export declare type DatePickerProps = TimePickerProps & {
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
isErrored?: boolean;
|
|
8
|
+
displayFormat?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
monthYearLocation?: MonthYearLocation;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
custom?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const DatePicker: (props: DatePickerProps) => JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TimePickerProps } from '@blueprintjs/datetime';
|
|
3
|
+
import '@blueprintjs/datetime/lib/css/blueprint-datetime.css';
|
|
4
|
+
declare type DateTimePickerProps = TimePickerProps & {
|
|
5
|
+
isRequired?: boolean;
|
|
6
|
+
isErrored?: boolean;
|
|
7
|
+
displayFormat?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
custom?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const DateTimePicker: (props: DateTimePickerProps) => JSX.Element;
|
|
16
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './components/Button';
|
|
|
3
3
|
export * from './components/Checkbox';
|
|
4
4
|
export * from './components/CssBaseLine';
|
|
5
5
|
export * from './components/Confirmation';
|
|
6
|
-
export * from './components/DatePicker';
|
|
7
6
|
export * from './components/Drawer';
|
|
8
7
|
export * from './components/ButtonDropdown';
|
|
9
8
|
export * from './components/Icons';
|
|
@@ -14,6 +13,7 @@ export * from './components/Modal';
|
|
|
14
13
|
export * from './components/MultiSelectDropdown';
|
|
15
14
|
export * from './components/Loader';
|
|
16
15
|
export * from './components/Dropdown';
|
|
16
|
+
export * from './components/Pickers';
|
|
17
17
|
export * from './components/Popover';
|
|
18
18
|
export * from './components/Radio';
|
|
19
19
|
export * from './components/BoxedRadio';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freemium-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.178",
|
|
4
4
|
"description": "React Ui Components for Freemium Apps",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -37,9 +37,12 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/freshdesk/freemium-ui#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@blueprintjs/datetime": "^3.23.19",
|
|
40
41
|
"@reach/dialog": "^0.10.4",
|
|
42
|
+
"@reach/popover": "^0.16.2",
|
|
41
43
|
"@rebass/grid": "6.1.0",
|
|
42
44
|
"@styled-system/should-forward-prop": "5.1.5",
|
|
45
|
+
"@types/react-dates": "^21.8.3",
|
|
43
46
|
"@types/react-table": "^7.7.0",
|
|
44
47
|
"deepmerge": "^4.2.2",
|
|
45
48
|
"downshift": "^5.4.2",
|
|
@@ -96,6 +99,7 @@
|
|
|
96
99
|
"react-docgen-typescript-loader": "3.7.1",
|
|
97
100
|
"react-dom": "^16.13.1",
|
|
98
101
|
"rollup": "2.18.0",
|
|
102
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
99
103
|
"rollup-plugin-terser": "^7.0.2",
|
|
100
104
|
"rollup-plugin-typescript2": "0.27.1",
|
|
101
105
|
"style-loader": "^1.2.1",
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
From 69099ea79a290dd13fc4f05c6d1a22e0db151168 Mon Sep 17 00:00:00 2001
|
|
2
|
-
From: codejets <mukeshkr@freshdesk.com>
|
|
3
|
-
Date: Wed, 30 Dec 2020 11:43:00 +0530
|
|
4
|
-
Subject: [PATCH] chore: Adding popper support to dropdown
|
|
5
|
-
|
|
6
|
-
This will remove the interaction from the dropdown and we can add that later
|
|
7
|
-
---
|
|
8
|
-
package.json | 1 +
|
|
9
|
-
src/components/Dropdown/Dropdown.stories.tsx | 2 +-
|
|
10
|
-
src/components/Dropdown/DropdownMenu.tsx | 94 +++++++++-----------
|
|
11
|
-
src/components/Dropdown/index.tsx | 71 ++++++++++++---
|
|
12
|
-
yarn.lock | 22 ++++-
|
|
13
|
-
5 files changed, 124 insertions(+), 66 deletions(-)
|
|
14
|
-
|
|
15
|
-
diff --git a/package.json b/package.json
|
|
16
|
-
index 1deb9b7..3fb95db 100644
|
|
17
|
-
--- a/package.json
|
|
18
|
-
+++ b/package.json
|
|
19
|
-
@@ -47,6 +47,7 @@
|
|
20
|
-
"react": ">=16.13.1",
|
|
21
|
-
"react-dates": "^21.8.0",
|
|
22
|
-
"react-dom": ">=16.13.1",
|
|
23
|
-
+ "react-popper": "1.3.3",
|
|
24
|
-
"react-table": "^7.2.1",
|
|
25
|
-
"react-tippy": "^1.4.0",
|
|
26
|
-
"react-transition-group": "^4.4.1",
|
|
27
|
-
diff --git a/src/components/Dropdown/Dropdown.stories.tsx b/src/components/Dropdown/Dropdown.stories.tsx
|
|
28
|
-
index 440bf74..37deb73 100644
|
|
29
|
-
--- a/src/components/Dropdown/Dropdown.stories.tsx
|
|
30
|
-
+++ b/src/components/Dropdown/Dropdown.stories.tsx
|
|
31
|
-
@@ -12,7 +12,7 @@ import {Dropdown} from './'
|
|
32
|
-
const stories = storiesOf('Dropdown', module)
|
|
33
|
-
stories.addDecorator(withKnobs)
|
|
34
|
-
stories.addDecorator((story) => {
|
|
35
|
-
- return <div style={{margin: '200px'}}>{story()}</div>
|
|
36
|
-
+ return <div style={{margin: '250px 200px 250px'}}>{story()}</div>
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const allHouses = [
|
|
40
|
-
diff --git a/src/components/Dropdown/DropdownMenu.tsx b/src/components/Dropdown/DropdownMenu.tsx
|
|
41
|
-
index f69b8c4..9333baf 100644
|
|
42
|
-
--- a/src/components/Dropdown/DropdownMenu.tsx
|
|
43
|
-
+++ b/src/components/Dropdown/DropdownMenu.tsx
|
|
44
|
-
@@ -129,56 +129,50 @@ const DropdownMenu = withDownshift(
|
|
45
|
-
return null
|
|
46
|
-
}
|
|
47
|
-
return (
|
|
48
|
-
- <SlideFade initialOffset="-20px" timeout={200} in={isOpen} unmountOnExit>
|
|
49
|
-
- {(styles: React.CSSProperties) => (
|
|
50
|
-
- <div
|
|
51
|
-
- style={{
|
|
52
|
-
- position: 'absolute',
|
|
53
|
-
- width: '100%',
|
|
54
|
-
- zIndex: 1000,
|
|
55
|
-
- ...styles,
|
|
56
|
-
- }}
|
|
57
|
-
- >
|
|
58
|
-
- <StyledMenuContainer
|
|
59
|
-
- {...getMenuProps({
|
|
60
|
-
- onClick: (event: React.MouseEvent<HTMLElement>) => {
|
|
61
|
-
- event.stopPropagation()
|
|
62
|
-
- },
|
|
63
|
-
- })}
|
|
64
|
-
- overrideStyles={overrideStyles}
|
|
65
|
-
- >
|
|
66
|
-
- {allItems.map((item, index) => {
|
|
67
|
-
- const canHighlightSelectedIndex =
|
|
68
|
-
- allItems.indexOf(selectedItem) === index
|
|
69
|
-
- return (
|
|
70
|
-
- <StyledMenuItem
|
|
71
|
-
- {...getItemProps({
|
|
72
|
-
- item,
|
|
73
|
-
- key: index,
|
|
74
|
-
- disabled: item.disabled,
|
|
75
|
-
- })}
|
|
76
|
-
- key={index}
|
|
77
|
-
- isSelectedIndex={canHighlightSelectedIndex}
|
|
78
|
-
- canHighlight={highlightedIndex === index}
|
|
79
|
-
- disabled={item.disabled}
|
|
80
|
-
- >
|
|
81
|
-
- <Flex justifyContent="space-between" alignItems="center">
|
|
82
|
-
- <Box width="90%" style={{wordBreak: 'break-word'}}>
|
|
83
|
-
- {itemComponent
|
|
84
|
-
- ? itemComponent(item)
|
|
85
|
-
- : itemToString(item)}
|
|
86
|
-
- </Box>
|
|
87
|
-
- {canHighlightSelectedIndex ? (
|
|
88
|
-
- <Icons glyph="check" size={12} viewBox="0 0 8 8" />
|
|
89
|
-
- ) : null}
|
|
90
|
-
- </Flex>
|
|
91
|
-
- </StyledMenuItem>
|
|
92
|
-
- )
|
|
93
|
-
- })}
|
|
94
|
-
- </StyledMenuContainer>
|
|
95
|
-
- </div>
|
|
96
|
-
- )}
|
|
97
|
-
- </SlideFade>
|
|
98
|
-
+ <div
|
|
99
|
-
+ style={{
|
|
100
|
-
+ width: '100%',
|
|
101
|
-
+ zIndex: 1000,
|
|
102
|
-
+ position: 'relative',
|
|
103
|
-
+ display: isOpen ? 'block' : 'none',
|
|
104
|
-
+ }}
|
|
105
|
-
+ >
|
|
106
|
-
+ <StyledMenuContainer
|
|
107
|
-
+ {...getMenuProps({
|
|
108
|
-
+ onClick: (event: React.MouseEvent<HTMLElement>) => {
|
|
109
|
-
+ event.stopPropagation()
|
|
110
|
-
+ },
|
|
111
|
-
+ })}
|
|
112
|
-
+ overrideStyles={overrideStyles}
|
|
113
|
-
+ >
|
|
114
|
-
+ {allItems.map((item, index) => {
|
|
115
|
-
+ const canHighlightSelectedIndex =
|
|
116
|
-
+ allItems.indexOf(selectedItem) === index
|
|
117
|
-
+ return (
|
|
118
|
-
+ <StyledMenuItem
|
|
119
|
-
+ {...getItemProps({
|
|
120
|
-
+ item,
|
|
121
|
-
+ key: index,
|
|
122
|
-
+ disabled: item.disabled,
|
|
123
|
-
+ })}
|
|
124
|
-
+ key={index}
|
|
125
|
-
+ isSelectedIndex={canHighlightSelectedIndex}
|
|
126
|
-
+ canHighlight={highlightedIndex === index}
|
|
127
|
-
+ disabled={item.disabled}
|
|
128
|
-
+ >
|
|
129
|
-
+ <Flex justifyContent="space-between" alignItems="center">
|
|
130
|
-
+ <Box width="90%" style={{wordBreak: 'break-word'}}>
|
|
131
|
-
+ {itemComponent ? itemComponent(item) : itemToString(item)}
|
|
132
|
-
+ </Box>
|
|
133
|
-
+ {canHighlightSelectedIndex ? (
|
|
134
|
-
+ <Icons glyph="check" size={12} viewBox="0 0 8 8" />
|
|
135
|
-
+ ) : null}
|
|
136
|
-
+ </Flex>
|
|
137
|
-
+ </StyledMenuItem>
|
|
138
|
-
+ )
|
|
139
|
-
+ })}
|
|
140
|
-
+ </StyledMenuContainer>
|
|
141
|
-
+ </div>
|
|
142
|
-
)
|
|
143
|
-
},
|
|
144
|
-
)
|
|
145
|
-
diff --git a/src/components/Dropdown/index.tsx b/src/components/Dropdown/index.tsx
|
|
146
|
-
index 6f160cc..d3262f3 100644
|
|
147
|
-
--- a/src/components/Dropdown/index.tsx
|
|
148
|
-
+++ b/src/components/Dropdown/index.tsx
|
|
149
|
-
@@ -2,6 +2,7 @@ import React from 'react'
|
|
150
|
-
import Downshift from 'downshift'
|
|
151
|
-
import hoistNonReactStatics from 'hoist-non-react-statics'
|
|
152
|
-
import styled from 'styled-components'
|
|
153
|
-
+import {Manager, Reference, Popper} from 'react-popper'
|
|
154
|
-
|
|
155
|
-
import DropdownButton from './DropdownButton'
|
|
156
|
-
import DropdownMenu from './DropdownMenu'
|
|
157
|
-
@@ -54,6 +55,16 @@ export const DROPDOWN_TYPES = {
|
|
158
|
-
|
|
159
|
-
const DownshiftContext = React.createContext<any>(null)
|
|
160
|
-
|
|
161
|
-
+class DropdownWrapper extends React.Component<{scheduleUpdate: any}> {
|
|
162
|
-
+ componentDidUpdate() {
|
|
163
|
-
+ this.props.scheduleUpdate()
|
|
164
|
-
+ }
|
|
165
|
-
+
|
|
166
|
-
+ render() {
|
|
167
|
-
+ return this.props.children
|
|
168
|
-
+ }
|
|
169
|
-
+}
|
|
170
|
-
+
|
|
171
|
-
export function withDownshift(Component: any) {
|
|
172
|
-
function Wrapper(props: any, ref: any) {
|
|
173
|
-
return (
|
|
174
|
-
@@ -86,6 +97,13 @@ type DropdownProps = {
|
|
175
|
-
onChange?: (value: any) => any
|
|
176
|
-
itemToString?: (a: any) => any
|
|
177
|
-
type?: 'button' | 'input'
|
|
178
|
-
+ defaultPlacement?:
|
|
179
|
-
+ | 'top'
|
|
180
|
-
+ | 'top-start'
|
|
181
|
-
+ | 'top-end'
|
|
182
|
-
+ | 'bottom-start'
|
|
183
|
-
+ | 'bottom'
|
|
184
|
-
+ | 'bottom-end'
|
|
185
|
-
filterKey?: string
|
|
186
|
-
label?: string
|
|
187
|
-
width?: string
|
|
188
|
-
@@ -114,6 +132,7 @@ export const Dropdown = (props: DropdownProps) => {
|
|
189
|
-
width = '100%',
|
|
190
|
-
disabled,
|
|
191
|
-
isRequired,
|
|
192
|
-
+ defaultPlacement,
|
|
193
|
-
overrideButtonStyles,
|
|
194
|
-
overrideContainerStyles,
|
|
195
|
-
...rest
|
|
196
|
-
@@ -158,20 +177,44 @@ export const Dropdown = (props: DropdownProps) => {
|
|
197
|
-
children
|
|
198
|
-
) : (
|
|
199
|
-
<>
|
|
200
|
-
- {DROPDOWN_TYPES.BUTTON === type && (
|
|
201
|
-
- <DropdownButton
|
|
202
|
-
- disabled={disabled}
|
|
203
|
-
- overrideStyles={overrideButtonStyles}
|
|
204
|
-
- placeholder={placeholder}
|
|
205
|
-
- />
|
|
206
|
-
- )}
|
|
207
|
-
- {DROPDOWN_TYPES.INPUT === type && (
|
|
208
|
-
- <DropdownInput placeholder={placeholder} />
|
|
209
|
-
- )}
|
|
210
|
-
- <DropdownMenu
|
|
211
|
-
- itemComponent={itemComponent}
|
|
212
|
-
- overrideStyles={overrideContainerStyles}
|
|
213
|
-
- />
|
|
214
|
-
+ <Manager>
|
|
215
|
-
+ <Reference>
|
|
216
|
-
+ {({ref}) => (
|
|
217
|
-
+ <div ref={ref}>
|
|
218
|
-
+ {DROPDOWN_TYPES.BUTTON === type && (
|
|
219
|
-
+ <DropdownButton
|
|
220
|
-
+ disabled={disabled}
|
|
221
|
-
+ overrideStyles={overrideButtonStyles}
|
|
222
|
-
+ placeholder={placeholder}
|
|
223
|
-
+ />
|
|
224
|
-
+ )}
|
|
225
|
-
+ {DROPDOWN_TYPES.INPUT === type && (
|
|
226
|
-
+ <DropdownInput placeholder={placeholder} />
|
|
227
|
-
+ )}
|
|
228
|
-
+ </div>
|
|
229
|
-
+ )}
|
|
230
|
-
+ </Reference>
|
|
231
|
-
+
|
|
232
|
-
+ <Popper placement={defaultPlacement || 'top'}>
|
|
233
|
-
+ {({ref, style, scheduleUpdate}) => (
|
|
234
|
-
+ <DropdownWrapper scheduleUpdate={scheduleUpdate}>
|
|
235
|
-
+ <div
|
|
236
|
-
+ ref={ref}
|
|
237
|
-
+ style={{
|
|
238
|
-
+ position: 'absolute',
|
|
239
|
-
+ width: '100%',
|
|
240
|
-
+ ...style,
|
|
241
|
-
+ }}
|
|
242
|
-
+ >
|
|
243
|
-
+ <DropdownMenu
|
|
244
|
-
+ itemComponent={itemComponent}
|
|
245
|
-
+ overrideStyles={overrideContainerStyles}
|
|
246
|
-
+ />
|
|
247
|
-
+ </div>
|
|
248
|
-
+ </DropdownWrapper>
|
|
249
|
-
+ )}
|
|
250
|
-
+ </Popper>
|
|
251
|
-
+ </Manager>
|
|
252
|
-
</>
|
|
253
|
-
)}
|
|
254
|
-
</DownshiftContext.Provider>
|
|
255
|
-
diff --git a/yarn.lock b/yarn.lock
|
|
256
|
-
index 519b93f..3c5f856 100644
|
|
257
|
-
--- a/yarn.lock
|
|
258
|
-
+++ b/yarn.lock
|
|
259
|
-
@@ -5123,6 +5123,14 @@ create-react-context@0.3.0, create-react-context@^0.3.0:
|
|
260
|
-
gud "^1.0.0"
|
|
261
|
-
warning "^4.0.3"
|
|
262
|
-
|
|
263
|
-
+create-react-context@<=0.2.2:
|
|
264
|
-
+ version "0.2.2"
|
|
265
|
-
+ resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca"
|
|
266
|
-
+ integrity sha512-KkpaLARMhsTsgp0d2NA/R94F/eDLbhXERdIq3LvX2biCAXcDvHYoOqHfWCHf1+OLj+HKBotLG3KqaOOf+C1C+A==
|
|
267
|
-
+ dependencies:
|
|
268
|
-
+ fbjs "^0.8.0"
|
|
269
|
-
+ gud "^1.0.0"
|
|
270
|
-
+
|
|
271
|
-
cross-spawn@6.0.5, cross-spawn@^6.0.0:
|
|
272
|
-
version "6.0.5"
|
|
273
|
-
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
|
274
|
-
@@ -6426,7 +6434,7 @@ fb-watchman@^2.0.0:
|
|
275
|
-
dependencies:
|
|
276
|
-
bser "2.1.1"
|
|
277
|
-
|
|
278
|
-
-fbjs@^0.8.4:
|
|
279
|
-
+fbjs@^0.8.0, fbjs@^0.8.4:
|
|
280
|
-
version "0.8.17"
|
|
281
|
-
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd"
|
|
282
|
-
integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=
|
|
283
|
-
@@ -11140,6 +11148,18 @@ react-popper-tooltip@^2.8.3:
|
|
284
|
-
"@babel/runtime" "^7.9.2"
|
|
285
|
-
react-popper "^1.3.7"
|
|
286
|
-
|
|
287
|
-
+react-popper@1.3.3:
|
|
288
|
-
+ version "1.3.3"
|
|
289
|
-
+ resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.3.tgz#2c6cef7515a991256b4f0536cd4bdcb58a7b6af6"
|
|
290
|
-
+ integrity sha512-ynMZBPkXONPc5K4P5yFWgZx5JGAUIP3pGGLNs58cfAPgK67olx7fmLp+AdpZ0+GoQ+ieFDa/z4cdV6u7sioH6w==
|
|
291
|
-
+ dependencies:
|
|
292
|
-
+ "@babel/runtime" "^7.1.2"
|
|
293
|
-
+ create-react-context "<=0.2.2"
|
|
294
|
-
+ popper.js "^1.14.4"
|
|
295
|
-
+ prop-types "^15.6.1"
|
|
296
|
-
+ typed-styles "^0.0.7"
|
|
297
|
-
+ warning "^4.0.2"
|
|
298
|
-
+
|
|
299
|
-
react-popper@^1.3.7:
|
|
300
|
-
version "1.3.7"
|
|
301
|
-
resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.7.tgz#f6a3471362ef1f0d10a4963673789de1baca2324"
|
|
302
|
-
--
|
|
303
|
-
2.20.1 (Apple Git-117)
|
|
304
|
-
|