@coopdigital/react 1.21.1 → 1.22.1

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,20 @@
1
+ import { StandardSizesWithNone } from "../../types/index.js";
2
+ import React, { ForwardRefExoticComponent, HTMLAttributes, JSX, ReactNode, Ref } from "react";
3
+ //#region src/components/Box/Box.d.ts
4
+ export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** **(Optional)** Specify a custom element to override default `div` */
6
+ as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
7
+ /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
8
+ children?: string | ReactNode;
9
+ /** **(Optional)** Specify additional CSS classes to be applied to the component. */
10
+ className?: string;
11
+ /** **(Optional)** Specify the Box padding. */
12
+ padding?: StandardSizesWithNone;
13
+ /** **(Optional)** Specify the Box border radius. */
14
+ radius?: StandardSizesWithNone;
15
+ /** **(Optional)** Specify a custom React ref for this component. */
16
+ ref?: Ref<HTMLDivElement>;
17
+ }
18
+ export declare const Box: ({ as, children, className, padding, radius, ref, ...props }: BoxProps) => JSX.Element;
19
+ //#endregion
20
+ export { Box as default };
@@ -0,0 +1,18 @@
1
+ import clsx from "clsx";
2
+ import React from "react";
3
+ //#region src/components/Box/Box.tsx
4
+ const Box = ({ as, children, className, padding, radius, ref, ...props }) => {
5
+ const componentProps = {
6
+ className: clsx("coop-box", className),
7
+ "data-padding": padding ?? void 0,
8
+ "data-radius": radius ?? void 0,
9
+ ...props
10
+ };
11
+ const element = as ?? "div";
12
+ return React.createElement(element, {
13
+ ...componentProps,
14
+ ref
15
+ }, children);
16
+ };
17
+ //#endregion
18
+ export { Box, Box as default };
@@ -0,0 +1,2 @@
1
+ import { Box, BoxProps } from "./Box.js";
2
+ export { Box, Box as default, BoxProps };
@@ -0,0 +1,5 @@
1
+ import { Box } from "./Box.js";
2
+ //#region src/components/Box/index.ts
3
+ var Box_default = Box;
4
+ //#endregion
5
+ export { Box, Box_default as default };
@@ -1,8 +1,8 @@
1
1
  import { ImageProps } from "../Image/Image.js";
2
2
  import "../Image/index.js";
3
+ import { StandardSizes } from "../../types/index.js";
3
4
  import { PictureProps } from "../Picture/Picture.js";
4
5
  import "../Picture/index.js";
