@xaui/native 0.9.1-alpha.25 → 0.9.1-alpha.27
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/chunk-2EBB5BO3.cjs +361 -0
- package/dist/chunk-3LKGVKQY.cjs +145 -0
- package/dist/{chunk-MRYLLKML.js → chunk-56KVKM27.js} +15 -15
- package/dist/{chunk-GSEK6OCY.cjs → chunk-5OXZIZRZ.cjs} +7 -7
- package/dist/{chunk-BULNTP5N.cjs → chunk-63TWVWHG.cjs} +9 -45
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/{chunk-EWBBDVTM.cjs → chunk-CQRUNV6S.cjs} +15 -15
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/{chunk-YEW5LPWL.cjs → chunk-JCKVYYZO.cjs} +42 -4
- package/dist/chunk-LGVIZAB2.js +503 -0
- package/dist/{chunk-I6UCYAO2.js → chunk-N4UJYDOW.js} +23 -56
- package/dist/{chunk-ZDCGPK5Z.js → chunk-TR2TGPDQ.js} +1 -1
- package/dist/{chunk-2OY76YNB.js → chunk-V2FQN6ZK.js} +42 -4
- package/dist/chunk-WEMZ4VMC.js +145 -0
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.d.cts +1 -1
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/button/index.cjs +3 -3
- package/dist/components/button/index.d.cts +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/card/index.d.cts +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/checkbox/index.cjs +23 -0
- package/dist/components/checkbox/index.d.cts +1137 -0
- package/dist/components/checkbox/index.d.ts +1137 -0
- package/dist/components/checkbox/index.js +23 -0
- package/dist/components/chip/index.cjs +3 -3
- package/dist/components/chip/index.d.cts +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +2 -2
- package/dist/components/input/index.cjs +2 -2
- package/dist/components/input/index.d.cts +6 -6
- package/dist/components/input/index.d.ts +6 -6
- package/dist/components/input/index.js +1 -1
- package/dist/components/input-group/index.cjs +26 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +26 -0
- package/dist/components/input-otp/index.cjs +3 -2
- package/dist/components/input-otp/index.d.cts +3 -3
- package/dist/components/input-otp/index.d.ts +3 -3
- package/dist/components/input-otp/index.js +2 -1
- package/dist/components/text-area/index.cjs +3 -3
- package/dist/components/text-area/index.d.cts +1 -1
- package/dist/components/text-area/index.d.ts +1 -1
- package/dist/components/text-area/index.js +2 -2
- package/dist/components/typography/index.d.cts +1 -1
- package/dist/components/typography/index.d.ts +1 -1
- package/dist/{create-recipe-dBN_ewZc.d.cts → create-recipe-CWvI5ot3.d.cts} +8 -1
- package/dist/{create-recipe-C4JkINrA.d.ts → create-recipe-DUo8doTt.d.ts} +8 -1
- package/dist/index.cjs +44 -10
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +57 -23
- package/dist/{input.type-BpJeUIe8.d.cts → input.type-BUMDlzL9.d.cts} +18 -2
- package/dist/{input.type-DjyZ6P2C.d.ts → input.type-D2qgi03E.d.ts} +18 -2
- package/dist/system/index.cjs +3 -3
- package/dist/system/index.d.cts +2 -2
- package/dist/system/index.d.ts +2 -2
- package/dist/system/index.js +5 -5
- package/package.json +21 -1
- package/dist/{chunk-4J26FA6O.js → chunk-EHARM2EN.js} +3 -3
- package/dist/{chunk-AV5LMFS3.cjs → chunk-H7DVR52Z.cjs} +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -179,41 +179,6 @@ InputOTPSeparator.displayName = "XAUI.InputOTP.Separator";
|
|
|
179
179
|
// src/components/input-otp/input-otp.hook.ts
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
// src/hooks/use-controllable-state.ts
|
|
183
|
-
|
|
184
|
-
function useControllableState({
|
|
185
|
-
value,
|
|
186
|
-
defaultValue,
|
|
187
|
-
onChange
|
|
188
|
-
}) {
|
|
189
|
-
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
190
|
-
const isControlled = value !== void 0;
|
|
191
|
-
const current = isControlled ? value : uncontrolled;
|
|
192
|
-
useControlWarning(isControlled);
|
|
193
|
-
const latest = _react.useRef.call(void 0, current);
|
|
194
|
-
latest.current = current;
|
|
195
|
-
const onChangeRef = _react.useRef.call(void 0, onChange);
|
|
196
|
-
onChangeRef.current = onChange;
|
|
197
|
-
const controlled = _react.useRef.call(void 0, isControlled);
|
|
198
|
-
controlled.current = isControlled;
|
|
199
|
-
const set = _react.useCallback.call(void 0, (next) => {
|
|
200
|
-
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
201
|
-
if (resolved === latest.current) return;
|
|
202
|
-
if (!controlled.current) setUncontrolled(resolved);
|
|
203
|
-
_optionalChain([onChangeRef, 'access', _6 => _6.current, 'optionalCall', _7 => _7(resolved)]);
|
|
204
|
-
}, []);
|
|
205
|
-
return [current, set];
|
|
206
|
-
}
|
|
207
|
-
function useControlWarning(isControlled) {
|
|
208
|
-
const wasControlled = _react.useRef.call(void 0, isControlled);
|
|
209
|
-
if (wasControlled.current !== isControlled) {
|
|
210
|
-
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
211
|
-
`a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
|
|
212
|
-
);
|
|
213
|
-
wasControlled.current = isControlled;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
182
|
// src/components/input-otp/input-otp.utils.ts
|
|
218
183
|
function buildSlots({
|
|
219
184
|
value,
|
|
@@ -240,7 +205,7 @@ function placeholderFor(placeholder, index) {
|
|
|
240
205
|
}
|
|
241
206
|
function extractPastedCode(pasted, maxLength) {
|
|
242
207
|
const match = pasted.match(new RegExp(`(?<!\\d)(\\d{${maxLength}})(?!\\d)`));
|
|
243
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
208
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _6 => _6[1]]), () => ( ""));
|
|
244
209
|
}
|
|
245
210
|
function isPaste(text, previous) {
|
|
246
211
|
return text.length > previous.length + 1;
|
|
@@ -259,7 +224,7 @@ function useInputOTPState({
|
|
|
259
224
|
pattern,
|
|
260
225
|
placeholder
|
|
261
226
|
}) {
|
|
262
|
-
const [value, setValue] = useControllableState({
|
|
227
|
+
const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
263
228
|
value: valueProp,
|
|
264
229
|
defaultValue,
|
|
265
230
|
onChange: onChangeTextProp
|
|
@@ -282,18 +247,18 @@ function useInputOTPState({
|
|
|
282
247
|
const next = candidate.slice(0, current.maxLength);
|
|
283
248
|
if (next.length > 0 && current.regexp && !current.regexp.test(next)) return;
|
|
284
249
|
current.setValue(next);
|
|
285
|
-
if (next.length === current.maxLength) _optionalChain([current, 'access',
|
|
250
|
+
if (next.length === current.maxLength) _optionalChain([current, 'access', _7 => _7.onComplete, 'optionalCall', _8 => _8(next)]);
|
|
286
251
|
}, []);
|
|
287
252
|
const onFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
|
|
288
253
|
const onBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
|
|
289
254
|
const handle = _react.useMemo.call(void 0,
|
|
290
255
|
() => ({
|
|
291
|
-
focus: () => _optionalChain([inputRef, 'access',
|
|
292
|
-
blur: () => _optionalChain([inputRef, 'access',
|
|
256
|
+
focus: () => _optionalChain([inputRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.focus, 'call', _11 => _11()]),
|
|
257
|
+
blur: () => _optionalChain([inputRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.blur, 'call', _14 => _14()]),
|
|
293
258
|
// Both halves: the native buffer and our value. Clearing one and not the other is
|
|
294
259
|
// how a cleared field comes back on the next keystroke.
|
|
295
260
|
clear: () => {
|
|
296
|
-
_optionalChain([inputRef, 'access',
|
|
261
|
+
_optionalChain([inputRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.clear, 'call', _17 => _17()]);
|
|
297
262
|
latest.current.setValue("");
|
|
298
263
|
}
|
|
299
264
|
}),
|
|
@@ -567,7 +532,7 @@ var InputOTPRoot = _react.forwardRef.call(void 0,
|
|
|
567
532
|
isInvalid
|
|
568
533
|
]
|
|
569
534
|
);
|
|
570
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.root, _optionalChain([tint, 'optionalAccess',
|
|
535
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.root, _optionalChain([tint, 'optionalAccess', _18 => _18.root]), styleProps, style], ...rest, children: [
|
|
571
536
|
children,
|
|
572
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
573
538
|
_reactnative.TextInput,
|
|
@@ -616,5 +581,4 @@ var InputOTP2 = Object.assign(InputOTPRoot, {
|
|
|
616
581
|
|
|
617
582
|
|
|
618
583
|
|
|
619
|
-
|
|
620
|
-
exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; exports.useControllableState = useControllableState; exports.buildSlots = buildSlots; exports.extractPastedCode = extractPastedCode; exports.OTP_DIGITS = OTP_DIGITS; exports.OTP_LETTERS = OTP_LETTERS; exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC; exports.inputOTPRecipe = inputOTPRecipe; exports.InputOTP = InputOTP2;
|
|
584
|
+
exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; exports.buildSlots = buildSlots; exports.extractPastedCode = extractPastedCode; exports.OTP_DIGITS = OTP_DIGITS; exports.OTP_LETTERS = OTP_LETTERS; exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC; exports.inputOTPRecipe = inputOTPRecipe; exports.InputOTP = InputOTP2;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-controllable-state.ts
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
function useControllableState({
|
|
8
|
+
value,
|
|
9
|
+
defaultValue,
|
|
10
|
+
onChange
|
|
11
|
+
}) {
|
|
12
|
+
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
13
|
+
const isControlled = value !== void 0;
|
|
14
|
+
const current = isControlled ? value : uncontrolled;
|
|
15
|
+
useControlWarning(isControlled);
|
|
16
|
+
const latest = _react.useRef.call(void 0, current);
|
|
17
|
+
latest.current = current;
|
|
18
|
+
const onChangeRef = _react.useRef.call(void 0, onChange);
|
|
19
|
+
onChangeRef.current = onChange;
|
|
20
|
+
const controlled = _react.useRef.call(void 0, isControlled);
|
|
21
|
+
controlled.current = isControlled;
|
|
22
|
+
const set = _react.useCallback.call(void 0, (next) => {
|
|
23
|
+
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
24
|
+
if (resolved === latest.current) return;
|
|
25
|
+
if (!controlled.current) setUncontrolled(resolved);
|
|
26
|
+
_optionalChain([onChangeRef, 'access', _ => _.current, 'optionalCall', _2 => _2(resolved)]);
|
|
27
|
+
}, []);
|
|
28
|
+
return [current, set];
|
|
29
|
+
}
|
|
30
|
+
function useControlWarning(isControlled) {
|
|
31
|
+
const wasControlled = _react.useRef.call(void 0, isControlled);
|
|
32
|
+
if (wasControlled.current !== isControlled) {
|
|
33
|
+
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
34
|
+
`a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
|
|
35
|
+
);
|
|
36
|
+
wasControlled.current = isControlled;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.useControllableState = useControllableState;
|
|
@@ -36,9 +36,9 @@ function _optionalChain(ops) {
|
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
|
-
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
40
39
|
var _chunkIG4Q3WQOcjs = require('./chunk-IG4Q3WQO.cjs');
|
|
41
40
|
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
41
|
+
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
42
42
|
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
43
43
|
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
44
44
|
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
@@ -110,10 +110,10 @@ function ButtonSpinner({
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
113
|
-
const
|
|
114
|
-
code: "function
|
|
115
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
116
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
113
|
+
const _worklet_3366338208300_init_data = {
|
|
114
|
+
code: "function chunkCQRUNV6SCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
115
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-CQRUNV6S.cjs",
|
|
116
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkCQRUNV6SCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-CQRUNV6S.cjs\"],\"mappings\":\"AAqF6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE/E,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
117
117
|
};
|
|
118
118
|
function SpinningRing({
|
|
119
119
|
style
|
|
@@ -126,28 +126,28 @@ function SpinningRing({
|
|
|
126
126
|
}), -1, false);
|
|
127
127
|
return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
|
|
128
128
|
}, [angle]);
|
|
129
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function
|
|
130
|
-
|
|
129
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkCQRUNV6SCjs1Factory({
|
|
130
|
+
_worklet_3366338208300_init_data,
|
|
131
131
|
angle
|
|
132
132
|
}) {
|
|
133
133
|
const _e = [new global.Error(), -2, -27];
|
|
134
|
-
const
|
|
134
|
+
const chunkCQRUNV6SCjs1 = function () {
|
|
135
135
|
return {
|
|
136
136
|
transform: [{
|
|
137
137
|
rotate: `${angle.value}deg`
|
|
138
138
|
}]
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
chunkCQRUNV6SCjs1.__closure = {
|
|
142
142
|
angle
|
|
143
143
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
144
|
+
chunkCQRUNV6SCjs1.__workletHash = 3366338208300;
|
|
145
|
+
chunkCQRUNV6SCjs1.__pluginVersion = "0.7.4";
|
|
146
|
+
chunkCQRUNV6SCjs1.__initData = _worklet_3366338208300_init_data;
|
|
147
|
+
chunkCQRUNV6SCjs1.__stackDetails = _e;
|
|
148
|
+
return chunkCQRUNV6SCjs1;
|
|
149
149
|
}({
|
|
150
|
-
|
|
150
|
+
_worklet_3366338208300_init_data,
|
|
151
151
|
angle
|
|
152
152
|
}), [angle]);
|
|
153
153
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
warnDev
|
|
3
|
+
} from "./chunk-EGLLDKN6.js";
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-controllable-state.ts
|
|
6
|
+
import { useCallback, useRef, useState } from "react";
|
|
7
|
+
function useControllableState({
|
|
8
|
+
value,
|
|
9
|
+
defaultValue,
|
|
10
|
+
onChange
|
|
11
|
+
}) {
|
|
12
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
13
|
+
const isControlled = value !== void 0;
|
|
14
|
+
const current = isControlled ? value : uncontrolled;
|
|
15
|
+
useControlWarning(isControlled);
|
|
16
|
+
const latest = useRef(current);
|
|
17
|
+
latest.current = current;
|
|
18
|
+
const onChangeRef = useRef(onChange);
|
|
19
|
+
onChangeRef.current = onChange;
|
|
20
|
+
const controlled = useRef(isControlled);
|
|
21
|
+
controlled.current = isControlled;
|
|
22
|
+
const set = useCallback((next) => {
|
|
23
|
+
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
24
|
+
if (resolved === latest.current) return;
|
|
25
|
+
if (!controlled.current) setUncontrolled(resolved);
|
|
26
|
+
onChangeRef.current?.(resolved);
|
|
27
|
+
}, []);
|
|
28
|
+
return [current, set];
|
|
29
|
+
}
|
|
30
|
+
function useControlWarning(isControlled) {
|
|
31
|
+
const wasControlled = useRef(isControlled);
|
|
32
|
+
if (wasControlled.current !== isControlled) {
|
|
33
|
+
warnDev(
|
|
34
|
+
`a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
|
|
35
|
+
);
|
|
36
|
+
wasControlled.current = isControlled;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
useControllableState
|
|
42
|
+
};
|
|
@@ -130,7 +130,10 @@ var SLOTS = [
|
|
|
130
130
|
"textArea",
|
|
131
131
|
"placeholder",
|
|
132
132
|
"description",
|
|
133
|
-
"error"
|
|
133
|
+
"error",
|
|
134
|
+
"prefix",
|
|
135
|
+
"suffix",
|
|
136
|
+
"icon"
|
|
134
137
|
];
|
|
135
138
|
var VARIANT_TOKENS = {
|
|
136
139
|
primary: {
|
|
@@ -156,13 +159,17 @@ var VARIANT_TOKENS = {
|
|
|
156
159
|
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
157
160
|
};
|
|
158
161
|
function sizeAxis(step) {
|
|
159
|
-
const { control, padding, gap, field, label, help, textAreaPadding } = step;
|
|
162
|
+
const { control, padding, gap, field, label, help, glyph, textAreaPadding } = step;
|
|
160
163
|
return (theme) => {
|
|
161
164
|
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
162
165
|
const helpType = {
|
|
163
166
|
fontSize: theme.fontSizes[help],
|
|
164
167
|
lineHeight: theme.lineHeights[help]
|
|
165
168
|
};
|
|
169
|
+
const decorator = {
|
|
170
|
+
paddingHorizontal: theme.spacing(padding),
|
|
171
|
+
gap: theme.spacing(padding)
|
|
172
|
+
};
|
|
166
173
|
return {
|
|
167
174
|
root: { gap: theme.spacing(gap) },
|
|
168
175
|
label: {
|
|
@@ -185,11 +192,23 @@ function sizeAxis(step) {
|
|
|
185
192
|
paddingBottom: theme.spacing(textAreaPadding)
|
|
186
193
|
},
|
|
187
194
|
description: { ...inset, ...helpType },
|
|
188
|
-
error: { ...inset, ...helpType }
|
|
195
|
+
error: { ...inset, ...helpType },
|
|
196
|
+
prefix: decorator,
|
|
197
|
+
suffix: decorator,
|
|
198
|
+
icon: { fontSize: theme.fontSizes[glyph] }
|
|
189
199
|
};
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
var LABEL_INSET = 1.5;
|
|
203
|
+
var DECORATOR = {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
top: 0,
|
|
206
|
+
bottom: 0,
|
|
207
|
+
flexDirection: "row",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
zIndex: 10
|
|
211
|
+
};
|
|
193
212
|
var SIZES = {
|
|
194
213
|
xs: {
|
|
195
214
|
control: "xs",
|
|
@@ -198,6 +217,7 @@ var SIZES = {
|
|
|
198
217
|
field: "sm",
|
|
199
218
|
label: "sm",
|
|
200
219
|
help: "xs",
|
|
220
|
+
glyph: "md",
|
|
201
221
|
labelInside: "xs",
|
|
202
222
|
textAreaPadding: 1.5
|
|
203
223
|
},
|
|
@@ -208,6 +228,7 @@ var SIZES = {
|
|
|
208
228
|
field: "md",
|
|
209
229
|
label: "sm",
|
|
210
230
|
help: "xs",
|
|
231
|
+
glyph: "lg",
|
|
211
232
|
labelInside: "xs",
|
|
212
233
|
textAreaPadding: 2
|
|
213
234
|
},
|
|
@@ -218,6 +239,7 @@ var SIZES = {
|
|
|
218
239
|
field: "md",
|
|
219
240
|
label: "md",
|
|
220
241
|
help: "sm",
|
|
242
|
+
glyph: "lg",
|
|
221
243
|
labelInside: "xs",
|
|
222
244
|
textAreaPadding: 2
|
|
223
245
|
},
|
|
@@ -228,6 +250,7 @@ var SIZES = {
|
|
|
228
250
|
field: "lg",
|
|
229
251
|
label: "lg",
|
|
230
252
|
help: "md",
|
|
253
|
+
glyph: "xl",
|
|
231
254
|
labelInside: "sm",
|
|
232
255
|
textAreaPadding: 2.5
|
|
233
256
|
}
|
|
@@ -303,7 +326,13 @@ var inputRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
|
303
326
|
error: {
|
|
304
327
|
fontFamily: theme.fontFamilies.body,
|
|
305
328
|
color: theme.colors.danger
|
|
306
|
-
}
|
|
329
|
+
},
|
|
330
|
+
prefix: { ...DECORATOR, start: 0 },
|
|
331
|
+
suffix: { ...DECORATOR, end: 0 },
|
|
332
|
+
// The glyph sits with the placeholder rather than with the value: a search mark or a
|
|
333
|
+
// lock is decoration for the text, not text. `paint` leaves it alone, so a tinted
|
|
334
|
+
// filled field is the one case where the caller names a colour on the icon itself.
|
|
335
|
+
icon: { color: theme.colors.fieldPlaceholder }
|
|
307
336
|
}),
|
|
308
337
|
variantTokens: VARIANT_TOKENS,
|
|
309
338
|
/**
|
|
@@ -423,6 +452,7 @@ var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
|
423
452
|
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
424
453
|
const context = _react.useMemo.call(void 0, () => {
|
|
425
454
|
const placeholder = _reactnative.StyleSheet.flatten(styles.placeholder);
|
|
455
|
+
const icon = _reactnative.StyleSheet.flatten(styles.icon);
|
|
426
456
|
const textArea = _reactnative.StyleSheet.flatten(styles.textArea);
|
|
427
457
|
return {
|
|
428
458
|
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
@@ -436,6 +466,14 @@ var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
|
436
466
|
},
|
|
437
467
|
descriptionStyle: styles.description,
|
|
438
468
|
errorStyle: styles.error,
|
|
469
|
+
prefixStyle: styles.prefix,
|
|
470
|
+
suffixStyle: styles.suffix,
|
|
471
|
+
icon: {
|
|
472
|
+
size: icon.fontSize,
|
|
473
|
+
// `ColorValue` also covers the platform's opaque colours, which an icon component
|
|
474
|
+
// takes as a `string` and nothing else.
|
|
475
|
+
color: typeof icon.color === "string" ? icon.color : void 0
|
|
476
|
+
},
|
|
439
477
|
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
440
478
|
// take for a placeholder.
|
|
441
479
|
placeholderTextColor: typeof placeholder.color === "string" ? placeholder.color : void 0,
|