@planningcenter/tapestry 3.2.2 → 3.2.3-qa-839.0
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/button/BaseButton.d.ts +4 -0
- package/dist/components/button/BaseButton.d.ts.map +1 -1
- package/dist/components/button/BaseButton.js.map +1 -1
- package/dist/components/button/Button.d.ts +2 -0
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/DropdownButton.d.ts +2 -0
- package/dist/components/button/DropdownButton.d.ts.map +1 -1
- package/dist/components/button/DropdownButton.js.map +1 -1
- package/dist/components/button/IconButton.d.ts +4 -0
- package/dist/components/button/IconButton.d.ts.map +1 -1
- package/dist/components/button/IconButton.js.map +1 -1
- package/dist/components/button/LoadingButton.d.ts +2 -0
- package/dist/components/button/LoadingButton.d.ts.map +1 -1
- package/dist/components/button/LoadingButton.js.map +1 -1
- package/dist/components/button/PageHeaderActionsDropdownButton.d.ts +2 -0
- package/dist/components/button/PageHeaderActionsDropdownButton.d.ts.map +1 -1
- package/dist/components/button/PageHeaderActionsDropdownButton.js.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +4 -0
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroup.d.ts +4 -0
- package/dist/components/checkbox-group/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroup.js.map +1 -1
- package/dist/components/combo-box/ComboBox.d.ts +4 -2
- package/dist/components/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/components/combo-box/ComboBox.js +5 -3
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +71 -122
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/link/BaseLink.js +1 -1
- package/dist/components/link/BaseLink.js.map +1 -1
- package/dist/components/link/IconLink.d.ts +2 -0
- package/dist/components/link/IconLink.d.ts.map +1 -1
- package/dist/components/link/IconLink.js.map +1 -1
- package/dist/components/page-header/PageHeader.d.ts +6 -3
- package/dist/components/page-header/PageHeader.d.ts.map +1 -1
- package/dist/components/page-header/PageHeader.js.map +1 -1
- package/dist/components/radio/Radio.d.ts +3 -0
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts +4 -0
- package/dist/components/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio-group/RadioGroup.js.map +1 -1
- package/dist/components/select/Select.d.ts +59 -9
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/time-field/TimeField.d.ts +8 -18
- package/dist/components/time-field/TimeField.d.ts.map +1 -1
- package/dist/components/time-field/TimeField.js +2 -2
- package/dist/components/time-field/TimeField.js.map +1 -1
- package/dist/components/time-field/index.d.ts +1 -1
- package/dist/components/time-field/index.d.ts.map +1 -1
- package/dist/components/toggle-switch/ToggleSwitch.d.ts +10 -4
- package/dist/components/toggle-switch/ToggleSwitch.d.ts.map +1 -1
- package/dist/components/toggle-switch/ToggleSwitch.js.map +1 -1
- package/dist/index.css +19 -21
- package/dist/index.css.map +1 -1
- package/dist/reactRender.css +755 -777
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +755 -777
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +50 -72
- package/dist/unstable.css.map +1 -1
- package/dist/utilities/buttonLinkShared.d.ts +5 -0
- package/dist/utilities/buttonLinkShared.d.ts.map +1 -1
- package/dist/utilities/buttonLinkShared.js.map +1 -1
- package/package.json +5 -5
- package/dist/ext/@react-aria/focus/dist/FocusScope.js +0 -664
- package/dist/ext/@react-aria/focus/dist/FocusScope.js.map +0 -1
- package/dist/ext/@react-aria/interactions/dist/focusSafely.js +0 -38
- package/dist/ext/@react-aria/interactions/dist/focusSafely.js.map +0 -1
- package/dist/ext/@react-aria/interactions/dist/useFocusVisible.js +0 -165
- package/dist/ext/@react-aria/interactions/dist/useFocusVisible.js.map +0 -1
- package/dist/ext/@react-aria/interactions/dist/utils.js +0 -6
- package/dist/ext/@react-aria/interactions/dist/utils.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/DOMFunctions.js +0 -38
- package/dist/ext/@react-aria/utils/dist/DOMFunctions.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/ShadowTreeWalker.js +0 -193
- package/dist/ext/@react-aria/utils/dist/ShadowTreeWalker.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/domHelpers.js +0 -20
- package/dist/ext/@react-aria/utils/dist/domHelpers.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/focusWithoutScrolling.js +0 -66
- package/dist/ext/@react-aria/utils/dist/focusWithoutScrolling.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/isElementVisible.js +0 -39
- package/dist/ext/@react-aria/utils/dist/isElementVisible.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/isFocusable.js +0 -49
- package/dist/ext/@react-aria/utils/dist/isFocusable.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/isVirtualEvent.js +0 -25
- package/dist/ext/@react-aria/utils/dist/isVirtualEvent.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/openLink.js +0 -42
- package/dist/ext/@react-aria/utils/dist/openLink.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/platform.js +0 -59
- package/dist/ext/@react-aria/utils/dist/platform.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/runAfterTransition.js +0 -91
- package/dist/ext/@react-aria/utils/dist/runAfterTransition.js.map +0 -1
- package/dist/ext/@react-aria/utils/dist/useLayoutEffect.js +0 -17
- package/dist/ext/@react-aria/utils/dist/useLayoutEffect.js.map +0 -1
- package/dist/ext/@react-stately/flags/dist/import.js +0 -7
- package/dist/ext/@react-stately/flags/dist/import.js.map +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
2
|
import React, { type SelectHTMLAttributes } from "react";
|
|
3
3
|
export type SelectSize = "lg" | "md";
|
|
4
|
+
/**
|
|
5
|
+
* String-labelled option variant. Valid in both native (`complex={false}`)
|
|
6
|
+
* and complex (`complex={true}`) modes. The `label` doubles as the type-ahead
|
|
7
|
+
* search target.
|
|
8
|
+
*/
|
|
4
9
|
export interface SelectOptionWithTextLabel {
|
|
10
|
+
/** Arbitrary `data-*` attributes are forwarded to the rendered option. */
|
|
5
11
|
[key: `data-${string}`]: boolean | number | string | undefined;
|
|
6
12
|
/** Whether this option is non-interactive. */
|
|
7
13
|
disabled?: boolean;
|
|
@@ -9,19 +15,40 @@ export interface SelectOptionWithTextLabel {
|
|
|
9
15
|
/** Displayed as the option content and used for type-ahead matching. */
|
|
10
16
|
label: string;
|
|
11
17
|
textValue?: never;
|
|
18
|
+
/** Unique identifier for the option. */
|
|
12
19
|
value: string;
|
|
13
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Rich-content option variant. The popover (`complex={true}`) renders the
|
|
23
|
+
* `label` node directly; the native `<select>` (`complex={false}`) falls back
|
|
24
|
+
* to `textValue` for the visible text. Requires a plain-text `textValue` so
|
|
25
|
+
* type-ahead matching, screen reader announcements, and the native fallback
|
|
26
|
+
* all have something stable to use.
|
|
27
|
+
*/
|
|
14
28
|
export interface SelectOptionWithNodeLabel {
|
|
29
|
+
/** Arbitrary `data-*` attributes are forwarded to the rendered option. */
|
|
15
30
|
[key: `data-${string}`]: boolean | number | string | undefined;
|
|
16
31
|
/** Whether this option is non-interactive. */
|
|
17
32
|
disabled?: boolean;
|
|
18
33
|
divider?: never;
|
|
19
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Option content. Rendered as JSX in complex mode; in native mode, the
|
|
36
|
+
* visible text comes from `textValue` instead.
|
|
37
|
+
*/
|
|
20
38
|
label: React.ReactNode;
|
|
21
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Plain-text fallback for type-ahead matching, screen reader
|
|
41
|
+
* announcements, and the native `<select>`'s visible option text when
|
|
42
|
+
* `label` is a React node.
|
|
43
|
+
*/
|
|
22
44
|
textValue: string;
|
|
45
|
+
/** Unique identifier for the option. */
|
|
23
46
|
value: string;
|
|
24
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Visual-separator option variant. Renders a divider line between options
|
|
50
|
+
* (or between groups of options). Carries no value of its own.
|
|
51
|
+
*/
|
|
25
52
|
export interface SelectOptionDivider {
|
|
26
53
|
disabled?: never;
|
|
27
54
|
/** Renders a visual separator between options. */
|
|
@@ -31,21 +58,38 @@ export interface SelectOptionDivider {
|
|
|
31
58
|
value?: never;
|
|
32
59
|
}
|
|
33
60
|
export type SelectOption = SelectOptionDivider | SelectOptionWithNodeLabel | SelectOptionWithTextLabel;
|
|
61
|
+
/**
|
|
62
|
+
* A group entry in `Select`'s `options` array. Renders a heading above its
|
|
63
|
+
* `options` and nests them visually beneath it.
|
|
64
|
+
*/
|
|
34
65
|
export interface SelectOptionsGroup {
|
|
35
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Whether all options in this group are non-interactive. Disables every
|
|
68
|
+
* nested option regardless of its own `disabled` flag.
|
|
69
|
+
*/
|
|
36
70
|
disabled?: boolean;
|
|
37
71
|
/** Visible heading displayed above the group's options. */
|
|
38
72
|
label: string;
|
|
39
|
-
/** The selectable options
|
|
73
|
+
/** The selectable options nested under this group. */
|
|
40
74
|
options: SelectOption[];
|
|
41
75
|
}
|
|
42
76
|
export type SelectItem = SelectOption | SelectOptionsGroup;
|
|
43
77
|
interface SelectBaseProps {
|
|
44
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* When true, renders as a popover listbox instead of a native `<select>`.
|
|
80
|
+
* Enables rich content in options (icons, descriptions).
|
|
81
|
+
*/
|
|
45
82
|
complex?: boolean;
|
|
46
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Helper text displayed below the select. Styled as error text when
|
|
85
|
+
* `invalid`. Defaults to `"Please select an option"` when `invalid` is true
|
|
86
|
+
* and no description is provided.
|
|
87
|
+
*/
|
|
47
88
|
description?: string;
|
|
48
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Whether the select is in an invalid state. Shows the default description
|
|
91
|
+
* if none is provided.
|
|
92
|
+
*/
|
|
49
93
|
invalid?: boolean;
|
|
50
94
|
/** A flat or mixed array of options and option groups. */
|
|
51
95
|
options: SelectItem[];
|
|
@@ -57,7 +101,10 @@ interface SelectBaseProps {
|
|
|
57
101
|
interface SelectWithVisibleLabel extends SelectBaseProps {
|
|
58
102
|
/** If true, the label is visually hidden and set as aria-label. */
|
|
59
103
|
hideLabel?: false;
|
|
60
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* The label text for the select. Required unless `aria-label` or
|
|
106
|
+
* `aria-labelledby` is provided.
|
|
107
|
+
*/
|
|
61
108
|
label: string;
|
|
62
109
|
}
|
|
63
110
|
interface SelectWithHiddenLabel extends SelectBaseProps {
|
|
@@ -73,7 +120,10 @@ interface SelectWithAriaLabel extends SelectBaseProps {
|
|
|
73
120
|
label?: never;
|
|
74
121
|
}
|
|
75
122
|
interface SelectWithAriaLabelledBy extends SelectBaseProps {
|
|
76
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* ID of an external label element. Use instead of `label` when a visible
|
|
125
|
+
* label exists elsewhere on the page.
|
|
126
|
+
*/
|
|
77
127
|
"aria-labelledby": string;
|
|
78
128
|
hideLabel?: never;
|
|
79
129
|
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,I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AAe;IACtD,mEAAmE;IACnE,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,qBAAsB,SAAQ,eAAe;IACrD,mEAAmE;IACnE,SAAS,EAAE,IAAI,CAAA;IACf,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,mBAAoB,SAAQ,eAAe;IACnD,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,UAAU,wBAAyB,SAAQ,eAAe;IACxD;;;OAGG;IACH,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,8FAgHlB,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. 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. Defaults to `\"Select an option\"`. */\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 effectivePlaceholder =\n normalizedDefaultValue !== undefined && normalizedDefaultValue !== \"\"\n ? null\n : placeholder || \"Select an option\"\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: effectivePlaceholder,\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,SAAS;AACb,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,YAAY,EACZ;AACE,QAAA,qBAAqB,EAAE,OAAO;QAC9B,gBAAgB,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AS,EAAC,kBAAkB,EAC5B,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;;;;"}
|
|
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\n/**\n * String-labelled option variant. Valid in both native (`complex={false}`)\n * and complex (`complex={true}`) modes. The `label` doubles as the type-ahead\n * search target.\n */\nexport interface SelectOptionWithTextLabel {\n /** Arbitrary `data-*` attributes are forwarded to the rendered option. */\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 /** Unique identifier for the option. */\n value: string\n}\n\n/**\n * Rich-content option variant. The popover (`complex={true}`) renders the\n * `label` node directly; the native `<select>` (`complex={false}`) falls back\n * to `textValue` for the visible text. Requires a plain-text `textValue` so\n * type-ahead matching, screen reader announcements, and the native fallback\n * all have something stable to use.\n */\nexport interface SelectOptionWithNodeLabel {\n /** Arbitrary `data-*` attributes are forwarded to the rendered option. */\n [key: `data-${string}`]: boolean | number | string | undefined\n /** Whether this option is non-interactive. */\n disabled?: boolean\n divider?: never\n /**\n * Option content. Rendered as JSX in complex mode; in native mode, the\n * visible text comes from `textValue` instead.\n */\n label: React.ReactNode\n /**\n * Plain-text fallback for type-ahead matching, screen reader\n * announcements, and the native `<select>`'s visible option text when\n * `label` is a React node.\n */\n textValue: string\n /** Unique identifier for the option. */\n value: string\n}\n\n/**\n * Visual-separator option variant. Renders a divider line between options\n * (or between groups of options). Carries no value of its own.\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\n/**\n * A group entry in `Select`'s `options` array. Renders a heading above its\n * `options` and nests them visually beneath it.\n */\nexport interface SelectOptionsGroup {\n /**\n * Whether all options in this group are non-interactive. Disables every\n * nested option regardless of its own `disabled` flag.\n */\n disabled?: boolean\n /** Visible heading displayed above the group's options. */\n label: string\n /** The selectable options nested under this group. */\n options: SelectOption[]\n}\n\nexport type SelectItem = SelectOption | SelectOptionsGroup\n\n// ---------------------------------------------------------------------------\n// Select component props\n// ---------------------------------------------------------------------------\n\ninterface SelectBaseProps {\n /**\n * When true, renders as a popover listbox instead of a native `<select>`.\n * Enables rich content in options (icons, descriptions).\n */\n complex?: boolean\n /**\n * Helper text displayed below the select. Styled as error text when\n * `invalid`. Defaults to `\"Please select an option\"` when `invalid` is true\n * and no description is provided.\n */\n description?: string\n /**\n * Whether the select is in an invalid state. Shows the default description\n * if none is provided.\n */\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. Defaults to `\"Select an option\"`. */\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 /**\n * The label text for the select. Required unless `aria-label` or\n * `aria-labelledby` is provided.\n */\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 /**\n * ID of an external label element. Use instead of `label` when a visible\n * label exists elsewhere on the page.\n */\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 effectivePlaceholder =\n normalizedDefaultValue !== undefined && normalizedDefaultValue !== \"\"\n ? null\n : placeholder || \"Select an option\"\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: effectivePlaceholder,\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":";;;;;;;AA0LA,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;AAC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import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaProps";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { type TimeFieldProps as AriaTimeFieldProps } from "react-aria-components";
|
|
4
6
|
export type TimeFieldSize = "md" | "lg";
|
|
5
7
|
export type TimeFieldValue = CalendarDateTime | Time | ZonedDateTime;
|
|
6
8
|
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
9
|
/** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */
|
|
10
10
|
description?: string;
|
|
11
11
|
/** Disables the field. */
|
|
@@ -14,10 +14,6 @@ export interface TimeFieldProps {
|
|
|
14
14
|
forceLeadingZeros?: boolean;
|
|
15
15
|
/** If `true`, renders the label visually hidden. */
|
|
16
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
17
|
/** If `true`, applies error styling to the field and description. */
|
|
22
18
|
invalid?: boolean;
|
|
23
19
|
/** Accessible label for the field. */
|
|
@@ -26,22 +22,16 @@ export interface TimeFieldProps {
|
|
|
26
22
|
max?: TimeFieldValue;
|
|
27
23
|
/** The minimum allowed time (e.g. `new Time(9, 0)`). */
|
|
28
24
|
min?: TimeFieldValue;
|
|
29
|
-
/** Field name for form submission. */
|
|
30
|
-
name?: string;
|
|
31
|
-
/** Called when the value changes. */
|
|
32
|
-
onChange?: (value: TimeFieldValue | null) => void;
|
|
33
25
|
/** Allows the value to be read but not changed. */
|
|
34
26
|
readOnly?: boolean;
|
|
35
27
|
/** If `true`, appends an asterisk after the label text. */
|
|
36
28
|
required?: boolean;
|
|
37
29
|
/** The size of the time field. */
|
|
38
30
|
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
31
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
export
|
|
32
|
+
type AriaTimeFieldPropsToOmit = "children" | "granularity" | "placeholderValue" | "shouldForceLeadingZeros" | "slot";
|
|
33
|
+
type AriaTimeFieldPropsToInclude = "defaultValue" | "hideTimeZone" | "hourCycle" | "name" | "onChange" | "value";
|
|
34
|
+
export type TimeFieldElementProps = CombineAriaPropsWithCustomProps<AriaTimeFieldProps<TimeFieldValue>, TimeFieldProps, AriaTimeFieldPropsToOmit, AriaTimeFieldPropsToInclude>;
|
|
35
|
+
export declare function TimeField({ className, description, disabled, forceLeadingZeros, hideLabel, invalid, label, max, min, readOnly, required, size, ...restProps }: TimeFieldElementProps): React.JSX.Element;
|
|
36
|
+
export {};
|
|
47
37
|
//# sourceMappingURL=TimeField.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAEhC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAML,KAAK,cAAc,IAAI,kBAAkB,EAC1C,MAAM,uB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AqB,qBAkDvB"}
|
|
@@ -3,9 +3,9 @@ import classNames from 'classnames';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { TimeField as TimeField$1, Label, DateInput, DateSegment, Text } from 'react-aria-components';
|
|
5
5
|
|
|
6
|
-
function TimeField({ className,
|
|
6
|
+
function TimeField({ className, description, disabled, forceLeadingZeros, hideLabel, invalid, label, max, min, readOnly, required, size = "md", ...restProps }) {
|
|
7
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,
|
|
8
|
+
return (React__default.createElement(TimeField$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, granularity: "minute", isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, isRequired: required, maxValue: max ?? undefined, minValue: min ?? undefined, shouldForceLeadingZeros: forceLeadingZeros },
|
|
9
9
|
!hideLabel && React__default.createElement(Label, { className: "tds-time-field-label" }, label),
|
|
10
10
|
React__default.createElement(DateInput, { className: "tds-time-field-input" }, (segment) => (React__default.createElement(DateSegment, { className: segment.type === "literal"
|
|
11
11
|
? "tds-time-field-segment-separator"
|
|
@@ -1 +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
|
|
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 type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React from \"react\"\nimport {\n DateInput,\n DateSegment,\n Label,\n Text,\n TimeField as AriaTimeField,\n type TimeFieldProps as AriaTimeFieldProps,\n} from \"react-aria-components\"\n\nexport type TimeFieldSize = \"md\" | \"lg\"\n\nexport type TimeFieldValue = CalendarDateTime | Time | ZonedDateTime\n\nexport interface TimeFieldProps {\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`, 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 /** 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}\n\ntype AriaTimeFieldPropsToOmit =\n | \"children\"\n | \"granularity\"\n | \"placeholderValue\"\n | \"shouldForceLeadingZeros\"\n | \"slot\"\n\ntype AriaTimeFieldPropsToInclude =\n | \"defaultValue\"\n | \"hideTimeZone\"\n | \"hourCycle\"\n | \"name\"\n | \"onChange\"\n | \"value\"\n\nexport type TimeFieldElementProps = CombineAriaPropsWithCustomProps<\n AriaTimeFieldProps<TimeFieldValue>,\n TimeFieldProps,\n AriaTimeFieldPropsToOmit,\n AriaTimeFieldPropsToInclude\n>\n\nexport function TimeField({\n className,\n description,\n disabled,\n forceLeadingZeros,\n hideLabel,\n invalid,\n label,\n max,\n min,\n readOnly,\n required,\n size = \"md\",\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 granularity=\"minute\"\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={max ?? undefined}\n minValue={min ?? undefined}\n shouldForceLeadingZeros={forceLeadingZeros}\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":";;;;;AAuEM,SAAU,SAAS,CAAC,EACxB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,KAAK,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACU,EAAA;AACtB,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,gBAAgB,EAChB,EAAE,oBAAoB,EAAE,IAAI,KAAK,IAAI,EAAE,EACvC,SAAS,CACV;IAED,QACEA,cAAA,CAAA,aAAA,CAACC,WAAa,EAAA,EAAA,GACR,SAAS,gBACD,SAAS,GAAG,KAAK,GAAG,SAAS,EACzC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAC,QAAQ,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,uBAAuB,EAAE,iBAAiB,EAAA;QAEzC,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;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
export type { TimeFieldElementProps, TimeFieldProps, TimeFieldSize, } from "./TimeField";
|
|
2
|
+
export type { TimeFieldElementProps, TimeFieldProps, TimeFieldSize, TimeFieldValue, } from "./TimeField";
|
|
3
3
|
export { TimeField } from "./TimeField";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACb,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -5,23 +5,29 @@ interface ToggleSwitchBaseProps {
|
|
|
5
5
|
"aria-invalid"?: never;
|
|
6
6
|
"aria-label"?: never;
|
|
7
7
|
"aria-required"?: never;
|
|
8
|
+
/** Optional description text that appears below the toggle switch label. */
|
|
8
9
|
description?: string;
|
|
9
10
|
required?: never;
|
|
11
|
+
/** The size of the toggle switch. */
|
|
10
12
|
size?: ToggleSwitchSize;
|
|
11
13
|
}
|
|
12
14
|
interface ToggleSwitchWithVisibleLabel extends ToggleSwitchBaseProps {
|
|
13
15
|
"aria-labelledby"?: never;
|
|
16
|
+
/** When true, hides the visible label and sets it as aria-label on the input instead. */
|
|
14
17
|
hideLabel?: false;
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* The label content for the toggle switch. Required unless
|
|
20
|
+
* `aria-labelledby` is provided to reference an external label. When
|
|
21
|
+
* using non-string content (e.g. JSX), it must not contain
|
|
22
|
+
* interactive elements. This includes native HTML elements such as
|
|
23
|
+
* `<a>` and `<button>`, as well as Tapestry or Tapestry-React
|
|
24
|
+
* interactive components.
|
|
20
25
|
*/
|
|
21
26
|
label: React.ReactNode;
|
|
22
27
|
}
|
|
23
28
|
interface ToggleSwitchWithHiddenLabel extends ToggleSwitchBaseProps {
|
|
24
29
|
"aria-labelledby"?: never;
|
|
30
|
+
/** When true, hides the visible label and sets it as aria-label on the input instead. */
|
|
25
31
|
hideLabel: true;
|
|
26
32
|
/** Label text for the toggle switch, used as an accessible `aria-label`. */
|
|
27
33
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAA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B,yFAAyF;IACzF,SAAS,EAAE,IAAI,CAAA;IACf,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,8BAA+B,SAAQ,qBAAqB;IACpE,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,wDAAwD;IACxD,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,iBAAiB,GACzB,4BAA4B,GAC5B,2BAA2B,GAC3B,8BAA8B,CAAA;AAElC,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,CAChE,GACC,iBAAiB,CAAA;AAEnB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,mGA0DxB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitch.js","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nexport type ToggleSwitchSize = \"md\" | \"sm\"\n\ninterface ToggleSwitchBaseProps {\n \"aria-invalid\"?: never\n \"aria-label\"?: never\n \"aria-required\"?: never\n description?: string\n required?: never\n size?: ToggleSwitchSize\n}\n\ninterface ToggleSwitchWithVisibleLabel extends ToggleSwitchBaseProps {\n \"aria-labelledby\"?: never\n hideLabel?: false\n /**\n *
|
|
1
|
+
{"version":3,"file":"ToggleSwitch.js","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nexport type ToggleSwitchSize = \"md\" | \"sm\"\n\ninterface ToggleSwitchBaseProps {\n \"aria-invalid\"?: never\n \"aria-label\"?: never\n \"aria-required\"?: never\n /** Optional description text that appears below the toggle switch label. */\n description?: string\n required?: never\n /** The size of the toggle switch. */\n size?: ToggleSwitchSize\n}\n\ninterface ToggleSwitchWithVisibleLabel extends ToggleSwitchBaseProps {\n \"aria-labelledby\"?: never\n /** When true, hides the visible label and sets it as aria-label on the input instead. */\n hideLabel?: false\n /**\n * The label content for the toggle switch. Required unless\n * `aria-labelledby` is provided to reference an external label. When\n * using non-string content (e.g. JSX), it must not contain\n * interactive elements. This includes native HTML elements such as\n * `<a>` and `<button>`, as well as Tapestry or Tapestry-React\n * interactive components.\n */\n label: React.ReactNode\n}\n\ninterface ToggleSwitchWithHiddenLabel extends ToggleSwitchBaseProps {\n \"aria-labelledby\"?: never\n /** When true, hides the visible label and sets it as aria-label on the input instead. */\n hideLabel: true\n /** Label text for the toggle switch, used as an accessible `aria-label`. */\n label: string\n}\n\ninterface ToggleSwitchWithAriaLabelledBy extends ToggleSwitchBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n /** Not available when `aria-labelledby` is provided. */\n label?: never\n}\n\nexport type ToggleSwitchProps =\n | ToggleSwitchWithVisibleLabel\n | ToggleSwitchWithHiddenLabel\n | ToggleSwitchWithAriaLabelledBy\n\nexport type ToggleSwitchElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof ToggleSwitchProps | \"type\" | \"required\" | \"aria-required\"\n> &\n ToggleSwitchProps\n\n/**\n * A toggle switch component that renders as a checkbox input styled as a switch.\n *\n * **Required:** You must provide either:\n * - `label` - Label content for the switch (must be a string when `hideLabel` is true)\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 */\nexport const ToggleSwitch = forwardRef<\n HTMLInputElement,\n ToggleSwitchElementProps\n>(\n (\n {\n \"aria-describedby\": ariaDescribedby,\n checked,\n className,\n description,\n hideLabel = false,\n id,\n label,\n size = \"md\",\n ...restProps\n }: ToggleSwitchElementProps,\n ref\n ) => {\n const combinedClassName = classNames(\n \"tds-toggle-switch\",\n size && size === \"sm\" && `tds-toggle-switch--sm`,\n hideLabel && `tds-toggle-switch--hide-label`,\n className\n )\n\n const stableId = useId()\n const toggleSwitchId = id || `tds-toggle-switch-${stableId}`\n\n return (\n <div className={combinedClassName}>\n <div className=\"tds-toggle-switch-track\" aria-hidden=\"true\"></div>\n <input\n {...restProps}\n id={toggleSwitchId}\n type=\"checkbox\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={hideLabel ? (label as string) : undefined}\n aria-describedby={\n description && !hideLabel\n ? `${toggleSwitchId}-description`\n : ariaDescribedby\n }\n checked={checked}\n ref={ref}\n />\n {label && !hideLabel && <label htmlFor={toggleSwitchId}>{label}</label>}\n {description && !hideLabel && (\n <p\n id={`${toggleSwitchId}-description`}\n className=\"tds-toggle-switch-description\"\n >\n {description}\n </p>\n )}\n </div>\n )\n }\n)\n\nToggleSwitch.displayName = \"ToggleSwitch\"\n"],"names":["React"],"mappings":";;;;AA4DA;;;;;;;;;;AAUG;AACI,MAAM,YAAY,GAAG,UAAU,CAIpC,CACE,EACE,kBAAkB,EAAE,eAAe,EACnC,OAAO,EACP,SAAS,EACT,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,EAAE,EACF,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACa,EAC3B,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAClC,mBAAmB,EACnB,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAA,qBAAA,CAAuB,EAChD,SAAS,IAAI,+BAA+B,EAC5C,SAAS,CACV;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,cAAc,GAAG,EAAE,IAAI,CAAA,kBAAA,EAAqB,QAAQ,EAAE;AAE5D,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA;AAC/B,QAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yBAAyB,EAAA,aAAA,EAAa,MAAM,EAAA,CAAO;AAClE,QAAAA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GACM,SAAS,EACb,EAAE,EAAE,cAAc,EAClB,IAAI,EAAC,UAAU,EACf,IAAI,EAAC,QAAQ,EAAA,cAAA,EACC,OAAO,EAAA,YAAA,EACT,SAAS,GAAI,KAAgB,GAAG,SAAS,EAAA,kBAAA,EAEnD,WAAW,IAAI,CAAC;kBACZ,CAAA,EAAG,cAAc,CAAA,YAAA;kBACjB,eAAe,EAErB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EAAA,CACR;QACD,KAAK,IAAI,CAAC,SAAS,IAAIA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,cAAc,EAAA,EAAG,KAAK,CAAS;QACtE,WAAW,IAAI,CAAC,SAAS,KACxBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,EAAE,EAAE,CAAA,EAAG,cAAc,cAAc,EACnC,SAAS,EAAC,+BAA+B,EAAA,EAExC,WAAW,CACV,CACL,CACG;AAEV,CAAC;AAGH,YAAY,CAAC,WAAW,GAAG,cAAc;;;;"}
|
package/dist/index.css
CHANGED
|
@@ -1830,8 +1830,7 @@ tds-sidenav-section:not(.hydrated) > [slot="ssr"]{
|
|
|
1830
1830
|
--tds-btn-loading-spinner-track-color:var(--t-fill-color-status-error-ghost);
|
|
1831
1831
|
}
|
|
1832
1832
|
|
|
1833
|
-
.tds-btn--inline-text
|
|
1834
|
-
a[class="tds-btn"]{
|
|
1833
|
+
.tds-btn--inline-text{
|
|
1835
1834
|
--tds-btn-color:var(--t-text-color-interaction);
|
|
1836
1835
|
--tds-btn-color-hover:var(--t-text-color-interaction-hover);
|
|
1837
1836
|
--tds-btn-color-active:var(--t-text-color-interaction-active);
|
|
@@ -1850,9 +1849,10 @@ a[class="tds-btn"]{
|
|
|
1850
1849
|
font-family:inherit;
|
|
1851
1850
|
font-style:inherit;
|
|
1852
1851
|
vertical-align:inherit;
|
|
1852
|
+
text-align:inherit;
|
|
1853
1853
|
}
|
|
1854
1854
|
|
|
1855
|
-
|
|
1855
|
+
.tds-btn--inline-text:hover,.tds-btn--inline-text:focus-visible{
|
|
1856
1856
|
--tds-btn-text-decoration:none;
|
|
1857
1857
|
}
|
|
1858
1858
|
|
|
@@ -2670,12 +2670,11 @@ a[class="tds-btn"]{
|
|
|
2670
2670
|
--tds-select-dropdown-border-radius:var(--t-border-radius);
|
|
2671
2671
|
--tds-select-dropdown-box-shadow:hsl(0, 0%, 0%, .05) 0 10px 15px -3px, hsl(0, 0%, 0%, .05) 0 4px 6px -4px;
|
|
2672
2672
|
--tds-select-dropdown-scroll-behavior:smooth;
|
|
2673
|
-
--tds-select-dropdown-transition
|
|
2674
|
-
--tds-select-dropdown-transition-exit:opacity var(--t-duration-200) var(--t-ease-in), transform var(--t-duration-200) var(--t-ease-in), display var(--t-duration-200) allow-discrete, overlay var(--t-duration-200) allow-discrete;
|
|
2673
|
+
--tds-select-dropdown-transition:opacity var(--t-duration-300) var(--t-ease-out), translate var(--t-duration-300) var(--t-ease-out), display var(--t-duration-300) allow-discrete, overlay var(--t-duration-300) allow-discrete;
|
|
2675
2674
|
--tds-select-dropdown-closed-opacity:0;
|
|
2676
2675
|
--tds-select-dropdown-open-opacity:1;
|
|
2677
|
-
--tds-select-dropdown-closed-
|
|
2678
|
-
--tds-select-dropdown-open-
|
|
2676
|
+
--tds-select-dropdown-closed-translate:0 -8px;
|
|
2677
|
+
--tds-select-dropdown-open-translate:0 0;
|
|
2679
2678
|
|
|
2680
2679
|
--tds-select-option-gap:var(--t-spacing-1);
|
|
2681
2680
|
--tds-select-option-padding-block:var(--t-spacing-1);
|
|
@@ -2873,11 +2872,10 @@ a[class="tds-btn"]{
|
|
|
2873
2872
|
|
|
2874
2873
|
.tds-select{
|
|
2875
2874
|
--tds-select-transition-property:none;
|
|
2876
|
-
--tds-select-dropdown-transition
|
|
2877
|
-
--tds-select-dropdown-transition-exit:none;
|
|
2875
|
+
--tds-select-dropdown-transition:none;
|
|
2878
2876
|
--tds-select-dropdown-scroll-behavior:auto;
|
|
2879
|
-
--tds-select-dropdown-closed-
|
|
2880
|
-
--tds-select-dropdown-open-
|
|
2877
|
+
--tds-select-dropdown-closed-translate:none;
|
|
2878
|
+
--tds-select-dropdown-open-translate:none;
|
|
2881
2879
|
--tds-select-caret-transition:none;
|
|
2882
2880
|
}
|
|
2883
2881
|
}
|
|
@@ -2918,6 +2916,7 @@ a[class="tds-btn"]{
|
|
|
2918
2916
|
color:var(--tds-select-placeholder-color);
|
|
2919
2917
|
white-space:nowrap;
|
|
2920
2918
|
background-image:none;
|
|
2919
|
+
anchor-name:--tds-select-anchor;
|
|
2921
2920
|
transition:background-color var(--t-duration-300) var(--t-ease-in-out), border-color var(--t-duration-300) var(--t-ease-in-out), outline-color var(--t-duration-300) var(--t-ease-in-out), outline-offset var(--t-duration-300) var(--t-ease-in-out), transform var(--t-duration-100) var(--t-ease-in-out);
|
|
2922
2921
|
-webkit-tap-highlight-color:transparent;
|
|
2923
2922
|
}
|
|
@@ -2940,6 +2939,7 @@ a[class="tds-btn"]{
|
|
|
2940
2939
|
}
|
|
2941
2940
|
|
|
2942
2941
|
.tds-select:has( > button) [popover]{
|
|
2942
|
+
position-anchor:--tds-select-anchor;
|
|
2943
2943
|
inset:auto;
|
|
2944
2944
|
inline-size:-moz-max-content;
|
|
2945
2945
|
inline-size:max-content;
|
|
@@ -2965,14 +2965,13 @@ a[class="tds-btn"]{
|
|
|
2965
2965
|
border-radius:var(--tds-select-dropdown-border-radius);
|
|
2966
2966
|
box-shadow:var(--tds-select-dropdown-box-shadow);
|
|
2967
2967
|
opacity:var(--tds-select-dropdown-open-opacity);
|
|
2968
|
-
|
|
2969
|
-
transition:var(--tds-select-dropdown-transition
|
|
2968
|
+
translate:var(--tds-select-dropdown-open-translate);
|
|
2969
|
+
transition:var(--tds-select-dropdown-transition);
|
|
2970
2970
|
}
|
|
2971
2971
|
|
|
2972
2972
|
:is(.tds-select:has( > button) [popover]):not(:popover-open){
|
|
2973
2973
|
opacity:var(--tds-select-dropdown-closed-opacity);
|
|
2974
|
-
|
|
2975
|
-
transition:var(--tds-select-dropdown-transition-exit);
|
|
2974
|
+
translate:var(--tds-select-dropdown-closed-translate);
|
|
2976
2975
|
}
|
|
2977
2976
|
|
|
2978
2977
|
:is(.tds-select:has( > button) [popover]) ul{
|
|
@@ -2984,7 +2983,7 @@ a[class="tds-btn"]{
|
|
|
2984
2983
|
@starting-style{
|
|
2985
2984
|
:is(.tds-select:has( > button) [popover]):popover-open{
|
|
2986
2985
|
opacity:var(--tds-select-dropdown-closed-opacity);
|
|
2987
|
-
|
|
2986
|
+
translate:var(--tds-select-dropdown-closed-translate);
|
|
2988
2987
|
}
|
|
2989
2988
|
}
|
|
2990
2989
|
|
|
@@ -3012,8 +3011,7 @@ a[class="tds-btn"]{
|
|
|
3012
3011
|
|
|
3013
3012
|
:is(.tds-select select:has( > button))::picker(select):not(:popover-open){
|
|
3014
3013
|
opacity:var(--tds-select-dropdown-closed-opacity);
|
|
3015
|
-
|
|
3016
|
-
transition:var(--tds-select-dropdown-transition-exit);
|
|
3014
|
+
translate:var(--tds-select-dropdown-closed-translate);
|
|
3017
3015
|
}
|
|
3018
3016
|
|
|
3019
3017
|
:is(.tds-select select:has( > button)):open,:is(.tds-select select:has( > button)):focus-within{
|
|
@@ -3061,8 +3059,8 @@ a[class="tds-btn"]{
|
|
|
3061
3059
|
border-radius:var(--tds-select-dropdown-border-radius);
|
|
3062
3060
|
box-shadow:var(--tds-select-dropdown-box-shadow);
|
|
3063
3061
|
opacity:var(--tds-select-dropdown-open-opacity);
|
|
3064
|
-
|
|
3065
|
-
transition:var(--tds-select-dropdown-transition
|
|
3062
|
+
translate:var(--tds-select-dropdown-open-translate);
|
|
3063
|
+
transition:var(--tds-select-dropdown-transition);
|
|
3066
3064
|
}
|
|
3067
3065
|
|
|
3068
3066
|
:is(.tds-select select:has( > button)) option::checkmark{
|
|
@@ -3072,7 +3070,7 @@ a[class="tds-btn"]{
|
|
|
3072
3070
|
@starting-style{
|
|
3073
3071
|
:is(.tds-select select:has( > button))::picker(select):popover-open{
|
|
3074
3072
|
opacity:var(--tds-select-dropdown-closed-opacity);
|
|
3075
|
-
|
|
3073
|
+
translate:var(--tds-select-dropdown-closed-translate);
|
|
3076
3074
|
}
|
|
3077
3075
|
}
|
|
3078
3076
|
}
|