5
- import { StandardSizes } from "../../types/index.js";
6
6
  import React, { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
7
7
  //#region src/components/Card/Card.d.ts
8
8
  export interface CardProps extends HTMLAttributes<HTMLDivElement> {
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  //#region src/components/Flourish/Flourish.tsx
4
4
  const Flourish = ({ children, className, fill = "brand-blue", ref, ...props }) => {
5
5
  const componentProps = {
6
- className: clsx("coop-flourish ", className),
6
+ className: clsx("coop-flourish", className),
7
7
  fill: `var(--color-${fill})`,
8
8
  ...props
9
9
  };
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/Form/Form.tsx
4
4
  const Form = ({ children, className, ref, ...props }) => {
5
5
  const componentProps = {
6
- className: clsx("coop-form ", className),
6
+ className: clsx("coop-form", className),
7
7
  ...props
8
8
  };
9
9
  return /* @__PURE__ */ jsx("form", {
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
4
4
  //#region src/components/LoadingSpinner/LoadingSpinner.tsx
5
5
  const LoadingSpinner = ({ className, ref, stroke = "currentColor", strokeWidth = "1px", ...props }) => {
6
6
  const componentProps = {
7
- className: clsx("coop-loading-spinner ", className),
7
+ className: clsx("coop-loading-spinner", className),
8
8
  stroke,
9
9
  strokeWidth,
10
10
  ...props
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/Prose/Prose.tsx
4
4
  const Prose = ({ children, className, full, ref, size, spacing, ...props }) => {
5
5
  const componentProps = {
6
- className: clsx("coop-prose ", className),
6
+ className: clsx("coop-prose", className),
7
7
  "data-full": full ?? void 0,
8
8
  "data-size": size ?? void 0,
9
9
  "data-spacing": spacing ?? void 0,
@@ -1,6 +1,6 @@
1
+ import { StandardSizes } from "../../types/index.js";
1
2
  import { ButtonProps } from "../Button/Button.js";
2
3
  import "../Button/index.js";
3
- import { StandardSizes } from "../../types/index.js";
4
4
  import { TextInputProps } from "../TextInput/TextInput.js";
5
5
  import "../TextInput/index.js";
6
6
  import React, { FormHTMLAttributes, JSX, RefObject } from "react";
@@ -27,7 +27,7 @@ const SquircleSvg = ({ size, ...props }) => {
27
27
  viewBox: "0 0 64 64",
28
28
  xmlns: "http://www.w3.org/2000/svg",
29
29
  children: /* @__PURE__ */ jsx("path", {
30
- d: "M0,32 C0,10.56,10.56,0,32,0 S64,10.56,64,32 S53.44,64,32,64 S0,53.44,0,32",
30
+ d: "M62 47.4a58 58 0 0 0 0-30.8A20 20 0 0 0 49.8 3a53 53 0 0 0-35.8 0 20 20 0 0 0-12 13.5 58 58 0 0 0 0 30.8A20 20 0 0 0 14 61a52 52 0 0 0 35.8 0 20 20 0 0 0 12-13.5",
31
31
  vectorEffect: "non-scaling-stroke"
32
32
  })
33
33
  });
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { AlertBanner, AlertBannerHeading, AlertBannerProps } from "./components/AlertBanner/AlertBanner.js";
2
2
  import { Image, ImageProps } from "./components/Image/Image.js";
3
3
  import { Author, AuthorProps } from "./components/Author/Author.js";
4
+ import { Box, BoxProps } from "./components/Box/Box.js";
5
+ import "./components/Box/index.js";
4
6
  import { Button, ButtonProps } from "./components/Button/Button.js";
5
7
  import { Picture, PictureProps } from "./components/Picture/Picture.js";
6
8
  import "./components/Picture/index.js";
@@ -29,4 +31,4 @@ import { Squircle, SquircleProps, SquircleSvgProps } from "./components/Squircle
29
31
  import { Tag, TagProps } from "./components/Tag/Tag.js";
30
32
  import { Textarea, TextareaProps } from "./components/Textarea/Textarea.js";
31
33
  import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps } from "./components/ValidationSummary/ValidationSummary.js";
32
- export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, DatePicker, DatePickerProps, Dialog, DialogBody, DialogHeader, DialogProps, Expandable, ExpandableContent, ExpandableProps, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, FieldsetProps, Flourish, FlourishProps, Form, FormProps, Image, ImageProps, LoadingSpinner, LoadingSpinnerProps, Logo, LogoProps, PasswordInput, PasswordInputProps, Picture, PictureProps, Pill, PillBadge, PillProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, PopoverTrigger, Radio, RadioProps, RootSVG, Searchbox, SearchboxButton, SearchboxInput, SearchboxProps, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps };
34
+ export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Box, BoxProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, DatePicker, DatePickerProps, Dialog, DialogBody, DialogHeader, DialogProps, Expandable, ExpandableContent, ExpandableProps, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, FieldsetProps, Flourish, FlourishProps, Form, FormProps, Image, ImageProps, LoadingSpinner, LoadingSpinnerProps, Logo, LogoProps, PasswordInput, PasswordInputProps, Picture, PictureProps, Pill, PillBadge, PillProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, PopoverTrigger, Radio, RadioProps, RootSVG, Searchbox, SearchboxButton, SearchboxInput, SearchboxProps, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AlertBanner, AlertBannerHeading } from "./components/AlertBanner/AlertBanner.js";
2
2
  import { Image } from "./components/Image/Image.js";
3
3
  import { Author } from "./components/Author/Author.js";
4
+ import { Box } from "./components/Box/Box.js";
4
5
  import { LoadingSpinner } from "./components/LoadingSpinner/LoadingSpinner.js";
5
6
  import { Button } from "./components/Button/Button.js";
6
7
  import { Picture } from "./components/Picture/Picture.js";
@@ -28,4 +29,4 @@ import { Squircle } from "./components/Squircle/Squircle.js";
28
29
  import { Tag } from "./components/Tag/Tag.js";
29
30
  import { Textarea } from "./components/Textarea/Textarea.js";
30
31
  import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt } from "./components/ValidationSummary/ValidationSummary.js";
31
- export { AlertBanner, AlertBannerHeading, Author, Button, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Checkbox, DatePicker, Dialog, DialogBody, DialogHeader, Expandable, ExpandableContent, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, Flourish, Form, Image, LoadingSpinner, Logo, PasswordInput, Picture, Pill, PillBadge, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Radio, RootSVG, Searchbox, SearchboxButton, SearchboxInput, Select, SelectOption, SelectOptionGroup, Signpost, SkipNav, Squircle, Tag, TextInput, Textarea, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt };
32
+ export { AlertBanner, AlertBannerHeading, Author, Box, Button, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Checkbox, DatePicker, Dialog, DialogBody, DialogHeader, Expandable, ExpandableContent, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, Flourish, Form, Image, LoadingSpinner, Logo, PasswordInput, Picture, Pill, PillBadge, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Radio, RootSVG, Searchbox, SearchboxButton, SearchboxInput, Select, SelectOption, SelectOptionGroup, Signpost, SkipNav, Squircle, Tag, TextInput, Textarea, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt };
@@ -1,3 +1,4 @@
1
1
  //#region src/types/index.d.ts
2
2
  export type StandardSizes = "sm" | "md" | "lg";
3
+ export type StandardSizesWithNone = "none" | "sm" | "md" | "lg";
3
4
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.21.1",
4
+ "version": "1.22.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -103,12 +103,12 @@
103
103
  "storybook": "$storybook"
104
104
  },
105
105
  "dependencies": {
106
- "@coopdigital/styles": "^1.15.0",
106
+ "@coopdigital/styles": "^1.16.0",
107
107
  "@radix-ui/react-popover": "^1.1.23",
108
108
  "clsx": "^2.1.1",
109
109
  "date-fns": "^4.4.0",
110
110
  "merge-refs": "^2.0.0",
111
111
  "react-day-picker": "^10.0.1"
112
112
  },
113
- "gitHead": "589224b266bc6e2d0ca95113056f4e676422f144"
113
+ "gitHead": "095447fa5af6d5bab3223cfd787f4eb668f4e2eb"
114
114
  }
@@ -0,0 +1,43 @@
1
+ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, ReactNode, Ref } from "react"
2
+
3
+ import clsx from "clsx"
4
+ import React from "react"
5
+
6
+ import { StandardSizesWithNone } from "@/types"
7
+ export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
8
+ /** **(Optional)** Specify a custom element to override default `div` */
9
+ // oxlint-disable-next-line typescript/no-explicit-any
10
+ as?: React.FC<any> | ForwardRefExoticComponent<any> | string
11
+ /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
12
+ children?: string | ReactNode
13
+ /** **(Optional)** Specify additional CSS classes to be applied to the component. */
14
+ className?: string
15
+ /** **(Optional)** Specify the Box padding. */
16
+ padding?: StandardSizesWithNone
17
+ /** **(Optional)** Specify the Box border radius. */
18
+ radius?: StandardSizesWithNone
19
+ /** **(Optional)** Specify a custom React ref for this component. */
20
+ ref?: Ref<HTMLDivElement>
21
+ }
22
+
23
+ export const Box = ({
24
+ as,
25
+ children,
26
+ className,
27
+ padding,
28
+ radius,
29
+ ref,
30
+ ...props
31
+ }: BoxProps): JSX.Element => {
32
+ const componentProps = {
33
+ className: clsx("coop-box", className),
34
+ "data-padding": padding ?? undefined,
35
+ "data-radius": radius ?? undefined,
36
+ ...props,
37
+ }
38
+ const element: BoxProps["as"] = as ?? "div"
39
+
40
+ return React.createElement(element, { ...componentProps, ref }, children)
41
+ }
42
+
43
+ export default Box
@@ -0,0 +1,5 @@
1
+ import Box from "./Box"
2
+
3
+ export default Box
4
+ export { Box }
5
+ export * from "./Box"
@@ -23,7 +23,7 @@ const Flourish = ({
23
23
  ...props
24
24
  }: FlourishProps): JSX.Element => {
25
25
  const componentProps = {
26
- className: clsx("coop-flourish ", className),
26
+ className: clsx("coop-flourish", className),
27
27
  fill: `var(--color-${fill})`,
28
28
  ...props,
29
29
  }
@@ -13,7 +13,7 @@ export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
13
13
 
14
14
  const Form = ({ children, className, ref, ...props }: FormProps): JSX.Element => {
15
15
  const componentProps = {
16
- className: clsx("coop-form ", className),
16
+ className: clsx("coop-form", className),
17
17
  ...props,
18
18
  }
19
19
 
@@ -23,7 +23,7 @@ export const LoadingSpinner = ({
23
23
  ...props
24
24
  }: LoadingSpinnerProps): JSX.Element => {
25
25
  const componentProps = {
26
- className: clsx("coop-loading-spinner ", className),
26
+ className: clsx("coop-loading-spinner", className),
27
27
  stroke,
28
28
  strokeWidth,
29
29
  ...props,
@@ -37,7 +37,7 @@ export const Prose = ({
37
37
  ...props
38
38
  }: ProseProps): JSX.Element => {
39
39
  const componentProps = {
40
- className: clsx("coop-prose ", className),
40
+ className: clsx("coop-prose", className),
41
41
  "data-full": full ?? undefined,
42
42
  "data-size": size ?? undefined,
43
43
  "data-spacing": spacing ?? undefined,
@@ -2,10 +2,6 @@ import type { HTMLAttributes, JSX, Ref, SVGAttributes } from "react"
2
2
 
3
3
  import clsx from "clsx"
4
4
 
5
- // import { useSlots } from "@/hooks"
6
-
7
- // import { hasUserBg } from "@/utils"
8
-
9
5
  export interface SquircleProps extends HTMLAttributes<HTMLDivElement> {
10
6
  /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
11
7
  children?: React.ReactNode
@@ -51,7 +47,7 @@ const SquircleSvg = ({ size, ...props }: SquircleSvgProps) => {
51
47
  xmlns="http://www.w3.org/2000/svg"
52
48
  >
53
49
  <path
54
- d="M0,32 C0,10.56,10.56,0,32,0 S64,10.56,64,32 S53.44,64,32,64 S0,53.44,0,32"
50
+ d="M62 47.4a58 58 0 0 0 0-30.8A20 20 0 0 0 49.8 3a53 53 0 0 0-35.8 0 20 20 0 0 0-12 13.5 58 58 0 0 0 0 30.8A20 20 0 0 0 14 61a52 52 0 0 0 35.8 0 20 20 0 0 0 12-13.5"
55
51
  vectorEffect="non-scaling-stroke"
56
52
  />
57
53
  </svg>
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./components/AlertBanner/AlertBanner"
2
2
  export * from "./components/Author/Author"
3
+ export * from "./components/Box"
3
4
  export * from "./components/Button/Button"
4
5
  export * from "./components/Card/Card"
5
6
  export * from "./components/Checkbox/Checkbox"
@@ -1,4 +1,5 @@
1
1
  export type StandardSizes = "sm" | "md" | "lg"
2
+ export type StandardSizesWithNone = "none" | "sm" | "md" | "lg"
2
3
 
3
4
  // export type FormFieldError = { message?: string; type?: string } | boolean | null | undefined
4
5