@kushagradhawan/kookie-ui 0.1.6 → 0.1.7

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,24 +1,25 @@
1
1
  import * as React from 'react';
2
- type ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';
3
- type ButtonSize = '1' | '2' | '3' | '4';
4
- type ButtonColor = 'gray' | 'gold' | 'bronze' | 'brown' | 'yellow' | 'amber' | 'orange' | 'tomato' | 'red' | 'ruby' | 'crimson' | 'pink' | 'plum' | 'purple' | 'violet' | 'iris' | 'indigo' | 'blue' | 'cyan' | 'teal' | 'jade' | 'green' | 'grass' | 'lime' | 'mint' | 'sky';
5
- type ButtonRadius = 'none' | 'small' | 'medium' | 'large' | 'full';
6
- interface ToggleIconButtonProps {
7
- pressed?: boolean;
8
- onPressedChange?: (pressed: boolean) => void;
9
- defaultPressed?: boolean;
2
+ import { Toggle } from 'radix-ui';
3
+ import type { BaseButtonProps } from './_internal/base-button.js';
4
+ type ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;
5
+ type AccessibilityProps = {
10
6
  'aria-label': string;
11
- variant?: ButtonVariant;
12
- size?: ButtonSize;
13
- color?: ButtonColor;
14
- highContrast?: boolean;
15
- radius?: ButtonRadius;
16
- disabled?: boolean;
17
- loading?: boolean;
18
- className?: string;
19
- children?: React.ReactNode;
7
+ 'aria-labelledby'?: never;
8
+ } | {
9
+ 'aria-label'?: never;
10
+ 'aria-labelledby': string;
11
+ } | {
12
+ 'aria-label'?: never;
13
+ 'aria-labelledby'?: never;
14
+ children: React.ReactNode;
15
+ };
16
+ interface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {
17
+ pressed?: ToggleProps['pressed'];
18
+ onPressedChange?: ToggleProps['onPressedChange'];
19
+ defaultPressed?: ToggleProps['defaultPressed'];
20
20
  }
21
- declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
21
+ type ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;
22
+ declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonPropsWithAccessibility & React.RefAttributes<HTMLButtonElement>>;
22
23
  export { ToggleIconButton };
23
- export type { ToggleIconButtonProps };
24
+ export type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };
24
25
  //# sourceMappingURL=toggle-icon-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACpF,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACxC,KAAK,WAAW,GACZ,MAAM,GACN,MAAM,GACN,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC;AACV,KAAK,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,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C,iBAAiB,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;CAChD;AAGD,KAAK,sCAAsC,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEzF,QAAA,MAAM,gBAAgB,kHAcpB,CAAC;AAGH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,sCAAsC,IAAI,qBAAqB,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var b=(o,e)=>{for(var t in e)a(o,t,{get:e[t],enumerable:!0})},i=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of m(e))!B.call(o,n)&&n!==t&&a(o,n,{get:()=>e[n],enumerable:!(r=p(e,n))||r.enumerable});return o};var f=(o,e,t)=>(t=o!=null?d(c(o)):{},i(e||!o||!o.__esModule?a(t,"default",{value:o,enumerable:!0}):t,o)),y=o=>i(a({},"__esModule",{value:!0}),o);var I={};b(I,{ToggleIconButton:()=>s});module.exports=y(I);var l=f(require("react")),u=require("radix-ui"),g=require("./icon-button.js");const s=l.forwardRef(({pressed:o,onPressedChange:e,defaultPressed:t,...r},n)=>l.createElement(u.Toggle.Root,{pressed:o,onPressedChange:e,defaultPressed:t,asChild:!0},l.createElement(g.IconButton,{...r,ref:n})));s.displayName="ToggleIconButton";
