@pibit.ai/cure-design-system 0.6.7 → 0.6.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.
Files changed (30) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +298 -282
  4. package/dist/patterns/accordion/accordion.d.ts +75 -0
  5. package/dist/patterns/accordion/accordion.d.ts.map +1 -0
  6. package/dist/patterns/accordion/accordion.js +151 -0
  7. package/dist/patterns/accordion/collapsible.d.ts +29 -0
  8. package/dist/patterns/accordion/collapsible.d.ts.map +1 -0
  9. package/dist/patterns/accordion/collapsible.js +30 -0
  10. package/dist/patterns/accordion/expandable-card.d.ts +30 -0
  11. package/dist/patterns/accordion/expandable-card.d.ts.map +1 -0
  12. package/dist/patterns/accordion/expandable-card.js +99 -0
  13. package/dist/patterns/accordion/index.d.ts +4 -0
  14. package/dist/patterns/accordion/index.d.ts.map +1 -0
  15. package/dist/patterns/table/toolbar/GroupByDropdown.js +1 -1
  16. package/dist/patterns/table/toolbar/ToolbarRadio.d.ts +5 -17
  17. package/dist/patterns/table/toolbar/ToolbarRadio.d.ts.map +1 -1
  18. package/dist/primitives/radio/index.d.ts +2 -0
  19. package/dist/primitives/radio/index.d.ts.map +1 -0
  20. package/dist/primitives/radio/radio.d.ts +61 -0
  21. package/dist/primitives/radio/radio.d.ts.map +1 -0
  22. package/dist/primitives/radio/radio.js +75 -0
  23. package/dist/primitives/textarea/index.d.ts +2 -0
  24. package/dist/primitives/textarea/index.d.ts.map +1 -0
  25. package/dist/primitives/textarea/textarea.d.ts +56 -0
  26. package/dist/primitives/textarea/textarea.d.ts.map +1 -0
  27. package/dist/primitives/textarea/textarea.js +107 -0
  28. package/dist/styles/components.css +1 -1
  29. package/package.json +1 -1
  30. package/dist/patterns/table/toolbar/ToolbarRadio.js +0 -64
