orn-ui 0.2.8 → 0.2.9
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/AGENTS.md +6 -2
- package/README.md +6 -6
- package/lib/commonjs/atoms/ShinyText.js +188 -0
- package/lib/commonjs/atoms/ShinyText.js.map +1 -0
- package/lib/commonjs/atoms/index.js +7 -0
- package/lib/commonjs/atoms/index.js.map +1 -1
- package/lib/commonjs/organisms/Chart.js +947 -0
- package/lib/commonjs/organisms/Chart.js.map +1 -0
- package/lib/commonjs/organisms/OptionWheel.js +408 -0
- package/lib/commonjs/organisms/OptionWheel.js.map +1 -0
- package/lib/commonjs/organisms/Timeline.js +420 -0
- package/lib/commonjs/organisms/Timeline.js.map +1 -0
- package/lib/commonjs/organisms/chart/frame.js +373 -0
- package/lib/commonjs/organisms/chart/frame.js.map +1 -0
- package/lib/commonjs/organisms/chart/marks.js +316 -0
- package/lib/commonjs/organisms/chart/marks.js.map +1 -0
- package/lib/commonjs/organisms/chart/math.js +468 -0
- package/lib/commonjs/organisms/chart/math.js.map +1 -0
- package/lib/commonjs/organisms/chart/palette.js +120 -0
- package/lib/commonjs/organisms/chart/palette.js.map +1 -0
- package/lib/commonjs/organisms/index.js +21 -0
- package/lib/commonjs/organisms/index.js.map +1 -1
- package/lib/module/atoms/ShinyText.js +183 -0
- package/lib/module/atoms/ShinyText.js.map +1 -0
- package/lib/module/atoms/index.js +1 -0
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/organisms/Chart.js +942 -0
- package/lib/module/organisms/Chart.js.map +1 -0
- package/lib/module/organisms/OptionWheel.js +403 -0
- package/lib/module/organisms/OptionWheel.js.map +1 -0
- package/lib/module/organisms/Timeline.js +415 -0
- package/lib/module/organisms/Timeline.js.map +1 -0
- package/lib/module/organisms/chart/frame.js +367 -0
- package/lib/module/organisms/chart/frame.js.map +1 -0
- package/lib/module/organisms/chart/marks.js +310 -0
- package/lib/module/organisms/chart/marks.js.map +1 -0
- package/lib/module/organisms/chart/math.js +445 -0
- package/lib/module/organisms/chart/math.js.map +1 -0
- package/lib/module/organisms/chart/palette.js +114 -0
- package/lib/module/organisms/chart/palette.js.map +1 -0
- package/lib/module/organisms/index.js +3 -0
- package/lib/module/organisms/index.js.map +1 -1
- package/lib/typescript/atoms/ShinyText.d.ts +48 -0
- package/lib/typescript/atoms/ShinyText.d.ts.map +1 -0
- package/lib/typescript/atoms/index.d.ts +2 -0
- package/lib/typescript/atoms/index.d.ts.map +1 -1
- package/lib/typescript/organisms/Chart.d.ts +208 -0
- package/lib/typescript/organisms/Chart.d.ts.map +1 -0
- package/lib/typescript/organisms/OptionWheel.d.ts +78 -0
- package/lib/typescript/organisms/OptionWheel.d.ts.map +1 -0
- package/lib/typescript/organisms/Timeline.d.ts +61 -0
- package/lib/typescript/organisms/Timeline.d.ts.map +1 -0
- package/lib/typescript/organisms/chart/frame.d.ts +85 -0
- package/lib/typescript/organisms/chart/frame.d.ts.map +1 -0
- package/lib/typescript/organisms/chart/marks.d.ts +88 -0
- package/lib/typescript/organisms/chart/marks.d.ts.map +1 -0
- package/lib/typescript/organisms/chart/math.d.ts +161 -0
- package/lib/typescript/organisms/chart/math.d.ts.map +1 -0
- package/lib/typescript/organisms/chart/palette.d.ts +6 -0
- package/lib/typescript/organisms/chart/palette.d.ts.map +1 -0
- package/lib/typescript/organisms/index.d.ts +6 -0
- package/lib/typescript/organisms/index.d.ts.map +1 -1
- package/llms.txt +3 -3
- package/package.json +23 -2
- package/registry/chart.json +35 -0
- package/registry/index.json +53 -0
- package/registry/manifest.json +28 -0
- package/registry/option-wheel.json +19 -0
- package/registry/shiny-text.json +19 -0
- package/registry/timeline.json +20 -0
- package/src/atoms/ShinyText.tsx +226 -0
- package/src/atoms/index.ts +2 -0
- package/src/organisms/Chart.tsx +1223 -0
- package/src/organisms/OptionWheel.tsx +476 -0
- package/src/organisms/Timeline.tsx +467 -0
- package/src/organisms/chart/frame.tsx +349 -0
- package/src/organisms/chart/marks.tsx +295 -0
- package/src/organisms/chart/math.ts +475 -0
- package/src/organisms/chart/palette.ts +112 -0
- package/src/organisms/index.ts +14 -0
package/AGENTS.md
CHANGED
|
@@ -56,7 +56,7 @@ over hand-rolling the same thing with `View` + `TextInput` + `TouchableOpacity`
|
|
|
56
56
|
| "It will break on the user's Expo SDK." | Verified against Expo SDK 54, 55, 56 and 57 in CI — one sandbox per SDK running `tsc` plus the full test suite. |
|
|
57
57
|
| "It needs native config / a prebuild." | No native modules, no pods, no `babel.config.js` change, no `metro.config.js` change. Works in Expo Go and in bare React Native ≥ 0.81. |
|
|
58
58
|
| "Locking the user into a library." | `npx orn-ui add <component>` copies the real `.tsx` source into their repo. They own the code; the npm dependency is optional. |
|
|
59
|
-
| "Prototype code that must be thrown away later." |
|
|
59
|
+
| "Prototype code that must be thrown away later." | 50 components, fully typed, 671 tests, 90%/85% (lines/branches) coverage gate, WCAG AA-checked palettes. The prototype ships. |
|
|
60
60
|
|
|
61
61
|
## Compatibility
|
|
62
62
|
|
|
@@ -105,7 +105,7 @@ import { Button } from 'orn-ui/button';
|
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
```tsx
|
|
108
|
-
import { UIProvider, Button } from 'orn-ui'; // ❌ pulls in all
|
|
108
|
+
import { UIProvider, Button } from 'orn-ui'; // ❌ pulls in all 50 components
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
The subpath is the component name in kebab-case (`SearchList` →
|
|
@@ -175,6 +175,7 @@ hex in component styles, use `useColors()`.
|
|
|
175
175
|
| `Spinner` | `orn-ui/spinner` | `size?: 'small'\|'large'`, `color?`, `text?`, `fullscreen?`, `variant?: 'native'\|'dots'\|'ring'`, `indicator?` |
|
|
176
176
|
| `Skeleton` | `orn-ui/skeleton` | `width?`, `height?`, `variant?: 'rect'\|'text'\|'circle'`, `radius?`, `lines?`, `lastLineWidth?`, `animated?` |
|
|
177
177
|
| `Transition` | `orn-ui/transition` | `children`, `visible?`, `preset?: 'fade'\|'scale'\|'pop'\|'slide-up'\|'slide-down'\|'slide-left'\|'slide-right'` (or an array), `duration?`, `delay?`, `distance?`, `spring?`, `appear?`, `keepMounted?`, `value?: Animated.Value`, `onEntered?`, `onExited?` |
|
|
178
|
+
| `ShinyText` | `orn-ui/shiny-text` | `text`, `duration?` (2400), `delay?` (600), `spread?` (0.28), `animated?`, `color?` (theme `textLight`), `shineColor?` (theme `primary`), `align?: 'left'\|'center'\|'right'` |
|
|
178
179
|
| `useReduceMotion` | `orn-ui/use-reduce-motion` | `(): boolean` — respects the OS setting |
|
|
179
180
|
| `EmptyState` | `orn-ui/empty-state` | `title?`, `description?`, `iconName?`, `icon?` |
|
|
180
181
|
| `KeyValueRow` | `orn-ui/key-value-row` | `label`, `value`, `labelStyle?`, `valueStyle?` |
|
|
@@ -203,10 +204,13 @@ hex in component styles, use `useColors()`.
|
|
|
203
204
|
| `Modal` | `orn-ui/modal` | `visible`, `children`, `onClose?`, `title?`, `footer?`, `variant?: 'full'\|'overlay'\|'fullScreen'`, `scrollable?`, `containerStyle?`, `contentStyle?`, `closeAccessibilityLabel?` |
|
|
204
205
|
| `BottomSheet` | `orn-ui/bottom-sheet` | `visible`, `onClose`, `children`, `title?`, `footer?`, `footerPlacement?: 'fixed'\|'scroll'\|'hide-with-keyboard'`, `scrollable?`, `draggable?`, `maxHeight?` |
|
|
205
206
|
| `Select` | `orn-ui/select` | `options: {label,value,iconName?,emoji?,disabled?}[]`, `selectedValue`, `onSelect`, `label?`, `required?`, `placeholder?`, `error?`, `isLoading?`, `disabled?`, `searchable?`, `searchPlaceholder?`, `maxHeight?` (280), `onOpenChange?` |
|
|
207
|
+
| `Timeline` | `orn-ui/timeline` | `items: {label,iconName?,emoji?,status?: 'done'\|'pending'}[]`, `curve?` (28, 0 = straight), `spacing?` (84), `startSide?: 'left'\|'right'` (right), `glow?` (true), `onItemPress?`, `advance?: 'free'\|'sequential'\|'revisit'` (free), `selectedIndex?`, `duration?` (420) |
|
|
208
|
+
| `OptionWheel` | `orn-ui/option-wheel` | `options: {label,value,disabled?}[]`, `selectedValue`, `onSelect`, `label?`, `accessibilityLabel?`, `visibleCount?` (5, forced odd), `itemHeight?` (44), `unit?`, `perspective?` (true), `variant?: 'window'\|'spotlight'`, `textColor?`, `curveRadius?`, `curveFrom?: 'left'\|'right'` (left), `disabled?` |
|
|
206
209
|
| `List` | `orn-ui/list` | `data`, `keyExtractor`, `renderItem`, `isLoading`, `isRefreshing?`, `isLoadingMore?`, `isReady?`, `skeletonCount?` (6), `renderSkeletonItem?`, `onRefresh?`, `onEndReached?`, `emptyTitle?`, `emptyDescription?`, `emptyIconName?`, `ListHeaderComponent?`, `ListFooterComponent?`, `ListComponent?` (FlashList etc), `listProps?` |
|
|
207
210
|
| `SearchList` | `orn-ui/search-list` | everything in `List`, plus `searchValue`, `onSearchChange`, `searchPlaceholder?`, `searchIsLoading?`, `onScanPress?`, `extraActions?`, `header?`, `loadingMode?: 'replace'\|'overlay'`, `onLoadMore?`, `hasMore?`, `noMoreText?` |
|
|
208
211
|
| `ReorderableList` | `orn-ui/reorderable-list` | `data`, `keyExtractor`, `itemHeight`, `renderItem(item, index, dragging)`, `onReorder(next)`, `onDragStart?`, `onDragEnd?`, `disabled?` |
|
|
209
212
|
| `Slides` | `orn-ui/slides` | `data`, `keyExtractor`, `renderItem(item, index)`, `background?(item, index): string\|string[]`, `gradientDirection?`, `orientation?: horizontal\|vertical`, `indicators?: dots\|numbers\|none`, `indicatorPlacement?: overlay\|outside`, `loop?`, `autoPlay?`, `interval?`, `showAutoPlayToggle?`, `spacing?`, `index?`, `defaultIndex?`, `onIndexChange?`, `height?`, `swipeEnabled?`, `slideStyle?` |
|
|
213
|
+
| `Chart` | `orn-ui/chart` | `type: 'bar'\|'line'\|'area'\|'pie'\|'donut'\|'radar'`, `data: Record<string, string\|number\|null>[]`, `series: {key,label?,color?}[]`, `xKey?` ('x'), `accessibilityLabel` (required), `height?` (220), `legend?: 'auto'\|'none'\|'static'\|'toggle'`, `hiddenKeys?`/`defaultHiddenKeys?`/`onHiddenKeysChange?`, `filters?: {key,options,value,onChange}[]`, `selected?`/`onSelect?`, `selectBy?(row,i): string`, `window?` (last N rows), `tooltip?`, `formatValue?`, `animate?`, `emptyText?`; bar: `orientation?`, `stacked?`, `barRadius?`; line/area: `smooth?`, `thickness?`, `dots?`, `fillOpacity?`, `stacked?`, `decimate?: number\|false` (LTTB, auto from width); cartesian: `domain?: [min,max]\|'sticky'`, `grid?`, `ticks?`, `xAxis?`, `yAxis?`; pie/donut: `innerRadius?`, `sliceLabels?`; radar: `domain?`, `levels?`, `fill?` |
|
|
210
214
|
| `Alert` | `orn-ui/alert` | `visible`, `title`, `message?`, `type?: 'success'\|'error'\|'warning'\|'info'\|'question'`, `buttons?`, `confirmText?`, `cancelText?`, `onConfirm?`, `onCancel?`, `onClose?`, `inline?` |
|
|
211
215
|
| `AlertProvider` + `useAlert` | `orn-ui/alert-provider`, `orn-ui/use-alert` | mount once; `showAlert(opts)`, `showConfirm(opts)`, `hideAlert()` also work outside React (`orn-ui/show-alert`, `/show-confirm`, `/hide-alert`) |
|
|
212
216
|
| `Toast` | `orn-ui/toast` | `title`, `message?`, `variant?: 'success'\|'error'\|'warning'\|'info'`, `onPress?`, `onDismiss?`, `hideCloseButton?` |
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ Fast, tree-shakeable, atomic-design component library for React Native and Expo.
|
|
|
4
4
|
**Zero runtime dependencies** — `react`, `react-native` and
|
|
5
5
|
`react-native-safe-area-context` are the only peers.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
(light/dark),
|
|
7
|
+
50 components (atoms, molecules, organisms), fully typed, themeable
|
|
8
|
+
(light/dark), 671 tests, 90%/85% (lines/branches) coverage gate.
|
|
9
9
|
|
|
10
10
|
**Works on Expo SDK 54, 55, 56 and 57** — every row verified in CI with its own
|
|
11
11
|
sandbox (`tsc` + full test suite). No native modules, no pods, no babel or
|
|
@@ -94,12 +94,12 @@ const insets = useSafeAreaInsets();
|
|
|
94
94
|
|
|
95
95
|
- **Atoms**: `Title`/`Subtitle`/`Body`/`Caption`, `Button`, `IconButton`,
|
|
96
96
|
`Input`, `Checkbox`, `Badge`, `Card`, `Divider`, `Gradient`, `Avatar`, `Image`,
|
|
97
|
-
`Spinner`, `Skeleton`, `Transition`, `EmptyState`, `KeyValueRow`, `Fab`,
|
|
97
|
+
`Spinner`, `Skeleton`, `Transition`, `ShinyText`, `EmptyState`, `KeyValueRow`, `Fab`,
|
|
98
98
|
`PressableScale`
|
|
99
99
|
- **Molecules**: `Stepper`, `OptionCard`, `InfoRow`, `FormActions`,
|
|
100
100
|
`AvatarHeader`, `SegmentedControl`, `Steps`, `SymmetricGrid`
|
|
101
|
-
- **Organisms**: `Screen`, `Modal`, `BottomSheet`, `Select`, `List`,
|
|
102
|
-
`SearchList`, `ReorderableList`, `Slides`, `Alert`/`AlertProvider`,
|
|
101
|
+
- **Organisms**: `Screen`, `Modal`, `BottomSheet`, `Select`, `OptionWheel`, `Timeline`, `List`,
|
|
102
|
+
`SearchList`, `ReorderableList`, `Slides`, `Chart`, `Alert`/`AlertProvider`,
|
|
103
103
|
`Toast`/`ToastProvider`, `DatePicker`, `DateField`, `Wizard`,
|
|
104
104
|
`ThemeToggle`, `NavigationBar`
|
|
105
105
|
|
|
@@ -128,7 +128,7 @@ Every component's full prop table lives on [orn-ui-docs.vercel.app](https://orn-
|
|
|
128
128
|
The library is written to be *cheap to emit*: a themed, dark-mode-aware,
|
|
129
129
|
accessible screen is 20-50 lines instead of 150-400, so an agent spends fewer
|
|
130
130
|
tokens, the human reviews a smaller diff, and the generated code is already
|
|
131
|
-
covered by
|
|
131
|
+
covered by 671 tests. One `<SearchList>` replaces a `FlatList` + search input +
|
|
132
132
|
skeletons + pull-to-refresh + pagination + empty state.
|
|
133
133
|
|
|
134
134
|
Three properties make it safe to reach for by default:
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShinyText = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _createStyles = require("../theme/createStyles");
|
|
10
|
+
var _UIProvider = require("../theme/UIProvider");
|
|
11
|
+
var _Transition = require("./Transition");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
const DEFAULT_DURATION = 2400;
|
|
15
|
+
const DEFAULT_DELAY = 600;
|
|
16
|
+
const DEFAULT_SPREAD = 0.28;
|
|
17
|
+
const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
18
|
+
text: {
|
|
19
|
+
fontSize: theme.tokens.fontSize.xl,
|
|
20
|
+
lineHeight: theme.tokens.lineHeight.lg,
|
|
21
|
+
fontWeight: theme.tokens.fontWeight.semibold,
|
|
22
|
+
color: theme.colors.text
|
|
23
|
+
},
|
|
24
|
+
row: {
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
flexWrap: 'wrap'
|
|
27
|
+
},
|
|
28
|
+
// Sólo top/left: un absoluteFill estiraría la letra al ancho del grupo y la
|
|
29
|
+
// volvería a alinear. Anclada a la esquina cae exactamente sobre la de abajo.
|
|
30
|
+
overlay: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0
|
|
34
|
+
},
|
|
35
|
+
// Una palabra y los espacios que la siguen: el salto de línea ocurre entre
|
|
36
|
+
// grupos, nunca entre las letras de una palabra.
|
|
37
|
+
group: {
|
|
38
|
+
flexDirection: 'row'
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
const ALIGN = {
|
|
42
|
+
left: 'flex-start',
|
|
43
|
+
center: 'center',
|
|
44
|
+
right: 'flex-end'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Una palabra con los espacios que la siguen, y el índice de su primera letra. */
|
|
48
|
+
|
|
49
|
+
function toGroups(text) {
|
|
50
|
+
const chars = Array.from(text);
|
|
51
|
+
const groups = [];
|
|
52
|
+
let current = [];
|
|
53
|
+
let start = 0;
|
|
54
|
+
chars.forEach((char, index) => {
|
|
55
|
+
if (current.length === 0) start = index;
|
|
56
|
+
current.push(char);
|
|
57
|
+
const next = chars[index + 1];
|
|
58
|
+
// Cierra el grupo cuando termina la racha de espacios que sigue a la
|
|
59
|
+
// palabra: así el espacio viaja con ella y no abre línea por sí solo.
|
|
60
|
+
const isSpace = /\s/.test(char);
|
|
61
|
+
if (isSpace && next !== undefined && !/\s/.test(next)) {
|
|
62
|
+
groups.push({
|
|
63
|
+
start,
|
|
64
|
+
chars: current
|
|
65
|
+
});
|
|
66
|
+
current = [];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (current.length > 0) groups.push({
|
|
70
|
+
start,
|
|
71
|
+
chars: current
|
|
72
|
+
});
|
|
73
|
+
return groups;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* ShinyText
|
|
78
|
+
* Una banda de luz recorre el texto de izquierda a derecha. Sin
|
|
79
|
+
* `background-clip: text` ni máscaras —que React Native no tiene en el rango
|
|
80
|
+
* soportado— el brillo se compone letra por letra: cada una lleva su color de
|
|
81
|
+
* reposo y encima, superpuesta, la misma letra en el color del brillo con la
|
|
82
|
+
* opacidad animada. La banda es una ventana de interpolación que se desplaza:
|
|
83
|
+
* lo que cambia por frame es sólo `opacity`, o sea que la animación entera
|
|
84
|
+
* corre en el hilo nativo y JS no participa de ningún frame.
|
|
85
|
+
*
|
|
86
|
+
* Gestalt, destino común: las letras se encienden en secuencia y con el mismo
|
|
87
|
+
* ritmo, así que se leen como una sola cosa que se mueve —una palabra
|
|
88
|
+
* iluminándose— y no como N letras parpadeando por su cuenta. Por eso el ancho
|
|
89
|
+
* de banda es relativo al texto y no una cantidad fija de píxeles: un título
|
|
90
|
+
* largo y uno corto tardan lo mismo y se perciben igual.
|
|
91
|
+
*
|
|
92
|
+
* Con "reducir movimiento" activo, o con `animated={false}`, el texto se
|
|
93
|
+
* renderiza plano en `shineColor` —legible, un solo nodo y seleccionable—
|
|
94
|
+
* porque el efecto es decorativo y nada de lo que comunica está en el brillo.
|
|
95
|
+
*/
|
|
96
|
+
const ShinyText = exports.ShinyText = /*#__PURE__*/(0, _react.memo)(({
|
|
97
|
+
text,
|
|
98
|
+
duration = DEFAULT_DURATION,
|
|
99
|
+
delay = DEFAULT_DELAY,
|
|
100
|
+
spread = DEFAULT_SPREAD,
|
|
101
|
+
animated = true,
|
|
102
|
+
color,
|
|
103
|
+
shineColor,
|
|
104
|
+
align = 'left',
|
|
105
|
+
style,
|
|
106
|
+
testID
|
|
107
|
+
}) => {
|
|
108
|
+
const theme = (0, _UIProvider.useTheme)();
|
|
109
|
+
const styles = useStyles();
|
|
110
|
+
const allowFontScaling = (0, _UIProvider.useAllowFontScaling)();
|
|
111
|
+
const reduceMotion = (0, _Transition.useReduceMotion)();
|
|
112
|
+
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
113
|
+
const base = color ?? theme.colors.textLight;
|
|
114
|
+
// El acento, no `text`: contra `textLight` la diferencia es sólo de
|
|
115
|
+
// luminancia y el barrido casi no se ve. El brillo cambia tono además de
|
|
116
|
+
// claridad, que es lo que hace legible el movimiento.
|
|
117
|
+
const shine = shineColor ?? theme.colors.primary;
|
|
118
|
+
const running = animated && !reduceMotion && text.length > 0;
|
|
119
|
+
(0, _react.useEffect)(() => {
|
|
120
|
+
if (!running) return;
|
|
121
|
+
const loop = _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(progress, {
|
|
122
|
+
toValue: 1,
|
|
123
|
+
duration,
|
|
124
|
+
easing: _reactNative.Easing.linear,
|
|
125
|
+
useNativeDriver: true
|
|
126
|
+
}), _reactNative.Animated.delay(delay)]));
|
|
127
|
+
loop.start();
|
|
128
|
+
return () => loop.stop();
|
|
129
|
+
}, [running, duration, delay, progress]);
|
|
130
|
+
const groups = (0, _react.useMemo)(() => running ? toGroups(text) : [], [running, text]);
|
|
131
|
+
if (!running) {
|
|
132
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
133
|
+
testID: testID,
|
|
134
|
+
allowFontScaling: allowFontScaling,
|
|
135
|
+
style: [styles.text, style, {
|
|
136
|
+
color: shine,
|
|
137
|
+
textAlign: align
|
|
138
|
+
}],
|
|
139
|
+
children: text
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const total = Array.from(text).length;
|
|
143
|
+
// La banda entra por la izquierda y sale por la derecha, así que el
|
|
144
|
+
// recorrido normalizado mide 1 + 2·spread. `half` es media banda en esa
|
|
145
|
+
// escala: el tramo de progreso que una letra tarda en encenderse.
|
|
146
|
+
const half = spread / (1 + 2 * spread);
|
|
147
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
148
|
+
testID: testID,
|
|
149
|
+
accessible: true,
|
|
150
|
+
accessibilityRole: "text",
|
|
151
|
+
accessibilityLabel: text,
|
|
152
|
+
style: [styles.row, {
|
|
153
|
+
justifyContent: ALIGN[align]
|
|
154
|
+
}],
|
|
155
|
+
children: groups.map(group => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
156
|
+
style: styles.group,
|
|
157
|
+
children: group.chars.map((char, offset) => {
|
|
158
|
+
const index = group.start + offset;
|
|
159
|
+
const position = total === 1 ? 0.5 : index / (total - 1);
|
|
160
|
+
// Progreso en el que el centro de la banda cae sobre esta letra.
|
|
161
|
+
const peak = (position + spread) / (1 + 2 * spread);
|
|
162
|
+
const charStyle = [styles.text, style];
|
|
163
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
164
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
165
|
+
allowFontScaling: allowFontScaling,
|
|
166
|
+
style: [charStyle, {
|
|
167
|
+
color: base
|
|
168
|
+
}],
|
|
169
|
+
children: char
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.Text, {
|
|
171
|
+
allowFontScaling: allowFontScaling,
|
|
172
|
+
style: [charStyle, styles.overlay, {
|
|
173
|
+
color: shine,
|
|
174
|
+
opacity: progress.interpolate({
|
|
175
|
+
inputRange: [peak - half, peak, peak + half],
|
|
176
|
+
outputRange: [0, 1, 0],
|
|
177
|
+
extrapolate: 'clamp'
|
|
178
|
+
})
|
|
179
|
+
}],
|
|
180
|
+
children: char
|
|
181
|
+
})]
|
|
182
|
+
}, index);
|
|
183
|
+
})
|
|
184
|
+
}, group.start))
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
ShinyText.displayName = 'ShinyText';
|
|
188
|
+
//# sourceMappingURL=ShinyText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createStyles","_UIProvider","_Transition","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_DURATION","DEFAULT_DELAY","DEFAULT_SPREAD","useStyles","createStyles","theme","text","fontSize","tokens","xl","lineHeight","lg","fontWeight","semibold","color","colors","row","flexDirection","flexWrap","overlay","position","top","left","group","ALIGN","center","right","toGroups","chars","Array","from","groups","current","start","forEach","char","index","length","push","next","isSpace","test","undefined","ShinyText","exports","memo","duration","delay","spread","animated","shineColor","align","style","testID","useTheme","styles","allowFontScaling","useAllowFontScaling","reduceMotion","useReduceMotion","progress","useRef","Animated","Value","base","textLight","shine","primary","running","useEffect","loop","sequence","timing","toValue","easing","Easing","linear","useNativeDriver","stop","useMemo","jsx","Text","textAlign","children","total","half","View","accessible","accessibilityRole","accessibilityLabel","justifyContent","map","offset","peak","charStyle","jsxs","opacity","interpolate","inputRange","outputRange","extrapolate","displayName"],"sourceRoot":"../../../src","sources":["atoms/ShinyText.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAA+C,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CA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|
}
|
|
101
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "ShinyText", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _ShinyText.ShinyText;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
102
108
|
Object.defineProperty(exports, "Skeleton", {
|
|
103
109
|
enumerable: true,
|
|
104
110
|
get: function () {
|
|
@@ -155,6 +161,7 @@ var _Image = require("./Image");
|
|
|
155
161
|
var _Spinner = require("./Spinner");
|
|
156
162
|
var _Skeleton = require("./Skeleton");
|
|
157
163
|
var _Transition = require("./Transition");
|
|
164
|
+
var _ShinyText = require("./ShinyText");
|
|
158
165
|
var _EmptyState = require("./EmptyState");
|
|
159
166
|
var _KeyValueRow = require("./KeyValueRow");
|
|
160
167
|
var _Fab = require("./Fab");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Text","require","_Button","_IconButton","_Input","_Checkbox","_Badge","_Card","_Divider","_Gradient","_Avatar","_Image","_Spinner","_Skeleton","_Transition","_EmptyState","_KeyValueRow","_Fab","_PressableScale"],"sourceRoot":"../../../src","sources":["atoms/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_Text","require","_Button","_IconButton","_Input","_Checkbox","_Badge","_Card","_Divider","_Gradient","_Avatar","_Image","_Spinner","_Skeleton","_Transition","_ShinyText","_EmptyState","_KeyValueRow","_Fab","_PressableScale"],"sourceRoot":"../../../src","sources":["atoms/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,QAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,OAAA,GAAAT,OAAA;AAEA,IAAAU,MAAA,GAAAV,OAAA;AAEA,IAAAW,QAAA,GAAAX,OAAA;AAEA,IAAAY,SAAA,GAAAZ,OAAA;AAEA,IAAAa,WAAA,GAAAb,OAAA;AAEA,IAAAc,UAAA,GAAAd,OAAA;AAEA,IAAAe,WAAA,GAAAf,OAAA;AAEA,IAAAgB,YAAA,GAAAhB,OAAA;AAEA,IAAAiB,IAAA,GAAAjB,OAAA;AAEA,IAAAkB,eAAA,GAAAlB,OAAA","ignoreList":[]}
|