@economic/taco 1.27.0 → 1.28.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Calendar/Calendar.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +2 -1
- package/dist/components/Header/components/Button.d.ts +1 -3
- package/dist/components/Header/components/Link.d.ts +0 -1
- package/dist/components/Header/components/Logo.d.ts +1 -0
- package/dist/components/Header/components/SecondaryNavigation.d.ts +2 -2
- package/dist/components/OverflowGroup/OverflowGroup.d.ts +5 -0
- package/dist/components/Provider/Localization.d.ts +1 -0
- 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/Header.js +3 -2
- package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +5 -7
- 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/Logo.js +19 -2
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.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/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 +1448 -1500
- 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 +21 -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
@@ -20,6 +20,8 @@ export declare type CalendarTexts = {
|
|
20
20
|
months: string[];
|
21
21
|
/** Text abbreviation for days in Calendar's header, starting with Sunday */
|
22
22
|
weekdaysShort: string[];
|
23
|
+
/** Text for days in Calendar's header, starting with Sunday */
|
24
|
+
weekdays: string[];
|
23
25
|
};
|
24
26
|
export declare type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {
|
25
27
|
/** Handler called when a day is clicked in calendar */
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Button } from './components/Button';
|
3
3
|
import { Link } from './components/Link';
|
4
|
-
import { Logo } from './components/Logo';
|
4
|
+
import { Logo, LogoLegacy } from './components/Logo';
|
5
5
|
import { PrimaryNavigation } from './components/PrimaryNavigation';
|
6
6
|
import { SecondaryNavigation } from './components/SecondaryNavigation';
|
7
7
|
import { MenuButton } from './components/MenuButton';
|
@@ -20,6 +20,7 @@ export declare type ForwardedHeaderWithStatics = React.ForwardRefExoticComponent
|
|
20
20
|
Button: typeof Button;
|
21
21
|
Link: typeof Link;
|
22
22
|
Logo: typeof Logo;
|
23
|
+
LogoLegacy: typeof LogoLegacy;
|
23
24
|
PrimaryNavigation: typeof PrimaryNavigation;
|
24
25
|
SecondaryNavigation: typeof SecondaryNavigation;
|
25
26
|
MenuButton: typeof MenuButton;
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { IconButtonProps } from '../../IconButton/IconButton';
|
3
3
|
export declare type ButtonProps = Omit<IconButtonProps, 'appearance' | 'aria-label'> & {
|
4
|
-
as?: string;
|
5
4
|
'aria-label': string;
|
6
5
|
};
|
7
6
|
export declare const Button: React.ForwardRefExoticComponent<Pick<IconButtonProps, "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "href" | "target" | "dialog" | "hanger" | "icon" | "menu" | "popover" | "rounded" | "tooltip"> & {
|
8
|
-
as?: string | undefined;
|
9
7
|
'aria-label': string;
|
10
8
|
} & React.RefAttributes<HTMLButtonElement>>;
|
11
|
-
export declare const getButtonClasses: () => string;
|
9
|
+
export declare const getButtonClasses: (rounded?: boolean) => string;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
export declare type LogoProps = React.SVGAttributes<SVGSVGElement>;
|
3
3
|
export declare const Logo: React.ForwardRefExoticComponent<LogoProps & React.RefAttributes<SVGSVGElement>>;
|
4
|
+
export declare const LogoLegacy: React.ForwardRefExoticComponent<LogoProps & React.RefAttributes<SVGSVGElement>>;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
export declare type SecondaryNavigationProps = React.HTMLAttributes<
|
3
|
-
export declare const SecondaryNavigation: React.ForwardRefExoticComponent<SecondaryNavigationProps & React.RefAttributes<
|
2
|
+
export declare type SecondaryNavigationProps = React.HTMLAttributes<HTMLDivElement>;
|
3
|
+
export declare const SecondaryNavigation: React.ForwardRefExoticComponent<SecondaryNavigationProps & React.RefAttributes<HTMLDivElement>>;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
3
|
+
export declare const OverflowGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
4
|
+
moreButton?: React.ReactElement<ButtonProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
|
5
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
@@ -1,3 +1,4 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
2
|
import { ToastType } from './Toast';
|
3
3
|
export declare const getBadgeIcon: (type: ToastType) => JSX.Element | null;
|
4
|
+
export declare const getToastEmptyContentWarning: (content?: Pick<React.ReactNode, never> | undefined) => string;
|
package/dist/esm/index.css
CHANGED
@@ -246,7 +246,7 @@
|
|
246
246
|
}
|
247
247
|
|
248
248
|
[data-taco='calendar'] .DayPicker-Footer {
|
249
|
-
@apply pt-
|
249
|
+
@apply pt-1 text-center;
|
250
250
|
}
|
251
251
|
|
252
252
|
[data-taco='calendar'] .DayPicker-TodayButton {
|
@@ -272,8 +272,8 @@
|
|
272
272
|
}
|
273
273
|
|
274
274
|
[data-taco='calendar'] .icon:hover,
|
275
|
-
[data-taco='calendar']:not(.DayPicker--interactionDisabled)
|
276
|
-
|
275
|
+
[data-taco='calendar']:not(.DayPicker--interactionDisabled),
|
276
|
+
.DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--outside):hover,
|
277
277
|
[data-taco='calendar'] .DayPicker-Day--highlighted,
|
278
278
|
[data-taco='calendar'] .DayPicker-Day--selected {
|
279
279
|
@apply wcag-grey-200;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { getSubtleColorShadeClasses, getColorByState } from '../../utils/
|
3
|
+
import { getSubtleColorShadeClasses, getColorByState } from '../../utils/tailwind.js';
|
4
4
|
import { Icon } from '../Icon/Icon.js';
|
5
5
|
import { BadgeIcon } from '../BadgeIcon/BadgeIcon.js';
|
6
6
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\nimport { getColorByState, getSubtleColorShadeClasses } from '../../utils/
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\nimport { getColorByState, getSubtleColorShadeClasses } from '../../utils/tailwind';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { State } from '../../types';\n\nexport type AlertProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: React.ReactNode;\n state?: State;\n onClose?: () => void;\n};\n\nconst getIconName = (state: State | undefined): IconName => {\n switch (state) {\n case 'information':\n return 'info';\n case 'warning':\n return 'warning';\n case 'error':\n return 'close';\n case 'success':\n return 'tick';\n default:\n return 'refresh';\n }\n};\n\nexport const Alert = React.forwardRef(function Alert(props: AlertProps, ref: React.Ref<HTMLDivElement>) {\n const { children, title, state, onClose } = props;\n\n const className = cn(\n `flex w-full flex-row items-start gap-2 rounded-md border-transparent p-3 ${getSubtleColorShadeClasses(\n getColorByState(state)\n )}`,\n props.className\n );\n\n return (\n <div {...props} ref={ref} className={className} role=\"alert\">\n <BadgeIcon className=\"flex-none\" icon={getIconName(state)} color={getColorByState(state)} />\n <div className=\"grow text-sm\">\n {title && <div className=\"font-bold\">{title}</div>}\n {children}\n </div>\n {onClose && <Icon className=\"flex-none cursor-pointer\" name=\"close\" onClick={onClose} />}\n </div>\n );\n});\n"],"names":["getIconName","state","Alert","React","forwardRef","props","ref","children","title","onClose","className","cn","getSubtleColorShadeClasses","getColorByState","role","BadgeIcon","icon","color","Icon","name","onClick"],"mappings":";;;;;;AAaA,MAAMA,WAAW,GAAIC,KAAwB;EACzC,QAAQA,KAAK;IACT,KAAK,aAAa;MACd,OAAO,MAAM;IACjB,KAAK,SAAS;MACV,OAAO,SAAS;IACpB,KAAK,OAAO;MACR,OAAO,OAAO;IAClB,KAAK,SAAS;MACV,OAAO,MAAM;IACjB;MACI,OAAO,SAAS;;AAE5B,CAAC;MAEYC,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAK,CAACG,KAAiB,EAAEC,GAA8B;EAClG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEP,KAAK;IAAEQ;GAAS,GAAGJ,KAAK;EAEjD,MAAMK,SAAS,GAAGC,EAAE,6EAC4DC,0BAA0B,CAClGC,eAAe,CAACZ,KAAK,CAAC,GACvB,EACHI,KAAK,CAACK,SAAS,CAClB;EAED,oBACIP,sDAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEI,SAAS,EAAEA,SAAS;IAAEI,IAAI,EAAC;mBACjDX,6BAACY,SAAS;IAACL,SAAS,EAAC,WAAW;IAACM,IAAI,EAAEhB,WAAW,CAACC,KAAK,CAAC;IAAEgB,KAAK,EAAEJ,eAAe,CAACZ,KAAK;IAAK,eAC5FE;IAAKO,SAAS,EAAC;KACVF,KAAK,iBAAIL;IAAKO,SAAS,EAAC;KAAaF,KAAK,CAAO,EACjDD,QAAQ,CACP,EACLE,OAAO,iBAAIN,6BAACe,IAAI;IAACR,SAAS,EAAC,0BAA0B;IAACS,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEX;IAAW,CACtF;AAEd,CAAC;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { forwardRef, createElement, Fragment } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { getOutlineColorShadeClasses, getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/
|
3
|
+
import { getOutlineColorShadeClasses, getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/tailwind.js';
|
4
4
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
5
5
|
|
6
6
|
const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden';\nimport { Color } from '../../types';\nimport { getSubtleColorShadeClasses, getColorShadeClasses, getOutlineColorShadeClasses } from '../../utils/
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden';\nimport { Color } from '../../types';\nimport { getSubtleColorShadeClasses, getColorShadeClasses, getOutlineColorShadeClasses } from '../../utils/tailwind';\nimport './Badge.css';\n\nexport type BadgeBaseProps = React.HTMLAttributes<HTMLSpanElement> & {\n /** Content should be a numerical value or tag/status like text **/\n children: React.ReactNode;\n /** Show small version of badge **/\n small?: boolean;\n /** Background color **/\n color?: Color;\n};\n\ninterface CompactBadgeProps extends BadgeBaseProps {\n /** Show compact version **/\n compact?: boolean;\n /** Show outlined version **/\n outline?: never;\n /** Show subtle version **/\n subtle?: never;\n /** Show status dot - can be used only in subtle badge **/\n status?: never;\n}\n\ninterface OutlineBadgeProps extends BadgeBaseProps {\n /** Show compact version **/\n compact?: never;\n /** Show outlined version **/\n outline?: boolean;\n /** Show subtle version **/\n subtle?: never;\n /** Show status dot - can be used only in subtle badge **/\n status?: never;\n}\n\ninterface SubtleBadgeProps extends BadgeBaseProps {\n /** Show compact version **/\n compact?: never;\n /** Show outlined version **/\n outline?: never;\n /** Show subtle version **/\n subtle?: boolean;\n /** Show status dot - can be used only in subtle badge **/\n status?: never;\n}\n\ninterface StatusBadgeProps extends BadgeBaseProps {\n /** Show compact version **/\n compact?: never;\n /** Show outlined version **/\n outline?: never;\n /** Show subtle version **/\n subtle?: boolean;\n /** Show status dot - can be used only in subtle badge **/\n status?: boolean;\n}\n\nexport type BadgeProps = CompactBadgeProps | OutlineBadgeProps | SubtleBadgeProps | StatusBadgeProps;\n\nexport const Badge = React.forwardRef(function Badge(props: BadgeProps, ref: React.Ref<HTMLSpanElement>) {\n const {\n children,\n compact = false,\n outline = false,\n status = false,\n subtle = false,\n small = false,\n color,\n ...otherProps\n } = props;\n const isTransparent = color === 'transparent';\n const className = cn(\n 'rounded-full border overflow-hidden whitespace-nowrap inline-flex items-center justify-center',\n {\n [`border ${getOutlineColorShadeClasses(color)}`]: outline,\n [`border-transparent font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,\n [`border-transparent ${getColorShadeClasses(color)}`]: !outline && !subtle,\n 'h-4 min-w-0 py-0 px-1 text-xs': small,\n 'h-2 w-2 min-w-0': compact,\n 'font-bold': outline || !subtle,\n 'text-sm': !small,\n 'h-5 py-0 px-1.5': !compact && !small, // custom padding keeps single digits in a perfect circle\n '!bg-grey-700': compact && isTransparent,\n },\n props.className\n );\n\n const content = () => {\n if (compact) {\n return <VisuallyHidden>{children}</VisuallyHidden>;\n }\n if (status) {\n return (\n <>\n <div className={cn('mr-1 h-2 w-2 rounded-full', getColorShadeClasses(color))} />\n {children}\n </>\n );\n }\n return children;\n };\n\n return (\n <span\n {...otherProps}\n aria-atomic=\"true\"\n aria-live=\"polite\"\n className={className}\n data-taco=\"badge\"\n ref={ref}\n role=\"status\"\n title={props['aria-label']}>\n {content()}\n </span>\n );\n});\n"],"names":["Badge","React","props","ref","children","compact","outline","status","subtle","small","color","otherProps","isTransparent","className","cn","getOutlineColorShadeClasses","getSubtleColorShadeClasses","getColorShadeClasses","content","VisuallyHidden","role","title"],"mappings":";;;;;MA8DaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAA+B;EACnG,MAAM;IACFC,QAAQ;IACRC,OAAO,GAAG,KAAK;IACfC,OAAO,GAAG,KAAK;IACfC,MAAM,GAAG,KAAK;IACdC,MAAM,GAAG,KAAK;IACdC,KAAK,GAAG,KAAK;IACbC,KAAK;IACL,GAAGC;GACN,GAAGT,KAAK;EACT,MAAMU,aAAa,GAAGF,KAAK,KAAK,aAAa;EAC7C,MAAMG,SAAS,GAAGC,EAAE,CAChB,+FAA+F,EAC/F;IACI,WAAWC,2BAA2B,CAACL,KAAK,GAAG,GAAGJ,OAAO;IACzD,mCAAmCU,0BAA0B,CAACN,KAAK,GAAG,GAAGF,MAAM;IAC/E,uBAAuBS,oBAAoB,CAACP,KAAK,GAAG,GAAG,CAACJ,OAAO,IAAI,CAACE,MAAM;IAC1E,+BAA+B,EAAEC,KAAK;IACtC,iBAAiB,EAAEJ,OAAO;IAC1B,WAAW,EAAEC,OAAO,IAAI,CAACE,MAAM;IAC/B,SAAS,EAAE,CAACC,KAAK;IACjB,iBAAiB,EAAE,CAACJ,OAAO,IAAI,CAACI,KAAK;IACrC,cAAc,EAAEJ,OAAO,IAAIO;GAC9B,EACDV,KAAK,CAACW,SAAS,CAClB;EAED,MAAMK,OAAO,GAAG;IACZ,IAAIb,OAAO,EAAE;MACT,oBAAOJ,cAACkB,cAAc,QAAEf,QAAQ,CAAkB;;IAEtD,IAAIG,MAAM,EAAE;MACR,oBACIN,2CACIA;QAAKY,SAAS,EAAEC,EAAE,CAAC,2BAA2B,EAAEG,oBAAoB,CAACP,KAAK,CAAC;QAAK,EAC/EN,QAAQ,CACV;;IAGX,OAAOA,QAAQ;GAClB;EAED,oBACIH,wCACQU,UAAU;mBACF,MAAM;iBACR,QAAQ;IAClBE,SAAS,EAAEA,SAAS;iBACV,OAAO;IACjBV,GAAG,EAAEA,GAAG;IACRiB,IAAI,EAAC,QAAQ;IACbC,KAAK,EAAEnB,KAAK,CAAC,YAAY;MACxBgB,OAAO,EAAE,CACP;AAEf,CAAC;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/
|
3
|
+
import { getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/tailwind.js';
|
4
4
|
import { Icon } from '../Icon/Icon.js';
|
5
5
|
|
6
6
|
const BadgeIcon = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BadgeIcon.js","sources":["../../../../../../../src/components/BadgeIcon/BadgeIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/
|
1
|
+
{"version":3,"file":"BadgeIcon.js","sources":["../../../../../../../src/components/BadgeIcon/BadgeIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { getSubtleColorShadeClasses, getColorShadeClasses } from '../../utils/tailwind';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { Color } from '../../types';\n\nexport type BadgeIconProps = React.HTMLAttributes<HTMLSpanElement> & {\n /** Icon type **/\n icon: IconName;\n /** Background color **/\n color?: Color;\n /** Show subtle version **/\n subtle?: boolean;\n};\n\nexport const BadgeIcon = React.forwardRef(function Badge(props: BadgeIconProps, ref: React.Ref<HTMLSpanElement>) {\n const { color, icon, subtle, ...otherProps } = props;\n\n const className = cn(\n `rounded-full border overflow-hidden whitespace-nowrap inline-flex items-center justify-center w-5 h-5 border-transparent [&>*]:max-h-full`,\n { [getSubtleColorShadeClasses(color)]: subtle, [getColorShadeClasses(color)]: !subtle },\n props.className\n );\n\n return (\n <span\n {...otherProps}\n aria-label=\"icon\"\n className={className}\n data-taco=\"badge-icon\"\n ref={ref}\n role=\"status\"\n title={props['aria-label']}>\n <Icon name={icon} />\n </span>\n );\n});\n"],"names":["BadgeIcon","React","Badge","props","ref","color","icon","subtle","otherProps","className","cn","getSubtleColorShadeClasses","getColorShadeClasses","role","title","Icon","name"],"mappings":";;;;;MAeaA,SAAS,gBAAGC,UAAgB,CAAC,SAASC,KAAK,CAACC,KAAqB,EAAEC,GAA+B;EAC3G,MAAM;IAAEC,KAAK;IAAEC,IAAI;IAAEC,MAAM;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAEpD,MAAMM,SAAS,GAAGC,EAAE,4IAC2H,EAC3I;IAAE,CAACC,0BAA0B,CAACN,KAAK,CAAC,GAAGE,MAAM;IAAE,CAACK,oBAAoB,CAACP,KAAK,CAAC,GAAG,CAACE;GAAQ,EACvFJ,KAAK,CAACM,SAAS,CAClB;EAED,oBACIR,wCACQO,UAAU;kBACH,MAAM;IACjBC,SAAS,EAAEA,SAAS;iBACV,YAAY;IACtBL,GAAG,EAAEA,GAAG;IACRS,IAAI,EAAC,QAAQ;IACbC,KAAK,EAAEX,KAAK,CAAC,YAAY;mBACzBF,cAACc,IAAI;IAACC,IAAI,EAAEV;IAAQ,CACjB;AAEf,CAAC;;;;"}
|
@@ -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,EA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BAAKwD,QAAQ;MAAEtD,aAAa,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,CA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AACG,UAAU,CAAC,CAAC,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","clear","displayName"],"mappings":";;;;;;;;;;MA6CaA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAU,CAACE,KAAsB,EAAEC,GAAgC;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AAS,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,14 +2,14 @@ import React__default from 'react';
|
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Button } from './components/Button.js';
|
4
4
|
import { Link } from './components/Link.js';
|
5
|
-
import { Logo } from './components/Logo.js';
|
5
|
+
import { Logo, LogoLegacy } from './components/Logo.js';
|
6
6
|
import { PrimaryNavigation } from './components/PrimaryNavigation.js';
|
7
7
|
import { SecondaryNavigation } from './components/SecondaryNavigation.js';
|
8
8
|
import { MenuButton } from './components/MenuButton.js';
|
9
9
|
import { AgreementDisplay, AgreementSelector } from './components/AgreementSelector.js';
|
10
10
|
|
11
11
|
const Header = /*#__PURE__*/React__default.forwardRef(function Header(props, ref) {
|
12
|
-
const className = cn('bg-blue-900 flex h-16 w-full shrink-0 items-center gap-
|
12
|
+
const className = cn('bg-blue-900 flex h-16 w-full shrink-0 items-center gap-2 pl-4', '[&>*:focus-visible]:yt-focus-dark [&>*]:rounded',
|
13
13
|
// styles for logo wrapped inside an anchor
|
14
14
|
props.className);
|
15
15
|
return /*#__PURE__*/React__default.createElement("header", Object.assign({}, props, {
|
@@ -22,6 +22,7 @@ Header.AgreementSelector = AgreementSelector;
|
|
22
22
|
Header.Button = Button;
|
23
23
|
Header.Link = Link;
|
24
24
|
Header.Logo = Logo;
|
25
|
+
Header.LogoLegacy = LogoLegacy;
|
25
26
|
Header.PrimaryNavigation = PrimaryNavigation;
|
26
27
|
Header.SecondaryNavigation = SecondaryNavigation;
|
27
28
|
Header.MenuButton = MenuButton;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../../../../../../../src/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Button } from './components/Button';\nimport { Link } from './components/Link';\nimport { Logo } from './components/Logo';\nimport { PrimaryNavigation } from './components/PrimaryNavigation';\nimport { SecondaryNavigation } from './components/SecondaryNavigation';\nimport { MenuButton } from './components/MenuButton';\nimport { AgreementSelector, AgreementDisplay } from './components/AgreementSelector';\n\nexport type HeaderTexts = {\n addAgreement: string;\n logout: string;\n more: string;\n new: string;\n search: string;\n};\n\ntype HeaderProps = React.HTMLAttributes<HTMLElement>;\n\nexport type ForwardedHeaderWithStatics = React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLDivElement>> & {\n AgreementDisplay: typeof AgreementDisplay;\n AgreementSelector: typeof AgreementSelector;\n Button: typeof Button;\n Link: typeof Link;\n Logo: typeof Logo;\n PrimaryNavigation: typeof PrimaryNavigation;\n SecondaryNavigation: typeof SecondaryNavigation;\n MenuButton: typeof MenuButton;\n};\n\nexport const Header = React.forwardRef<HTMLDivElement, HeaderProps>(function Header(props, ref) {\n const className = cn(\n 'bg-blue-900 flex h-16 w-full shrink-0 items-center gap-
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../../../../src/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Button } from './components/Button';\nimport { Link } from './components/Link';\nimport { Logo, LogoLegacy } from './components/Logo';\nimport { PrimaryNavigation } from './components/PrimaryNavigation';\nimport { SecondaryNavigation } from './components/SecondaryNavigation';\nimport { MenuButton } from './components/MenuButton';\nimport { AgreementSelector, AgreementDisplay } from './components/AgreementSelector';\n\nexport type HeaderTexts = {\n addAgreement: string;\n logout: string;\n more: string;\n new: string;\n search: string;\n};\n\ntype HeaderProps = React.HTMLAttributes<HTMLElement>;\n\nexport type ForwardedHeaderWithStatics = React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLDivElement>> & {\n AgreementDisplay: typeof AgreementDisplay;\n AgreementSelector: typeof AgreementSelector;\n Button: typeof Button;\n Link: typeof Link;\n Logo: typeof Logo;\n LogoLegacy: typeof LogoLegacy;\n PrimaryNavigation: typeof PrimaryNavigation;\n SecondaryNavigation: typeof SecondaryNavigation;\n MenuButton: typeof MenuButton;\n};\n\nexport const Header = React.forwardRef<HTMLDivElement, HeaderProps>(function Header(props, ref) {\n const className = cn(\n 'bg-blue-900 flex h-16 w-full shrink-0 items-center gap-2 pl-4',\n '[&>*:focus-visible]:yt-focus-dark [&>*]:rounded', // styles for logo wrapped inside an anchor\n props.className\n );\n\n return <header {...props} className={className} ref={ref} />;\n}) as ForwardedHeaderWithStatics;\n\nHeader.AgreementDisplay = AgreementDisplay;\nHeader.AgreementSelector = AgreementSelector;\nHeader.Button = Button;\nHeader.Link = Link;\nHeader.Logo = Logo;\nHeader.LogoLegacy = LogoLegacy;\nHeader.PrimaryNavigation = PrimaryNavigation;\nHeader.SecondaryNavigation = SecondaryNavigation;\nHeader.MenuButton = MenuButton;\n"],"names":["Header","React","forwardRef","props","ref","className","cn","AgreementDisplay","AgreementSelector","Button","Link","Logo","LogoLegacy","PrimaryNavigation","SecondaryNavigation","MenuButton"],"mappings":";;;;;;;;;;MAgCaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAA8B,SAASF,MAAM,CAACG,KAAK,EAAEC,GAAG;EAC1F,MAAMC,SAAS,GAAGC,EAAE,CAChB,+DAA+D,EAC/D,iDAAiD;;EACjDH,KAAK,CAACE,SAAS,CAClB;EAED,oBAAOJ,yDAAYE,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAChE,CAAC;AAEDJ,MAAM,CAACO,gBAAgB,GAAGA,gBAAgB;AAC1CP,MAAM,CAACQ,iBAAiB,GAAGA,iBAAiB;AAC5CR,MAAM,CAACS,MAAM,GAAGA,MAAM;AACtBT,MAAM,CAACU,IAAI,GAAGA,IAAI;AAClBV,MAAM,CAACW,IAAI,GAAGA,IAAI;AAClBX,MAAM,CAACY,UAAU,GAAGA,UAAU;AAC9BZ,MAAM,CAACa,iBAAiB,GAAGA,iBAAiB;AAC5Cb,MAAM,CAACc,mBAAmB,GAAGA,mBAAmB;AAChDd,MAAM,CAACe,UAAU,GAAGA,UAAU;;;;"}
|
@@ -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,21 +4,19 @@ 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
|
+
}));
|
16
|
+
});
|
17
|
+
const getButtonClasses = (rounded = true) => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer 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', {
|
18
|
+
'!rounded-full': rounded
|
20
19
|
});
|
21
|
-
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
20
|
|
23
21
|
export { Button, getButtonClasses };
|
24
22
|
//# sourceMappingURL=Button.js.map
|
@@ -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 = (rounded = true) =>\n cn(\n '!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer 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 '!rounded-full': rounded,\n }\n );\n"],"names":["Button","React","forwardRef","props","ref","attributes","className","cn","getButtonClasses","IconButton","appearance","rounded"],"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,CAACG,OAAO,GAAG,IAAI,KAC3CJ,EAAE,CACE,6DAA6D,EAC7D,sEAAsE,EACtE,2FAA2F,EAC3F,+CAA+C,EAC/C;EACI,eAAe,EAAEI;CACpB;;;;"}
|