@qasa/qds-ui 0.10.0-next.7 → 0.10.0-next.9

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,70 @@
1
+ import type { ReactElement } from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ interface CheckboxOptions {
4
+ /**
5
+ * The label for the checkbox. Accepts a string, or a React component for rendering links within the label.
6
+ *
7
+ * @example
8
+ * ```jsx
9
+ * <Checkbox label="I agree to the terms and conditions" />
10
+ * ```
11
+ *
12
+ * @example
13
+ * ```jsx
14
+ * <Checkbox
15
+ * label={
16
+ * <>
17
+ * I agree to <Link href="/terms">the terms and conditions</Link>
18
+ * </>
19
+ * }
20
+ * />
21
+ * ```
22
+ */
23
+ label: string | ReactElement<unknown>;
24
+ /**
25
+ * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
26
+ */
27
+ isDefaultChecked?: boolean;
28
+ /**
29
+ * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
30
+ */
31
+ defaultChecked?: boolean;
32
+ /**
33
+ * The controlled checked state of the checkbox. Must be used in conjunction with `onCheckedChange`.
34
+ */
35
+ isChecked?: boolean;
36
+ /**
37
+ * The controlled checked state of the checkbox. Must be used in conjunction with `onCheckedChange`.
38
+ */
39
+ checked?: boolean;
40
+ /**
41
+ * Event handler called when the checked state of the checkbox changes.
42
+ */
43
+ onCheckedChange?: (checked: boolean) => void;
44
+ /**
45
+ * If `true` the checkbox will render in its invalid state.
46
+ * @default false
47
+ */
48
+ isInvalid?: boolean;
49
+ /**
50
+ * If `true` it prevents the user from interacting with the checkbox.
51
+ * @default false
52
+ */
53
+ isDisabled?: boolean;
54
+ /**
55
+ * If `true` the user must check the checkbox before the owning form can be submitted.
56
+ * @default false
57
+ */
58
+ isRequired?: boolean;
59
+ /**
60
+ * The name of the checkbox. Submitted with its owning form as part of a name/value pair.
61
+ */
62
+ name?: string;
63
+ /**
64
+ * The value given as data when submitted with a `name`.
65
+ */
66
+ value?: string;
67
+ }
68
+ export declare type CheckboxProps = Omit<CheckboxPrimitive.CheckboxProps, 'asChild' | 'children' | 'checked' | 'defaultChecked' | keyof CheckboxOptions> & CheckboxOptions;
69
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps, "children" | "asChild" | keyof CheckboxOptions> & CheckboxOptions & import("react").RefAttributes<HTMLButtonElement>>;
70
+ export {};
@@ -0,0 +1 @@
1
+ export * from './checkbox';
@@ -1,5 +1,6 @@
1
1
  export * from './avatar';
2
2
  export * from './button';
3
+ export * from './checkbox';
3
4
  export * from './divider';
4
5
  export * from './dropdown-menu';
5
6
  export * from './heading';
