@codefast/ui 0.0.55 → 0.0.56

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.
Files changed (84) hide show
  1. package/dist/{chunk-MFYACCZV.mjs → chunk-77I644ZX.mjs} +1 -1
  2. package/dist/{chunk-MFYACCZV.mjs.map → chunk-77I644ZX.mjs.map} +1 -1
  3. package/dist/{chunk-VZVI3OHH.js → chunk-BEBSUUL4.js} +2 -2
  4. package/dist/{chunk-VZVI3OHH.js.map → chunk-BEBSUUL4.js.map} +1 -1
  5. package/dist/{chunk-4JHGPRLG.js → chunk-JI2ITVUE.js} +1 -1
  6. package/dist/{chunk-4JHGPRLG.js.map → chunk-JI2ITVUE.js.map} +1 -1
  7. package/dist/{chunk-X4BEEJEW.js → chunk-P2RMYMNK.js} +2 -2
  8. package/dist/chunk-P2RMYMNK.js.map +1 -0
  9. package/dist/{chunk-K63K4LTH.mjs → chunk-QXZKUXR2.mjs} +2 -2
  10. package/dist/chunk-QXZKUXR2.mjs.map +1 -0
  11. package/dist/{chunk-7ABWX5CF.mjs → chunk-TVVOS66G.mjs} +2 -2
  12. package/dist/{chunk-7ABWX5CF.mjs.map → chunk-TVVOS66G.mjs.map} +1 -1
  13. package/dist/{chunk-SCXRD727.js → chunk-VE44YFJR.js} +1 -1
  14. package/dist/{chunk-SCXRD727.js.map → chunk-VE44YFJR.js.map} +1 -1
  15. package/dist/{chunk-5RENVAXH.mjs → chunk-W3VRLCP7.mjs} +1 -1
  16. package/dist/{chunk-5RENVAXH.mjs.map → chunk-W3VRLCP7.mjs.map} +1 -1
  17. package/dist/plugin/animate.plugin.js +1 -1
  18. package/dist/plugin/animate.plugin.mjs +1 -1
  19. package/dist/react/alert-dialog.js +1 -1
  20. package/dist/react/alert-dialog.mjs +1 -1
  21. package/dist/react/alert.js.map +1 -1
  22. package/dist/react/alert.mjs.map +1 -1
  23. package/dist/react/badge.js.map +1 -1
  24. package/dist/react/badge.mjs.map +1 -1
  25. package/dist/react/button.js +1 -1
  26. package/dist/react/button.mjs +1 -1
  27. package/dist/react/calendar.js +1 -1
  28. package/dist/react/calendar.js.map +1 -1
  29. package/dist/react/calendar.mjs +1 -1
  30. package/dist/react/calendar.mjs.map +1 -1
  31. package/dist/react/carousel.js +1 -1
  32. package/dist/react/carousel.js.map +1 -1
  33. package/dist/react/carousel.mjs +1 -1
  34. package/dist/react/carousel.mjs.map +1 -1
  35. package/dist/react/checkbox-cards.js +1 -1
  36. package/dist/react/checkbox-cards.mjs +1 -1
  37. package/dist/react/checkbox-group.js +1 -1
  38. package/dist/react/checkbox-group.mjs +1 -1
  39. package/dist/react/checkbox-group.primitive.js +1 -1
  40. package/dist/react/checkbox-group.primitive.mjs +1 -1
  41. package/dist/react/data-table.js +1 -1
  42. package/dist/react/data-table.js.map +1 -1
  43. package/dist/react/data-table.mjs +1 -1
  44. package/dist/react/data-table.mjs.map +1 -1
  45. package/dist/react/form.js.map +1 -1
  46. package/dist/react/form.mjs.map +1 -1
  47. package/dist/react/input.js.map +1 -1
  48. package/dist/react/input.mjs.map +1 -1
  49. package/dist/react/pagination.js +1 -1
  50. package/dist/react/pagination.js.map +1 -1
  51. package/dist/react/pagination.mjs +1 -1
  52. package/dist/react/pagination.mjs.map +1 -1
  53. package/dist/react/sheet.js +1 -1
  54. package/dist/react/sheet.js.map +1 -1
  55. package/dist/react/sheet.mjs +1 -1
  56. package/dist/react/sheet.mjs.map +1 -1
  57. package/dist/react/toggle-group.js +1 -1
  58. package/dist/react/toggle-group.js.map +1 -1
  59. package/dist/react/toggle-group.mjs +1 -1
  60. package/dist/react/toggle-group.mjs.map +1 -1
  61. package/dist/react/toggle.js +1 -1
  62. package/dist/react/toggle.mjs +1 -1
  63. package/dist/tailwind.config.js +1 -1
  64. package/dist/tailwind.config.js.map +1 -1
  65. package/dist/tailwind.config.mjs +1 -1
  66. package/dist/tailwind.config.mjs.map +1 -1
  67. package/package.json +2 -2
  68. package/plugin/animate.plugin.ts +1 -1
  69. package/src/react/alert.tsx +1 -1
  70. package/src/react/badge.tsx +1 -1
  71. package/src/react/button.tsx +1 -1
  72. package/src/react/calendar.tsx +1 -2
  73. package/src/react/carousel.tsx +2 -4
  74. package/src/react/checkbox-group.primitive.tsx +1 -2
  75. package/src/react/data-table.tsx +1 -1
  76. package/src/react/form.tsx +1 -1
  77. package/src/react/input.tsx +1 -1
  78. package/src/react/pagination.tsx +1 -2
  79. package/src/react/sheet.tsx +1 -1
  80. package/src/react/toggle-group.tsx +2 -4
  81. package/src/react/toggle.tsx +1 -1
  82. package/tailwind.config.ts +1 -1
  83. package/dist/chunk-K63K4LTH.mjs.map +0 -1
  84. package/dist/chunk-X4BEEJEW.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/ui",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "license": "MIT",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -408,7 +408,7 @@