@@ -0,0 +1,56 @@
1
+ import { ReactNode, Ref } from 'react';
2
+ import { TextAreaProps as AriaTextAreaProps, TextFieldProps as AriaTextFieldProps } from 'react-aria-components';
3
+ export interface TextAreaBaseProps extends AriaTextAreaProps {
4
+ ref?: Ref<HTMLTextAreaElement>;
5
+ /**
6
+ * TextArea size.
7
+ * @default "sm"
8
+ */
9
+ size?: "sm" | "md" | "lg";
10
+ }
11
+ /** The bare `<textarea>`, for use inside your own React Aria `TextField`. */
12
+ export declare const TextAreaBase: {
13
+ ({ className, style, size, ...props }: TextAreaBaseProps): import("react/jsx-runtime").JSX.Element;
14
+ displayName: string;
15
+ };
16
+ export interface TextAreaProps extends AriaTextFieldProps {
17
+ /** Label text for the textarea. */
18
+ label?: string;
19
+ /** Helper text below the textarea. Shown as the error message when `isInvalid`. */
20
+ hint?: ReactNode;
21
+ /** Tooltip shown after the label. */
22
+ tooltip?: string;
23
+ /** Class name for the `<textarea>` itself (`className` styles the field wrapper). */
24
+ textAreaClassName?: TextAreaBaseProps["className"];
25
+ /** Ref for the field wrapper. */
26
+ ref?: Ref<HTMLDivElement>;
27
+ /** Ref for the `<textarea>`, e.g. to measure it for auto-grow. */
28
+ textAreaRef?: TextAreaBaseProps["ref"];
29
+ /** Hide the required asterisk on the label. */
30
+ hideRequiredIndicator?: boolean;
31
+ /** Placeholder text. */
32
+ placeholder?: string;
33
+ /** Visible height in rows. */
34
+ rows?: number;
35
+ /** Visible width in columns. */
36
+ cols?: number;
37
+ /**
38
+ * TextArea size.
39
+ * @default "sm"
40
+ */
41
+ size?: TextAreaBaseProps["size"];
42
+ }
43
+ /**
44
+ * A multi-line text field built on React Aria `TextField` + `TextArea`, with the
45
+ * same label and hint as `Input`. Validation goes through `isInvalid` + `hint`;
46
+ * a character count is the caller's to render.
47
+ *
48
+ * @example
49
+ * <TextArea label="Description" rows={4} value={value} onChange={setValue} />
50
+ * <TextArea label="Reason" isRequired isInvalid hint="Required" />
51
+ */
52
+ export declare const TextArea: {
53
+ ({ label, hint, tooltip, textAreaRef, hideRequiredIndicator, textAreaClassName, placeholder, className, rows, cols, size, ...props }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
54
+ displayName: string;
55
+ };
56
+ //# sourceMappingURL=textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/primitives/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,cAAc,IAAI,kBAAkB,EACrC,MAAM,uBAAuB,CAAC;AA+C/B,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3B;AAED,6EAA6E;AAC7E,eAAO,MAAM,YAAY;2CAKtB,iBAAiB;;CAkCnB,CAAC;AAIF,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACnD,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,kEAAkE;IAClE,WAAW,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,+CAA+C;IAC/C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ;0IAalB,aAAa;;CAsCf,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { jsx as i, jsxs as h, Fragment as y } from "react/jsx-runtime";
2
+ import { TextField as w, TextArea as k } from "react-aria-components";
3
+ import { cx as x } from "../../utils/cn.js";
4
+ import { HintText as z } from "../input/hint-text.js";
5
+ import { Label as T } from "../input/label.js";
6
+ const n = (r) => `url(data:image/svg+xml;base64,${btoa(
7
+ `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 2L2 10" stroke="${r}" stroke-linecap="round"/><path d="M11 7L7 11" stroke="${r}" stroke-linecap="round"/></svg>`
8
+ )})`, A = {
9
+ "--resize-handle-bg": n("#D5D7DA"),
10
+ "--resize-handle-bg-dark": n("#373A41")
11
+ }, v = {
12
+ sm: "text-xs",
13
+ md: "text-sm",
14
+ lg: "text-md"
15
+ }, D = {
16
+ sm: "text-xs",
17
+ md: "text-xs",
18
+ lg: "text-sm"
19
+ }, B = {
20
+ sm: "p-[7px]",
21
+ md: "py-2 px-3",
22
+ lg: "py-3 px-3.5"
23
+ }, m = ({
24
+ className: r,
25
+ style: t,
26
+ size: s = "sm",
27
+ ...o
28
+ }) => /* @__PURE__ */ i(
29
+ k,
30
+ {
31
+ ...o,
32
+ style: (e) => ({
33
+ ...A,
34
+ ...typeof t == "function" ? t(e) : t
35
+ }),
36
+ className: (e) => x(
37
+ "w-full scroll-py-3 rounded-lg bg-primary border border-secondary transition duration-100 ease-linear placeholder:text-placeholder_subtle autofill:rounded-lg autofill:text-primary focus:outline-hidden text-primary",
38
+ v[s],
39
+ B[s],
40
+ // Resize handle
41
+ "[&::-webkit-resizer]:bg-(image:--resize-handle-bg) [&::-webkit-resizer]:bg-contain dark:[&::-webkit-resizer]:bg-(image:--resize-handle-bg-dark)",
42
+ e.isFocused && !e.isDisabled && "border-brand",
43
+ e.isDisabled && "cursor-not-allowed bg-disabled_subtle text-disabled border-disabled",
44
+ // Frozen to platform-ui on purpose: an unfocused invalid textarea keeps its
45
+ // normal border, and the error shows in the hint text. The red ring only
46
+ // appears on focus. Unlike `Input`, there is no `border-error`. platform-ui
47
+ // callers that want a red border at rest (the inline-edit cells) pass
48
+ // `ring-2 ring-error` through `textAreaClassName`. Bringing this in line
49
+ // with `Input` is a visible change, so it is left for a design decision.
50
+ e.isInvalid && "ring-error_subtle",
51
+ e.isInvalid && e.isFocused && "ring-2 ring-error",
52
+ typeof r == "function" ? r(e) : r
53
+ )
54
+ }
55
+ );
56
+ m.displayName = "TextAreaBase";
57
+ const F = ({
58
+ label: r,
59
+ hint: t,
60
+ tooltip: s,
61
+ textAreaRef: o,
62
+ hideRequiredIndicator: e,
63
+ textAreaClassName: g,
64
+ placeholder: p,
65
+ className: l,
66
+ rows: b,
67
+ cols: c,
68
+ size: d = "sm",
69
+ ...u
70
+ }) => /* @__PURE__ */ i(
71
+ w,
72
+ {
73
+ ...u,
74
+ className: (a) => x(
75
+ "group flex h-max w-full flex-col items-start justify-start gap-1.5",
76
+ typeof l == "function" ? l(a) : l
77
+ ),
78
+ children: ({ isInvalid: a, isRequired: f }) => /* @__PURE__ */ h(y, { children: [
79
+ r && /* @__PURE__ */ i(
80
+ T,
81
+ {
82
+ className: D[d],
83
+ isRequired: f && !e,
84
+ tooltip: s,
85
+ children: r
86
+ }
87
+ ),
88
+ /* @__PURE__ */ i(
89
+ m,
90
+ {
91
+ placeholder: p,
92
+ className: g,
93
+ ref: o,
94
+ rows: b,
95
+ cols: c,
96
+ size: d
97
+ }
98
+ ),
99
+ t && /* @__PURE__ */ i(z, { isInvalid: a, children: t })
100
+ ] })
101
+ }
102
+ );
103
+ F.displayName = "TextArea";
104
+ export {
105
+ F as TextArea,
106
+ m as TextAreaBase
107
+ };