@webority-technologies/mobile 0.0.3 → 0.0.4

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.
@@ -113,6 +113,7 @@ const SkeletonContent = ({
113
113
  variant = 'shimmer',
114
114
  speed = 'normal',
115
115
  mode = 'auto',
116
+ count = 1,
116
117
  style,
117
118
  testID
118
119
  }) => {
@@ -121,13 +122,18 @@ const SkeletonContent = ({
121
122
  children: children
122
123
  });
123
124
  }
125
+ const repeated = count > 1 ? Array.from({
126
+ length: count
127
+ }, (_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
128
+ children: children
129
+ }, `sk-rep-${i}`)) : children;
124
130
  if (mode === 'block') {
125
131
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockSkeleton, {
126
132
  style: style,
127
133
  testID: testID,
128
134
  variant: variant,
129
135
  speed: speed,
130
- children: children
136
+ children: repeated
131
137
  });
132
138
  }
133
139
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -137,7 +143,7 @@ const SkeletonContent = ({
137
143
  accessibilityLabel: "Loading",
138
144
  accessibilityRole: "progressbar",
139
145
  accessibilityLiveRegion: "polite",
140
- children: skeletonizeNode(children, variant, speed)
146
+ children: skeletonizeNode(repeated, variant, speed)
141
147
  });
142
148
  };
143
149
  exports.SkeletonContent = SkeletonContent;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SkeletonList = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _SkeletonContent = require("./SkeletonContent.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * Drop-in FlatList replacement that renders `placeholderCount` skeleton rows while
14
+ * `loading` is true, then transitions to a real `<FlatList>` of `data` once loaded.
15
+ *
16
+ * Solves the "FlatList with empty data renders nothing" problem so consumer screens
17
+ * don't have to maintain a separate placeholder branch.
18
+ *
19
+ * @example
20
+ * <SkeletonList
21
+ * loading={isLoading}
22
+ * data={sites}
23
+ * renderItem={({ item }) => <SiteCard item={item} />}
24
+ * renderPlaceholder={() => <SiteCard loading />}
25
+ * placeholderCount={3}
26
+ * horizontal
27
+ * />
28
+ */
29
+ function SkeletonListInner(props) {
30
+ const {
31
+ loading,
32
+ data,
33
+ renderItem,
34
+ renderPlaceholder,
35
+ placeholderCount = 3,
36
+ variant,
37
+ speed,
38
+ placeholderContainerStyle,
39
+ horizontal,
40
+ contentContainerStyle,
41
+ style,
42
+ testID,
43
+ ...rest
44
+ } = props;
45
+ if (loading) {
46
+ const slots = Array.from({
47
+ length: Math.max(0, placeholderCount)
48
+ }, (_, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
49
+ children: renderPlaceholder ? renderPlaceholder(index) : null
50
+ }, `sk-list-${index}`));
51
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SkeletonContent.SkeletonContent, {
52
+ loading: true,
53
+ variant: variant,
54
+ speed: speed,
55
+ style: style,
56
+ testID: testID,
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
58
+ style: [horizontal ? styles.row : styles.column, placeholderContainerStyle],
59
+ children: slots
60
+ })
61
+ });
62
+ }
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
64
+ data: data ?? [],
65
+ renderItem: renderItem,
66
+ horizontal: horizontal,
67
+ contentContainerStyle: contentContainerStyle,
68
+ style: style,
69
+ testID: testID,
70
+ ...rest
71
+ });
72
+ }
73
+ const styles = {
74
+ row: {
75
+ flexDirection: 'row'
76
+ },
77
+ column: {
78
+ flexDirection: 'column'
79
+ }
80
+ };
81
+ const SkeletonList = exports.SkeletonList = SkeletonListInner;
82
+ //# sourceMappingURL=SkeletonList.js.map
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "SkeletonContent", {
33
33
  return _SkeletonContent.SkeletonContent;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "SkeletonList", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _SkeletonList.SkeletonList;
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "SkeletonListItem", {
37
43
  enumerable: true,
38
44
  get: function () {
@@ -53,5 +59,6 @@ Object.defineProperty(exports, "default", {
53
59
  });
54
60
  var _Skeleton = _interopRequireWildcard(require("./Skeleton.js"));
55
61
  var _SkeletonContent = require("./SkeletonContent.js");
62
+ var _SkeletonList = require("./SkeletonList.js");
56
63
  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); }
57
64
  //# sourceMappingURL=index.js.map
@@ -261,6 +261,12 @@ Object.defineProperty(exports, "SkeletonContent", {
261
261
  return _index35.SkeletonContent;
262
262
  }
263
263
  });
