@plexui/ui 0.7.15 → 0.7.17
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/es/components/FloatingLabelSelect/FloatingLabelSelect.js +50 -0
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -0
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.module.css +145 -0
- package/dist/es/components/FloatingLabelSelect/index.js +2 -0
- package/dist/es/components/FloatingLabelSelect/index.js.map +1 -0
- package/dist/types/components/FloatingLabelSelect/FloatingLabelSelect.d.ts +26 -0
- package/dist/types/components/FloatingLabelSelect/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { forwardRef, useCallback, useId } from "react";
|
|
5
|
+
import { FieldError } from "../FieldError";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
import { Dropdown, X } from "../Icon";
|
|
8
|
+
import s from "./FloatingLabelSelect.module.css";
|
|
9
|
+
export const FloatingLabelSelect = forwardRef(function FloatingLabelSelect(props, ref) {
|
|
10
|
+
const { label, selected = false, errorMessage, "invalid": invalidProp, disabled = false, open = false, onInteract, onClearClick, children, className, "aria-describedby": ariaDescribedByProp, onKeyDown, ...restProps } = props;
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const errorId = `floating-label-select-${generatedId}-error`;
|
|
13
|
+
const invalid = invalidProp ?? !!errorMessage;
|
|
14
|
+
const showClearButton = !!onClearClick && selected && !disabled;
|
|
15
|
+
const ariaDescribedBy = [ariaDescribedByProp, errorMessage ? errorId : undefined].filter(Boolean).join(" ") ||
|
|
16
|
+
undefined;
|
|
17
|
+
const handlePointerDown = useCallback((evt) => {
|
|
18
|
+
if (evt.button === 2 || disabled)
|
|
19
|
+
return;
|
|
20
|
+
evt.preventDefault();
|
|
21
|
+
onInteract?.();
|
|
22
|
+
}, [disabled, onInteract]);
|
|
23
|
+
const handleKeyDown = useCallback((evt) => {
|
|
24
|
+
onKeyDown?.(evt);
|
|
25
|
+
if (disabled)
|
|
26
|
+
return;
|
|
27
|
+
switch (evt.key) {
|
|
28
|
+
case "ArrowDown":
|
|
29
|
+
case "ArrowUp":
|
|
30
|
+
case " ":
|
|
31
|
+
evt.stopPropagation();
|
|
32
|
+
evt.preventDefault();
|
|
33
|
+
onInteract?.();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}, [disabled, onInteract, onKeyDown]);
|
|
37
|
+
const handleClearPointerDown = useCallback((evt) => {
|
|
38
|
+
evt.stopPropagation();
|
|
39
|
+
}, []);
|
|
40
|
+
const handleClearClick = useCallback((evt) => {
|
|
41
|
+
evt.stopPropagation();
|
|
42
|
+
evt.preventDefault();
|
|
43
|
+
onClearClick?.();
|
|
44
|
+
}, [onClearClick]);
|
|
45
|
+
return (_jsxs("div", { className: clsx(s.Root, className), ref: ref, children: [_jsxs("div", { className: clsx(s.FieldFootprint, {
|
|
46
|
+
[s.HasValue]: selected,
|
|
47
|
+
}), role: "button", tabIndex: disabled ? -1 : 0, "data-open": open ? "" : undefined, "data-invalid": invalid ? "" : undefined, "data-disabled": disabled ? "" : undefined, "aria-expanded": open, "aria-haspopup": "listbox", "aria-invalid": invalid ? true : undefined, "aria-describedby": ariaDescribedBy, "aria-disabled": disabled || undefined, onPointerDown: handlePointerDown, onKeyDown: handleKeyDown, ...restProps, children: [_jsx("div", { className: s.TypeableLabel, children: _jsx("div", { className: s.LabelPositioner, children: _jsx("div", { className: s.LabelText, children: label }) }) }), _jsx("span", { className: s.Content, children: selected ? children : null }), _jsxs("div", { className: s.IndicatorWrapper, children: [showClearButton && (_jsx(Button, { "aria-label": "Clear selection", className: s.Clear, onPointerDown: handleClearPointerDown, onClick: handleClearClick, color: "secondary", variant: "ghost", size: "3xs", uniform: true, pill: true, children: _jsx(X, {}) })), _jsx(Dropdown, { className: s.DropdownIcon })] })] }), errorMessage && (_jsx(FieldError, { id: errorId, className: s.ErrorMessage, children: errorMessage }))] }));
|
|
48
|
+
});
|
|
49
|
+
FloatingLabelSelect.displayName = "FloatingLabelSelect";
|
|
50
|
+
//# sourceMappingURL=FloatingLabelSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingLabelSelect.js","sourceRoot":"","sources":["../../../../src/components/FloatingLabelSelect/FloatingLabelSelect.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,CAAC,MAAM,kCAAkC,CAAA;AAmBhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAC3C,SAAS,mBAAmB,CAAC,KAAK,EAAE,GAAG;IACrC,MAAM,EACJ,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,YAAY,EACZ,SAAS,EAAE,WAAW,EACtB,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,KAAK,EACZ,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,kBAAkB,EAAE,mBAAmB,EACvC,SAAS,EACT,GAAG,SAAS,EACb,GAAG,KAAK,CAAA;IAET,MAAM,WAAW,GAAG,KAAK,EAAE,CAAA;IAC3B,MAAM,OAAO,GAAG,yBAAyB,WAAW,QAAQ,CAAA;IAE5D,MAAM,OAAO,GAAG,WAAW,IAAI,CAAC,CAAC,YAAY,CAAA;IAE7C,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,IAAI,QAAQ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C,OAAO,EACf,IAAI,EAAC,KAAK,EACV,OAAO,QACP,IAAI,kBAEJ,KAAC,CAAC,KAAG,GACE,CACV,EACD,KAAC,QAAQ,IAAC,SAAS,EAAE,CAAC,CAAC,YAAY,GAAI,IACnC,IACF,EACL,YAAY,IAAI,CACf,KAAC,UAAU,IAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,YAAY,YAC/C,YAAY,GACF,CACd,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { forwardRef, useCallback, useId } from \"react\"\n\nimport { FieldError } from \"../FieldError\"\nimport { Button } from \"../Button\"\nimport { Dropdown, X } from \"../Icon\"\n\nimport s from \"./FloatingLabelSelect.module.css\"\n\nexport type FloatingLabelSelectProps = {\n label: string\n selected?: boolean\n errorMessage?: string\n invalid?: boolean\n disabled?: boolean\n open?: boolean\n onInteract?: () => void\n onClearClick?: () => void\n children?: React.ReactNode\n className?: string\n \"aria-describedby\"?: string\n} & Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"children\" | \"role\" | \"tabIndex\" | \"aria-describedby\"\n>\n\nexport const FloatingLabelSelect = forwardRef<HTMLDivElement, FloatingLabelSelectProps>(\n function FloatingLabelSelect(props, ref) {\n const {\n label,\n selected = false,\n errorMessage,\n \"invalid\": invalidProp,\n disabled = false,\n open = false,\n onInteract,\n onClearClick,\n children,\n className,\n \"aria-describedby\": ariaDescribedByProp,\n onKeyDown,\n ...restProps\n } = props\n\n const generatedId = useId()\n const errorId = `floating-label-select-${generatedId}-error`\n\n const invalid = invalidProp ?? !!errorMessage\n\n const showClearButton = !!onClearClick && selected && !disabled\n\n const ariaDescribedBy =\n [ariaDescribedByProp, errorMessage ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined\n\n const handlePointerDown = useCallback(\n (evt: React.PointerEvent<HTMLDivElement>) => {\n if (evt.button === 2 || disabled) return\n evt.preventDefault()\n onInteract?.()\n },\n [disabled, onInteract],\n )\n\n const handleKeyDown = useCallback(\n (evt: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(evt)\n if (disabled) return\n\n switch (evt.key) {\n case \"ArrowDown\":\n case \"ArrowUp\":\n case \" \":\n evt.stopPropagation()\n evt.preventDefault()\n onInteract?.()\n break\n }\n },\n [disabled, onInteract, onKeyDown],\n )\n\n const handleClearPointerDown = useCallback((evt: React.PointerEvent<HTMLButtonElement>) => {\n evt.stopPropagation()\n }, [])\n\n const handleClearClick = useCallback(\n (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.stopPropagation()\n evt.preventDefault()\n onClearClick?.()\n },\n [onClearClick],\n )\n\n return (\n <div className={clsx(s.Root, className)} ref={ref}>\n <div\n className={clsx(s.FieldFootprint, {\n [s.HasValue]: selected,\n })}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n data-open={open ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-invalid={invalid ? true : undefined}\n aria-describedby={ariaDescribedBy}\n aria-disabled={disabled || undefined}\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n {...restProps}\n >\n <div className={s.TypeableLabel}>\n <div className={s.LabelPositioner}>\n <div className={s.LabelText}>{label}</div>\n </div>\n </div>\n <span className={s.Content}>{selected ? children : null}</span>\n <div className={s.IndicatorWrapper}>\n {showClearButton && (\n <Button\n aria-label=\"Clear selection\"\n className={s.Clear}\n onPointerDown={handleClearPointerDown}\n onClick={handleClearClick}\n color=\"secondary\"\n variant=\"ghost\"\n size=\"3xs\"\n uniform\n pill\n >\n <X />\n </Button>\n )}\n <Dropdown className={s.DropdownIcon} />\n </div>\n </div>\n {errorMessage && (\n <FieldError id={errorId} className={s.ErrorMessage}>\n {errorMessage}\n </FieldError>\n )}\n </div>\n )\n },\n)\n\nFloatingLabelSelect.displayName = \"FloatingLabelSelect\"\n"]}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
@layer components {.Root {
|
|
2
|
+
position: relative;
|
|
3
|
+
--field-error-padding-inline: 0;
|
|
4
|
+
--field-error-margin-top: 0.25rem;
|
|
5
|
+
}.Root:has([data-disabled]) {
|
|
6
|
+
--cursor: not-allowed;
|
|
7
|
+
opacity: 0.5;
|
|
8
|
+
}.FieldFootprint {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: stretch;
|
|
13
|
+
height: var(--floating-input-height);
|
|
14
|
+
border-radius: var(--floating-input-border-radius);
|
|
15
|
+
line-height: 1.5rem;
|
|
16
|
+
color: var(--color-text);
|
|
17
|
+
font-size: 1rem;
|
|
18
|
+
width: 100%;
|
|
19
|
+
border: 1px solid var(--input-state-color, var(--floating-input-border-color));
|
|
20
|
+
padding: 0 var(--floating-input-gutter);
|
|
21
|
+
background-color: var(--floating-input-background);
|
|
22
|
+
cursor: var(--cursor, pointer);
|
|
23
|
+
transition: border-color var(--floating-input-transition-duration) ease-in-out;
|
|
24
|
+
-webkit-user-select: none;
|
|
25
|
+
-moz-user-select: none;
|
|
26
|
+
user-select: none;
|
|
27
|
+
}.FieldFootprint:hover:not([data-disabled]) {
|
|
28
|
+
border-color: var(--input-state-color, var(--floating-input-border-color-hover));
|
|
29
|
+
}.FieldFootprint[data-focused] {
|
|
30
|
+
--input-state-color: var(--floating-input-border-color-focus);
|
|
31
|
+
}.FieldFootprint[data-open] {
|
|
32
|
+
--input-state-color: var(--floating-input-border-color-focus);
|
|
33
|
+
}.FieldFootprint[data-invalid] {
|
|
34
|
+
--input-state-color: var(--floating-input-border-color-invalid);
|
|
35
|
+
}/* Focus ring */.FieldFootprint:focus-visible {
|
|
36
|
+
outline: 2px solid var(--color-ring);
|
|
37
|
+
outline-offset: 1px;
|
|
38
|
+
}/* Label container - positioned absolutely */.TypeableLabel {
|
|
39
|
+
cursor: var(--cursor, pointer);
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset: 0;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
}/* Label background overlay - covers content when not selected */.TypeableLabel::before {
|
|
44
|
+
content: "";
|
|
45
|
+
display: block;
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
border-radius: var(--floating-input-border-radius);
|
|
49
|
+
background-color: var(--floating-input-background);
|
|
50
|
+
}/* Label text positioner */.LabelPositioner {
|
|
51
|
+
--placeholder-transition: transform var(--floating-input-transition-duration) ease-in-out;
|
|
52
|
+
position: absolute;
|
|
53
|
+
inset: 0;
|
|
54
|
+
padding: 0 var(--floating-input-gutter);
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
transition: var(--placeholder-transition);
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}/* Label text */.LabelText {
|
|
60
|
+
--horizontal-padding: 6px;
|
|
61
|
+
background-color: var(--floating-input-background);
|
|
62
|
+
padding: 1px var(--horizontal-padding);
|
|
63
|
+
transition: var(--placeholder-transition);
|
|
64
|
+
color: var(--input-state-color, var(--floating-input-label-color));
|
|
65
|
+
font-size: 1rem;
|
|
66
|
+
line-height: 1;
|
|
67
|
+
cursor: var(--cursor, pointer);
|
|
68
|
+
transform: translate(calc(-1 * var(--horizontal-padding)));
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
max-width: calc(100% - var(--floating-input-gutter) * 2);
|
|
73
|
+
}/* Float state - label moves up */.FieldFootprint[data-open] .TypeableLabel,
|
|
74
|
+
.FieldFootprint[data-invalid] .TypeableLabel,
|
|
75
|
+
.HasValue .TypeableLabel {
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}.FieldFootprint[data-open] .TypeableLabel::before,
|
|
78
|
+
.FieldFootprint[data-invalid] .TypeableLabel::before,
|
|
79
|
+
.HasValue .TypeableLabel::before {
|
|
80
|
+
display: none;
|
|
81
|
+
}.FieldFootprint[data-open] .LabelPositioner,
|
|
82
|
+
.FieldFootprint[data-invalid] .LabelPositioner,
|
|
83
|
+
.HasValue .LabelPositioner {
|
|
84
|
+
transform: translateY(-50%);
|
|
85
|
+
}.FieldFootprint[data-open] .LabelText,
|
|
86
|
+
.FieldFootprint[data-invalid] .LabelText,
|
|
87
|
+
.HasValue .LabelText {
|
|
88
|
+
transform: translate(-12px) scale(var(--floating-input-label-scale));
|
|
89
|
+
max-width: 133%;
|
|
90
|
+
}/* Focus/open label color */.FieldFootprint[data-focused] .LabelText,
|
|
91
|
+
.FieldFootprint[data-open] .LabelText {
|
|
92
|
+
color: var(--floating-input-label-color-focus);
|
|
93
|
+
}/* Invalid label color */.FieldFootprint[data-invalid] .LabelText {
|
|
94
|
+
color: var(--floating-input-label-color-invalid);
|
|
95
|
+
}/* Content area (selected value) */.Content {
|
|
96
|
+
position: relative;
|
|
97
|
+
z-index: 1;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 8px;
|
|
101
|
+
flex: 1;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
overflow-x: clip;
|
|
104
|
+
text-overflow: ellipsis;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
color: inherit;
|
|
107
|
+
}/* Indicator wrapper — mirrors SelectControl IndicatorWrapper at 3xl size */.IndicatorWrapper {
|
|
108
|
+
position: relative;
|
|
109
|
+
z-index: 1;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 6px;
|
|
113
|
+
padding-left: 4px;
|
|
114
|
+
}/* Clear button — using Button component, sizing matches SelectControl 3xl */.Clear {
|
|
115
|
+
--button-size: 24px;
|
|
116
|
+
--button-icon-size: 16px;
|
|
117
|
+
|
|
118
|
+
position: relative;
|
|
119
|
+
opacity: 0.75;
|
|
120
|
+
}.FieldFootprint:hover:not([data-disabled]) .Clear,
|
|
121
|
+
.FieldFootprint[data-open] .Clear,
|
|
122
|
+
.Clear:focus-visible {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}/* Dropdown icon — matches SelectControl 3xl: 9×13 */.DropdownIcon {
|
|
125
|
+
position: relative;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
width: 9px;
|
|
128
|
+
height: 13px;
|
|
129
|
+
color: var(--color-text-secondary);
|
|
130
|
+
opacity: 0.75;
|
|
131
|
+
transition: opacity var(--floating-input-transition-duration) ease-in-out;
|
|
132
|
+
}.FieldFootprint:hover:not([data-disabled]) .DropdownIcon {
|
|
133
|
+
opacity: 1;
|
|
134
|
+
}.FieldFootprint[data-open] .DropdownIcon {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
}/* Error message spacing */.ErrorMessage {
|
|
137
|
+
margin-top: var(--field-error-margin-top);
|
|
138
|
+
}/* Reduced motion preference */@media (prefers-reduced-motion: reduce) {
|
|
139
|
+
.FieldFootprint,
|
|
140
|
+
.LabelPositioner,
|
|
141
|
+
.LabelText {
|
|
142
|
+
transition: none;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/FloatingLabelSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiC,MAAM,uBAAuB,CAAA","sourcesContent":["export { FloatingLabelSelect, type FloatingLabelSelectProps } from \"./FloatingLabelSelect\"\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type FloatingLabelSelectProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
errorMessage?: string;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
onInteract?: () => void;
|
|
9
|
+
onClearClick?: () => void;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
"aria-describedby"?: string;
|
|
13
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "role" | "tabIndex" | "aria-describedby">;
|
|
14
|
+
export declare const FloatingLabelSelect: import("react").ForwardRefExoticComponent<{
|
|
15
|
+
label: string;
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
onInteract?: () => void;
|
|
22
|
+
onClearClick?: () => void;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
"aria-describedby"?: string;
|
|
26
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "children" | "role" | "tabIndex" | "aria-describedby"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FloatingLabelSelect, type FloatingLabelSelectProps } from "./FloatingLabelSelect";
|