@planningcenter/tapestry 3.2.1-rc.6 → 3.2.1-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ import "./index.css";
2
+ import type { CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date";
3
+ import React, { type AriaAttributes } from "react";
4
+ export type TimeFieldSize = "md" | "lg";
5
+ export type TimeFieldValue = CalendarDateTime | Time | ZonedDateTime;
6
+ export interface TimeFieldProps {
7
+ /** The default uncontrolled value (e.g. `new Time(9, 30)` or `new CalendarDateTime(2025, 1, 1, 9, 30)`). */
8
+ defaultValue?: TimeFieldValue | null;
9
+ /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */
10
+ description?: string;
11
+ /** Disables the field. */
12
+ disabled?: boolean;
13
+ /** If `true`, always shows leading zeros in the hour field. */
14
+ forceLeadingZeros?: boolean;
15
+ /** If `true`, renders the label visually hidden. */
16
+ hideLabel?: boolean;
17
+ /** If `true`, hides the time zone abbreviation for ZonedDateTime values. */
18
+ hideTimeZone?: boolean;
19
+ /** Whether to display in 12 or 24 hour format. By default, determined by locale. */
20
+ hourCycle?: 12 | 24;
21
+ /** If `true`, applies error styling to the field and description. */
22
+ invalid?: boolean;
23
+ /** Accessible label for the field. */
24
+ label: string;
25
+ /** The maximum allowed time (e.g. `new Time(17, 0)`). */
26
+ max?: TimeFieldValue;
27
+ /** The minimum allowed time (e.g. `new Time(9, 0)`). */
28
+ min?: TimeFieldValue;
29
+ /** Field name for form submission. */
30
+ name?: string;
31
+ /** Called when the value changes. */
32
+ onChange?: (value: TimeFieldValue | null) => void;
33
+ /** Allows the value to be read but not changed. */
34
+ readOnly?: boolean;
35
+ /** If `true`, appends an asterisk after the label text. */
36
+ required?: boolean;
37
+ /** The size of the time field. */
38
+ size?: TimeFieldSize;
39
+ /** The controlled value (e.g. `new Time(9, 30)` or `new CalendarDateTime(2025, 1, 1, 9, 30)`). */
40
+ value?: TimeFieldValue | null;
41
+ }
42
+ export type TimeFieldElementProps = TimeFieldProps & Omit<AriaAttributes, keyof TimeFieldProps> & {
43
+ className?: string;
44
+ id?: string;
45
+ };
46
+ export declare function TimeField({ className, defaultValue, description, disabled, forceLeadingZeros, hideLabel, hideTimeZone, hourCycle, invalid, label, max, min, name, onChange, readOnly, required, size, value, ...restProps }: TimeFieldElementProps): React.JSX.Element;
47
+ //# sourceMappingURL=TimeField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../../../src/components/time-field/TimeField.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,aAAa,EACd,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AASlD,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvC,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,IAAI,GAAG,aAAa,CAAA;AAEpE,MAAM,WAAW,cAAc;IAC7B,4GAA4G;IAC5G,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACpC,gGAAgG;IAChG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,oFAAoF;IACpF,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,CAAA;IACnB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,wDAAwD;IACxD,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAA;IACjD,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kCAAkC;IAClC,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,kGAAkG;IAClG,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAChD,IAAI,CAAC,cAAc,EAAE,MAAM,cAAc,CAAC,GAAG;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAEH,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,OAAO,EACP,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAW,EACX,KAAK,EACL,GAAG,SAAS,EACb,EAAE,qBAAqB,qBAwDvB"}
@@ -0,0 +1,19 @@
1
+ import Icon from '../../utilities/Icon.js';
2
+ import classNames from 'classnames';
3
+ import React__default from 'react';
4
+ import { TimeField as TimeField$1, Label, DateInput, DateSegment, Text } from 'react-aria-components';
5
+
6
+ function TimeField({ className, defaultValue, description, disabled, forceLeadingZeros, hideLabel, hideTimeZone, hourCycle, invalid, label, max, min, name, onChange, readOnly, required, size = "md", value, ...restProps }) {
7
+ const combinedClassName = classNames("tds-time-field", { "tds-time-field--lg": size === "lg" }, className);
8
+ return (React__default.createElement(TimeField$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, defaultValue: defaultValue, granularity: "minute", hideTimeZone: hideTimeZone, hourCycle: hourCycle, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, isRequired: required, maxValue: max ?? undefined, minValue: min ?? undefined, name: name, onChange: onChange ?? undefined, shouldForceLeadingZeros: forceLeadingZeros, value: value },
9
+ !hideLabel && React__default.createElement(Label, { className: "tds-time-field-label" }, label),
10
+ React__default.createElement(DateInput, { className: "tds-time-field-input" }, (segment) => (React__default.createElement(DateSegment, { className: segment.type === "literal"
11
+ ? "tds-time-field-segment-separator"
12
+ : "tds-time-field-segment", segment: segment }))),
13
+ description && (React__default.createElement(Text, { elementType: "p", className: "tds-time-field-description", slot: "description" },
14
+ React__default.createElement(Icon, { "aria-hidden": true, className: "tds-time-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
15
+ description))));
16
+ }
17
+
18
+ export { TimeField };
19
+ //# sourceMappingURL=TimeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeField.js","sources":["../../../src/components/time-field/TimeField.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport type {\n CalendarDateTime,\n Time,\n ZonedDateTime,\n} from \"@internationalized/date\"\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { type AriaAttributes } from \"react\"\nimport {\n DateInput,\n DateSegment,\n Label,\n Text,\n TimeField as AriaTimeField,\n} from \"react-aria-components\"\n\nexport type TimeFieldSize = \"md\" | \"lg\"\n\nexport type TimeFieldValue = CalendarDateTime | Time | ZonedDateTime\n\nexport interface TimeFieldProps {\n /** The default uncontrolled value (e.g. `new Time(9, 30)` or `new CalendarDateTime(2025, 1, 1, 9, 30)`). */\n defaultValue?: TimeFieldValue | null\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: string\n /** Disables the field. */\n disabled?: boolean\n /** If `true`, always shows leading zeros in the hour field. */\n forceLeadingZeros?: boolean\n /** If `true`, renders the label visually hidden. */\n hideLabel?: boolean\n /** If `true`, hides the time zone abbreviation for ZonedDateTime values. */\n hideTimeZone?: boolean\n /** Whether to display in 12 or 24 hour format. By default, determined by locale. */\n hourCycle?: 12 | 24\n /** If `true`, applies error styling to the field and description. */\n invalid?: boolean\n /** Accessible label for the field. */\n label: string\n /** The maximum allowed time (e.g. `new Time(17, 0)`). */\n max?: TimeFieldValue\n /** The minimum allowed time (e.g. `new Time(9, 0)`). */\n min?: TimeFieldValue\n /** Field name for form submission. */\n name?: string\n /** Called when the value changes. */\n onChange?: (value: TimeFieldValue | null) => void\n /** Allows the value to be read but not changed. */\n readOnly?: boolean\n /** If `true`, appends an asterisk after the label text. */\n required?: boolean\n /** The size of the time field. */\n size?: TimeFieldSize\n /** The controlled value (e.g. `new Time(9, 30)` or `new CalendarDateTime(2025, 1, 1, 9, 30)`). */\n value?: TimeFieldValue | null\n}\n\nexport type TimeFieldElementProps = TimeFieldProps &\n Omit<AriaAttributes, keyof TimeFieldProps> & {\n className?: string\n id?: string\n }\n\nexport function TimeField({\n className,\n defaultValue,\n description,\n disabled,\n forceLeadingZeros,\n hideLabel,\n hideTimeZone,\n hourCycle,\n invalid,\n label,\n max,\n min,\n name,\n onChange,\n readOnly,\n required,\n size = \"md\",\n value,\n ...restProps\n}: TimeFieldElementProps) {\n const combinedClassName = classNames(\n \"tds-time-field\",\n { \"tds-time-field--lg\": size === \"lg\" },\n className\n )\n\n return (\n <AriaTimeField\n {...restProps}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n defaultValue={defaultValue}\n granularity=\"minute\"\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={max ?? undefined}\n minValue={min ?? undefined}\n name={name}\n onChange={onChange ?? undefined}\n shouldForceLeadingZeros={forceLeadingZeros}\n value={value}\n >\n {!hideLabel && <Label className=\"tds-time-field-label\">{label}</Label>}\n <DateInput className=\"tds-time-field-input\">\n {(segment) => (\n <DateSegment\n className={\n segment.type === \"literal\"\n ? \"tds-time-field-segment-separator\"\n : \"tds-time-field-segment\"\n }\n segment={segment}\n />\n )}\n </DateInput>\n {description && (\n <Text\n elementType=\"p\"\n className=\"tds-time-field-description\"\n slot=\"description\"\n >\n <Icon\n aria-hidden\n className=\"tds-time-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </Text>\n )}\n </AriaTimeField>\n )\n}\n"],"names":["React","AriaTimeField"],"mappings":";;;;;AAiEM,SAAU,SAAS,CAAC,EACxB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,OAAO,EACP,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,KAAK,EACL,GAAG,SAAS,EACU,EAAA;AACtB,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,gBAAgB,EAChB,EAAE,oBAAoB,EAAE,IAAI,KAAK,IAAI,EAAE,EACvC,SAAS,CACV;AAED,IAAA,QACEA,cAAA,CAAA,aAAA,CAACC,WAAa,EAAA,EAAA,GACR,SAAS,gBACD,SAAS,GAAG,KAAK,GAAG,SAAS,EACzC,SAAS,EAAE,iBAAiB,EAC5B,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAC,QAAQ,EACpB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,GAAG,IAAI,SAAS,EAC1B,QAAQ,EAAE,GAAG,IAAI,SAAS,EAC1B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,IAAI,SAAS,EAC/B,uBAAuB,EAAE,iBAAiB,EAC1C,KAAK,EAAE,KAAK,EAAA;QAEX,CAAC,SAAS,IAAID,cAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,SAAS,EAAC,sBAAsB,EAAA,EAAE,KAAK,CAAS;QACtEA,cAAA,CAAA,aAAA,CAAC,SAAS,IAAC,SAAS,EAAC,sBAAsB,EAAA,EACxC,CAAC,OAAO,MACPA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EACV,SAAS,EACP,OAAO,CAAC,IAAI,KAAK;AACf,kBAAE;kBACA,wBAAwB,EAE9B,OAAO,EAAE,OAAO,EAAA,CAChB,CACH,CACS;AACX,QAAA,WAAW,KACVA,cAAA,CAAA,aAAA,CAAC,IAAI,IACH,WAAW,EAAC,GAAG,EACf,SAAS,EAAC,4BAA4B,EACtC,IAAI,EAAC,aAAa,EAAA;YAElBA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,yCAAyC,EACnD,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,WAAW,CACP,CACR,CACa;AAEpB;;;;"}
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ export type { TimeFieldElementProps, TimeFieldProps, TimeFieldSize, } from "./TimeField";
3
+ export { TimeField } from "./TimeField";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/time-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}