1
+ "use strict";var c=Object.create;var n=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},g=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of u(o))!B.call(e,s)&&s!==t&&n(e,s,{get:()=>o[s],enumerable:!(r=d(o,s))||r.enumerable});return e};var T=(e,o,t)=>(t=e!=null?c(P(e)):{},g(o||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),b=e=>g(n({},"__esModule",{value:!0}),e);var f={};y(f,{ToggleIconButton:()=>a});module.exports=b(f);var l=T(require("react")),i=require("radix-ui"),p=require("./icon-button.js"),I=require("./_internal/base-button.js");const a=l.forwardRef(({pressed:e,onPressedChange:o,defaultPressed:t,...r},s)=>l.createElement(i.Toggle.Root,{pressed:e,onPressedChange:o,defaultPressed:t,asChild:!0},l.createElement(p.IconButton,{...r,ref:s})));a.displayName="ToggleIconButton";
2
2
  //# sourceMappingURL=toggle-icon-button.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/toggle-icon-button.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\n// Extract the specific types we need\ntype ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';\ntype ButtonSize = '1' | '2' | '3' | '4';\ntype ButtonColor =\n | 'gray'\n | 'gold'\n | 'bronze'\n | 'brown'\n | 'yellow'\n | 'amber'\n | 'orange'\n | 'tomato'\n | 'red'\n | 'ruby'\n | 'crimson'\n | 'pink'\n | 'plum'\n | 'purple'\n | 'violet'\n | 'iris'\n | 'indigo'\n | 'blue'\n | 'cyan'\n | 'teal'\n | 'jade'\n | 'green'\n | 'grass'\n | 'lime'\n | 'mint'\n | 'sky';\ntype ButtonRadius = 'none' | 'small' | 'medium' | 'large' | 'full';\n\ninterface ToggleIconButtonProps {\n pressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n defaultPressed?: boolean;\n 'aria-label': string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n color?: ButtonColor;\n highContrast?: boolean;\n radius?: ButtonRadius;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n children?: React.ReactNode;\n}\n\ntype ToggleIconButtonElement = React.ElementRef<typeof IconButton>;\n\nconst ToggleIconButton = React.forwardRef<ToggleIconButtonElement, ToggleIconButtonProps>(\n ({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {\n return (\n <Toggle.Root\n pressed={pressed}\n onPressedChange={onPressedChange}\n defaultPressed={defaultPressed}\n asChild\n >\n <IconButton {...iconButtonProps} ref={forwardedRef} />\n </Toggle.Root>\n );\n },\n);\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonProps };\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,oBACvBC,EAA2B,4BAqD3B,MAAMJ,EAAmBE,EAAM,WAC7B,CAAC,CAAE,QAAAG,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,GAAGC,CAAgB,EAAGC,IAE/DP,EAAA,cAAC,SAAO,KAAP,CACC,QAASG,EACT,gBAAiBC,EACjB,eAAgBC,EAChB,QAAO,IAEPL,EAAA,cAAC,cAAY,GAAGM,EAAiB,IAAKC,EAAc,CACtD,CAGN,EACAT,EAAiB,YAAc",
6
- "names": ["toggle_icon_button_exports", "__export", "ToggleIconButton", "__toCommonJS", "React", "import_radix_ui", "import_icon_button", "pressed", "onPressedChange", "defaultPressed", "iconButtonProps", "forwardedRef"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\nimport { BaseButton } from './_internal/base-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\ntype ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;\n\n// Extract toggle-specific props from Radix Toggle\ntype ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;\n\n// Required accessibility props for icon buttons (same as IconButton)\ntype AccessibilityProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string }\n | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };\n\n// Combine BaseButton props with Toggle-specific props and accessibility requirements\ninterface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {\n pressed?: ToggleProps['pressed'];\n onPressedChange?: ToggleProps['onPressedChange'];\n defaultPressed?: ToggleProps['defaultPressed'];\n}\n\n// Intersection with accessibility props\ntype ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;\n\nconst ToggleIconButton = React.forwardRef<\n ToggleIconButtonElement,\n ToggleIconButtonPropsWithAccessibility\n>(({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {\n return (\n <Toggle.Root\n pressed={pressed}\n onPressedChange={onPressedChange}\n defaultPressed={defaultPressed}\n asChild\n >\n <IconButton {...iconButtonProps} ref={forwardedRef} />\n </Toggle.Root>\n );\n});\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,oBACvBC,EAA2B,4BAC3BC,EAA2B,sCAwB3B,MAAML,EAAmBE,EAAM,WAG7B,CAAC,CAAE,QAAAI,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,GAAGC,CAAgB,EAAGC,IAEjER,EAAA,cAAC,SAAO,KAAP,CACC,QAASI,EACT,gBAAiBC,EACjB,eAAgBC,EAChB,QAAO,IAEPN,EAAA,cAAC,cAAY,GAAGO,EAAiB,IAAKC,EAAc,CACtD,CAEH,EACDV,EAAiB,YAAc",
6
+ "names": ["toggle_icon_button_exports", "__export", "ToggleIconButton", "__toCommonJS", "React", "import_radix_ui", "import_icon_button", "import_base_button", "pressed", "onPressedChange", "defaultPressed", "iconButtonProps", "forwardedRef"]
7
7
  }
@@ -1,24 +1,25 @@
1
1
  import * as React from 'react';
2
- type ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';
3
- type ButtonSize = '1' | '2' | '3' | '4';
4
- type ButtonColor = 'gray' | 'gold' | 'bronze' | 'brown' | 'yellow' | 'amber' | 'orange' | 'tomato' | 'red' | 'ruby' | 'crimson' | 'pink' | 'plum' | 'purple' | 'violet' | 'iris' | 'indigo' | 'blue' | 'cyan' | 'teal' | 'jade' | 'green' | 'grass' | 'lime' | 'mint' | 'sky';
5
- type ButtonRadius = 'none' | 'small' | 'medium' | 'large' | 'full';
6
- interface ToggleIconButtonProps {
7
- pressed?: boolean;
8
- onPressedChange?: (pressed: boolean) => void;
9
- defaultPressed?: boolean;
2
+ import { Toggle } from 'radix-ui';
3
+ import type { BaseButtonProps } from './_internal/base-button.js';
4
+ type ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;
5
+ type AccessibilityProps = {
10
6
  'aria-label': string;
11
- variant?: ButtonVariant;
12
- size?: ButtonSize;
13
- color?: ButtonColor;
14
- highContrast?: boolean;
15
- radius?: ButtonRadius;
16
- disabled?: boolean;
17
- loading?: boolean;
18
- className?: string;
19
- children?: React.ReactNode;
7
+ 'aria-labelledby'?: never;
8
+ } | {
9
+ 'aria-label'?: never;
10
+ 'aria-labelledby': string;
11
+ } | {
12
+ 'aria-label'?: never;
13
+ 'aria-labelledby'?: never;
14
+ children: React.ReactNode;
15
+ };
16
+ interface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {
17
+ pressed?: ToggleProps['pressed'];
18
+ onPressedChange?: ToggleProps['onPressedChange'];
19
+ defaultPressed?: ToggleProps['defaultPressed'];
20
20
  }
21
- declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
21
+ type ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;
22
+ declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonPropsWithAccessibility & React.RefAttributes<HTMLButtonElement>>;
22
23
  export { ToggleIconButton };
23
- export type { ToggleIconButtonProps };
24
+ export type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };
24
25
  //# sourceMappingURL=toggle-icon-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACpF,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACxC,KAAK,WAAW,GACZ,MAAM,GACN,MAAM,GACN,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC;AACV,KAAK,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,CAAC,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,sCAAsC,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEzF,QAAA,MAAM,gBAAgB,kHAcpB,CAAC;AAGH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,sCAAsC,IAAI,qBAAqB,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as o from"react";import{Toggle as s}from"radix-ui";import{IconButton as i}from"./icon-button.js";const e=o.forwardRef(({pressed:t,onPressedChange:n,defaultPressed:r,...a},l)=>o.createElement(s.Root,{pressed:t,onPressedChange:n,defaultPressed:r,asChild:!0},o.createElement(i,{...a,ref:l})));e.displayName="ToggleIconButton";export{e as ToggleIconButton};
1
+ import*as e from"react";import{Toggle as a}from"radix-ui";import{IconButton as g}from"./icon-button.js";import"./_internal/base-button.js";const o=e.forwardRef(({pressed:t,onPressedChange:s,defaultPressed:r,...n},l)=>e.createElement(a.Root,{pressed:t,onPressedChange:s,defaultPressed:r,asChild:!0},e.createElement(g,{...n,ref:l})));o.displayName="ToggleIconButton";export{o as ToggleIconButton};
2
2
  //# sourceMappingURL=toggle-icon-button.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/toggle-icon-button.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\n// Extract the specific types we need\ntype ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';\ntype ButtonSize = '1' | '2' | '3' | '4';\ntype ButtonColor =\n | 'gray'\n | 'gold'\n | 'bronze'\n | 'brown'\n | 'yellow'\n | 'amber'\n | 'orange'\n | 'tomato'\n | 'red'\n | 'ruby'\n | 'crimson'\n | 'pink'\n | 'plum'\n | 'purple'\n | 'violet'\n | 'iris'\n | 'indigo'\n | 'blue'\n | 'cyan'\n | 'teal'\n | 'jade'\n | 'green'\n | 'grass'\n | 'lime'\n | 'mint'\n | 'sky';\ntype ButtonRadius = 'none' | 'small' | 'medium' | 'large' | 'full';\n\ninterface ToggleIconButtonProps {\n pressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n defaultPressed?: boolean;\n 'aria-label': string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n color?: ButtonColor;\n highContrast?: boolean;\n radius?: ButtonRadius;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n children?: React.ReactNode;\n}\n\ntype ToggleIconButtonElement = React.ElementRef<typeof IconButton>;\n\nconst ToggleIconButton = React.forwardRef<ToggleIconButtonElement, ToggleIconButtonProps>(\n ({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {\n return (\n <Toggle.Root\n pressed={pressed}\n onPressedChange={onPressedChange}\n defaultPressed={defaultPressed}\n asChild\n >\n <IconButton {...iconButtonProps} ref={forwardedRef} />\n </Toggle.Root>\n );\n },\n);\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonProps };\n"],
5
- "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAS,UAAAC,MAAc,WACvB,OAAS,cAAAC,MAAkB,mBAqD3B,MAAMC,EAAmBH,EAAM,WAC7B,CAAC,CAAE,QAAAI,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,GAAGC,CAAgB,EAAGC,IAE/DR,EAAA,cAACC,EAAO,KAAP,CACC,QAASG,EACT,gBAAiBC,EACjB,eAAgBC,EAChB,QAAO,IAEPN,EAAA,cAACE,EAAA,CAAY,GAAGK,EAAiB,IAAKC,EAAc,CACtD,CAGN,EACAL,EAAiB,YAAc",
4
+ "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\nimport { BaseButton } from './_internal/base-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\ntype ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;\n\n// Extract toggle-specific props from Radix Toggle\ntype ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;\n\n// Required accessibility props for icon buttons (same as IconButton)\ntype AccessibilityProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string }\n | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };\n\n// Combine BaseButton props with Toggle-specific props and accessibility requirements\ninterface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {\n pressed?: ToggleProps['pressed'];\n onPressedChange?: ToggleProps['onPressedChange'];\n defaultPressed?: ToggleProps['defaultPressed'];\n}\n\n// Intersection with accessibility props\ntype ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;\n\nconst ToggleIconButton = React.forwardRef<\n ToggleIconButtonElement,\n ToggleIconButtonPropsWithAccessibility\n>(({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {\n return (\n <Toggle.Root\n pressed={pressed}\n onPressedChange={onPressedChange}\n defaultPressed={defaultPressed}\n asChild\n >\n <IconButton {...iconButtonProps} ref={forwardedRef} />\n </Toggle.Root>\n );\n});\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };\n"],
5
+ "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAS,UAAAC,MAAc,WACvB,OAAS,cAAAC,MAAkB,mBAC3B,MAA2B,6BAwB3B,MAAMC,EAAmBH,EAAM,WAG7B,CAAC,CAAE,QAAAI,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,GAAGC,CAAgB,EAAGC,IAEjER,EAAA,cAACC,EAAO,KAAP,CACC,QAASG,EACT,gBAAiBC,EACjB,eAAgBC,EAChB,QAAO,IAEPN,EAAA,cAACE,EAAA,CAAY,GAAGK,EAAiB,IAAKC,EAAc,CACtD,CAEH,EACDL,EAAiB,YAAc",
6
6
  "names": ["React", "Toggle", "IconButton", "ToggleIconButton", "pressed", "onPressedChange", "defaultPressed", "iconButtonProps", "forwardedRef"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushagradhawan/kookie-ui",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A modern React component library with beautiful design tokens and flexible theming",
5
5
  "keywords": [
6
6
  "react",
@@ -1,73 +1,46 @@
1
1
  import * as React from 'react';
2
2
  import { Toggle } from 'radix-ui';
3
3
  import { IconButton } from './icon-button.js';
4
+ import { BaseButton } from './_internal/base-button.js';
4
5
  import type { BaseButtonProps } from './_internal/base-button.js';
5
6
 
6
- // Extract the specific types we need
7
- type ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';
8
- type ButtonSize = '1' | '2' | '3' | '4';
9
- type ButtonColor =
10
- | 'gray'
11
- | 'gold'
12
- | 'bronze'
13
- | 'brown'
14
- | 'yellow'
15
- | 'amber'
16
- | 'orange'
17
- | 'tomato'
18
- | 'red'
19
- | 'ruby'
20
- | 'crimson'
21
- | 'pink'
22
- | 'plum'
23
- | 'purple'
24
- | 'violet'
25
- | 'iris'
26
- | 'indigo'
27
- | 'blue'
28
- | 'cyan'
29
- | 'teal'
30
- | 'jade'
31
- | 'green'
32
- | 'grass'
33
- | 'lime'
34
- | 'mint'
35
- | 'sky';
36
- type ButtonRadius = 'none' | 'small' | 'medium' | 'large' | 'full';
7
+ type ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;
37
8
 
38
- interface ToggleIconButtonProps {
39
- pressed?: boolean;
40
- onPressedChange?: (pressed: boolean) => void;
41
- defaultPressed?: boolean;
42
- 'aria-label': string;
43
- variant?: ButtonVariant;
44
- size?: ButtonSize;
45
- color?: ButtonColor;
46
- highContrast?: boolean;
47
- radius?: ButtonRadius;
48
- disabled?: boolean;
49
- loading?: boolean;
50
- className?: string;
51
- children?: React.ReactNode;
9
+ // Extract toggle-specific props from Radix Toggle
10
+ type ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;
11
+
12
+ // Required accessibility props for icon buttons (same as IconButton)
13
+ type AccessibilityProps =
14
+ | { 'aria-label': string; 'aria-labelledby'?: never }
15
+ | { 'aria-label'?: never; 'aria-labelledby': string }
16
+ | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };
17
+
18
+ // Combine BaseButton props with Toggle-specific props and accessibility requirements
19
+ interface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {
20
+ pressed?: ToggleProps['pressed'];
21
+ onPressedChange?: ToggleProps['onPressedChange'];
22
+ defaultPressed?: ToggleProps['defaultPressed'];
52
23
  }
53
24
 
54
- type ToggleIconButtonElement = React.ElementRef<typeof IconButton>;
25
+ // Intersection with accessibility props
26
+ type ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;
55
27
 
56
- const ToggleIconButton = React.forwardRef<ToggleIconButtonElement, ToggleIconButtonProps>(
57
- ({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {
58
- return (
59
- <Toggle.Root
60
- pressed={pressed}
61
- onPressedChange={onPressedChange}
62
- defaultPressed={defaultPressed}
63
- asChild
64
- >
65
- <IconButton {...iconButtonProps} ref={forwardedRef} />
66
- </Toggle.Root>
67
- );
68
- },
69
- );
28
+ const ToggleIconButton = React.forwardRef<
29
+ ToggleIconButtonElement,
30
+ ToggleIconButtonPropsWithAccessibility
31
+ >(({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {
32
+ return (
33
+ <Toggle.Root
34
+ pressed={pressed}
35
+ onPressedChange={onPressedChange}
36
+ defaultPressed={defaultPressed}
37
+ asChild
38
+ >
39
+ <IconButton {...iconButtonProps} ref={forwardedRef} />
40
+ </Toggle.Root>
41
+ );
42
+ });
70
43
  ToggleIconButton.displayName = 'ToggleIconButton';
71
44
 
72
45
  export { ToggleIconButton };
73
- export type { ToggleIconButtonProps };
46
+ export type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };