@planningcenter/tapestry 3.1.0-rc.23 → 3.1.0-rc.24
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.
- package/dist/components/checkbox/Checkbox.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.js +5 -14
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox/tds-indeterminate.d.ts +11 -0
- package/dist/components/checkbox/tds-indeterminate.d.ts.map +1 -0
- package/dist/components/checkbox/tds-indeterminate.js +30 -0
- package/dist/components/checkbox/tds-indeterminate.js.map +1 -0
- package/dist/components/input/Input.d.ts +9 -9
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/select/Select.d.ts +14 -11
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/text-area/TextArea.d.ts +10 -9
- package/dist/components/text-area/TextArea.d.ts.map +1 -1
- package/dist/components/text-area/TextArea.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/reactRender.css +476 -472
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +476 -472
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +4 -0
- package/dist/unstable.css.map +1 -1
- package/dist/unstable.js +1 -0
- package/dist/unstable.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,iBAAiB,CAAC,EAAE,KAAK,CAAA;IACzB;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,UAAU,0BAA2B,SAAQ,iBAAiB;IAC5D,iBAAiB,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,0BAA0B,CAAA;AAE1E,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,aAAa,GAAG,MAAM,CAC7B,GACC,aAAa,CAAA;AAEf;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,+FAyDpB,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import './tds-indeterminate.js';
|
|
1
2
|
import Icon from '../../utilities/Icon.js';
|
|
2
3
|
import { useId } from '../../utilities/useId.js';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
|
-
import React__default, { forwardRef
|
|
5
|
+
import React__default, { forwardRef } from 'react';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A checkbox component that renders as a checkbox input with label.
|
|
@@ -18,23 +19,13 @@ import React__default, { forwardRef, useCallback } from 'react';
|
|
|
18
19
|
* @component
|
|
19
20
|
*/
|
|
20
21
|
const Checkbox = forwardRef(({ className, description, id, indeterminate = false, invalid, label, size = "md", ...restProps }, ref) => {
|
|
21
|
-
const callbackRef = useCallback((element) => {
|
|
22
|
-
if (element) {
|
|
23
|
-
element.indeterminate = indeterminate;
|
|
24
|
-
}
|
|
25
|
-
// Handle the forwarded ref
|
|
26
|
-
if (typeof ref === "function") {
|
|
27
|
-
ref(element);
|
|
28
|
-
}
|
|
29
|
-
else if (ref && typeof ref === "object") {
|
|
30
|
-
ref.current = element;
|
|
31
|
-
}
|
|
32
|
-
}, [ref, indeterminate]);
|
|
33
22
|
const combinedClassName = classNames("tds-checkbox", size && size === "sm" && `tds-checkbox--sm`, invalid && "tds-checkbox--invalid", className);
|
|
34
23
|
const stableId = useId();
|
|
35
24
|
const checkboxId = id || `tds-checkbox-${stableId}`;
|
|
25
|
+
const WrapperElement = indeterminate ? "tds-indeterminate" : React__default.Fragment;
|
|
36
26
|
return (React__default.createElement("div", { className: combinedClassName },
|
|
37
|
-
React__default.createElement(
|
|
27
|
+
React__default.createElement(WrapperElement, null,
|
|
28
|
+
React__default.createElement("input", { ...restProps, "aria-describedby": description ? `${checkboxId}-description` : undefined, "aria-invalid": invalid, id: checkboxId, ref: ref, type: "checkbox" })),
|
|
38
29
|
label && React__default.createElement("label", { htmlFor: checkboxId }, label),
|
|
39
30
|
description && (React__default.createElement("p", { id: `${checkboxId}-description`, className: "tds-checkbox-description" },
|
|
40
31
|
React__default.createElement(Icon, { className: "tds-checkbox-description-invalid-icon", symbol: "general#exclamation-triangle", "aria-hidden": true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import \"./index.css\"\nimport \"./tds-indeterminate\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nexport type CheckboxSize = \"md\" | \"sm\"\n\ninterface CheckboxBaseProps {\n description?: string\n indeterminate?: boolean\n invalid?: boolean\n size?: CheckboxSize\n}\n\ninterface CheckboxWithLabel extends CheckboxBaseProps {\n \"aria-labelledby\"?: never\n /**\n * Label content for the checkbox. When using non-string content\n * (e.g. JSX), it must not contain interactive elements. This\n * includes native HTML elements such as `<a>` and `<button>`, as\n * well as Tapestry or Tapestry-React interactive components.\n */\n label: React.ReactNode\n}\n\ninterface CheckboxWithAriaLabelledBy extends CheckboxBaseProps {\n \"aria-labelledby\": string\n label?: never\n}\n\nexport type CheckboxProps = CheckboxWithLabel | CheckboxWithAriaLabelledBy\n\nexport type CheckboxElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof CheckboxProps | \"type\"\n> &\n CheckboxProps\n\n/**\n * A checkbox component that renders as a checkbox input with label.\n * Supports various sizes, error states, and disabled states.\n *\n * **Required:** You must provide either:\n * - `label` - Label content for the checkbox\n * - `aria-labelledby` - ID of an external element that provides the label\n *\n * When using non-string content for `label` (e.g. JSX), it must not contain\n * interactive elements. This includes native HTML elements such as `<a>` and\n * `<button>`, as well as Tapestry or Tapestry-React interactive components.\n *\n * @component\n */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxElementProps>(\n (\n {\n className,\n description,\n id,\n indeterminate = false,\n invalid,\n label,\n size = \"md\",\n ...restProps\n }: CheckboxElementProps,\n ref\n ) => {\n const combinedClassName = classNames(\n \"tds-checkbox\",\n size && size === \"sm\" && `tds-checkbox--sm`,\n invalid && \"tds-checkbox--invalid\",\n className\n )\n\n const stableId = useId()\n const checkboxId = id || `tds-checkbox-${stableId}`\n\n const WrapperElement = indeterminate ? \"tds-indeterminate\" : React.Fragment\n\n return (\n <div className={combinedClassName}>\n <WrapperElement>\n <input\n {...restProps}\n aria-describedby={\n description ? `${checkboxId}-description` : undefined\n }\n aria-invalid={invalid}\n id={checkboxId}\n ref={ref}\n type=\"checkbox\"\n />\n </WrapperElement>\n {label && <label htmlFor={checkboxId}>{label}</label>}\n {description && (\n <p\n id={`${checkboxId}-description`}\n className=\"tds-checkbox-description\"\n >\n <Icon\n className=\"tds-checkbox-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n aria-hidden\n />\n {description}\n </p>\n )}\n </div>\n )\n }\n)\n\nCheckbox.displayName = \"Checkbox\"\n"],"names":["React"],"mappings":";;;;;;AAyCA;;;;;;;;;;;;;AAaG;AACI,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,SAAS,EACT,WAAW,EACX,EAAE,EACF,aAAa,GAAG,KAAK,EACrB,OAAO,EACP,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACS,EACvB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAClC,cAAc,EACd,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAA,gBAAA,CAAkB,EAC3C,OAAO,IAAI,uBAAuB,EAClC,SAAS,CACV;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,UAAU,GAAG,EAAE,IAAI,CAAA,aAAA,EAAgB,QAAQ,EAAE;AAEnD,IAAA,MAAM,cAAc,GAAG,aAAa,GAAG,mBAAmB,GAAGA,cAAK,CAAC,QAAQ;AAE3E,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA;AAC/B,QAAAA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,IAAA;AACb,YAAAA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GACM,SAAS,EAAA,kBAAA,EAEX,WAAW,GAAG,CAAA,EAAG,UAAU,CAAA,YAAA,CAAc,GAAG,SAAS,EAAA,cAAA,EAEzC,OAAO,EACrB,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,UAAU,EAAA,CACf,CACa;AAChB,QAAA,KAAK,IAAIA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,UAAU,EAAA,EAAG,KAAK,CAAS;QACpD,WAAW,KACVA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,EAAE,EAAE,CAAA,EAAG,UAAU,CAAA,YAAA,CAAc,EAC/B,SAAS,EAAC,0BAA0B,EAAA;YAEpCA,cAAA,CAAA,aAAA,CAAC,IAAI,IACH,SAAS,EAAC,uCAAuC,EACjD,MAAM,EAAC,8BAA8B,EAAA,aAAA,EAAA,IAAA,EAAA,CAErC;AACD,YAAA,WAAW,CACV,CACL,CACG;AAEV,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
declare global {
|
|
3
|
+
namespace JSX {
|
|
4
|
+
interface IntrinsicElements {
|
|
5
|
+
"tds-indeterminate": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
|
|
6
|
+
value?: string;
|
|
7
|
+
}, HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=tds-indeterminate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tds-indeterminate.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/tds-indeterminate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAiC9B,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,CAC1C,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE,EACtD,WAAW,CACZ,CAAA;SACF;KACF;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A custom element that sets `indeterminate = true` on its child
|
|
3
|
+
* `<input>` element. This bridges the gap between HTML (which has no
|
|
4
|
+
* `indeterminate` attribute) and the DOM property that CSS
|
|
5
|
+
* `:indeterminate` reads from.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* <tds-indeterminate>
|
|
9
|
+
* <input type="checkbox" />
|
|
10
|
+
* </tds-indeterminate>
|
|
11
|
+
*/
|
|
12
|
+
if (typeof HTMLElement !== "undefined") {
|
|
13
|
+
class TdsIndeterminate extends HTMLElement {
|
|
14
|
+
#input = null;
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.#input = this.querySelector("input");
|
|
17
|
+
if (this.#input)
|
|
18
|
+
this.#input.indeterminate = true;
|
|
19
|
+
}
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
if (this.#input)
|
|
22
|
+
this.#input.indeterminate = false;
|
|
23
|
+
this.#input = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (!customElements.get("tds-indeterminate")) {
|
|
27
|
+
customElements.define("tds-indeterminate", TdsIndeterminate);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=tds-indeterminate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tds-indeterminate.js","sources":["../../../src/components/checkbox/tds-indeterminate.ts"],"sourcesContent":["import type React from \"react\"\n\n/**\n * A custom element that sets `indeterminate = true` on its child\n * `<input>` element. This bridges the gap between HTML (which has no\n * `indeterminate` attribute) and the DOM property that CSS\n * `:indeterminate` reads from.\n *\n * Usage:\n * <tds-indeterminate>\n * <input type=\"checkbox\" />\n * </tds-indeterminate>\n */\nif (typeof HTMLElement !== \"undefined\") {\n class TdsIndeterminate extends HTMLElement {\n #input: HTMLInputElement | null = null\n\n connectedCallback() {\n this.#input = this.querySelector(\"input\")\n if (this.#input) this.#input.indeterminate = true\n }\n\n disconnectedCallback() {\n if (this.#input) this.#input.indeterminate = false\n this.#input = null\n }\n }\n\n if (!customElements.get(\"tds-indeterminate\")) {\n customElements.define(\"tds-indeterminate\", TdsIndeterminate)\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"tds-indeterminate\": React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement> & { value?: string },\n HTMLElement\n >\n }\n }\n}\n"],"names":[],"mappings":"AAEA;;;;;;;;;;AAUG;AACH,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;IACtC,MAAM,gBAAiB,SAAQ,WAAW,CAAA;QACxC,MAAM,GAA4B,IAAI;QAEtC,iBAAiB,GAAA;YACf,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YACzC,IAAI,IAAI,CAAC,MAAM;AAAE,gBAAA,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,IAAI;QACnD;QAEA,oBAAoB,GAAA;YAClB,IAAI,IAAI,CAAC,MAAM;AAAE,gBAAA,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,KAAK;AAClD,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI;QACpB;AACD;IAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE;AAC5C,QAAA,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;IAC9D;AACF"}
|
|
@@ -3,29 +3,29 @@ import React, { type InputHTMLAttributes } from "react";
|
|
|
3
3
|
export type InputSize = "lg" | "md";
|
|
4
4
|
export type InputType = "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
5
5
|
interface InputBaseProps {
|
|
6
|
-
/** If true, the input width grows to fit content
|
|
6
|
+
/** If true, the input width grows to fit content. */
|
|
7
7
|
autoWidth?: boolean;
|
|
8
|
-
/** Helper text below the input.
|
|
8
|
+
/** Helper text displayed below the input. Styled as an error when `invalid`. */
|
|
9
9
|
description?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Whether the input is in an invalid state. */
|
|
11
11
|
invalid?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** If true, all text is selected when the input receives focus. */
|
|
13
13
|
selectTextOnFocus?: boolean;
|
|
14
|
-
/**
|
|
14
|
+
/** The size of the input. */
|
|
15
15
|
size?: InputSize;
|
|
16
16
|
/** Supported input types — defaults to 'text' */
|
|
17
17
|
type?: InputType;
|
|
18
18
|
}
|
|
19
19
|
interface InputWithVisibleLabel extends InputBaseProps {
|
|
20
|
-
/** If true, label is
|
|
20
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
21
21
|
hideLabel?: false;
|
|
22
|
-
/**
|
|
22
|
+
/** The label text for the input. */
|
|
23
23
|
label: React.ReactNode;
|
|
24
24
|
}
|
|
25
25
|
interface InputWithHiddenLabel extends InputBaseProps {
|
|
26
|
-
/** If true, label is
|
|
26
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
27
27
|
hideLabel: true;
|
|
28
|
-
/**
|
|
28
|
+
/** The label text for the input. Must be a string when hidden. */
|
|
29
29
|
label: string;
|
|
30
30
|
}
|
|
31
31
|
interface InputWithAriaLabelledBy extends InputBaseProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAEnE,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAEnC,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,KAAK,CAAA;AAET,UAAU,cAAc;IACtB,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAEnE,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAEnC,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,KAAK,CAAA;AAET,UAAU,cAAc;IACtB,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,UAAU,qBAAsB,SAAQ,cAAc;IACpD,mEAAmE;IACnE,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,oCAAoC;IACpC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,UAAU,oBAAqB,SAAQ,cAAc;IACnD,mEAAmE;IACnE,SAAS,EAAE,IAAI,CAAA;IACf,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,uBAAwB,SAAQ,cAAc;IACtD,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,UAAU,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,qBAAqB,CAAA;AAEzB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CACnC,GACC,UAAU,CAAA;AAEZ,eAAO,MAAM,KAAK,4FA2EjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../src/components/input/Input.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { InputTextBase } from \"@components/input-text-base\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type InputHTMLAttributes } from \"react\"\n\nexport type InputSize = \"lg\" | \"md\"\n\nexport type InputType =\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"url\"\n\ninterface InputBaseProps {\n /** If true, the input width grows to fit content
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../src/components/input/Input.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { InputTextBase } from \"@components/input-text-base\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type InputHTMLAttributes } from \"react\"\n\nexport type InputSize = \"lg\" | \"md\"\n\nexport type InputType =\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"url\"\n\ninterface InputBaseProps {\n /** If true, the input width grows to fit content. */\n autoWidth?: boolean\n /** Helper text displayed below the input. Styled as an error when `invalid`. */\n description?: string\n /** Whether the input is in an invalid state. */\n invalid?: boolean\n /** If true, all text is selected when the input receives focus. */\n selectTextOnFocus?: boolean\n /** The size of the input. */\n size?: InputSize\n /** Supported input types — defaults to 'text' */\n type?: InputType\n}\n\ninterface InputWithVisibleLabel extends InputBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel?: false\n /** The label text for the input. */\n label: React.ReactNode\n}\n\ninterface InputWithHiddenLabel extends InputBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel: true\n /** The label text for the input. Must be a string when hidden. */\n label: string\n}\n\ninterface InputWithAriaLabelledBy extends InputBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type InputProps =\n | InputWithAriaLabelledBy\n | InputWithHiddenLabel\n | InputWithVisibleLabel\n\n/**\n * Combines standard HTML input attributes with custom Input props.\n * Omits 'size' and 'type' from HTML attributes to avoid conflict with our strict types.\n */\nexport type InputElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof InputProps | \"size\" | \"type\"\n> &\n InputProps\n\nexport const Input = forwardRef<HTMLInputElement, InputElementProps>(\n function Input(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n autoComplete,\n autoWidth,\n className,\n description,\n hideLabel,\n id,\n invalid,\n label,\n onFocus,\n selectTextOnFocus,\n size = \"md\",\n type = \"text\",\n ...restProps\n }: InputElementProps,\n ref\n ) {\n const autoCompleteBlockingProps =\n autoComplete === \"off\"\n ? {\n \"data-1p-ignore\": true,\n \"data-bwignore\": true,\n \"data-form-type\": \"other\",\n \"data-lpignore\": true,\n }\n : {}\n\n const handleFocus = selectTextOnFocus\n ? (event: React.FocusEvent<HTMLInputElement>) => {\n try {\n event.currentTarget.select()\n } catch {\n // Some input types (e.g. number) do not support text selection.\n }\n onFocus?.(event)\n }\n : onFocus\n\n const wrapperClassName = classNames(\n { \"tds-input--auto-width\": autoWidth },\n className\n )\n\n return (\n <InputTextBase\n className={wrapperClassName}\n description={description}\n hideLabel={hideLabel || !!ariaLabelledBy}\n id={id}\n invalid={invalid}\n label={label}\n size={size}\n >\n {({ descriptionId, inputId }) => (\n <input\n {...restProps}\n {...autoCompleteBlockingProps}\n aria-describedby={descriptionId}\n aria-invalid={invalid || undefined}\n aria-label={hideLabel ? ariaLabel || (label as string) : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n autoComplete={autoComplete}\n id={inputId}\n onFocus={handleFocus}\n ref={ref}\n type={type}\n />\n )}\n </InputTextBase>\n )\n }\n)\n\nInput.displayName = \"Input\"\n"],"names":["React"],"mappings":";;;;MAmEa,K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SAAS,qBACjD,cAAc,EAC/B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,OAAO,EACX,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EAAA,CACV,CACH,CACa;AAEpB,CAAC;AAGH,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
|
|
@@ -16,14 +16,15 @@ export interface SelectOptionWithNodeLabel {
|
|
|
16
16
|
/** Whether this option is non-interactive. */
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
divider?: never;
|
|
19
|
-
/** Displayed as the option content. */
|
|
19
|
+
/** Displayed as the option content. Accepts React nodes in complex mode. */
|
|
20
20
|
label: React.ReactNode;
|
|
21
|
-
/** Plain-text
|
|
21
|
+
/** Plain-text fallback for type-ahead matching when `label` is a React node. */
|
|
22
22
|
textValue: string;
|
|
23
23
|
value: string;
|
|
24
24
|
}
|
|
25
25
|
export interface SelectOptionDivider {
|
|
26
26
|
disabled?: never;
|
|
27
|
+
/** Renders a visual separator between options. */
|
|
27
28
|
divider: true;
|
|
28
29
|
label?: never;
|
|
29
30
|
textValue?: never;
|
|
@@ -40,37 +41,39 @@ export interface SelectOptionsGroup {
|
|
|
40
41
|
}
|
|
41
42
|
export type SelectItem = SelectOption | SelectOptionsGroup;
|
|
42
43
|
interface SelectBaseProps {
|
|
43
|
-
/**
|
|
44
|
+
/** When true, renders as a popover listbox instead of a native `<select>`. */
|
|
44
45
|
complex?: boolean;
|
|
45
|
-
/** Helper text below the select.
|
|
46
|
+
/** Helper text displayed below the select. Styled as error text when `invalid`. */
|
|
46
47
|
description?: string;
|
|
47
|
-
/**
|
|
48
|
+
/** Whether the select is in an invalid state. */
|
|
48
49
|
invalid?: boolean;
|
|
49
50
|
/** A flat or mixed array of options and option groups. */
|
|
50
51
|
options: SelectItem[];
|
|
51
|
-
/** Placeholder text
|
|
52
|
+
/** Placeholder text shown when no option is selected. */
|
|
52
53
|
placeholder: string;
|
|
53
|
-
/**
|
|
54
|
+
/** The size of the select. */
|
|
54
55
|
size?: SelectSize;
|
|
55
56
|
}
|
|
56
57
|
interface SelectWithVisibleLabel extends SelectBaseProps {
|
|
57
|
-
/** If true, label is visually hidden and
|
|
58
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
58
59
|
hideLabel?: false;
|
|
59
|
-
/**
|
|
60
|
+
/** The label text for the select. */
|
|
60
61
|
label: string;
|
|
61
62
|
}
|
|
62
63
|
interface SelectWithHiddenLabel extends SelectBaseProps {
|
|
63
|
-
/** If true, label is visually hidden and
|
|
64
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
64
65
|
hideLabel: true;
|
|
65
|
-
/**
|
|
66
|
+
/** The label text for the select. Must be a string when hidden. */
|
|
66
67
|
label: string;
|
|
67
68
|
}
|
|
68
69
|
interface SelectWithAriaLabel extends SelectBaseProps {
|
|
70
|
+
/** Accessible label for the select. Use when no visible label exists. */
|
|
69
71
|
"aria-label": string;
|
|
70
72
|
hideLabel?: never;
|
|
71
73
|
label?: never;
|
|
72
74
|
}
|
|
73
75
|
interface SelectWithAriaLabelledBy extends SelectBaseProps {
|
|
76
|
+
/** ID of an external label element. Use instead of `label`. */
|
|
74
77
|
"aria-labelledby": string;
|
|
75
78
|
hideLabel?: never;
|
|
76
79
|
label?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,EAAc,KAAK,oBAAoB,EAAU,MAAM,OAAO,CAAA;AAS5E,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC,MAAM,WAAW,yBAAyB;IACxC,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAC9D,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,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,CAAA;IACpB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,UAAU,wBAAyB,SAAQ,eAAe;IACxD,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,qBAAqB,GACrB,sBAAsB,CAAA;AAE1B,KAAK,sBAAsB,GAAG,IAAI,CAChC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,CACxC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,GAC3D,WAAW,GAAG;IACZ,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB,CAAA;AAEH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAC5D,WAAW,GAAG;IACZ,OAAO,EAAE,IAAI,CAAA;CACd,CAAA;AAEH,MAAM,MAAM,kBAAkB,GAC1B,wBAAwB,GACxB,yBAAyB,CAAA;AAkB7B,eAAO,MAAM,MAAM,8FA4GlB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type SelectHTMLAttributes, useRef } from \"react\"\n\nimport { SelectNative } from \"./SelectNative\"\nimport { SelectPopover } from \"./SelectPopover\"\n\n// ---------------------------------------------------------------------------\n// Shared types\n// ---------------------------------------------------------------------------\n\nexport type SelectSize = \"lg\" | \"md\"\n\nexport interface SelectOptionWithTextLabel {\n [key: `data-${string}`]: boolean | number | string | undefined\n /** Whether this option is non-interactive. */\n disabled?: boolean\n divider?: never\n /** Displayed as the option content and used for type-ahead matching. */\n label: string\n textValue?: never\n value: string\n}\n\nexport interface SelectOptionWithNodeLabel {\n [key: `data-${string}`]: boolean | number | string | undefined\n /** Whether this option is non-interactive. */\n disabled?: boolean\n divider?: never\n /** Displayed as the option content. */\n label: React.ReactNode\n /** Plain-text representation required for type-ahead matching. */\n textValue: string\n value: string\n}\n\nexport interface SelectOptionDivider {\n disabled?: never\n divider: true\n label?: never\n textValue?: never\n value?: never\n}\n\nexport type SelectOption =\n | SelectOptionDivider\n | SelectOptionWithNodeLabel\n | SelectOptionWithTextLabel\n\nexport interface SelectOptionsGroup {\n /** Whether all options in this group are non-interactive. */\n disabled?: boolean\n /** Visible heading displayed above the group's options. */\n label: string\n /** The selectable options within this group. */\n options: SelectOption[]\n}\n\nexport type SelectItem = SelectOption | SelectOptionsGroup\n\n// ---------------------------------------------------------------------------\n// Select component props\n// ---------------------------------------------------------------------------\n\ninterface SelectBaseProps {\n /** Render as popover listbox (SelectPopover) instead of native <select>. */\n complex?: boolean\n /** Helper text below the select. Red when invalid. */\n description?: string\n /** Triggers invalid state (red border, red description). */\n invalid?: boolean\n /** A flat or mixed array of options and option groups. */\n options: SelectItem[]\n /** Placeholder text for the empty state. */\n placeholder: string\n /** Visual size of the select. */\n size?: SelectSize\n}\n\ninterface SelectWithVisibleLabel extends SelectBaseProps {\n /** If true, label is visually hidden and applied as aria-label instead. */\n hideLabel?: false\n /** Label text displayed above the select. */\n label: string\n}\n\ninterface SelectWithHiddenLabel extends SelectBaseProps {\n /** If true, label is visually hidden and applied as aria-label instead. */\n hideLabel: true\n /** Label text used as aria-label when visually hidden. */\n label: string\n}\n\ninterface SelectWithAriaLabel extends SelectBaseProps {\n \"aria-label\": string\n hideLabel?: never\n label?: never\n}\n\ninterface SelectWithAriaLabelledBy extends SelectBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type SelectProps =\n | SelectWithAriaLabel\n | SelectWithAriaLabelledBy\n | SelectWithHiddenLabel\n | SelectWithVisibleLabel\n\ntype BaseSelectElementProps = Omit<\n SelectHTMLAttributes<HTMLSelectElement>,\n keyof SelectProps | \"multiple\" | \"size\"\n>\n\nexport type NativeSelectElementProps = BaseSelectElementProps &\n SelectProps & {\n complex?: false\n }\n\nexport type ComplexSelectElementProps = BaseSelectElementProps &\n SelectProps & {\n complex: true\n }\n\nexport type SelectElementProps =\n | NativeSelectElementProps\n | ComplexSelectElementProps\n\nfunction normalizeSelectValue(\n value:\n | NativeSelectElementProps[\"defaultValue\"]\n | NativeSelectElementProps[\"value\"]\n | ComplexSelectElementProps[\"defaultValue\"]\n | ComplexSelectElementProps[\"value\"]\n) {\n if (value === undefined || value === null) return undefined\n if (Array.isArray(value)) return value[0]\n return String(value)\n}\n\n// ---------------------------------------------------------------------------\n// Select (public)\n// ---------------------------------------------------------------------------\n\nexport const Select = forwardRef<HTMLSelectElement, SelectElementProps>(\n function Select(props: SelectElementProps, ref) {\n const {\n \"aria-label\": userAriaLabel,\n \"aria-labelledby\": userAriaLabelledBy,\n className,\n complex,\n defaultValue,\n description,\n hideLabel,\n id,\n invalid,\n label,\n onChange,\n options,\n placeholder,\n required,\n size,\n value,\n ...restProps\n } = props\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n const stableId = useId()\n const controlId = id || `tds-select-${stableId}`\n const labelId = `${controlId}-label`\n const resolvedDescription =\n description || (invalid ? \"Please select an option\" : undefined)\n const descriptionId = resolvedDescription\n ? `${controlId}-description`\n : undefined\n const computedClassName = classNames(\n \"tds-select\",\n {\n \"tds-select--invalid\": invalid,\n \"tds-select--lg\": size === \"lg\",\n \"tds-select--required\": required,\n },\n className\n )\n\n const normalizedDefaultValue = normalizeSelectValue(defaultValue)\n const normalizedValue = normalizeSelectValue(value)\n\n const computedDefaultValue =\n normalizedDefaultValue === undefined && normalizedValue === undefined\n ? \"\"\n : normalizedDefaultValue\n const showLabel = !!label && !hideLabel\n const computedAriaLabel = userAriaLabel ?? (hideLabel ? label : undefined)\n const computedAriaLabelledBy =\n userAriaLabelledBy ??\n (computedAriaLabel || !showLabel ? undefined : labelId)\n\n const sharedControlProps = {\n ...restProps,\n \"aria-describedby\": descriptionId,\n \"aria-label\": computedAriaLabel,\n \"aria-labelledby\": computedAriaLabelledBy,\n defaultValue: computedDefaultValue,\n invalid,\n options,\n placeholder,\n required,\n value: normalizedValue,\n }\n\n const handleComplexLabelClick = () => triggerRef.current?.focus()\n\n const SelectComponent = complex ? SelectPopover : SelectNative\n\n return (\n <div className={computedClassName}>\n {showLabel &&\n (complex ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- mirrors native label click-to-focus; keyboard users interact with the combobox directly\n <div\n className=\"tds-select-label\"\n id={labelId}\n onClick={handleComplexLabelClick}\n >\n {label}\n </div>\n ) : (\n <label htmlFor={controlId} id={labelId}>\n {label}\n </label>\n ))}\n <SelectComponent\n {...sharedControlProps}\n ref={ref}\n id={controlId}\n onChange={onChange}\n {...(complex && { triggerRef })}\n />\n {resolvedDescription && descriptionId && (\n <p className=\"tds-select-description\" id={descriptionId}>\n <Icon\n aria-hidden\n className=\"tds-select-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {resolvedDescription}\n </p>\n )}\n </div>\n )\n }\n)\n\nSelect.displayName = \"Select\"\n"],"names":["React"],"mappings":";;;;;;;AAqIA,SAAS,oBAAoB,CAC3B,KAIsC,EAAA;AAEtC,IAAA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,SAAS;AAC3D,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,CAAC,CAAC;AACzC,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB;AAEA;AACA;AACA;AAEO,MAAM,MAAM,GAAG,UAAU,CAC9B,SAAS,MAAM,CAAC,KAAyB,EAAE,GAAG,EAAA;AAC5C,IAAA,MAAM,EACJ,YAA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B,CAClB,CACL,CACG;AAEV,CAAC;AAGH,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type SelectHTMLAttributes, useRef } from \"react\"\n\nimport { SelectNative } from \"./SelectNative\"\nimport { SelectPopover } from \"./SelectPopover\"\n\n// ---------------------------------------------------------------------------\n// Shared types\n// ---------------------------------------------------------------------------\n\nexport type SelectSize = \"lg\" | \"md\"\n\nexport interface SelectOptionWithTextLabel {\n [key: `data-${string}`]: boolean | number | string | undefined\n /** Whether this option is non-interactive. */\n disabled?: boolean\n divider?: never\n /** Displayed as the option content and used for type-ahead matching. */\n label: string\n textValue?: never\n value: string\n}\n\nexport interface SelectOptionWithNodeLabel {\n [key: `data-${string}`]: boolean | number | string | undefined\n /** Whether this option is non-interactive. */\n disabled?: boolean\n divider?: never\n /** Displayed as the option content. Accepts React nodes in complex mode. */\n label: React.ReactNode\n /** Plain-text fallback for type-ahead matching when `label` is a React node. */\n textValue: string\n value: string\n}\n\nexport interface SelectOptionDivider {\n disabled?: never\n /** Renders a visual separator between options. */\n divider: true\n label?: never\n textValue?: never\n value?: never\n}\n\nexport type SelectOption =\n | SelectOptionDivider\n | SelectOptionWithNodeLabel\n | SelectOptionWithTextLabel\n\nexport interface SelectOptionsGroup {\n /** Whether all options in this group are non-interactive. */\n disabled?: boolean\n /** Visible heading displayed above the group's options. */\n label: string\n /** The selectable options within this group. */\n options: SelectOption[]\n}\n\nexport type SelectItem = SelectOption | SelectOptionsGroup\n\n// ---------------------------------------------------------------------------\n// Select component props\n// ---------------------------------------------------------------------------\n\ninterface SelectBaseProps {\n /** When true, renders as a popover listbox instead of a native `<select>`. */\n complex?: boolean\n /** Helper text displayed below the select. Styled as error text when `invalid`. */\n description?: string\n /** Whether the select is in an invalid state. */\n invalid?: boolean\n /** A flat or mixed array of options and option groups. */\n options: SelectItem[]\n /** Placeholder text shown when no option is selected. */\n placeholder: string\n /** The size of the select. */\n size?: SelectSize\n}\n\ninterface SelectWithVisibleLabel extends SelectBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel?: false\n /** The label text for the select. */\n label: string\n}\n\ninterface SelectWithHiddenLabel extends SelectBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel: true\n /** The label text for the select. Must be a string when hidden. */\n label: string\n}\n\ninterface SelectWithAriaLabel extends SelectBaseProps {\n /** Accessible label for the select. Use when no visible label exists. */\n \"aria-label\": string\n hideLabel?: never\n label?: never\n}\n\ninterface SelectWithAriaLabelledBy extends SelectBaseProps {\n /** ID of an external label element. Use instead of `label`. */\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type SelectProps =\n | SelectWithAriaLabel\n | SelectWithAriaLabelledBy\n | SelectWithHiddenLabel\n | SelectWithVisibleLabel\n\ntype BaseSelectElementProps = Omit<\n SelectHTMLAttributes<HTMLSelectElement>,\n keyof SelectProps | \"multiple\" | \"size\"\n>\n\nexport type NativeSelectElementProps = BaseSelectElementProps &\n SelectProps & {\n complex?: false\n }\n\nexport type ComplexSelectElementProps = BaseSelectElementProps &\n SelectProps & {\n complex: true\n }\n\nexport type SelectElementProps =\n | NativeSelectElementProps\n | ComplexSelectElementProps\n\nfunction normalizeSelectValue(\n value:\n | NativeSelectElementProps[\"defaultValue\"]\n | NativeSelectElementProps[\"value\"]\n | ComplexSelectElementProps[\"defaultValue\"]\n | ComplexSelectElementProps[\"value\"]\n) {\n if (value === undefined || value === null) return undefined\n if (Array.isArray(value)) return value[0]\n return String(value)\n}\n\n// ---------------------------------------------------------------------------\n// Select (public)\n// ---------------------------------------------------------------------------\n\nexport const Select = forwardRef<HTMLSelectElement, SelectElementProps>(\n function Select(props: SelectElementProps, ref) {\n const {\n \"aria-label\": userAriaLabel,\n \"aria-labelledby\": userAriaLabelledBy,\n className,\n complex,\n defaultValue,\n description,\n hideLabel,\n id,\n invalid,\n label,\n onChange,\n options,\n placeholder,\n required,\n size,\n value,\n ...restProps\n } = props\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n const stableId = useId()\n const controlId = id || `tds-select-${stableId}`\n const labelId = `${controlId}-label`\n const resolvedDescription =\n description || (invalid ? \"Please select an option\" : undefined)\n const descriptionId = resolvedDescription\n ? `${controlId}-description`\n : undefined\n const computedClassName = classNames(\n \"tds-select\",\n {\n \"tds-select--invalid\": invalid,\n \"tds-select--lg\": size === \"lg\",\n \"tds-select--required\": required,\n },\n className\n )\n\n const normalizedDefaultValue = normalizeSelectValue(defaultValue)\n const normalizedValue = normalizeSelectValue(value)\n\n const computedDefaultValue =\n normalizedDefaultValue === undefined && normalizedValue === undefined\n ? \"\"\n : normalizedDefaultValue\n const showLabel = !!label && !hideLabel\n const computedAriaLabel = userAriaLabel ?? (hideLabel ? label : undefined)\n const computedAriaLabelledBy =\n userAriaLabelledBy ??\n (computedAriaLabel || !showLabel ? undefined : labelId)\n\n const sharedControlProps = {\n ...restProps,\n \"aria-describedby\": descriptionId,\n \"aria-label\": computedAriaLabel,\n \"aria-labelledby\": computedAriaLabelledBy,\n defaultValue: computedDefaultValue,\n invalid,\n options,\n placeholder,\n required,\n value: normalizedValue,\n }\n\n const handleComplexLabelClick = () => triggerRef.current?.focus()\n\n const SelectComponent = complex ? SelectPopover : SelectNative\n\n return (\n <div className={computedClassName}>\n {showLabel &&\n (complex ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- mirrors native label click-to-focus; keyboard users interact with the combobox directly\n <div\n className=\"tds-select-label\"\n id={labelId}\n onClick={handleComplexLabelClick}\n >\n {label}\n </div>\n ) : (\n <label htmlFor={controlId} id={labelId}>\n {label}\n </label>\n ))}\n <SelectComponent\n {...sharedControlProps}\n ref={ref}\n id={controlId}\n onChange={onChange}\n {...(complex && { triggerRef })}\n />\n {resolvedDescription && descriptionId && (\n <p className=\"tds-select-description\" id={descriptionId}>\n <Icon\n aria-hidden\n className=\"tds-select-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {resolvedDescription}\n </p>\n )}\n </div>\n )\n }\n)\n\nSelect.displayName = \"Select\"\n"],"names":["React"],"mappings":";;;;;;;AAwIA,SAAS,oBAAoB,CAC3B,KAIsC,EAAA;AAEtC,IAAA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,SAAS;AAC3D,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,CAAC,CAAC;AACzC,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB;AAEA;AACA;AACA;AAEO,MAAM,MAAM,GAAG,UAAU,CAC9B,SAAS,MAAM,CAAC,KAAyB,EAAE,GAAG,EAAA;AAC5C,IAAA,MAAM,EACJ,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,kBAAkB,EACrC,SAAS,EACT,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,EAAE,EACF,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,GAAG,SAAS,EACb,GAAG,KAAK;AAET,IAAA,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC;AAClD,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,SAAS,GAAG,EAAE,IAAI,CAAA,WAAA,EAAc,QAAQ,EAAE;AAChD,IAAA,MAAM,OAAO,GAAG,CAAA,EAAG,SAAS,QAAQ;AACpC,IAAA,MAAM,mBAAmB,GACvB,WAAW,KAAK,OAAO,GAAG,yBAAyB,GAAG,SAAS,CAAC;IAClE,MAAM,aAAa,GAAG;UAClB,CAAA,EAAG,SAAS,CAAA,YAAA;UACZ,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,EAAE,EAAE,OAAO,EACX,OAAO,EAAE,uBAAuB,EAAA,EAE/B,KAAK,CACF,KAENA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAA,EACnC,KAAK,CACA,CACT,CAAC;QACJA,cAAA,CAAA,aAAA,CAAC,eAAe,OACV,kBAAkB,EACtB,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,SAAS,EACb,QAAQ,EAAE,QAAQ,EAAA,IACb,OAAO,IAAI,EAAE,UAAU,EAAE,CAAC,EAAA,CAC/B;QACD,mBAAmB,IAAI,aAAa,KACnCA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,wBAAwB,EAAC,EAAE,EAAE,aAAa,EAAA;YACrDA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,qCAAqC,EAC/C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,mBAAmB,CAClB,CACL,CACG;AAEV,CAAC;AAGH,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
|
|
@@ -3,30 +3,31 @@ import React, { type TextareaHTMLAttributes } from "react";
|
|
|
3
3
|
export type TextAreaResize = "auto" | "none" | "vertical";
|
|
4
4
|
export type TextAreaSize = "lg" | "md";
|
|
5
5
|
interface TextAreaBaseProps {
|
|
6
|
-
/** Helper text displayed below the
|
|
6
|
+
/** Helper text displayed below the textarea. Styled as error text when `invalid`. */
|
|
7
7
|
description?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** Whether the textarea is in an invalid state. */
|
|
9
9
|
invalid?: boolean;
|
|
10
|
-
/** Controls resize behavior.
|
|
10
|
+
/** Controls resize behavior. */
|
|
11
11
|
resize?: TextAreaResize;
|
|
12
|
-
/**
|
|
12
|
+
/** Visible height in lines. */
|
|
13
13
|
rows?: number;
|
|
14
|
-
/**
|
|
14
|
+
/** The size of the textarea. */
|
|
15
15
|
size?: TextAreaSize;
|
|
16
16
|
}
|
|
17
17
|
interface TextAreaWithVisibleLabel extends TextAreaBaseProps {
|
|
18
|
-
/** If true, label is
|
|
18
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
19
19
|
hideLabel?: false;
|
|
20
|
-
/**
|
|
20
|
+
/** The label text for the textarea. */
|
|
21
21
|
label: React.ReactNode;
|
|
22
22
|
}
|
|
23
23
|
interface TextAreaWithHiddenLabel extends TextAreaBaseProps {
|
|
24
|
-
/** If true, label is
|
|
24
|
+
/** If true, the label is visually hidden and set as aria-label. */
|
|
25
25
|
hideLabel: true;
|
|
26
|
-
/**
|
|
26
|
+
/** The label text for the textarea. Must be a string when hidden. */
|
|
27
27
|
label: string;
|
|
28
28
|
}
|
|
29
29
|
interface TextAreaWithAriaLabelledBy extends TextAreaBaseProps {
|
|
30
|
+
/** ID of an external label element. Use instead of `label`. */
|
|
30
31
|
"aria-labelledby": string;
|
|
31
32
|
hideLabel?: never;
|
|
32
33
|
label?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/text-area/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,KAAK,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAEtE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,UAAU,iBAAiB;IACzB,
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/text-area/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,KAAK,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAEtE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,UAAU,iBAAiB;IACzB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gCAAgC;IAChC,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,UAAU,wBAAyB,SAAQ,iBAAiB;IAC1D,mEAAmE;IACnE,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,UAAU,uBAAwB,SAAQ,iBAAiB;IACzD,mEAAmE;IACnE,SAAS,EAAE,IAAI,CAAA;IACf,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,0BAA2B,SAAQ,iBAAiB;IAC5D,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,mBAAmB,GAC3B,0BAA0B,GAC1B,uBAAuB,GACvB,wBAAwB,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,MAAM,mBAAmB,GAAG,MAAM,CACnC,GACC,mBAAmB,CAAA;AAErB,eAAO,MAAM,QAAQ,2FAoDpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { InputTextBase } from \"@components/input-text-base\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type TextareaHTMLAttributes } from \"react\"\n\nexport type TextAreaResize = \"auto\" | \"none\" | \"vertical\"\n\nexport type TextAreaSize = \"lg\" | \"md\"\n\ninterface TextAreaBaseProps {\n /** Helper text displayed below the
|
|
1
|
+
{"version":3,"file":"TextArea.js","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { InputTextBase } from \"@components/input-text-base\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, type TextareaHTMLAttributes } from \"react\"\n\nexport type TextAreaResize = \"auto\" | \"none\" | \"vertical\"\n\nexport type TextAreaSize = \"lg\" | \"md\"\n\ninterface TextAreaBaseProps {\n /** Helper text displayed below the textarea. Styled as error text when `invalid`. */\n description?: string\n /** Whether the textarea is in an invalid state. */\n invalid?: boolean\n /** Controls resize behavior. */\n resize?: TextAreaResize\n /** Visible height in lines. */\n rows?: number\n /** The size of the textarea. */\n size?: TextAreaSize\n}\n\ninterface TextAreaWithVisibleLabel extends TextAreaBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel?: false\n /** The label text for the textarea. */\n label: React.ReactNode\n}\n\ninterface TextAreaWithHiddenLabel extends TextAreaBaseProps {\n /** If true, the label is visually hidden and set as aria-label. */\n hideLabel: true\n /** The label text for the textarea. Must be a string when hidden. */\n label: string\n}\n\ninterface TextAreaWithAriaLabelledBy extends TextAreaBaseProps {\n /** ID of an external label element. Use instead of `label`. */\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type TextAreaCustomProps =\n | TextAreaWithAriaLabelledBy\n | TextAreaWithHiddenLabel\n | TextAreaWithVisibleLabel\n\nexport type TextAreaProps = Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n keyof TextAreaCustomProps | \"rows\"\n> &\n TextAreaCustomProps\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n description,\n hideLabel,\n id,\n invalid,\n label,\n resize = \"vertical\",\n rows = 3,\n size = \"md\",\n ...restProps\n }: TextAreaProps,\n ref\n ) {\n const wrapperClassName = classNames(\n {\n \"tds-textarea--resize-auto\": resize === \"auto\",\n \"tds-textarea--resize-none\": resize === \"none\",\n \"tds-textarea--resize-vertical\": resize === \"vertical\",\n },\n className\n )\n\n return (\n <InputTextBase\n className={wrapperClassName}\n description={description}\n hideLabel={hideLabel || !!ariaLabelledBy}\n id={id}\n invalid={invalid}\n label={label}\n size={size}\n >\n {({ descriptionId, inputId }) => (\n <textarea\n {...restProps}\n aria-describedby={descriptionId}\n aria-invalid={invalid || undefined}\n aria-label={hideLabel ? ariaLabel || (label as string) : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n id={inputId}\n ref={ref}\n rows={rows}\n />\n )}\n </InputTextBase>\n )\n }\n)\n\nTextArea.displayName = \"TextArea\"\n"],"names":["React"],"mappings":";;;;MAuDa,QAAQ,GAAG,UAAU,CAChC,SAAS,QAAQ,CACf,EACE,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,SAAS,EACT,WAAW,EACX,SAAS,EACT,EAAE,EACF,OAAO,EACP,KAAK,EACL,MAAM,GAAG,UAAU,EACnB,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACE,EAChB,GAAG,EAAA;IAEH,MAAM,gBAAgB,GAAG,UAAU,CACjC;QACE,2BAA2B,EAAE,MAAM,KAAK,MAAM;QAC9C,2BAA2B,EAAE,MAAM,KAAK,MAAM;QAC9C,+BAA+B,EAAE,MAAM,KAAK,UAAU;KACvD,EACD,SAAS,CACV;AAED,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,aAAa,IACZ,SAAS,EAAE,gBAAgB,EAC3B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,IAAI,CAAC,CAAC,cAAc,EACxC,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EAAA,EAET,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,MAC1BA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAA,GACM,SAAS,EAAA,kBAAA,EACK,aAAa,kBACjB,OAAO,IAAI,SAAS,EAAA,YAAA,EACtB,SAAS,GAAG,SAAS,IAAK,KAAgB,GAAG,SAAS,qBACjD,cAAc,EAC/B,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,GACV,CACH,CACa;AAEpB,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
|
package/dist/index.css
CHANGED