@dangerousthings/react-native 0.1.0
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/dist/components/DTAccordion.d.ts +75 -0
- package/dist/components/DTAccordion.d.ts.map +1 -0
- package/dist/components/DTAccordion.js +147 -0
- package/dist/components/DTAccordion.js.map +1 -0
- package/dist/components/DTButton.d.ts +68 -0
- package/dist/components/DTButton.d.ts.map +1 -0
- package/dist/components/DTButton.js +59 -0
- package/dist/components/DTButton.js.map +1 -0
- package/dist/components/DTCard.d.ts +97 -0
- package/dist/components/DTCard.d.ts.map +1 -0
- package/dist/components/DTCard.js +81 -0
- package/dist/components/DTCard.js.map +1 -0
- package/dist/components/DTCheckbox.d.ts +63 -0
- package/dist/components/DTCheckbox.d.ts.map +1 -0
- package/dist/components/DTCheckbox.js +55 -0
- package/dist/components/DTCheckbox.js.map +1 -0
- package/dist/components/DTChip.d.ts +40 -0
- package/dist/components/DTChip.d.ts.map +1 -0
- package/dist/components/DTChip.js +55 -0
- package/dist/components/DTChip.js.map +1 -0
- package/dist/components/DTDrawer.d.ts +82 -0
- package/dist/components/DTDrawer.d.ts.map +1 -0
- package/dist/components/DTDrawer.js +146 -0
- package/dist/components/DTDrawer.js.map +1 -0
- package/dist/components/DTGallery.d.ts +83 -0
- package/dist/components/DTGallery.d.ts.map +1 -0
- package/dist/components/DTGallery.js +160 -0
- package/dist/components/DTGallery.js.map +1 -0
- package/dist/components/DTHexagon.d.ts +81 -0
- package/dist/components/DTHexagon.d.ts.map +1 -0
- package/dist/components/DTHexagon.js +110 -0
- package/dist/components/DTHexagon.js.map +1 -0
- package/dist/components/DTLabel.d.ts +100 -0
- package/dist/components/DTLabel.d.ts.map +1 -0
- package/dist/components/DTLabel.js +189 -0
- package/dist/components/DTLabel.js.map +1 -0
- package/dist/components/DTMediaFrame.d.ts +77 -0
- package/dist/components/DTMediaFrame.d.ts.map +1 -0
- package/dist/components/DTMediaFrame.js +84 -0
- package/dist/components/DTMediaFrame.js.map +1 -0
- package/dist/components/DTMenu.d.ts +119 -0
- package/dist/components/DTMenu.d.ts.map +1 -0
- package/dist/components/DTMenu.js +188 -0
- package/dist/components/DTMenu.js.map +1 -0
- package/dist/components/DTModal.d.ts +64 -0
- package/dist/components/DTModal.d.ts.map +1 -0
- package/dist/components/DTModal.js +45 -0
- package/dist/components/DTModal.js.map +1 -0
- package/dist/components/DTProgressBar.d.ts +66 -0
- package/dist/components/DTProgressBar.d.ts.map +1 -0
- package/dist/components/DTProgressBar.js +82 -0
- package/dist/components/DTProgressBar.js.map +1 -0
- package/dist/components/DTQuantityStepper.d.ts +76 -0
- package/dist/components/DTQuantityStepper.d.ts.map +1 -0
- package/dist/components/DTQuantityStepper.js +108 -0
- package/dist/components/DTQuantityStepper.js.map +1 -0
- package/dist/components/DTRadioGroup.d.ts +79 -0
- package/dist/components/DTRadioGroup.d.ts.map +1 -0
- package/dist/components/DTRadioGroup.js +107 -0
- package/dist/components/DTRadioGroup.js.map +1 -0
- package/dist/components/DTSearchInput.d.ts +72 -0
- package/dist/components/DTSearchInput.d.ts.map +1 -0
- package/dist/components/DTSearchInput.js +71 -0
- package/dist/components/DTSearchInput.js.map +1 -0
- package/dist/components/DTSwitch.d.ts +52 -0
- package/dist/components/DTSwitch.d.ts.map +1 -0
- package/dist/components/DTSwitch.js +85 -0
- package/dist/components/DTSwitch.js.map +1 -0
- package/dist/components/DTTextInput.d.ts +58 -0
- package/dist/components/DTTextInput.d.ts.map +1 -0
- package/dist/components/DTTextInput.js +85 -0
- package/dist/components/DTTextInput.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/DTThemeProvider.d.ts +49 -0
- package/dist/theme/DTThemeProvider.d.ts.map +1 -0
- package/dist/theme/DTThemeProvider.js +52 -0
- package/dist/theme/DTThemeProvider.js.map +1 -0
- package/dist/theme/colors.d.ts +42 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +59 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/theme/paperTheme.d.ts +39 -0
- package/dist/theme/paperTheme.d.ts.map +1 -0
- package/dist/theme/paperTheme.js +116 -0
- package/dist/theme/paperTheme.js.map +1 -0
- package/dist/theme/typography.d.ts +57 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +170 -0
- package/dist/theme/typography.js.map +1 -0
- package/dist/utils/bevelPaths.d.ts +42 -0
- package/dist/utils/bevelPaths.d.ts.map +1 -0
- package/dist/utils/bevelPaths.js +105 -0
- package/dist/utils/bevelPaths.js.map +1 -0
- package/dist/utils/useComponentLayout.d.ts +18 -0
- package/dist/utils/useComponentLayout.d.ts.map +1 -0
- package/dist/utils/useComponentLayout.js +24 -0
- package/dist/utils/useComponentLayout.js.map +1 -0
- package/dist/utils/variantColors.d.ts +12 -0
- package/dist/utils/variantColors.d.ts.map +1 -0
- package/dist/utils/variantColors.js +20 -0
- package/dist/utils/variantColors.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DT Accordion Component
|
|
3
|
+
*
|
|
4
|
+
* Custom-built accordion with animated height expansion following
|
|
5
|
+
* the Dangerous Things angular aesthetic.
|
|
6
|
+
*
|
|
7
|
+
* Web CSS reference (FilterAccordion):
|
|
8
|
+
* - menu-item-clipped style headers with thick top border
|
|
9
|
+
* - Expand/collapse with height animation
|
|
10
|
+
* - Active sections switch to activeVariant color
|
|
11
|
+
*/
|
|
12
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
13
|
+
import { type DTVariant } from '../utils/variantColors';
|
|
14
|
+
export interface DTAccordionSection {
|
|
15
|
+
/**
|
|
16
|
+
* Unique key for the section
|
|
17
|
+
*/
|
|
18
|
+
key: string;
|
|
19
|
+
/**
|
|
20
|
+
* Section header title
|
|
21
|
+
*/
|
|
22
|
+
title: string;
|
|
23
|
+
/**
|
|
24
|
+
* Section content (rendered when expanded)
|
|
25
|
+
*/
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
interface DTAccordionProps {
|
|
29
|
+
/**
|
|
30
|
+
* Array of accordion sections
|
|
31
|
+
*/
|
|
32
|
+
sections: DTAccordionSection[];
|
|
33
|
+
/**
|
|
34
|
+
* Visual variant for section headers
|
|
35
|
+
* @default 'normal'
|
|
36
|
+
*/
|
|
37
|
+
variant?: DTVariant;
|
|
38
|
+
/**
|
|
39
|
+
* Variant color for active/expanded sections
|
|
40
|
+
* @default 'emphasis'
|
|
41
|
+
*/
|
|
42
|
+
activeVariant?: DTVariant;
|
|
43
|
+
/**
|
|
44
|
+
* Allow multiple sections open simultaneously
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
allowMultiple?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Section keys to open initially
|
|
50
|
+
*/
|
|
51
|
+
initialOpenKeys?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Called when a section is toggled
|
|
54
|
+
*/
|
|
55
|
+
onSectionToggle?: (key: string, isOpen: boolean) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Additional styles
|
|
58
|
+
*/
|
|
59
|
+
style?: StyleProp<ViewStyle>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* DT-styled Accordion with animated height expansion
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <DTAccordion
|
|
66
|
+
* sections={[
|
|
67
|
+
* { key: 'size', title: 'Size', children: <SizeFilter /> },
|
|
68
|
+
* { key: 'color', title: 'Color', children: <ColorFilter /> },
|
|
69
|
+
* ]}
|
|
70
|
+
* variant="normal"
|
|
71
|
+
* />
|
|
72
|
+
*/
|
|
73
|
+
export declare function DTAccordion({ sections, variant, activeVariant, allowMultiple, initialOpenKeys, onSectionToggle, style, }: DTAccordionProps): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=DTAccordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTAccordion.d.ts","sourceRoot":"","sources":["../../src/components/DTAccordion.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAGL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,UAAU,gBAAgB;IACxB;;OAEG;IACH,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAkB,EAClB,aAA0B,EAC1B,aAAqB,EACrB,eAAe,EACf,eAAe,EACf,KAAK,GACN,EAAE,gBAAgB,2CAuClB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DT Accordion Component
|
|
4
|
+
*
|
|
5
|
+
* Custom-built accordion with animated height expansion following
|
|
6
|
+
* the Dangerous Things angular aesthetic.
|
|
7
|
+
*
|
|
8
|
+
* Web CSS reference (FilterAccordion):
|
|
9
|
+
* - menu-item-clipped style headers with thick top border
|
|
10
|
+
* - Expand/collapse with height animation
|
|
11
|
+
* - Active sections switch to activeVariant color
|
|
12
|
+
*/
|
|
13
|
+
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
14
|
+
import { StyleSheet, View, Pressable, Animated, } from 'react-native';
|
|
15
|
+
import { Text } from 'react-native-paper';
|
|
16
|
+
import { DTColors } from '../theme/colors';
|
|
17
|
+
import { getVariantColor } from '../utils/variantColors';
|
|
18
|
+
/**
|
|
19
|
+
* DT-styled Accordion with animated height expansion
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <DTAccordion
|
|
23
|
+
* sections={[
|
|
24
|
+
* { key: 'size', title: 'Size', children: <SizeFilter /> },
|
|
25
|
+
* { key: 'color', title: 'Color', children: <ColorFilter /> },
|
|
26
|
+
* ]}
|
|
27
|
+
* variant="normal"
|
|
28
|
+
* />
|
|
29
|
+
*/
|
|
30
|
+
export function DTAccordion({ sections, variant = 'normal', activeVariant = 'emphasis', allowMultiple = false, initialOpenKeys, onSectionToggle, style, }) {
|
|
31
|
+
const [openKeys, setOpenKeys] = useState(new Set(initialOpenKeys));
|
|
32
|
+
const toggleSection = useCallback((key) => {
|
|
33
|
+
setOpenKeys(prev => {
|
|
34
|
+
const next = new Set(allowMultiple ? prev : []);
|
|
35
|
+
const isOpening = !prev.has(key);
|
|
36
|
+
if (isOpening) {
|
|
37
|
+
next.add(key);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
next.delete(key);
|
|
41
|
+
}
|
|
42
|
+
onSectionToggle?.(key, isOpening);
|
|
43
|
+
return next;
|
|
44
|
+
});
|
|
45
|
+
}, [allowMultiple, onSectionToggle]);
|
|
46
|
+
const inactiveColor = getVariantColor(variant);
|
|
47
|
+
const activeColor = getVariantColor(activeVariant);
|
|
48
|
+
return (_jsx(View, { style: [styles.container, style], children: sections.map(section => (_jsx(AccordionSection, { section: section, isOpen: openKeys.has(section.key), onToggle: () => toggleSection(section.key), inactiveColor: inactiveColor, activeColor: activeColor }, section.key))) }));
|
|
49
|
+
}
|
|
50
|
+
function AccordionSection({ section, isOpen, onToggle, inactiveColor, activeColor, }) {
|
|
51
|
+
const heightAnim = useRef(new Animated.Value(isOpen ? 1 : 0)).current;
|
|
52
|
+
const chevronAnim = useRef(new Animated.Value(isOpen ? 1 : 0)).current;
|
|
53
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
54
|
+
const [measured, setMeasured] = useState(false);
|
|
55
|
+
const sectionColor = isOpen ? activeColor : inactiveColor;
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
Animated.parallel([
|
|
58
|
+
Animated.timing(heightAnim, {
|
|
59
|
+
toValue: isOpen ? 1 : 0,
|
|
60
|
+
duration: 250,
|
|
61
|
+
useNativeDriver: false,
|
|
62
|
+
}),
|
|
63
|
+
Animated.timing(chevronAnim, {
|
|
64
|
+
toValue: isOpen ? 1 : 0,
|
|
65
|
+
duration: 250,
|
|
66
|
+
useNativeDriver: true,
|
|
67
|
+
}),
|
|
68
|
+
]).start();
|
|
69
|
+
}, [isOpen, heightAnim, chevronAnim]);
|
|
70
|
+
const animatedHeight = heightAnim.interpolate({
|
|
71
|
+
inputRange: [0, 1],
|
|
72
|
+
outputRange: [0, contentHeight],
|
|
73
|
+
});
|
|
74
|
+
const chevronRotate = chevronAnim.interpolate({
|
|
75
|
+
inputRange: [0, 1],
|
|
76
|
+
outputRange: ['0deg', '180deg'],
|
|
77
|
+
});
|
|
78
|
+
return (_jsxs(View, { children: [_jsxs(Pressable, { onPress: onToggle, style: ({ pressed }) => [
|
|
79
|
+
styles.header,
|
|
80
|
+
{
|
|
81
|
+
borderColor: sectionColor,
|
|
82
|
+
borderTopColor: sectionColor,
|
|
83
|
+
opacity: pressed ? 0.7 : 1,
|
|
84
|
+
},
|
|
85
|
+
], children: [_jsx(Text, { style: [styles.title, { color: sectionColor }], children: section.title }), _jsx(Animated.View, { style: [
|
|
86
|
+
styles.chevron,
|
|
87
|
+
{ transform: [{ rotate: chevronRotate }] },
|
|
88
|
+
], children: _jsx(View, { style: [styles.chevronArrow, { borderTopColor: sectionColor }] }) })] }), _jsx(Animated.View, { style: [
|
|
89
|
+
styles.contentWrapper,
|
|
90
|
+
{
|
|
91
|
+
height: measured ? animatedHeight : undefined,
|
|
92
|
+
overflow: 'hidden',
|
|
93
|
+
},
|
|
94
|
+
], children: _jsx(View, { style: styles.content, onLayout: e => {
|
|
95
|
+
const h = e.nativeEvent.layout.height;
|
|
96
|
+
if (h > 0 && !measured) {
|
|
97
|
+
setContentHeight(h);
|
|
98
|
+
setMeasured(true);
|
|
99
|
+
if (!isOpen) {
|
|
100
|
+
heightAnim.setValue(0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, children: section.children }) })] }));
|
|
104
|
+
}
|
|
105
|
+
const styles = StyleSheet.create({
|
|
106
|
+
container: {
|
|
107
|
+
gap: 4,
|
|
108
|
+
},
|
|
109
|
+
header: {
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
justifyContent: 'space-between',
|
|
113
|
+
backgroundColor: DTColors.dark,
|
|
114
|
+
borderWidth: 1,
|
|
115
|
+
borderTopWidth: 5,
|
|
116
|
+
paddingVertical: 12,
|
|
117
|
+
paddingHorizontal: 16,
|
|
118
|
+
},
|
|
119
|
+
title: {
|
|
120
|
+
fontWeight: '600',
|
|
121
|
+
letterSpacing: 0.5,
|
|
122
|
+
textTransform: 'uppercase',
|
|
123
|
+
fontSize: 14,
|
|
124
|
+
},
|
|
125
|
+
contentWrapper: {},
|
|
126
|
+
content: {
|
|
127
|
+
paddingHorizontal: 16,
|
|
128
|
+
paddingVertical: 12,
|
|
129
|
+
backgroundColor: DTColors.dark,
|
|
130
|
+
},
|
|
131
|
+
chevron: {
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
width: 24,
|
|
135
|
+
height: 24,
|
|
136
|
+
},
|
|
137
|
+
chevronArrow: {
|
|
138
|
+
width: 0,
|
|
139
|
+
height: 0,
|
|
140
|
+
borderLeftWidth: 6,
|
|
141
|
+
borderRightWidth: 6,
|
|
142
|
+
borderTopWidth: 8,
|
|
143
|
+
borderLeftColor: 'transparent',
|
|
144
|
+
borderRightColor: 'transparent',
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=DTAccordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTAccordion.js","sourceRoot":"","sources":["../../src/components/DTAccordion.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EACL,UAAU,EACV,IAAI,EAGJ,SAAS,EACT,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAiB,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAmDvE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GAAG,QAAQ,EAClB,aAAa,GAAG,UAAU,EAC1B,aAAa,GAAG,KAAK,EACrB,eAAe,EACf,eAAe,EACf,KAAK,GACY;IACjB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CACtC,IAAI,GAAG,CAAC,eAAe,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,GAAW,EAAE,EAAE;QACd,WAAW,CAAC,IAAI,CAAC,EAAE;YACjB,MAAM,IAAI,GA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A themed button following the Dangerous Things design language
|
|
5
|
+
* with SVG-based beveled corners.
|
|
6
|
+
*/
|
|
7
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
8
|
+
import { type DTVariant } from '../utils/variantColors';
|
|
9
|
+
interface DTButtonProps {
|
|
10
|
+
/**
|
|
11
|
+
* Button content/label
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Visual variant of the button
|
|
16
|
+
* @default 'normal'
|
|
17
|
+
*/
|
|
18
|
+
variant?: DTVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Button display mode
|
|
21
|
+
* - 'outlined': Border with transparent background (default)
|
|
22
|
+
* - 'contained': Filled background
|
|
23
|
+
* @default 'outlined'
|
|
24
|
+
*/
|
|
25
|
+
mode?: 'outlined' | 'contained';
|
|
26
|
+
/**
|
|
27
|
+
* Custom color (overrides variant)
|
|
28
|
+
*/
|
|
29
|
+
color?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Press handler
|
|
32
|
+
*/
|
|
33
|
+
onPress?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Whether button is disabled
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Additional styles for container
|
|
40
|
+
*/
|
|
41
|
+
style?: StyleProp<ViewStyle>;
|
|
42
|
+
/**
|
|
43
|
+
* Border width
|
|
44
|
+
* @default 2
|
|
45
|
+
*/
|
|
46
|
+
borderWidth?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Bevel size in pixels
|
|
49
|
+
* @default 8
|
|
50
|
+
*/
|
|
51
|
+
bevelSize?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* DT-styled Button component with SVG beveled corners
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* <DTButton variant="normal" onPress={handleScan}>
|
|
58
|
+
* Scan NFC Tag
|
|
59
|
+
* </DTButton>
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <DTButton variant="emphasis" mode="contained" onPress={handleAction}>
|
|
63
|
+
* View Results
|
|
64
|
+
* </DTButton>
|
|
65
|
+
*/
|
|
66
|
+
export declare function DTButton({ children, variant, mode, color, onPress, disabled, style, borderWidth, bevelSize, }: DTButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=DTButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTButton.d.ts","sourceRoot":"","sources":["../../src/components/DTButton.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmB,SAAS,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AAKvE,UAAU,aAAa;IACrB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAkB,EAClB,IAAiB,EACjB,KAAK,EACL,OAAO,EACP,QAAgB,EAChB,KAAK,EACL,WAAe,EACf,SAAa,GACd,EAAE,aAAa,2CA8Cf"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DT Button Component
|
|
4
|
+
*
|
|
5
|
+
* A themed button following the Dangerous Things design language
|
|
6
|
+
* with SVG-based beveled corners.
|
|
7
|
+
*/
|
|
8
|
+
import { StyleSheet, View, Pressable } from 'react-native';
|
|
9
|
+
import { Text } from 'react-native-paper';
|
|
10
|
+
import Svg, { Path } from 'react-native-svg';
|
|
11
|
+
import { DTColors } from '../theme/colors';
|
|
12
|
+
import { getVariantColor } from '../utils/variantColors';
|
|
13
|
+
import { buildButtonBevelPath } from '../utils/bevelPaths';
|
|
14
|
+
import { useComponentLayout } from '../utils/useComponentLayout';
|
|
15
|
+
import { useState } from 'react';
|
|
16
|
+
/**
|
|
17
|
+
* DT-styled Button component with SVG beveled corners
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <DTButton variant="normal" onPress={handleScan}>
|
|
21
|
+
* Scan NFC Tag
|
|
22
|
+
* </DTButton>
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <DTButton variant="emphasis" mode="contained" onPress={handleAction}>
|
|
26
|
+
* View Results
|
|
27
|
+
* </DTButton>
|
|
28
|
+
*/
|
|
29
|
+
export function DTButton({ children, variant = 'normal', mode = 'outlined', color, onPress, disabled = false, style, borderWidth = 2, bevelSize = 8, }) {
|
|
30
|
+
const { dimensions, onLayout, hasDimensions } = useComponentLayout();
|
|
31
|
+
const [pressed, setPressed] = useState(false);
|
|
32
|
+
const accentColor = getVariantColor(variant, color);
|
|
33
|
+
const isContained = mode === 'contained';
|
|
34
|
+
const bgColor = isContained ? accentColor : 'transparent';
|
|
35
|
+
const textColor = isContained ? DTColors.dark : accentColor;
|
|
36
|
+
const { width, height } = dimensions;
|
|
37
|
+
const opacity = disabled ? 0.5 : pressed ? 0.7 : 1;
|
|
38
|
+
return (_jsx(Pressable, { onPress: onPress, disabled: disabled, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false), style: [{ opacity }, style], children: _jsxs(View, { style: styles.container, onLayout: onLayout, children: [hasDimensions && (_jsx(Svg, { style: StyleSheet.absoluteFill, width: width, height: height, viewBox: `0 0 ${width} ${height}`, children: _jsx(Path, { d: buildButtonBevelPath(width, height, bevelSize, borderWidth), fill: bgColor, stroke: accentColor, strokeWidth: borderWidth }) })), _jsx(View, { style: styles.content, children: typeof children === 'string' ? (_jsx(Text, { variant: "labelLarge", style: [styles.label, { color: textColor }], children: children })) : (children) })] }) }));
|
|
39
|
+
}
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
container: {
|
|
42
|
+
position: 'relative',
|
|
43
|
+
minHeight: 44,
|
|
44
|
+
},
|
|
45
|
+
content: {
|
|
46
|
+
position: 'relative',
|
|
47
|
+
zIndex: 1,
|
|
48
|
+
paddingVertical: 12,
|
|
49
|
+
paddingHorizontal: 24,
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
},
|
|
53
|
+
label: {
|
|
54
|
+
fontWeight: '600',
|
|
55
|
+
letterSpacing: 1,
|
|
56
|
+
textTransform: 'uppercase',
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=DTButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTButton.js","sourceRoot":"","sources":["../../src/components/DTButton.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAC,UAAU,EAAE,IAAI,EAAwB,SAAS,EAAC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,GAAG,EAAE,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAiB,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,oBAAoB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
|
|
1
|
+
/**
|
|
2
|
+
* DT Card Component
|
|
3
|
+
*
|
|
4
|
+
* A themed card following the Dangerous Things design language
|
|
5
|
+
* with SVG-based beveled corners matching the web storefront style.
|
|
6
|
+
*
|
|
7
|
+
* Web CSS reference:
|
|
8
|
+
* - Bottom-right bevel: 2em (~32px)
|
|
9
|
+
* - Bottom-left bevel: 1em (~16px)
|
|
10
|
+
* - Border width: 0.2em (~3px)
|
|
11
|
+
*/
|
|
12
|
+
import { ReactNode } from 'react';
|
|
13
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
14
|
+
import { type DTVariant } from '../utils/variantColors';
|
|
15
|
+
interface DTCardProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Color mode for the card accent
|
|
19
|
+
* @default 'normal'
|
|
20
|
+
*/
|
|
21
|
+
mode?: DTVariant;
|
|
22
|
+
/**
|
|
23
|
+
* Custom border color (overrides mode)
|
|
24
|
+
*/
|
|
25
|
+
borderColor?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Card title (displayed in header)
|
|
28
|
+
*/
|
|
29
|
+
title?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to show the accent header bar
|
|
32
|
+
* @default true when title is provided
|
|
33
|
+
*/
|
|
34
|
+
showHeader?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Additional styles for the card container
|
|
37
|
+
*/
|
|
38
|
+
style?: StyleProp<ViewStyle>;
|
|
39
|
+
/**
|
|
40
|
+
* Additional styles for the content area
|
|
41
|
+
*/
|
|
42
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
43
|
+
/**
|
|
44
|
+
* Inner content padding
|
|
45
|
+
* @default 16
|
|
46
|
+
*/
|
|
47
|
+
padding?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Border width in pixels
|
|
50
|
+
* @default 3
|
|
51
|
+
*/
|
|
52
|
+
borderWidth?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Bottom-right bevel size in pixels
|
|
55
|
+
* @default 32
|
|
56
|
+
*/
|
|
57
|
+
bevelSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Bottom-left bevel size in pixels (smaller accent bevel)
|
|
60
|
+
* @default 16
|
|
61
|
+
*/
|
|
62
|
+
bevelSizeSmall?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Background color
|
|
65
|
+
* @default '#000000'
|
|
66
|
+
*/
|
|
67
|
+
backgroundColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Press handler
|
|
70
|
+
*/
|
|
71
|
+
onPress?: () => void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* DT-styled Card component with SVG beveled corners
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* <DTCard title="Detected Chip" mode="normal">
|
|
78
|
+
* <Text>NTAG215</Text>
|
|
79
|
+
* </DTCard>
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* <DTCard mode="emphasis" onPress={handlePress}>
|
|
83
|
+
* <Text>Tap to scan</Text>
|
|
84
|
+
* </DTCard>
|
|
85
|
+
*/
|
|
86
|
+
export declare function DTCard({ children, mode, borderColor, title, showHeader, style, contentStyle, padding, borderWidth, bevelSize, bevelSizeSmall, backgroundColor, onPress, }: DTCardProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
/**
|
|
88
|
+
* DT design system constants matching web CSS variables
|
|
89
|
+
*/
|
|
90
|
+
export declare const DTCardClipPath: {
|
|
91
|
+
css: string;
|
|
92
|
+
bevelSize: number;
|
|
93
|
+
bevelSizeSmall: number;
|
|
94
|
+
borderWidth: number;
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=DTCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTCard.d.ts","sourceRoot":"","sources":["../../src/components/DTCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAmB,SAAS,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AAIvE,UAAU,WAAW;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,IAAe,EACf,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,YAAY,EACZ,OAAY,EACZ,WAAe,EACf,SAAc,EACd,cAAmB,EACnB,eAA2B,EAC3B,OAAO,GACR,EAAE,WAAW,2CAuEb;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;CAc1B,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, View, Pressable } from 'react-native';
|
|
3
|
+
import { Text } from 'react-native-paper';
|
|
4
|
+
import Svg, { Path } from 'react-native-svg';
|
|
5
|
+
import { DTColors } from '../theme/colors';
|
|
6
|
+
import { getVariantColor } from '../utils/variantColors';
|
|
7
|
+
import { buildCardBevelPath } from '../utils/bevelPaths';
|
|
8
|
+
import { useComponentLayout } from '../utils/useComponentLayout';
|
|
9
|
+
/**
|
|
10
|
+
* DT-styled Card component with SVG beveled corners
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <DTCard title="Detected Chip" mode="normal">
|
|
14
|
+
* <Text>NTAG215</Text>
|
|
15
|
+
* </DTCard>
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <DTCard mode="emphasis" onPress={handlePress}>
|
|
19
|
+
* <Text>Tap to scan</Text>
|
|
20
|
+
* </DTCard>
|
|
21
|
+
*/
|
|
22
|
+
export function DTCard({ children, mode = 'normal', borderColor, title, showHeader, style, contentStyle, padding = 16, borderWidth = 3, bevelSize = 32, bevelSizeSmall = 16, backgroundColor = '#000000', onPress, }) {
|
|
23
|
+
const { dimensions, onLayout, hasDimensions } = useComponentLayout();
|
|
24
|
+
const accentColor = getVariantColor(mode, borderColor);
|
|
25
|
+
const shouldShowHeader = showHeader ?? !!title;
|
|
26
|
+
const { width, height } = dimensions;
|
|
27
|
+
// Outer bevel path (full card shape)
|
|
28
|
+
const outerPath = hasDimensions
|
|
29
|
+
? buildCardBevelPath(width, height, bevelSize, bevelSizeSmall, 0)
|
|
30
|
+
: '';
|
|
31
|
+
// Inner bevel path at border inset (for background + frame cutout)
|
|
32
|
+
const innerPath = hasDimensions
|
|
33
|
+
? buildCardBevelPath(width, height, bevelSize - borderWidth, bevelSizeSmall - borderWidth, borderWidth)
|
|
34
|
+
: '';
|
|
35
|
+
const content = (_jsxs(View, { style: [styles.container, style], onLayout: onLayout, children: [hasDimensions && (_jsx(Svg, { style: StyleSheet.absoluteFill, width: width, height: height, viewBox: `0 0 ${width} ${height}`, children: _jsx(Path, { d: innerPath, fill: backgroundColor }) })), _jsxs(View, { style: styles.innerContainer, children: [shouldShowHeader && (_jsx(View, { style: [styles.header, { backgroundColor: accentColor }], children: title && (_jsx(Text, { variant: "titleMedium", style: [styles.headerText, { color: DTColors.dark }], children: title })) })), _jsx(View, { style: [styles.content, { padding }, contentStyle], children: children })] }), hasDimensions && (_jsx(Svg, { style: [StyleSheet.absoluteFill, styles.frameOverlay], width: width, height: height, viewBox: `0 0 ${width} ${height}`, pointerEvents: "none", children: _jsx(Path, { d: outerPath + ' ' + innerPath, fillRule: "evenodd", fill: accentColor }) }))] }));
|
|
36
|
+
if (onPress) {
|
|
37
|
+
return (_jsx(Pressable, { onPress: onPress, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: content }));
|
|
38
|
+
}
|
|
39
|
+
return content;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* DT design system constants matching web CSS variables
|
|
43
|
+
*/
|
|
44
|
+
export const DTCardClipPath = {
|
|
45
|
+
// CSS-style clip path (for web reference)
|
|
46
|
+
css: `polygon(
|
|
47
|
+
0% 0%,
|
|
48
|
+
100% 0%,
|
|
49
|
+
100% calc(100% - 2em),
|
|
50
|
+
calc(100% - 2em) 100%,
|
|
51
|
+
1em 100%,
|
|
52
|
+
0% calc(100% - 1em)
|
|
53
|
+
)`,
|
|
54
|
+
// Default bevel sizes in pixels (matching 2em and 1em at 16px base)
|
|
55
|
+
bevelSize: 32,
|
|
56
|
+
bevelSizeSmall: 16,
|
|
57
|
+
borderWidth: 3,
|
|
58
|
+
};
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
container: {
|
|
61
|
+
position: 'relative',
|
|
62
|
+
},
|
|
63
|
+
innerContainer: {
|
|
64
|
+
position: 'relative',
|
|
65
|
+
zIndex: 1,
|
|
66
|
+
overflow: 'hidden',
|
|
67
|
+
},
|
|
68
|
+
header: {
|
|
69
|
+
paddingHorizontal: 16,
|
|
70
|
+
paddingVertical: 12,
|
|
71
|
+
},
|
|
72
|
+
headerText: {
|
|
73
|
+
fontWeight: '700',
|
|
74
|
+
letterSpacing: 0.5,
|
|
75
|
+
},
|
|
76
|
+
content: {},
|
|
77
|
+
frameOverlay: {
|
|
78
|
+
zIndex: 2,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=DTCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTCard.js","sourceRoot":"","sources":["../../src/components/DTCard.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAwB,SAAS,EAAC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,GAAG,EAAE,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAiB,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AA6D/D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,YAAY,EACZ,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,CAAC,EACf,SAAS,GAAG,EAAE,EACd,cAAc,GAAG,EAAE,EACnB,eAAe,GAAG,SAAS,EAC3B,OAAO,GACK;IACZ,MAAM,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,GAAG,kBAAkB,EAAE,CAAC;IACnE,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC;IAE/C,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B,aAAa,EAAE,GAAG;KACnB;IACD,OAAO,EAAE,EAAE;IACX,YAAY,EAAE;QACZ,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DT Checkbox Component
|
|
3
|
+
*
|
|
4
|
+
* Custom-built angular checkbox following the Dangerous Things design language.
|
|
5
|
+
* Uses SVG for beveled shape and checkmark — RNP Checkbox enforces
|
|
6
|
+
* rounded corners (borderRadius: 18) so we build from scratch.
|
|
7
|
+
*
|
|
8
|
+
* Uses diagonal-symmetry bevels (top-left + bottom-right) on the indicator.
|
|
9
|
+
*/
|
|
10
|
+
import { ViewStyle, TextStyle, StyleProp } from 'react-native';
|
|
11
|
+
import { type DTVariant } from '../utils/variantColors';
|
|
12
|
+
interface DTCheckboxProps {
|
|
13
|
+
/**
|
|
14
|
+
* Whether the checkbox is checked
|
|
15
|
+
*/
|
|
16
|
+
checked: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Press handler to toggle state
|
|
19
|
+
*/
|
|
20
|
+
onPress: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Visual variant
|
|
23
|
+
* @default 'normal'
|
|
24
|
+
*/
|
|
25
|
+
variant?: DTVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Label text displayed beside the checkbox
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the checkbox is disabled
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Size of the checkbox in pixels
|
|
36
|
+
* @default 24
|
|
37
|
+
*/
|
|
38
|
+
size?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Custom color (overrides variant)
|
|
41
|
+
*/
|
|
42
|
+
color?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Additional styles for the container
|
|
45
|
+
*/
|
|
46
|
+
style?: StyleProp<ViewStyle>;
|
|
47
|
+
/**
|
|
48
|
+
* Additional styles for the label text
|
|
49
|
+
*/
|
|
50
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* DT-styled Checkbox with beveled opposing corners (top-left + bottom-right)
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* <DTCheckbox checked={isChecked} onPress={() => setChecked(!isChecked)} label="Remember me" />
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* <DTCheckbox checked={true} onPress={toggle} variant="success" label="Accepted" />
|
|
60
|
+
*/
|
|
61
|
+
export declare function DTCheckbox({ checked, onPress, variant, label, disabled, size, color, style, labelStyle, }: DTCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=DTCheckbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DTCheckbox.d.ts","sourceRoot":"","sources":["../../src/components/DTCheckbox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAa,SAAS,EAAE,SAAS,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAIpF,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AAGvE,UAAU,eAAe;IACvB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,OAAO,EACP,OAAkB,EAClB,KAAK,EACL,QAAgB,EAChB,IAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,GACX,EAAE,eAAe,2CAgDjB"}
|