264
+ Object.defineProperty(exports, "SkeletonList", {
265
+ enumerable: true,
266
+ get: function () {
267
+ return _index35.SkeletonList;
268
+ }
269
+ });
264
270
  Object.defineProperty(exports, "SkeletonListItem", {
265
271
  enumerable: true,
266
272
  get: function () {
@@ -108,6 +108,7 @@ const SkeletonContent = ({
108
108
  variant = 'shimmer',
109
109
  speed = 'normal',
110
110
  mode = 'auto',
111
+ count = 1,
111
112
  style,
112
113
  testID
113
114
  }) => {
@@ -116,13 +117,18 @@ const SkeletonContent = ({
116
117
  children: children
117
118
  });
118
119
  }
120
+ const repeated = count > 1 ? Array.from({
121
+ length: count
122
+ }, (_, i) => /*#__PURE__*/_jsx(React.Fragment, {
123
+ children: children
124
+ }, `sk-rep-${i}`)) : children;
119
125
  if (mode === 'block') {
120
126
  return /*#__PURE__*/_jsx(BlockSkeleton, {
121
127
  style: style,
122
128
  testID: testID,
123
129
  variant: variant,
124
130
  speed: speed,
125
- children: children
131
+ children: repeated
126
132
  });
127
133
  }
128
134
  return /*#__PURE__*/_jsx(View, {
@@ -132,7 +138,7 @@ const SkeletonContent = ({
132
138
  accessibilityLabel: "Loading",
133
139
  accessibilityRole: "progressbar",
134
140
  accessibilityLiveRegion: "polite",
135
- children: skeletonizeNode(children, variant, speed)
141
+ children: skeletonizeNode(repeated, variant, speed)
136
142
  });
137
143
  };
138
144
  SkeletonContent.displayName = 'SkeletonContent';
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { FlatList, View } from 'react-native';
5
+ import { SkeletonContent } from "./SkeletonContent.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * Drop-in FlatList replacement that renders `placeholderCount` skeleton rows while
9
+ * `loading` is true, then transitions to a real `<FlatList>` of `data` once loaded.
10
+ *
11
+ * Solves the "FlatList with empty data renders nothing" problem so consumer screens
12
+ * don't have to maintain a separate placeholder branch.
13
+ *
14
+ * @example
15
+ * <SkeletonList
16
+ * loading={isLoading}
17
+ * data={sites}
18
+ * renderItem={({ item }) => <SiteCard item={item} />}
19
+ * renderPlaceholder={() => <SiteCard loading />}
20
+ * placeholderCount={3}
21
+ * horizontal
22
+ * />
23
+ */
24
+ function SkeletonListInner(props) {
25
+ const {
26
+ loading,
27
+ data,
28
+ renderItem,
29
+ renderPlaceholder,
30
+ placeholderCount = 3,
31
+ variant,
32
+ speed,
33
+ placeholderContainerStyle,
34
+ horizontal,
35
+ contentContainerStyle,
36
+ style,
37
+ testID,
38
+ ...rest
39
+ } = props;
40
+ if (loading) {
41
+ const slots = Array.from({
42
+ length: Math.max(0, placeholderCount)
43
+ }, (_, index) => /*#__PURE__*/_jsx(React.Fragment, {
44
+ children: renderPlaceholder ? renderPlaceholder(index) : null
45
+ }, `sk-list-${index}`));
46
+ return /*#__PURE__*/_jsx(SkeletonContent, {
47
+ loading: true,
48
+ variant: variant,
49
+ speed: speed,
50
+ style: style,
51
+ testID: testID,
52
+ children: /*#__PURE__*/_jsx(View, {
53
+ style: [horizontal ? styles.row : styles.column, placeholderContainerStyle],
54
+ children: slots
55
+ })
56
+ });
57
+ }
58
+ return /*#__PURE__*/_jsx(FlatList, {
59
+ data: data ?? [],
60
+ renderItem: renderItem,
61
+ horizontal: horizontal,
62
+ contentContainerStyle: contentContainerStyle,
63
+ style: style,
64
+ testID: testID,
65
+ ...rest
66
+ });
67
+ }
68
+ const styles = {
69
+ row: {
70
+ flexDirection: 'row'
71
+ },
72
+ column: {
73
+ flexDirection: 'column'
74
+ }
75
+ };
76
+ export const SkeletonList = SkeletonListInner;
77
+ //# sourceMappingURL=SkeletonList.js.map
@@ -2,4 +2,5 @@
2
2
 
3
3
  export { Skeleton, SkeletonCircle, SkeletonText, SkeletonAvatar, SkeletonCard, SkeletonListItem, default } from "./Skeleton.js";
4
4
  export { SkeletonContent } from "./SkeletonContent.js";
5
+ export { SkeletonList } from "./SkeletonList.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -36,7 +36,7 @@ export { SearchBar } from "./SearchBar/index.js";
36
36
  export { SegmentedControl } from "./SegmentedControl/index.js";
37
37
  export { Select } from "./Select/index.js";
38
38
  export { Stepper } from "./Stepper/index.js";
39
- export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonListItem, SkeletonText } from "./Skeleton/index.js";
39
+ export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonList, SkeletonListItem, SkeletonText } from "./Skeleton/index.js";
40
40
  export { Slider } from "./Slider/index.js";
41
41
  export { Swipeable } from "./Swipeable/index.js";
42
42
  export { Switch } from "./Switch/index.js";
@@ -20,6 +20,12 @@ export interface SkeletonContentProps {
20
20
  * cannot inspect.
21
21
  */
22
22
  mode?: SkeletonContentMode;
23
+ /**
24
+ * Repeat `children` this many times while loading. Useful for list layouts where the
25
+ * placeholder shape should appear N times (e.g. 3 site cards, 5 list rows). Ignored when
26
+ * `loading` is false. Default: `1`.
27
+ */
28
+ count?: number;
23
29
  style?: StyleProp<ViewStyle>;
24
30
  testID?: string;
25
31
  }
@@ -0,0 +1,27 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { FlatListProps, StyleProp, ViewStyle } from 'react-native';
3
+ import type { SkeletonSpeed, SkeletonVariant } from './Skeleton';
4
+ export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, 'data' | 'renderItem'> {
5
+ /** Whether the list is in its initial loading state. */
6
+ loading: boolean;
7
+ /** The data to render once loading is complete. */
8
+ data: readonly ItemT[] | null | undefined;
9
+ /** Renders a single real item once data is available. */
10
+ renderItem: FlatListProps<ItemT>['renderItem'];
11
+ /**
12
+ * Renders one placeholder row. Index is provided so callers may vary
13
+ * placeholder shape per slot if desired. Defaults to `null`.
14
+ */
15
+ renderPlaceholder?: (index: number) => ReactNode;
16
+ /** How many placeholder rows to render while loading. Default: 3. */
17
+ placeholderCount?: number;
18
+ /** Animation style — same as Skeleton. */
19
+ variant?: SkeletonVariant;
20
+ /** Animation speed — same as Skeleton. */
21
+ speed?: SkeletonSpeed;
22
+ /** Style applied to the wrapper View around the placeholders. */
23
+ placeholderContainerStyle?: StyleProp<ViewStyle>;
24
+ testID?: string;
25
+ }
26
+ export declare const SkeletonList: <ItemT>(props: SkeletonListProps<ItemT>) => ReactElement;
27
+ //# sourceMappingURL=SkeletonList.d.ts.map
@@ -2,4 +2,6 @@ export { Skeleton, SkeletonCircle, SkeletonText, SkeletonAvatar, SkeletonCard, S
2
2
  export type { SkeletonProps, SkeletonCircleProps, SkeletonTextProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonListItemProps, SkeletonVariant, SkeletonSpeed, SkeletonRadius, SkeletonWidth, SkeletonAvatarSize } from './Skeleton';
3
3
  export { SkeletonContent } from './SkeletonContent';
4
4
  export type { SkeletonContentProps, SkeletonContentMode } from './SkeletonContent';
5
+ export { SkeletonList } from './SkeletonList';
6
+ export type { SkeletonListProps } from './SkeletonList';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -70,8 +70,8 @@ export { Select } from './Select';
70
70
  export type { SelectProps, SelectOption, SelectSize } from './Select';
71
71
  export { Stepper } from './Stepper';
72
72
  export type { StepperProps, StepperVariant, StepperStep, StepperTone } from './Stepper';
73
- export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonListItem, SkeletonText } from './Skeleton';
74
- export type { SkeletonProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonCircleProps, SkeletonContentMode, SkeletonContentProps, SkeletonListItemProps, SkeletonTextProps, SkeletonVariant, SkeletonSpeed } from './Skeleton';
73
+ export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonList, SkeletonListItem, SkeletonText } from './Skeleton';
74
+ export type { SkeletonProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonCircleProps, SkeletonContentMode, SkeletonContentProps, SkeletonListItemProps, SkeletonListProps, SkeletonTextProps, SkeletonVariant, SkeletonSpeed } from './Skeleton';
75
75
  export { Slider } from './Slider';
76
76
  export type { SliderProps, SliderTone, SliderSize } from './Slider';
77
77
  export { Swipeable } from './Swipeable';
@@ -20,6 +20,12 @@ export interface SkeletonContentProps {
20
20
  * cannot inspect.
21
21
  */
22
22
  mode?: SkeletonContentMode;
23
+ /**
24
+ * Repeat `children` this many times while loading. Useful for list layouts where the
25
+ * placeholder shape should appear N times (e.g. 3 site cards, 5 list rows). Ignored when
26
+ * `loading` is false. Default: `1`.
27
+ */
28
+ count?: number;
23
29
  style?: StyleProp<ViewStyle>;
24
30
  testID?: string;
25
31
  }
@@ -0,0 +1,27 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { FlatListProps, StyleProp, ViewStyle } from 'react-native';
3
+ import type { SkeletonSpeed, SkeletonVariant } from './Skeleton';
4
+ export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, 'data' | 'renderItem'> {
5
+ /** Whether the list is in its initial loading state. */
6
+ loading: boolean;
7
+ /** The data to render once loading is complete. */
8
+ data: readonly ItemT[] | null | undefined;
9
+ /** Renders a single real item once data is available. */
10
+ renderItem: FlatListProps<ItemT>['renderItem'];
11
+ /**
12
+ * Renders one placeholder row. Index is provided so callers may vary
13
+ * placeholder shape per slot if desired. Defaults to `null`.
14
+ */
15
+ renderPlaceholder?: (index: number) => ReactNode;
16
+ /** How many placeholder rows to render while loading. Default: 3. */
17
+ placeholderCount?: number;
18
+ /** Animation style — same as Skeleton. */
19
+ variant?: SkeletonVariant;
20
+ /** Animation speed — same as Skeleton. */
21
+ speed?: SkeletonSpeed;
22
+ /** Style applied to the wrapper View around the placeholders. */
23
+ placeholderContainerStyle?: StyleProp<ViewStyle>;
24
+ testID?: string;
25
+ }
26
+ export declare const SkeletonList: <ItemT>(props: SkeletonListProps<ItemT>) => ReactElement;
27
+ //# sourceMappingURL=SkeletonList.d.ts.map
@@ -2,4 +2,6 @@ export { Skeleton, SkeletonCircle, SkeletonText, SkeletonAvatar, SkeletonCard, S
2
2
  export type { SkeletonProps, SkeletonCircleProps, SkeletonTextProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonListItemProps, SkeletonVariant, SkeletonSpeed, SkeletonRadius, SkeletonWidth, SkeletonAvatarSize } from './Skeleton';
3
3
  export { SkeletonContent } from './SkeletonContent';
4
4
  export type { SkeletonContentProps, SkeletonContentMode } from './SkeletonContent';
5
+ export { SkeletonList } from './SkeletonList';
6
+ export type { SkeletonListProps } from './SkeletonList';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -70,8 +70,8 @@ export { Select } from './Select';
70
70
  export type { SelectProps, SelectOption, SelectSize } from './Select';
71
71
  export { Stepper } from './Stepper';
72
72
  export type { StepperProps, StepperVariant, StepperStep, StepperTone } from './Stepper';
73
- export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonListItem, SkeletonText } from './Skeleton';
74
- export type { SkeletonProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonCircleProps, SkeletonContentMode, SkeletonContentProps, SkeletonListItemProps, SkeletonTextProps, SkeletonVariant, SkeletonSpeed } from './Skeleton';
73
+ export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonCircle, SkeletonContent, SkeletonList, SkeletonListItem, SkeletonText } from './Skeleton';
74
+ export type { SkeletonProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonCircleProps, SkeletonContentMode, SkeletonContentProps, SkeletonListItemProps, SkeletonListProps, SkeletonTextProps, SkeletonVariant, SkeletonSpeed } from './Skeleton';
75
75
  export { Slider } from './Slider';
76
76
  export type { SliderProps, SliderTone, SliderSize } from './Slider';
77
77
  export { Swipeable } from './Swipeable';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Beautiful, animated, accessible React Native components plus API/auth/logging/network/storage utilities for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",