@xaui/native 0.0.3 → 0.0.5

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.
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/divider/index.ts
31
+ var divider_exports = {};
32
+ __export(divider_exports, {
33
+ Divider: () => Divider
34
+ });
35
+ module.exports = __toCommonJS(divider_exports);
36
+
37
+ // src/components/divider/divider.tsx
38
+ var import_react4 = __toESM(require("react"), 1);
39
+ var import_react_native4 = require("react-native");
40
+
41
+ // src/components/divider/divider.style.ts
42
+ var import_react_native = require("react-native");
43
+ var styles = import_react_native.StyleSheet.create({
44
+ horizontal: {
45
+ height: 1,
46
+ width: "100%"
47
+ },
48
+ vertical: {
49
+ width: 1,
50
+ alignSelf: "stretch"
51
+ }
52
+ });
53
+
54
+ // src/components/divider/divider.hook.ts
55
+ var import_react3 = require("react");
56
+
57
+ // src/core/theme-context.tsx
58
+ var import_react = __toESM(require("react"), 1);
59
+ var import_react_native2 = require("react-native");
60
+ var import_theme = require("@xaui/core/theme");
61
+ var import_palette = require("@xaui/core/palette");
62
+ var XUIThemeContext = (0, import_react.createContext)(null);
63
+
64
+ // src/core/theme-hooks.ts
65
+ var import_react2 = require("react");
66
+ var import_react_native3 = require("react-native");
67
+ function useXUITheme() {
68
+ const theme = (0, import_react2.useContext)(XUIThemeContext);
69
+ if (!theme) {
70
+ throw new Error("useXUITheme must be used within XUIProvider");
71
+ }
72
+ return theme;
73
+ }
74
+
75
+ // src/components/divider/divider.hook.ts
76
+ var import_core2 = require("@xaui/core");
77
+ var useDividerColor = (themeColor, customColor) => {
78
+ const theme = useXUITheme();
79
+ const dividerColor = (0, import_react3.useMemo)(() => {
80
+ if (customColor) {
81
+ return customColor;
82
+ }
83
+ const safeThemeColor = (0, import_core2.getSafeThemeColor)(themeColor);
84
+ return theme.colors[safeThemeColor].main;
85
+ }, [customColor, themeColor, theme]);
86
+ return dividerColor;
87
+ };
88
+ var useDividerSize = (size, orientation) => {
89
+ const sizeStyles = (0, import_react3.useMemo)(() => {
90
+ if (orientation === "horizontal") {
91
+ return {
92
+ height: size
93
+ };
94
+ }
95
+ return {
96
+ width: size
97
+ };
98
+ }, [size, orientation]);
99
+ return sizeStyles;
100
+ };
101
+
102
+ // src/components/divider/divider.tsx
103
+ var Divider = ({
104
+ size = 1,
105
+ themeColor = "default",
106
+ color,
107
+ orientation = "horizontal"
108
+ }) => {
109
+ const dividerColor = useDividerColor(themeColor, color);
110
+ const sizeStyles = useDividerSize(size, orientation);
111
+ return /* @__PURE__ */ import_react4.default.createElement(
112
+ import_react_native4.View,
113
+ {
114
+ style: [
115
+ orientation === "horizontal" ? styles.horizontal : styles.vertical,
116
+ sizeStyles,
117
+ { backgroundColor: dividerColor }
118
+ ]
119
+ }
120
+ );
121
+ };
122
+ // Annotate the CommonJS export names for ESM import in node:
123
+ 0 && (module.exports = {
124
+ Divider
125
+ });
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
3
+
4
+ type DividerOrientation = 'horizontal' | 'vertical';
5
+ type DividerProps = {
6
+ /**
7
+ * The size (thickness) of the divider in pixels.
8
+ * @default 1
9
+ */
10
+ size?: number;
11
+ /**
12
+ * The theme color of the divider.
13
+ * @default 'default'
14
+ */
15
+ themeColor?: ThemeColor;
16
+ /**
17
+ * Custom color for the divider.
18
+ * If provided, this will override themeColor.
19
+ */
20
+ color?: string;
21
+ /**
22
+ * The orientation of the divider.
23
+ * @default 'horizontal'
24
+ */
25
+ orientation?: DividerOrientation;
26
+ };
27
+
28
+ declare const Divider: React.FC<DividerProps>;
29
+
30
+ export { Divider, type DividerOrientation, type DividerProps };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.js';
3
+
4
+ type DividerOrientation = 'horizontal' | 'vertical';
5
+ type DividerProps = {
6
+ /**
7
+ * The size (thickness) of the divider in pixels.
8
+ * @default 1
9
+ */
10
+ size?: number;
11
+ /**
12
+ * The theme color of the divider.
13
+ * @default 'default'
14
+ */
15
+ themeColor?: ThemeColor;
16
+ /**
17
+ * Custom color for the divider.
18
+ * If provided, this will override themeColor.
19
+ */
20
+ color?: string;
21
+ /**
22
+ * The orientation of the divider.
23
+ * @default 'horizontal'
24
+ */
25
+ orientation?: DividerOrientation;
26
+ };
27
+
28
+ declare const Divider: React.FC<DividerProps>;
29
+
30
+ export { Divider, type DividerOrientation, type DividerProps };
@@ -0,0 +1,7 @@
1
+ import {
2
+ Divider
3
+ } from "../chunk-AX7QS5WJ.js";
4
+ import "../chunk-3ECCBLTG.js";
5
+ export {
6
+ Divider
7
+ };
@@ -1,4 +1,5 @@
1
1
  type ThemeColor = 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'success' | 'default';
