@economic/taco 1.26.2 → 1.28.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/Calendar/Calendar.d.ts +2 -0
- package/dist/components/Header/components/Button.d.ts +0 -2
- package/dist/components/Header/components/Link.d.ts +0 -1
- package/dist/components/Header/components/SecondaryNavigation.d.ts +2 -2
- package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/OverflowGroup/OverflowGroup.d.ts +5 -0
- package/dist/components/Provider/Localization.d.ts +1 -0
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Toast/util.d.ts +2 -1
- package/dist/esm/index.css +3 -3
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +12 -5
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +8 -4
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +2 -6
- package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +3 -7
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +7 -114
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -0
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/WorkflowTemplateBasic.js +18 -0
- package/dist/esm/packages/taco/src/components/Icon/components/WorkflowTemplateBasic.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +75 -0
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +3 -3
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js +2 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +8 -8
- package/dist/esm/packages/taco/src/utils/{taillwind.js → tailwind.js} +1 -1
- package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -0
- package/dist/index.css +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/taco.cjs.development.js +1245 -1302
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/tailwind.d.ts +6 -1
- package/package.json +4 -3
- package/types.json +11 -14
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +0 -5
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js +0 -46
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/esm/packages/taco/src/utils/taillwind.js.map +0 -1
- package/dist/utils/taillwind.d.ts +0 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useState, useEffect, createElement, memo } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
3
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
|
4
5
|
import { useLocalization } from '../Provider/Localization.js';
|
|
5
6
|
import ReactDayPicker from 'react-day-picker';
|
|
@@ -31,7 +32,7 @@ const Navbar = /*#__PURE__*/memo(({
|
|
|
31
32
|
onMonthChange(new Date(year.value, month.value));
|
|
32
33
|
};
|
|
33
34
|
return /*#__PURE__*/createElement("div", {
|
|
34
|
-
className: "mb-
|
|
35
|
+
className: "mb-1 flex items-center justify-between"
|
|
35
36
|
}, /*#__PURE__*/createElement("form", {
|
|
36
37
|
className: "inline-flex space-x-1"
|
|
37
38
|
}, /*#__PURE__*/createElement("select", {
|
|
@@ -50,19 +51,23 @@ const Navbar = /*#__PURE__*/memo(({
|
|
|
50
51
|
}, years.map(year => /*#__PURE__*/createElement("option", {
|
|
51
52
|
key: year,
|
|
52
53
|
value: year
|
|
53
|
-
}, String(year))))), /*#__PURE__*/createElement("div", null, /*#__PURE__*/createElement(
|
|
54
|
+
}, String(year))))), /*#__PURE__*/createElement("div", null, /*#__PURE__*/createElement(Tooltip, {
|
|
55
|
+
title: actions.previousMonth
|
|
56
|
+
}, /*#__PURE__*/createElement(IconButton, {
|
|
54
57
|
appearance: "discrete",
|
|
55
58
|
icon: "chevron-left",
|
|
56
59
|
"aria-label": actions.previousMonth,
|
|
57
60
|
onClick: () => onPreviousClick(),
|
|
58
61
|
rounded: true
|
|
59
|
-
}), /*#__PURE__*/createElement(
|
|
62
|
+
})), /*#__PURE__*/createElement(Tooltip, {
|
|
63
|
+
title: actions.nextMonth
|
|
64
|
+
}, /*#__PURE__*/createElement(IconButton, {
|
|
60
65
|
appearance: "discrete",
|
|
61
66
|
icon: "chevron-right",
|
|
62
67
|
"aria-label": actions.nextMonth,
|
|
63
68
|
onClick: () => onNextClick(),
|
|
64
69
|
rounded: true
|
|
65
|
-
})));
|
|
70
|
+
}))));
|
|
66
71
|
});
|
|
67
72
|
const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
68
73
|
const {
|
|
@@ -80,6 +85,7 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
|
80
85
|
if (visibleMonth !== value) {
|
|
81
86
|
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
|
82
87
|
}
|
|
88
|
+
// visibleMonth in deps array breaking month switching logic. It should not be in deps array.
|
|
83
89
|
}, [value]);
|
|
84
90
|
const handleDayClick = (date, modifiers, event) => {
|
|
85
91
|
if (modifiers.outside || modifiers.disabled) {
|
|
@@ -95,7 +101,7 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
|
95
101
|
today.setSeconds(0);
|
|
96
102
|
handleChange(today);
|
|
97
103
|
};
|
|
98
|
-
const className = cn('flex bg-white text-xs p-
|
|
104
|
+
const className = cn('flex bg-white text-xs p-2', otherProps.className);
|
|
99
105
|
return /*#__PURE__*/createElement("div", {
|
|
100
106
|
"data-taco": "calendar"
|
|
101
107
|
}, /*#__PURE__*/createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
@@ -105,6 +111,7 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
|
105
111
|
locale: locale.substring(0, 2),
|
|
106
112
|
firstDayOfWeek: 1,
|
|
107
113
|
months: texts.calendar.months,
|
|
114
|
+
weekdaysLong: texts.calendar.weekdays,
|
|
108
115
|
weekdaysShort: texts.calendar.weekdaysShort,
|
|
109
116
|
navbarElement: navProps => /*#__PURE__*/createElement(Navbar, Object.assign({}, navProps, {
|
|
110
117
|
onMonthChange: setVisibleMonth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 50; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-2 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","numberOfMonths"],"mappings":";;;;;;AAmCA,MAAMA,QAAQ,gBAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;AACzC,MAAMC,KAAK,GAAa,EAAE;AAE1B,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAIJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAI,CAAC,EAAE;EACpDD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;AAGjB,MAAME,MAAM,gBAAGC,IAAU,CACrB,CAAC;EAAEC,aAAa;EAAEC,WAAW;EAAEC,eAAe;EAAEC,KAAK,GAAG,IAAIV,IAAI;CAA8B;EAC1F,MAAM;IACFW,KAAK,EAAE;MACHC,QAAQ,EAAE;QAAEC,OAAO;QAAEC;;;GAE5B,GAAGC,eAAe,EAAE;EAErB,MAAMC,YAAY,GAAG,SAASA,YAAY,CAACC,KAAK;IAC5C,MAAM;MAAEC,IAAI;MAAEC;KAAO,GAAGF,KAAK,CAACG,MAAM,CAACC,IAAI;IACzCd,aAAa,CAAC,IAAIP,IAAI,CAACkB,IAAI,CAACR,KAAK,EAAES,KAAK,CAACT,KAAK,CAA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AAa,EAAEoC,eAAe;MAAEjC,KAAK,EAAEgC;OAAgB;IACxGoB,UAAU,EAAElB,cAAc;IAC1BrC,aAAa,EAAEoC,eAAe;IAC9BoB,kBAAkB,EAAEd,wBAAwB;IAC5Ce,cAAc,EAAE,MAAM,IAAI;IAC1BC,WAAW,EAAEtD,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACqC,KAAK;IACzCgB,cAAc,EAAE,CAAC;IACjB5B,GAAG,EAAEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n /** Text for days in Calendar's header, starting with Sunday */\n weekdays: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 50; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-1 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <Tooltip title={actions.previousMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n </Tooltip>\n <Tooltip title={actions.nextMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </Tooltip>\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n // visibleMonth in deps array breaking month switching logic. It should not be in deps array.\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-2', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysLong={texts.calendar.weekdays}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","Tooltip","title","previousMonth","IconButton","appearance","icon","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysLong","weekdays","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","numberOfMonths"],"mappings":";;;;;;;AAsCA,MAAMA,QAAQ,gBAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;AACzC,MAAMC,KAAK,GAAa,EAAE;AAE1B,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAIJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAI,CAAC,EAAE;EACpDD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;AAGjB,MAAME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CAAC;IAEnBvC,YAAY,CAACoC,KAAK,CAAC;GACtB;EAED,MAAM9B,SAAS,GAAGkC,EAAE,CAAC,2BAA2B,EAAEd,UAAU,CAACpB,SAAS,CAAC;EAEvE,oBACIhB;iBAAe;kBACXA,cAACmD,cAAc,oBACPf,UAAU;IACdpB,SAAS,EAAEA,SAAS;IACpBH,KAAK,EAAEyB,YAAY;IACnBc,YAAY,EAAEhD,KAAK;IACnBiC,MAAM,EAAEA,MAAM,CAACgB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9BC,cAAc,EAAE,CAAC;IACjB9C,MAAM,EAAEH,KAAK,CAACC,QAAQ,CAACE,MAAM;IAC7B+C,YAAY,EAAElD,KAAK,CAACC,QAAQ,CAACkD,QAAQ;IACrCC,aAAa,EAAEpD,KAAK,CAACC,QAAQ,CAACmD,aAAa;IAC3CC,aAAa,EAAEC,QAAQ,iBAAI3D,cAACD,MAAM,oBAAK4D,QAAQ;MAAE1D,aAAa,EAAEsC,eAAe;MAAEnC,KAAK,EAAEkC;OAAgB;IACxGsB,UAAU,EAAEpB,cAAc;IAC1BvC,aAAa,EAAEsC,eAAe;IAC9BsB,kBAAkB,EAAEhB,wBAAwB;IAC5CiB,cAAc,EAAE,MAAM,IAAI;IAC1BC,WAAW,EAAE1D,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACuC,KAAK;IACzCkB,cAAc,EAAE,CAAC;IACjB9B,GAAG,EAAEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
|
-
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
|
3
2
|
import { v4 } from 'uuid';
|
|
3
|
+
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
|
4
4
|
import debounce from 'lodash-es/debounce';
|
|
5
5
|
import { getId } from '../Listbox/ScrollableList.js';
|
|
6
6
|
import { createCustomKeyboardEvent } from '../../utils/input.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
3
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
|
4
5
|
import { useLocalization } from '../Provider/Localization.js';
|
|
5
6
|
import { Calendar } from '../Calendar/Calendar.js';
|
|
@@ -29,10 +30,14 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
|
29
30
|
"data-taco": "datepicker",
|
|
30
31
|
style: style
|
|
31
32
|
}, /*#__PURE__*/createElement(Input, Object.assign({}, input, {
|
|
32
|
-
button: /*#__PURE__*/createElement(
|
|
33
|
+
button: /*#__PURE__*/createElement(Tooltip, {
|
|
34
|
+
title: texts.datepicker.calendar
|
|
35
|
+
}, /*#__PURE__*/createElement(IconButton, {
|
|
33
36
|
"aria-label": texts.datepicker.expand,
|
|
34
37
|
disabled: input.disabled || input.readOnly,
|
|
35
38
|
icon: "calendar",
|
|
39
|
+
tabIndex: -1,
|
|
40
|
+
className: " border-grey-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 flex h-full items-center justify-center rounded-l-none rounded-r border transition-colors transition-opacity ease-in focus:z-10 focus:rounded focus:!border-blue-300 focus:outline-none",
|
|
36
41
|
popover: props => /*#__PURE__*/createElement(Popover, Object.assign({}, props), /*#__PURE__*/createElement(Popover.Content, null, ({
|
|
37
42
|
close
|
|
38
43
|
}) => /*#__PURE__*/createElement("div", {
|
|
@@ -41,8 +46,7 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
|
41
46
|
onChange: (date, event) => {
|
|
42
47
|
calendar.onChange(date, event);
|
|
43
48
|
close();
|
|
44
|
-
}
|
|
45
|
-
tabIndex: -1
|
|
49
|
+
}
|
|
46
50
|
})), shortcuts && /*#__PURE__*/createElement("div", {
|
|
47
51
|
className: "border-grey-300 flex flex-col border-l"
|
|
48
52
|
}, /*#__PURE__*/createElement("span", {
|
|
@@ -66,7 +70,7 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
|
66
70
|
close();
|
|
67
71
|
}
|
|
68
72
|
}, texts.datepicker.clear)))))
|
|
69
|
-
})
|
|
73
|
+
}))
|
|
70
74
|
})));
|
|
71
75
|
});
|
|
72
76
|
Datepicker.displayName = 'Datepicker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatePickerShortcut = {\n onClick: (event: React.MouseEvent) => void;\n text: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: DatePickerShortcut[];\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <IconButton\n
|
|
1
|
+
{"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatePickerShortcut = {\n onClick: (event: React.MouseEvent) => void;\n text: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: DatePickerShortcut[];\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <Tooltip title={texts.datepicker.calendar}>\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n tabIndex={-1}\n className=\" border-grey-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 flex h-full items-center justify-center rounded-l-none rounded-r border transition-colors transition-opacity ease-in focus:z-10 focus:rounded focus:!border-blue-300 focus:outline-none\"\n popover={props => (\n <Popover {...props}>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n />\n {shortcuts && (\n <div className=\"border-grey-300 flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map(shortcut => (\n <li key={shortcut.text}>\n <button\n type=\"button\"\n className=\"hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}>\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n type=\"button\"\n className=\"my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}>\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n )}\n />\n </Tooltip>\n }\n />\n </span>\n );\n});\nDatepicker.displayName = 'Datepicker';\n"],"names":["Datepicker","React","props","ref","className","externalClassName","onReset","handleReset","style","shortcuts","shortcutsText","otherProps","calendar","input","useDatepicker","texts","useLocalization","cn","Input","button","Tooltip","title","datepicker","IconButton","expand","disabled","readOnly","icon","tabIndex","popover","Popover","Content","close","Calendar","onChange","date","event","map","shortcut","key","text","type","onClick","persist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,EAAC;SACXM,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAIK,KAAK,CAACO,UAAU,CAACb,SAAS,CACzC,eACPR,0BACKQ,SAAS,CAAC4B,GAAG,CAACC,QAAQ,iBACnBrC;QAAIsC,GAAG,EAAED,QAAQ,CAACE;sBACdvC;QACIwC,IAAI,EAAC,QAAQ;QACbrC,SAAS,EAAC,+DAA+D;QACzEsC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACfL,QAAQ,CAACI,OAAO,CAACN,KAAK,CAAC;UACvBJ,KAAK,EAAE;;SAEVM,QAAQ,CAACE,IAAI,CACT,CAEhB,CAAC,CACD,EACJjC,WAAW,iBACRN;QACIwC,IAAI,EAAC,QAAQ;QACbrC,SAAS,EAAC,sHAAsH;QAChIsC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACfpC,WAAW,CAAC6B,KAAK,CAAC;UAClBJ,KAAK,EAAE;;SAEVjB,KAAK,CAACO,UAAU,CAACsB,KAAK,CAE9B,CAER,CAER,CACa;MAG5B;KAGZ,CACC;AAEf,CAAC;AACD5C,UAAU,CAAC6C,WAAW,GAAG,YAAY;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { forwardRef, useState, useMemo, useCallback, useEffect, createElement } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
4
3
|
import { Root } from '@radix-ui/react-dialog';
|
|
5
4
|
import { DrawerContext } from './Context.js';
|
|
6
5
|
import { Content, InnerContent, Title, Footer, Close, Actions } from './components/Content.js';
|
|
6
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
7
7
|
import { Trigger } from './components/Trigger.js';
|
|
8
8
|
|
|
9
9
|
const Outlet = /*#__PURE__*/forwardRef(function Outlet(props, ref) {
|
|
@@ -4,10 +4,10 @@ import { Backdrop } from '../../Backdrop/Backdrop.js';
|
|
|
4
4
|
import { IconButton } from '../../IconButton/IconButton.js';
|
|
5
5
|
import { useLocalization } from '../../Provider/Localization.js';
|
|
6
6
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
|
7
|
-
import { Group } from '../../Group/Group.js';
|
|
8
|
-
import { useCurrentMenu } from '../../Menu/Context.js';
|
|
9
7
|
import { Title as Title$1, Close as Close$1, Portal as Portal$1, Overlay, Content as Content$1 } from '@radix-ui/react-dialog';
|
|
10
8
|
import { useDraggable } from '../../../utils/hooks/useDraggable.js';
|
|
9
|
+
import { Group } from '../../Group/Group.js';
|
|
10
|
+
import { useCurrentMenu } from '../../Menu/Context.js';
|
|
11
11
|
import { useCurrentDrawer } from '../Context.js';
|
|
12
12
|
import { getBackdropClassNames, getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util.js';
|
|
13
13
|
import { useGlobalKeyboardShortcut } from '../../../hooks/useGlobalKeyboardShortcut.js';
|
|
@@ -2,9 +2,9 @@ import React__default from 'react';
|
|
|
2
2
|
import { Icon } from '../../Icon/Icon.js';
|
|
3
3
|
import { useLocalization } from '../../Provider/Localization.js';
|
|
4
4
|
import { Button } from '../../Button/Button.js';
|
|
5
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
5
|
import { Root, Trigger, Content } from '@radix-ui/react-popover';
|
|
7
6
|
import { createCustomKeyboardEvent } from '../../../utils/input.js';
|
|
7
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
8
8
|
import { SearchInput } from '../../SearchInput/SearchInput.js';
|
|
9
9
|
import { Root as Root$1 } from '../../../primitives/Collection/components/Root.js';
|
|
10
10
|
import '../../../primitives/Collection/Collection.js';
|
|
@@ -4,19 +4,15 @@ import { IconButton } from '../../IconButton/IconButton.js';
|
|
|
4
4
|
|
|
5
5
|
const Button = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
|
6
6
|
const {
|
|
7
|
-
as = 'li',
|
|
8
7
|
...attributes
|
|
9
8
|
} = props;
|
|
10
9
|
const className = cn(getButtonClasses(), props.className);
|
|
11
|
-
|
|
12
|
-
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
13
|
-
className: "contents"
|
|
14
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
10
|
+
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
15
11
|
appearance: "discrete",
|
|
16
12
|
className: className,
|
|
17
13
|
"data-taco": "header-button",
|
|
18
14
|
ref: ref
|
|
19
|
-
}))
|
|
15
|
+
}));
|
|
20
16
|
});
|
|
21
17
|
const getButtonClasses = () => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer !rounded-full relative', 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white');
|
|
22
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../../../../src/components/Header/components/Button.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconButton, IconButtonProps } from '../../IconButton/IconButton';\n\nexport type ButtonProps = Omit<IconButtonProps, 'appearance' | 'aria-label'> & {\n
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../../../../src/components/Header/components/Button.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconButton, IconButtonProps } from '../../IconButton/IconButton';\n\nexport type ButtonProps = Omit<IconButtonProps, 'appearance' | 'aria-label'> & {\n 'aria-label': string;\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(props, ref) {\n const { ...attributes } = props;\n const className = cn(getButtonClasses(), props.className);\n\n return <IconButton {...attributes} appearance=\"discrete\" className={className} data-taco=\"header-button\" ref={ref} />;\n});\n\nexport const getButtonClasses = () =>\n cn(\n '!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer !rounded-full relative',\n 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ',\n 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n '!text-white hover:text-white focus:text-white'\n );\n"],"names":["Button","React","forwardRef","props","ref","attributes","className","cn","getButtonClasses","IconButton","appearance"],"mappings":";;;;MAQaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAiC,SAASF,MAAM,CAACG,KAAK,EAAEC,GAAG;EAC7F,MAAM;IAAE,GAAGC;GAAY,GAAGF,KAAK;EAC/B,MAAMG,SAAS,GAAGC,EAAE,CAACC,gBAAgB,EAAE,EAAEL,KAAK,CAACG,SAAS,CAAC;EAEzD,oBAAOL,6BAACQ,UAAU,oBAAKJ,UAAU;IAAEK,UAAU,EAAC,UAAU;IAACJ,SAAS,EAAEA,SAAS;iBAAY,eAAe;IAACF,GAAG,EAAEA;KAAO;AACzH,CAAC;MAEYI,gBAAgB,GAAG,MAC5BD,EAAE,CACE,2EAA2E,EAC3E,sEAAsE,EACtE,2FAA2F,EAC3F,+CAA+C;;;;"}
|
|
@@ -7,7 +7,6 @@ import { useLocalization } from '../../Provider/Localization.js';
|
|
|
7
7
|
|
|
8
8
|
const Link = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
|
9
9
|
const {
|
|
10
|
-
as = 'li',
|
|
11
10
|
children,
|
|
12
11
|
icon,
|
|
13
12
|
isNew,
|
|
@@ -17,9 +16,8 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
|
|
17
16
|
const {
|
|
18
17
|
texts
|
|
19
18
|
} = useLocalization();
|
|
20
|
-
const Tag = as;
|
|
21
19
|
const className = cn(getLinkClasses(icon), 'relative', props.className);
|
|
22
|
-
|
|
20
|
+
const link = /*#__PURE__*/React__default.createElement("a", Object.assign({}, otherProps, {
|
|
23
21
|
className: className,
|
|
24
22
|
"data-taco": "header-link",
|
|
25
23
|
ref: ref,
|
|
@@ -32,13 +30,11 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
|
|
32
30
|
className: "absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
|
|
33
31
|
}, texts.header.new) : null);
|
|
34
32
|
if (tooltip) {
|
|
35
|
-
|
|
33
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
36
34
|
title: tooltip
|
|
37
35
|
}, link);
|
|
38
36
|
}
|
|
39
|
-
return
|
|
40
|
-
className: "contents"
|
|
41
|
-
}, link);
|
|
37
|
+
return link;
|
|
42
38
|
});
|
|
43
39
|
const getLinkClasses = (icon = undefined) => cn('flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ', 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white', {
|
|
44
40
|
'!rounded-full !h-9 !w-9': icon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../../../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../../../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n className=\"absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["Link","React","forwardRef","props","ref","children","icon","isNew","tooltip","otherProps","texts","useLocalization","className","cn","getLinkClasses","link","tabIndex","Icon","name","Badge","color","small","header","new","Tooltip","title","undefined"],"mappings":";;;;;;;MA0BaA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAA+B,SAASF,IAAI,CAACG,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC/D,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAACC,cAAc,CAACR,IAAI,CAAC,EAAE,UAAU,EAAEH,KAAK,CAACS,SAAS,CAAC;EAEvE,MAAMG,IAAI,gBACNd,oDAAOQ,UAAU;IAAEG,SAAS,EAAEA,SAAS;iBAAY,aAAa;IAACR,GAAG,EAAEA,GAAG;IAAEY,QAAQ,EAAE;MAChFV,IAAI,gBAAGL,6BAACgB,IAAI;IAACC,IAAI,EAAEZ;IAAQ,GAAG,IAAI,EAClCD,QAAQ,EACRE,KAAK,gBACFN,6BAACkB,KAAK;IACFC,KAAK,EAAC,MAAM;IACZC,KAAK;IACLT,SAAS,EAAC;KACTF,KAAK,CAACY,MAAM,CAACC,GAAG,CACb,GACR,IAAI,CAEf;EAED,IAAIf,OAAO,EAAE;IACT,oBAAOP,6BAACuB,OAAO;MAACC,KAAK,EAAEjB;OAAUO,IAAI,CAAW;;EAGpD,OAAOA,IAAI;AACf,CAAC;MAEYD,cAAc,GAAG,CAACR,OAA6BoB,SAAS,KACjEb,EAAE,CACE,gFAAgF,EAChF,qEAAqE,EACrE,2FAA2F,EAC3F,+CAA+C,EAC/C;EACI,yBAAyB,EAAEP,IAAI;EAC/B,uDAAuD,EAAE,CAACA;CAC7D;;;;"}
|
|
@@ -3,131 +3,24 @@ import cn from 'classnames';
|
|
|
3
3
|
import { useLocalization } from '../../Provider/Localization.js';
|
|
4
4
|
import { Button } from '../../Button/Button.js';
|
|
5
5
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
|
6
|
-
import {
|
|
7
|
-
import { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener.js';
|
|
6
|
+
import { OverflowGroup } from '../../OverflowGroup/OverflowGroup.js';
|
|
8
7
|
import { getLinkClasses } from './Link.js';
|
|
9
|
-
import { Portal } from '@radix-ui/react-portal';
|
|
10
8
|
|
|
11
|
-
const getChildWidths = parent => {
|
|
12
|
-
const widths = [];
|
|
13
|
-
for (let index = 0; index < parent.children.length; index++) {
|
|
14
|
-
var _parent$children$inde, _childRect$width;
|
|
15
|
-
const childRect = (_parent$children$inde = parent.children[index].firstElementChild) === null || _parent$children$inde === void 0 ? void 0 : _parent$children$inde.getBoundingClientRect();
|
|
16
|
-
widths.push((_childRect$width = childRect === null || childRect === void 0 ? void 0 : childRect.width) !== null && _childRect$width !== void 0 ? _childRect$width : 0);
|
|
17
|
-
}
|
|
18
|
-
return widths;
|
|
19
|
-
};
|
|
20
|
-
const ChildrenWidth = ({
|
|
21
|
-
setWidth,
|
|
22
|
-
children
|
|
23
|
-
}) => {
|
|
24
|
-
const ref = React__default.useRef(null);
|
|
25
|
-
const [show, setShow] = React__default.useState(true);
|
|
26
|
-
React__default.useEffect(() => {
|
|
27
|
-
// Calculate the width of children, and then hides the portal
|
|
28
|
-
if (ref.current && show) {
|
|
29
|
-
setWidth(getChildWidths(ref.current));
|
|
30
|
-
setShow(false);
|
|
31
|
-
}
|
|
32
|
-
}, [show]);
|
|
33
|
-
React__default.useEffect(() => {
|
|
34
|
-
// If children changes, then we render the children to calculate their width
|
|
35
|
-
if (!show) {
|
|
36
|
-
setShow(true);
|
|
37
|
-
}
|
|
38
|
-
}, [children]);
|
|
39
|
-
return show ? /*#__PURE__*/React__default.createElement(Portal, {
|
|
40
|
-
className: cn('invisible absolute z-[-10] flex translate-x-[-1000px]'),
|
|
41
|
-
ref: ref
|
|
42
|
-
}, children) : null;
|
|
43
|
-
};
|
|
44
|
-
const useBoundaryIndex = (wrapperWidth, buttonRef, childWidths) => {
|
|
45
|
-
// Primary navigation has a gap of gap-1, so we need to take the gap value in account as well
|
|
46
|
-
// left gap + right gap = 8px
|
|
47
|
-
const GAP = 8;
|
|
48
|
-
return React__default.useMemo(() => {
|
|
49
|
-
if (childWidths.length && wrapperWidth && buttonRef.current) {
|
|
50
|
-
const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;
|
|
51
|
-
let boundary;
|
|
52
|
-
let total = 0;
|
|
53
|
-
childWidths.every((width, index) => {
|
|
54
|
-
const nextWidth = total + width + GAP;
|
|
55
|
-
if (nextWidth > realWidth) {
|
|
56
|
-
boundary = index;
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
total = nextWidth;
|
|
60
|
-
return true;
|
|
61
|
-
});
|
|
62
|
-
return boundary;
|
|
63
|
-
}
|
|
64
|
-
return undefined;
|
|
65
|
-
}, [childWidths, wrapperWidth]);
|
|
66
|
-
};
|
|
67
9
|
const PrimaryNavigation = /*#__PURE__*/React__default.forwardRef(function PrimaryNavigation(props, ref) {
|
|
68
|
-
var _rect$width;
|
|
69
10
|
const {
|
|
70
11
|
texts
|
|
71
12
|
} = useLocalization();
|
|
72
13
|
const internalRef = useMergedRef(ref);
|
|
73
|
-
const rect = useBoundingClientRectListener(internalRef);
|
|
74
|
-
const buttonRef = React__default.useRef(null);
|
|
75
|
-
const [childWidths, setChildWidths] = React__default.useState([]);
|
|
76
|
-
const boundaryIndex = useBoundaryIndex((_rect$width = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _rect$width !== void 0 ? _rect$width : 0, buttonRef, childWidths);
|
|
77
14
|
const className = cn('flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative', props.className);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const hiddenChildren = [];
|
|
82
|
-
React__default.Children.forEach(props.children, (child, index) => {
|
|
83
|
-
if ( /*#__PURE__*/React__default.isValidElement(child) && !!child) {
|
|
84
|
-
if (boundaryIndex && index >= boundaryIndex) {
|
|
85
|
-
hiddenChildren.push(child);
|
|
86
|
-
} else {
|
|
87
|
-
visibleChildren.push(child);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return [visibleChildren, hiddenChildren];
|
|
92
|
-
}, [boundaryIndex, props.children]);
|
|
15
|
+
const moreButton = /*#__PURE__*/React__default.createElement(Button, {
|
|
16
|
+
className: cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')
|
|
17
|
+
}, texts.header.more);
|
|
93
18
|
return /*#__PURE__*/React__default.createElement("nav", Object.assign({}, props, {
|
|
94
19
|
className: className,
|
|
95
20
|
ref: internalRef
|
|
96
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
97
|
-
className: "
|
|
98
|
-
|
|
99
|
-
className: cn({
|
|
100
|
-
invisible: boundaryIndex === undefined
|
|
101
|
-
})
|
|
102
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
103
|
-
className: moreButtonClassName,
|
|
104
|
-
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, {
|
|
105
|
-
className: "hidden lg:block"
|
|
106
|
-
}, hiddenChildren.map((child, index) => {
|
|
107
|
-
const href = child.props.to || child.props.href;
|
|
108
|
-
const target = href !== null && href !== void 0 && href.startsWith('http') ? '_blank' : '_self';
|
|
109
|
-
// Removing className prop so that custom styling cannot be applied on Menu.Link
|
|
110
|
-
const {
|
|
111
|
-
as,
|
|
112
|
-
className: _,
|
|
113
|
-
...otherProps
|
|
114
|
-
} = child.props;
|
|
115
|
-
if (as) {
|
|
116
|
-
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
117
|
-
as: Menu.Link,
|
|
118
|
-
key: index,
|
|
119
|
-
target,
|
|
120
|
-
...otherProps
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return /*#__PURE__*/React__default.createElement(Menu.Link, Object.assign({
|
|
124
|
-
key: index,
|
|
125
|
-
target: target
|
|
126
|
-
}, otherProps));
|
|
127
|
-
}))),
|
|
128
|
-
ref: buttonRef
|
|
129
|
-
}, texts.header.more))), /*#__PURE__*/React__default.createElement(ChildrenWidth, {
|
|
130
|
-
setWidth: setChildWidths
|
|
21
|
+
}), /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
|
22
|
+
className: "h-full flex-grow items-center gap-1 px-1",
|
|
23
|
+
moreButton: moreButton
|
|
131
24
|
}, props.children));
|
|
132
25
|
});
|
|
133
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Portal } from '@radix-ui/react-portal';\nimport { getLinkClasses } from './Link';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { Button } from '../../Button/Button';\nimport { Menu } from '../../Menu/Menu';\nimport { useLocalization } from '../../Provider/Localization';\n\ntype ChildrenWidthProps = {\n setWidth: React.Dispatch<React.SetStateAction<number[]>>;\n children: React.ReactNode;\n};\n\nconst getChildWidths = (parent: HTMLDivElement): number[] => {\n const widths: number[] = [];\n\n for (let index = 0; index < parent.children.length; index++) {\n const childRect = parent.children[index].firstElementChild?.getBoundingClientRect();\n widths.push(childRect?.width ?? 0);\n }\n\n return widths;\n};\n\nconst ChildrenWidth = ({ setWidth, children }: ChildrenWidthProps) => {\n const ref = React.useRef<HTMLDivElement>(null);\n const [show, setShow] = React.useState(true);\n\n React.useEffect(() => {\n // Calculate the width of children, and then hides the portal\n if (ref.current && show) {\n setWidth(getChildWidths(ref.current));\n setShow(false);\n }\n }, [show]);\n\n React.useEffect(() => {\n // If children changes, then we render the children to calculate their width\n if (!show) {\n setShow(true);\n }\n }, [children]);\n\n return show ? (\n <Portal className={cn('invisible absolute z-[-10] flex translate-x-[-1000px]')} ref={ref}>\n {children}\n </Portal>\n ) : null;\n};\n\nconst useBoundaryIndex = (wrapperWidth: number, buttonRef: React.RefObject<HTMLButtonElement>, childWidths: number[]) => {\n // Primary navigation has a gap of gap-1, so we need to take the gap value in account as well\n // left gap + right gap = 8px\n const GAP = 8;\n\n return React.useMemo(() => {\n if (childWidths.length && wrapperWidth && buttonRef.current) {\n const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;\n let boundary: number | undefined;\n let total = 0;\n\n childWidths.every((width, index) => {\n const nextWidth = total + width + GAP;\n\n if (nextWidth > realWidth) {\n boundary = index;\n return false;\n }\n\n total = nextWidth;\n return true;\n });\n\n return boundary;\n }\n\n return undefined;\n }, [childWidths, wrapperWidth]);\n};\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const rect = useBoundingClientRectListener(internalRef);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const [childWidths, setChildWidths] = React.useState<number[]>([]);\n const boundaryIndex = useBoundaryIndex(rect?.width ?? 0, buttonRef, childWidths);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButtonClassName = cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]');\n\n const [visibleChildren, hiddenChildren] = React.useMemo(() => {\n const visibleChildren: JSX.Element[] = [];\n const hiddenChildren: JSX.Element[] = [];\n\n React.Children.forEach(props.children, (child, index) => {\n if (React.isValidElement(child) && !!child) {\n if (boundaryIndex && index >= boundaryIndex) {\n hiddenChildren.push(child);\n } else {\n visibleChildren.push(child);\n }\n }\n });\n\n return [visibleChildren, hiddenChildren];\n }, [boundaryIndex, props.children]);\n\n return (\n <nav {...props} className={className} ref={internalRef}>\n <ul className=\"mb-0 flex h-full w-full items-center gap-1 overflow-hidden px-1\">\n {visibleChildren}\n <li className={cn({ invisible: boundaryIndex === undefined })}>\n <Button\n className={moreButtonClassName}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content className=\"hidden lg:block\">\n {hiddenChildren.map((child, index) => {\n const href: string | undefined = child.props.to || child.props.href;\n const target = href?.startsWith('http') ? '_blank' : '_self';\n // Removing className prop so that custom styling cannot be applied on Menu.Link\n const { as, className: _, ...otherProps } = child.props;\n\n if (as) {\n return React.cloneElement(child, {\n as: Menu.Link,\n key: index,\n target,\n ...otherProps,\n });\n }\n\n return <Menu.Link key={index} target={target} {...otherProps} />;\n })}\n </Menu.Content>\n </Menu>\n )}\n ref={buttonRef}>\n {texts.header.more}\n </Button>\n </li>\n </ul>\n <ChildrenWidth setWidth={setChildWidths}>{props.children}</ChildrenWidth>\n </nav>\n );\n});\n"],"names":["getChildWidths","parent","widths","index","children","length","childRect","firstElementChild","getBoundingClientRect","push","width","ChildrenWidth","setWidth","ref","React","useRef","show","setShow","useState","useEffect","current","Portal","className","cn","useBoundaryIndex","wrapperWidth","buttonRef","childWidths","GAP","useMemo","realWidth","boundary","total","every","nextWidth","undefined","PrimaryNavigation","forwardRef","props","texts","useLocalization","internalRef","useMergedRef","rect","useBoundingClientRectListener","setChildWidths","boundaryIndex","moreButtonClassName","getLinkClasses","visibleChildren","hiddenChildren","Children","forEach","child","isValidElement","invisible","Button","menu","menuProps","Menu","Content","map","href","to","target","startsWith","as","_","otherProps","cloneElement","Link","key","header","more"],"mappings":";;;;;;;;;;AAeA,MAAMA,cAAc,GAAIC,MAAsB;EAC1C,MAAMC,MAAM,GAAa,EAAE;EAE3B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,MAAM,CAACG,QAAQ,CAACC,MAAM,EAAEF,KAAK,EAAE,EAAE;IAAA;IACzD,MAAMG,SAAS,4BAAGL,MAAM,CAACG,QAAQ,CAACD,KAAK,CAAC,CAACI,iBAAiB,0DAAxC,sBAA0CC,qBAAqB,EAAE;IACnFN,MAAM,CAACO,IAAI,qBAACH,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEI,KAAK,+DAAI,CAAC,CAAC;;EAGtC,OAAOR,MAAM;AACjB,CAAC;AAED,MAAMS,aAAa,GAAG,CAAC;EAAEC,QAAQ;EAAER;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ACW,IAAI;QAACC,GAAG,EAAEpE,KAAK;QAAE6D,MAAM,EAAEA;SAAYI,UAAU,EAAI;KACnE,CAAC,CACS,CAEtB;IACDvD,GAAG,EAAEa;KACJa,KAAK,CAACiC,MAAM,CAACC,IAAI,CACb,CACR,CACJ,eACL3D,6BAACH,aAAa;IAACC,QAAQ,EAAEiC;KAAiBP,KAAK,CAAClC,QAAQ,CAAiB,CACvE;AAEd,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { getLinkClasses } from './Link';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Button } from '../../Button/Button';\nimport { OverflowGroup } from '../../OverflowGroup/OverflowGroup';\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButton = (\n <Button className={cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')}>{texts.header.more}</Button>\n );\n return (\n <nav {...props} className={className} ref={internalRef}>\n <OverflowGroup className=\"h-full flex-grow items-center gap-1 px-1\" moreButton={moreButton}>\n {props.children}\n </OverflowGroup>\n </nav>\n );\n});\n"],"names":["PrimaryNavigation","React","forwardRef","props","ref","texts","useLocalization","internalRef","useMergedRef","className","cn","moreButton","Button","getLinkClasses","header","more","OverflowGroup","children"],"mappings":";;;;;;;;MAUaA,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAsC,SAASF,iBAAiB,CAACG,KAAK,EAAEC,GAAG;EACxH,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,WAAW,GAAGC,YAAY,CAAiBJ,GAAG,CAAC;EAErD,MAAMK,SAAS,GAAGC,EAAE,CAChB,wFAAwF,EACxFP,KAAK,CAACM,SAAS,CAClB;EAED,MAAME,UAAU,gBACZV,6BAACW,MAAM;IAACH,SAAS,EAAEC,EAAE,CAACG,cAAc,EAAE,EAAE,+CAA+C;KAAIR,KAAK,CAACS,MAAM,CAACC,IAAI,CAC/G;EACD,oBACId,sDAASE,KAAK;IAAEM,SAAS,EAAEA,SAAS;IAAEL,GAAG,EAAEG;mBACvCN,6BAACe,aAAa;IAACP,SAAS,EAAC,0CAA0C;IAACE,UAAU,EAAEA;KAC3ER,KAAK,CAACc,QAAQ,CACH,CACd;AAEd,CAAC;;;;"}
|
|
@@ -2,8 +2,8 @@ import React__default from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
const SecondaryNavigation = /*#__PURE__*/React__default.forwardRef(function SecondaryNavigation(props, ref) {
|
|
5
|
-
const className = cn('flex h-full items-center gap-2 mb-0', props.className);
|
|
6
|
-
return /*#__PURE__*/React__default.createElement("
|
|
5
|
+
const className = cn('flex h-full items-center gap-2 mb-0 flex-shrink-0', props.className);
|
|
6
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
|
|
7
7
|
className: className,
|
|
8
8
|
ref: ref
|
|
9
9
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/SecondaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type SecondaryNavigationProps = React.HTMLAttributes<
|
|
1
|
+
{"version":3,"file":"SecondaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/SecondaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type SecondaryNavigationProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const SecondaryNavigation = React.forwardRef<HTMLDivElement, SecondaryNavigationProps>(function SecondaryNavigation(\n props,\n ref\n) {\n const className = cn('flex h-full items-center gap-2 mb-0 flex-shrink-0', props.className);\n return <div {...props} className={className} ref={ref} />;\n});\n"],"names":["SecondaryNavigation","React","forwardRef","props","ref","className","cn"],"mappings":";;;MAKaA,mBAAmB,gBAAGC,cAAK,CAACC,UAAU,CAA2C,SAASF,mBAAmB,CACtHG,KAAK,EACLC,GAAG;EAEH,MAAMC,SAAS,GAAGC,EAAE,CAAC,mDAAmD,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC1F,oBAAOJ,sDAASE,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAC7D,CAAC;;;;"}
|
|
@@ -17,6 +17,7 @@ const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
|
17
17
|
return Component ? /*#__PURE__*/React__default.createElement(Component, Object.assign({}, otherProps, {
|
|
18
18
|
className: className,
|
|
19
19
|
"data-taco": "icon",
|
|
20
|
+
"data-icon-name": name,
|
|
20
21
|
focusable: "false",
|
|
21
22
|
ref: ref,
|
|
22
23
|
role: "img"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../../../../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconName, icons } from './components/index';\n\nexport { icons } from './components/index';\nexport type { IconName } from './components/index';\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement> & {\n /** Set what svg icon should be rendered */\n name: IconName; // this dynamic type causes the type extraction for props to fail\n};\n\nexport const Icon = React.forwardRef(function Icon(props: IconProps, ref: React.Ref<SVGSVGElement>) {\n const { name, ...otherProps } = props;\n const Component = icons[name];\n /* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */\n const className = cn('inline-flex h-[1.715em] w-[1.715em] flex-shrink-0', props.className, {\n 'p-[3px]': props.className?.includes('rounded-full'),\n });\n\n return Component ? (\n <Component
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../../../../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconName, icons } from './components/index';\n\nexport { icons } from './components/index';\nexport type { IconName } from './components/index';\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement> & {\n /** Set what svg icon should be rendered */\n name: IconName; // this dynamic type causes the type extraction for props to fail\n};\n\nexport const Icon = React.forwardRef(function Icon(props: IconProps, ref: React.Ref<SVGSVGElement>) {\n const { name, ...otherProps } = props;\n const Component = icons[name];\n /* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */\n const className = cn('inline-flex h-[1.715em] w-[1.715em] flex-shrink-0', props.className, {\n 'p-[3px]': props.className?.includes('rounded-full'),\n });\n\n return Component ? (\n <Component\n {...otherProps}\n className={className}\n data-taco=\"icon\"\n data-icon-name={name}\n focusable=\"false\"\n ref={ref}\n role=\"img\"\n />\n ) : null;\n});\n"],"names":["Icon","React","forwardRef","props","ref","name","otherProps","Component","icons","className","cn","includes","focusable","role"],"mappings":";;;;;MAYaA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,IAAI,CAACG,KAAgB,EAAEC,GAA6B;;EAC9F,MAAM;IAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGH,KAAK;EACrC,MAAMI,SAAS,GAAGC,KAAK,CAACH,IAAI,CAAC;;EAE7B,MAAMI,SAAS,GAAGC,EAAE,CAAC,mDAAmD,EAAEP,KAAK,CAACM,SAAS,EAAE;IACvF,SAAS,sBAAEN,KAAK,CAACM,SAAS,qDAAf,iBAAiBE,QAAQ,CAAC,cAAc;GACtD,CAAC;EAEF,OAAOJ,SAAS,gBACZN,6BAACM,SAAS,oBACFD,UAAU;IACdG,SAAS,EAAEA,SAAS;iBACV,MAAM;sBACAJ,IAAI;IACpBO,SAAS,EAAC,OAAO;IACjBR,GAAG,EAAEA,GAAG;IACRS,IAAI,EAAC;KACP,GACF,IAAI;AACZ,CAAC;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { forwardRef, createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
function IconWorkflowTemplateBasic(props, svgRef) {
|
|
4
|
+
return /*#__PURE__*/createElement("svg", Object.assign({
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
ref: svgRef
|
|
8
|
+
}, props), /*#__PURE__*/createElement("path", {
|
|
9
|
+
fillRule: "evenodd",
|
|
10
|
+
clipRule: "evenodd",
|
|
11
|
+
d: "M12 1l5.762 3.12v6.161L23 13.117v6.763L17.238 23 12 20.164 6.762 23 1 19.88v-6.762l5.238-2.837V4.137L12 1zM6.761 11.183l-4.144 2.244 4.144 2.243 4.143-2.243-4.143-2.244zm4.714 3.12l-4.19 2.269v4.96l4.19-2.27v-4.96zm1.048 4.96l4.19 2.268v-4.96l-4.19-2.268v4.96zm.57-5.837l4.144 2.244 4.144-2.243-4.144-2.244-4.143 2.244zm8.858.877l-4.19 2.269v4.96l4.19-2.27v-4.96zm-9.428-1.753l4.19-2.269V5.305l-4.19 2.27v4.975zm-1.048-4.975l-4.19-2.256v4.962l4.19 2.27V7.574zm-3.62-3.133L12 6.672l4.144-2.243-4.142-2.243-4.145 2.256zm-1.618 17.09v-4.96l-4.19-2.27v4.96l4.19 2.27z",
|
|
12
|
+
fill: "currentColor"
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
var WorkflowTemplateBasic = /*#__PURE__*/forwardRef(IconWorkflowTemplateBasic);
|
|
16
|
+
|
|
17
|
+
export default WorkflowTemplateBasic;
|
|
18
|
+
//# sourceMappingURL=WorkflowTemplateBasic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowTemplateBasic.js","sources":["../../../../../../../../src/components/Icon/components/WorkflowTemplateBasic.tsx"],"sourcesContent":["import * as React from 'react';\nfunction IconWorkflowTemplateBasic(props: React.SVGProps<SVGSVGElement>, svgRef?: React.Ref<SVGSVGElement>): JSX.Element {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" ref={svgRef} {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 1l5.762 3.12v6.161L23 13.117v6.763L17.238 23 12 20.164 6.762 23 1 19.88v-6.762l5.238-2.837V4.137L12 1zM6.761 11.183l-4.144 2.244 4.144 2.243 4.143-2.243-4.143-2.244zm4.714 3.12l-4.19 2.269v4.96l4.19-2.27v-4.96zm1.048 4.96l4.19 2.268v-4.96l-4.19-2.268v4.96zm.57-5.837l4.144 2.244 4.144-2.243-4.144-2.244-4.143 2.244zm8.858.877l-4.19 2.269v4.96l4.19-2.27v-4.96zm-9.428-1.753l4.19-2.269V5.305l-4.19 2.27v4.975zm-1.048-4.975l-4.19-2.256v4.962l4.19 2.27V7.574zm-3.62-3.133L12 6.672l4.144-2.243-4.142-2.243-4.145 2.256zm-1.618 17.09v-4.96l-4.19-2.27v4.96l4.19 2.27z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\nexport default React.forwardRef(IconWorkflowTemplateBasic);\n"],"names":["IconWorkflowTemplateBasic","props","svgRef","React","xmlns","viewBox","ref","fillRule","clipRule","d","fill"],"mappings":";;AACA,SAASA,yBAAyB,CAACC,KAAoC,EAAEC,MAAiC;EACtG,oBACIC;IAAKC,KAAK,EAAC,4BAA4B;IAACC,OAAO,EAAC,WAAW;IAACC,GAAG,EAAEJ;KAAYD,KAAK,gBAC9EE;IACII,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,SAAS;IAClBC,CAAC,EAAC,qjBAAqjB;IACvjBC,IAAI,EAAC;IACP,CACA;AAEd;AACA,yCAAeP,UAAgB,CAACH,yBAAyB,CAAC;;;;"}
|