jy-headless 0.2.23 → 0.2.26

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/cjs/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export { default as Button } from './buttons/Button/Button';
2
+ export { default as Input } from './inputs/Input/Input';
3
+ export * as Types from './types';
4
+ export * as Utils from './utils';
package/cjs/index.js CHANGED
@@ -1,7 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var Button = require('./buttons/Button/Button.js');
4
+ var Input = require('./inputs/Input/Input.js');
5
+ var index = require('./types/index.js');
6
+ var index$1 = require('./utils/index.js');
7
+
8
+ function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
9
+
10
+ var index__namespace = /*#__PURE__*/_interopNamespaceDefaultOnly(index$1);
4
11
 
5
12
 
6
13
 
7
14
  exports.Button = Button;
15
+ exports.Input = Input;
16
+ exports.Types = index;
17
+ exports.Utils = index__namespace;
@@ -0,0 +1,3 @@
1
+ import { InputProps } from '../../types/inputs/types';
2
+ declare const Input: ({ id, suffixElement, prefixElement, wrapperStyle, wrapperClass, children, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Input;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var ArrayUtils = require('../../utils/ArrayUtils.js');
5
+
6
+ const Input = ({ id, suffixElement, prefixElement, wrapperStyle, wrapperClass, children, ...props }) => {
7
+ return (jsxRuntime.jsxs("span", { "data-testid": 'input-wrapper', id: [id, 'input-wrapper'].join('-'), className: wrapperClass && ArrayUtils.toFlat(wrapperClass).join(' '), style: wrapperStyle, children: [prefixElement, jsxRuntime.jsx("input", { id: id, ...props }), suffixElement] }));
8
+ };
9
+
10
+ module.exports = Input;
@@ -0,0 +1 @@
1
+ export { default } from './Input/Input';
@@ -1 +1,2 @@
1
1
  export * from './buttons/types';
2
+ export * from './inputs/types';
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,7 @@
1
+ import { CSSProperties, InputHTMLAttributes, ReactElement, ReactNode } from 'react';
2
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ suffixElement?: ReactElement | ReactNode;
4
+ prefixElement?: ReactElement | ReactNode;
5
+ wrapperStyle?: CSSProperties;
6
+ wrapperClass?: string | string[];
7
+ }
@@ -0,0 +1,4 @@
1
+ declare const ArrayUtils: {
2
+ toFlat(...args: (string | string[])[]): string[];
3
+ };
4
+ export default ArrayUtils;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const ArrayUtils = {
4
+ toFlat(...args) {
5
+ return args.flat().map(String).filter(Boolean);
6
+ },
7
+ };
8
+
9
+ module.exports = ArrayUtils;
@@ -0,0 +1 @@
1
+ export { default } from './ArrayUtils';
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var ArrayUtils = require('./ArrayUtils.js');
4
+
5
+
6
+
7
+ module.exports = ArrayUtils;
package/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export { default as Button } from './buttons/Button/Button';
2
+ export { default as Input } from './inputs/Input/Input';
3
+ export * as Types from './types';
4
+ export * as Utils from './utils';
package/index.js CHANGED
@@ -1 +1,6 @@
1
1
  export { default as Button } from './buttons/Button/Button.js';
2
+ export { default as Input } from './inputs/Input/Input.js';
3
+ import * as index from './types/index.js';
4
+ export { index as Types };
5
+ import * as index$1 from './utils/index.js';
6
+ export { index$1 as Utils };
@@ -0,0 +1,3 @@
1
+ import { InputProps } from '../../types/inputs/types';
2
+ declare const Input: ({ id, suffixElement, prefixElement, wrapperStyle, wrapperClass, children, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Input;
@@ -0,0 +1,8 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import ArrayUtils from '../../utils/ArrayUtils.js';
3
+
4
+ const Input = ({ id, suffixElement, prefixElement, wrapperStyle, wrapperClass, children, ...props }) => {
5
+ return (jsxs("span", { "data-testid": 'input-wrapper', id: [id, 'input-wrapper'].join('-'), className: wrapperClass && ArrayUtils.toFlat(wrapperClass).join(' '), style: wrapperStyle, children: [prefixElement, jsx("input", { id: id, ...props }), suffixElement] }));
6
+ };
7
+
8
+ export { Input as default };
@@ -0,0 +1 @@
1
+ export { default } from './Input/Input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jy-headless",
3
- "version": "0.2.23",
3
+ "version": "0.2.26",
4
4
  "description": "A lightweight and customizable headless UI library for React components",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/yCZwIqY/jy-headless",
@@ -24,9 +24,39 @@
24
24
  "types": "./cjs/index.d.ts"
25
25
  },
26
26
  "./index": {
27
- "import": "./index.js",
28
- "require": "./cjs/index.js",
29
- "types": "./index.d.ts"
27
+ "import": "./utils/index.js",
28
+ "require": "./cjs/utils/index.js",
29
+ "types": "./utils/index.d.ts"
30
+ },
31
+ "./Input": {
32
+ "import": "./inputs/Input/Input.js",
33
+ "require": "./cjs/inputs/Input/Input.js",
34
+ "types": "./inputs/Input/Input.d.ts"
35
+ },
36
+ "./cjs/types": {
37
+ "import": "./cjs/types/index.js",
38
+ "require": "./cjs/cjs/types/index.js",
39
+ "types": "./cjs/types/index.d.ts"
40
+ },
41
+ "./cjs/utils": {
42
+ "import": "./cjs/utils/index.js",
43
+ "require": "./cjs/cjs/utils/index.js",
44
+ "types": "./cjs/utils/index.d.ts"
45
+ },
46
+ "./ArrayUtils": {
47
+ "import": "./utils/ArrayUtils.js",
48
+ "require": "./cjs/utils/ArrayUtils.js",
49
+ "types": "./utils/ArrayUtils.d.ts"
50
+ },
51
+ "./types": {
52
+ "import": "./types/index.js",
53
+ "require": "./cjs/types/index.js",
54
+ "types": "./types/index.d.ts"
55
+ },
56
+ "./utils": {
57
+ "import": "./utils/index.js",
58
+ "require": "./cjs/utils/index.js",
59
+ "types": "./utils/index.d.ts"
30
60
  }
31
61
  },
32
62
  "keywords": [
package/types/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './buttons/types';
2
+ export * from './inputs/types';
package/types/index.js ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,7 @@
1
+ import { CSSProperties, InputHTMLAttributes, ReactElement, ReactNode } from 'react';
2
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ suffixElement?: ReactElement | ReactNode;
4
+ prefixElement?: ReactElement | ReactNode;
5
+ wrapperStyle?: CSSProperties;
6
+ wrapperClass?: string | string[];
7
+ }
@@ -0,0 +1,4 @@
1
+ declare const ArrayUtils: {
2
+ toFlat(...args: (string | string[])[]): string[];
3
+ };
4
+ export default ArrayUtils;
@@ -0,0 +1,7 @@
1
+ const ArrayUtils = {
2
+ toFlat(...args) {
3
+ return args.flat().map(String).filter(Boolean);
4
+ },
5
+ };
6
+
7
+ export { ArrayUtils as default };
@@ -0,0 +1 @@
1
+ export { default } from './ArrayUtils';
package/utils/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './ArrayUtils.js';
package/version.txt CHANGED
@@ -1 +1 @@
1
- 0.2.23
1
+ 0.2.26