@duro-app/ui 0.34.7 → 0.34.8
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/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/styles.css.d.ts +3 -0
- package/dist/components/Badge/styles.css.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/styles.css.d.ts +3 -0
- package/dist/components/Button/styles.css.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/styles.css.d.ts +3 -0
- package/dist/components/Checkbox/styles.css.d.ts.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/components/InputGroup/styles.css.d.ts +3 -0
- package/dist/components/InputGroup/styles.css.d.ts.map +1 -1
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/styles.css.d.ts +3 -0
- package/dist/components/Switch/styles.css.d.ts.map +1 -1
- package/dist/index.js +866 -858
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +12 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.native.d.ts +2 -0
- package/dist/platform.native.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/Badge/Badge.tsx +6 -1
- package/src/components/Badge/styles.css.ts +5 -0
- package/src/components/Button/Button.tsx +2 -0
- package/src/components/Button/styles.css.ts +5 -0
- package/src/components/Checkbox/Checkbox.tsx +9 -2
- package/src/components/Checkbox/styles.css.ts +5 -0
- package/src/components/InputGroup/InputGroup.tsx +2 -0
- package/src/components/InputGroup/styles.css.ts +5 -0
- package/src/components/Switch/Switch.tsx +4 -1
- package/src/components/Switch/styles.css.ts +5 -0
- package/src/platform.native.ts +3 -0
- package/src/platform.ts +11 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform flag resolved by the bundler's platform extensions: web bundlers
|
|
3
|
+
* (Vite/Rollup) read THIS file (`isNative = false`); Metro reads
|
|
4
|
+
* `platform.native.ts` (`isNative = true`) on React Native / Expo.
|
|
5
|
+
*
|
|
6
|
+
* It lets shared components layer a native-only style override without
|
|
7
|
+
* importing `react-native` on web (the DS web build has no react-native).
|
|
8
|
+
* Typed `boolean` (not the `false` literal) so `isNative && styles.x` stays a
|
|
9
|
+
* `false | Style` union in style arrays rather than narrowing to `false`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isNative: boolean;
|
|
12
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.native.d.ts","sourceRoot":"","sources":["../src/platform.native.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,EAAE,OAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duro-app/ui",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@duro-app/tokens": "^0.34.
|
|
57
|
+
"@duro-app/tokens": "^0.34.8"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@babel/preset-typescript": "^7.28.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
import {html} from 'react-strict-dom'
|
|
3
|
+
import {isNative} from '../../platform'
|
|
3
4
|
import {styles} from './styles.css'
|
|
4
5
|
|
|
5
6
|
export type BadgeVariant = 'default' | 'success' | 'warning' | 'error' | 'info'
|
|
@@ -17,5 +18,9 @@ const sizeMap = {
|
|
|
17
18
|
} as const
|
|
18
19
|
|
|
19
20
|
export function Badge({variant = 'default', size = 'md', children}: BadgeProps) {
|
|
20
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
<html.span style={[styles.base, isNative && styles.nativeFlex, sizeMap[size], styles[variant]]}>
|
|
23
|
+
{children}
|
|
24
|
+
</html.span>
|
|
25
|
+
)
|
|
21
26
|
}
|
|
@@ -48,4 +48,9 @@ export const styles = css.create({
|
|
|
48
48
|
backgroundColor: colors.infoBg,
|
|
49
49
|
color: colors.infoText,
|
|
50
50
|
},
|
|
51
|
+
// RSD-native only honors display:'flex' (not 'inline-flex'). Layered on
|
|
52
|
+
// native via `isNative` so the flex container applies; web keeps inline-flex.
|
|
53
|
+
nativeFlex: {
|
|
54
|
+
display: 'flex',
|
|
55
|
+
},
|
|
51
56
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
import {html} from 'react-strict-dom'
|
|
3
|
+
import {isNative} from '../../platform'
|
|
3
4
|
import {styles} from './styles.css'
|
|
4
5
|
|
|
5
6
|
export type ButtonVariant = 'primary' | 'secondary' | 'inverseSecondary' | 'link' | 'danger'
|
|
@@ -36,6 +37,7 @@ export function Button({
|
|
|
36
37
|
onClick={onClick}
|
|
37
38
|
style={[
|
|
38
39
|
styles.base,
|
|
40
|
+
isNative && styles.nativeFlex,
|
|
39
41
|
sizeMap[size],
|
|
40
42
|
styles[variant],
|
|
41
43
|
fullWidth && styles.fullWidth,
|
|
@@ -116,4 +116,9 @@ export const styles = css.create({
|
|
|
116
116
|
opacity: 0.5,
|
|
117
117
|
cursor: 'not-allowed',
|
|
118
118
|
},
|
|
119
|
+
// RSD-native only honors display:'flex' (not 'inline-flex'). Layered on
|
|
120
|
+
// native via `isNative` so the flex container applies; web keeps inline-flex.
|
|
121
|
+
nativeFlex: {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
},
|
|
119
124
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {type ReactNode, useState, useCallback} from 'react'
|
|
2
2
|
import {html} from 'react-strict-dom'
|
|
3
|
+
import {isNative} from '../../platform'
|
|
3
4
|
import {styles} from './styles.css'
|
|
4
5
|
|
|
5
6
|
interface CheckboxProps {
|
|
@@ -39,7 +40,9 @@ export function Checkbox({
|
|
|
39
40
|
)
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
|
-
<html.label
|
|
43
|
+
<html.label
|
|
44
|
+
style={[styles.root, isNative && styles.nativeFlex, disabled && styles.rootDisabled]}
|
|
45
|
+
>
|
|
43
46
|
<html.input
|
|
44
47
|
type="checkbox"
|
|
45
48
|
name={name}
|
|
@@ -52,7 +55,11 @@ export function Checkbox({
|
|
|
52
55
|
style={styles.input}
|
|
53
56
|
/>
|
|
54
57
|
<html.span
|
|
55
|
-
style={[
|
|
58
|
+
style={[
|
|
59
|
+
styles.box,
|
|
60
|
+
isNative && styles.nativeFlex,
|
|
61
|
+
isChecked ? styles.boxChecked : styles.boxUnchecked,
|
|
62
|
+
]}
|
|
56
63
|
aria-hidden
|
|
57
64
|
>
|
|
58
65
|
<svg
|
|
@@ -54,4 +54,9 @@ export const styles = css.create({
|
|
|
54
54
|
opacity: 0,
|
|
55
55
|
overflow: 'hidden',
|
|
56
56
|
},
|
|
57
|
+
// RSD-native only honors display:'flex' (not 'inline-flex'). Layered on
|
|
58
|
+
// native via `isNative` (on both .root and .box); web keeps inline-flex.
|
|
59
|
+
nativeFlex: {
|
|
60
|
+
display: 'flex',
|
|
61
|
+
},
|
|
57
62
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
import {useMemo} from 'react'
|
|
3
3
|
import {css, html} from 'react-strict-dom'
|
|
4
|
+
import {isNative} from '../../platform'
|
|
4
5
|
import {InputGroupContext} from './InputGroupContext'
|
|
5
6
|
import {styles} from './styles.css'
|
|
6
7
|
|
|
@@ -37,6 +38,7 @@ function Addon({position = 'end', onClick, disabled, minWidth, children}: AddonP
|
|
|
37
38
|
const positionStyle = position === 'start' ? styles.addonStart : styles.addonEnd
|
|
38
39
|
const style = [
|
|
39
40
|
styles.addon,
|
|
41
|
+
isNative && styles.nativeFlex,
|
|
40
42
|
positionStyle,
|
|
41
43
|
onClick && !disabled && styles.addonClickable,
|
|
42
44
|
disabled && styles.addonDisabled,
|
|
@@ -58,4 +58,9 @@ export const styles = css.create({
|
|
|
58
58
|
opacity: 0.4,
|
|
59
59
|
cursor: 'not-allowed',
|
|
60
60
|
},
|
|
61
|
+
// RSD-native only honors display:'flex' (not 'inline-flex'). Layered on
|
|
62
|
+
// native via `isNative` so the flex container applies; web keeps inline-flex.
|
|
63
|
+
nativeFlex: {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
},
|
|
61
66
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {type ReactNode, useCallback, useRef} from 'react'
|
|
2
2
|
import {html} from 'react-strict-dom'
|
|
3
|
+
import {isNative} from '../../platform'
|
|
3
4
|
import {useControllableValue} from '../../hooks/useControllableValue'
|
|
4
5
|
import {styles} from './styles.css'
|
|
5
6
|
|
|
@@ -46,7 +47,9 @@ export function Switch({
|
|
|
46
47
|
}, [disabled, checked, setChecked])
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<html.label
|
|
50
|
+
<html.label
|
|
51
|
+
style={[styles.root, isNative && styles.nativeFlex, disabled && styles.rootDisabled]}
|
|
52
|
+
>
|
|
50
53
|
<html.input
|
|
51
54
|
ref={inputRef}
|
|
52
55
|
type="checkbox"
|
|
@@ -68,4 +68,9 @@ export const styles = css.create({
|
|
|
68
68
|
opacity: 0,
|
|
69
69
|
overflow: 'hidden',
|
|
70
70
|
},
|
|
71
|
+
// RSD-native only honors display:'flex' (not 'inline-flex'). Layered on
|
|
72
|
+
// native via `isNative` so the flex container applies; web keeps inline-flex.
|
|
73
|
+
nativeFlex: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
},
|
|
71
76
|
})
|
package/src/platform.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform flag resolved by the bundler's platform extensions: web bundlers
|
|
3
|
+
* (Vite/Rollup) read THIS file (`isNative = false`); Metro reads
|
|
4
|
+
* `platform.native.ts` (`isNative = true`) on React Native / Expo.
|
|
5
|
+
*
|
|
6
|
+
* It lets shared components layer a native-only style override without
|
|
7
|
+
* importing `react-native` on web (the DS web build has no react-native).
|
|
8
|
+
* Typed `boolean` (not the `false` literal) so `isNative && styles.x` stays a
|
|
9
|
+
* `false | Style` union in style arrays rather than narrowing to `false`.
|
|
10
|
+
*/
|
|
11
|
+
export const isNative: boolean = false
|