@loja-integrada/admin-components 1.3.17 → 1.3.19

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,8 @@
1
+ import { a } from './chunk-AGCI6C3Z.js';
2
+ import { cva } from 'class-variance-authority';
3
+ import g, { useState, useEffect } from 'react';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var N=cva("text-f6 border-y border-l border-primary font-semibold",{variants:{variant:{small:"px-4 py-1",default:"px-5 py-2",large:"px-6 py-4"},active:{true:"bg-primary text-base-1",false:"text-primary"},borderDirection:{left:"rounded-l",middle:"",right:"rounded-r border-r"},disabled:{true:"cursor-not-allowed opacity-50",false:""}}}),T=({items:o,defaultItem:c=o[0]?.slug,disabled:u=!1,className:f="",variant:m="default",value:r,onChange:a$1})=>{let[l,n]=useState(c);useEffect(()=>{r!==void 0&&n(r);},[r]);function b(t){t!==l&&(n(t),a$1&&a$1(t));}return jsx("nav",{id:"toggle-button","aria-label":"Toggle Button",className:f,children:jsx("ul",{className:"flex",children:o.map((t,s)=>{let p=s===0?"left":o.length-1===s?"right":"middle",i=u||t.disabled;return jsx("li",{children:jsx("button",{id:`toggle-button-${t.slug}`,type:"button",disabled:i,onClick:()=>b(t.slug),className:a(N({variant:m,active:t.slug===l,borderDirection:p,disabled:i}),t.className),children:t.content})},t.slug)})})})},x=g.forwardRef(T),h=g.memo(x);h.displayName="ToggleButton";
7
+
8
+ export { h as a };
@@ -15,6 +15,10 @@ interface ToggleButtonProps {
15
15
  * The default item to be selected
16
16
  * */
17
17
  defaultItem: string;
18
+ /**
19
+ * Controls the currently selected item externally (for controlled usage)
20
+ * */
21
+ value?: string;
18
22
  /**
19
23
  * If true, the button will be disabled
20
24
  * */
@@ -23,6 +27,10 @@ interface ToggleButtonProps {
23
27
  * Additional classes to be added to the component
24
28
  * */
25
29
  className?: string;
30
+ /**
31
+ * Base height of the component
32
+ * */
33
+ variant?: 'small' | 'default' | 'large';
26
34
  /**
27
35
  * Callback function when the selected item changes
28
36
  * */
@@ -1,2 +1,2 @@
1
- "use client";export { a as ToggleButton } from '../../chunk-5DW7FCTC.js';
1
+ "use client";export { a as ToggleButton } from '../../chunk-2FXYZXCT.js';
2
2
  import '../../chunk-AGCI6C3Z.js';
@@ -22,7 +22,7 @@ import '../chunk-7NYGOWFC.js';
22
22
  import '../chunk-TZI6YTCW.js';
23
23
  import '../chunk-ZWW7VJFD.js';
24
24
  export { a as Toggle } from '../chunk-K4PEKBET.js';
25
- export { a as ToggleButton } from '../chunk-5DW7FCTC.js';
25
+ export { a as ToggleButton } from '../chunk-2FXYZXCT.js';
26
26
  import '../chunk-RLOTNDPD.js';
27
27
  import '../chunk-UF4BFCSP.js';
28
28
  export { a as Checkbox } from '../chunk-NRAIF4I3.js';
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ export { b as ToastContainer, a as notify } from './chunk-7NYGOWFC.js';
27
27
  export { a as Tooltip } from './chunk-TZI6YTCW.js';
28
28
  export { a as Button } from './chunk-ZWW7VJFD.js';
29
29
  export { a as Toggle } from './chunk-K4PEKBET.js';
30
- export { a as ToggleButton } from './chunk-5DW7FCTC.js';
30
+ export { a as ToggleButton } from './chunk-2FXYZXCT.js';
31
31
  export { a as Alert } from './chunk-RLOTNDPD.js';
32
32
  export { b as DataTable } from './chunk-UF4BFCSP.js';
33
33
  export { a as Checkbox } from './chunk-NRAIF4I3.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loja-integrada/admin-components",
3
- "version": "1.3.17",
3
+ "version": "1.3.19",
4
4
  "author": "Loja Integrada",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,8 +0,0 @@
1
- import { a } from './chunk-AGCI6C3Z.js';
2
- import { cva } from 'class-variance-authority';
3
- import i, { useState } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- var y=cva("text-f6 border-y border-l border-primary px-6 py-4 font-semibold",{variants:{active:{true:"bg-primary text-base-1",false:"text-primary"},borderDirection:{left:"rounded-l",middle:"",right:"rounded-r border-r"},disabled:{true:"cursor-not-allowed opacity-50",false:""}}}),v=({items:o,defaultItem:g=o[0]?.slug,disabled:d=!1,className:c="",onChange:r})=>{let[a$1,u]=useState(g);function b(t){t!==a$1&&(u(t),r&&r(t));}return jsx("nav",{id:"toggle-button","aria-label":"Toggle Button",className:c,children:jsx("ul",{className:"flex",children:o.map((t,l)=>{let m=l===0?"left":o.length-1===l?"right":"middle",n=d||t.disabled;return jsx("li",{children:jsx("button",{id:`toggle-button-${t.slug}`,type:"button",disabled:n,onClick:()=>b(t.slug),className:a(y({active:t.slug===a$1,borderDirection:m,disabled:n}),t.className),children:t.content})},t.slug)})})})},B=i.forwardRef(v),N=i.memo(B);N.displayName="ToggleButton";
7
-
8
- export { N as a };