@economic/taco 1.40.2 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/dist/components/IconButton/IconButton.d.ts +3 -3
  2. package/dist/components/RadioGroup/util.d.ts +1 -0
  3. package/dist/components/Table2/Table2.d.ts +1 -1
  4. package/dist/components/Tabs/Tabs.d.ts +2 -0
  5. package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -0
  6. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +1 -0
  8. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  11. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +2 -7
  13. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/RadioGroup/util.js +14 -0
  15. package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -0
  16. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +4 -0
  17. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +3 -1
  19. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +2 -2
  22. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +9 -1
  24. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  25. package/dist/taco.cjs.development.js +31 -12
  26. package/dist/taco.cjs.development.js.map +1 -1
  27. package/dist/taco.cjs.production.min.js +1 -1
  28. package/dist/taco.cjs.production.min.js.map +1 -1
  29. package/package.json +8 -10
  30. package/tailwind.config.js +0 -1
  31. package/types.json +16 -4
@@ -30,7 +30,7 @@ export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'childre
30
30
  */
31
31
  rounded?: boolean;
32
32
  /** A tooltip to show when hovering over the button */
33
- tooltip?: string;
33
+ tooltip?: string | JSX.Element;
34
34
  };
35
35
  export declare const Base: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "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-label" | "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" | "shortcut" | "target"> & {
36
36
  /** Appearance will change the style of the button */
@@ -59,7 +59,7 @@ export declare const Base: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.
59
59
  */
60
60
  rounded?: boolean | undefined;
61
61
  /** A tooltip to show when hovering over the button */
62
- tooltip?: string | undefined;
62
+ tooltip?: string | JSX.Element | undefined;
63
63
  } & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
64
64
  export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "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-label" | "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" | "shortcut" | "target"> & {
65
65
  /** Appearance will change the style of the button */
@@ -88,5 +88,5 @@ export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrim
88
88
  */
89
89
  rounded?: boolean | undefined;
90
90
  /** A tooltip to show when hovering over the button */
91
- tooltip?: string | undefined;
91
+ tooltip?: string | JSX.Element | undefined;
92
92
  } & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
@@ -0,0 +1 @@
1
+ export declare const getRadioClassnames: (disabled?: boolean, invalid?: boolean) => string;
@@ -127,4 +127,4 @@ export declare type ForwardedTable2WithStatics = React.ForwardRefExoticComponent
127
127
  declare const Table2: ForwardedTable2WithStatics;
128
128
  export { Table2 };
129
129
  export type { Table2Props };
130
- export type { Table2ColumnProps, Table2ActionProps, Table2RowActionRenderer, Table2Settings } from './types';
130
+ export type { Table2ColumnProps, Table2ActionProps, Table2RowActionRenderer, Table2Settings, Table2Filter, Table2FilterComparator, } from './types';
@@ -36,6 +36,8 @@ export declare type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> &
36
36
  * When true, prevents the user from interacting with the tab.
37
37
  */
38
38
  disabled?: boolean;
39
+ /** A tooltip to show when hovering over the trigger */
40
+ tooltip?: string | JSX.Element;
39
41
  };
40
42
  export declare type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {
41
43
  /**
@@ -29,6 +29,7 @@ const Alert = /*#__PURE__*/React__default.forwardRef(function Alert(props, ref)
29
29
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
30
30
  ref: ref,
31
31
  className: className,
32
+ "data-taco": "alert",
32
33
  role: "alert"
33
34
  }), /*#__PURE__*/React__default.createElement(BadgeIcon, {
34
35
  className: "flex-none",
@@ -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/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 'question-mark';\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,eAAe;;AAElC,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
+ {"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 'question-mark';\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} data-taco=\"alert\" 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,eAAe;;AAElC,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;iBAAY,OAAO;IAACI,IAAI,EAAC;mBACnEX,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;;;;"}
@@ -41,6 +41,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
41
41
  }
42
42
  };
