@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-2f600c.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.
- package/lib/commonjs/components/AspectRatio.js +17 -1
- package/lib/commonjs/components/Button.js +24 -33
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DeprecatedButton.js +127 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Pressable.js +12 -23
- package/lib/commonjs/components/Touchable.js +13 -24
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/Button.js +11 -1
- package/lib/commonjs/mappings/{Pressable.js → Touchable.js} +18 -10
- package/lib/module/components/Accordion/AccordionItem.js +25 -4
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/Button.js +18 -27
- package/lib/module/components/Checkbox/Checkbox.js +3 -4
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +25 -7
- package/lib/module/components/Checkbox/CheckboxRow.js +25 -8
- package/lib/module/components/DeprecatedButton.js +117 -0
- package/lib/module/components/DeprecatedCardWrapper.js +20 -3
- package/lib/module/components/NumberInput.js +12 -3
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Portal/Portal.js +2 -6
- package/lib/module/components/Pressable.js +11 -21
- package/lib/module/components/ProgressBar.js +39 -7
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/Touchable.js +12 -22
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/constants.js +1 -0
- package/lib/module/mappings/Button.js +11 -1
- package/lib/module/mappings/{Pressable.js → Touchable.js} +19 -11
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +2 -4
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -4
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Button.d.ts +1 -1
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{Pressable.d.ts → Touchable.d.ts} +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +18 -22
- package/src/components/Button.tsx +19 -40
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +83 -0
- package/src/components/DeprecatedButton.tsx +190 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Pressable.js +10 -15
- package/src/components/Pressable.tsx +11 -28
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +13 -34
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +11 -1
- package/src/mappings/Button.ts +11 -1
- package/src/mappings/{Pressable.js → Touchable.js} +19 -11
- package/src/mappings/{Pressable.ts → Touchable.ts} +19 -12
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { Switch as NativeSwitch } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -29,7 +28,6 @@ function Switch(_ref) {
|
|
|
29
28
|
setChecked(value);
|
|
30
29
|
}
|
|
31
30
|
}, [value, checked]);
|
|
32
|
-
|
|
33
31
|
// This special logic is to handle weird APIs like Airtable that return
|
|
34
32
|
// true or undefined for a boolean
|
|
35
33
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -38,24 +36,24 @@ function Switch(_ref) {
|
|
|
38
36
|
setChecked(Boolean(defaultValue));
|
|
39
37
|
}
|
|
40
38
|
}, [defaultValue, previousDefaultValue]);
|
|
41
|
-
return /*#__PURE__*/React.createElement(NativeSwitch,
|
|
39
|
+
return /*#__PURE__*/React.createElement(NativeSwitch, {
|
|
42
40
|
value: checked,
|
|
43
41
|
disabled: disabled,
|
|
44
42
|
trackColor: {
|
|
45
43
|
false: inactiveTrackThemeColor,
|
|
46
44
|
true: activeTrackThemeColor
|
|
47
45
|
},
|
|
48
|
-
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
46
|
+
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
|
|
49
47
|
// @ts-ignore react-native-web only
|
|
50
|
-
,
|
|
51
48
|
activeThumbColor: activeThumbThemeColor,
|
|
52
49
|
ios_backgroundColor: inactiveTrackThemeColor,
|
|
53
50
|
style: style,
|
|
54
51
|
onValueChange: bool => {
|
|
55
52
|
setChecked(bool);
|
|
56
53
|
onValueChange && onValueChange(bool);
|
|
57
|
-
}
|
|
58
|
-
|
|
54
|
+
},
|
|
55
|
+
...rest
|
|
56
|
+
});
|
|
59
57
|
}
|
|
60
58
|
function Row(_ref2) {
|
|
61
59
|
let {
|
|
@@ -84,7 +82,7 @@ function Row(_ref2) {
|
|
|
84
82
|
setChecked(defaultValue);
|
|
85
83
|
}
|
|
86
84
|
}, [defaultValue]);
|
|
87
|
-
return /*#__PURE__*/React.createElement(FormRow,
|
|
85
|
+
return /*#__PURE__*/React.createElement(FormRow, {
|
|
88
86
|
disabled: disabled,
|
|
89
87
|
onPress: () => {
|
|
90
88
|
setChecked(!checked);
|
|
@@ -92,8 +90,9 @@ function Row(_ref2) {
|
|
|
92
90
|
},
|
|
93
91
|
label: label,
|
|
94
92
|
direction: direction,
|
|
95
|
-
style: style
|
|
96
|
-
|
|
93
|
+
style: style,
|
|
94
|
+
...rest
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
97
96
|
theme: theme,
|
|
98
97
|
value: checked,
|
|
99
98
|
disabled: disabled,
|
|
@@ -106,4 +105,16 @@ function Row(_ref2) {
|
|
|
106
105
|
}
|
|
107
106
|
const SwitchRow = withTheme(Row);
|
|
108
107
|
export { SwitchRow };
|
|
108
|
+
export default withTheme(Switch);: theme,
|
|
109
|
+
value: checked,
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
onValueChange: onValueChange,
|
|
112
|
+
activeTrackColor: activeTrackColor,
|
|
113
|
+
inactiveTrackColor: inactiveTrackColor,
|
|
114
|
+
activeThumbColor: activeThumbColor,
|
|
115
|
+
inactiveThumbColor: inactiveThumbColor
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
const SwitchRow = withTheme(Row);
|
|
119
|
+
export { SwitchRow };
|
|
109
120
|
export default withTheme(Switch);
|
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
4
|
export default function Touchable(_ref) {
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
disabled,
|
|
8
8
|
onPress,
|
|
9
|
-
onLongPress,
|
|
10
|
-
hitSlop,
|
|
11
|
-
delayLongPress,
|
|
12
9
|
activeOpacity,
|
|
13
10
|
disabledOpacity,
|
|
11
|
+
delayLongPress,
|
|
12
|
+
hitSlop,
|
|
14
13
|
style,
|
|
15
14
|
...props
|
|
16
15
|
} = _ref;
|
|
17
|
-
const getOpacity = useCallback(pressed => {
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return disabledOpacity;
|
|
20
|
-
} else {
|
|
21
|
-
if (pressed) return activeOpacity;else return 1;
|
|
22
|
-
}
|
|
23
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
-
const _style = useCallback(_ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
pressed
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return [style, {
|
|
29
|
-
opacity: getOpacity(pressed)
|
|
30
|
-
}];
|
|
31
|
-
}, [getOpacity, style]);
|
|
32
16
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
33
|
-
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
17
|
disabled: disabled,
|
|
18
|
+
onPress: onPress,
|
|
36
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
-
style:
|
|
21
|
+
style: _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
pressed
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return [{
|
|
26
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
27
|
+
}, style];
|
|
28
|
+
}
|
|
39
29
|
}, props), children);
|
|
40
30
|
}
|
package/lib/module/constants.js
CHANGED
|
@@ -17,11 +17,21 @@ const SEED_DATA_PROPS = {
|
|
|
17
17
|
activeOpacity: createStaticNumberProp({
|
|
18
18
|
label: "Active Opacity",
|
|
19
19
|
description: "Opacity of the button when active.",
|
|
20
|
+
defaultValue: 0.8,
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 1,
|
|
23
|
+
step: 0.01,
|
|
24
|
+
precision: 2,
|
|
20
25
|
required: false
|
|
21
26
|
}),
|
|
22
27
|
disabledOpacity: createStaticNumberProp({
|
|
23
28
|
label: "Disabled Opacity",
|
|
24
29
|
description: "Opacity of the button when disabled.",
|
|
30
|
+
defaultValue: 0.8,
|
|
31
|
+
min: 0,
|
|
32
|
+
max: 1,
|
|
33
|
+
step: 0.01,
|
|
34
|
+
precision: 2,
|
|
25
35
|
required: false
|
|
26
36
|
}),
|
|
27
37
|
delayLongPress: createStaticNumberProp({
|
|
@@ -41,9 +51,9 @@ export const SEED_DATA = [{
|
|
|
41
51
|
category: COMPONENT_TYPES.deprecated,
|
|
42
52
|
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
43
53
|
layout: {
|
|
44
|
-
backgroundColor: "transparent",
|
|
45
54
|
borderRadius: 8,
|
|
46
55
|
fontFamily: "system-700",
|
|
56
|
+
backgroundColor: "transparent",
|
|
47
57
|
borderWidth: 1,
|
|
48
58
|
textAlign: "center"
|
|
49
59
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createActionProp, Triggers,
|
|
1
|
+
import { COMPONENT_TYPES, createActionProp, Triggers, createStaticNumberProp, StylesPanelSections } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Borders],
|
|
4
4
|
layout: {},
|
|
@@ -6,27 +6,35 @@ const SEED_DATA_PROPS = {
|
|
|
6
6
|
props: {
|
|
7
7
|
onPress: createActionProp(),
|
|
8
8
|
onLongPress: createActionProp(),
|
|
9
|
-
activeOpacity:
|
|
9
|
+
activeOpacity: createStaticNumberProp({
|
|
10
10
|
label: "Active Opacity",
|
|
11
11
|
description: "The opacity when the button is pressed.",
|
|
12
12
|
defaultValue: 0.8,
|
|
13
|
-
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 1,
|
|
15
|
+
step: 0.01,
|
|
16
|
+
precision: 2,
|
|
17
|
+
required: false
|
|
14
18
|
}),
|
|
15
|
-
disabledOpacity:
|
|
19
|
+
disabledOpacity: createStaticNumberProp({
|
|
16
20
|
label: "Disabled Opacity",
|
|
17
21
|
description: "The opacity when the button is disabled.",
|
|
18
22
|
defaultValue: 0.8,
|
|
19
|
-
|
|
23
|
+
min: 0,
|
|
24
|
+
max: 1,
|
|
25
|
+
step: 0.01,
|
|
26
|
+
precision: 2,
|
|
27
|
+
required: false
|
|
20
28
|
}),
|
|
21
|
-
delayLongPress:
|
|
29
|
+
delayLongPress: createStaticNumberProp({
|
|
22
30
|
label: "Delay Long Press",
|
|
23
31
|
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
24
|
-
|
|
32
|
+
required: false
|
|
25
33
|
}),
|
|
26
|
-
hitSlop:
|
|
34
|
+
hitSlop: createStaticNumberProp({
|
|
27
35
|
label: "Hit Slop",
|
|
28
36
|
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
29
|
-
|
|
37
|
+
required: false
|
|
30
38
|
})
|
|
31
39
|
}
|
|
32
40
|
};
|
|
@@ -34,12 +42,12 @@ export const SEED_DATA = [{
|
|
|
34
42
|
name: "Touchable",
|
|
35
43
|
tag: "Touchable",
|
|
36
44
|
description: "An interactive view with no styles",
|
|
37
|
-
category: COMPONENT_TYPES.
|
|
45
|
+
category: COMPONENT_TYPES.deprecated,
|
|
38
46
|
...SEED_DATA_PROPS
|
|
39
47
|
}, {
|
|
40
48
|
name: "Pressable",
|
|
41
49
|
tag: "Pressable",
|
|
42
50
|
description: "An interactive view with no styles",
|
|
43
|
-
category: COMPONENT_TYPES.
|
|
51
|
+
category: COMPONENT_TYPES.button,
|
|
44
52
|
...SEED_DATA_PROPS
|
|
45
53
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AAoJA,QAAA,MAAM,WAAW,EAAE,GAAsB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,EAAE,GAAsB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AAmBlB,QAAA,MAAM,aAAa,EAAE,GAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle
|
|
2
|
+
import { PressableProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
4
4
|
export interface CheckboxProps {
|
|
5
5
|
status?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,QAAQ,CAoFjE,CAAC;AAqBF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroupRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/CheckboxGroupRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,EACT,SAAS,EAET,SAAS,
|
|
1
|
+
{"version":3,"file":"CheckboxGroupRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/CheckboxGroupRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,EACT,SAAS,EAET,SAAS,EAIV,MAAM,cAAc,CAAC;AACtB,OAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,UAAU,gBAAgB;CAC3B;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;IAC3E,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB;AA2BD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,GAAG,QAAQ,CAsEhE,CAAC;AAsBF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/CheckboxRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,EACT,SAAS,EAET,SAAS,
|
|
1
|
+
{"version":3,"file":"CheckboxRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/CheckboxRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,EACT,SAAS,EAET,SAAS,EAIV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,UAAU,gBAAgB;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAcD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,GAAG,QAAQ,CA2FtD,CAAC;AAsBF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, PressableProps } from "react-native";
|
|
3
|
+
import type { Theme } from "../styles/DefaultTheme";
|
|
4
|
+
import type { IconSlot } from "../interfaces/Icon";
|
|
5
|
+
/**
|
|
6
|
+
* A button is component that the user can press to trigger an action.
|
|
7
|
+
*
|
|
8
|
+
* <div class="screenshots">
|
|
9
|
+
* <figure>
|
|
10
|
+
* <img src="screenshots/button-1.png" />
|
|
11
|
+
* <figcaption>Text button</figcaption>
|
|
12
|
+
* </figure>
|
|
13
|
+
* <figure>
|
|
14
|
+
* <img src="screenshots/button-2.png" />
|
|
15
|
+
* <figcaption>Outlined button</figcaption>
|
|
16
|
+
* </figure>
|
|
17
|
+
* <figure>
|
|
18
|
+
* <img src="screenshots/button-3.png" />
|
|
19
|
+
* <figcaption>Contained button</figcaption>
|
|
20
|
+
* </figure>
|
|
21
|
+
* </div>
|
|
22
|
+
*
|
|
23
|
+
* ## Usage
|
|
24
|
+
* ```js
|
|
25
|
+
* import * as React from 'react';
|
|
26
|
+
* import { Button } from '@draftbit/ui';
|
|
27
|
+
*
|
|
28
|
+
* const MyComponent = () => (
|
|
29
|
+
* <Button icon="add-a-photo" type="solid" onPress={() => console.log('Pressed')}>
|
|
30
|
+
* Press me
|
|
31
|
+
* </Button>
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* export default MyComponent;
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare type Props = {
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
type?: "solid" | "outline" | "text";
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
icon?: string;
|
|
42
|
+
labelColor?: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
onPress: () => void;
|
|
46
|
+
elevation?: number;
|
|
47
|
+
style?: StyleProp<ViewStyle>;
|
|
48
|
+
theme: Theme;
|
|
49
|
+
} & PressableProps & IconSlot;
|
|
50
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
51
|
+
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
52
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<Props>> & React.FC<React.PropsWithChildren<Props>>, {}>;
|
|
53
|
+
export default _default;
|
|
54
|
+
//# sourceMappingURL=DeprecatedButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeprecatedButton.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGT,cAAc,EACf,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,cAAc,GAChB,QAAQ,CAAC;;;;AA2HX,wBAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,aAAK,KAAK,GAAG;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;;;;AAiCF,wBAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AA2aF,wBAAiC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PressableProps,
|
|
2
|
+
import { PressableProps, ViewStyle } from "react-native";
|
|
3
3
|
declare type Props = {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -8,11 +8,9 @@ declare type Props = {
|
|
|
8
8
|
onLongPress?: () => void;
|
|
9
9
|
delayLongPress?: number;
|
|
10
10
|
hitSlop?: number;
|
|
11
|
-
pressRetentionOffset?: number;
|
|
12
11
|
activeOpacity?: number;
|
|
13
12
|
disabledOpacity?: number;
|
|
14
13
|
} & PressableProps;
|
|
15
|
-
export
|
|
16
|
-
export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }: Props): JSX.Element;
|
|
14
|
+
export default function Pressable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }: Props): JSX.Element;
|
|
17
15
|
export {};
|
|
18
16
|
//# sourceMappingURL=Pressable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,EACd,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,cAAc,CAAC;AAEnB,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACd,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eAoBP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PressableProps,
|
|
2
|
+
import { PressableProps, ViewStyle } from "react-native";
|
|
3
3
|
declare type Props = {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -8,11 +8,9 @@ declare type Props = {
|
|
|
8
8
|
onLongPress?: () => void;
|
|
9
9
|
delayLongPress?: number;
|
|
10
10
|
hitSlop?: number;
|
|
11
|
-
pressRetentionOffset?: number;
|
|
12
11
|
activeOpacity?: number;
|
|
13
12
|
disabledOpacity?: number;
|
|
14
13
|
} & PressableProps;
|
|
15
|
-
export
|
|
16
|
-
export default function Touchable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }: Props): JSX.Element;
|
|
14
|
+
export default function Touchable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }: Props): JSX.Element;
|
|
17
15
|
export {};
|
|
18
16
|
//# sourceMappingURL=Touchable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/components/Touchable.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/components/Touchable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,cAAc,CAAC;AAEnB,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACd,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eAoBP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Touchable.web.d.ts","sourceRoot":"","sources":["../../../../src/components/Touchable.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AA6DA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoErB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Touchable.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "47.0.1-
|
|
3
|
+
"version": "47.0.1-2f600c.2+2f600c0",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^47.0.1-
|
|
44
|
+
"@draftbit/types": "^47.0.1-2f600c.2+2f600c0",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "2f600c022c7e9950c72bbbc6ce75d2e97f14e963"
|
|
95
95
|
}
|
package/src/components/Button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { Text, Pressable, Platform, StyleSheet, ActivityIndicator, } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
const CONSTANTS = {
|
|
@@ -7,7 +7,7 @@ const CONSTANTS = {
|
|
|
7
7
|
padding: 8,
|
|
8
8
|
icon: 24,
|
|
9
9
|
};
|
|
10
|
-
function Base({ Icon, icon, title,
|
|
10
|
+
function Base({ Icon, icon, title, loading, disabled, style, activeOpacity, disabledOpacity, ...props }) {
|
|
11
11
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
|
|
12
12
|
const titleStyles = {
|
|
13
13
|
color,
|
|
@@ -28,22 +28,15 @@ function Base({ Icon, icon, title, onPress, onLongPress, activeOpacity, disabled
|
|
|
28
28
|
if (textAlign === "right") {
|
|
29
29
|
buttonStyles.justifyContent = "flex-end";
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
42
|
-
const _style = useCallback(({ pressed }) => [
|
|
43
|
-
buttonStyles,
|
|
44
|
-
{ opacity: getOpacity(pressed) },
|
|
45
|
-
], [getOpacity, buttonStyles]);
|
|
46
|
-
return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled || loading, style: (styles.base, _style), ...props },
|
|
31
|
+
return (React.createElement(Pressable, { disabled: disabled || loading, style: ({ pressed }) => {
|
|
32
|
+
return [
|
|
33
|
+
styles.base,
|
|
34
|
+
{
|
|
35
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
36
|
+
},
|
|
37
|
+
buttonStyles,
|
|
38
|
+
];
|
|
39
|
+
}, ...props },
|
|
47
40
|
loading ? (React.createElement(ActivityIndicator, { size: "small", color: color, style: styles.loading })) : null,
|
|
48
41
|
icon && !loading ? (React.createElement(Icon, { name: icon, color: color, style: styles.icon, size: CONSTANTS.icon })) : null,
|
|
49
42
|
React.createElement(Text, { style: titleStyles }, title)));
|
|
@@ -81,10 +74,8 @@ const styles = StyleSheet.create({
|
|
|
81
74
|
flexDirection: "row",
|
|
82
75
|
alignItems: "center",
|
|
83
76
|
justifyContent: "center",
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
paddingRight: CONSTANTS.padding,
|
|
87
|
-
paddingBottom: CONSTANTS.padding,
|
|
77
|
+
minHeight: CONSTANTS.baseHeight,
|
|
78
|
+
paddingHorizontal: 12,
|
|
88
79
|
fontFamily: "System",
|
|
89
80
|
fontWeight: "700",
|
|
90
81
|
...Platform.select({
|
|
@@ -98,6 +89,11 @@ const styles = StyleSheet.create({
|
|
|
98
89
|
backgroundColor: "transparent",
|
|
99
90
|
borderWidth: 1,
|
|
100
91
|
},
|
|
92
|
+
bare: {
|
|
93
|
+
backgroundColor: "transparent",
|
|
94
|
+
padding: 0,
|
|
95
|
+
minHeight: undefined,
|
|
96
|
+
},
|
|
101
97
|
loading: {
|
|
102
98
|
marginRight: 6,
|
|
103
99
|
},
|