2
2
  type Size = 'xs' | 'sm' | 'md' | 'lg';
3
+ type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
3
4
 
4
- export type { Size as S, ThemeColor as T };
5
+ export type { Radius as R, Size as S, ThemeColor as T };
@@ -1,4 +1,5 @@
1
1
  type ThemeColor = 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'success' | 'default';
2
2
  type Size = 'xs' | 'sm' | 'md' | 'lg';
3
+ type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
3
4
 
4
- export type { Size as S, ThemeColor as T };
5
+ export type { Radius as R, Size as S, ThemeColor as T };
package/dist/index.cjs CHANGED
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- ActivityIndicator: () => ActivityIndicator
33
+ ActivityIndicator: () => ActivityIndicator,
34
+ Divider: () => Divider
34
35
  });
35
36
  module.exports = __toCommonJS(src_exports);
36
37
 
@@ -42,6 +43,7 @@ var import_react_native6 = require("react-native");
42
43
  var import_react = __toESM(require("react"), 1);
43
44
  var import_react_native = require("react-native");
44
45
  var import_theme = require("@xaui/core/theme");
46
+ var import_palette = require("@xaui/core/palette");
45
47
  var XUIThemeContext = (0, import_react.createContext)(null);
46
48
 
47
49
  // src/core/theme-hooks.ts
@@ -411,7 +413,74 @@ var ActivityIndicator = (props) => {
411
413
  )
412
414
  );
413
415
  };
416
+
417
+ // src/components/divider/divider.tsx
418
+ var import_react8 = __toESM(require("react"), 1);
419
+ var import_react_native8 = require("react-native");
420
+
421
+ // src/components/divider/divider.style.ts
422
+ var import_react_native7 = require("react-native");
423
+ var styles2 = import_react_native7.StyleSheet.create({
424
+ horizontal: {
425
+ height: 1,
426
+ width: "100%"
427
+ },
428
+ vertical: {
429
+ width: 1,
430
+ alignSelf: "stretch"
431
+ }
432
+ });
433
+
434
+ // src/components/divider/divider.hook.ts
435
+ var import_react7 = require("react");
436
+ var import_core6 = require("@xaui/core");
437
+ var useDividerColor = (themeColor, customColor) => {
438
+ const theme = useXUITheme();
439
+ const dividerColor = (0, import_react7.useMemo)(() => {
440
+ if (customColor) {
441
+ return customColor;
442
+ }
443
+ const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
444
+ return theme.colors[safeThemeColor].main;
445
+ }, [customColor, themeColor, theme]);
446
+ return dividerColor;
447
+ };
448
+ var useDividerSize = (size, orientation) => {
449
+ const sizeStyles = (0, import_react7.useMemo)(() => {
450
+ if (orientation === "horizontal") {
451
+ return {
452
+ height: size
453
+ };
454
+ }
455
+ return {
456
+ width: size
457
+ };
458
+ }, [size, orientation]);
459
+ return sizeStyles;
460
+ };
461
+
462
+ // src/components/divider/divider.tsx
463
+ var Divider = ({
464
+ size = 1,
465
+ themeColor = "default",
466
+ color,
467
+ orientation = "horizontal"
468
+ }) => {
469
+ const dividerColor = useDividerColor(themeColor, color);
470
+ const sizeStyles = useDividerSize(size, orientation);
471
+ return /* @__PURE__ */ import_react8.default.createElement(
472
+ import_react_native8.View,
473
+ {
474
+ style: [
475
+ orientation === "horizontal" ? styles2.horizontal : styles2.vertical,
476
+ sizeStyles,
477
+ { backgroundColor: dividerColor }
478
+ ]
479
+ }
480
+ );
481
+ };
414
482
  // Annotate the CommonJS export names for ESM import in node:
415
483
  0 && (module.exports = {
416
- ActivityIndicator
484
+ ActivityIndicator,
485
+ Divider
417
486
  });
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { ActivityIndicator } from './indicator/index.cjs';
2
+ export { Divider } from './divider/index.cjs';
2
3
  import 'react';
