@paciu/ui 0.0.37 → 0.0.39

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.
@@ -1 +1,2 @@
1
1
  export { useEscape } from './use-escape';
2
+ export { useSkipFirstEffect } from './use-skip-first-effect';
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export interface UseSkipFirstEffectOptions {
3
+ count?: number;
4
+ }
5
+ export declare const useSkipFirstEffect: (cb: React.EffectCallback, deps?: React.DependencyList) => void;
@@ -0,0 +1,62 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useEffect as u, useRef as p } from "react";
3
+ import './index.css';const _ = "_button_1cbbb_2", d = "_small_1cbbb_17", y = "_text_1cbbb_26", s = {
4
+ button: _,
5
+ small: d,
6
+ text: y,
7
+ "button--error": "_button--error_1cbbb_39"
8
+ };
9
+ function i(t) {
10
+ var r, o, e = "";
11
+ if (typeof t == "string" || typeof t == "number") e += t;
12
+ else if (typeof t == "object") if (Array.isArray(t)) {
13
+ var n = t.length;
14
+ for (r = 0; r < n; r++) t[r] && (o = i(t[r])) && (e && (e += " "), e += o);
15
+ } else for (o in t) t[o] && (e && (e += " "), e += o);
16
+ return e;
17
+ }
18
+ function a() {
19
+ for (var t, r, o = 0, e = "", n = arguments.length; o < n; o++) (t = arguments[o]) && (r = i(t)) && (e && (e += " "), e += r);
20
+ return e;
21
+ }
22
+ const E = (t) => {
23
+ const { children: r, className: o, color: e, text: n, icon: l, loading: b, small: f, ...m } = t;
24
+ return /* @__PURE__ */ c(
25
+ "button",
26
+ {
27
+ className: a(
28
+ s.button,
29
+ {
30
+ [s.text]: n,
31
+ [s.small]: f,
32
+ [s.icon]: l,
33
+ [s.loading]: b,
34
+ ...e && { [s[`paciu-ui-button--${e}`]]: e }
35
+ },
36
+ o
37
+ ),
38
+ ...m,
39
+ children: r
40
+ }
41
+ );
42
+ }, g = "_row_1ojv4_2", x = {
43
+ row: g
44
+ }, h = ({ children: t, className: r, ...o }) => /* @__PURE__ */ c("div", { className: a(x.row, r), ...o, children: t }), j = (t) => {
45
+ u(() => {
46
+ const r = (o) => {
47
+ o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), o.stopImmediatePropagation(), t());
48
+ };
49
+ return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
50
+ }, [t]);
51
+ }, k = (t, r) => {
52
+ const o = p(!0);
53
+ u(() => {
54
+ o.current ? o.current = !1 : t();
55
+ }, r);
56
+ };
57
+ export {
58
+ E as Button,
59
+ h as Row,
60
+ j as useEscape,
61
+ k as useSkipFirstEffect
62
+ };
@@ -1,2 +1,2 @@
1
- (function(n,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],b):(n=typeof globalThis<"u"?globalThis:n||self,b(n["paciu-ui"]={},n["react/jsx-runtime"],n.react))})(this,(function(n,b,_){"use strict";var s=document.createElement("style");s.textContent=`._button_1cbbb_2{position:relative;overflow:hidden;font:inherit;font-weight:600;border:none;cursor:pointer;background:#333;color:#fff;font-size:16px;border-radius:16px;padding:0 16px;min-height:40px;transition:.2s}._button_1cbbb_2._small_1cbbb_17{min-height:32px;border-radius:12px;font-size:12px;padding:0 12px}._button_1cbbb_2:hover{background:#242424}._button_1cbbb_2._text_1cbbb_26{color:#333;background:#3333330d}._button_1cbbb_2._text_1cbbb_26:hover{background:#3333331a}._button_1cbbb_2:disabled{background:#f0f0f0;color:#a0a0a0;cursor:default;pointer-events:none}._button--error_1cbbb_39{position:relative;overflow:hidden;font:inherit;font-weight:600;border:none;cursor:pointer;background:#ea2027;color:#fff;font-size:16px;border-radius:16px;padding:0 16px;min-height:40px;transition:.2s}._button--error_1cbbb_39._small_1cbbb_17{min-height:32px;border-radius:12px;font-size:12px;padding:0 12px}._button--error_1cbbb_39:hover{background:#db1118}._button--error_1cbbb_39._text_1cbbb_26{color:#ea2027;background:#ea20270d}._button--error_1cbbb_39._text_1cbbb_26:hover{background:#ea20271a}._button--error_1cbbb_39:disabled{background:#f0f0f0;color:#a0a0a0;cursor:default;pointer-events:none}._row_1ojv4_2{padding:12px}
2
- /*$vite$:1*/`,document.head.appendChild(s);const i={button:"_button_1cbbb_2",small:"_small_1cbbb_17",text:"_text_1cbbb_26","button--error":"_button--error_1cbbb_39"};function a(t){var r,e,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var c=t.length;for(r=0;r<c;r++)t[r]&&(e=a(t[r]))&&(o&&(o+=" "),o+=e)}else for(e in t)t[e]&&(o&&(o+=" "),o+=e);return o}function u(){for(var t,r,e=0,o="",c=arguments.length;e<c;e++)(t=arguments[e])&&(r=a(t))&&(o&&(o+=" "),o+=r);return o}const d=t=>{const{children:r,className:e,color:o,text:c,icon:x,loading:m,small:g,...h}=t;return b.jsx("button",{className:u(i.button,{[i.text]:c,[i.small]:g,[i.icon]:x,[i.loading]:m,...o&&{[i[`paciu-ui-button--${o}`]]:o}},e),...h,children:r})},f={row:"_row_1ojv4_2"},l=({children:t,className:r,...e})=>b.jsx("div",{className:u(f.row,r),...e,children:t}),p=t=>{_.useEffect(()=>{const r=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t])};n.Button=d,n.Row=l,n.useEscape=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(n,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],b):(n=typeof globalThis<"u"?globalThis:n||self,b(n["paciu-ui"]={},n["react/jsx-runtime"],n.react))})(this,(function(n,b,c){"use strict";var u=document.createElement("style");u.textContent=`._button_1cbbb_2{position:relative;overflow:hidden;font:inherit;font-weight:600;border:none;cursor:pointer;background:#333;color:#fff;font-size:16px;border-radius:16px;padding:0 16px;min-height:40px;transition:.2s}._button_1cbbb_2._small_1cbbb_17{min-height:32px;border-radius:12px;font-size:12px;padding:0 12px}._button_1cbbb_2:hover{background:#242424}._button_1cbbb_2._text_1cbbb_26{color:#333;background:#3333330d}._button_1cbbb_2._text_1cbbb_26:hover{background:#3333331a}._button_1cbbb_2:disabled{background:#f0f0f0;color:#a0a0a0;cursor:default;pointer-events:none}._button--error_1cbbb_39{position:relative;overflow:hidden;font:inherit;font-weight:600;border:none;cursor:pointer;background:#ea2027;color:#fff;font-size:16px;border-radius:16px;padding:0 16px;min-height:40px;transition:.2s}._button--error_1cbbb_39._small_1cbbb_17{min-height:32px;border-radius:12px;font-size:12px;padding:0 12px}._button--error_1cbbb_39:hover{background:#db1118}._button--error_1cbbb_39._text_1cbbb_26{color:#ea2027;background:#ea20270d}._button--error_1cbbb_39._text_1cbbb_26:hover{background:#ea20271a}._button--error_1cbbb_39:disabled{background:#f0f0f0;color:#a0a0a0;cursor:default;pointer-events:none}._row_1ojv4_2{padding:12px}
2
+ /*$vite$:1*/`,document.head.appendChild(u);const i={button:"_button_1cbbb_2",small:"_small_1cbbb_17",text:"_text_1cbbb_26","button--error":"_button--error_1cbbb_39"};function a(t){var o,e,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(o=0;o<s;o++)t[o]&&(e=a(t[o]))&&(r&&(r+=" "),r+=e)}else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function _(){for(var t,o,e=0,r="",s=arguments.length;e<s;e++)(t=arguments[e])&&(o=a(t))&&(r&&(r+=" "),r+=o);return r}const d=t=>{const{children:o,className:e,color:r,text:s,icon:m,loading:g,small:h,...v}=t;return b.jsx("button",{className:_(i.button,{[i.text]:s,[i.small]:h,[i.icon]:m,[i.loading]:g,...r&&{[i[`paciu-ui-button--${r}`]]:r}},e),...v,children:o})},f={row:"_row_1ojv4_2"},l=({children:t,className:o,...e})=>b.jsx("div",{className:_(f.row,o),...e,children:t}),p=t=>{c.useEffect(()=>{const o=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t())};return document.addEventListener("keydown",o,!0),()=>document.removeEventListener("keydown",o,!0)},[t])},x=(t,o)=>{const e=c.useRef(!0);c.useEffect(()=>{e.current?e.current=!1:t()},o)};n.Button=d,n.Row=l,n.useEscape=p,n.useSkipFirstEffect=x,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,18 +1,25 @@
1
1
  {
2
2
  "name": "@paciu/ui",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
5
+ "main": "./dist/index.umd.js",
6
+ "module": "./dist/index.es.js",
7
7
  "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.es.js",
12
+ "require": "./dist/index.umd.js"
13
+ }
14
+ },
8
15
  "files": [
9
16
  "dist"
10
17
  ],
11
- "exports": "./dist/index.js",
12
18
  "scripts": {
13
- "lint:format": "npx prettier ./src --write && npx eslint ./src --fix",
14
- "build": "rimraf dist && npm run lint:format && npx tsc -b && vite build",
15
- "prod": "npm run build && npm version patch && npm publish --access public"
19
+ "dev": "",
20
+ "build": "rimraf dist && npm run code-style && npx tsc -b && vite build",
21
+ "prod": "npm run build && npm version patch && npm publish --access public",
22
+ "code-style": "npx prettier ./src --write && npx eslint ./src --fix"
16
23
  },
17
24
  "peerDependencies": {
18
25
  "clsx": "^2.1.1",
@@ -32,6 +39,6 @@
32
39
  "vite": "^7.1.9",
33
40
  "vite-plugin-dts": "^4.5.4",
34
41
  "vite-plugin-lib-inject-css": "^2.2.2",
35
- "@paciu/code-quality": "^0.0.3"
42
+ "@paciu/code-quality": "^0.0.4"
36
43
  }
37
44
  }
File without changes