@planningcenter/tapestry 4.4.1-rc.1 → 4.4.1-rc.2
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/segmented-control/IconSegment.d.ts +23 -0
- package/dist/components/segmented-control/IconSegment.d.ts.map +1 -0
- package/dist/components/segmented-control/IconSegment.js +18 -0
- package/dist/components/segmented-control/IconSegment.js.map +1 -0
- package/dist/components/segmented-control/Segment.d.ts +28 -0
- package/dist/components/segmented-control/Segment.d.ts.map +1 -0
- package/dist/components/segmented-control/Segment.js +22 -0
- package/dist/components/segmented-control/Segment.js.map +1 -0
- package/dist/components/segmented-control/SegmentBase.d.ts +22 -0
- package/dist/components/segmented-control/SegmentBase.d.ts.map +1 -0
- package/dist/components/segmented-control/SegmentBase.js +70 -0
- package/dist/components/segmented-control/SegmentBase.js.map +1 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +64 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts.map +1 -0
- package/dist/components/segmented-control/SegmentedControl.js +52 -0
- package/dist/components/segmented-control/SegmentedControl.js.map +1 -0
- package/dist/components/segmented-control/SegmentedControlContext.d.ts +8 -0
- package/dist/components/segmented-control/SegmentedControlContext.d.ts.map +1 -0
- package/dist/components/segmented-control/SegmentedControlContext.js +6 -0
- package/dist/components/segmented-control/SegmentedControlContext.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +8 -0
- package/dist/components/segmented-control/index.d.ts.map +1 -0
- package/dist/reactRender.css +1061 -937
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +1061 -937
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +124 -0
- package/dist/unstable.css.map +1 -1
- package/dist/unstable.d.ts +1 -0
- package/dist/unstable.d.ts.map +1 -1
- package/dist/unstable.js +3 -0
- package/dist/unstable.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import React, { type ButtonHTMLAttributes } from "react";
|
|
3
|
+
export interface IconSegmentProps {
|
|
4
|
+
/** Accessible label — required since there's no visible text. */
|
|
5
|
+
"aria-label": string;
|
|
6
|
+
/** Disables this item only. */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** The icon to display. */
|
|
9
|
+
icon: React.ReactNode;
|
|
10
|
+
/** Unique identifier for this item. */
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export type IconSegmentElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof IconSegmentProps | "aria-checked" | "children" | "onClick" | "onKeyDown" | "role" | "tabIndex" | "type"> & IconSegmentProps;
|
|
14
|
+
/**
|
|
15
|
+
* An icon-only item within a `SegmentedControl`, mirroring `IconButton`'s
|
|
16
|
+
* shape. Must be rendered as a direct child of `SegmentedControl` — it reads
|
|
17
|
+
* selection state, group `disabled`, and roving tabindex from that context.
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
21
|
+
*/
|
|
22
|
+
export declare const IconSegment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof IconSegmentProps> & IconSegmentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
//# sourceMappingURL=IconSegment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconSegment.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/IconSegment.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,EAAE,KAAK,oBAAoB,EAAc,MAAM,OAAO,CAAA;AAIpE,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAA;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2BAA2B;IAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,oBAAoB,CAAC,iBAAiB,CAAC,EACrC,MAAM,gBAAgB,GACtB,cAAc,GACd,UAAU,GACV,SAAS,GACT,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,CACT,GACC,gBAAgB,CAAA;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,iQAKtB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React__default, { forwardRef } from 'react';
|
|
2
|
+
import { SegmentBase } from './SegmentBase.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An icon-only item within a `SegmentedControl`, mirroring `IconButton`'s
|
|
6
|
+
* shape. Must be rendered as a direct child of `SegmentedControl` — it reads
|
|
7
|
+
* selection state, group `disabled`, and roving tabindex from that context.
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
11
|
+
*/
|
|
12
|
+
const IconSegment = forwardRef(function IconSegment({ icon, ...restProps }, ref) {
|
|
13
|
+
return React__default.createElement(SegmentBase, { ...restProps, content: icon, iconOnly: true, ref: ref });
|
|
14
|
+
});
|
|
15
|
+
IconSegment.displayName = "IconSegment";
|
|
16
|
+
|
|
17
|
+
export { IconSegment };
|
|
18
|
+
//# sourceMappingURL=IconSegment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconSegment.js","sources":["../../../src/components/segmented-control/IconSegment.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport React, { type ButtonHTMLAttributes, forwardRef } from \"react\"\n\nimport { SegmentBase } from \"./SegmentBase\"\n\nexport interface IconSegmentProps {\n /** Accessible label — required since there's no visible text. */\n \"aria-label\": string\n /** Disables this item only. */\n disabled?: boolean\n /** The icon to display. */\n icon: React.ReactNode\n /** Unique identifier for this item. */\n value: string\n}\n\nexport type IconSegmentElementProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n | keyof IconSegmentProps\n | \"aria-checked\"\n | \"children\"\n | \"onClick\"\n | \"onKeyDown\"\n | \"role\"\n | \"tabIndex\"\n | \"type\"\n> &\n IconSegmentProps\n\n/**\n * An icon-only item within a `SegmentedControl`, mirroring `IconButton`'s\n * shape. Must be rendered as a direct child of `SegmentedControl` — it reads\n * selection state, group `disabled`, and roving tabindex from that context.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}\n */\nexport const IconSegment = forwardRef<\n HTMLButtonElement,\n IconSegmentElementProps\n>(function IconSegment({ icon, ...restProps }: IconSegmentElementProps, ref) {\n return <SegmentBase {...restProps} content={icon} iconOnly ref={ref} />\n})\n\nIconSegment.displayName = \"IconSegment\"\n"],"names":["React"],"mappings":";;;AA8BA;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,UAAU,CAGnC,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,EAA2B,EAAE,GAAG,EAAA;AACzE,IAAA,OAAOA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAA,GAAK,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAA,IAAA,EAAC,GAAG,EAAE,GAAG,GAAI;AACzE,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import React, { type ButtonHTMLAttributes } from "react";
|
|
3
|
+
export interface SegmentProps {
|
|
4
|
+
/** Disables this item only. */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** Visible text. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Optional leading icon. */
|
|
9
|
+
prefix?: React.ReactNode;
|
|
10
|
+
/** Optional trailing icon. */
|
|
11
|
+
suffix?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier for this item — distinct from `label`, so relabeling
|
|
14
|
+
* doesn't change the selected identity.
|
|
15
|
+
*/
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
export type SegmentElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof SegmentProps | "aria-checked" | "children" | "onClick" | "onKeyDown" | "role" | "tabIndex" | "type"> & SegmentProps;
|
|
19
|
+
/**
|
|
20
|
+
* A single item within a `SegmentedControl`. Must be rendered as a direct
|
|
21
|
+
* child of `SegmentedControl` — it reads selection state, group `disabled`,
|
|
22
|
+
* and roving tabindex from that context.
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
26
|
+
*/
|
|
27
|
+
export declare const Segment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof SegmentProps> & SegmentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
//# sourceMappingURL=Segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Segment.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/Segment.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,EAAE,KAAK,oBAAoB,EAAc,MAAM,OAAO,CAAA;AAIpE,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,oBAAoB,CAAC,iBAAiB,CAAC,EACrC,MAAM,YAAY,GAClB,cAAc,GACd,UAAU,GACV,SAAS,GACT,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,CACT,GACC,YAAY,CAAA;AAEd;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,yPAmBnB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { wrapStringWithSpan } from '../../utilities/buttonLinkShared.js';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import { SegmentBase } from './SegmentBase.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A single item within a `SegmentedControl`. Must be rendered as a direct
|
|
7
|
+
* child of `SegmentedControl` — it reads selection state, group `disabled`,
|
|
8
|
+
* and roving tabindex from that context.
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
12
|
+
*/
|
|
13
|
+
const Segment = forwardRef(function Segment({ label, prefix, suffix, ...restProps }, ref) {
|
|
14
|
+
return (React__default.createElement(SegmentBase, { ...restProps, content: React__default.createElement(React__default.Fragment, null,
|
|
15
|
+
wrapStringWithSpan(prefix),
|
|
16
|
+
label,
|
|
17
|
+
wrapStringWithSpan(suffix)), ref: ref }));
|
|
18
|
+
});
|
|
19
|
+
Segment.displayName = "Segment";
|
|
20
|
+
|
|
21
|
+
export { Segment };
|
|
22
|
+
//# sourceMappingURL=Segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Segment.js","sources":["../../../src/components/segmented-control/Segment.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { wrapStringWithSpan } from \"@utilities/buttonLinkShared\"\nimport React, { type ButtonHTMLAttributes, forwardRef } from \"react\"\n\nimport { SegmentBase } from \"./SegmentBase\"\n\nexport interface SegmentProps {\n /** Disables this item only. */\n disabled?: boolean\n /** Visible text. */\n label: string\n /** Optional leading icon. */\n prefix?: React.ReactNode\n /** Optional trailing icon. */\n suffix?: React.ReactNode\n /**\n * Unique identifier for this item — distinct from `label`, so relabeling\n * doesn't change the selected identity.\n */\n value: string\n}\n\nexport type SegmentElementProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n | keyof SegmentProps\n | \"aria-checked\"\n | \"children\"\n | \"onClick\"\n | \"onKeyDown\"\n | \"role\"\n | \"tabIndex\"\n | \"type\"\n> &\n SegmentProps\n\n/**\n * A single item within a `SegmentedControl`. Must be rendered as a direct\n * child of `SegmentedControl` — it reads selection state, group `disabled`,\n * and roving tabindex from that context.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}\n */\nexport const Segment = forwardRef<HTMLButtonElement, SegmentElementProps>(\n function Segment(\n { label, prefix, suffix, ...restProps }: SegmentElementProps,\n ref\n ) {\n return (\n <SegmentBase\n {...restProps}\n content={\n <>\n {wrapStringWithSpan(prefix)}\n {label}\n {wrapStringWithSpan(suffix)}\n </>\n }\n ref={ref}\n />\n )\n }\n)\n\nSegment.displayName = \"Segment\"\n"],"names":["React"],"mappings":";;;;AAoCA;;;;;;;AAOG;MACU,OAAO,GAAG,UAAU,CAC/B,SAAS,OAAO,CACd,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAuB,EAC5D,GAAG,EAAA;AAEH,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,WAAW,OACN,SAAS,EACb,OAAO,EACLA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;YACG,kBAAkB,CAAC,MAAM,CAAC;YAC1B,KAAK;YACL,kBAAkB,CAAC,MAAM,CAAC,CAC1B,EAEL,GAAG,EAAE,GAAG,EAAA,CACR;AAEN,CAAC;AAGH,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
export type SegmentKind = "interaction-subtle";
|
|
3
|
+
export interface SegmentBaseProps {
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
iconOnly?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Not yet exposed on `Segment`/`IconSegment` —
|
|
9
|
+
* V1 only has one value ("interaction-subtle").
|
|
10
|
+
*/
|
|
11
|
+
kind?: SegmentKind;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export type SegmentBaseElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof SegmentBaseProps | "aria-checked" | "children" | "onClick" | "onKeyDown" | "role" | "tabIndex" | "type"> & SegmentBaseProps;
|
|
15
|
+
/**
|
|
16
|
+
* Shared `role="radio"` button implementation for `Segment` and
|
|
17
|
+
* `IconSegment` — selection state, roving tabindex, arrow-key navigation,
|
|
18
|
+
* and disabled propagation all live here so the two public components only
|
|
19
|
+
* differ in what they render inside the button.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SegmentBase: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof SegmentBaseProps> & SegmentBaseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
//# sourceMappingURL=SegmentBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentBase.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/SegmentBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,KAAK,oBAAoB,EAA0B,MAAM,OAAO,CAAA;AAIhF,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAW9C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,oBAAoB,CAAC,iBAAiB,CAAC,EACrC,MAAM,gBAAgB,GACtB,cAAc,GACd,UAAU,GACV,SAAS,GACT,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,CACT,GACC,gBAAgB,CAAA;AAElB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,iQAuFtB,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React__default, { forwardRef, useContext } from 'react';
|
|
3
|
+
import { SegmentedControlContext } from './SegmentedControlContext.js';
|
|
4
|
+
|
|
5
|
+
const ARROW_KEYS = [
|
|
6
|
+
"ArrowLeft",
|
|
7
|
+
"ArrowRight",
|
|
8
|
+
"ArrowUp",
|
|
9
|
+
"ArrowDown",
|
|
10
|
+
"Home",
|
|
11
|
+
"End",
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Shared `role="radio"` button implementation for `Segment` and
|
|
15
|
+
* `IconSegment` — selection state, roving tabindex, arrow-key navigation,
|
|
16
|
+
* and disabled propagation all live here so the two public components only
|
|
17
|
+
* differ in what they render inside the button.
|
|
18
|
+
*/
|
|
19
|
+
const SegmentBase = forwardRef(function SegmentBase({ className, content, disabled = false, iconOnly = false, kind = "interaction-subtle", value, ...restProps }, ref) {
|
|
20
|
+
const context = useContext(SegmentedControlContext);
|
|
21
|
+
const isDisabled = disabled || (context?.disabled ?? false);
|
|
22
|
+
const isChecked = context?.value === value;
|
|
23
|
+
const combinedClassName = classNames("tds-segmented-control-segment", iconOnly && "tds-segmented-control-segment--icon-only", `tds-segmented-control-segment--${kind}`, className);
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
if (isDisabled)
|
|
26
|
+
return;
|
|
27
|
+
context?.onSelect(value);
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = (event) => {
|
|
30
|
+
if (!ARROW_KEYS.includes(event.key))
|
|
31
|
+
return;
|
|
32
|
+
const track = event.currentTarget.closest('[role="radiogroup"]');
|
|
33
|
+
if (!track)
|
|
34
|
+
return;
|
|
35
|
+
const segments = Array.from(track.querySelectorAll('[role="radio"]:not(:disabled)'));
|
|
36
|
+
const currentIndex = segments.indexOf(event.currentTarget);
|
|
37
|
+
if (currentIndex === -1)
|
|
38
|
+
return;
|
|
39
|
+
let nextIndex = currentIndex;
|
|
40
|
+
switch (event.key) {
|
|
41
|
+
case "ArrowLeft":
|
|
42
|
+
case "ArrowUp":
|
|
43
|
+
nextIndex = currentIndex === 0 ? segments.length - 1 : currentIndex - 1;
|
|
44
|
+
break;
|
|
45
|
+
case "ArrowRight":
|
|
46
|
+
case "ArrowDown":
|
|
47
|
+
nextIndex = currentIndex === segments.length - 1 ? 0 : currentIndex + 1;
|
|
48
|
+
break;
|
|
49
|
+
case "Home":
|
|
50
|
+
nextIndex = 0;
|
|
51
|
+
break;
|
|
52
|
+
case "End":
|
|
53
|
+
nextIndex = segments.length - 1;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
const nextSegment = segments[nextIndex];
|
|
57
|
+
if (!nextSegment || nextSegment === event.currentTarget)
|
|
58
|
+
return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
nextSegment.focus();
|
|
61
|
+
const nextValue = nextSegment.dataset.segmentValue;
|
|
62
|
+
if (nextValue)
|
|
63
|
+
context?.onSelect(nextValue);
|
|
64
|
+
};
|
|
65
|
+
return (React__default.createElement("button", { ...restProps, "aria-checked": isChecked ? "true" : "false", className: combinedClassName, "data-segment-value": value, disabled: isDisabled, onClick: handleClick, onKeyDown: handleKeyDown, ref: ref, role: "radio", tabIndex: value === context?.tabbableValue ? 0 : -1, type: "button" }, content));
|
|
66
|
+
});
|
|
67
|
+
SegmentBase.displayName = "SegmentBase";
|
|
68
|
+
|
|
69
|
+
export { SegmentBase };
|
|
70
|
+
//# sourceMappingURL=SegmentBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentBase.js","sources":["../../../src/components/segmented-control/SegmentBase.tsx"],"sourcesContent":["import classNames from \"classnames\"\nimport React, { type ButtonHTMLAttributes, forwardRef, useContext } from \"react\"\n\nimport { SegmentedControlContext } from \"./SegmentedControlContext\"\n\nexport type SegmentKind = \"interaction-subtle\"\n\nconst ARROW_KEYS = [\n \"ArrowLeft\",\n \"ArrowRight\",\n \"ArrowUp\",\n \"ArrowDown\",\n \"Home\",\n \"End\",\n]\n\nexport interface SegmentBaseProps {\n content: React.ReactNode\n disabled?: boolean\n iconOnly?: boolean\n /**\n * Not yet exposed on `Segment`/`IconSegment` —\n * V1 only has one value (\"interaction-subtle\").\n */\n kind?: SegmentKind\n value: string\n}\n\nexport type SegmentBaseElementProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n | keyof SegmentBaseProps\n | \"aria-checked\"\n | \"children\"\n | \"onClick\"\n | \"onKeyDown\"\n | \"role\"\n | \"tabIndex\"\n | \"type\"\n> &\n SegmentBaseProps\n\n/**\n * Shared `role=\"radio\"` button implementation for `Segment` and\n * `IconSegment` — selection state, roving tabindex, arrow-key navigation,\n * and disabled propagation all live here so the two public components only\n * differ in what they render inside the button.\n */\nexport const SegmentBase = forwardRef<\n HTMLButtonElement,\n SegmentBaseElementProps\n>(function SegmentBase(\n {\n className,\n content,\n disabled = false,\n iconOnly = false,\n kind = \"interaction-subtle\",\n value,\n ...restProps\n }: SegmentBaseElementProps,\n ref\n) {\n const context = useContext(SegmentedControlContext)\n const isDisabled = disabled || (context?.disabled ?? false)\n const isChecked = context?.value === value\n\n const combinedClassName = classNames(\n \"tds-segmented-control-segment\",\n iconOnly && \"tds-segmented-control-segment--icon-only\",\n `tds-segmented-control-segment--${kind}`,\n className\n )\n\n const handleClick = () => {\n if (isDisabled) return\n context?.onSelect(value)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (!ARROW_KEYS.includes(event.key)) return\n\n const track = event.currentTarget.closest('[role=\"radiogroup\"]')\n if (!track) return\n\n const segments = Array.from(\n track.querySelectorAll<HTMLButtonElement>('[role=\"radio\"]:not(:disabled)')\n )\n const currentIndex = segments.indexOf(event.currentTarget)\n if (currentIndex === -1) return\n\n let nextIndex = currentIndex\n switch (event.key) {\n case \"ArrowLeft\":\n case \"ArrowUp\":\n nextIndex = currentIndex === 0 ? segments.length - 1 : currentIndex - 1\n break\n case \"ArrowRight\":\n case \"ArrowDown\":\n nextIndex = currentIndex === segments.length - 1 ? 0 : currentIndex + 1\n break\n case \"Home\":\n nextIndex = 0\n break\n case \"End\":\n nextIndex = segments.length - 1\n break\n }\n\n const nextSegment = segments[nextIndex]\n if (!nextSegment || nextSegment === event.currentTarget) return\n\n event.preventDefault()\n nextSegment.focus()\n const nextValue = nextSegment.dataset.segmentValue\n if (nextValue) context?.onSelect(nextValue)\n }\n\n return (\n <button\n {...restProps}\n aria-checked={isChecked ? \"true\" : \"false\"}\n className={combinedClassName}\n data-segment-value={value}\n disabled={isDisabled}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n ref={ref}\n role=\"radio\"\n tabIndex={value === context?.tabbableValue ? 0 : -1}\n type=\"button\"\n >\n {content}\n </button>\n )\n})\n\nSegmentBase.displayName = \"SegmentBase\"\n"],"names":["React"],"mappings":";;;;AAOA,MAAM,UAAU,GAAG;IACjB,WAAW;IACX,YAAY;IACZ,SAAS;IACT,WAAW;IACX,MAAM;IACN,KAAK;CACN;AA2BD;;;;;AAKG;AACI,MAAM,WAAW,GAAG,UAAU,CAGnC,SA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React, { type HTMLAttributes } from "react";
|
|
3
|
+
export type SegmentedControlSize = "md" | "sm";
|
|
4
|
+
interface SegmentedControlSharedProps {
|
|
5
|
+
/** `Segment`/`IconSegment` elements. */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Disables the whole group. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If `true`, the group spans 100% of its container and items split the
|
|
11
|
+
* width evenly. Intended for a primary mode switch at the top of a
|
|
12
|
+
* section/modal/pane — not for a control nested deep in a form.
|
|
13
|
+
*/
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If `true`, renders `label` visually hidden instead of a visible
|
|
17
|
+
* element.
|
|
18
|
+
*/
|
|
19
|
+
hideLabel?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible label for the group. Rendered as a visible element by
|
|
22
|
+
* default.
|
|
23
|
+
*/
|
|
24
|
+
label: string;
|
|
25
|
+
/** Called with the newly selected item's `value`. */
|
|
26
|
+
onChange?: (value: string) => void;
|
|
27
|
+
/** Default `'md'`. */
|
|
28
|
+
size?: SegmentedControlSize;
|
|
29
|
+
}
|
|
30
|
+
interface SegmentedControlControlledProps extends SegmentedControlSharedProps {
|
|
31
|
+
defaultValue?: never;
|
|
32
|
+
/** Controlled selected item's `value`. */
|
|
33
|
+
value: string;
|
|
34
|
+
}
|
|
35
|
+
interface SegmentedControlUncontrolledProps extends SegmentedControlSharedProps {
|
|
36
|
+
/**
|
|
37
|
+
* Uncontrolled initial selected item's `value` — a segmented control
|
|
38
|
+
* always reflects a current mode, so one item must start selected.
|
|
39
|
+
*/
|
|
40
|
+
defaultValue: string;
|
|
41
|
+
value?: never;
|
|
42
|
+
}
|
|
43
|
+
export type SegmentedControlProps = SegmentedControlControlledProps | SegmentedControlUncontrolledProps;
|
|
44
|
+
export type SegmentedControlElementProps = Omit<HTMLAttributes<HTMLDivElement>, keyof SegmentedControlProps | "children" | "role"> & SegmentedControlProps;
|
|
45
|
+
/**
|
|
46
|
+
* A single-select group of items — Table/Card, Yes/No, Tag/Tag group —
|
|
47
|
+
* where exactly one `Segment`/`IconSegment` is selected at a time. Hand-rolls
|
|
48
|
+
* the W3C APG `radiogroup` pattern: `role="radiogroup"` container,
|
|
49
|
+
* `role="radio"` + `aria-checked` items, one roving tab stop, arrow keys move
|
|
50
|
+
* both focus and selection.
|
|
51
|
+
*
|
|
52
|
+
* Not a binary on/off choice (`ToggleSwitch` is the right component there),
|
|
53
|
+
* and not a form control — `SegmentedControl`'s state is read from and
|
|
54
|
+
* written to independently of any surrounding form.
|
|
55
|
+
*
|
|
56
|
+
* @component
|
|
57
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
58
|
+
*/
|
|
59
|
+
export declare const SegmentedControl: {
|
|
60
|
+
({ children, className, defaultValue, disabled, fullWidth, hideLabel, id, label, onChange, size, value, ...restProps }: SegmentedControlElementProps): React.JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAA;AAI5D,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9C,UAAU,2BAA2B;IACnC,wCAAwC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,sBAAsB;IACtB,IAAI,CAAC,EAAE,oBAAoB,CAAA;CAC5B;AAED,UAAU,+BAAgC,SAAQ,2BAA2B;IAC3E,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,iCACR,SAAQ,2BAA2B;IACnC;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,qBAAqB,GAC7B,+BAA+B,GAC/B,iCAAiC,CAAA;AAErC,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,cAAc,CAAC,cAAc,CAAC,EAC9B,MAAM,qBAAqB,GAAG,UAAU,GAAG,MAAM,CAClD,GACC,qBAAqB,CAAA;AAEvB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;4HAa1B,4BAA4B;;CAqD9B,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useId } from '../../utilities/useId.js';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import React__default, { useState } from 'react';
|
|
4
|
+
import { SegmentedControlContext } from './SegmentedControlContext.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A single-select group of items — Table/Card, Yes/No, Tag/Tag group —
|
|
8
|
+
* where exactly one `Segment`/`IconSegment` is selected at a time. Hand-rolls
|
|
9
|
+
* the W3C APG `radiogroup` pattern: `role="radiogroup"` container,
|
|
10
|
+
* `role="radio"` + `aria-checked` items, one roving tab stop, arrow keys move
|
|
11
|
+
* both focus and selection.
|
|
12
|
+
*
|
|
13
|
+
* Not a binary on/off choice (`ToggleSwitch` is the right component there),
|
|
14
|
+
* and not a form control — `SegmentedControl`'s state is read from and
|
|
15
|
+
* written to independently of any surrounding form.
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}
|
|
19
|
+
*/
|
|
20
|
+
const SegmentedControl = ({ children, className, defaultValue, disabled = false, fullWidth = false, hideLabel = false, id, label, onChange, size = "md", value, ...restProps }) => {
|
|
21
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
22
|
+
const isControlled = value !== undefined;
|
|
23
|
+
const selectedValue = isControlled ? value : uncontrolledValue;
|
|
24
|
+
const onSelect = (nextValue) => {
|
|
25
|
+
if (nextValue === selectedValue)
|
|
26
|
+
return;
|
|
27
|
+
if (!isControlled)
|
|
28
|
+
setUncontrolledValue(nextValue);
|
|
29
|
+
onChange?.(nextValue);
|
|
30
|
+
};
|
|
31
|
+
const contextValue = {
|
|
32
|
+
disabled,
|
|
33
|
+
onSelect,
|
|
34
|
+
tabbableValue: selectedValue,
|
|
35
|
+
value: selectedValue,
|
|
36
|
+
};
|
|
37
|
+
const stableId = useId();
|
|
38
|
+
const componentId = id || `tds-segmented-control-${stableId}`;
|
|
39
|
+
const labelId = `${componentId}-label`;
|
|
40
|
+
const combinedClassName = classNames("tds-segmented-control", {
|
|
41
|
+
"tds-segmented-control--full-width": fullWidth,
|
|
42
|
+
"tds-segmented-control--sm": size === "sm",
|
|
43
|
+
}, className);
|
|
44
|
+
return (React__default.createElement("div", { ...restProps, className: combinedClassName, id: componentId },
|
|
45
|
+
React__default.createElement("div", { className: classNames("tds-segmented-control-label", hideLabel && "tds-segmented-control-label--hidden"), id: labelId }, label),
|
|
46
|
+
React__default.createElement("div", { "aria-labelledby": labelId, className: "tds-segmented-control-track", role: "radiogroup" },
|
|
47
|
+
React__default.createElement(SegmentedControlContext.Provider, { value: contextValue }, children))));
|
|
48
|
+
};
|
|
49
|
+
SegmentedControl.displayName = "SegmentedControl";
|
|
50
|
+
|
|
51
|
+
export { SegmentedControl };
|
|
52
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { type HTMLAttributes, useState } from \"react\"\n\nimport { SegmentedControlContext } from \"./SegmentedControlContext\"\n\nexport type SegmentedControlSize = \"md\" | \"sm\"\n\ninterface SegmentedControlSharedProps {\n /** `Segment`/`IconSegment` elements. */\n children: React.ReactNode\n /** Disables the whole group. */\n disabled?: boolean\n /**\n * If `true`, the group spans 100% of its container and items split the\n * width evenly. Intended for a primary mode switch at the top of a\n * section/modal/pane — not for a control nested deep in a form.\n */\n fullWidth?: boolean\n /**\n * If `true`, renders `label` visually hidden instead of a visible\n * element.\n */\n hideLabel?: boolean\n /**\n * Accessible label for the group. Rendered as a visible element by\n * default.\n */\n label: string\n /** Called with the newly selected item's `value`. */\n onChange?: (value: string) => void\n /** Default `'md'`. */\n size?: SegmentedControlSize\n}\n\ninterface SegmentedControlControlledProps extends SegmentedControlSharedProps {\n defaultValue?: never\n /** Controlled selected item's `value`. */\n value: string\n}\n\ninterface SegmentedControlUncontrolledProps\n extends SegmentedControlSharedProps {\n /**\n * Uncontrolled initial selected item's `value` — a segmented control\n * always reflects a current mode, so one item must start selected.\n */\n defaultValue: string\n value?: never\n}\n\nexport type SegmentedControlProps =\n | SegmentedControlControlledProps\n | SegmentedControlUncontrolledProps\n\nexport type SegmentedControlElementProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n keyof SegmentedControlProps | \"children\" | \"role\"\n> &\n SegmentedControlProps\n\n/**\n * A single-select group of items — Table/Card, Yes/No, Tag/Tag group —\n * where exactly one `Segment`/`IconSegment` is selected at a time. Hand-rolls\n * the W3C APG `radiogroup` pattern: `role=\"radiogroup\"` container,\n * `role=\"radio\"` + `aria-checked` items, one roving tab stop, arrow keys move\n * both focus and selection.\n *\n * Not a binary on/off choice (`ToggleSwitch` is the right component there),\n * and not a form control — `SegmentedControl`'s state is read from and\n * written to independently of any surrounding form.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/unstable-segmentedcontrol--docs | Storybook Documentation}\n */\nexport const SegmentedControl = ({\n children,\n className,\n defaultValue,\n disabled = false,\n fullWidth = false,\n hideLabel = false,\n id,\n label,\n onChange,\n size = \"md\",\n value,\n ...restProps\n}: SegmentedControlElementProps) => {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue)\n const isControlled = value !== undefined\n const selectedValue = isControlled ? value : uncontrolledValue\n\n const onSelect = (nextValue: string) => {\n if (nextValue === selectedValue) return\n if (!isControlled) setUncontrolledValue(nextValue)\n onChange?.(nextValue)\n }\n\n const contextValue = {\n disabled,\n onSelect,\n tabbableValue: selectedValue,\n value: selectedValue,\n }\n\n const stableId = useId()\n const componentId = id || `tds-segmented-control-${stableId}`\n const labelId = `${componentId}-label`\n\n const combinedClassName = classNames(\n \"tds-segmented-control\",\n {\n \"tds-segmented-control--full-width\": fullWidth,\n \"tds-segmented-control--sm\": size === \"sm\",\n },\n className\n )\n\n return (\n <div {...restProps} className={combinedClassName} id={componentId}>\n <div\n className={classNames(\n \"tds-segmented-control-label\",\n hideLabel && \"tds-segmented-control-label--hidden\"\n )}\n id={labelId}\n >\n {label}\n </div>\n <div\n aria-labelledby={labelId}\n className=\"tds-segmented-control-track\"\n role=\"radiogroup\"\n >\n <SegmentedControlContext.Provider value={contextValue}>\n {children}\n </SegmentedControlContext.Provider>\n </div>\n </div>\n )\n}\n\nSegmentedControl.displayName = \"SegmentedControl\"\n"],"names":["React"],"mappings":";;;;;AA+DA;;;;;;;;;;;;;AAaG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,SAAS,GA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;QACNA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,iBAAA,EACmB,OAAO,EACxB,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAC,YAAY,EAAA;AAEjB,YAAAA,cAAA,CAAA,aAAA,CAAC,uBAAuB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,EAClD,QAAQ,CACwB,CAC/B,CACF;AAEV;AAEA,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SegmentedControlContextValue {
|
|
2
|
+
disabled: boolean;
|
|
3
|
+
onSelect: (value: string) => void;
|
|
4
|
+
tabbableValue: string | undefined;
|
|
5
|
+
value: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare const SegmentedControlContext: import("react").Context<SegmentedControlContextValue | null>;
|
|
8
|
+
//# sourceMappingURL=SegmentedControlContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControlContext.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/SegmentedControlContext.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B;AAED,eAAO,MAAM,uBAAuB,8DACsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControlContext.js","sources":["../../../src/components/segmented-control/SegmentedControlContext.tsx"],"sourcesContent":["import { createContext } from \"react\"\n\nexport interface SegmentedControlContextValue {\n disabled: boolean\n onSelect: (value: string) => void\n tabbableValue: string | undefined\n value: string | undefined\n}\n\nexport const SegmentedControlContext =\n createContext<SegmentedControlContextValue | null>(null)\n"],"names":[],"mappings":";;MASa,uBAAuB,GAClC,aAAa,CAAsC,IAAI;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
export type { IconSegmentElementProps, IconSegmentProps } from "./IconSegment";
|
|
3
|
+
export { IconSegment } from "./IconSegment";
|
|
4
|
+
export type { SegmentElementProps, SegmentProps } from "./Segment";
|
|
5
|
+
export { Segment } from "./Segment";
|
|
6
|
+
export type { SegmentedControlElementProps, SegmentedControlProps, SegmentedControlSize, } from "./SegmentedControl";
|
|
7
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,YAAY,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EACV,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|