3
- import './index-BDSvmsTU.cjs';
4
+ import './index-BOw6tbkc.cjs';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { ActivityIndicator } from './indicator/index.js';
2
+ export { Divider } from './divider/index.js';
2
3
  import 'react';
3
- import './index-BDSvmsTU.js';
4
+ import './index-BOw6tbkc.js';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import {
2
2
  ActivityIndicator
3
- } from "./chunk-52PIZF2Z.js";
4
- import "./chunk-DNJWBME5.js";
3
+ } from "./chunk-KI7CPXTP.js";
4
+ import {
5
+ Divider
6
+ } from "./chunk-AX7QS5WJ.js";
7
+ import "./chunk-3ECCBLTG.js";
5
8
  export {
6
- ActivityIndicator
9
+ ActivityIndicator,
10
+ Divider
7
11
  };
@@ -42,6 +42,7 @@ var import_react_native6 = require("react-native");
42
42
  var import_react = __toESM(require("react"), 1);
43
43
  var import_react_native = require("react-native");
44
44
  var import_theme = require("@xaui/core/theme");
45
+ var import_palette = require("@xaui/core/palette");
45
46
  var XUIThemeContext = (0, import_react.createContext)(null);
46
47
 
47
48
  // src/core/theme-hooks.ts
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as ThemeColor } from '../index-BDSvmsTU.cjs';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
3
3
 
4
4
  type ActivityIndicatorVariant = 'linear' | 'circular';
5
5
  type ActivityIndicatorProps = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as ThemeColor } from '../index-BDSvmsTU.js';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.js';
3
3
 
4
4
  type ActivityIndicatorVariant = 'linear' | 'circular';
5
5
  type ActivityIndicatorProps = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ActivityIndicator
3
- } from "../chunk-52PIZF2Z.js";
4
- import "../chunk-DNJWBME5.js";
3
+ } from "../chunk-KI7CPXTP.js";
4
+ import "../chunk-3ECCBLTG.js";
5
5
  export {
6
6
  ActivityIndicator
7
7
  };
@@ -42,6 +42,7 @@ var import_react_native6 = require("react-native");
42
42
  var import_react = __toESM(require("react"), 1);
43
43
  var import_react_native = require("react-native");
44
44
  var import_theme = require("@xaui/core/theme");
45
+ var import_palette = require("@xaui/core/palette");
45
46
  var XUIThemeContext = (0, import_react.createContext)(null);
46
47
 
47
48
  // src/core/theme-hooks.ts
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as ThemeColor } from '../index-BDSvmsTU.cjs';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
3
3
 
4
4
  type ProgressVariant = 'linear' | 'circular';
5
5
  type ProgressIndicatorProps = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as ThemeColor } from '../index-BDSvmsTU.js';
2
+ import { T as ThemeColor } from '../index-BOw6tbkc.js';
3
3
 
4
4
  type ProgressVariant = 'linear' | 'circular';
5
5
  type ProgressIndicatorProps = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useXUITheme
3
- } from "../chunk-DNJWBME5.js";
3
+ } from "../chunk-3ECCBLTG.js";
4
4
 
5
5
  // src/components/progress/progress.tsx
6
6
  import React3 from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Flutter-inspired React Native UI components with native animations powered by React Native Reanimated",
5
5
  "keywords": [
6
6
  "react-native",
@@ -37,6 +37,11 @@
37
37
  "import": "./dist/checkbox/index.js",
38
38
  "require": "./dist/checkbox/index.js"
39
39
  },
40
+ "./accordion": {
41
+ "types": "./dist/accordion/index.d.ts",
42
+ "import": "./dist/accordion/index.js",
43
+ "require": "./dist/accordion/index.js"
44
+ },
40
45
  "./progress": {
41
46
  "types": "./dist/progress/index.d.ts",
42
47
  "import": "./dist/progress/index.js",
@@ -46,6 +51,11 @@
46
51
  "types": "./dist/indicator/index.d.ts",
47
52
  "import": "./dist/indicator/index.js",
48
53
  "require": "./dist/indicator/index.js"
54
+ },
55
+ "./divider": {
56
+ "types": "./dist/divider/index.d.ts",
57
+ "import": "./dist/divider/index.js",
58
+ "require": "./dist/divider/index.js"
49
59
  }
50
60
  },
51
61
  "files": [
@@ -58,7 +68,7 @@
58
68
  "directory": "packages/native"
59
69
  },
60
70
  "dependencies": {
61
- "@xaui/core": "0.1.6"
71
+ "@xaui/core": "0.1.7"
62
72
  },
63
73
  "peerDependencies": {
64
74
  "react": "^18.0.0 || ^19.0.0",