@@ -408,7 +408,7 @@ export declare const getFormFieldBaseStyles: (theme: {
408
408
  borderColor: string;
409
409
  boxShadow: `0 0 0 1px ${string}`;
410
410
  };
411
- '&[aria-invalid=true]': {
411
+ '&[aria-invalid="true"]': {
412
412
  borderColor: string;
413
413
  '&:focus': {
414
414
  boxShadow: `0 0 0 1px ${string}`;
@@ -1,3 +1,4 @@
1
1
  declare type Booleanish = boolean | 'true' | 'false';
2
2
  export declare const dataAttr: (condition: boolean | undefined) => Booleanish;
3
+ export declare const ariaAttr: (condition: boolean | undefined) => Booleanish;
3
4
  export {};
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import * as react from 'react';
3
- import { ElementType, ComponentPropsWithoutRef, ReactNode, SVGAttributes, useLayoutEffect } from 'react';
3
+ import { ElementType, ComponentPropsWithoutRef, ReactNode, SVGAttributes, ReactElement, useLayoutEffect } from 'react';
4
4
  import { Options } from '@emotion/cache';
5
5
  import * as _emotion_react from '@emotion/react';
6
6
  import { CSSObject } from '@emotion/react';
7
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
7
8
  import * as DropdownPrimitive from '@radix-ui/react-dropdown-menu';
8
9
  import * as _emotion_styled from '@emotion/styled';
9
10
  import { LucideIcon } from 'lucide-react';
@@ -1444,7 +1445,7 @@ declare const getFormFieldBaseStyles: (theme: {
1444
1445
  borderColor: string;
1445
1446
  boxShadow: `0 0 0 1px ${string}`;
1446
1447
  };
1447
- '&[aria-invalid=true]': {
1448
+ '&[aria-invalid="true"]': {
1448
1449
  borderColor: string;
1449
1450
  '&:focus': {
1450
1451
  boxShadow: `0 0 0 1px ${string}`;
@@ -2419,6 +2420,74 @@ declare type PolymorphicButton = ForwardRefComponent<'button', ButtonOptions>;
2419
2420
  declare type ButtonProps = PropsOf<PolymorphicButton>;
2420
2421
  declare const Button: PolymorphicButton;
2421
2422
 
2423
+ interface CheckboxOptions {
2424
+ /**
2425
+ * The label for the checkbox. Accepts a string, or a React component for rendering links within the label.
2426
+ *
2427
+ * @example
2428
+ * ```jsx
2429
+ * <Checkbox label="I agree to the terms and conditions" />
2430
+ * ```
2431
+ *
2432
+ * @example
2433
+ * ```jsx
2434
+ * <Checkbox
2435
+ * label={
2436
+ * <>
2437
+ * I agree to <Link href="/terms">the terms and conditions</Link>
2438
+ * </>
2439
+ * }
2440
+ * />
2441
+ * ```
2442
+ */
2443
+ label: string | ReactElement<unknown>;
2444
+ /**
2445
+ * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
2446
+ */
2447
+ isDefaultChecked?: boolean;
2448
+ /**
2449
+ * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
2450
+ */
2451
+ defaultChecked?: boolean;
2452
+ /**
2453
+ * The controlled checked state of the checkbox. Must be used in conjunction with `onCheckedChange`.
2454
+ */
2455
+ isChecked?: boolean;
2456
+ /**
2457
+ * The controlled checked state of the checkbox. Must be used in conjunction with `onCheckedChange`.
2458
+ */
2459
+ checked?: boolean;
2460
+ /**
2461
+ * Event handler called when the checked state of the checkbox changes.
2462
+ */
2463
+ onCheckedChange?: (checked: boolean) => void;
2464
+ /**
2465
+ * If `true` the checkbox will render in its invalid state.
2466
+ * @default false
2467
+ */
2468
+ isInvalid?: boolean;
2469
+ /**
2470
+ * If `true` it prevents the user from interacting with the checkbox.
2471
+ * @default false
2472
+ */
2473
+ isDisabled?: boolean;
2474
+ /**
2475
+ * If `true` the user must check the checkbox before the owning form can be submitted.
2476
+ * @default false
2477
+ */
2478
+ isRequired?: boolean;
2479
+ /**
2480
+ * The name of the checkbox. Submitted with its owning form as part of a name/value pair.
2481
+ */
2482
+ name?: string;
2483
+ /**
2484
+ * The value given as data when submitted with a `name`.
2485
+ */
2486
+ value?: string;
2487
+ }
2488
+ declare type CheckboxProps = Omit<CheckboxPrimitive.CheckboxProps, 'asChild' | 'children' | 'checked' | 'defaultChecked' | keyof CheckboxOptions> & CheckboxOptions;
2489
+ declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps, "children" | "asChild" | keyof CheckboxOptions> & CheckboxOptions & react.RefAttributes<HTMLButtonElement>>;
2490
+
2422
2491
  interface DividerOptions {
2423
2492
  /**
2424
2493
  * The orientation of the divider.
@@ -5198,4 +5267,4 @@ declare function useStableId(fixedId?: string | null): string;
5198
5267
  */
5199
5268
  declare const useSafeLayoutEffect: typeof useLayoutEffect;
5200
5269
 
5201
- export { AlertCircleIcon, AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, Avatar, AvatarProps, BellIcon, BellOffIcon, BookmarkIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CreateIconOptions, Divider, DividerProps, DropdownMenu, DropdownMenuContentProps, DropdownMenuDividerProps, DropdownMenuItemProps, DropdownMenuRootProps, DropdownMenuTriggerProps, ForwardRefComponent, GlobalStyles, GlobeIcon, Heading, HeadingProps, HeartFilledIcon, HeartIcon, HelpCircleIcon, HintBox, HintBoxProps, HintBoxTitleProps, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconProps, ImageIcon, InputBase, InputBaseOptions, InputBaseProps, IntrinsicElement, Label, LabelProps, Link, LinkProps, ListFilterIcon, ListIcon, LoadingDots, LoadingDotsProps, LogOutIcon, MapIcon, MapPinIcon, MenuIcon, MessageCircleIcon, MinusIcon, MoreHorizontalIcon, MoreVerticalIcon, OwnProps, Paragraph, ParagraphProps, PenIcon, PlusIcon, PropsOf, QdsProvider, RadioCardProps, RadioGroup, RadioGroupLabelProps, RadioGroupProps, SearchIcon, Select, SelectBase, SelectBaseOptions, SelectOptionProps, SelectProps, SettingsIcon, ShareIcon, SlidersIcon, Spacer, SpacerProps, Stack, StackProps, StarFilledIcon, StarIcon, TextField, TextFieldProps, Textarea, TextareaBase, TextareaBaseOptions, TextareaBaseProps, TextareaProps, Theme, ThemeOverrides, TrashIcon, UseBreakpointOptions, UseBreakpointValueProps, UseFormFieldProps, UseImageProps, UserIcon, VariantProps, XCircleIcon, XIcon, createIcon, createLucideIcon, createStyle, createStyleVariants, getFormFieldBaseStyles, overrideTheme, pxToRem, theme, toast, useBreakpoint, useBreakpointValue, useFormField, useImage, useSafeLayoutEffect, useStableId };
5270
+ export { AlertCircleIcon, AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, Avatar, AvatarProps, BellIcon, BellOffIcon, BookmarkIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CheckCircleIcon, CheckIcon, Checkbox, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CreateIconOptions, Divider, DividerProps, DropdownMenu, DropdownMenuContentProps, DropdownMenuDividerProps, DropdownMenuItemProps, DropdownMenuRootProps, DropdownMenuTriggerProps, ForwardRefComponent, GlobalStyles, GlobeIcon, Heading, HeadingProps, HeartFilledIcon, HeartIcon, HelpCircleIcon, HintBox, HintBoxProps, HintBoxTitleProps, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconProps, ImageIcon, InputBase, InputBaseOptions, InputBaseProps, IntrinsicElement, Label, LabelProps, Link, LinkProps, ListFilterIcon, ListIcon, LoadingDots, LoadingDotsProps, LogOutIcon, MapIcon, MapPinIcon, MenuIcon, MessageCircleIcon, MinusIcon, MoreHorizontalIcon, MoreVerticalIcon, OwnProps, Paragraph, ParagraphProps, PenIcon, PlusIcon, PropsOf, QdsProvider, RadioCardProps, RadioGroup, RadioGroupLabelProps, RadioGroupProps, SearchIcon, Select, SelectBase, SelectBaseOptions, SelectOptionProps, SelectProps, SettingsIcon, ShareIcon, SlidersIcon, Spacer, SpacerProps, Stack, StackProps, StarFilledIcon, StarIcon, TextField, TextFieldProps, Textarea, TextareaBase, TextareaBaseOptions, TextareaBaseProps, TextareaProps, Theme, ThemeOverrides, TrashIcon, UseBreakpointOptions, UseBreakpointValueProps, UseFormFieldProps, UseImageProps, UserIcon, VariantProps, XCircleIcon, XIcon, createIcon, createLucideIcon, createStyle, createStyleVariants, getFormFieldBaseStyles, overrideTheme, pxToRem, theme, toast, useBreakpoint, useBreakpointValue, useFormField, useImage, useSafeLayoutEffect, useStableId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qasa/qds-ui",
3
- "version": "0.10.0-next.7",
3
+ "version": "0.10.0-next.9",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -106,6 +106,7 @@
106
106
  "node": ">=14"
107
107
  },
108
108
  "dependencies": {
109
+ "@radix-ui/react-checkbox": "^1.0.4",
109
110
  "@radix-ui/react-radio-group": "^1.1.3",
110
111
  "@radix-ui/react-toast": "^1.1.5",
111
112
  "@radix-ui/react-dropdown-menu": "^2.0.6"