@acronis-platform/ui-react 0.62.0 → 1.0.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/ui/alert/alert.js +115 -57
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/button-group/button-group.js +57 -0
- package/dist/components/ui/button-group/button-group.js.map +1 -0
- package/dist/components/ui/button-icon-menu/button-icon-menu.js +26 -0
- package/dist/components/ui/button-icon-menu/button-icon-menu.js.map +1 -0
- package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -1
- package/dist/components/ui/chip/chip.js +33 -33
- package/dist/components/ui/chip/chip.js.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker-utils.js +11 -23
- package/dist/components/ui/date-range-picker/date-range-picker-utils.js.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.js +94 -134
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +129 -72
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/filter-chips/filter-chips.js +44 -0
- package/dist/components/ui/filter-chips/filter-chips.js.map +1 -0
- package/dist/components/ui/filter-search/filter-search.js +184 -138
- package/dist/components/ui/filter-search/filter-search.js.map +1 -1
- package/dist/components/ui/fitted-actions/fitted-actions.js +139 -0
- package/dist/components/ui/fitted-actions/fitted-actions.js.map +1 -0
- package/dist/components/ui/input-date-picker/input-date-picker.js +103 -93
- package/dist/components/ui/input-date-picker/input-date-picker.js.map +1 -1
- package/dist/components/ui/input-password/input-password.js +76 -66
- package/dist/components/ui/input-password/input-password.js.map +1 -1
- package/dist/components/ui/input-search/input-search.js +9 -9
- package/dist/components/ui/input-search/input-search.js.map +1 -1
- package/dist/components/ui/input-select/input-select.js +8 -8
- package/dist/components/ui/input-select/input-select.js.map +1 -1
- package/dist/components/ui/input-text/input-text.js +77 -66
- package/dist/components/ui/input-text/input-text.js.map +1 -1
- package/dist/components/ui/input-text-area/input-text-area.js +76 -66
- package/dist/components/ui/input-text-area/input-text-area.js.map +1 -1
- package/dist/components/ui/link/link.js +50 -35
- package/dist/components/ui/link/link.js.map +1 -1
- package/dist/components/ui/number-field/number-field.js +1 -1
- package/dist/components/ui/number-field/number-field.js.map +1 -1
- package/dist/components/ui/popover/popover.js +75 -56
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +46 -30
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/timer/timer.js +47 -0
- package/dist/components/ui/timer/timer.js.map +1 -0
- package/dist/components/ui/toast/toast.js +168 -61
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/truncate-text/middle-truncate.js +20 -0
- package/dist/components/ui/truncate-text/middle-truncate.js.map +1 -0
- package/dist/components/ui/truncate-text/text-width.js +12 -0
- package/dist/components/ui/truncate-text/text-width.js.map +1 -0
- package/dist/components/ui/truncate-text/truncate-text.js +152 -0
- package/dist/components/ui/truncate-text/truncate-text.js.map +1 -0
- package/dist/index.js +505 -473
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js +5 -5
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js.map +1 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js +3 -6
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js.map +1 -1
- package/dist/react.js +505 -473
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/alert/alert.d.ts +34 -3
- package/dist/src/components/ui/alert/index.d.ts +2 -2
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/button-group/button-group.d.ts +38 -0
- package/dist/src/components/ui/button-group/index.d.ts +1 -0
- package/dist/src/components/ui/button-icon/button-icon.d.ts +1 -1
- package/dist/src/components/ui/button-icon-menu/button-icon-menu.d.ts +28 -0
- package/dist/src/components/ui/button-icon-menu/index.d.ts +1 -0
- package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
- package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +2 -2
- package/dist/src/components/ui/chip/chip.d.ts +1 -1
- package/dist/src/components/ui/date-range-picker/date-range-picker-utils.d.ts +10 -16
- package/dist/src/components/ui/date-range-picker/date-range-picker.d.ts +46 -2
- package/dist/src/components/ui/dropdown-menu/dropdown-menu.d.ts +8 -1
- package/dist/src/components/ui/dropdown-menu/index.d.ts +1 -1
- package/dist/src/components/ui/filter-chips/filter-chips.d.ts +25 -0
- package/dist/src/components/ui/filter-chips/index.d.ts +1 -0
- package/dist/src/components/ui/filter-search/filter-search.d.ts +39 -1
- package/dist/src/components/ui/fitted-actions/fitted-actions.d.ts +50 -0
- package/dist/src/components/ui/fitted-actions/fitted-actions.docs.d.ts +45 -0
- package/dist/src/components/ui/fitted-actions/index.d.ts +1 -0
- package/dist/src/components/ui/link/index.d.ts +1 -1
- package/dist/src/components/ui/link/link.d.ts +22 -4
- package/dist/src/components/ui/metric/metric.d.ts +1 -1
- package/dist/src/components/ui/popover/popover.d.ts +30 -1
- package/dist/src/components/ui/popover/popover.docs.d.ts +27 -2
- package/dist/src/components/ui/scroll-area/scroll-area.d.ts +24 -0
- package/dist/src/components/ui/tag/tag.d.ts +1 -1
- package/dist/src/components/ui/timer/index.d.ts +1 -0
- package/dist/src/components/ui/timer/timer.d.ts +28 -0
- package/dist/src/components/ui/toast/index.d.ts +1 -1
- package/dist/src/components/ui/toast/toast.d.ts +51 -18
- package/dist/src/components/ui/toast/toast.docs.d.ts +4 -0
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +1 -1
- package/dist/src/components/ui/truncate-text/__tests__/middle-truncate.test.d.ts +1 -0
- package/dist/src/components/ui/truncate-text/index.d.ts +3 -0
- package/dist/src/components/ui/truncate-text/middle-truncate.d.ts +13 -0
- package/dist/src/components/ui/truncate-text/text-width.d.ts +11 -0
- package/dist/src/components/ui/truncate-text/truncate-text.d.ts +45 -0
- package/dist/src/components/ui/truncate-text/truncate-text.docs.d.ts +35 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js +0 -8
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js +0 -9
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js +0 -23
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js +0 -42
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js +0 -62
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +0 -52
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js +0 -34
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +0 -22
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +0 -23
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +0 -33
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +0 -33
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +0 -34
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +0 -34
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +0 -106
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +0 -49
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -49
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +0 -41
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +0 -81
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +0 -49
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +0 -70
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +0 -33
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +0 -78
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +0 -76
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +0 -33
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -81
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +0 -78
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +0 -76
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -23
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +0 -23
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js +0 -50
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js +0 -68
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js +0 -104
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js +0 -86
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js +0 -12
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js +0 -11
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js +0 -10
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js +0 -10
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js.map +0 -1
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js +0 -18
- package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js.map +0 -1
|
@@ -26,7 +26,7 @@ const Y = c.Group, T = a.forwardRef(({ className: t, ...e }, r) => /* @__PURE__
|
|
|
26
26
|
{
|
|
27
27
|
ref: r,
|
|
28
28
|
className: s(
|
|
29
|
-
"flex
|
|
29
|
+
"flex min-w-[var(--ui-input-select-global-container-width-min)] flex-col gap-[var(--ui-input-select-global-container-gap)]",
|
|
30
30
|
t
|
|
31
31
|
),
|
|
32
32
|
...e
|
|
@@ -73,7 +73,7 @@ const P = a.forwardRef(({ className: t, children: e, ...r }, i) => /* @__PURE__
|
|
|
73
73
|
...r,
|
|
74
74
|
children: [
|
|
75
75
|
e,
|
|
76
|
-
/* @__PURE__ */ o(c.Icon, { className: "flex shrink-0 items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] group-data-[disabled]:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]", children: /* @__PURE__ */ o(
|
|
76
|
+
/* @__PURE__ */ o(c.Icon, { className: "flex size-[var(--ui-input-select-global-icon-box-size)] shrink-0 items-center justify-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] group-data-[disabled]:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]", children: /* @__PURE__ */ o(
|
|
77
77
|
f,
|
|
78
78
|
{
|
|
79
79
|
size: 16,
|
|
@@ -84,7 +84,7 @@ const P = a.forwardRef(({ className: t, children: e, ...r }, i) => /* @__PURE__
|
|
|
84
84
|
}
|
|
85
85
|
));
|
|
86
86
|
P.displayName = "InputSelectTrigger";
|
|
87
|
-
const
|
|
87
|
+
const j = a.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ o(
|
|
88
88
|
c.Value,
|
|
89
89
|
{
|
|
90
90
|
ref: r,
|
|
@@ -96,8 +96,8 @@ const G = a.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ o(
|
|
|
96
96
|
...e
|
|
97
97
|
}
|
|
98
98
|
));
|
|
99
|
-
|
|
100
|
-
const
|
|
99
|
+
j.displayName = "InputSelectValue";
|
|
100
|
+
const G = a.forwardRef(
|
|
101
101
|
({
|
|
102
102
|
className: t,
|
|
103
103
|
children: e,
|
|
@@ -132,7 +132,7 @@ const j = a.forwardRef(
|
|
|
132
132
|
) });
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
|
-
|
|
135
|
+
G.displayName = "InputSelectContent";
|
|
136
136
|
const q = a.forwardRef(({ className: t, value: e, onChange: r, onKeyDown: i, ...l }, d) => {
|
|
137
137
|
const n = a.useContext(g), u = n == null ? void 0 : n.setQuery, b = e !== void 0;
|
|
138
138
|
return a.useEffect(() => {
|
|
@@ -321,7 +321,7 @@ const A = a.forwardRef(
|
|
|
321
321
|
A.displayName = "InputSelectStatus";
|
|
322
322
|
export {
|
|
323
323
|
E as InputSelect,
|
|
324
|
-
|
|
324
|
+
G as InputSelectContent,
|
|
325
325
|
Q as InputSelectDescription,
|
|
326
326
|
_ as InputSelectError,
|
|
327
327
|
B as InputSelectExpander,
|
|
@@ -334,7 +334,7 @@ export {
|
|
|
334
334
|
W as InputSelectSectionLabel,
|
|
335
335
|
A as InputSelectStatus,
|
|
336
336
|
P as InputSelectTrigger,
|
|
337
|
-
|
|
337
|
+
j as InputSelectValue,
|
|
338
338
|
X as useInputSelectFilter
|
|
339
339
|
};
|
|
340
340
|
//# sourceMappingURL=input-select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-select.js","sources":["../../../../src/components/ui/input-select/input-select.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleWarningIcon,\n InboxIcon,\n MagnifierIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// The next-gen select, themed by the dedicated `--ui-input-select-*` tier (global /\n// normal / error / dropdown). It composes Base UI `Select` and adds the field\n// furniture (label, required, description, error) and the dropdown machinery\n// (in-dropdown search, sections/groups, single + multiple items, loading/empty/error\n// status). The trigger box wires each state to its own token — idle / hover / open\n// (`data-popup-open`) + focus ring / disabled — and switches to the error border +\n// `--ui-focus-error` ring when `aria-invalid` is set. Selection mode (single vs\n// multiple) flows from the `multiple` prop on the root via `InputSelectModeContext`:\n// single items toggle the row background and show a trailing check; multiple items\n// keep the row background and show a leading checkbox.\n\nconst InputSelectModeContext = React.createContext(false);\n\ninterface InputSelectFilterContextValue {\n /** Current in-dropdown search query. */\n query: string;\n /** Update the search query. */\n setQuery: (query: string) => void;\n}\n\nconst InputSelectFilterContext =\n React.createContext<InputSelectFilterContextValue | null>(null);\n\n/**\n * Read the live in-dropdown search query (and its setter) from the nearest\n * `InputSelect`. Flat item lists filter themselves; use this for hierarchical\n * (tree) dropdowns that need to compute their own visibility.\n */\nfunction useInputSelectFilter(): InputSelectFilterContextValue {\n const context = React.useContext(InputSelectFilterContext);\n if (!context) {\n throw new Error('useInputSelectFilter must be used within <InputSelect>.');\n }\n return context;\n}\n\nfunction InputSelect<Value, Multiple extends boolean | undefined = false>(\n props: SelectPrimitive.Root.Props<Value, Multiple>\n) {\n const { onOpenChange } = props;\n const [query, setQuery] = React.useState('');\n const filter = React.useMemo(() => ({ query, setQuery }), [query]);\n\n // Reset the query when the popup closes so it reopens unfiltered.\n const handleOpenChange = React.useCallback<\n NonNullable<SelectPrimitive.Root.Props<Value, Multiple>['onOpenChange']>\n >(\n (open, eventDetails) => {\n onOpenChange?.(open, eventDetails);\n if (!open) {\n setQuery('');\n }\n },\n [onOpenChange]\n );\n\n return (\n <InputSelectModeContext.Provider value={Boolean(props.multiple)}>\n <InputSelectFilterContext.Provider value={filter}>\n <SelectPrimitive.Root {...props} onOpenChange={handleOpenChange} />\n </InputSelectFilterContext.Provider>\n </InputSelectModeContext.Provider>\n );\n}\nInputSelect.displayName = 'InputSelect';\n\nconst InputSelectGroup = SelectPrimitive.Group;\n\n/** Vertical field stack: label, trigger, description/error. */\nconst InputSelectField = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex w-full min-w-[var(--ui-input-select-global-container-width-min)] flex-col gap-[var(--ui-input-select-global-container-gap)]',\n className\n )}\n {...props}\n />\n));\nInputSelectField.displayName = 'InputSelectField';\n\nconst InputSelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> & {\n /** Appends a required `*` after the label text. */\n required?: boolean;\n }\n>(({ className, children, required, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n 'flex gap-[var(--ui-input-select-global-container-label-gap)] text-sm leading-4 text-[var(--ui-input-select-global-label-color-idle)] data-[disabled]:text-[var(--ui-input-select-global-label-color-disabled)]',\n className\n )}\n {...props}\n >\n {children}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-select-global-required-color)]\"\n >\n *\n </span>\n )}\n </SelectPrimitive.Label>\n));\nInputSelectLabel.displayName = 'InputSelectLabel';\n\nconst InputSelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex h-[var(--ui-input-select-global-box-height)] w-full min-w-0 items-center gap-[var(--ui-input-select-global-box-gap)] rounded-[var(--ui-input-select-global-box-border-radius)] border bg-[var(--ui-input-select-global-box-color-idle)] border-[var(--ui-input-select-normal-box-border-color-idle)] px-[var(--ui-input-select-global-box-padding-x)] text-sm leading-6 text-[var(--ui-input-select-global-value-color-idle)] outline-none transition-colors',\n 'not-data-[disabled]:hover:bg-[var(--ui-input-select-global-box-color-hover)] not-data-[disabled]:hover:border-[var(--ui-input-select-normal-box-border-color-hover)]',\n 'focus-visible:border-[var(--ui-input-select-normal-box-border-color-hover)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)]',\n 'data-[popup-open]:border-[var(--ui-input-select-normal-box-border-color-hover)] data-[popup-open]:ring-[3px] data-[popup-open]:ring-[var(--ui-focus-primary)]',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:border-[var(--ui-input-select-normal-box-border-color-disabled)] data-[disabled]:bg-[var(--ui-input-select-global-box-color-disabled)] data-[disabled]:text-[var(--ui-input-select-global-value-color-disabled)]',\n // Error treatment (driven by `aria-invalid`).\n 'aria-invalid:border-[var(--ui-input-select-error-box-border-color-idle)] not-data-[disabled]:aria-invalid:hover:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:focus-visible:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:focus-visible:ring-[var(--ui-focus-error)] aria-invalid:data-[popup-open]:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:data-[popup-open]:ring-[var(--ui-focus-error)]',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon className=\"flex shrink-0 items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] group-data-[disabled]:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]\">\n <ChevronDownIcon\n size={16}\n className=\"transition-transform group-data-[popup-open]:rotate-180\"\n />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nInputSelectTrigger.displayName = 'InputSelectTrigger';\n\nconst InputSelectValue = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Value>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Value\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 truncate text-start text-[var(--ui-input-select-global-value-color-idle)] data-[placeholder]:text-[var(--ui-input-select-global-placeholder-color-idle)]',\n 'group-data-[disabled]:!text-[var(--ui-input-select-global-value-color-disabled)] group-data-[disabled]:data-[placeholder]:!text-[var(--ui-input-select-global-placeholder-color-disabled)]',\n className\n )}\n {...props}\n />\n));\nInputSelectValue.displayName = 'InputSelectValue';\n\nconst InputSelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Popup> & {\n sideOffset?: number;\n align?: SelectPrimitive.Positioner.Props['align'];\n side?: SelectPrimitive.Positioner.Props['side'];\n /**\n * Container to portal the dropdown into. Defaults to the document body;\n * pass an element to scope the portal (e.g. a shadow root, so the popup\n * inherits styles defined there).\n */\n portalContainer?: SelectPrimitive.Portal.Props['container'];\n }\n>(\n (\n {\n className,\n children,\n sideOffset = 4,\n align = 'start',\n side = 'bottom',\n portalContainer,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <SelectPrimitive.Portal container={resolvedContainer}>\n <SelectPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n side={side}\n alignItemWithTrigger={false}\n className=\"z-50 outline-none\"\n >\n <SelectPrimitive.Popup\n ref={ref}\n className={cn(\n 'max-h-[var(--available-height)] min-w-[var(--anchor-width)] overflow-y-auto rounded-[var(--ui-input-select-dropdown-container-border-radius)] border border-[var(--ui-input-select-dropdown-container-border-color)] bg-[var(--ui-input-select-dropdown-container-color)] py-[var(--ui-input-select-dropdown-container-padding-y)] text-sm shadow-md outline-none',\n className\n )}\n {...props}\n >\n {children}\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n }\n);\nInputSelectContent.displayName = 'InputSelectContent';\n\n/**\n * In-dropdown search row (magnifier + input). By default it drives the\n * `InputSelect` filter context — flat `InputSelectItem`s filter themselves, and\n * tree dropdowns read the query via `useInputSelectFilter`. Pass `value`/`onChange`\n * to control the query externally.\n */\nconst InputSelectSearch = React.forwardRef<\n HTMLInputElement,\n React.ComponentPropsWithoutRef<'input'>\n>(({ className, value, onChange, onKeyDown, ...props }, ref) => {\n const filter = React.useContext(InputSelectFilterContext);\n const setQuery = filter?.setQuery;\n const controlled = value !== undefined;\n\n // When the query is controlled externally, the consumer's `value` is the\n // source of truth for what's displayed, so keep the internal filter context\n // (what flat items match against) synced to it. A prop-driven value change —\n // a \"clear\" button resetting to '', a debounced/transformed value — doesn't\n // fire `onChange`, so driving the filter off raw DOM events alone would leave\n // `filter.query` stale and hide every item against a query the box no longer\n // shows. `setQuery` is a stable state setter, so this runs only when `value`\n // changes.\n React.useEffect(() => {\n if (controlled) {\n setQuery?.(String(value ?? ''));\n }\n }, [controlled, value, setQuery]);\n\n return (\n <div className=\"flex items-center gap-[var(--ui-input-select-dropdown-dropdown-search-gap)] px-[var(--ui-input-select-dropdown-dropdown-search-padding-x)] py-[var(--ui-input-select-dropdown-dropdown-search-padding-y)]\">\n <MagnifierIcon\n size={16}\n className=\"shrink-0 text-[var(--ui-glyph-on-surface-primary)]\"\n />\n <input\n ref={ref}\n type=\"search\"\n value={value ?? filter?.query ?? ''}\n onChange={(event) => {\n onChange?.(event);\n // Uncontrolled: the input's value *is* the filter query, so write it\n // straight through. Controlled: the effect above syncs the filter to\n // the consumer's `value` once it re-renders, avoiding a flash of raw\n // typed text when the consumer debounces or transforms the value.\n if (!controlled) {\n filter?.setQuery(event.currentTarget.value);\n }\n }}\n // Base UI Select's typeahead would consume printable keys before they\n // reach this input, so stop those from bubbling — but let navigation and\n // selection keys (Arrow*/Home/End/Enter/Escape, all multi-char `key`\n // names) through so the user can move from the search box into the\n // filtered list and pick a result with the keyboard.\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n }}\n className={cn(\n 'min-w-0 flex-1 border-0 bg-transparent p-0 text-sm leading-6 text-[var(--ui-input-select-dropdown-dropdown-search-label-color-value)] outline-none placeholder:text-[var(--ui-input-select-dropdown-dropdown-search-label-color-placeholder)] [&::-webkit-search-cancel-button]:appearance-none',\n className\n )}\n {...props}\n />\n </div>\n );\n});\nInputSelectSearch.displayName = 'InputSelectSearch';\n\n/** A section (group) of items with an optional header. Divided by a top border. */\nconst InputSelectSection = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Group\n ref={ref}\n className={cn(\n 'flex flex-col border-t border-[var(--ui-input-select-dropdown-section-container-border-color)] py-[var(--ui-input-select-dropdown-section-container-padding-y)] first:border-t-0',\n className\n )}\n {...props}\n />\n));\nInputSelectSection.displayName = 'InputSelectSection';\n\nconst InputSelectSectionLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.GroupLabel>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.GroupLabel>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.GroupLabel\n ref={ref}\n className={cn(\n 'px-[var(--ui-input-select-dropdown-section-container-header-padding-x)] py-[var(--ui-input-select-dropdown-section-container-header-padding-y)] text-sm font-semibold leading-6 text-[var(--ui-input-select-dropdown-section-label-group-color)]',\n className\n )}\n {...props}\n />\n));\nInputSelectSectionLabel.displayName = 'InputSelectSectionLabel';\n\n/**\n * Width (px) of the leading nesting spacer for a 1-based tree `indent` level, per\n * the Figma \"InputSelectDropdownTenants\" spec: level 1 reserves 16 px (enough for a\n * single chevron) and each deeper level adds 24 px — 16 / 40 / 64 for levels 1–3.\n * The tenant icon therefore starts at the same x-position whether or not the row is\n * expandable, because the chevron lives right-aligned inside this reserved space.\n */\nconst NESTING_BASE = 16;\nconst NESTING_STEP = 24;\nfunction nestingWidth(indent: number): number {\n return NESTING_BASE + (indent - 1) * NESTING_STEP;\n}\n\nexport interface InputSelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Optional leading icon rendered before the label text. Colored by `--ui-input-select-dropdown-item-global-icon-tenant`. */\n icon?: React.ReactNode;\n /** 1-based nesting level (0 / omitted = no indent). Levels 1–3 reserve 16 / 40 / 64 px. */\n indent?: number;\n /**\n * Text used to match the in-dropdown search query. Defaults to the string\n * `children`. When a query is active and this text doesn't match, the row hides\n * itself — unless `hidden` is passed explicitly (tree dropdowns compute their own\n * visibility). Rows stay mounted while hidden to keep Base UI's selection index\n * stable.\n */\n textValue?: string;\n}\n\nconst InputSelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n InputSelectItemProps\n>(({ className, children, icon, indent, textValue, hidden, ...props }, ref) => {\n const multiple = React.useContext(InputSelectModeContext);\n const filter = React.useContext(InputSelectFilterContext);\n const query = filter?.query.trim().toLowerCase() ?? '';\n const label = textValue ?? (typeof children === 'string' ? children : undefined);\n const autoHidden =\n query.length > 0 && label !== undefined && !label.toLowerCase().includes(query);\n return (\n <SelectPrimitive.Item\n ref={ref}\n hidden={hidden ?? autoHidden}\n className={cn(\n 'group/item relative flex cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none',\n 'bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]',\n // Single-select rows tint when selected; multiple-select rows keep the\n // unselected background (the leading checkbox carries the state).\n !multiple &&\n 'data-[selected]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-idle)] data-[selected]:data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-hover)]',\n 'data-[disabled]:pointer-events-none data-[disabled]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-disabled)]',\n className\n )}\n {...props}\n >\n {multiple && (\n <span\n aria-hidden=\"true\"\n className=\"flex size-[var(--ui-checkbox-global-box-size)] shrink-0 items-center justify-center rounded-[var(--ui-checkbox-global-box-border-radius)] border-[length:var(--ui-checkbox-global-box-border-width)] border-[var(--ui-checkbox-unchecked-box-border-color-idle)] bg-[var(--ui-checkbox-unchecked-box-color-idle)] text-transparent group-data-[selected]/item:border-[var(--ui-checkbox-checked-box-border-color-idle)] group-data-[selected]/item:bg-[var(--ui-checkbox-checked-box-color-idle)] group-data-[selected]/item:text-[var(--ui-checkbox-checked-icon-color-idle)]\"\n >\n <CheckIcon size={16} />\n </span>\n )}\n {typeof indent === 'number' && indent > 0 && (\n <span\n aria-hidden=\"true\"\n className=\"size-4 shrink-0\"\n style={{ minWidth: nestingWidth(indent) }}\n />\n )}\n {icon && (\n <span className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-tenant)]\">\n {icon}\n </span>\n )}\n <SelectPrimitive.ItemText className=\"min-w-0 flex-1 truncate\">\n {children}\n </SelectPrimitive.ItemText>\n {!multiple && (\n <SelectPrimitive.ItemIndicator className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-checked)]\">\n <CheckIcon size={16} />\n </SelectPrimitive.ItemIndicator>\n )}\n </SelectPrimitive.Item>\n );\n});\nInputSelectItem.displayName = 'InputSelectItem';\n\nexport interface InputSelectExpanderProps\n extends React.ComponentPropsWithoutRef<'button'> {\n /** Whether the group is currently expanded. */\n expanded: boolean;\n /** Called when the user clicks the row to toggle expand/collapse. */\n onToggle: () => void;\n /** Optional leading icon rendered after the chevron. */\n icon?: React.ReactNode;\n /** 1-based nesting level (0 / omitted = level 1). Levels 1–3 reserve 16 / 40 / 64 px; the chevron sits right-aligned inside. */\n indent?: number;\n}\n\n/**\n * A non-selectable row that acts as an expand/collapse toggle for a tree group.\n * Visually identical to `InputSelectItem` but is **not** a `SelectPrimitive.Item`,\n * so clicking it won't set the select value.\n *\n * When collapsing a group, keep its child `InputSelectItem`s mounted and toggle\n * their `hidden` prop rather than unmounting them: Base UI's Select tracks the\n * selection by list index, so removing the selected row from the DOM makes a\n * sibling inherit its index and render a phantom check. `hidden` rows keep the\n * indices stable and are skipped by keyboard navigation.\n */\nconst InputSelectExpander = React.forwardRef<\n HTMLButtonElement,\n InputSelectExpanderProps\n>(({ className, children, expanded, onToggle, icon, indent, ...props }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className={cn(\n 'group/item relative flex w-full cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] text-start leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none',\n 'bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] hover:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]',\n className\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex shrink-0 items-center justify-end text-[var(--ui-input-select-dropdown-item-global-icon-collapse)]\"\n style={{\n minWidth:\n typeof indent === 'number' && indent > 0 ? nestingWidth(indent) : NESTING_BASE,\n }}\n >\n {expanded ? <ChevronDownIcon size={16} /> : <ChevronRightIcon size={16} />}\n </span>\n {icon && (\n <span className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-tenant)]\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n </button>\n));\nInputSelectExpander.displayName = 'InputSelectExpander';\n\nconst InputSelectDescription = React.forwardRef<\n HTMLParagraphElement,\n React.ComponentPropsWithoutRef<'p'>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n 'text-xs leading-4 text-[var(--ui-input-select-normal-description-color-idle)]',\n className\n )}\n {...props}\n />\n));\nInputSelectDescription.displayName = 'InputSelectDescription';\n\nconst InputSelectError = React.forwardRef<\n HTMLParagraphElement,\n React.ComponentPropsWithoutRef<'p'>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n 'text-xs leading-4 text-[var(--ui-input-select-error-error-msg-color)]',\n className\n )}\n {...props}\n />\n));\nInputSelectError.displayName = 'InputSelectError';\n\nexport interface InputSelectStatusProps\n extends React.ComponentPropsWithoutRef<'div'> {\n /** Which status to show. Drives the leading icon. */\n variant: 'loading' | 'empty' | 'error';\n /** Optional trailing action (e.g. a \"Try again\" button) — shown for `error`. */\n action?: React.ReactNode;\n}\n\n/** Loading / empty / error status row shown instead of items inside the dropdown. */\nconst InputSelectStatus = React.forwardRef<HTMLDivElement, InputSelectStatusProps>(\n ({ className, variant, children, action, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex min-h-[var(--ui-input-select-dropdown-container-status-width-min)] flex-col items-center justify-center gap-[var(--ui-input-select-dropdown-container-status-gap)] border-t border-[var(--ui-input-select-dropdown-section-container-border-color)] px-[var(--ui-input-select-dropdown-container-status-padding-x)] py-[var(--ui-input-select-dropdown-container-status-padding-y)] text-center text-sm leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)]',\n className\n )}\n {...props}\n >\n {variant === 'loading' && (\n <span\n aria-hidden=\"true\"\n className=\"size-6 animate-spin rounded-full border-2 border-[var(--ui-glyph-on-surface-primary)] border-t-transparent\"\n />\n )}\n {variant === 'empty' && <InboxIcon size={24} className=\"text-[var(--ui-glyph-on-status-info)]\" />}\n {variant === 'error' && <CircleWarningIcon size={24} className=\"text-[var(--ui-glyph-on-status-warning)]\" />}\n {children}\n {variant === 'error' && action}\n </div>\n )\n);\nInputSelectStatus.displayName = 'InputSelectStatus';\n\nexport {\n InputSelect,\n InputSelectField,\n InputSelectLabel,\n InputSelectTrigger,\n InputSelectValue,\n InputSelectContent,\n InputSelectSearch,\n InputSelectGroup,\n InputSelectSection,\n InputSelectSectionLabel,\n InputSelectItem,\n InputSelectExpander,\n InputSelectDescription,\n InputSelectError,\n InputSelectStatus,\n useInputSelectFilter,\n};\n"],"names":["InputSelectModeContext","React","InputSelectFilterContext","useInputSelectFilter","context","InputSelect","props","onOpenChange","query","setQuery","filter","handleOpenChange","open","eventDetails","jsx","SelectPrimitive","InputSelectGroup","InputSelectField","className","ref","cn","InputSelectLabel","children","required","jsxs","InputSelectTrigger","ChevronDownIcon","InputSelectValue","InputSelectContent","sideOffset","align","side","portalContainer","ctxContainer","usePortalContainer","resolvedContainer","InputSelectSearch","value","onChange","onKeyDown","controlled","MagnifierIcon","event","InputSelectSection","InputSelectSectionLabel","NESTING_BASE","NESTING_STEP","nestingWidth","indent","InputSelectItem","icon","textValue","hidden","multiple","label","autoHidden","CheckIcon","InputSelectExpander","expanded","onToggle","ChevronRightIcon","InputSelectDescription","InputSelectError","InputSelectStatus","variant","action","InboxIcon","CircleWarningIcon"],"mappings":";;;;;;AAyBA,MAAMA,IAAyBC,EAAM,cAAc,EAAK,GASlDC,IACJD,EAAM,cAAoD,IAAI;AAOhE,SAASE,IAAsD;AAC7D,QAAMC,IAAUH,EAAM,WAAWC,CAAwB;AACzD,MAAI,CAACE;AACH,UAAM,IAAI,MAAM,yDAAyD;AAE3E,SAAOA;AACT;AAEA,SAASC,EACPC,GACA;AACA,QAAM,EAAE,cAAAC,MAAiBD,GACnB,CAACE,GAAOC,CAAQ,IAAIR,EAAM,SAAS,EAAE,G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,EAAA,GAASa,MACnD,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAL;AAAA,MACA,WAAWC;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAED,GAAGZ;AAAA,MAEH,UAAA;AAAA,QAAA0D,MAAY,aACX,gBAAAlD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAGbkD,MAAY,WAAW,gBAAAlD,EAACoD,KAAU,MAAM,IAAI,WAAU,yCAAwC;AAAA,QAC9FF,MAAY,WAAW,gBAAAlD,EAACqD,KAAkB,MAAM,IAAI,WAAU,4CAA2C;AAAA,QACzG7C;AAAA,QACA0C,MAAY,WAAWC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG9B;AACAF,EAAkB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"input-select.js","sources":["../../../../src/components/ui/input-select/input-select.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleWarningIcon,\n InboxIcon,\n MagnifierIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// The next-gen select, themed by the dedicated `--ui-input-select-*` tier (global /\n// normal / error / dropdown). It composes Base UI `Select` and adds the field\n// furniture (label, required, description, error) and the dropdown machinery\n// (in-dropdown search, sections/groups, single + multiple items, loading/empty/error\n// status). The trigger box wires each state to its own token — idle / hover / open\n// (`data-popup-open`) + focus ring / disabled — and switches to the error border +\n// `--ui-focus-error` ring when `aria-invalid` is set. Selection mode (single vs\n// multiple) flows from the `multiple` prop on the root via `InputSelectModeContext`:\n// single items toggle the row background and show a trailing check; multiple items\n// keep the row background and show a leading checkbox.\n\nconst InputSelectModeContext = React.createContext(false);\n\ninterface InputSelectFilterContextValue {\n /** Current in-dropdown search query. */\n query: string;\n /** Update the search query. */\n setQuery: (query: string) => void;\n}\n\nconst InputSelectFilterContext =\n React.createContext<InputSelectFilterContextValue | null>(null);\n\n/**\n * Read the live in-dropdown search query (and its setter) from the nearest\n * `InputSelect`. Flat item lists filter themselves; use this for hierarchical\n * (tree) dropdowns that need to compute their own visibility.\n */\nfunction useInputSelectFilter(): InputSelectFilterContextValue {\n const context = React.useContext(InputSelectFilterContext);\n if (!context) {\n throw new Error('useInputSelectFilter must be used within <InputSelect>.');\n }\n return context;\n}\n\nfunction InputSelect<Value, Multiple extends boolean | undefined = false>(\n props: SelectPrimitive.Root.Props<Value, Multiple>\n) {\n const { onOpenChange } = props;\n const [query, setQuery] = React.useState('');\n const filter = React.useMemo(() => ({ query, setQuery }), [query]);\n\n // Reset the query when the popup closes so it reopens unfiltered.\n const handleOpenChange = React.useCallback<\n NonNullable<SelectPrimitive.Root.Props<Value, Multiple>['onOpenChange']>\n >(\n (open, eventDetails) => {\n onOpenChange?.(open, eventDetails);\n if (!open) {\n setQuery('');\n }\n },\n [onOpenChange]\n );\n\n return (\n <InputSelectModeContext.Provider value={Boolean(props.multiple)}>\n <InputSelectFilterContext.Provider value={filter}>\n <SelectPrimitive.Root {...props} onOpenChange={handleOpenChange} />\n </InputSelectFilterContext.Provider>\n </InputSelectModeContext.Provider>\n );\n}\nInputSelect.displayName = 'InputSelect';\n\nconst InputSelectGroup = SelectPrimitive.Group;\n\n/** Vertical field stack: label, trigger, description/error. */\nconst InputSelectField = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex min-w-[var(--ui-input-select-global-container-width-min)] flex-col gap-[var(--ui-input-select-global-container-gap)]',\n className\n )}\n {...props}\n />\n));\nInputSelectField.displayName = 'InputSelectField';\n\nconst InputSelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> & {\n /** Appends a required `*` after the label text. */\n required?: boolean;\n }\n>(({ className, children, required, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n 'flex gap-[var(--ui-input-select-global-container-label-gap)] text-sm leading-4 text-[var(--ui-input-select-global-label-color-idle)] data-[disabled]:text-[var(--ui-input-select-global-label-color-disabled)]',\n className\n )}\n {...props}\n >\n {children}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-select-global-required-color)]\"\n >\n *\n </span>\n )}\n </SelectPrimitive.Label>\n));\nInputSelectLabel.displayName = 'InputSelectLabel';\n\nconst InputSelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex h-[var(--ui-input-select-global-box-height)] w-full min-w-0 items-center gap-[var(--ui-input-select-global-box-gap)] rounded-[var(--ui-input-select-global-box-border-radius)] border bg-[var(--ui-input-select-global-box-color-idle)] border-[var(--ui-input-select-normal-box-border-color-idle)] px-[var(--ui-input-select-global-box-padding-x)] text-sm leading-6 text-[var(--ui-input-select-global-value-color-idle)] outline-none transition-colors',\n 'not-data-[disabled]:hover:bg-[var(--ui-input-select-global-box-color-hover)] not-data-[disabled]:hover:border-[var(--ui-input-select-normal-box-border-color-hover)]',\n 'focus-visible:border-[var(--ui-input-select-normal-box-border-color-hover)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)]',\n 'data-[popup-open]:border-[var(--ui-input-select-normal-box-border-color-hover)] data-[popup-open]:ring-[3px] data-[popup-open]:ring-[var(--ui-focus-primary)]',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:border-[var(--ui-input-select-normal-box-border-color-disabled)] data-[disabled]:bg-[var(--ui-input-select-global-box-color-disabled)] data-[disabled]:text-[var(--ui-input-select-global-value-color-disabled)]',\n // Error treatment (driven by `aria-invalid`).\n 'aria-invalid:border-[var(--ui-input-select-error-box-border-color-idle)] not-data-[disabled]:aria-invalid:hover:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:focus-visible:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:focus-visible:ring-[var(--ui-focus-error)] aria-invalid:data-[popup-open]:border-[var(--ui-input-select-error-box-border-color-hover)] aria-invalid:data-[popup-open]:ring-[var(--ui-focus-error)]',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon className=\"flex size-[var(--ui-input-select-global-icon-box-size)] shrink-0 items-center justify-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] group-data-[disabled]:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]\">\n <ChevronDownIcon\n size={16}\n className=\"transition-transform group-data-[popup-open]:rotate-180\"\n />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nInputSelectTrigger.displayName = 'InputSelectTrigger';\n\nconst InputSelectValue = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Value>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Value\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 truncate text-start text-[var(--ui-input-select-global-value-color-idle)] data-[placeholder]:text-[var(--ui-input-select-global-placeholder-color-idle)]',\n 'group-data-[disabled]:!text-[var(--ui-input-select-global-value-color-disabled)] group-data-[disabled]:data-[placeholder]:!text-[var(--ui-input-select-global-placeholder-color-disabled)]',\n className\n )}\n {...props}\n />\n));\nInputSelectValue.displayName = 'InputSelectValue';\n\nconst InputSelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Popup> & {\n sideOffset?: number;\n align?: SelectPrimitive.Positioner.Props['align'];\n side?: SelectPrimitive.Positioner.Props['side'];\n /**\n * Container to portal the dropdown into. Defaults to the document body;\n * pass an element to scope the portal (e.g. a shadow root, so the popup\n * inherits styles defined there).\n */\n portalContainer?: SelectPrimitive.Portal.Props['container'];\n }\n>(\n (\n {\n className,\n children,\n sideOffset = 4,\n align = 'start',\n side = 'bottom',\n portalContainer,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <SelectPrimitive.Portal container={resolvedContainer}>\n <SelectPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n side={side}\n alignItemWithTrigger={false}\n className=\"z-50 outline-none\"\n >\n <SelectPrimitive.Popup\n ref={ref}\n className={cn(\n 'max-h-[var(--available-height)] min-w-[var(--anchor-width)] overflow-y-auto rounded-[var(--ui-input-select-dropdown-container-border-radius)] border border-[var(--ui-input-select-dropdown-container-border-color)] bg-[var(--ui-input-select-dropdown-container-color)] py-[var(--ui-input-select-dropdown-container-padding-y)] text-sm shadow-md outline-none',\n className\n )}\n {...props}\n >\n {children}\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n }\n);\nInputSelectContent.displayName = 'InputSelectContent';\n\n/**\n * In-dropdown search row (magnifier + input). By default it drives the\n * `InputSelect` filter context — flat `InputSelectItem`s filter themselves, and\n * tree dropdowns read the query via `useInputSelectFilter`. Pass `value`/`onChange`\n * to control the query externally.\n */\nconst InputSelectSearch = React.forwardRef<\n HTMLInputElement,\n React.ComponentPropsWithoutRef<'input'>\n>(({ className, value, onChange, onKeyDown, ...props }, ref) => {\n const filter = React.useContext(InputSelectFilterContext);\n const setQuery = filter?.setQuery;\n const controlled = value !== undefined;\n\n // When the query is controlled externally, the consumer's `value` is the\n // source of truth for what's displayed, so keep the internal filter context\n // (what flat items match against) synced to it. A prop-driven value change —\n // a \"clear\" button resetting to '', a debounced/transformed value — doesn't\n // fire `onChange`, so driving the filter off raw DOM events alone would leave\n // `filter.query` stale and hide every item against a query the box no longer\n // shows. `setQuery` is a stable state setter, so this runs only when `value`\n // changes.\n React.useEffect(() => {\n if (controlled) {\n setQuery?.(String(value ?? ''));\n }\n }, [controlled, value, setQuery]);\n\n return (\n <div className=\"flex items-center gap-[var(--ui-input-select-dropdown-dropdown-search-gap)] px-[var(--ui-input-select-dropdown-dropdown-search-padding-x)] py-[var(--ui-input-select-dropdown-dropdown-search-padding-y)]\">\n <MagnifierIcon\n size={16}\n className=\"shrink-0 text-[var(--ui-glyph-on-surface-primary)]\"\n />\n <input\n ref={ref}\n type=\"search\"\n value={value ?? filter?.query ?? ''}\n onChange={(event) => {\n onChange?.(event);\n // Uncontrolled: the input's value *is* the filter query, so write it\n // straight through. Controlled: the effect above syncs the filter to\n // the consumer's `value` once it re-renders, avoiding a flash of raw\n // typed text when the consumer debounces or transforms the value.\n if (!controlled) {\n filter?.setQuery(event.currentTarget.value);\n }\n }}\n // Base UI Select's typeahead would consume printable keys before they\n // reach this input, so stop those from bubbling — but let navigation and\n // selection keys (Arrow*/Home/End/Enter/Escape, all multi-char `key`\n // names) through so the user can move from the search box into the\n // filtered list and pick a result with the keyboard.\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n }}\n className={cn(\n 'min-w-0 flex-1 border-0 bg-transparent p-0 text-sm leading-6 text-[var(--ui-input-select-dropdown-dropdown-search-label-color-value)] outline-none placeholder:text-[var(--ui-input-select-dropdown-dropdown-search-label-color-placeholder)] [&::-webkit-search-cancel-button]:appearance-none',\n className\n )}\n {...props}\n />\n </div>\n );\n});\nInputSelectSearch.displayName = 'InputSelectSearch';\n\n/** A section (group) of items with an optional header. Divided by a top border. */\nconst InputSelectSection = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Group\n ref={ref}\n className={cn(\n 'flex flex-col border-t border-[var(--ui-input-select-dropdown-section-container-border-color)] py-[var(--ui-input-select-dropdown-section-container-padding-y)] first:border-t-0',\n className\n )}\n {...props}\n />\n));\nInputSelectSection.displayName = 'InputSelectSection';\n\nconst InputSelectSectionLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.GroupLabel>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.GroupLabel>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.GroupLabel\n ref={ref}\n className={cn(\n 'px-[var(--ui-input-select-dropdown-section-container-header-padding-x)] py-[var(--ui-input-select-dropdown-section-container-header-padding-y)] text-sm font-semibold leading-6 text-[var(--ui-input-select-dropdown-section-label-group-color)]',\n className\n )}\n {...props}\n />\n));\nInputSelectSectionLabel.displayName = 'InputSelectSectionLabel';\n\n/**\n * Width (px) of the leading nesting spacer for a 1-based tree `indent` level, per\n * the Figma \"InputSelectDropdownTenants\" spec: level 1 reserves 16 px (enough for a\n * single chevron) and each deeper level adds 24 px — 16 / 40 / 64 for levels 1–3.\n * The tenant icon therefore starts at the same x-position whether or not the row is\n * expandable, because the chevron lives right-aligned inside this reserved space.\n */\nconst NESTING_BASE = 16;\nconst NESTING_STEP = 24;\nfunction nestingWidth(indent: number): number {\n return NESTING_BASE + (indent - 1) * NESTING_STEP;\n}\n\nexport interface InputSelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Optional leading icon rendered before the label text. Colored by `--ui-input-select-dropdown-item-global-icon-tenant`. */\n icon?: React.ReactNode;\n /** 1-based nesting level (0 / omitted = no indent). Levels 1–3 reserve 16 / 40 / 64 px. */\n indent?: number;\n /**\n * Text used to match the in-dropdown search query. Defaults to the string\n * `children`. When a query is active and this text doesn't match, the row hides\n * itself — unless `hidden` is passed explicitly (tree dropdowns compute their own\n * visibility). Rows stay mounted while hidden to keep Base UI's selection index\n * stable.\n */\n textValue?: string;\n}\n\nconst InputSelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n InputSelectItemProps\n>(({ className, children, icon, indent, textValue, hidden, ...props }, ref) => {\n const multiple = React.useContext(InputSelectModeContext);\n const filter = React.useContext(InputSelectFilterContext);\n const query = filter?.query.trim().toLowerCase() ?? '';\n const label = textValue ?? (typeof children === 'string' ? children : undefined);\n const autoHidden =\n query.length > 0 && label !== undefined && !label.toLowerCase().includes(query);\n return (\n <SelectPrimitive.Item\n ref={ref}\n hidden={hidden ?? autoHidden}\n className={cn(\n 'group/item relative flex cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none',\n 'bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]',\n // Single-select rows tint when selected; multiple-select rows keep the\n // unselected background (the leading checkbox carries the state).\n !multiple &&\n 'data-[selected]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-idle)] data-[selected]:data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-hover)]',\n 'data-[disabled]:pointer-events-none data-[disabled]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-disabled)]',\n className\n )}\n {...props}\n >\n {multiple && (\n <span\n aria-hidden=\"true\"\n className=\"flex size-[var(--ui-checkbox-global-box-size)] shrink-0 items-center justify-center rounded-[var(--ui-checkbox-global-box-border-radius)] border-[length:var(--ui-checkbox-global-box-border-width)] border-[var(--ui-checkbox-unchecked-box-border-color-idle)] bg-[var(--ui-checkbox-unchecked-box-color-idle)] text-transparent group-data-[selected]/item:border-[var(--ui-checkbox-checked-box-border-color-idle)] group-data-[selected]/item:bg-[var(--ui-checkbox-checked-box-color-idle)] group-data-[selected]/item:text-[var(--ui-checkbox-checked-icon-color-idle)]\"\n >\n <CheckIcon size={16} />\n </span>\n )}\n {typeof indent === 'number' && indent > 0 && (\n <span\n aria-hidden=\"true\"\n className=\"size-4 shrink-0\"\n style={{ minWidth: nestingWidth(indent) }}\n />\n )}\n {icon && (\n <span className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-tenant)]\">\n {icon}\n </span>\n )}\n <SelectPrimitive.ItemText className=\"min-w-0 flex-1 truncate\">\n {children}\n </SelectPrimitive.ItemText>\n {!multiple && (\n <SelectPrimitive.ItemIndicator className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-checked)]\">\n <CheckIcon size={16} />\n </SelectPrimitive.ItemIndicator>\n )}\n </SelectPrimitive.Item>\n );\n});\nInputSelectItem.displayName = 'InputSelectItem';\n\nexport interface InputSelectExpanderProps\n extends React.ComponentPropsWithoutRef<'button'> {\n /** Whether the group is currently expanded. */\n expanded: boolean;\n /** Called when the user clicks the row to toggle expand/collapse. */\n onToggle: () => void;\n /** Optional leading icon rendered after the chevron. */\n icon?: React.ReactNode;\n /** 1-based nesting level (0 / omitted = level 1). Levels 1–3 reserve 16 / 40 / 64 px; the chevron sits right-aligned inside. */\n indent?: number;\n}\n\n/**\n * A non-selectable row that acts as an expand/collapse toggle for a tree group.\n * Visually identical to `InputSelectItem` but is **not** a `SelectPrimitive.Item`,\n * so clicking it won't set the select value.\n *\n * When collapsing a group, keep its child `InputSelectItem`s mounted and toggle\n * their `hidden` prop rather than unmounting them: Base UI's Select tracks the\n * selection by list index, so removing the selected row from the DOM makes a\n * sibling inherit its index and render a phantom check. `hidden` rows keep the\n * indices stable and are skipped by keyboard navigation.\n */\nconst InputSelectExpander = React.forwardRef<\n HTMLButtonElement,\n InputSelectExpanderProps\n>(({ className, children, expanded, onToggle, icon, indent, ...props }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className={cn(\n 'group/item relative flex w-full cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] text-start leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none',\n 'bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] hover:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]',\n className\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex shrink-0 items-center justify-end text-[var(--ui-input-select-dropdown-item-global-icon-collapse)]\"\n style={{\n minWidth:\n typeof indent === 'number' && indent > 0 ? nestingWidth(indent) : NESTING_BASE,\n }}\n >\n {expanded ? <ChevronDownIcon size={16} /> : <ChevronRightIcon size={16} />}\n </span>\n {icon && (\n <span className=\"flex shrink-0 items-center text-[var(--ui-input-select-dropdown-item-global-icon-tenant)]\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n </button>\n));\nInputSelectExpander.displayName = 'InputSelectExpander';\n\nconst InputSelectDescription = React.forwardRef<\n HTMLParagraphElement,\n React.ComponentPropsWithoutRef<'p'>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n 'text-xs leading-4 text-[var(--ui-input-select-normal-description-color-idle)]',\n className\n )}\n {...props}\n />\n));\nInputSelectDescription.displayName = 'InputSelectDescription';\n\nconst InputSelectError = React.forwardRef<\n HTMLParagraphElement,\n React.ComponentPropsWithoutRef<'p'>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n 'text-xs leading-4 text-[var(--ui-input-select-error-error-msg-color)]',\n className\n )}\n {...props}\n />\n));\nInputSelectError.displayName = 'InputSelectError';\n\nexport interface InputSelectStatusProps\n extends React.ComponentPropsWithoutRef<'div'> {\n /** Which status to show. Drives the leading icon. */\n variant: 'loading' | 'empty' | 'error';\n /** Optional trailing action (e.g. a \"Try again\" button) — shown for `error`. */\n action?: React.ReactNode;\n}\n\n/** Loading / empty / error status row shown instead of items inside the dropdown. */\nconst InputSelectStatus = React.forwardRef<HTMLDivElement, InputSelectStatusProps>(\n ({ className, variant, children, action, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex min-h-[var(--ui-input-select-dropdown-container-status-width-min)] flex-col items-center justify-center gap-[var(--ui-input-select-dropdown-container-status-gap)] border-t border-[var(--ui-input-select-dropdown-section-container-border-color)] px-[var(--ui-input-select-dropdown-container-status-padding-x)] py-[var(--ui-input-select-dropdown-container-status-padding-y)] text-center text-sm leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)]',\n className\n )}\n {...props}\n >\n {variant === 'loading' && (\n <span\n aria-hidden=\"true\"\n className=\"size-6 animate-spin rounded-full border-2 border-[var(--ui-glyph-on-surface-primary)] border-t-transparent\"\n />\n )}\n {variant === 'empty' && <InboxIcon size={24} className=\"text-[var(--ui-glyph-on-status-info)]\" />}\n {variant === 'error' && <CircleWarningIcon size={24} className=\"text-[var(--ui-glyph-on-status-warning)]\" />}\n {children}\n {variant === 'error' && action}\n </div>\n )\n);\nInputSelectStatus.displayName = 'InputSelectStatus';\n\nexport {\n InputSelect,\n InputSelectField,\n InputSelectLabel,\n InputSelectTrigger,\n InputSelectValue,\n InputSelectContent,\n InputSelectSearch,\n InputSelectGroup,\n InputSelectSection,\n InputSelectSectionLabel,\n InputSelectItem,\n InputSelectExpander,\n InputSelectDescription,\n InputSelectError,\n InputSelectStatus,\n useInputSelectFilter,\n};\n"],"names":["InputSelectModeContext","React","InputSelectFilterContext","useInputSelectFilter","context","InputSelect","props","onOpenChange","query","setQuery","filter","handleOpenChange","open","eventDetails","jsx","SelectPrimitive","InputSelectGroup","InputSelectField","className","ref","cn","InputSelectLabel","children","required","jsxs","InputSelectTrigger","ChevronDownIcon","InputSelectValue","InputSelectContent","sideOffset","align","side","portalContainer","ctxContainer","usePortalContainer","resolvedContainer","InputSelectSearch","value","onChange","onKeyDown","controlled","MagnifierIcon","event","InputSelectSection","InputSelectSectionLabel","NESTING_BASE","NESTING_STEP","nestingWidth","indent","InputSelectItem","icon","textValue","hidden","multiple","label","autoHidden","CheckIcon","InputSelectExpander","expanded","onToggle","ChevronRightIcon","InputSelectDescription","Input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MAAMC,IAAmB7D,EAAM,WAG7B,CAAC,EAAE,WAAAiB,GAAW,GAAGZ,EAAA,GAASa,MAC1B,gBAAAL;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAK;AAAA,IACA,WAAWC;AAAA,MACT;AAAA,MACAF;AAAA,IAAA;AAAA,IAED,GAAGZ;AAAA,EAAA;AACN,CACD;AACDwD,EAAiB,cAAc;AAW/B,MAAMC,IAAoB9D,EAAM;AAAA,EAC9B,CAAC,EAAE,WAAAiB,GAAW,SAAA8C,GAAS,UAAA1C,GAAU,QAAA2C,GAAQ,GAAG3D,EAAA,GAASa,MACnD,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAL;AAAA,MACA,WAAWC;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAED,GAAGZ;AAAA,MAEH,UAAA;AAAA,QAAA0D,MAAY,aACX,gBAAAlD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAGbkD,MAAY,WAAW,gBAAAlD,EAACoD,KAAU,MAAM,IAAI,WAAU,yCAAwC;AAAA,QAC9FF,MAAY,WAAW,gBAAAlD,EAACqD,KAAkB,MAAM,IAAI,WAAU,4CAA2C;AAAA,QACzG7C;AAAA,QACA0C,MAAY,WAAWC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG9B;AACAF,EAAkB,cAAc;"}
|
|
@@ -1,87 +1,98 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as m from "react";
|
|
3
|
-
import { TimesIcon as
|
|
3
|
+
import { TimesIcon as C } from "@acronis-platform/icons-react/stroke-mono";
|
|
4
4
|
import { cn as c } from "../../../lib/utils.js";
|
|
5
|
-
import { InputBox as
|
|
6
|
-
const
|
|
5
|
+
import { InputBox as T } from "../input/input.js";
|
|
6
|
+
const k = m.forwardRef(
|
|
7
7
|
({
|
|
8
8
|
className: g,
|
|
9
|
+
style: v,
|
|
9
10
|
id: b,
|
|
10
11
|
label: i,
|
|
11
12
|
required: u,
|
|
12
|
-
description:
|
|
13
|
+
description: h,
|
|
13
14
|
error: o,
|
|
14
15
|
clearable: f,
|
|
15
|
-
onClear:
|
|
16
|
+
onClear: I,
|
|
16
17
|
disabled: e,
|
|
17
18
|
value: a,
|
|
18
|
-
...
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */ s(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
...N
|
|
20
|
+
}, y) => {
|
|
21
|
+
const w = m.useId(), r = b ?? w, d = `${r}-message`, n = o != null && o !== "", j = a != null && a !== "", p = !!f && j && !e, l = n ? o : h, x = l != null && l !== "";
|
|
22
|
+
return /* @__PURE__ */ s(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: c(
|
|
26
|
+
"flex min-w-[var(--ui-input-text-global-container-width-min)] flex-col gap-[var(--ui-input-text-global-container-gap)]",
|
|
27
|
+
g
|
|
28
|
+
),
|
|
29
|
+
style: v,
|
|
30
|
+
children: [
|
|
31
|
+
i != null && i !== "" && /* @__PURE__ */ s(
|
|
32
|
+
"label",
|
|
33
|
+
{
|
|
34
|
+
htmlFor: r,
|
|
35
|
+
className: c(
|
|
36
|
+
"flex gap-[var(--ui-input-text-global-container-label-gap)] text-sm leading-4",
|
|
37
|
+
e ? "text-[var(--ui-input-text-global-label-color-disabled)]" : "text-[var(--ui-input-text-global-label-color-idle)]"
|
|
38
|
+
),
|
|
39
|
+
children: [
|
|
40
|
+
i,
|
|
41
|
+
u && /* @__PURE__ */ t(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: "text-[var(--ui-input-text-global-required-color)]",
|
|
46
|
+
children: "*"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
]
|
|
50
|
+
}
|
|
29
51
|
),
|
|
30
|
-
children: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
52
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
53
|
+
/* @__PURE__ */ t(
|
|
54
|
+
T,
|
|
55
|
+
{
|
|
56
|
+
ref: y,
|
|
57
|
+
id: r,
|
|
58
|
+
disabled: e,
|
|
59
|
+
value: a,
|
|
60
|
+
"aria-invalid": n || void 0,
|
|
61
|
+
"aria-required": u || void 0,
|
|
62
|
+
"aria-describedby": x ? d : void 0,
|
|
63
|
+
className: p ? "pe-9" : void 0,
|
|
64
|
+
...N
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
p && /* @__PURE__ */ t(
|
|
68
|
+
"button",
|
|
34
69
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: I,
|
|
72
|
+
"aria-label": "Clear",
|
|
73
|
+
className: "absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] p-0.5 text-[var(--ui-button-icon-global-icon-color-idle)] outline-none hover:bg-[var(--ui-button-icon-global-container-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0",
|
|
74
|
+
children: /* @__PURE__ */ t(C, {})
|
|
38
75
|
}
|
|
39
76
|
)
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
...I
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
p && /* @__PURE__ */ t(
|
|
59
|
-
"button",
|
|
60
|
-
{
|
|
61
|
-
type: "button",
|
|
62
|
-
onClick: h,
|
|
63
|
-
"aria-label": "Clear",
|
|
64
|
-
className: "absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] p-0.5 text-[var(--ui-button-icon-global-icon-color-idle)] outline-none hover:bg-[var(--ui-button-icon-global-container-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0",
|
|
65
|
-
children: /* @__PURE__ */ t(j, {})
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
] }),
|
|
69
|
-
x && /* @__PURE__ */ t(
|
|
70
|
-
"p",
|
|
71
|
-
{
|
|
72
|
-
id: d,
|
|
73
|
-
className: c(
|
|
74
|
-
"text-xs leading-4",
|
|
75
|
-
l ? "text-[var(--ui-input-text-error-msg-error-color)]" : e ? "text-[var(--ui-input-text-normal-description-color-disabled)]" : "text-[var(--ui-input-text-normal-description-color-idle)]"
|
|
76
|
-
),
|
|
77
|
-
children: n
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
] });
|
|
77
|
+
] }),
|
|
78
|
+
x && /* @__PURE__ */ t(
|
|
79
|
+
"p",
|
|
80
|
+
{
|
|
81
|
+
id: d,
|
|
82
|
+
className: c(
|
|
83
|
+
"text-xs leading-4",
|
|
84
|
+
n ? "text-[var(--ui-input-text-error-msg-error-color)]" : e ? "text-[var(--ui-input-text-normal-description-color-disabled)]" : "text-[var(--ui-input-text-normal-description-color-idle)]"
|
|
85
|
+
),
|
|
86
|
+
children: l
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
81
92
|
}
|
|
82
93
|
);
|
|
83
|
-
|
|
94
|
+
k.displayName = "InputText";
|
|
84
95
|
export {
|
|
85
|
-
|
|
96
|
+
k as InputText
|
|
86
97
|
};
|
|
87
98
|
//# sourceMappingURL=input-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-text.js","sources":["../../../../src/components/ui/input-text/input-text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { InputBox } from '../input';\n\n// Mirrors the Figma \"InputText\" component: a full single-line text field built\n// around the bare `InputBox` primitive (themed by the `--ui-input-text-*` tier). It\n// adds the field furniture: an optional `label` (with an optional `required` `*`),\n// an optional clear (✕) button, and an optional `description` or `error` message\n// below. Passing `error` switches the field to its error treatment — the box gets\n// the red error border (via the input's `aria-invalid` styling) and the red error\n// message replaces the description. The clear button appears only while `clearable`\n// is set and the (controlled) field has a value, and calls `onClear`. Colors come\n// from the `--ui-input-text-*` tokens — label/required/description/error — so brand\n// overrides are honored; the clear button is a ghost ButtonIcon (glyph\n// `--ui-button-icon-global-icon-color-idle`, since the input-text tier dropped its\n// own clear-icon token in the Figma sync) with a 3px `--ui-focus-primary` ring.\nexport interface InputTextProps\n extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {\n /** Field label, rendered above the input. */\n label?: React.ReactNode;\n /** Marks the field required — appends a `*` after the label. */\n required?: boolean;\n /** Helper text below the input. Hidden while `error` is set. */\n description?: React.ReactNode;\n /**\n * Error message below the input. Its presence switches the field to the error\n * treatment (red box border + red message).\n */\n error?: React.ReactNode;\n /** Show a clear (✕) button while the (controlled) field has a value. */\n clearable?: boolean;\n /** Called when the clear button is activated. */\n onClear?: () => void;\n}\n\nconst InputText = React.forwardRef<HTMLInputElement, InputTextProps>(\n (\n {\n className,\n id,\n label,\n required,\n description,\n error,\n clearable,\n onClear,\n disabled,\n value,\n ...props\n },\n ref\n ) => {\n const reactId = React.useId();\n const inputId = id ?? reactId;\n const messageId = `${inputId}-message`;\n\n const hasError = error != null && error !== '';\n const hasValue = value != null && value !== '';\n const showClear = Boolean(clearable) && hasValue && !disabled;\n const message = hasError ? error : description;\n const hasMessage = message != null && message !== '';\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"input-text.js","sources":["../../../../src/components/ui/input-text/input-text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { InputBox } from '../input';\n\n// Mirrors the Figma \"InputText\" component: a full single-line text field built\n// around the bare `InputBox` primitive (themed by the `--ui-input-text-*` tier). It\n// adds the field furniture: an optional `label` (with an optional `required` `*`),\n// an optional clear (✕) button, and an optional `description` or `error` message\n// below. Passing `error` switches the field to its error treatment — the box gets\n// the red error border (via the input's `aria-invalid` styling) and the red error\n// message replaces the description. The clear button appears only while `clearable`\n// is set and the (controlled) field has a value, and calls `onClear`. Colors come\n// from the `--ui-input-text-*` tokens — label/required/description/error — so brand\n// overrides are honored; the clear button is a ghost ButtonIcon (glyph\n// `--ui-button-icon-global-icon-color-idle`, since the input-text tier dropped its\n// own clear-icon token in the Figma sync) with a 3px `--ui-focus-primary` ring.\n// `ref` targets the underlying `<input>`; `className` and `style` both target the\n// field wrapper (label + box + message), so sizing the field works the same way\n// whichever one a consumer reaches for.\nexport interface InputTextProps\n extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {\n /** Field label, rendered above the input. */\n label?: React.ReactNode;\n /** Marks the field required — appends a `*` after the label. */\n required?: boolean;\n /** Helper text below the input. Hidden while `error` is set. */\n description?: React.ReactNode;\n /**\n * Error message below the input. Its presence switches the field to the error\n * treatment (red box border + red message).\n */\n error?: React.ReactNode;\n /** Show a clear (✕) button while the (controlled) field has a value. */\n clearable?: boolean;\n /** Called when the clear button is activated. */\n onClear?: () => void;\n}\n\nconst InputText = React.forwardRef<HTMLInputElement, InputTextProps>(\n (\n {\n className,\n style,\n id,\n label,\n required,\n description,\n error,\n clearable,\n onClear,\n disabled,\n value,\n ...props\n },\n ref\n ) => {\n const reactId = React.useId();\n const inputId = id ?? reactId;\n const messageId = `${inputId}-message`;\n\n const hasError = error != null && error !== '';\n const hasValue = value != null && value !== '';\n const showClear = Boolean(clearable) && hasValue && !disabled;\n const message = hasError ? error : description;\n const hasMessage = message != null && message !== '';\n\n return (\n <div\n className={cn(\n 'flex min-w-[var(--ui-input-text-global-container-width-min)] flex-col gap-[var(--ui-input-text-global-container-gap)]',\n className\n )}\n style={style}\n >\n {label != null && label !== '' && (\n <label\n htmlFor={inputId}\n className={cn(\n 'flex gap-[var(--ui-input-text-global-container-label-gap)] text-sm leading-4',\n disabled\n ? 'text-[var(--ui-input-text-global-label-color-disabled)]'\n : 'text-[var(--ui-input-text-global-label-color-idle)]'\n )}\n >\n {label}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-text-global-required-color)]\"\n >\n *\n </span>\n )}\n </label>\n )}\n\n <div className=\"relative\">\n <InputBox\n ref={ref}\n id={inputId}\n disabled={disabled}\n value={value}\n aria-invalid={hasError || undefined}\n aria-required={required || undefined}\n aria-describedby={hasMessage ? messageId : undefined}\n className={showClear ? 'pe-9' : undefined}\n {...props}\n />\n {showClear && (\n <button\n type=\"button\"\n onClick={onClear}\n aria-label=\"Clear\"\n className=\"absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] p-0.5 text-[var(--ui-button-icon-global-icon-color-idle)] outline-none hover:bg-[var(--ui-button-icon-global-container-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0\"\n >\n <TimesIcon />\n </button>\n )}\n </div>\n\n {hasMessage && (\n <p\n id={messageId}\n className={cn(\n 'text-xs leading-4',\n hasError\n ? 'text-[var(--ui-input-text-error-msg-error-color)]'\n : disabled\n ? 'text-[var(--ui-input-text-normal-description-color-disabled)]'\n : 'text-[var(--ui-input-text-normal-description-color-idle)]'\n )}\n >\n {message}\n </p>\n )}\n </div>\n );\n }\n);\nInputText.displayName = 'InputText';\n\nexport { InputText };\n"],"names":["InputText","React","className","style","id","label","required","description","error","clearable","onClear","disabled","value","props","ref","reactId","inputId","messageId","hasError","hasValue","showClear","message","hasMessage","jsxs","cn","jsx","InputBox","TimesIcon"],"mappings":";;;;;AAwCA,MAAMA,IAAYC,EAAM;AAAA,EACtB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAUd,EAAM,MAAA,GAChBe,IAAUZ,KAAMW,GAChBE,IAAY,GAAGD,CAAO,YAEtBE,IAAWV,KAAS,QAAQA,MAAU,IACtCW,IAAWP,KAAS,QAAQA,MAAU,IACtCQ,IAAY,EAAQX,KAAcU,KAAY,CAACR,GAC/CU,IAAUH,IAAWV,IAAQD,GAC7Be,IAAaD,KAAW,QAAQA,MAAY;AAElD,WACE,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACAtB;AAAA,QAAA;AAAA,QAEF,OAAAC;AAAA,QAEC,UAAA;AAAA,UAAAE,KAAS,QAAQA,MAAU,MAC1B,gBAAAkB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAASP;AAAA,cACT,WAAWQ;AAAA,gBACT;AAAA,gBACAb,IACI,4DACA;AAAA,cAAA;AAAA,cAGL,UAAA;AAAA,gBAAAN;AAAA,gBACAC,KACC,gBAAAmB;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,eAAY;AAAA,oBACZ,WAAU;AAAA,oBACX,UAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAED;AAAA,YAAA;AAAA,UAAA;AAAA,UAKN,gBAAAF,EAAC,OAAA,EAAI,WAAU,YACb,UAAA;AAAA,YAAA,gBAAAE;AAAA,cAACC;AAAA,cAAA;AAAA,gBACC,KAAAZ;AAAA,gBACA,IAAIE;AAAA,gBACJ,UAAAL;AAAA,gBACA,OAAAC;AAAA,gBACA,gBAAcM,KAAY;AAAA,gBAC1B,iBAAeZ,KAAY;AAAA,gBAC3B,oBAAkBgB,IAAaL,IAAY;AAAA,gBAC3C,WAAWG,IAAY,SAAS;AAAA,gBAC/B,GAAGP;AAAA,cAAA;AAAA,YAAA;AAAA,YAELO,KACC,gBAAAK;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAASf;AAAA,gBACT,cAAW;AAAA,gBACX,WAAU;AAAA,gBAEV,4BAACiB,GAAA,CAAA,CAAU;AAAA,cAAA;AAAA,YAAA;AAAA,UACb,GAEJ;AAAA,UAECL,KACC,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAIR;AAAA,cACJ,WAAWO;AAAA,gBACT;AAAA,gBACAN,IACI,sDACAP,IACE,kEACA;AAAA,cAAA;AAAA,cAGP,UAAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACArB,EAAU,cAAc;"}
|
|
@@ -1,77 +1,87 @@
|
|
|
1
|
-
import { jsxs as x, jsx as
|
|
1
|
+
import { jsxs as x, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
3
|
+
import { cn as e } from "../../../lib/utils.js";
|
|
4
|
+
const I = c.forwardRef(
|
|
5
5
|
({
|
|
6
6
|
className: v,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
style: p,
|
|
8
|
+
id: b,
|
|
9
|
+
label: r,
|
|
9
10
|
required: d,
|
|
10
|
-
description:
|
|
11
|
-
error:
|
|
12
|
-
disabled:
|
|
13
|
-
"aria-invalid":
|
|
14
|
-
...
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
return /* @__PURE__ */ x(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
description: h,
|
|
12
|
+
error: a,
|
|
13
|
+
disabled: i,
|
|
14
|
+
"aria-invalid": m,
|
|
15
|
+
...g
|
|
16
|
+
}, f) => {
|
|
17
|
+
const w = c.useId(), t = b ?? w, u = `${t}-message`, o = a != null && a !== "", y = o || m, l = o ? a : h, s = l != null && l !== "";
|
|
18
|
+
return /* @__PURE__ */ x(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: e(
|
|
22
|
+
"flex min-w-[var(--ui-input-text-area-container-width-min)] flex-col gap-[var(--ui-input-text-area-container-gap)]",
|
|
23
|
+
v
|
|
24
|
+
),
|
|
25
|
+
style: p,
|
|
26
|
+
children: [
|
|
27
|
+
r != null && r !== "" && /* @__PURE__ */ x(
|
|
28
|
+
"label",
|
|
29
|
+
{
|
|
30
|
+
htmlFor: t,
|
|
31
|
+
className: e(
|
|
32
|
+
"flex gap-[var(--ui-input-text-area-container-label-gap)] text-sm leading-4",
|
|
33
|
+
i ? "text-[var(--ui-input-text-area-label-color-disabled)]" : "text-[var(--ui-input-text-area-label-color-idle)]"
|
|
34
|
+
),
|
|
35
|
+
children: [
|
|
36
|
+
r,
|
|
37
|
+
d && /* @__PURE__ */ n(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
className: "text-[var(--ui-input-text-area-required-color)]",
|
|
42
|
+
children: "*"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
25
47
|
),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
disabled: a,
|
|
45
|
-
"aria-invalid": w || void 0,
|
|
46
|
-
"aria-required": d || void 0,
|
|
47
|
-
"aria-describedby": s ? u : void 0,
|
|
48
|
-
className: n(
|
|
49
|
-
"min-h-[var(--ui-input-text-area-box-height-min)] w-full min-w-0 resize-y rounded-[var(--ui-input-text-area-box-border-radius)] border bg-[var(--ui-input-text-area-box-color-idle)] border-[var(--ui-input-text-area-border-color-idle)] px-[var(--ui-input-text-area-box-padding-x)] py-[var(--ui-input-text-area-box-padding-y)] text-sm leading-6 text-[var(--ui-input-text-area-value-color-idle)] transition-colors placeholder:text-[var(--ui-input-text-area-placeholder-color-idle)] focus-visible:outline-none focus-visible:ring-[3px]",
|
|
50
|
-
"enabled:not-aria-[invalid=true]:hover:bg-[var(--ui-input-text-area-box-color-hover)] enabled:not-aria-[invalid=true]:hover:border-[var(--ui-input-text-area-border-color-hover)] enabled:hover:text-[var(--ui-input-text-area-value-color-hover)] enabled:hover:placeholder:text-[var(--ui-input-text-area-placeholder-color-hover)]",
|
|
51
|
-
"not-aria-[invalid=true]:focus-visible:border-[var(--ui-input-text-area-border-color-focus)] not-aria-[invalid=true]:focus-visible:ring-[var(--ui-focus-primary)]",
|
|
52
|
-
"aria-[invalid=true]:border-[var(--ui-input-text-area-error-msg-box-border-color-idle)] enabled:aria-[invalid=true]:hover:border-[var(--ui-input-text-area-error-msg-box-border-color-hover)] aria-[invalid=true]:focus-visible:border-[var(--ui-input-text-area-error-msg-box-border-color-hover)] aria-[invalid=true]:focus-visible:ring-[var(--ui-focus-error)]",
|
|
53
|
-
"disabled:cursor-not-allowed disabled:border-[var(--ui-input-text-area-border-color-disabled)] disabled:bg-[var(--ui-input-text-area-box-color-disabled)] disabled:text-[var(--ui-input-text-area-value-color-disabled)] disabled:placeholder:text-[var(--ui-input-text-area-placeholder-color-disabled)]",
|
|
54
|
-
v
|
|
48
|
+
/* @__PURE__ */ n(
|
|
49
|
+
"textarea",
|
|
50
|
+
{
|
|
51
|
+
ref: f,
|
|
52
|
+
id: t,
|
|
53
|
+
disabled: i,
|
|
54
|
+
"aria-invalid": y || void 0,
|
|
55
|
+
"aria-required": d || void 0,
|
|
56
|
+
"aria-describedby": s ? u : void 0,
|
|
57
|
+
className: e(
|
|
58
|
+
"min-h-[var(--ui-input-text-area-box-height-min)] w-full min-w-0 resize-y rounded-[var(--ui-input-text-area-box-border-radius)] border bg-[var(--ui-input-text-area-box-color-idle)] border-[var(--ui-input-text-area-border-color-idle)] px-[var(--ui-input-text-area-box-padding-x)] py-[var(--ui-input-text-area-box-padding-y)] text-sm leading-6 text-[var(--ui-input-text-area-value-color-idle)] transition-colors placeholder:text-[var(--ui-input-text-area-placeholder-color-idle)] focus-visible:outline-none focus-visible:ring-[3px]",
|
|
59
|
+
"enabled:not-aria-[invalid=true]:hover:bg-[var(--ui-input-text-area-box-color-hover)] enabled:not-aria-[invalid=true]:hover:border-[var(--ui-input-text-area-border-color-hover)] enabled:hover:text-[var(--ui-input-text-area-value-color-hover)] enabled:hover:placeholder:text-[var(--ui-input-text-area-placeholder-color-hover)]",
|
|
60
|
+
"not-aria-[invalid=true]:focus-visible:border-[var(--ui-input-text-area-border-color-focus)] not-aria-[invalid=true]:focus-visible:ring-[var(--ui-focus-primary)]",
|
|
61
|
+
"aria-[invalid=true]:border-[var(--ui-input-text-area-error-msg-box-border-color-idle)] enabled:aria-[invalid=true]:hover:border-[var(--ui-input-text-area-error-msg-box-border-color-hover)] aria-[invalid=true]:focus-visible:border-[var(--ui-input-text-area-error-msg-box-border-color-hover)] aria-[invalid=true]:focus-visible:ring-[var(--ui-focus-error)]",
|
|
62
|
+
"disabled:cursor-not-allowed disabled:border-[var(--ui-input-text-area-border-color-disabled)] disabled:bg-[var(--ui-input-text-area-box-color-disabled)] disabled:text-[var(--ui-input-text-area-value-color-disabled)] disabled:placeholder:text-[var(--ui-input-text-area-placeholder-color-disabled)]"
|
|
63
|
+
),
|
|
64
|
+
...g
|
|
65
|
+
}
|
|
55
66
|
),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
] });
|
|
67
|
+
s && /* @__PURE__ */ n(
|
|
68
|
+
"p",
|
|
69
|
+
{
|
|
70
|
+
id: u,
|
|
71
|
+
className: e(
|
|
72
|
+
"text-xs leading-4",
|
|
73
|
+
o ? "text-[var(--ui-input-text-area-error-msg-error-color)]" : i ? "text-[var(--ui-input-text-area-description-color-disabled)]" : "text-[var(--ui-input-text-area-description-color-idle)]"
|
|
74
|
+
),
|
|
75
|
+
children: l
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
71
81
|
}
|
|
72
82
|
);
|
|
73
|
-
|
|
83
|
+
I.displayName = "InputTextArea";
|
|
74
84
|
export {
|
|
75
|
-
|
|
85
|
+
I as InputTextArea
|
|
76
86
|
};
|
|
77
87
|
//# sourceMappingURL=input-text-area.js.map
|