@yahoo/uds-mobile 2.15.0 → 2.17.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/README.md +27 -24
- package/dist/bin/fixtures/dist/index.mjs +14 -0
- package/dist/components/Input.cjs +16 -13
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +16 -13
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +52 -0
- package/dist/components/InputHelpText.d.cts +37 -0
- package/dist/components/InputHelpText.d.cts.map +1 -0
- package/dist/components/InputHelpText.d.ts +37 -0
- package/dist/components/InputHelpText.d.ts.map +1 -0
- package/dist/components/InputHelpText.js +52 -0
- package/dist/components/InputHelpText.js.map +1 -0
- package/dist/components/Toast/Toast.cjs +141 -0
- package/dist/components/Toast/Toast.d.cts +38 -0
- package/dist/components/Toast/Toast.d.cts.map +1 -0
- package/dist/components/Toast/Toast.d.ts +38 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.js +141 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.cjs +88 -0
- package/dist/components/Toast/ToastAnimatedItem.d.cts +27 -0
- package/dist/components/Toast/ToastAnimatedItem.d.cts.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.d.ts +27 -0
- package/dist/components/Toast/ToastAnimatedItem.d.ts.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.js +87 -0
- package/dist/components/Toast/ToastAnimatedItem.js.map +1 -0
- package/dist/components/Toast/ToastItem.cjs +35 -0
- package/dist/components/Toast/ToastItem.d.cts +25 -0
- package/dist/components/Toast/ToastItem.d.cts.map +1 -0
- package/dist/components/Toast/ToastItem.d.ts +25 -0
- package/dist/components/Toast/ToastItem.d.ts.map +1 -0
- package/dist/components/Toast/ToastItem.js +35 -0
- package/dist/components/Toast/ToastItem.js.map +1 -0
- package/dist/components/Toast/ToastProvider.cjs +144 -0
- package/dist/components/Toast/ToastProvider.d.cts +58 -0
- package/dist/components/Toast/ToastProvider.d.cts.map +1 -0
- package/dist/components/Toast/ToastProvider.d.ts +58 -0
- package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/Toast/ToastProvider.js +143 -0
- package/dist/components/Toast/ToastProvider.js.map +1 -0
- package/dist/components/Toast/ToastViewport.cjs +48 -0
- package/dist/components/Toast/ToastViewport.d.cts +42 -0
- package/dist/components/Toast/ToastViewport.d.cts.map +1 -0
- package/dist/components/Toast/ToastViewport.d.ts +42 -0
- package/dist/components/Toast/ToastViewport.d.ts.map +1 -0
- package/dist/components/Toast/ToastViewport.js +48 -0
- package/dist/components/Toast/ToastViewport.js.map +1 -0
- package/dist/components/Toast/createToast.cjs +21 -0
- package/dist/components/Toast/createToast.d.cts +10 -0
- package/dist/components/Toast/createToast.d.cts.map +1 -0
- package/dist/components/Toast/createToast.d.ts +10 -0
- package/dist/components/Toast/createToast.d.ts.map +1 -0
- package/dist/components/Toast/createToast.js +20 -0
- package/dist/components/Toast/createToast.js.map +1 -0
- package/dist/components/Toast/index.cjs +10 -0
- package/dist/components/Toast/index.d.cts +6 -0
- package/dist/components/Toast/index.d.ts +6 -0
- package/dist/components/Toast/index.js +5 -0
- package/dist/components/Toast/types.cjs +1 -0
- package/dist/components/Toast/types.d.cts +113 -0
- package/dist/components/Toast/types.d.cts.map +1 -0
- package/dist/components/Toast/types.d.ts +113 -0
- package/dist/components/Toast/types.d.ts.map +1 -0
- package/dist/components/Toast/types.js +1 -0
- package/dist/components/Toast/useToastController.cjs +286 -0
- package/dist/components/Toast/useToastController.d.cts +25 -0
- package/dist/components/Toast/useToastController.d.cts.map +1 -0
- package/dist/components/Toast/useToastController.d.ts +25 -0
- package/dist/components/Toast/useToastController.d.ts.map +1 -0
- package/dist/components/Toast/useToastController.js +286 -0
- package/dist/components/Toast/useToastController.js.map +1 -0
- package/dist/components/Toast/utils.cjs +69 -0
- package/dist/components/Toast/utils.d.cts +27 -0
- package/dist/components/Toast/utils.d.cts.map +1 -0
- package/dist/components/Toast/utils.d.ts +27 -0
- package/dist/components/Toast/utils.d.ts.map +1 -0
- package/dist/components/Toast/utils.js +55 -0
- package/dist/components/Toast/utils.js.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.cjs +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.js +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.js.map +1 -0
- package/dist/components/internal/Overlay/index.cjs +6 -0
- package/dist/components/internal/Overlay/index.d.cts +5 -0
- package/dist/components/internal/Overlay/index.d.ts +5 -0
- package/dist/components/internal/Overlay/index.js +4 -0
- package/dist/components/internal/Overlay/types.cjs +1 -0
- package/dist/components/internal/Overlay/types.d.cts +21 -0
- package/dist/components/internal/Overlay/types.d.cts.map +1 -0
- package/dist/components/internal/Overlay/types.d.ts +21 -0
- package/dist/components/internal/Overlay/types.d.ts.map +1 -0
- package/dist/components/internal/Overlay/types.js +1 -0
- package/dist/components/internal/Overlay/useControllableState.cjs +34 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.js +34 -0
- package/dist/components/internal/Overlay/useControllableState.js.map +1 -0
- package/dist/jest/mocks/gesture-handler.cjs +38 -0
- package/dist/jest/mocks/gesture-handler.d.cts +41 -0
- package/dist/jest/mocks/gesture-handler.d.cts.map +1 -0
- package/dist/jest/mocks/gesture-handler.d.ts +41 -0
- package/dist/jest/mocks/gesture-handler.d.ts.map +1 -0
- package/dist/jest/mocks/gesture-handler.js +37 -0
- package/dist/jest/mocks/gesture-handler.js.map +1 -0
- package/dist/jest/mocks/safe-area-context.cjs +35 -0
- package/dist/jest/mocks/safe-area-context.d.cts +43 -0
- package/dist/jest/mocks/safe-area-context.d.cts.map +1 -0
- package/dist/jest/mocks/safe-area-context.d.ts +43 -0
- package/dist/jest/mocks/safe-area-context.d.ts.map +1 -0
- package/dist/jest/mocks/safe-area-context.js +32 -0
- package/dist/jest/mocks/safe-area-context.js.map +1 -0
- package/dist/jest/mocks/screens.cjs +8 -0
- package/dist/jest/mocks/screens.d.cts +12 -0
- package/dist/jest/mocks/screens.d.cts.map +1 -0
- package/dist/jest/mocks/screens.d.ts +12 -0
- package/dist/jest/mocks/screens.d.ts.map +1 -0
- package/dist/jest/mocks/screens.js +9 -0
- package/dist/jest/mocks/screens.js.map +1 -0
- package/dist/jest/mocks/styles.cjs +38 -1
- package/dist/jest/mocks/styles.d.cts +3 -2
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts +3 -2
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +38 -2
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/portal.cjs +1 -0
- package/dist/portal.d.cts +6 -1
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts +6 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +1 -1
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts +4 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +4 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +209 -209
- package/fonts/index.mjs +209 -209
- package/generated/styles.cjs +114 -0
- package/generated/styles.d.ts +29 -0
- package/generated/styles.mjs +114 -0
- package/generated/unistyles.d.ts +110 -0
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
`@yahoo/uds-mobile` brings UDS to React Native. It provides:
|
|
19
19
|
|
|
20
|
-
- **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, Link, Radio, RadioGroup, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
|
|
20
|
+
- **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, InputHelpText, Link, Radio, RadioGroup, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
|
|
21
21
|
- **Theming**: Full light/dark mode support with automatic system preference detection
|
|
22
22
|
- **Design Token Integration**: Colors, typography, spacing, and motion configs synced from UDS tokens
|
|
23
23
|
- **Animations**: Smooth, physics-based animations using Reanimated with motion parity to web
|
|
@@ -319,29 +319,30 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
319
319
|
|
|
320
320
|
### Available Components
|
|
321
321
|
|
|
322
|
-
| Component
|
|
323
|
-
|
|
|
324
|
-
| `Avatar`
|
|
325
|
-
| `Badge`
|
|
326
|
-
| `Box`
|
|
327
|
-
| `Button`
|
|
328
|
-
| `Checkbox`
|
|
329
|
-
| `Chip`
|
|
330
|
-
| `Divider`
|
|
331
|
-
| `HStack`
|
|
332
|
-
| `Icon`
|
|
333
|
-
| `IconButton`
|
|
334
|
-
| `IconSlot`
|
|
335
|
-
| `Image`
|
|
336
|
-
| `Input`
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
322
|
+
| Component | Description |
|
|
323
|
+
| --------------- | ----------------------------------------------- |
|
|
324
|
+
| `Avatar` | User avatars with image, initials, or icon |
|
|
325
|
+
| `Badge` | Status indicators and labels |
|
|
326
|
+
| `Box` | Flexible container with layout props |
|
|
327
|
+
| `Button` | Interactive button with variants and animations |
|
|
328
|
+
| `Checkbox` | Selectable checkbox with label |
|
|
329
|
+
| `Chip` | Compact elements for filters and selections |
|
|
330
|
+
| `Divider` | Visual separator for grouping content |
|
|
331
|
+
| `HStack` | Horizontal flex container |
|
|
332
|
+
| `Icon` | Icon rendering (font or SVG) |
|
|
333
|
+
| `IconButton` | Icon-only button |
|
|
334
|
+
| `IconSlot` | Flexible icon slot for component composition |
|
|
335
|
+
| `Image` | Image component with loading states |
|
|
336
|
+
| `Input` | Text input with label and helper text |
|
|
337
|
+
| `InputHelpText` | Helper text for custom input layouts |
|
|
338
|
+
| `Link` | Inline text links with icons |
|
|
339
|
+
| `Pressable` | Base pressable component |
|
|
340
|
+
| `Radio` | Radio button with label |
|
|
341
|
+
| `RadioGroup` | Coordinates Radio selection in a group |
|
|
342
|
+
| `Screen` | Screen container with safe area handling |
|
|
343
|
+
| `Switch` | Toggle switch with animations |
|
|
344
|
+
| `Text` | Typography component with variants |
|
|
345
|
+
| `VStack` | Vertical flex container |
|
|
345
346
|
|
|
346
347
|
### Usage Examples
|
|
347
348
|
|
|
@@ -668,6 +669,7 @@ import type { IconProps, IconName } from '@yahoo/uds-mobile/Icon';
|
|
|
668
669
|
import type { IconButtonProps } from '@yahoo/uds-mobile/IconButton';
|
|
669
670
|
import type { ImageProps } from '@yahoo/uds-mobile/Image';
|
|
670
671
|
import type { InputProps } from '@yahoo/uds-mobile/Input';
|
|
672
|
+
import type { InputHelpTextProps } from '@yahoo/uds-mobile/InputHelpText';
|
|
671
673
|
import type { LinkProps } from '@yahoo/uds-mobile/Link';
|
|
672
674
|
import type { RadioProps } from '@yahoo/uds-mobile/Radio';
|
|
673
675
|
import type { SwitchProps } from '@yahoo/uds-mobile/Switch';
|
|
@@ -696,6 +698,7 @@ import { IconButton } from '@yahoo/uds-mobile/IconButton';
|
|
|
696
698
|
import { IconSlot } from '@yahoo/uds-mobile/IconSlot';
|
|
697
699
|
import { Image } from '@yahoo/uds-mobile/Image';
|
|
698
700
|
import { Input } from '@yahoo/uds-mobile/Input';
|
|
701
|
+
import { InputHelpText } from '@yahoo/uds-mobile/InputHelpText';
|
|
699
702
|
import { Link } from '@yahoo/uds-mobile/Link';
|
|
700
703
|
import { Pressable } from '@yahoo/uds-mobile/Pressable';
|
|
701
704
|
import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var breakpointSizeSort = {
|
|
3
|
+
sm: 0,
|
|
4
|
+
md: 1,
|
|
5
|
+
lg: 2,
|
|
6
|
+
xl: 3,
|
|
7
|
+
"2xl": 4
|
|
8
|
+
};
|
|
9
|
+
[
|
|
10
|
+
"sm",
|
|
11
|
+
"md",
|
|
12
|
+
"lg",
|
|
13
|
+
"xl",
|
|
14
|
+
"2xl"
|
|
15
|
+
].sort((a, b) => breakpointSizeSort[a] - breakpointSizeSort[b]);
|
|
2
16
|
var elevationAliases = [
|
|
3
17
|
"elevation-0",
|
|
4
18
|
"elevation-1",
|
|
@@ -4,6 +4,7 @@ require("../_virtual/_rolldown/runtime.cjs");
|
|
|
4
4
|
const require_components_HStack = require("./HStack.cjs");
|
|
5
5
|
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
6
6
|
const require_components_Text = require("./Text.cjs");
|
|
7
|
+
const require_components_InputHelpText = require("./InputHelpText.cjs");
|
|
7
8
|
const require_components_VStack = require("./VStack.cjs");
|
|
8
9
|
let react = require("react");
|
|
9
10
|
let react_native = require("react-native");
|
|
@@ -128,23 +129,25 @@ const Input = (0, react.memo)(function Input({ label, size = "md", startIcon, en
|
|
|
128
129
|
const helpTextContent = (0, react.useMemo)(() => {
|
|
129
130
|
if (!helpText) return null;
|
|
130
131
|
const content = (0, lodash_es.isFunction)(helpText) ? helpText() : helpText;
|
|
131
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
children: content
|
|
141
|
-
})]
|
|
132
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_InputHelpText.InputHelpText, {
|
|
133
|
+
startIcon: helperTextIcon,
|
|
134
|
+
size,
|
|
135
|
+
isFilled: valueState === "filled",
|
|
136
|
+
disabled,
|
|
137
|
+
readOnly,
|
|
138
|
+
hasError,
|
|
139
|
+
pressed: isFocused,
|
|
140
|
+
children: content
|
|
142
141
|
});
|
|
143
142
|
}, [
|
|
143
|
+
disabled,
|
|
144
|
+
hasError,
|
|
144
145
|
helpText,
|
|
145
146
|
helperTextIcon,
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
isFocused,
|
|
148
|
+
readOnly,
|
|
149
|
+
size,
|
|
150
|
+
valueState
|
|
148
151
|
]);
|
|
149
152
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_VStack.VStack, {
|
|
150
153
|
style: rootStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.cts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Input.d.cts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;;;;;;;UAoBU,UAAA,SAEN,IAAA,CAAK,mBAAA,CAAoB,YAAA,aACzB,IAAA,CAAK,cAAA,yBACL,IAAA,CAAK,SAAA;;EAEP,GAAA,GAAM,GAAA,CAAI,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAS;;;;;;;;;;;cA0Cf,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;;;;;;;UAoBU,UAAA,SAEN,IAAA,CAAK,mBAAA,CAAoB,YAAA,aACzB,IAAA,CAAK,cAAA,yBACL,IAAA,CAAK,SAAA;;EAEP,GAAA,GAAM,GAAA,CAAI,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAS;;;;;;;;;;;cA0Cf,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
package/dist/components/Input.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { HStack } from "./HStack.js";
|
|
3
3
|
import { IconSlot } from "./IconSlot.js";
|
|
4
4
|
import { Text as Text$1 } from "./Text.js";
|
|
5
|
+
import { InputHelpText } from "./InputHelpText.js";
|
|
5
6
|
import { VStack } from "./VStack.js";
|
|
6
7
|
import { memo, useCallback, useId, useMemo, useState } from "react";
|
|
7
8
|
import { TextInput, View } from "react-native";
|
|
@@ -126,23 +127,25 @@ const Input = memo(function Input({ label, size = "md", startIcon, endIcon, help
|
|
|
126
127
|
const helpTextContent = useMemo(() => {
|
|
127
128
|
if (!helpText) return null;
|
|
128
129
|
const content = isFunction(helpText) ? helpText() : helpText;
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
children: content
|
|
139
|
-
})]
|
|
130
|
+
return /* @__PURE__ */ jsx(InputHelpText, {
|
|
131
|
+
startIcon: helperTextIcon,
|
|
132
|
+
size,
|
|
133
|
+
isFilled: valueState === "filled",
|
|
134
|
+
disabled,
|
|
135
|
+
readOnly,
|
|
136
|
+
hasError,
|
|
137
|
+
pressed: isFocused,
|
|
138
|
+
children: content
|
|
140
139
|
});
|
|
141
140
|
}, [
|
|
141
|
+
disabled,
|
|
142
|
+
hasError,
|
|
142
143
|
helpText,
|
|
143
144
|
helperTextIcon,
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
isFocused,
|
|
146
|
+
readOnly,
|
|
147
|
+
size,
|
|
148
|
+
valueState
|
|
146
149
|
]);
|
|
147
150
|
return /* @__PURE__ */ jsxs(VStack, {
|
|
148
151
|
style: rootStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["Text"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import type { UniversalInputProps } from '@yahoo/uds-types';\nimport { isFunction } from 'lodash-es';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { TextInputProps } from 'react-native';\nimport { TextInput, View } from 'react-native';\n\nimport { inputStyles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\nimport { VStack } from './VStack';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\ninterface InputProps\n extends\n Omit<UniversalInputProps<IconSlotType>, 'width'>,\n Omit<TextInputProps, 'style' | 'editable'>,\n Pick<SizeProps, 'width'> {\n /** Ref to the underlying TextInput element */\n ref?: Ref<TextInput>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **📦 An input that allows users to enter text and collect data.**\n *\n * @description\n * An input field is a component that takes text typed into it. It can also serve\n * as a way to display a selection and trigger a dropdown menu. Inputs are interactive\n * elements that users can click, tap, or otherwise engage with to collect data.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Input } from '@yahoo/uds-mobile/Input';\n *\n * <Input label=\"Name\" placeholder=\"Enter your name\" required />\n * <Input label=\"Email\" startIcon=\"Mail\" helpText=\"We'll never share your email\" />\n * <Input label=\"Password\" secureTextEntry hasError helpText=\"Password is required\" />\n * ```\n *\n * @usage\n * - Forms: For collecting data like names, emails, passwords, etc.\n * - Search Bars: Allowing users to enter search queries\n * - Filters/Settings: When users need to specify preferences\n * - Feedback/Comments: Letting users leave reviews or comments\n *\n * @accessibility\n * - Label is automatically associated with the input\n * - Help text is announced as accessibility hint\n * - Error state is communicated to screen readers\n * - Disabled state prevents interaction\n *\n * @see {@link Checkbox} for boolean selections\n * @see {@link Radio} for single-select options\n */\nconst Input = memo(function Input({\n // Input props\n label,\n size = 'md',\n startIcon,\n endIcon,\n helpText,\n helperTextIcon,\n hasError,\n disabled,\n readOnly,\n required,\n // Size props\n width = '100%',\n // TextInput props\n defaultValue,\n value: controlledValue,\n onChangeText,\n onFocus,\n onBlur,\n placeholder,\n placeholderTextColor,\n ref,\n ...textInputProps\n}: InputProps) {\n const generatedId = useId();\n const uid = `uds-input-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const [internalValue, setInternalValue] = useState(defaultValue ?? '');\n const [isFocused, setIsFocused] = useState(false);\n\n // Support both controlled and uncontrolled modes\n const isControlled = controlledValue !== undefined;\n const value = isControlled ? controlledValue : internalValue;\n const valueState = value ? 'filled' : 'empty';\n\n /* -------------------------------- Handlers -------------------------------- */\n const handleChangeText = useCallback(\n (text: string) => {\n if (!isControlled) {\n setInternalValue(text);\n }\n onChangeText?.(text);\n },\n [isControlled, onChangeText],\n );\n\n const handleFocus = useCallback<NonNullable<TextInputProps['onFocus']>>(\n (e) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<NonNullable<TextInputProps['onBlur']>>(\n (e) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n\n /* --------------------------------- Styles --------------------------------- */\n inputStyles.useVariants({\n size,\n value: valueState,\n disabled,\n pressed: isFocused,\n readonly: readOnly,\n invalid: hasError,\n });\n\n // Get placeholder color from theme styles\n const computedPlaceholderColor = placeholderTextColor ?? inputStyles.inputPlaceholder.color;\n\n const rootStyle = useMemo(() => [{ width, opacity: disabled ? 0.5 : 1 }], [width, disabled]);\n\n const inputWrapperStyle = useMemo(\n () => [\n inputStyles.inputWrapper,\n { flexDirection: 'row' as const, alignItems: 'center' as const },\n ],\n [inputStyles.inputWrapper],\n );\n\n // Android-specific fixes: TextInput on Android has rendering issues with text visibility\n // - includeFontPadding: false removes Android's extra font padding that can clip text\n // - textAlignVertical: 'center' ensures text is vertically centered in the input\n // - paddingVertical: 0 removes default padding that interferes with flex layout\n const textInputStyle = useMemo(\n () => [\n inputStyles.input,\n {\n flex: 1,\n includeFontPadding: false,\n textAlignVertical: 'center' as const,\n paddingVertical: 0,\n },\n ],\n [inputStyles.input],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n const content = isFunction(label) ? label() : label;\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-end\" spacingBottom=\"2\">\n <Text style={inputStyles.label}>{content}</Text>\n {required && <Text style={inputStyles.labelRequired}>*</Text>}\n </HStack>\n );\n }, [label, required, inputStyles.label, inputStyles.labelRequired]);\n\n const startIconContent = useMemo(() => {\n if (!startIcon) {\n return null;\n }\n return <IconSlot icon={startIcon} variant=\"outline\" style={inputStyles.startIcon} />;\n }, [startIcon, inputStyles.startIcon]);\n\n const endIconContent = useMemo(() => {\n if (!endIcon) {\n return null;\n }\n return <IconSlot icon={endIcon} variant=\"outline\" style={inputStyles.endIcon} />;\n }, [endIcon, inputStyles.endIcon]);\n\n const helpTextContent = useMemo(() => {\n if (!helpText) {\n return null;\n }\n const content = isFunction(helpText) ? helpText() : helpText;\n return (\n <HStack columnGap=\"1\" alignItems=\"center\" spacingTop=\"2\">\n {helperTextIcon && <IconSlot icon={helperTextIcon} style={inputStyles.helperIcon} />}\n <Text style={inputStyles.helperText}>{content}</Text>\n </HStack>\n );\n }, [helpText, helperTextIcon, inputStyles.helperIcon, inputStyles.helperText]);\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <VStack style={rootStyle}>\n {labelContent}\n\n <View\n style={inputWrapperStyle}\n accessible\n accessibilityRole=\"none\"\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n >\n {startIconContent}\n\n <TextInput\n ref={ref}\n nativeID={uid}\n value={value}\n onChangeText={handleChangeText}\n onFocus={handleFocus}\n onBlur={handleBlur}\n placeholder={placeholder}\n placeholderTextColor={computedPlaceholderColor}\n editable={!disabled && !readOnly}\n style={textInputStyle}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n accessibilityHint={typeof helpText === 'string' ? helpText : undefined}\n accessibilityState={{ disabled }}\n {...textInputProps}\n />\n\n {endIconContent}\n </View>\n\n {helpTextContent}\n </VStack>\n );\n});\n\nInput.displayName = 'Input';\n\nexport { Input, type InputProps };\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["Text"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import type { UniversalInputProps } from '@yahoo/uds-types';\nimport { isFunction } from 'lodash-es';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { TextInputProps } from 'react-native';\nimport { TextInput, View } from 'react-native';\n\nimport { inputStyles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { InputHelpText } from './InputHelpText';\nimport { Text } from './Text';\nimport { VStack } from './VStack';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\ninterface InputProps\n extends\n Omit<UniversalInputProps<IconSlotType>, 'width'>,\n Omit<TextInputProps, 'style' | 'editable'>,\n Pick<SizeProps, 'width'> {\n /** Ref to the underlying TextInput element */\n ref?: Ref<TextInput>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **📦 An input that allows users to enter text and collect data.**\n *\n * @description\n * An input field is a component that takes text typed into it. It can also serve\n * as a way to display a selection and trigger a dropdown menu. Inputs are interactive\n * elements that users can click, tap, or otherwise engage with to collect data.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Input } from '@yahoo/uds-mobile/Input';\n *\n * <Input label=\"Name\" placeholder=\"Enter your name\" required />\n * <Input label=\"Email\" startIcon=\"Mail\" helpText=\"We'll never share your email\" />\n * <Input label=\"Password\" secureTextEntry hasError helpText=\"Password is required\" />\n * ```\n *\n * @usage\n * - Forms: For collecting data like names, emails, passwords, etc.\n * - Search Bars: Allowing users to enter search queries\n * - Filters/Settings: When users need to specify preferences\n * - Feedback/Comments: Letting users leave reviews or comments\n *\n * @accessibility\n * - Label is automatically associated with the input\n * - Help text is announced as accessibility hint\n * - Error state is communicated to screen readers\n * - Disabled state prevents interaction\n *\n * @see {@link Checkbox} for boolean selections\n * @see {@link Radio} for single-select options\n */\nconst Input = memo(function Input({\n // Input props\n label,\n size = 'md',\n startIcon,\n endIcon,\n helpText,\n helperTextIcon,\n hasError,\n disabled,\n readOnly,\n required,\n // Size props\n width = '100%',\n // TextInput props\n defaultValue,\n value: controlledValue,\n onChangeText,\n onFocus,\n onBlur,\n placeholder,\n placeholderTextColor,\n ref,\n ...textInputProps\n}: InputProps) {\n const generatedId = useId();\n const uid = `uds-input-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const [internalValue, setInternalValue] = useState(defaultValue ?? '');\n const [isFocused, setIsFocused] = useState(false);\n\n // Support both controlled and uncontrolled modes\n const isControlled = controlledValue !== undefined;\n const value = isControlled ? controlledValue : internalValue;\n const valueState = value ? 'filled' : 'empty';\n\n /* -------------------------------- Handlers -------------------------------- */\n const handleChangeText = useCallback(\n (text: string) => {\n if (!isControlled) {\n setInternalValue(text);\n }\n onChangeText?.(text);\n },\n [isControlled, onChangeText],\n );\n\n const handleFocus = useCallback<NonNullable<TextInputProps['onFocus']>>(\n (e) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<NonNullable<TextInputProps['onBlur']>>(\n (e) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n\n /* --------------------------------- Styles --------------------------------- */\n inputStyles.useVariants({\n size,\n value: valueState,\n disabled,\n pressed: isFocused,\n readonly: readOnly,\n invalid: hasError,\n });\n\n // Get placeholder color from theme styles\n const computedPlaceholderColor = placeholderTextColor ?? inputStyles.inputPlaceholder.color;\n\n const rootStyle = useMemo(() => [{ width, opacity: disabled ? 0.5 : 1 }], [width, disabled]);\n\n const inputWrapperStyle = useMemo(\n () => [\n inputStyles.inputWrapper,\n { flexDirection: 'row' as const, alignItems: 'center' as const },\n ],\n [inputStyles.inputWrapper],\n );\n\n // Android-specific fixes: TextInput on Android has rendering issues with text visibility\n // - includeFontPadding: false removes Android's extra font padding that can clip text\n // - textAlignVertical: 'center' ensures text is vertically centered in the input\n // - paddingVertical: 0 removes default padding that interferes with flex layout\n const textInputStyle = useMemo(\n () => [\n inputStyles.input,\n {\n flex: 1,\n includeFontPadding: false,\n textAlignVertical: 'center' as const,\n paddingVertical: 0,\n },\n ],\n [inputStyles.input],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n const content = isFunction(label) ? label() : label;\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-end\" spacingBottom=\"2\">\n <Text style={inputStyles.label}>{content}</Text>\n {required && <Text style={inputStyles.labelRequired}>*</Text>}\n </HStack>\n );\n }, [label, required, inputStyles.label, inputStyles.labelRequired]);\n\n const startIconContent = useMemo(() => {\n if (!startIcon) {\n return null;\n }\n return <IconSlot icon={startIcon} variant=\"outline\" style={inputStyles.startIcon} />;\n }, [startIcon, inputStyles.startIcon]);\n\n const endIconContent = useMemo(() => {\n if (!endIcon) {\n return null;\n }\n return <IconSlot icon={endIcon} variant=\"outline\" style={inputStyles.endIcon} />;\n }, [endIcon, inputStyles.endIcon]);\n\n const helpTextContent = useMemo(() => {\n if (!helpText) {\n return null;\n }\n const content = isFunction(helpText) ? helpText() : helpText;\n return (\n <InputHelpText\n startIcon={helperTextIcon}\n size={size}\n isFilled={valueState === 'filled'}\n disabled={disabled}\n readOnly={readOnly}\n hasError={hasError}\n pressed={isFocused}\n >\n {content}\n </InputHelpText>\n );\n }, [disabled, hasError, helpText, helperTextIcon, isFocused, readOnly, size, valueState]);\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <VStack style={rootStyle}>\n {labelContent}\n\n <View\n style={inputWrapperStyle}\n accessible\n accessibilityRole=\"none\"\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n >\n {startIconContent}\n\n <TextInput\n ref={ref}\n nativeID={uid}\n value={value}\n onChangeText={handleChangeText}\n onFocus={handleFocus}\n onBlur={handleBlur}\n placeholder={placeholder}\n placeholderTextColor={computedPlaceholderColor}\n editable={!disabled && !readOnly}\n style={textInputStyle}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n accessibilityHint={typeof helpText === 'string' ? helpText : undefined}\n accessibilityState={{ disabled }}\n {...textInputProps}\n />\n\n {endIconContent}\n </View>\n\n {helpTextContent}\n </VStack>\n );\n});\n\nInput.displayName = 'Input';\n\nexport { Input, type InputProps };\n"],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_HStack = require("./HStack.cjs");
|
|
5
|
+
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
6
|
+
const require_components_Text = require("./Text.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let generated_styles = require("../../generated/styles");
|
|
10
|
+
//#region src/components/InputHelpText.tsx
|
|
11
|
+
const InputHelpText = (0, react.memo)(function InputHelpText({ children, startIcon, endIcon, iconProps, size = "md", isFilled = false, disabled, readOnly, hasError, pressed, ref, ...hStackProps }) {
|
|
12
|
+
const { style: iconStyle, variant = "outline", ...resolvedIconProps } = iconProps ?? {};
|
|
13
|
+
const value = isFilled ? "filled" : "empty";
|
|
14
|
+
generated_styles.inputStyles.useVariants({
|
|
15
|
+
size,
|
|
16
|
+
value,
|
|
17
|
+
disabled,
|
|
18
|
+
pressed,
|
|
19
|
+
readonly: readOnly,
|
|
20
|
+
invalid: hasError
|
|
21
|
+
});
|
|
22
|
+
const resolvedIconStyle = (0, react.useMemo)(() => [generated_styles.inputStyles.helperIcon, iconStyle], [iconStyle, generated_styles.inputStyles.helperIcon]);
|
|
23
|
+
if (children === null || children === void 0 || children === false) return null;
|
|
24
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_HStack.HStack, {
|
|
25
|
+
ref,
|
|
26
|
+
columnGap: "1",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
spacingTop: "2",
|
|
29
|
+
...hStackProps,
|
|
30
|
+
children: [
|
|
31
|
+
startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
32
|
+
icon: startIcon,
|
|
33
|
+
variant,
|
|
34
|
+
style: resolvedIconStyle,
|
|
35
|
+
...resolvedIconProps
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
38
|
+
style: generated_styles.inputStyles.helperText,
|
|
39
|
+
children
|
|
40
|
+
}),
|
|
41
|
+
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
42
|
+
icon: endIcon,
|
|
43
|
+
variant,
|
|
44
|
+
style: resolvedIconStyle,
|
|
45
|
+
...resolvedIconProps
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
InputHelpText.displayName = "InputHelpText";
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.InputHelpText = InputHelpText;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { InputSize } from "../types/dist/index.cjs";
|
|
3
|
+
import { IconSlotProps, IconSlotType } from "./IconSlot.cjs";
|
|
4
|
+
import { HStackProps } from "./HStack.cjs";
|
|
5
|
+
import * as _$react from "react";
|
|
6
|
+
import { ReactNode, Ref } from "react";
|
|
7
|
+
import { View } from "react-native";
|
|
8
|
+
|
|
9
|
+
//#region src/components/InputHelpText.d.ts
|
|
10
|
+
interface InputHelpTextProps extends Omit<HStackProps, 'children' | 'ref'> {
|
|
11
|
+
/** Ref to the underlying root View. */
|
|
12
|
+
ref?: Ref<View>;
|
|
13
|
+
/** Helper text content. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** Icon to render before the help text. */
|
|
16
|
+
startIcon?: IconSlotType;
|
|
17
|
+
/** Icon to render after the help text. */
|
|
18
|
+
endIcon?: IconSlotType;
|
|
19
|
+
/** Props to apply to both helper icons. */
|
|
20
|
+
iconProps?: Omit<IconSlotProps, 'icon' | 'ref'>;
|
|
21
|
+
/** Input size used to resolve configured helper text styles. */
|
|
22
|
+
size?: InputSize;
|
|
23
|
+
/** Whether the associated input has a value. */
|
|
24
|
+
isFilled?: boolean;
|
|
25
|
+
/** Whether the associated input is disabled. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Whether the associated input is read-only. */
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
/** Whether the associated input has a validation error. */
|
|
30
|
+
hasError?: boolean;
|
|
31
|
+
/** Whether the associated input is focused or pressed. */
|
|
32
|
+
pressed?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const InputHelpText: _$react.NamedExoticComponent<InputHelpTextProps>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { InputHelpText, type InputHelpTextProps };
|
|
37
|
+
//# sourceMappingURL=InputHelpText.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputHelpText.d.cts","names":[],"sources":["../../src/components/InputHelpText.tsx"],"mappings":";;;;;;;;;UAaU,kBAAA,SAA2B,IAAA,CAAK,WAAA;;EAExC,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,QAAA,GAAW,SAAA;;EAEX,SAAA,GAAY,YAAA;EAJF;EAMV,OAAA,GAAU,YAAA;EAJC;EAMX,SAAA,GAAY,IAAA,CAAK,aAAA;EAFP;EAIV,IAAA,GAAO,SAAA;EAFK;EAIZ,QAAA;EAdmC;EAgBnC,QAAA;EAhBuC;EAkBvC,QAAA;EAlBwC;EAoBxC,QAAA;EAlBM;EAoBN,OAAA;AAAA;AAAA,cAGI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { InputSize } from "../types/dist/index.js";
|
|
3
|
+
import { IconSlotProps, IconSlotType } from "./IconSlot.js";
|
|
4
|
+
import { HStackProps } from "./HStack.js";
|
|
5
|
+
import * as _$react from "react";
|
|
6
|
+
import { ReactNode, Ref } from "react";
|
|
7
|
+
import { View } from "react-native";
|
|
8
|
+
|
|
9
|
+
//#region src/components/InputHelpText.d.ts
|
|
10
|
+
interface InputHelpTextProps extends Omit<HStackProps, 'children' | 'ref'> {
|
|
11
|
+
/** Ref to the underlying root View. */
|
|
12
|
+
ref?: Ref<View>;
|
|
13
|
+
/** Helper text content. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** Icon to render before the help text. */
|
|
16
|
+
startIcon?: IconSlotType;
|
|
17
|
+
/** Icon to render after the help text. */
|
|
18
|
+
endIcon?: IconSlotType;
|
|
19
|
+
/** Props to apply to both helper icons. */
|
|
20
|
+
iconProps?: Omit<IconSlotProps, 'icon' | 'ref'>;
|
|
21
|
+
/** Input size used to resolve configured helper text styles. */
|
|
22
|
+
size?: InputSize;
|
|
23
|
+
/** Whether the associated input has a value. */
|
|
24
|
+
isFilled?: boolean;
|
|
25
|
+
/** Whether the associated input is disabled. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Whether the associated input is read-only. */
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
/** Whether the associated input has a validation error. */
|
|
30
|
+
hasError?: boolean;
|
|
31
|
+
/** Whether the associated input is focused or pressed. */
|
|
32
|
+
pressed?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const InputHelpText: _$react.NamedExoticComponent<InputHelpTextProps>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { InputHelpText, type InputHelpTextProps };
|
|
37
|
+
//# sourceMappingURL=InputHelpText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputHelpText.d.ts","names":[],"sources":["../../src/components/InputHelpText.tsx"],"mappings":";;;;;;;;;UAaU,kBAAA,SAA2B,IAAA,CAAK,WAAA;;EAExC,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,QAAA,GAAW,SAAA;;EAEX,SAAA,GAAY,YAAA;EAJF;EAMV,OAAA,GAAU,YAAA;EAJC;EAMX,SAAA,GAAY,IAAA,CAAK,aAAA;EAFP;EAIV,IAAA,GAAO,SAAA;EAFK;EAIZ,QAAA;EAdmC;EAgBnC,QAAA;EAhBuC;EAkBvC,QAAA;EAlBwC;EAoBxC,QAAA;EAlBM;EAoBN,OAAA;AAAA;AAAA,cAGI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { HStack } from "./HStack.js";
|
|
3
|
+
import { IconSlot } from "./IconSlot.js";
|
|
4
|
+
import { Text } from "./Text.js";
|
|
5
|
+
import { memo, useMemo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { inputStyles } from "../../generated/styles";
|
|
8
|
+
//#region src/components/InputHelpText.tsx
|
|
9
|
+
const InputHelpText = memo(function InputHelpText({ children, startIcon, endIcon, iconProps, size = "md", isFilled = false, disabled, readOnly, hasError, pressed, ref, ...hStackProps }) {
|
|
10
|
+
const { style: iconStyle, variant = "outline", ...resolvedIconProps } = iconProps ?? {};
|
|
11
|
+
const value = isFilled ? "filled" : "empty";
|
|
12
|
+
inputStyles.useVariants({
|
|
13
|
+
size,
|
|
14
|
+
value,
|
|
15
|
+
disabled,
|
|
16
|
+
pressed,
|
|
17
|
+
readonly: readOnly,
|
|
18
|
+
invalid: hasError
|
|
19
|
+
});
|
|
20
|
+
const resolvedIconStyle = useMemo(() => [inputStyles.helperIcon, iconStyle], [iconStyle, inputStyles.helperIcon]);
|
|
21
|
+
if (children === null || children === void 0 || children === false) return null;
|
|
22
|
+
return /* @__PURE__ */ jsxs(HStack, {
|
|
23
|
+
ref,
|
|
24
|
+
columnGap: "1",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
spacingTop: "2",
|
|
27
|
+
...hStackProps,
|
|
28
|
+
children: [
|
|
29
|
+
startIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
30
|
+
icon: startIcon,
|
|
31
|
+
variant,
|
|
32
|
+
style: resolvedIconStyle,
|
|
33
|
+
...resolvedIconProps
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(Text, {
|
|
36
|
+
style: inputStyles.helperText,
|
|
37
|
+
children
|
|
38
|
+
}),
|
|
39
|
+
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
40
|
+
icon: endIcon,
|
|
41
|
+
variant,
|
|
42
|
+
style: resolvedIconStyle,
|
|
43
|
+
...resolvedIconProps
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
InputHelpText.displayName = "InputHelpText";
|
|
49
|
+
//#endregion
|
|
50
|
+
export { InputHelpText };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=InputHelpText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputHelpText.js","names":[],"sources":["../../src/components/InputHelpText.tsx"],"sourcesContent":["import type { InputSize } from '@yahoo/uds-types';\nimport type { ReactNode, Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { View } from 'react-native';\n\nimport { inputStyles } from '../../generated/styles';\nimport type { HStackProps } from './HStack';\nimport { HStack } from './HStack';\nimport type { IconSlotProps, IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { TextProps } from './Text';\nimport { Text } from './Text';\n\ninterface InputHelpTextProps extends Omit<HStackProps, 'children' | 'ref'> {\n /** Ref to the underlying root View. */\n ref?: Ref<View>;\n /** Helper text content. */\n children?: ReactNode;\n /** Icon to render before the help text. */\n startIcon?: IconSlotType;\n /** Icon to render after the help text. */\n endIcon?: IconSlotType;\n /** Props to apply to both helper icons. */\n iconProps?: Omit<IconSlotProps, 'icon' | 'ref'>;\n /** Input size used to resolve configured helper text styles. */\n size?: InputSize;\n /** Whether the associated input has a value. */\n isFilled?: boolean;\n /** Whether the associated input is disabled. */\n disabled?: boolean;\n /** Whether the associated input is read-only. */\n readOnly?: boolean;\n /** Whether the associated input has a validation error. */\n hasError?: boolean;\n /** Whether the associated input is focused or pressed. */\n pressed?: boolean;\n}\n\nconst InputHelpText = memo(function InputHelpText({\n children,\n startIcon,\n endIcon,\n iconProps,\n size = 'md',\n isFilled = false,\n disabled,\n readOnly,\n hasError,\n pressed,\n ref,\n ...hStackProps\n}: InputHelpTextProps) {\n const { style: iconStyle, variant = 'outline', ...resolvedIconProps } = iconProps ?? {};\n const value = isFilled ? 'filled' : 'empty';\n\n inputStyles.useVariants({\n size,\n value,\n disabled,\n pressed,\n readonly: readOnly,\n invalid: hasError,\n });\n\n const resolvedIconStyle = useMemo(\n () => [inputStyles.helperIcon, iconStyle],\n [iconStyle, inputStyles.helperIcon],\n );\n\n if (children === null || children === undefined || children === false) {\n return null;\n }\n\n return (\n <HStack ref={ref} columnGap=\"1\" alignItems=\"center\" spacingTop=\"2\" {...hStackProps}>\n {startIcon && (\n <IconSlot\n icon={startIcon}\n variant={variant}\n style={resolvedIconStyle}\n {...resolvedIconProps}\n />\n )}\n\n <Text style={inputStyles.helperText as TextProps['style']}>{children}</Text>\n\n {endIcon && (\n <IconSlot\n icon={endIcon}\n variant={variant}\n style={resolvedIconStyle}\n {...resolvedIconProps}\n />\n )}\n </HStack>\n );\n});\n\nInputHelpText.displayName = 'InputHelpText';\n\nexport { InputHelpText, type InputHelpTextProps };\n"],"mappings":";;;;;;;;AAsCA,MAAM,gBAAgB,KAAK,SAAS,cAAc,EAChD,UACA,WACA,SACA,WACA,OAAO,MACP,WAAW,OACX,UACA,UACA,UACA,SACA,KACA,GAAG,eACkB;CACrB,MAAM,EAAE,OAAO,WAAW,UAAU,WAAW,GAAG,sBAAsB,aAAa,EAAE;CACvF,MAAM,QAAQ,WAAW,WAAW;CAEpC,YAAY,YAAY;EACtB;EACA;EACA;EACA;EACA,UAAU;EACV,SAAS;EACV,CAAC;CAEF,MAAM,oBAAoB,cAClB,CAAC,YAAY,YAAY,UAAU,EACzC,CAAC,WAAW,YAAY,WAAW,CACpC;CAED,IAAI,aAAa,QAAQ,aAAa,KAAA,KAAa,aAAa,OAC9D,OAAO;CAGT,OACE,qBAAC,QAAD;EAAa;EAAK,WAAU;EAAI,YAAW;EAAS,YAAW;EAAI,GAAI;YAAvE;GACG,aACC,oBAAC,UAAD;IACE,MAAM;IACG;IACT,OAAO;IACP,GAAI;IACJ,CAAA;GAGJ,oBAAC,MAAD;IAAM,OAAO,YAAY;IAAmC;IAAgB,CAAA;GAE3E,WACC,oBAAC,UAAD;IACE,MAAM;IACG;IACT,OAAO;IACP,GAAI;IACJ,CAAA;GAEG;;EAEX;AAEF,cAAc,cAAc"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
5
|
+
const require_components_Text = require("../Text.cjs");
|
|
6
|
+
const require_components_Button = require("../Button.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_native = require("react-native");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let generated_styles = require("../../../generated/styles");
|
|
11
|
+
//#region src/components/Toast/Toast.tsx
|
|
12
|
+
const TOAST_ICON_MAP = {
|
|
13
|
+
error: "Error",
|
|
14
|
+
info: "Info",
|
|
15
|
+
loading: "Progress",
|
|
16
|
+
success: "CheckCircle",
|
|
17
|
+
warning: "Warning"
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* **A toast notification for short, non-blocking system feedback.**
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* Toast renders the configured mobile toast surface. It supports variant icons,
|
|
24
|
+
* message or custom content, an optional action button, and an optional dismiss
|
|
25
|
+
* affordance.
|
|
26
|
+
*
|
|
27
|
+
* This component only renders the visual toast. Use ToastProvider, useToast, or
|
|
28
|
+
* createToast for floating toast state, queueing, placement, timers, and motion.
|
|
29
|
+
*
|
|
30
|
+
* @category Feedback
|
|
31
|
+
* @platform mobile
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { Toast } from '@yahoo/uds-mobile/Toast';
|
|
36
|
+
*
|
|
37
|
+
* <Toast variant="info" message="Draft saved" />
|
|
38
|
+
* <Toast
|
|
39
|
+
* variant="success"
|
|
40
|
+
* message="Message archived"
|
|
41
|
+
* actionButton="Undo"
|
|
42
|
+
* onActionPress={() => {}}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @see {@link ToastProvider} for floating toast state and placement
|
|
47
|
+
*/
|
|
48
|
+
const Toast = (0, react.memo)(function Toast({ id, size: _size = "default", variant = "info", message, children, actionButton, onActionPress, onClickActionButton, onClose, onClickCloseButton, startIcon, closeIcon = "Cross", dismissible, closeAccessibilityLabel = "Dismiss", style, ref, ...rest }) {
|
|
49
|
+
generated_styles.toastStyles.useVariants({ variant });
|
|
50
|
+
const icon = startIcon === void 0 ? TOAST_ICON_MAP[variant] : startIcon;
|
|
51
|
+
const hasContent = message !== void 0 && message !== null;
|
|
52
|
+
const actionHandler = onActionPress ?? onClickActionButton;
|
|
53
|
+
const isDismissible = dismissible ?? closeIcon !== false;
|
|
54
|
+
const handleActionPress = (0, react.useCallback)(() => {
|
|
55
|
+
actionHandler?.();
|
|
56
|
+
}, [actionHandler]);
|
|
57
|
+
const handleClosePress = (0, react.useCallback)(() => {
|
|
58
|
+
onClose?.(id);
|
|
59
|
+
onClickCloseButton?.(id);
|
|
60
|
+
}, [
|
|
61
|
+
id,
|
|
62
|
+
onClickCloseButton,
|
|
63
|
+
onClose
|
|
64
|
+
]);
|
|
65
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
66
|
+
ref,
|
|
67
|
+
accessibilityLiveRegion: "polite",
|
|
68
|
+
accessibilityRole: "alert",
|
|
69
|
+
style: (0, react.useMemo)(() => [
|
|
70
|
+
generated_styles.toastStyles.root,
|
|
71
|
+
internalStyles.root,
|
|
72
|
+
style
|
|
73
|
+
], [style, generated_styles.toastStyles.root]),
|
|
74
|
+
...rest,
|
|
75
|
+
children: [
|
|
76
|
+
icon !== false && (variant === "loading" && startIcon === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ActivityIndicator, {
|
|
77
|
+
size: generated_styles.toastStyles.icon.fontSize,
|
|
78
|
+
color: generated_styles.toastStyles.icon.color,
|
|
79
|
+
style: internalStyles.icon
|
|
80
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
81
|
+
icon,
|
|
82
|
+
variant: "fill",
|
|
83
|
+
size: generated_styles.toastStyles.icon.iconSizeToken ?? "md",
|
|
84
|
+
style: [generated_styles.toastStyles.icon, internalStyles.icon],
|
|
85
|
+
accessibilityElementsHidden: true,
|
|
86
|
+
importantForAccessibility: "no"
|
|
87
|
+
})),
|
|
88
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
89
|
+
style: internalStyles.content,
|
|
90
|
+
children: hasContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
91
|
+
style: [generated_styles.toastStyles.label, generated_styles.toastStyles.text],
|
|
92
|
+
children: message
|
|
93
|
+
}) : children
|
|
94
|
+
}),
|
|
95
|
+
actionButton && actionHandler && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Button.Button, {
|
|
96
|
+
size: "sm",
|
|
97
|
+
variant: "secondary",
|
|
98
|
+
disableEffects: true,
|
|
99
|
+
onPress: handleActionPress,
|
|
100
|
+
children: actionButton
|
|
101
|
+
}),
|
|
102
|
+
isDismissible && closeIcon !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
103
|
+
accessibilityLabel: closeAccessibilityLabel,
|
|
104
|
+
accessibilityRole: "button",
|
|
105
|
+
hitSlop: 12,
|
|
106
|
+
onPress: handleClosePress,
|
|
107
|
+
style: internalStyles.closeButton,
|
|
108
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
109
|
+
icon: closeIcon,
|
|
110
|
+
variant: "outline",
|
|
111
|
+
size: generated_styles.toastStyles.closeIcon.iconSizeToken ?? "sm",
|
|
112
|
+
style: generated_styles.toastStyles.closeIcon,
|
|
113
|
+
accessibilityElementsHidden: true,
|
|
114
|
+
importantForAccessibility: "no"
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
Toast.displayName = "Toast";
|
|
121
|
+
const internalStyles = react_native.StyleSheet.create({
|
|
122
|
+
root: {
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
alignSelf: "stretch",
|
|
125
|
+
flexDirection: "row",
|
|
126
|
+
maxWidth: "100%",
|
|
127
|
+
width: "100%"
|
|
128
|
+
},
|
|
129
|
+
icon: { flexShrink: 0 },
|
|
130
|
+
content: {
|
|
131
|
+
flex: 1,
|
|
132
|
+
minWidth: 0
|
|
133
|
+
},
|
|
134
|
+
closeButton: {
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
flexShrink: 0,
|
|
137
|
+
justifyContent: "center"
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
//#endregion
|
|
141
|
+
exports.Toast = Toast;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/Toast.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **A toast notification for short, non-blocking system feedback.**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Toast renders the configured mobile toast surface. It supports variant icons,
|
|
11
|
+
* message or custom content, an optional action button, and an optional dismiss
|
|
12
|
+
* affordance.
|
|
13
|
+
*
|
|
14
|
+
* This component only renders the visual toast. Use ToastProvider, useToast, or
|
|
15
|
+
* createToast for floating toast state, queueing, placement, timers, and motion.
|
|
16
|
+
*
|
|
17
|
+
* @category Feedback
|
|
18
|
+
* @platform mobile
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { Toast } from '@yahoo/uds-mobile/Toast';
|
|
23
|
+
*
|
|
24
|
+
* <Toast variant="info" message="Draft saved" />
|
|
25
|
+
* <Toast
|
|
26
|
+
* variant="success"
|
|
27
|
+
* message="Message archived"
|
|
28
|
+
* actionButton="Undo"
|
|
29
|
+
* onActionPress={() => {}}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link ToastProvider} for floating toast state and placement
|
|
34
|
+
*/
|
|
35
|
+
declare const Toast: _$react.NamedExoticComponent<ToastProps>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Toast };
|
|
38
|
+
//# sourceMappingURL=Toast.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.cts","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"mappings":";;;;;;;;AAS0C;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCpC,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|