43
43
  const element = /*#__PURE__*/createElement(Root, Object.assign({}, otherProps, labelledByProps, {
44
+ "aria-invalid": invalid ? 'true' : undefined,
44
45
  "data-taco": "checkbox",
45
46
  checked: indeterminate ? 'indeterminate' : checked,
46
47
  className: className,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus-visible:yt-focus disabled:cursor-not-allowed text-white',\n {\n 'self-start': !!label,\n },\n invalid\n ? {\n 'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700':\n !props.disabled,\n 'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled,\n }\n : {\n 'border-grey-500 hover:border-grey-700 aria-checked:border-blue-500 aria-checked-mixed:border-blue-500 aria-checked:bg-blue-500 aria-checked-mixed:bg-blue-500 aria-checked:hover:border-blue-700 aria-checked-mixed:hover:border-blue-700 aria-checked:hover:bg-blue-700 aria-checked-mixed:hover:bg-blue-700':\n !props.disabled,\n 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked-mixed:bg-blue-500/50': props.disabled,\n },\n props.className\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n // the enter keyboard shortcut isn't supported by default, but we want it\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter') {\n event.currentTarget.click();\n }\n };\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","props","ref","checked","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","handleKeyDown","event","key","currentTarget","click","element","CheckboxPrimitive","onCheckedChange","onKeyDown","Icon","name","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;;MAuCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,EAAE,GAAGC,KAAK,CAACT,KAAK,CAACQ,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,iIAAiI,EACjI;IACI,YAAY,EAAE,CAAC,CAACN;GACnB,EACDD,OAAO,GACD;IACI,qSAAqS,EACjS,CAACJ,KAAK,CAACY,QAAQ;IACnB,mFAAmF,EAAE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8B,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus-visible:yt-focus disabled:cursor-not-allowed text-white',\n {\n 'self-start': !!label,\n },\n invalid\n ? {\n 'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700':\n !props.disabled,\n 'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled,\n }\n : {\n 'border-grey-500 hover:border-grey-700 aria-checked:border-blue-500 aria-checked-mixed:border-blue-500 aria-checked:bg-blue-500 aria-checked-mixed:bg-blue-500 aria-checked:hover:border-blue-700 aria-checked-mixed:hover:border-blue-700 aria-checked:hover:bg-blue-700 aria-checked-mixed:hover:bg-blue-700':\n !props.disabled,\n 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked-mixed:bg-blue-500/50': props.disabled,\n },\n props.className\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n // the enter keyboard shortcut isn't supported by default, but we want it\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter') {\n event.currentTarget.click();\n }\n };\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n aria-invalid={invalid ? 'true' : undefined}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","props","ref","checked","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","handleKeyDown","event","key","currentTarget","click","element","CheckboxPrimitive","undefined","onCheckedChange","onKeyDown","Icon","name","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;;MAuCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,EAAE,GAAGC,KAAK,CAACT,KAAK,CAACQ,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,iIAAiI,EACjI;IACI,YAAY,EAAE,CAAC,CAACN;GACnB,EACDD,OAAO,GACD;IACI,qSAAqS,EACjS,CAACJ,KAAK,CAACY,QAAQ;IACnB,mFAAmF,EAAEZ,KAAK,CAACY;GAC9F,GACD;IACI,+SAA+S,EAC3S,CAACZ,KAAK,CAACY,QAAQ;IACnB,kFAAkF,EAAEZ,KAAK,CAACY;GAC7F,EACPZ,KAAK,CAACU,SAAS,CAClB;EAED,IAAIG,YAA2D;EAE/D,IAAIP,QAAQ,EAAE;IACVO,YAAY,GAAIX,OAAqB,IAAKI,QAAQ,CAACJ,OAAO,KAAK,eAAe,GAAG,KAAK,GAAGA,OAAO,CAAC;;EAGrG,IAAIY,eAAe,GAAkC,IAAI;EAEzD,IAAIT,KAAK,EAAE;IACPS,eAAe,GAAG;MACd,iBAAiB,KAAKN,UAAU;MAChCA;KACH;;;EAIL,MAAMO,aAAa,GAAIC,KAA6C;IAChE,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,EAAE;MACvBD,KAAK,CAACE,aAAa,CAACC,KAAK,EAAE;;GAElC;EAED,MAAMC,OAAO,gBACTrB,cAACsB,IAAsB,oBACfd,UAAU,EACVO,eAAe;oBACLV,OAAO,GAAG,MAAM,GAAGkB,SAAS;iBAChC,UAAU;IACpBpB,OAAO,EAAEC,aAAa,GAAG,eAAe,GAAGD,OAAO;IAClDQ,SAAS,EAAEA,SAAS;IACpBa,eAAe,EAAEV,YAAY;IAC7BW,SAAS,EAAET,aAAa;IACxBd,GAAG,EAAEA;mBACLF,cAACsB,SAA2B;IAACX,SAAS,EAAC;kBACnCX,cAAC0B,IAAI;IAACC,IAAI,EAAEvB,aAAa,GAAG,MAAM,GAAG,MAAM;IAAEO,SAAS,EAAC;IAAoB,CACjD,CAErC;EAED,IAAIL,KAAK,EAAE;IACP,MAAMsB,uBAAuB,GAAGhB,EAAE,CAAC,wCAAwC,EAAE;MACzE,kCAAkC,EAAEX,KAAK,CAACY;KAC7C,CAAC;IAEF,oBACIb;MAAMW,SAAS,EAAEiB;OACZP,OAAO,eACRrB;MAAO6B,OAAO,EAAEpB,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOe,OAAO;AAClB,CAAC;AACDtB,QAAQ,CAAC+B,WAAW,GAAG,UAAU;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sources":["../../../../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /**\n * Set whether the button is rounded.\n * Default value is `false`\n */\n rounded?: boolean;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const Base = React.forwardRef(function IconButtonBase(\n props: IconButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { icon, rounded = false, ...otherProps } = props;\n\n const className = cn(\n 'w-8',\n getButtonClasses(),\n getAppearanceClasses(otherProps.appearance, true),\n {\n 'rounded-full': rounded,\n rounded: !rounded,\n },\n props.className\n );\n\n if (!icon) {\n return null;\n }\n\n return createButtonWithTooltip(\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\n className,\n ref\n );\n});\n\nexport const IconButton = React.forwardRef(function Button(\n props: IconButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, hanger, menu, popover, ...buttonProps } = props;\n const button = <Base {...buttonProps} ref={ref} />;\n\n return createButtonWithOverlays({ dialog, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","IconButtonBase","props","ref","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","createButtonWithTooltip","children","Icon","name","IconButton","Button","dialog","hanger","menu","popover","buttonProps","button","createButtonWithOverlays"],"mappings":";;;;;MAsCaA,IAAI,gBAAGC,UAAgB,CAAC,SAASC,cAAc,CACxDC,KAAsB,EACtBC,GAAqD;EAErD,MAAM;IAAEC,IAAI;IAAEC,OAAO,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAEtD,MAAMK,SAAS,GAAGC,EAAE,CAChB,KAAK,EACLC,gBAAgB,EAAE,EAClBC,oBAAoB,CAACJ,UAAU,CAACK,UAAU,EAAE,IAAI,CAAC,EACjD;IACI,cAAc,EAAEN,OAAO;IACvBA,OAAO,EAAE,CAACA;GACb,EACDH,KAAK,CAACK,SAAS,CAClB;EAED,IAAI,CAACH,IAAI,EAAE;IACP,OAAO,IAAI;;EAGf,OAAOQ,uBAAuB,CAC1B;IAAE,GAAGN,UAAU;IAAEO,QAAQ,eAAEb,cAACc,IAAI;MAACC,IAAI,EAAEX,IAAI;MAAEG,SAAS,EAAC;MAAY;IAAE,WAAW,EAAE;GAAe,EACjGA,SAAS,EACTJ,GAAG,CACN;AACL,CAAC;MAEYa,UAAU,gBAAGhB,UAAgB,CAAC,SAASiB,MAAM,CACtDf,KAAsB,EACtBC,GAAqD;EAErD,MAAM;IAAEe,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGpB,KAAK;EAC/D,MAAMqB,MAAM,gBAAGvB,cAACD,IAAI,oBAAKuB,WAAW;IAAEnB,GAAG,EAAEA;KAAO;EAElD,OAAOqB,wBAAwB,CAAC;IAAEN,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEE,MAAM,CAAC;AAC9E,CAAC;;;;"}
1
+ {"version":3,"file":"IconButton.js","sources":["../../../../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /**\n * Set whether the button is rounded.\n * Default value is `false`\n */\n rounded?: boolean;\n /** A tooltip to show when hovering over the button */\n tooltip?: string | JSX.Element;\n};\n\nexport const Base = React.forwardRef(function IconButtonBase(\n props: IconButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { icon, rounded = false, ...otherProps } = props;\n\n const className = cn(\n 'w-8',\n getButtonClasses(),\n getAppearanceClasses(otherProps.appearance, true),\n {\n 'rounded-full': rounded,\n rounded: !rounded,\n },\n props.className\n );\n\n if (!icon) {\n return null;\n }\n\n return createButtonWithTooltip(\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\n className,\n ref\n );\n});\n\nexport const IconButton = React.forwardRef(function Button(\n props: IconButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, hanger, menu, popover, ...buttonProps } = props;\n const button = <Base {...buttonProps} ref={ref} />;\n\n return createButtonWithOverlays({ dialog, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","IconButtonBase","props","ref","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","createButtonWithTooltip","children","Icon","name","IconButton","Button","dialog","hanger","menu","popover","buttonProps","button","createButtonWithOverlays"],"mappings":";;;;;MAsCaA,IAAI,gBAAGC,UAAgB,CAAC,SAASC,cAAc,CACxDC,KAAsB,EACtBC,GAAqD;EAErD,MAAM;IAAEC,IAAI;IAAEC,OAAO,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAEtD,MAAMK,SAAS,GAAGC,EAAE,CAChB,KAAK,EACLC,gBAAgB,EAAE,EAClBC,oBAAoB,CAACJ,UAAU,CAACK,UAAU,EAAE,IAAI,CAAC,EACjD;IACI,cAAc,EAAEN,OAAO;IACvBA,OAAO,EAAE,CAACA;GACb,EACDH,KAAK,CAACK,SAAS,CAClB;EAED,IAAI,CAACH,IAAI,EAAE;IACP,OAAO,IAAI;;EAGf,OAAOQ,uBAAuB,CAC1B;IAAE,GAAGN,UAAU;IAAEO,QAAQ,eAAEb,cAACc,IAAI;MAACC,IAAI,EAAEX,IAAI;MAAEG,SAAS,EAAC;MAAY;IAAE,WAAW,EAAE;GAAe,EACjGA,SAAS,EACTJ,GAAG,CACN;AACL,CAAC;MAEYa,UAAU,gBAAGhB,UAAgB,CAAC,SAASiB,MAAM,CACtDf,KAAsB,EACtBC,GAAqD;EAErD,MAAM;IAAEe,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGpB,KAAK;EAC/D,MAAMqB,MAAM,gBAAGvB,cAACD,IAAI,oBAAKuB,WAAW;IAAEnB,GAAG,EAAEA;KAAO;EAElD,OAAOqB,wBAAwB,CAAC;IAAEN,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEE,MAAM,CAAC;AAC9E,CAAC;;;;"}
@@ -37,7 +37,7 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWit
37
37
  const prefixRef = useRef(null);
38
38
  const prefixRect = useBoundingClientRectListener(prefixRef);
39
39
  const postfixRef = useRef(null);
40
- const postfixRect = useBoundingClientRectListener(postfixRef);
40
+ const postfixRect = useBoundingClientRectListener(postfixRef, [postfix]);
41
41
  const className = cn(getInputClasses(props), {
42
42
  'pl-8': !!prefix,
43
43
  'pr-8': !!postfix
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getButtonStateClasses, getInputClasses } from './util';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../hooks/useMergedRef';\n\nexport type InputWithoutDeprecatedFeaturesProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> & {\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n postfix?: string | JSX.Element;\n prefix?: string | JSX.Element;\n};\n\nconst validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];\n\nconst InputWithoutDeprecatedFeatures = React.forwardRef(function InputWithoutDeprecatedFeatures(\n props: InputWithoutDeprecatedFeaturesProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { highlighted, invalid, onKeyDown, postfix, prefix, type = 'text', ...attributes } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n\n let handleKeyDown = onKeyDown;\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange\n if (validSetSelectionRangeTypes.includes(type)) {\n handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n }\n\n const prefixRef = React.useRef<HTMLDivElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLDivElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef);\n\n const className = cn(\n getInputClasses(props),\n {\n 'pl-8': !!prefix,\n 'pr-8': !!postfix,\n },\n attributes.className\n );\n\n return (\n <div className=\"relative inline-flex w-full\" data-taco=\"input-container\" style={{ opacity: 0.999 }}>\n <input\n {...attributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\n aria-invalid={invalid}\n data-highlighted={highlighted}\n ref={internalRef}\n style={{\n paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,\n paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined,\n }}\n type={type}\n />\n {prefix ? <Affix type=\"prefix\" children={prefix} disabled={attributes.disabled} ref={prefixRef} /> : null}\n {postfix ? <Affix type=\"postfix\" children={postfix} disabled={attributes.disabled} ref={postfixRef} /> : null}\n </div>\n );\n});\n\ntype AffixProps = {\n children: string | JSX.Element;\n disabled?: boolean;\n type: 'prefix' | 'postfix';\n};\nconst Affix = React.memo(\n React.forwardRef(function Affix(props: AffixProps, ref: React.Ref<HTMLDivElement>) {\n const { children, disabled, type } = props;\n\n return (\n <div\n className={cn(\n 'group absolute top-0 flex h-full items-center justify-center px-2',\n // icon\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0 [&>button]:!-ml-2': type === 'prefix',\n 'right-0 [&>button]:!-mr-2': type === 'postfix',\n }\n )}\n data-affix-type={type}\n ref={ref}>\n {children}\n </div>\n );\n })\n);\n\nexport type InputProps = InputWithoutDeprecatedFeaturesProps & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n};\n\nexport const Input = React.forwardRef(function LegacyInput(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, ...attributes } = props;\n\n let postfix;\n\n if (button) {\n const disabled = button.props.disabled || attributes.disabled;\n const buttonClassName = cn(\n 'items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n getButtonStateClasses(attributes.invalid, disabled),\n button.props.className\n );\n postfix = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n postfix = typeof icon === 'string' ? <Icon name={icon} /> : icon;\n }\n\n return <InputWithoutDeprecatedFeatures {...attributes} postfix={attributes.postfix ?? postfix} ref={ref} />;\n});\n"],"names":["validSetSelectionRangeTypes","InputWithoutDeprecatedFeatures","React","props","ref","highlighted","invalid","onKeyDown","postfix","prefix","type","attributes","internalRef","useMergedRef","handleKeyDown","includes","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","style","opacity","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8B,CAC3FE,KAA0C,EAC1CC,GAAgC;EAEhC,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI,GAAG,MAAM;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAChG,MAAMS,WAAW,GAAGC,YAAY,CAAmBT,GAAG,CAAC;EAEvD,IAAIU,aAAa,GAAGP,SAAS;;;;;EAM7B,IAAIP,2BAA2B,CAACe,QAAQ,CAACL,IAAI,CAAC,EAAE;IAC5CI,aAAa,GAAIE,KAA4C;MACzD,IAAI,CAACA,KAAK,CAACC,QAAQ,KAAKD,KAAK,CAACE,GAAG,KAAK,MAAM,IAAIF,KAAK,CAACE,GAAG,KAAK,KAAK,CAAC,EAAE;QAClEF,KAAK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MAAM,EAAE;MACjCd,SAAS,EAAEgB,eAAe;MAC1BL;KACH,CAAC;GACL,MAAM,IAAII,IAAI,EAAE;IACbrC,OAAO,GAAG,OAAOqC,IAAI,KAAK,QAAQ,gBAAG3C,cAAC8C,IAAI;MAACC,IAAI,EAAEJ;MAAQ,GAAGA,IAAI;;EAGpE,oBAAO3C,cAACD,8BAA8B,oBAAKU,UAAU;IAAEH,OAAO,yBAAEG,UAAU,CAACH,OAAO,qEAAIA,OAAO;IAAEJ,GAAG,EAAEA;KAAO;AAC/G,CAAC;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getButtonStateClasses, getInputClasses } from './util';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../hooks/useMergedRef';\n\nexport type InputWithoutDeprecatedFeaturesProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> & {\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n postfix?: string | JSX.Element;\n prefix?: string | JSX.Element;\n};\n\nconst validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];\n\nconst InputWithoutDeprecatedFeatures = React.forwardRef(function InputWithoutDeprecatedFeatures(\n props: InputWithoutDeprecatedFeaturesProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { highlighted, invalid, onKeyDown, postfix, prefix, type = 'text', ...attributes } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n\n let handleKeyDown = onKeyDown;\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange\n if (validSetSelectionRangeTypes.includes(type)) {\n handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n }\n\n const prefixRef = React.useRef<HTMLDivElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLDivElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef, [postfix]);\n\n const className = cn(\n getInputClasses(props),\n {\n 'pl-8': !!prefix,\n 'pr-8': !!postfix,\n },\n attributes.className\n );\n\n return (\n <div className=\"relative inline-flex w-full\" data-taco=\"input-container\" style={{ opacity: 0.999 }}>\n <input\n {...attributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\n aria-invalid={invalid}\n data-highlighted={highlighted}\n ref={internalRef}\n style={{\n paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,\n paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined,\n }}\n type={type}\n />\n {prefix ? <Affix type=\"prefix\" children={prefix} disabled={attributes.disabled} ref={prefixRef} /> : null}\n {postfix ? <Affix type=\"postfix\" children={postfix} disabled={attributes.disabled} ref={postfixRef} /> : null}\n </div>\n );\n});\n\ntype AffixProps = {\n children: string | JSX.Element;\n disabled?: boolean;\n type: 'prefix' | 'postfix';\n};\nconst Affix = React.memo(\n React.forwardRef(function Affix(props: AffixProps, ref: React.Ref<HTMLDivElement>) {\n const { children, disabled, type } = props;\n\n return (\n <div\n className={cn(\n 'group absolute top-0 flex h-full items-center justify-center px-2',\n // icon\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0 [&>button]:!-ml-2': type === 'prefix',\n 'right-0 [&>button]:!-mr-2': type === 'postfix',\n }\n )}\n data-affix-type={type}\n ref={ref}>\n {children}\n </div>\n );\n })\n);\n\nexport type InputProps = InputWithoutDeprecatedFeaturesProps & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n};\n\nexport const Input = React.forwardRef(function LegacyInput(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, ...attributes } = props;\n\n let postfix;\n\n if (button) {\n const disabled = button.props.disabled || attributes.disabled;\n const buttonClassName = cn(\n 'items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n getButtonStateClasses(attributes.invalid, disabled),\n button.props.className\n );\n postfix = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n postfix = typeof icon === 'string' ? <Icon name={icon} /> : icon;\n }\n\n return <InputWithoutDeprecatedFeatures {...attributes} postfix={attributes.postfix ?? postfix} ref={ref} />;\n});\n"],"names":["validSetSelectionRangeTypes","InputWithoutDeprecatedFeatures","React","props","ref","highlighted","invalid","onKeyDown","postfix","prefix","type","attributes","internalRef","useMergedRef","handleKeyDown","includes","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","style","opacity","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8B,CAC3FE,KAA0C,EAC1CC,GAAgC;EAEhC,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI,GAAG,MAAM;IAAE,GAAGC;GAAY,GAAGR,KAAK;EA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KAAK;EAE7C,IAAIK,OAAO;EAEX,IAAIoC,MAAM,EAAE;IACR,MAAMH,QAAQ,GAAGG,MAAM,CAACzC,KAAK,CAACsC,QAAQ,IAAI9B,UAAU,CAAC8B,QAAQ;IAC7D,MAAMK,eAAe,GAAGf,EAAE,CACtB,8GAA8G,EAC9GgB,qBAAqB,CAACpC,UAAU,CAACL,OAAO,EAAEmC,QAAQ,CAAC,EACnDG,MAAM,CAACzC,KAAK,CAAC2B,SAAS,CACzB;IACDtB,OAAO,gBAAGN,YAAkB,CAAC0C,MAAM,EAAE;MACjCd,SAAS,EAAEgB,eAAe;MAC1BL;KACH,CAAC;GACL,MAAM,IAAII,IAAI,EAAE;IACbrC,OAAO,GAAG,OAAOqC,IAAI,KAAK,QAAQ,gBAAG3C,cAAC8C,IAAI;MAACC,IAAI,EAAEJ;MAAQ,GAAGA,IAAI;;EAGpE,oBAAO3C,cAACD,8BAA8B,oBAAKU,UAAU;IAAEH,OAAO,yBAAEG,UAAU,CAACH,OAAO,qEAAIA,OAAO;IAAEJ,GAAG,EAAEA;KAAO;AAC/G,CAAC;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { useMemo, Children, forwardRef, createElement, createContext, useContext, isValidElement } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Root, Item, Indicator } from '@radix-ui/react-radio-group';
4
+ import { getRadioClassnames } from './util.js';
4
5
 
5
6
  const getRadioGroupItemValueAsString = value => String(value !== null && value !== void 0 ? value : '');
6
7
  const findByValue = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
@@ -16,13 +17,7 @@ const RadioGroupItem = /*#__PURE__*/forwardRef(function RadioGroupItem(props, re
16
17
  ...otherProps
17
18
  } = props;
18
19
  const isDisabled = context.disabled || props.disabled;
19
- const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 focus-visible:yt-focus disabled:cursor-not-allowed hover:border-4', context.invalid ? {
20
- 'border-red-500 hover:border-red-700 aria-checked:bg-red-500 aria-checked:border-red-500 hover:aria-checked:border-red-700': !isDisabled,
21
- 'border-red-500/50 aria-checked:bg-red-500/50 aria-checked:border-red-500/50': isDisabled
22
- } : {
23
- 'border-grey-500 hover:border-grey-700 aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-700': !isDisabled,
24
- 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked:border-blue-500/50': isDisabled
25
- });
20
+ const className = cn('self-start', getRadioClassnames(isDisabled, context.invalid));
26
21
  const labelClassName = cn('flex items-center gap-2', {
27
22
  'cursor-pointer': !isDisabled,
28
23
  'cursor-not-allowed text-grey-300': isDisabled
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../../../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { Orientation } from '../../types';\n\nexport type RadioGroupItemValue = string | number | boolean | null;\n\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => String(value ?? '');\n\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\n\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\n\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\n React.ButtonHTMLAttributes<T>,\n 'children' | 'onSelect' | 'value'\n> & {\n /** Label for the radio group item */\n children: React.ReactNode;\n /* Whether the radio group item is disabled */\n disabled?: boolean;\n /** Value of the radio button */\n value: RadioGroupItemValue;\n};\n\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(RadioGroupContext);\n const { children, value, ...otherProps } = props;\n\n const isDisabled = context.disabled || props.disabled;\n\n const className = cn(\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 focus-visible:yt-focus disabled:cursor-not-allowed hover:border-4',\n context.invalid\n ? {\n 'border-red-500 hover:border-red-700 aria-checked:bg-red-500 aria-checked:border-red-500 hover:aria-checked:border-red-700':\n !isDisabled,\n 'border-red-500/50 aria-checked:bg-red-500/50 aria-checked:border-red-500/50': isDisabled,\n }\n : {\n 'border-grey-500 hover:border-grey-700 aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-700':\n !isDisabled,\n 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked:border-blue-500/50': isDisabled,\n }\n );\n const labelClassName = cn(\n 'flex items-center gap-2',\n {\n 'cursor-pointer': !isDisabled,\n 'cursor-not-allowed text-grey-300': isDisabled,\n },\n props.className\n );\n\n return (\n <label className={labelClassName}>\n <RadioGroupPrimitive.Item\n {...otherProps}\n className={className}\n disabled={isDisabled}\n ref={ref}\n value={getRadioGroupItemValueAsString(value)}>\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\n </RadioGroupPrimitive.Item>\n {children}\n </label>\n );\n});\n\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\n\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: ReactGroupBaseChild[];\n /* Whether the radio group is disabled */\n disabled?: boolean;\n /* Whether the radio group is in an invalid state */\n invalid?: boolean;\n /** The name of the radio group, used when submitting an HTML form */\n name?: string;\n /**\n * Orientation of the radio group\n * @defaultValue vertical\n */\n orientation?: Orientation;\n /* Whether the radio group requires user input */\n required?: boolean;\n};\n\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\n /* The default value (uncontrolled) */\n defaultValue?: RadioGroupItemValue;\n onChange?: never;\n value?: never;\n}\n\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\n defaultValue?: never;\n /** Handler called when the value changes */\n onChange: (value: RadioGroupItemValue) => void;\n /** The current value (controlled) */\n value?: RadioGroupItemValue;\n}\n\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\n\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Item component rendered in a `RadioGroup` component */\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\n};\n\nexport const useRadioGroup = (props: RadioGroupProps) => {\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\n\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\n const radioGroupItemValues: RadioGroupItemValue[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n radioGroupItemValues.push(child.props.value);\n }\n });\n\n return radioGroupItemValues;\n }, [children]);\n\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\n\n let valueProps;\n\n if (onChange !== undefined) {\n const handleChange = (value: string): void => onChange(findByValue(values, value));\n\n valueProps = {\n onValueChange: handleChange,\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\n };\n } else {\n valueProps = {\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\n };\n }\n\n return {\n context,\n props: {\n ...otherProps,\n ...valueProps,\n children,\n disabled,\n orientation,\n },\n };\n};\n\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn(\n 'flex items-start gap-y-2',\n {\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\n 'flex-col': otherProps.orientation === 'vertical',\n },\n otherProps.className\n );\n\n return (\n <RadioGroupContext.Provider value={context}>\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\n </RadioGroupContext.Provider>\n );\n}) as ForwardedRadioGroupWithStatics;\nRadioGroup.Item = RadioGroupItem;\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;MAOaA,8BAA8B,GAAIC,KAA0B,IAAaC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;MAE3FE,WAAW,GAAG,CAACC,MAA6B,EAAEC,aAAqB,KAC5ED,MAAM,CAACE,IAAI,CAACL,KAAK,IAAID,8BAA8B,CAACC,KAAK,CAAC,KAAKI,aAAa;AAEhF,MAAME,iBAAiB,gBAAGC,aAAmB,CAAC;EAAEC,QAAQ,EAAE,KAAK;EAAEC,OAAO,EAAE;CAAO,CAAC;AAclF,MAAMC,cAAc,gBAAGH,UAAgB,CAAC,SAASG,cAAc,CAACC,KAA0B,EAAEC,GAAiC;EACzH,MAAMC,OAAO,GAAGN,UAAgB,CAACD,iBAAiB,CAAC;EACnD,MAAM;IAAEQ,QAAQ;IAAEd,KAAK;IAAE,GAAGe;GAAY,GAAGJ,KAAK;EAEhD,MAAMK,UAAU,GAAGH,OAAO,CAACL,QAAQ,IAAIG,KAAK,CAACH,QAAQ;EAErD,MAAMS,SAAS,GAAGC,EAAE,CAChB,gLAAgL,EAChLL,OAAO,CAACJ,OAAO,GACT;IACI,2HAA2H,EACvH,CAACO,UAAU;IACf,6EAA6E,EAAEA;GAClF,GACD;IACI,gIAAgI,EAC5H,CAACA,UAAU;IACf,gFAAgF,EAAEA;GACrF,CACV;EACD,MAAMG,cAAc,GAAGD,EAAE,CACrB,yBAAyB,EACzB;IACI,gBAAgB,EAAE,CAACF,UAAU;IAC7B,kCAAkC,EAAEA;GACvC,EACDL,KAAK,CAACM,SAAS,CAClB;EAED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/B,KAAK,EAAEA,KAAK,KAAK8B,SAAS,GAAG/B,8BAA8B,CAACC,KAAK,CAAC,GAAG8B;KACxE;GACJ,MAAM;IACHD,UAAU,GAAG;MACTP,YAAY,EAAEA,YAAY,KAAKQ,SAAS,GAAG/B,8BAA8B,CAACuB,YAAY,CAAC,GAAGQ;KAC7F;;EAGL,OAAO;IACHjB,OAAO;IACPF,KAAK,EAAE;MACH,GAAGI,UAAU;MACb,GAAGc,UAAU;MACbf,QAAQ;MACRN,QAAQ;MACRgB;;GAEP;AACL;MAEaS,UAAU,gBAAG1B,UAAgB,CAAC,SAAS0B,UAAU,CAACtB,KAAsB,EAAEC,GAA8B;EACjH,MAAM;IAAEC,OAAO;IAAEF,KAAK,EAAEI;GAAY,GAAGM,aAAa,CAACV,KAAK,CAAC;EAC3D,MAAMM,SAAS,GAAGC,EAAE,CAChB,0BAA0B,EAC1B;IACI,oBAAoB,EAAEH,UAAU,CAACS,WAAW,KAAK,YAAY;IAC7D,UAAU,EAAET,UAAU,CAACS,WAAW,KAAK;GAC1C,EACDT,UAAU,CAACE,SAAS,CACvB;EAED,oBACIV,cAACD,iBAAiB,CAAC4B,QAAQ;IAAClC,KAAK,EAAEa;kBAC/BN,cAACa,IAAwB,oBAAKL,UAAU;IAAEE,SAAS,EAAEA,SAAS;iBAAY,aAAa;IAACL,GAAG,EAAEA;KAAO,CAC3E;AAErC,CAAC;AACDqB,UAAU,CAACE,IAAI,GAAGzB,cAAc;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../../../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { Orientation } from '../../types';\nimport { getRadioClassnames } from './util';\n\nexport type RadioGroupItemValue = string | number | boolean | null;\n\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => String(value ?? '');\n\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\n\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\n\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\n React.ButtonHTMLAttributes<T>,\n 'children' | 'onSelect' | 'value'\n> & {\n /** Label for the radio group item */\n children: React.ReactNode;\n /* Whether the radio group item is disabled */\n disabled?: boolean;\n /** Value of the radio button */\n value: RadioGroupItemValue;\n};\n\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(RadioGroupContext);\n const { children, value, ...otherProps } = props;\n\n const isDisabled = context.disabled || props.disabled;\n\n const className = cn('self-start', getRadioClassnames(isDisabled, context.invalid));\n const labelClassName = cn(\n 'flex items-center gap-2',\n {\n 'cursor-pointer': !isDisabled,\n 'cursor-not-allowed text-grey-300': isDisabled,\n },\n props.className\n );\n\n return (\n <label className={labelClassName}>\n <RadioGroupPrimitive.Item\n {...otherProps}\n className={className}\n disabled={isDisabled}\n ref={ref}\n value={getRadioGroupItemValueAsString(value)}>\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\n </RadioGroupPrimitive.Item>\n {children}\n </label>\n );\n});\n\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\n\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: ReactGroupBaseChild[];\n /* Whether the radio group is disabled */\n disabled?: boolean;\n /* Whether the radio group is in an invalid state */\n invalid?: boolean;\n /** The name of the radio group, used when submitting an HTML form */\n name?: string;\n /**\n * Orientation of the radio group\n * @defaultValue vertical\n */\n orientation?: Orientation;\n /* Whether the radio group requires user input */\n required?: boolean;\n};\n\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\n /* The default value (uncontrolled) */\n defaultValue?: RadioGroupItemValue;\n onChange?: never;\n value?: never;\n}\n\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\n defaultValue?: never;\n /** Handler called when the value changes */\n onChange: (value: RadioGroupItemValue) => void;\n /** The current value (controlled) */\n value?: RadioGroupItemValue;\n}\n\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\n\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Item component rendered in a `RadioGroup` component */\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\n};\n\nexport const useRadioGroup = (props: RadioGroupProps) => {\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\n\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\n const radioGroupItemValues: RadioGroupItemValue[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n radioGroupItemValues.push(child.props.value);\n }\n });\n\n return radioGroupItemValues;\n }, [children]);\n\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\n\n let valueProps;\n\n if (onChange !== undefined) {\n const handleChange = (value: string): void => onChange(findByValue(values, value));\n\n valueProps = {\n onValueChange: handleChange,\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\n };\n } else {\n valueProps = {\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\n };\n }\n\n return {\n context,\n props: {\n ...otherProps,\n ...valueProps,\n children,\n disabled,\n orientation,\n },\n };\n};\n\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn(\n 'flex items-start gap-y-2',\n {\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\n 'flex-col': otherProps.orientation === 'vertical',\n },\n otherProps.className\n );\n\n return (\n <RadioGroupContext.Provider value={context}>\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\n </RadioGroupContext.Provider>\n );\n}) as ForwardedRadioGroupWithStatics;\nRadioGroup.Item = RadioGroupItem;\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","getRadioClassnames","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;;MAQaA,8BAA8B,GAAIC,KAA0B,IAAaC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;MAE3FE,WAAW,GAAG,CAACC,MAA6B,EAAEC,aAAqB,KAC5ED,MAAM,CAACE,IAAI,CAACL,KAAK,IAAID,8BAA8B,CAACC,KAAK,CAAC,KAAKI,aAAa;AAEhF,MAAME,iBAAiB,gBAAGC,aAAmB,CAAC;EAAEC,QAAQ,EAAE,KAAK;EAAEC,OAAO,EAAE;CAAO,CAAC;AAclF,MAAMC,cAAc,gBAAGH,UAAgB,CAAC,SAASG,cAAc,CAACC,KAA0B,EAAEC,GAAiC;EACzH,MAAMC,OAAO,GAAGN,UAAgB,CAACD,iBAAiB,CAAC;EACnD,MAAM;IAAEQ,QAAQ;IAAEd,KAAK;IAAE,GAAGe;GAAY,GAAGJ,KAAK;EAEhD,MAAMK,UAAU,GAAGH,OAAO,CAACL,QAAQ,IAAIG,KAAK,CAACH,QAAQ;EAErD,MAAMS,SAAS,GAAGC,EAAE,CAAC,YAAY,EAAEC,kBAAkB,CAACH,UAAU,EAAEH,OAAO,CAACJ,OAAO,CAAC,CAAC;EACnF,MAAMW,cAAc,GAAGF,EAAE,CACrB,yBAAyB,EACzB;IACI,gBAAgB,EAAE,CAACF,UAAU;IAC7B,kCAAkC,EAAEA;GACvC,EACDL,KA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,aAAa,EAAED,YAAY;MAC3BhC,KAAK,EAAEA,KAAK,KAAK+B,SAAS,GAAGhC,8BAA8B,CAACC,KAAK,CAAC,GAAG+B;KACxE;GACJ,MAAM;IACHD,UAAU,GAAG;MACTP,YAAY,EAAEA,YAAY,KAAKQ,SAAS,GAAGhC,8BAA8B,CAACwB,YAAY,CAAC,GAAGQ;KAC7F;;EAGL,OAAO;IACHlB,OAAO;IACPF,KAAK,EAAE;MACH,GAAGI,UAAU;MACb,GAAGe,UAAU;MACbhB,QAAQ;MACRN,QAAQ;MACRiB;;GAEP;AACL;MAEaS,UAAU,gBAAG3B,UAAgB,CAAC,SAAS2B,UAAU,CAACvB,KAAsB,EAAEC,GAA8B;EACjH,MAAM;IAAEC,OAAO;IAAEF,KAAK,EAAEI;GAAY,GAAGO,aAAa,CAACX,KAAK,CAAC;EAC3D,MAAMM,SAAS,GAAGC,EAAE,CAChB,0BAA0B,EAC1B;IACI,oBAAoB,EAAEH,UAAU,CAACU,WAAW,KAAK,YAAY;IAC7D,UAAU,EAAEV,UAAU,CAACU,WAAW,KAAK;GAC1C,EACDV,UAAU,CAACE,SAAS,CACvB;EAED,oBACIV,cAACD,iBAAiB,CAAC6B,QAAQ;IAACnC,KAAK,EAAEa;kBAC/BN,cAACc,IAAwB,oBAAKN,UAAU;IAAEE,SAAS,EAAEA,SAAS;iBAAY,aAAa;IAACL,GAAG,EAAEA;KAAO,CAC3E;AAErC,CAAC;AACDsB,UAAU,CAACE,IAAI,GAAG1B,cAAc;;;;"}
@@ -0,0 +1,14 @@
1
+ import cn from 'classnames';
2
+
3
+ const getRadioClassnames = (disabled = false, invalid = false) => {
4
+ return cn('flex flex-shrink-0 items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 focus-visible:yt-focus disabled:cursor-not-allowed hover:border-4', invalid ? {
5
+ 'border-red-500 hover:border-red-700 aria-checked:bg-red-500 aria-checked:border-red-500 hover:aria-checked:border-red-700': !disabled,
6
+ 'border-red-500/50 aria-checked:bg-red-500/50 aria-checked:border-red-500/50': disabled
7
+ } : {
8
+ 'border-grey-500 hover:border-grey-700 aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-700': !disabled,
9
+ 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked:border-blue-500/50': disabled
10
+ });
11
+ };
12
+
13
+ export { getRadioClassnames };
14
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/RadioGroup/util.ts"],"sourcesContent":["import cn from 'classnames';\n\nexport const getRadioClassnames = (disabled = false, invalid = false) => {\n return cn(\n 'flex flex-shrink-0 items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 focus-visible:yt-focus disabled:cursor-not-allowed hover:border-4',\n invalid\n ? {\n 'border-red-500 hover:border-red-700 aria-checked:bg-red-500 aria-checked:border-red-500 hover:aria-checked:border-red-700':\n !disabled,\n 'border-red-500/50 aria-checked:bg-red-500/50 aria-checked:border-red-500/50': disabled,\n }\n : {\n 'border-grey-500 hover:border-grey-700 aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-700':\n !disabled,\n 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked:border-blue-500/50': disabled,\n }\n );\n};\n"],"names":["getRadioClassnames","disabled","invalid","cn"],"mappings":";;MAEaA,kBAAkB,GAAG,CAACC,QAAQ,GAAG,KAAK,EAAEC,OAAO,GAAG,KAAK;EAChE,OAAOC,EAAE,CACL,qKAAqK,EACrKD,OAAO,GACD;IACI,2HAA2H,EACvH,CAACD,QAAQ;IACb,6EAA6E,EAAEA;GAClF,GACD;IACI,gIAAgI,EAC5H,CAACA,QAAQ;IACb,gFAAgF,EAAEA;GACrF,CACV;AACL;;;;"}
@@ -31,6 +31,10 @@ const SearchInput = /*#__PURE__*/forwardRef(function SearchInput({
31
31
  handleClick();
32
32
  return;
33
33
  }
34
+ if (event.key === 'Escape') {
35
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch('');
36
+ return;
37
+ }
34
38
  };
35
39
  return /*#__PURE__*/createElement(Input, Object.assign({
36
40
  "aria-label": texts.searchInput.placeholder,
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef } from '../../utils/input';\n\nexport type SearchInputTexts = {\n button: string;\n clear: string;\n placeholder: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'button' | 'icon' | 'prefix' | 'postfix'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n onSearch?.(internalRef.current?.value ?? '');\n };\n\n const handleCancelClick = (): void => {\n setInputValueByRef(internalRef.current, '');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n handleClick();\n return;\n }\n };\n\n return (\n <Input\n aria-label={texts.searchInput.placeholder}\n placeholder={texts.searchInput.placeholder}\n {...props}\n onKeyDown={handleKeyDown}\n postfix={\n <>\n {props.disabled || props.readOnly || !props.value ? null : (\n <IconButton\n aria-hidden\n aria-label={texts.searchInput.clear}\n className=\"group-peer-focus:visible group-peer-hover:visible !text-grey-700 invisible mr-0.5 !h-5 !min-h-[theme(spacing.4)] !w-5 !min-w-[theme(spacing.4)] text-xs hover:visible group-hover:visible\"\n icon=\"close\"\n onClick={handleCancelClick}\n rounded\n tabIndex={-1}\n tooltip={texts.searchInput.clear}\n />\n )}\n <IconButton\n aria-label={texts.searchInput.button}\n icon=\"search\"\n className=\"group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent\"\n disabled={props.disabled || props.readOnly}\n onClick={handleClick}\n tabIndex={-1}\n tooltip={texts.searchInput.button}\n />\n </>\n }\n ref={internalRef}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","onSearch","props","ref","internalRef","useMergedRef","texts","useLocalization","handleClick","current","value","handleCancelClick","setInputValueByRef","handleKeyDown","event","onKeyDown","isDefaultPrevented","key","preventDefault","Input","searchInput","placeholder","postfix","disabled","readOnly","IconButton","clear","className","icon","onClick","rounded","tabIndex","tooltip","button","type"],"mappings":";;;;;;;MAkBaA,WAAW,gBAAGC,UAAgB,CAAC,SAASD,WAAW,CAC5D;EAAEE,QAAQ;EAAE,GAAGC;CAAyB,EACxCC,GAAgC;EAEhC,MAAMC,WAAW,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACvD,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,WAAW,GAAG;;IAChBP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,kDAAGG,WAAW,CAACK,OAAO,yDAAnB,qBAAqBC,KAAK,yEAAI,EAAE,CAAC;GAC/C;EAED,MAAMC,iBAAiB,GAAG;IACtBC,kBAAkB,CAACR,WAAW,CAACK,OAAO,EAAE,EAAE,CAAC;GAC9C;EAED,MAAMI,aAAa,GAAIC,KAA4C;;IAC/D,oBAAAZ,KAAK,CAACa,SAAS,qDAAf,sBAAAb,KAAK,EAAaY,KAAK,CAAC;IAExB,IAAIA,KAAK,CAACE,kBAAkB,EAAE,EAAE;MAC5B;;IAGJ,IAAIF,KAAK,CAACG,GAAG,KAAK,OAAO,EAAE;MACvBH,KAAK,CAACI,cAAc,EAAE;MACtBV,WAAW,EAAE;MACb;;GAEP;EAED,oBACIR,cAACmB,KAAK;kBACUb,KAAK,CAACc,WAAW,CAACC,WAAW;IACzCA,WAAW,EAAEf,KAAK,CAACc,WAAW,CAACC;KAC3BnB,KAAK;IACTa,SAAS,EAAEF,aAAa;IACxBS,OAAO,eACHtB,8BACKE,KAAK,CAACqB,QAAQ,IAAIrB,KAAK,CAACsB,QAAQ,IAAI,CAACtB,KAAK,CAACQ,KAAK,GAAG,IAAI,gBACpDV,cAACyB,UAAU;;oBAEKnB,KAAK,CAACc,WAAW,CAACM,KAAK;MACnCC,SAAS,EAAC,2LAA2L;MACrMC,IAAI,EAAC,OAAO;MACZC,OAAO,EAAElB,iBAAiB;MAC1BmB,OAAO;MACPC,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAE1B,KAAK,CAACc,WAAW,CAACM;MAElC,eACD1B,cAACyB,UAAU;oBACKnB,KAAK,CAACc,WAAW,CAACa,MAAM;MACpCL,IAAI,EAAC,QAAQ;MACbD,SAAS,EAAC,iKAAiK;MAC3KJ,QAAQ,EAAErB,KAAK,CAACqB,QAAQ,IAAIrB,KAAK,CAACsB,QAAQ;MAC1CK,OAAO,EAAErB,WAAW;MACpBuB,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAE1B,KAAK,CAACc,WAAW,CAACa;MAC7B,CACH;IAEP9B,GAAG,EAAEC,WAAW;IAChB8B,IAAI,EAAC;KACP;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef } from '../../utils/input';\n\nexport type SearchInputTexts = {\n button: string;\n clear: string;\n placeholder: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'button' | 'icon' | 'prefix' | 'postfix'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n onSearch?.(internalRef.current?.value ?? '');\n };\n\n const handleCancelClick = (): void => {\n setInputValueByRef(internalRef.current, '');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n handleClick();\n return;\n }\n\n if (event.key === 'Escape') {\n onSearch?.('');\n return;\n }\n };\n\n return (\n <Input\n aria-label={texts.searchInput.placeholder}\n placeholder={texts.searchInput.placeholder}\n {...props}\n onKeyDown={handleKeyDown}\n postfix={\n <>\n {props.disabled || props.readOnly || !props.value ? null : (\n <IconButton\n aria-hidden\n aria-label={texts.searchInput.clear}\n className=\"group-peer-focus:visible group-peer-hover:visible !text-grey-700 invisible mr-0.5 !h-5 !min-h-[theme(spacing.4)] !w-5 !min-w-[theme(spacing.4)] text-xs hover:visible group-hover:visible\"\n icon=\"close\"\n onClick={handleCancelClick}\n rounded\n tabIndex={-1}\n tooltip={texts.searchInput.clear}\n />\n )}\n <IconButton\n aria-label={texts.searchInput.button}\n icon=\"search\"\n className=\"group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent\"\n disabled={props.disabled || props.readOnly}\n onClick={handleClick}\n tabIndex={-1}\n tooltip={texts.searchInput.button}\n />\n </>\n }\n ref={internalRef}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","onSearch","props","ref","internalRef","useMergedRef","texts","useLocalization","handleClick","current","value","handleCancelClick","setInputValueByRef","handleKeyDown","event","onKeyDown","isDefaultPrevented","key","preventDefault","Input","searchInput","placeholder","postfix","disabled","readOnly","IconButton","clear","className","icon","onClick","rounded","tabIndex","tooltip","button","type"],"mappings":";;;;;;;MAkBaA,WAAW,gBAAGC,UAAgB,CAAC,SAASD,WAAW,CAC5D;EAAEE,QAAQ;EAAE,GAAGC;CAAyB,EACxCC,GAAgC;EAEhC,MAAMC,WAAW,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACvD,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,WAAW,GAAG;;IAChBP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,kDAAGG,WAAW,CAACK,OAAO,yDAAnB,qBAAqBC,KAAK,yEAAI,EAAE,CAAC;GAC/C;EAED,MAAMC,iBAAiB,GAAG;IACtBC,kBAAkB,CAACR,WAAW,CAACK,OAAO,EAAE,EAAE,CAAC;GAC9C;EAED,MAAMI,aAAa,GAAIC,KAA4C;;IAC/D,oBAAAZ,KAAK,CAACa,SAAS,qDAAf,sBAAAb,KAAK,EAAaY,KAAK,CAAC;IAExB,IAAIA,KAAK,CAACE,kBAAkB,EAAE,EAAE;MAC5B;;IAGJ,IAAIF,KAAK,CAACG,GAAG,KAAK,OAAO,EAAE;MACvBH,KAAK,CAACI,cAAc,EAAE;MACtBV,WAAW,EAAE;MACb;;IAGJ,IAAIM,KAAK,CAACG,GAAG,KAAK,QAAQ,EAAE;MACxBhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAG,EAAE,CAAC;MACd;;GAEP;EAED,oBACID,cAACmB,KAAK;kBACUb,KAAK,CAACc,WAAW,CAACC,WAAW;IACzCA,WAAW,EAAEf,KAAK,CAACc,WAAW,CAACC;KAC3BnB,KAAK;IACTa,SAAS,EAAEF,aAAa;IACxBS,OAAO,eACHtB,8BACKE,KAAK,CAACqB,QAAQ,IAAIrB,KAAK,CAACsB,QAAQ,IAAI,CAACtB,KAAK,CAACQ,KAAK,GAAG,IAAI,gBACpDV,cAACyB,UAAU;;oBAEKnB,KAAK,CAACc,WAAW,CAACM,KAAK;MACnCC,SAAS,EAAC,2LAA2L;MACrMC,IAAI,EAAC,OAAO;MACZC,OAAO,EAAElB,iBAAiB;MAC1BmB,OAAO;MACPC,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAE1B,KAAK,CAACc,WAAW,CAACM;MAElC,eACD1B,cAACyB,UAAU;oBACKnB,KAAK,CAACc,WAAW,CAACa,MAAM;MACpCL,IAAI,EAAC,QAAQ;MACbD,SAAS,EAAC,iKAAiK;MAC3KJ,QAAQ,EAAErB,KAAK,CAACqB,QAAQ,IAAIrB,KAAK,CAACsB,QAAQ;MAC1CK,OAAO,EAAErB,WAAW;MACpBuB,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAE1B,KAAK,CAACc,WAAW,CAACa;MAC7B,CACH;IAEP9B,GAAG,EAAEC,WAAW;IAChB8B,IAAI,EAAC;KACP;AAEV,CAAC;;;;"}
@@ -4,6 +4,8 @@ import { isMacOs } from '../../utils/keyboard.js';
4
4
 
5
5
  const replaceWithShortform = key => {
6
6
  switch (key) {
7
+ case 'Escape':
8
+ return 'Esc';
7
9
  case 'Delete':
8
10
  return 'Del';
9
11
  case 'Space':
@@ -48,7 +50,7 @@ const Shortcut = ({
48
50
  className: className
49
51
  }), texts.map(key => /*#__PURE__*/React__default.createElement("kbd", {
50
52
  key: key,
51
- className: "font-display bg-grey-300/[0.25] rounded-sm px-1 text-center font-bold text-white"
53
+ className: "font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-taco=tooltip]_&]:text-white"
52
54
  }, key)));
53
55
  };
54
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"Shortcut.js","sources":["../../../../../../../src/components/Shortcut/Shortcut.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { isMacOs, KeyDownHandlerOptions } from '../../utils/keyboard';\n\nconst replaceWithShortform = (key: string) => {\n switch (key) {\n case 'Delete':\n return 'Del';\n\n case 'Space':\n case ' ':\n return '␣';\n\n case 'ArrowLeft':\n return '◄';\n\n case 'ArrowRight':\n return '►';\n\n case 'ArrowUp':\n return '▲';\n\n case 'ArrowDown':\n return '▼';\n\n default:\n return key.length === 1 ? key.toLocaleUpperCase() : key;\n }\n};\n\nconst getShortcutText = (key: string | KeyDownHandlerOptions) => {\n if (!key) {\n return [];\n }\n\n if (typeof key === 'string') {\n return [replaceWithShortform(key)];\n }\n\n const keys: string[] = [];\n\n if (key.shift) {\n keys.push(isMacOs() ? '⇧' : 'Shift');\n }\n\n if (key.meta) {\n keys.push(isMacOs() ? '⌘' : 'Ctrl');\n }\n\n keys.push(replaceWithShortform(key.key));\n\n return keys;\n};\n\nexport type ShortcutProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n keys: string | KeyDownHandlerOptions;\n};\n\nexport const Shortcut = ({ keys, ...props }: ShortcutProps) => {\n const className = cn('inline-flex gap-0.5', props.className);\n const texts = getShortcutText(keys);\n\n return (\n <span {...props} className={className}>\n {texts.map(key => (\n <kbd key={key} className=\"font-display bg-grey-300/[0.25] rounded-sm px-1 text-center font-bold text-white\">\n {key}\n </kbd>\n ))}\n </span>\n );\n};\n"],"names":["replaceWithShortform","key","length","toLocaleUpperCase","getShortcutText","keys","shift","push","isMacOs","meta","Shortcut","props","className","cn","texts","React","map"],"mappings":";;;;AAIA,MAAMA,oBAAoB,GAAIC,GAAW;EACrC,QAAQA,GAAG;IACP,KAAK,QAAQ;MACT,OAAO,KAAK;IAEhB,KAAK,OAAO;IACZ,KAAK,GAAG;MACJ,OAAO,GAAG;IAEd,KAAK,WAAW;MACZ,OAAO,GAAG;IAEd,KAAK,YAAY;MACb,OAAO,GAAG;IAEd,KAAK,SAAS;MACV,OAAO,GAAG;IAEd,KAAK,WAAW;MACZ,OAAO,GAAG;IAEd;MACI,OAAOA,GAAG,CAACC,MAAM,KAAK,CAAC,GAAGD,GAAG,CAACE,iBAAiB,EAAE,GAAGF,GAAG;;AAEnE,CAAC;AAED,MAAMG,eAAe,GAAIH,GAAmC;EACxD,IAAI,CAACA,GAAG,EAAE;IACN,OAAO,EAAE;;EAGb,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO,CAACD,oBAAoB,CAACC,GAAG,CAAC,CAAC;;EAGtC,MAAMI,IAAI,GAAa,EAAE;EAEzB,IAAIJ,GAAG,CAACK,KAAK,EAAE;IACXD,IAAI,CAACE,IAAI,CAACC,OAAO,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC;;EAGxC,IAAIP,GAAG,CAACQ,IAAI,EAAE;IACVJ,IAAI,CAACE,IAAI,CAACC,OAAO,EAAE,GAAG,GAAG,GAAG,MAAM,CAAC;;EAGvCH,IAAI,CAACE,IAAI,CAACP,oBAAoB,CAACC,GAAG,CAACA,GAAG,CAAC,CAAC;EAExC,OAAOI,IAAI;AACf,CAAC;MAMYK,QAAQ,GAAG,CAAC;EAAEL,IAAI;EAAE,GAAGM;CAAsB;EACtD,MAAMC,SAAS,GAAGC,EAAE,CAAC,qBAAqB,EAAEF,KAAK,CAACC,SAAS,CAAC;EAC5D,MAAME,KAAK,GAAGV,eAAe,CAACC,IAAI,CAAC;EAEnC,oBACIU,uDAAUJ,KAAK;IAAEC,SAAS,EAAEA;MACvBE,KAAK,CAACE,GAAG,CAACf,GAAG,iBACVc;IAAKd,GAAG,EAAEA,GAAG;IAAEW,SAAS,EAAC;KACpBX,GAAG,CAEX,CAAC,CACC;AAEf;;;;"}
1
+ {"version":3,"file":"Shortcut.js","sources":["../../../../../../../src/components/Shortcut/Shortcut.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { isMacOs, KeyDownHandlerOptions } from '../../utils/keyboard';\n\nconst replaceWithShortform = (key: string) => {\n switch (key) {\n case 'Escape':\n return 'Esc';\n\n case 'Delete':\n return 'Del';\n\n case 'Space':\n case ' ':\n return '␣';\n\n case 'ArrowLeft':\n return '◄';\n\n case 'ArrowRight':\n return '►';\n\n case 'ArrowUp':\n return '▲';\n\n case 'ArrowDown':\n return '▼';\n\n default:\n return key.length === 1 ? key.toLocaleUpperCase() : key;\n }\n};\n\nconst getShortcutText = (key: string | KeyDownHandlerOptions) => {\n if (!key) {\n return [];\n }\n\n if (typeof key === 'string') {\n return [replaceWithShortform(key)];\n }\n\n const keys: string[] = [];\n\n if (key.shift) {\n keys.push(isMacOs() ? '⇧' : 'Shift');\n }\n\n if (key.meta) {\n keys.push(isMacOs() ? '⌘' : 'Ctrl');\n }\n\n keys.push(replaceWithShortform(key.key));\n\n return keys;\n};\n\nexport type ShortcutProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n keys: string | KeyDownHandlerOptions;\n};\n\nexport const Shortcut = ({ keys, ...props }: ShortcutProps) => {\n const className = cn('inline-flex gap-0.5', props.className);\n const texts = getShortcutText(keys);\n\n return (\n <span {...props} className={className}>\n {texts.map(key => (\n <kbd\n key={key}\n className=\"font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-taco=tooltip]_&]:text-white\">\n {key}\n </kbd>\n ))}\n </span>\n );\n};\n"],"names":["replaceWithShortform","key","length","toLocaleUpperCase","getShortcutText","keys","shift","push","isMacOs","meta","Shortcut","props","className","cn","texts","React","map"],"mappings":";;;;AAIA,MAAMA,oBAAoB,GAAIC,GAAW;EACrC,QAAQA,GAAG;IACP,KAAK,QAAQ;MACT,OAAO,KAAK;IAEhB,KAAK,QAAQ;MACT,OAAO,KAAK;IAEhB,KAAK,OAAO;IACZ,KAAK,GAAG;MACJ,OAAO,GAAG;IAEd,KAAK,WAAW;MACZ,OAAO,GAAG;IAEd,KAAK,YAAY;MACb,OAAO,GAAG;IAEd,KAAK,SAAS;MACV,OAAO,GAAG;IAEd,KAAK,WAAW;M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