408
408
  "tailwindcss": "^3.4.4",
409
409
  "tsup": "^8.1.0",
410
410
  "typescript": "^5.5.2",
411
- "@codefast/eslint-config": "0.0.27",
411
+ "@codefast/eslint-config": "0.0.28",
412
412
  "@codefast/typescript-config": "0.0.2"
413
413
  },
414
414
  "peerDependencies": {
@@ -1,5 +1,5 @@
1
1
  import plugin from 'tailwindcss/plugin';
2
- import type { Config } from 'tailwindcss/types/config';
2
+ import { type Config } from 'tailwindcss/types/config';
3
3
 
4
4
  type Theme = <TDefaultValue = Config['theme']>(path?: string, defaultValue?: TDefaultValue) => TDefaultValue;
5
5
 
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { type VariantProps } from 'cva';
2
3
  import { cn, cva } from '../lib/utils';
3
- import type { VariantProps } from 'cva';
4
4
 
5
5
  /* -----------------------------------------------------------------------------
6
6
  * Variant: Alert
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { type VariantProps } from 'cva';
2
3
  import { cva } from '../lib/utils';
3
- import type { VariantProps } from 'cva';
4
4
 
5
5
  /* -----------------------------------------------------------------------------
6
6
  * Variant: Badge
@@ -2,9 +2,9 @@ import * as React from 'react';
2
2
  import { Fragment } from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
5
+ import { type VariantProps } from 'cva';
5
6
  import { cva } from '../lib/utils';
6
7
  import { Spinner } from './spinner';
7
- import type { VariantProps } from 'cva';
8
8
 
9
9
  /* -----------------------------------------------------------------------------
10
10
  * Variant: Button
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import * as React from 'react';
4
- import { DayPicker } from 'react-day-picker';
4
+ import { DayPicker, type DateRange, type DayPickerProps, type StyledComponent } from 'react-day-picker';
5
5
  import { ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons';
6
6
  import { cn } from '../lib/utils';
7
7
  import { buttonVariants } from './button';
8
- import type { DateRange, DayPickerProps, StyledComponent } from 'react-day-picker';
9
8
 
10
9
  /* -----------------------------------------------------------------------------
11
10
  * Component: Calendar
@@ -3,11 +3,9 @@
3
3
  import * as React from 'react';
4
4
  import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
5
5
  import { ArrowLeftIcon, ArrowRightIcon } from '@radix-ui/react-icons';
6
- import { createContextScope } from '@radix-ui/react-context';
6
+ import { createContextScope, type Scope } from '@radix-ui/react-context';
7
7
  import { cn } from '../lib/utils';
8
- import { Button } from './button';
9
- import type { ButtonProps } from './button';
10
- import type { Scope } from '@radix-ui/react-context';
8
+ import { Button, type ButtonProps } from './button';
11
9
 
12
10
  /* -----------------------------------------------------------------------------
13
11
  * Context: Carousel
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
3
  import { createCheckboxScope } from '@radix-ui/react-checkbox';
4
- import { createContextScope } from '@radix-ui/react-context';
4
+ import { createContextScope, type Scope } from '@radix-ui/react-context';
5
5
  import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
6
6
  import { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';
7
7
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
8
8
  import { useDirection } from '@radix-ui/react-direction';
9
9
  import { Primitive } from '@radix-ui/react-primitive';
10
- import type { Scope } from '@radix-ui/react-context';
11
10
 
12
11
  /* -------------------------------------------------------------------------------------------------
13
12
  * Component: CheckboxGroup
@@ -12,6 +12,7 @@ import {
12
12
  EyeNoneIcon,
13
13
  MixerHorizontalIcon,
14
14
  } from '@radix-ui/react-icons';
15
+ import type * as ReactTable from '@tanstack/react-table';
15
16
  import { cn } from '../lib/utils';
16
17
  import {
17
18
  DropdownMenu,
@@ -24,7 +25,6 @@ import {
24
25
  } from './dropdown-menu';
25
26
  import { Button } from './button';
26
27
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';
27
- import type * as ReactTable from '@tanstack/react-table';
28
28
 
29
29
  /* -----------------------------------------------------------------------------
30
30
  * Component: DataTableViewOptions
@@ -13,9 +13,9 @@ import {
13
13
  type Merge,
14
14
  useFormContext,
15
15
  } from 'react-hook-form';
16
+ import type * as LabelPrimitive from '@radix-ui/react-label';
16
17
  import { cn } from '../lib/utils';
17
18
  import { Label } from './label';
18
- import type * as LabelPrimitive from '@radix-ui/react-label';
19
19
 
20
20
  /* -----------------------------------------------------------------------------
21
21
  * Context: Form
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { type VariantProps } from 'cva';
2
3
  import { cva } from '../lib/utils';
3
- import type { VariantProps } from 'cva';
4
4
 
5
5
  /* -----------------------------------------------------------------------------
6
6
  * Variant: Input
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ChevronLeftIcon, ChevronRightIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
3
3
  import { cn } from '../lib/utils';
4
- import { buttonVariants } from './button';
5
- import type { ButtonProps } from './button';
4
+ import { buttonVariants, type ButtonProps } from './button';
6
5
 
7
6
  /* -----------------------------------------------------------------------------
8
7
  * Component: Pagination
@@ -3,8 +3,8 @@
3
3
  import * as React from 'react';
4
4
  import * as SheetPrimitive from '@radix-ui/react-dialog';
5
5
  import { Cross2Icon } from '@radix-ui/react-icons';
6
+ import { type VariantProps } from 'cva';
6
7
  import { cn, cva } from '../lib/utils';
7
- import type { VariantProps } from 'cva';
8
8
 
9
9
  /* -----------------------------------------------------------------------------
10
10
  * Variant: Sheet
@@ -3,11 +3,9 @@
3
3
  import * as React from 'react';
4
4
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
5
5
  import { createToggleGroupScope } from '@radix-ui/react-toggle-group';
6
- import { createContextScope } from '@radix-ui/react-context';
6
+ import { createContextScope, type Scope } from '@radix-ui/react-context';
7
7
  import { cn } from '../lib/utils';
8
- import { toggleVariants } from './toggle';
9
- import type { ToggleVariantsProps } from './toggle';
10
- import type { Scope } from '@radix-ui/react-context';
8
+ import { toggleVariants, type ToggleVariantsProps } from './toggle';
11
9
 
12
10
  /* -----------------------------------------------------------------------------
13
11
  * Component: ToggleGroup
@@ -2,8 +2,8 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import * as TogglePrimitive from '@radix-ui/react-toggle';
5
+ import { type VariantProps } from 'cva';
5
6
  import { cva } from '../lib/utils';
6
- import type { VariantProps } from 'cva';
7
7
 
8
8
  /* -----------------------------------------------------------------------------
9
9
  * Variant: Toggle
@@ -2,7 +2,7 @@ import { fontFamily } from 'tailwindcss/defaultTheme';
2
2
  import animate from './plugin/animate.plugin';
3
3
  import base from './plugin/base.plugin';
4
4
  import perspective from './plugin/perspective.plugin';
5
- import type { Config } from 'tailwindcss';
5
+ import { Config } from 'tailwindcss';
6
6
 
7
7
  const tailwindcssConfig: Config = {
8
8
  content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/checkbox-group.primitive.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { createCheckboxScope } from '@radix-ui/react-checkbox';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_GROUP_NAME = 'CheckboxGroup';\n\ntype ScopedProps<P> = P & { __scopeCheckboxGroup?: Scope };\n\nconst [createCheckboxGroupContext, createCheckboxGroupScope] = createContextScope(CHECKBOX_GROUP_NAME, [\n createRovingFocusGroupScope,\n createCheckboxScope,\n]);\n\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useCheckboxScope = createCheckboxScope();\n\ninterface CheckboxGroupContextValue {\n name?: string;\n required: boolean;\n disabled: boolean;\n value?: string[];\n onItemCheck: (value: string) => void;\n onItemUncheck: (value: string) => void;\n}\n\nconst [CheckboxGroupProvider, useCheckboxGroupContext] =\n createCheckboxGroupContext<CheckboxGroupContextValue>(CHECKBOX_GROUP_NAME);\n\ntype CheckboxGroupElement = React.ElementRef<typeof Primitive.div>;\n\ninterface CheckboxGroupProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {\n name?: CheckboxGroupContextValue['name'];\n required?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['required'];\n disabled?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['disabled'];\n dir?: RovingFocusGroup.RovingFocusGroupProps['dir'];\n orientation?: RovingFocusGroup.RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroup.RovingFocusGroupProps['loop'];\n defaultValue?: string[];\n value?: CheckboxGroupContextValue['value'];\n onValueChange?: (value: string[]) => void;\n}\n\nconst CheckboxGroup = React.forwardRef<CheckboxGroupElement, CheckboxGroupProps>(\n (\n {\n __scopeCheckboxGroup,\n name,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...props\n }: ScopedProps<CheckboxGroupProps>,\n ref,\n ) => {\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);\n const direction = useDirection(dir);\n const [value = [], setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const handleItemCheck = React.useCallback(\n (itemValue: string) => {\n setValue((prevValue = []) => [...prevValue, itemValue]);\n },\n [setValue],\n );\n\n const handleItemUncheck = React.useCallback(\n (itemValue: string) => {\n setValue((prevValue = []) => prevValue.filter((val) => val !== itemValue));\n },\n [setValue],\n );\n\n return (\n <CheckboxGroupProvider\n scope={__scopeCheckboxGroup}\n name={name}\n required={required}\n disabled={disabled}\n value={value}\n onItemCheck={handleItemCheck}\n onItemUncheck={handleItemUncheck}\n >\n <RovingFocusGroup.Root asChild {...rovingFocusGroupScope} orientation={orientation} dir={direction} loop={loop}>\n {/* eslint-disable-next-line react/jsx-pascal-case -- radix-ui */}\n <Primitive.div ref={ref} role=\"group\" data-disabled={disabled ? '' : undefined} dir={direction} {...props} />\n </RovingFocusGroup.Root>\n </CheckboxGroupProvider>\n );\n },\n);\n\nCheckboxGroup.displayName = CHECKBOX_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = `${CHECKBOX_GROUP_NAME}Item`;\n\ntype CheckboxGroupItemElement = React.ElementRef<typeof CheckboxPrimitive.Root>;\n\ninterface CheckboxGroupItemProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,\n 'checked' | 'defaultChecked' | 'onCheckedChange' | 'name'\n > {\n value: string;\n}\n\nconst CheckboxGroupItem = React.forwardRef<CheckboxGroupItemElement, CheckboxGroupItemProps>(\n ({ __scopeCheckboxGroup, disabled, ...props }: ScopedProps<CheckboxGroupItemProps>, ref) => {\n const context = useCheckboxGroupContext(ITEM_NAME, __scopeCheckboxGroup);\n const isDisabled = context.disabled || disabled;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n const checked = context.value?.includes(props.value);\n\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!isDisabled} active={checked}>\n <CheckboxPrimitive.Root\n ref={ref}\n name={context.name}\n disabled={isDisabled}\n required={context.required}\n checked={checked}\n {...checkboxScope}\n {...props}\n onCheckedChange={(checkedState) => {\n if (checkedState) {\n context.onItemCheck(props.value);\n } else {\n context.onItemUncheck(props.value);\n }\n }}\n />\n </RovingFocusGroup.Item>\n );\n },\n);\n\nCheckboxGroupItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = `${CHECKBOX_GROUP_NAME}Indicator`;\n\ntype CheckboxGroupIndicatorElement = React.ElementRef<typeof CheckboxPrimitive.Indicator>;\ntype CheckboxGroupIndicatorProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Indicator>;\n\nconst CheckboxGroupIndicator = React.forwardRef<CheckboxGroupIndicatorElement, CheckboxGroupIndicatorProps>(\n ({ __scopeCheckboxGroup, ...props }: ScopedProps<CheckboxGroupIndicatorProps>, ref) => {\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n\n return <CheckboxPrimitive.Indicator ref={ref} {...checkboxScope} {...props} />;\n },\n);\n\nCheckboxGroupIndicator.displayName = INDICATOR_NAME;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nconst Root = CheckboxGroup;\nconst Item = CheckboxGroupItem;\nconst Indicator = CheckboxGroupIndicator;\n\nexport {\n createCheckboxGroupScope,\n CheckboxGroup,\n CheckboxGroupItem,\n CheckboxGroupIndicator,\n Root,\n Item,\n Indicator,\n type CheckboxGroupProps,\n type CheckboxGroupItemProps,\n type CheckboxGroupIndicatorProps,\n};\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAAuB,2BACnC,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,sBAAAC,MAA0B,0BACnC,UAAYC,MAAsB,+BAClC,OAAS,+BAAAC,MAAmC,+BAC5C,OAAS,wBAAAC,MAA4B,yCACrC,OAAS,gBAAAC,MAAoB,4BAC7B,OAAS,aAAAC,MAAiB,4BAgGhB,cAAAC,MAAA,oBAzFV,IAAMC,EAAsB,gBAItB,CAACC,EAA4BC,CAAwB,EAAIT,EAAmBO,EAAqB,CACrGL,EACAH,CACF,CAAC,EAEKW,EAA2BR,EAA4B,EACvDS,EAAmBZ,EAAoB,EAWvC,CAACa,EAAuBC,CAAuB,EACnDL,EAAsDD,CAAmB,EAgBrEO,EAAsB,aAC1B,CACE,CACE,qBAAAC,EACA,KAAAC,EACA,aAAAC,EACA,MAAOC,EACP,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,YAAAC,EACA,IAAAC,EACA,KAAAC,EAAO,GACP,cAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,IAAMC,EAAwBjB,EAAyBK,CAAoB,EACrEa,EAAYxB,EAAakB,CAAG,EAC5B,CAACO,EAAQ,CAAC,EAAGC,CAAQ,EAAI3B,EAAqB,CAClD,KAAMe,EACN,YAAaD,EACb,SAAUO,CACZ,CAAC,EAEKO,EAAwB,cAC3BC,GAAsB,CACrBF,EAAS,CAACG,EAAY,CAAC,IAAM,CAAC,GAAGA,EAAWD,CAAS,CAAC,CACxD,EACA,CAACF,CAAQ,CACX,EAEMI,EAA0B,cAC7BF,GAAsB,CACrBF,EAAS,CAACG,EAAY,CAAC,IAAMA,EAAU,OAAQE,GAAQ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,CACrF,IAAMc,EAAgB7B,EAAiBI,CAAoB,EAE3D,OAAOT,EAAmB,YAAlB,CAA4B,IAAKoB,EAAM,GAAGc,EAAgB,GAAGf,EAAO,CAC9E,CACF,EAEAmB,EAAuB,YAAcD,EAMrC,IAAME,EAAO/B,EACPgC,EAAOT,EACPU,EAAYH","names":["React","CheckboxPrimitive","createCheckboxScope","createContextScope","RovingFocusGroup","createRovingFocusGroupScope","useControllableState","useDirection","Primitive","jsx","CHECKBOX_GROUP_NAME","createCheckboxGroupContext","createCheckboxGroupScope","useRovingFocusGroupScope","useCheckboxScope","CheckboxGroupProvider","useCheckboxGroupContext","CheckboxGroup","__scopeCheckboxGroup","name","defaultValue","valueProp","required","disabled","orientation","dir","loop","onValueChange","props","ref","rovingFocusGroupScope","direction","value","setValue","handleItemCheck","itemValue","prevValue","handleItemUncheck","val","ITEM_NAME","CheckboxGroupItem","context","isDisabled","checkboxScope","checked","checkedState","INDICATOR_NAME","CheckboxGroupIndicator","Root","Item","Indicator"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/checkbox-group.primitive.tsx"],"names":["React","CheckboxPrimitive","createCheckboxScope","createContextScope","RovingFocusGroup","createRovingFocusGroupScope","useControllableState","useDirection","Primitive","jsx","CHECKBOX_GROUP_NAME","createCheckboxGroupContext","createCheckboxGroupScope","useRovingFocusGroupScope","useCheckboxScope","CheckboxGroupProvider","useCheckboxGroupContext","CheckboxGroup","__scopeCheckboxGroup","name","defaultValue","valueProp","required","disabled","orientation","dir","loop","onValueChange","props","ref","rovingFocusGroupScope","direction","value","setValue","handleItemCheck","itemValue","prevValue","handleItemUncheck","val","ITEM_NAME","CheckboxGroupItem","context","isDisabled","checkboxScope","checked","checkedState","INDICATOR_NAME","CheckboxGroupIndicator","Root","Item","Indicator"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAAuB,2BACnC,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,sBAAAC,MAA0B,0BACnC,UAAYC,M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AK,KAAK,QAAQ,gBAAeN,EAAW,GAAK,OAAW,IAAKQ,EAAY,GAAGH,EAAO,EAC7G,EACF,CAEJ,CACF,EAEAX,EAAc,YAAcP,EAM5B,IAAM6B,EAAY,GAAG7B,CAAmB,OAYlC8B,EAA0B,aAC9B,CAAC,CAAE,qBAAAtB,EAAsB,SAAAK,EAAU,GAAGK,CAAM,EAAwCC,IAAQ,CAC1F,IAAMY,EAAUzB,EAAwBuB,EAAWrB,CAAoB,EACjEwB,EAAaD,EAAQ,UAAYlB,EACjCO,EAAwBjB,EAAyBK,CAAoB,EACrEyB,EAAgB7B,EAAiBI,CAAoB,EACrD0B,EAAUH,EAAQ,OAAO,SAASb,EAAM,KAAK,EAEnD,OACEnB,EAAkB,OAAjB,CAAsB,QAAO,GAAE,GAAGqB,EAAuB,UAAW,CAACY,EAAY,OAAQE,EACxF,SAAAnC,EAAmB,OAAlB,CACC,IAAKoB,EACL,KAAMY,EAAQ,KACd,SAAUC,EACV,SAAUD,EAAQ,SAClB,QAASG,EACR,GAAGD,EACH,GAAGf,EACJ,gBAAkBiB,GAAiB,CAC7BA,EACFJ,EAAQ,YAAYb,EAAM,KAAK,EAE/Ba,EAAQ,cAAcb,EAAM,KAAK,CAErC,EACF,EACF,CAEJ,CACF,EAEAY,EAAkB,YAAcD,EAMhC,IAAMO,EAAiB,GAAGpC,CAAmB,YAKvCqC,EAA+B,aACnC,CAAC,CAAE,qBAAA7B,EAAsB,GAAGU,CAAM,EAA6CC,IAAQ,CACrF,IAAMc,EAAgB7B,EAAiBI,CAAoB,EAE3D,OAAOT,EAAmB,YAAlB,CAA4B,IAAKoB,EAAM,GAAGc,EAAgB,GAAGf,EAAO,CAC9E,CACF,EAEAmB,EAAuB,YAAcD,EAMrC,IAAME,EAAO/B,EACPgC,EAAOT,EACPU,EAAYH","sourcesContent":["import * as React from 'react';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { createCheckboxScope } from '@radix-ui/react-checkbox';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_GROUP_NAME = 'CheckboxGroup';\n\ntype ScopedProps<P> = P & { __scopeCheckboxGroup?: Scope };\n\nconst [createCheckboxGroupContext, createCheckboxGroupScope] = createContextScope(CHECKBOX_GROUP_NAME, [\n createRovingFocusGroupScope,\n createCheckboxScope,\n]);\n\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useCheckboxScope = createCheckboxScope();\n\ninterface CheckboxGroupContextValue {\n name?: string;\n required: boolean;\n disabled: boolean;\n value?: string[];\n onItemCheck: (value: string) => void;\n onItemUncheck: (value: string) => void;\n}\n\nconst [CheckboxGroupProvider, useCheckboxGroupContext] =\n createCheckboxGroupContext<CheckboxGroupContextValue>(CHECKBOX_GROUP_NAME);\n\ntype CheckboxGroupElement = React.ElementRef<typeof Primitive.div>;\n\ninterface CheckboxGroupProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {\n name?: CheckboxGroupContextValue['name'];\n required?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['required'];\n disabled?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['disabled'];\n dir?: RovingFocusGroup.RovingFocusGroupProps['dir'];\n orientation?: RovingFocusGroup.RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroup.RovingFocusGroupProps['loop'];\n defaultValue?: string[];\n value?: CheckboxGroupContextValue['value'];\n onValueChange?: (value: string[]) => void;\n}\n\nconst CheckboxGroup = React.forwardRef<CheckboxGroupElement, CheckboxGroupProps>(\n (\n {\n __scopeCheckboxGroup,\n name,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...props\n }: ScopedProps<CheckboxGroupProps>,\n ref,\n ) => {\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);\n const direction = useDirection(dir);\n const [value = [], setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const handleItemCheck = React.useCallback(\n (itemValue: string) => {\n setValue((prevValue = []) => [...prevValue, itemValue]);\n },\n [setValue],\n );\n\n const handleItemUncheck = React.useCallback(\n (itemValue: string) => {\n setValue((prevValue = []) => prevValue.filter((val) => val !== itemValue));\n },\n [setValue],\n );\n\n return (\n <CheckboxGroupProvider\n scope={__scopeCheckboxGroup}\n name={name}\n required={required}\n disabled={disabled}\n value={value}\n onItemCheck={handleItemCheck}\n onItemUncheck={handleItemUncheck}\n >\n <RovingFocusGroup.Root asChild {...rovingFocusGroupScope} orientation={orientation} dir={direction} loop={loop}>\n {/* eslint-disable-next-line react/jsx-pascal-case -- radix-ui */}\n <Primitive.div ref={ref} role=\"group\" data-disabled={disabled ? '' : undefined} dir={direction} {...props} />\n </RovingFocusGroup.Root>\n </CheckboxGroupProvider>\n );\n },\n);\n\nCheckboxGroup.displayName = CHECKBOX_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = `${CHECKBOX_GROUP_NAME}Item`;\n\ntype CheckboxGroupItemElement = React.ElementRef<typeof CheckboxPrimitive.Root>;\n\ninterface CheckboxGroupItemProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,\n 'checked' | 'defaultChecked' | 'onCheckedChange' | 'name'\n > {\n value: string;\n}\n\nconst CheckboxGroupItem = React.forwardRef<CheckboxGroupItemElement, CheckboxGroupItemProps>(\n ({ __scopeCheckboxGroup, disabled, ...props }: ScopedProps<CheckboxGroupItemProps>, ref) => {\n const context = useCheckboxGroupContext(ITEM_NAME, __scopeCheckboxGroup);\n const isDisabled = context.disabled || disabled;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n const checked = context.value?.includes(props.value);\n\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!isDisabled} active={checked}>\n <CheckboxPrimitive.Root\n ref={ref}\n name={context.name}\n disabled={isDisabled}\n required={context.required}\n checked={checked}\n {...checkboxScope}\n {...props}\n onCheckedChange={(checkedState) => {\n if (checkedState) {\n context.onItemCheck(props.value);\n } else {\n context.onItemUncheck(props.value);\n }\n }}\n />\n </RovingFocusGroup.Item>\n );\n },\n);\n\nCheckboxGroupItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Component: CheckboxGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = `${CHECKBOX_GROUP_NAME}Indicator`;\n\ntype CheckboxGroupIndicatorElement = React.ElementRef<typeof CheckboxPrimitive.Indicator>;\ntype CheckboxGroupIndicatorProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Indicator>;\n\nconst CheckboxGroupIndicator = React.forwardRef<CheckboxGroupIndicatorElement, CheckboxGroupIndicatorProps>(\n ({ __scopeCheckboxGroup, ...props }: ScopedProps<CheckboxGroupIndicatorProps>, ref) => {\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n\n return <CheckboxPrimitive.Indicator ref={ref} {...checkboxScope} {...props} />;\n },\n);\n\nCheckboxGroupIndicator.displayName = INDICATOR_NAME;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nconst Root = CheckboxGroup;\nconst Item = CheckboxGroupItem;\nconst Indicator = CheckboxGroupIndicator;\n\nexport {\n createCheckboxGroupScope,\n CheckboxGroup,\n CheckboxGroupItem,\n CheckboxGroupIndicator,\n Root,\n Item,\n Indicator,\n type CheckboxGroupProps,\n type CheckboxGroupItemProps,\n type CheckboxGroupIndicatorProps,\n};\n"]}