@lumx/react 2.1.2 → 2.1.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/_internal/Avatar2.js +5 -1
- package/esm/_internal/Avatar2.js.map +1 -1
- package/esm/_internal/ClickAwayProvider.js +1 -1
- package/esm/_internal/Dialog2.js +13 -8
- package/esm/_internal/Dialog2.js.map +1 -1
- package/esm/_internal/DragHandle.js +1 -1
- package/esm/_internal/DragHandle.js.map +1 -1
- package/esm/_internal/Flag2.js +1 -3
- package/esm/_internal/Flag2.js.map +1 -1
- package/esm/_internal/List2.js +16 -9
- package/esm/_internal/List2.js.map +1 -1
- package/esm/_internal/Message2.js +2 -2
- package/esm/_internal/Message2.js.map +1 -1
- package/esm/_internal/SlideshowControls.js +3 -3
- package/esm/_internal/SlideshowControls.js.map +1 -1
- package/esm/_internal/Thumbnail2.js +29 -34
- package/esm/_internal/Thumbnail2.js.map +1 -1
- package/esm/_internal/Tooltip2.js +1 -1
- package/esm/_internal/UserBlock.js +44 -14
- package/esm/_internal/UserBlock.js.map +1 -1
- package/esm/_internal/getRootClassName.js +17 -1
- package/esm/_internal/getRootClassName.js.map +1 -1
- package/esm/_internal/user-block.js +1 -0
- package/esm/_internal/user-block.js.map +1 -1
- package/package.json +16 -17
- package/src/components/avatar/Avatar.tsx +8 -0
- package/src/components/dialog/Dialog.stories.tsx +44 -2
- package/src/components/dialog/Dialog.tsx +15 -11
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +76 -0
- package/src/components/drag-handle/DragHandle.tsx +5 -1
- package/src/components/flag/Flag.test.tsx +1 -2
- package/src/components/flag/Flag.tsx +2 -10
- package/src/components/flag/__snapshots__/Flag.test.tsx.snap +0 -15
- package/src/components/list/List.stories.tsx +7 -1
- package/src/components/list/ListItem.stories.tsx +28 -3
- package/src/components/list/ListItem.tsx +25 -7
- package/src/components/list/__snapshots__/List.test.tsx.snap +23 -3
- package/src/components/list/__snapshots__/ListItem.test.tsx.snap +84 -11
- package/src/components/list/useInteractiveList.tsx +1 -1
- package/src/components/message/Message.tsx +2 -2
- package/src/components/slideshow/useKeyNavigate.ts +2 -2
- package/src/components/thumbnail/Thumbnail.stories.tsx +21 -0
- package/src/components/thumbnail/Thumbnail.test.tsx +20 -2
- package/src/components/thumbnail/Thumbnail.tsx +40 -15
- package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +53 -6
- package/src/components/user-block/UserBlock.stories.tsx +27 -4
- package/src/components/user-block/UserBlock.tsx +40 -16
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +244 -145
- package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +54 -0
- package/src/utils/MaterialThemeSwitcher/index.ts +1 -0
- package/types.d.ts +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** User name. */\n name?: string;\n /** Orientation. */\n orientation?: Orientation;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n multipleActions,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const nameBlock: ReactNode =
|
|
1
|
+
{"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { isEmpty } from 'lodash';\nimport { renderLink } from '@lumx/react/utils/renderLink';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Props to pass to the link wrapping the avatar thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** User name. */\n name?: string;\n /** Orientation. */\n orientation?: Orientation;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n multipleActions,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n linkProps,\n linkAs,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const isLink = Boolean(linkProps?.href || linkAs);\n const isClickable = !!onClick || isLink;\n\n const nameBlock: ReactNode = React.useMemo(() => {\n if (isEmpty(name)) {\n return null;\n }\n const nameClassName = classNames(\n handleBasicClasses({ prefix: `${CLASSNAME}__name`, isClickable }),\n isLink && linkProps?.className,\n );\n if (isLink) {\n return renderLink({ ...linkProps, linkAs, className: nameClassName }, name);\n }\n if (onClick) {\n return (\n <button onClick={onClick} type=\"button\" className={nameClassName}>\n {name}\n </button>\n );\n }\n return <span className={nameClassName}>{name}</span>;\n }, [isClickable, isLink, linkAs, linkProps, name, onClick]);\n\n const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((aField: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {aField}\n </span>\n ))}\n </div>\n );\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({ prefix: CLASSNAME, orientation, size: componentSize, theme, isClickable }),\n )}\n onMouseLeave={onMouseLeave}\n onMouseEnter={onMouseEnter}\n >\n {avatarProps && (\n <Avatar\n linkProps={linkProps}\n {...avatarProps}\n className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}\n size={componentSize}\n onClick={onClick}\n theme={theme}\n />\n )}\n {(fields || name) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {nameBlock}\n {fieldsBlock}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n </div>\n );\n});\nUserBlock.displayName = COMPONENT_NAME;\nUserBlock.className = CLASSNAME;\nUserBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","size","Size","m","theme","Theme","light","UserBlock","forwardRef","props","ref","avatarProps","className","fields","multipleActions","name","onClick","onMouseEnter","onMouseLeave","simpleAction","linkProps","linkAs","forwardedProps","componentSize","vertical","l","shouldDisplayActions","isLink","Boolean","href","isClickable","nameBlock","React","useMemo","isEmpty","nameClassName","classNames","handleBasicClasses","prefix","renderLink","fieldsBlock","s","map","aField","idx","displayName","defaultProps"],"mappings":";;;;;;;;AAgDA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAsC,GAAG;AAC3CC,EAAAA,WAA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B;;;;"}
|
|
@@ -273,6 +273,22 @@ function onEscapePressed(handler) {
|
|
|
273
273
|
handler(evt);
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Handle button key pressed (Enter + Space).
|
|
278
|
+
*
|
|
279
|
+
* @param handler The handler to call.
|
|
280
|
+
* @return The decorated function.
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
function onButtonPressed(handler) {
|
|
284
|
+
return function (evt) {
|
|
285
|
+
if (evt.key !== 'Enter' && evt.key !== ' ') {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
handler(evt);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
276
292
|
|
|
277
293
|
/**
|
|
278
294
|
* The prefix to use for the CSS classes.
|
|
@@ -308,5 +324,5 @@ function getRootClassName(componentName, subComponent) {
|
|
|
308
324
|
return formattedClassName;
|
|
309
325
|
}
|
|
310
326
|
|
|
311
|
-
export { CSS_PREFIX as C, DIALOG_TRANSITION_DURATION as D, NOTIFICATION_TRANSITION_DURATION as N, getBasicClass as a,
|
|
327
|
+
export { CSS_PREFIX as C, DIALOG_TRANSITION_DURATION as D, NOTIFICATION_TRANSITION_DURATION as N, getBasicClass as a, onButtonPressed as b, classnames as c, createCommonjsModule as d, detectHorizontalSwipe as e, onEscapePressed as f, getRootClassName as g, handleBasicClasses as h, onEnterPressed as o };
|
|
312
328
|
//# sourceMappingURL=getRootClassName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRootClassName.js","sources":["../../../../../node_modules/classnames/index.js","../../../../lumx-core/src/js/utils.ts","../../../../lumx-core/src/js/constants/index.ts","../../../src/utils/getRootClassName.ts"],"sourcesContent":["/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import classNames from 'classnames';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport React from 'react';\n\nimport isBoolean from 'lodash/isBoolean';\nimport isEmpty from 'lodash/isEmpty';\nimport kebabCase from 'lodash/kebabCase';\nimport noop from 'lodash/noop';\n\n/**\n * Enhance isEmpty method to also works with numbers.\n *\n * @param value The value to check.\n * @return Whether the input value is empty or != 0.\n */\nconst _isEmpty = (value: any) => {\n if (typeof value === 'number') {\n return value === 0;\n }\n\n return isEmpty(value);\n};\n\n/**\n * Get the basic CSS class for the given type.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).\n * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).\n * @return The basic CSS class.\n */\nexport function getBasicClass({\n prefix,\n type,\n value,\n}: {\n prefix: string;\n type: string;\n value: string | number | boolean | undefined;\n}): string {\n if (isBoolean(value)) {\n if (!value) {\n // False value should not return a class.\n return '';\n }\n const booleanPrefixes = ['has', 'is'];\n\n if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {\n return `${prefix}--${kebabCase(type)}`;\n }\n\n return `${prefix}--is-${kebabCase(type)}`;\n }\n\n return `${prefix}--${kebabCase(type)}-${value}`;\n}\n\n/**\n * Return all basic LumX CSS classes which are available for every components.\n *\n * @see {@link /src/components/index.d.ts} for the possible values of each parameter.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param props All the other props you want to generate a class.\n * The rule of thumb: the key is the name of the prop in the class, the value a string that will\n * be used in the classname to represent the value of the given prop.\n * @return All LumX basic CSS classes.\n */\nexport function handleBasicClasses({ prefix, ...props }: { prefix: string; [prop: string]: any }): string {\n const otherClasses: any = {};\n if (!isEmpty(props)) {\n Object.keys(props).forEach((prop) => {\n otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] = isBoolean(props[prop])\n ? props[prop]\n : !_isEmpty(props[prop]);\n });\n }\n\n return classNames(prefix, otherClasses);\n}\n\ndeclare type SwipeDirection = 'none' | 'up' | 'down' | 'left' | 'right';\n\n/**\n * Detects swipe direction.\n * Credits: http://javascriptkit.com/javatutors/touchevents2.shtml.\n *\n * @deprecated use `detectHorizontalSwipe` instead if possible (better performance and does not block scroll)\n * @param touchSurface Element that will hold touch events.\n * @param handleSwipe Callback function.\n * @return Function to remove listeners.\n */\nexport function detectSwipe(touchSurface: Element, handleSwipe: (direction: SwipeDirection) => void = noop) {\n let distX: number;\n let distY: number;\n let startX: number;\n let startY: number;\n let direction: SwipeDirection;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 100;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n direction = 'none';\n // Const dist = 0;\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n evt.preventDefault();\n };\n\n const onTouchMove = (evt: Event) => {\n // Prevent scrolling when inside DIV.\n evt.preventDefault();\n };\n\n const onTouchEnd = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n distY = touch.pageY - startY;\n // Get time elapsed.\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime <= allowedTime) {\n // First condition for awipe met.\n if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) {\n // 2nd condition for horizontal swipe met.\n // If dist traveled is negative, it indicates left swipe.\n direction = distX < 0 ? 'left' : 'right';\n } else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) {\n // 2nd condition for vertical swipe met.\n // If dist traveled is negative, it indicates up swipe.\n direction = distY < 0 ? 'up' : 'down';\n }\n }\n handleSwipe(direction);\n evt.preventDefault();\n };\n\n touchSurface.addEventListener('touchstart', onTouchStart, false);\n touchSurface.addEventListener('touchmove', onTouchMove, false);\n touchSurface.addEventListener('touchend', onTouchEnd, false);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, false);\n touchSurface.removeEventListener('touchmove', onTouchMove, false);\n touchSurface.removeEventListener('touchend', onTouchEnd, false);\n };\n}\n\n/**\n * Checks whether or not the browser support passive events.\n * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js\n */\nfunction isPassiveEventAvailable() {\n let supportsPassiveOption = false;\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supportsPassiveOption = true;\n },\n });\n window.addEventListener('testPassiveEventSupport', noop, opts);\n window.removeEventListener('testPassiveEventSupport', noop, opts);\n } catch (e) {\n // ignored\n }\n return supportsPassiveOption;\n}\n\n/**\n * Detects horizontal swipe direction without blocking the browser scroll using passive event.\n * @see http://javascriptkit.com/javatutors/touchevents2.shtml\n * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function detectHorizontalSwipe(touchSurface: Element, handleSwipe: (direction: 'right' | 'left') => void) {\n let startX: number;\n let startY: number;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 150;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n let finished: boolean;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n finished = false;\n };\n\n const onTouchMove = (evt: Event) => {\n if (finished) {\n return;\n }\n\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime > allowedTime) {\n // Touch swipe too long to be considered.\n return;\n }\n\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n const distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n const distY = touch.pageY - startY;\n\n if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {\n // Swipe is not horizontal.\n return;\n }\n // Swipe direction.\n const direction = distX < 0 ? 'left' : 'right';\n\n handleSwipe(direction);\n finished = true;\n };\n\n // Activate passive event if possible for better scrolling performance.\n const eventOptions: any = isPassiveEventAvailable() ? { passive: true } : false;\n touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);\n };\n}\n\ntype KeyboardEventHandler<E extends KeyboardEvent | React.KeyboardEvent> = (event: E) => void;\n\n/**\n * Make sure the pressed key is the enter key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEnterPressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Enter') {\n return;\n }\n handler(evt);\n };\n}\n\n/**\n * Make sure the pressed key is the escape key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEscapePressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Escape') {\n return;\n }\n handler(evt);\n };\n}\n","/**\n * The prefix to use for the CSS classes.\n */\nexport const CSS_PREFIX = 'lumx';\n\n/**\n * Key codes.\n */\nexport * from './keycodes';\n\n/**\n * Animation duration constants. Take into consideration that if you change one of these variables,\n * you need to update their scss counterpart as well\n */\nexport const DIALOG_TRANSITION_DURATION = 400;\nexport const NOTIFICATION_TRANSITION_DURATION = 200;\n","import { CSS_PREFIX } from '@lumx/react/constants';\n\nimport kebabCase from 'lodash/kebabCase';\n\n// See https://regex101.com/r/YjS1uI/3\nconst LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;\n\n/**\n * Get the name of the root CSS class of a component based on its name.\n *\n * @param componentName The name of the component. This name should contains the component prefix and be\n * written in PascalCase.\n * @param subComponent Whether the current component is a sub component, if true, define the class according\n * to BEM standards.\n * @return The name of the root CSS class. This classname include the CSS classname prefix and is written in\n * lower-snake-case.\n */\nexport function getRootClassName(componentName: string, subComponent?: boolean): string {\n const formattedClassName = `${CSS_PREFIX}-${kebabCase(componentName)}`;\n\n if (subComponent) {\n return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');\n }\n return formattedClassName;\n}\n"],"names":["_isEmpty","value","isEmpty","getBasicClass","prefix","type","isBoolean","booleanPrefixes","some","booleanPrefix","toString","startsWith","kebabCase","handleBasicClasses","props","otherClasses","Object","keys","forEach","prop","classNames","isPassiveEventAvailable","supportsPassiveOption","opts","defineProperty","get","window","addEventListener","noop","removeEventListener","e","detectHorizontalSwipe","touchSurface","handleSwipe","startX","startY","threshold","restraint","allowedTime","elapsedTime","startTime","finished","onTouchStart","evt","Array","from","changedTouches","touch","pageX","pageY","Date","getTime","onTouchMove","distX","distY","Math","abs","direction","eventOptions","passive","onEnterPressed","handler","key","onEscapePressed","CSS_PREFIX","DIALOG_TRANSITION_DURATION","NOTIFICATION_TRANSITION_DURATION","LAST_PART_CLASSNAME","getRootClassName","componentName","subComponent","formattedClassName","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,YAAY;AAEb;AACA,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC;AAChC;AACA,CAAC,SAAS,UAAU,IAAI;AACxB,EAAE,IAAI,OAAO,GAAG,EAAE,CAAC;AACnB;AACA,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1B,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS;AACtB;AACA,GAAG,IAAI,OAAO,GAAG,OAAO,GAAG,CAAC;AAC5B;AACA,GAAG,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE;AACrD,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtB,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE;AAChD,IAAI,IAAI,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC5C,IAAI,IAAI,KAAK,EAAE;AACf,KAAK,OAAO,CAAC,IAAI,CAAC,KAA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ACH,GALD;AAMH;;ACtRD;;;IAGaqB,UAAU,GAAG;AAO1B;;;;;IAIaC,0BAA0B,GAAG;IAC7BC,gCAAgC,GAAG;;ACVhD,IAAMC,mBAAmB,GAAG,eAA5B;AAEA;;;;;;;;;;;AAUO,SAASC,gBAAT,CAA0BC,aAA1B,EAAiDC,YAAjD,EAAiF;AACpF,MAAMC,kBAAkB,aAAMP,UAAN,cAAoBpD,SAAS,CAACyD,aAAD,CAA7B,CAAxB;;AAEA,MAAIC,YAAJ,EAAkB;AACd,WAAOC,kBAAkB,CAACC,OAAnB,CAA2BL,mBAA3B,EAAgD,QAAhD,CAAP;AACH;;AACD,SAAOI,kBAAP;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"getRootClassName.js","sources":["../../../../../node_modules/classnames/index.js","../../../../lumx-core/src/js/utils.ts","../../../../lumx-core/src/js/constants/index.ts","../../../src/utils/getRootClassName.ts"],"sourcesContent":["/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import classNames from 'classnames';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport React from 'react';\n\nimport isBoolean from 'lodash/isBoolean';\nimport isEmpty from 'lodash/isEmpty';\nimport kebabCase from 'lodash/kebabCase';\nimport noop from 'lodash/noop';\n\n/**\n * Enhance isEmpty method to also works with numbers.\n *\n * @param value The value to check.\n * @return Whether the input value is empty or != 0.\n */\nconst _isEmpty = (value: any) => {\n if (typeof value === 'number') {\n return value === 0;\n }\n\n return isEmpty(value);\n};\n\n/**\n * Get the basic CSS class for the given type.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).\n * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).\n * @return The basic CSS class.\n */\nexport function getBasicClass({\n prefix,\n type,\n value,\n}: {\n prefix: string;\n type: string;\n value: string | number | boolean | undefined;\n}): string {\n if (isBoolean(value)) {\n if (!value) {\n // False value should not return a class.\n return '';\n }\n const booleanPrefixes = ['has', 'is'];\n\n if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {\n return `${prefix}--${kebabCase(type)}`;\n }\n\n return `${prefix}--is-${kebabCase(type)}`;\n }\n\n return `${prefix}--${kebabCase(type)}-${value}`;\n}\n\n/**\n * Return all basic LumX CSS classes which are available for every components.\n *\n * @see {@link /src/components/index.d.ts} for the possible values of each parameter.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param props All the other props you want to generate a class.\n * The rule of thumb: the key is the name of the prop in the class, the value a string that will\n * be used in the classname to represent the value of the given prop.\n * @return All LumX basic CSS classes.\n */\nexport function handleBasicClasses({ prefix, ...props }: { prefix: string; [prop: string]: any }): string {\n const otherClasses: any = {};\n if (!isEmpty(props)) {\n Object.keys(props).forEach((prop) => {\n otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] = isBoolean(props[prop])\n ? props[prop]\n : !_isEmpty(props[prop]);\n });\n }\n\n return classNames(prefix, otherClasses);\n}\n\ndeclare type SwipeDirection = 'none' | 'up' | 'down' | 'left' | 'right';\n\n/**\n * Detects swipe direction.\n * Credits: http://javascriptkit.com/javatutors/touchevents2.shtml.\n *\n * @deprecated use `detectHorizontalSwipe` instead if possible (better performance and does not block scroll)\n * @param touchSurface Element that will hold touch events.\n * @param handleSwipe Callback function.\n * @return Function to remove listeners.\n */\nexport function detectSwipe(touchSurface: Element, handleSwipe: (direction: SwipeDirection) => void = noop) {\n let distX: number;\n let distY: number;\n let startX: number;\n let startY: number;\n let direction: SwipeDirection;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 100;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n direction = 'none';\n // Const dist = 0;\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n evt.preventDefault();\n };\n\n const onTouchMove = (evt: Event) => {\n // Prevent scrolling when inside DIV.\n evt.preventDefault();\n };\n\n const onTouchEnd = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n distY = touch.pageY - startY;\n // Get time elapsed.\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime <= allowedTime) {\n // First condition for awipe met.\n if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) {\n // 2nd condition for horizontal swipe met.\n // If dist traveled is negative, it indicates left swipe.\n direction = distX < 0 ? 'left' : 'right';\n } else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) {\n // 2nd condition for vertical swipe met.\n // If dist traveled is negative, it indicates up swipe.\n direction = distY < 0 ? 'up' : 'down';\n }\n }\n handleSwipe(direction);\n evt.preventDefault();\n };\n\n touchSurface.addEventListener('touchstart', onTouchStart, false);\n touchSurface.addEventListener('touchmove', onTouchMove, false);\n touchSurface.addEventListener('touchend', onTouchEnd, false);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, false);\n touchSurface.removeEventListener('touchmove', onTouchMove, false);\n touchSurface.removeEventListener('touchend', onTouchEnd, false);\n };\n}\n\n/**\n * Checks whether or not the browser support passive events.\n * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js\n */\nfunction isPassiveEventAvailable() {\n let supportsPassiveOption = false;\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supportsPassiveOption = true;\n },\n });\n window.addEventListener('testPassiveEventSupport', noop, opts);\n window.removeEventListener('testPassiveEventSupport', noop, opts);\n } catch (e) {\n // ignored\n }\n return supportsPassiveOption;\n}\n\n/**\n * Detects horizontal swipe direction without blocking the browser scroll using passive event.\n * @see http://javascriptkit.com/javatutors/touchevents2.shtml\n * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function detectHorizontalSwipe(touchSurface: Element, handleSwipe: (direction: 'right' | 'left') => void) {\n let startX: number;\n let startY: number;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 150;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n let finished: boolean;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n finished = false;\n };\n\n const onTouchMove = (evt: Event) => {\n if (finished) {\n return;\n }\n\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime > allowedTime) {\n // Touch swipe too long to be considered.\n return;\n }\n\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n const distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n const distY = touch.pageY - startY;\n\n if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {\n // Swipe is not horizontal.\n return;\n }\n // Swipe direction.\n const direction = distX < 0 ? 'left' : 'right';\n\n handleSwipe(direction);\n finished = true;\n };\n\n // Activate passive event if possible for better scrolling performance.\n const eventOptions: any = isPassiveEventAvailable() ? { passive: true } : false;\n touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);\n };\n}\n\ntype KeyboardEventHandler<E extends KeyboardEvent | React.KeyboardEvent> = (event: E) => void;\n\n/**\n * Make sure the pressed key is the enter key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEnterPressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Enter') {\n return;\n }\n handler(evt);\n };\n}\n\n/**\n * Make sure the pressed key is the escape key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEscapePressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Escape') {\n return;\n }\n handler(evt);\n };\n}\n\n/**\n * Handle button key pressed (Enter + Space).\n *\n * @param handler The handler to call.\n * @return The decorated function.\n */\nexport function onButtonPressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Enter' && evt.key !== ' ') {\n return;\n }\n handler(evt);\n };\n}\n","/**\n * The prefix to use for the CSS classes.\n */\nexport const CSS_PREFIX = 'lumx';\n\n/**\n * Key codes.\n */\nexport * from './keycodes';\n\n/**\n * Animation duration constants. Take into consideration that if you change one of these variables,\n * you need to update their scss counterpart as well\n */\nexport const DIALOG_TRANSITION_DURATION = 400;\nexport const NOTIFICATION_TRANSITION_DURATION = 200;\n","import { CSS_PREFIX } from '@lumx/react/constants';\n\nimport kebabCase from 'lodash/kebabCase';\n\n// See https://regex101.com/r/YjS1uI/3\nconst LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;\n\n/**\n * Get the name of the root CSS class of a component based on its name.\n *\n * @param componentName The name of the component. This name should contains the component prefix and be\n * written in PascalCase.\n * @param subComponent Whether the current component is a sub component, if true, define the class according\n * to BEM standards.\n * @return The name of the root CSS class. This classname include the CSS classname prefix and is written in\n * lower-snake-case.\n */\nexport function getRootClassName(componentName: string, subComponent?: boolean): string {\n const formattedClassName = `${CSS_PREFIX}-${kebabCase(componentName)}`;\n\n if (subComponent) {\n return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');\n }\n return formattedClassName;\n}\n"],"names":["_isEmpty","value","isEmpty","getBasicClass","prefix","type","isBoolean","booleanPrefixes","some","booleanPrefix","toString","startsWith","kebabCase","handleBasicClasses","props","otherClasses","Object","keys","forEach","prop","classNames","isPassiveEventAvailable","supportsPassiveOption","opts","defineProperty","get","window","addEventListener","noop","removeEventListener","e","detectHorizontalSwipe","touchSurface","handleSwipe","startX","startY","threshold","restraint","allowedTime","elapsedTime","startTime","finished","onTouchStart","evt","Array","from","changedTouches","touch","pageX","pageY","Date","getTime","onTouchMove","distX","distY","Math","abs","direction","eventOptions","passive","onEnterPressed","handler","key","onEscapePressed","onButtonPressed","CSS_PREFIX","DIALOG_TRANSITION_DURATION","NOTIFICATION_TRANSITION_DURATION","LAST_PART_CLASSNAME","getRootClassName","componentName","subComponent","formattedClassName","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,YAAY;AAEb;AACA,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC;AAChC;AACA,CAAC,SAAS,UAAU,IAAI;AACxB,EAAE,IAAI,OAAO,GAAG,EAAE,CAAC;AACnB;AACA,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1B,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS;AACtB;AACA,GAAG,IAAI,OAAO,GAAG,OAAO,GAAG,CAAC;AAC5B;AACA,GAAG,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE;AACrD,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtB,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE;AAChD,IAAI,IAAI,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC5C,IAAI,IAAI,KAAK,EAAE;AACf,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;AACpC,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;AACzB,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;AAC5C,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG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;;IAGasB,UAAU,GAAG;AAO1B;;;;;IAIaC,0BAA0B,GAAG;IAC7BC,gCAAgC,GAAG;;ACVhD,IAAMC,mBAAmB,GAAG,eAA5B;AAEA;;;;;;;;;;;AAUO,SAASC,gBAAT,CAA0BC,aAA1B,EAAiDC,YAAjD,EAAiF;AACpF,MAAMC,kBAAkB,aAAMP,UAAN,cAAoBrD,SAAS,CAAC0D,aAAD,CAA7B,CAAxB;;AAEA,MAAIC,YAAJ,EAAkB;AACd,WAAOC,kBAAkB,CAACC,OAAnB,CAA2BL,mBAA3B,EAAgD,QAAhD,CAAP;AACH;;AACD,SAAOI,kBAAP;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.1.
|
|
11
|
-
"@lumx/icons": "^2.1.
|
|
10
|
+
"@lumx/core": "^2.1.6-alpha.0",
|
|
11
|
+
"@lumx/icons": "^2.1.6-alpha.0",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"@babel/preset-typescript": "^7.12.7",
|
|
29
29
|
"@rollup/plugin-commonjs": "^15.0.0",
|
|
30
30
|
"@rollup/plugin-node-resolve": "9.0.0",
|
|
31
|
-
"@storybook/addon-a11y": "^5.3.
|
|
32
|
-
"@storybook/addon-actions": "^5.3.
|
|
33
|
-
"@storybook/addon-knobs": "^5.3.
|
|
34
|
-
"@storybook/addon-storysource": "^5.3.
|
|
35
|
-
"@storybook/addon-viewport": "^5.3.
|
|
36
|
-
"@storybook/
|
|
31
|
+
"@storybook/addon-a11y": "^5.3.21",
|
|
32
|
+
"@storybook/addon-actions": "^5.3.21",
|
|
33
|
+
"@storybook/addon-knobs": "^5.3.21",
|
|
34
|
+
"@storybook/addon-storysource": "^5.3.21",
|
|
35
|
+
"@storybook/addon-viewport": "^5.3.21",
|
|
36
|
+
"@storybook/core": "^5.3.21",
|
|
37
|
+
"@storybook/react": "^5.3.21",
|
|
37
38
|
"@types/body-scroll-lock": "^2.6.1",
|
|
38
39
|
"@types/classnames": "^2.2.9",
|
|
39
40
|
"@types/enzyme": "^3.10.5",
|
|
@@ -78,7 +79,6 @@
|
|
|
78
79
|
"ts-jest": "^26.2.0",
|
|
79
80
|
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
|
80
81
|
"typescript": "^4.1.2",
|
|
81
|
-
"version-changelog": "^3.1.1",
|
|
82
82
|
"yargs": "^15.4.1",
|
|
83
83
|
"yarn": "^1.19.1"
|
|
84
84
|
},
|
|
@@ -115,17 +115,16 @@
|
|
|
115
115
|
"url": "git+https://github.com/lumapps/design-system.git"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
118
|
-
"build": "rollup -c",
|
|
119
|
-
"
|
|
118
|
+
"build": "rollup -c && yarn generate:types",
|
|
119
|
+
"generate:types": "dts-bundle-generator --no-check --external-types=react --external-imports=moment -o dist/types.d.ts src/index.ts",
|
|
120
120
|
"prepare": "install-peers || exit 0",
|
|
121
121
|
"prepublishOnly": "yarn build",
|
|
122
122
|
"test": "jest --config jest/index.js --coverage --notify --passWithNoTests --detectOpenHandles --runInBand",
|
|
123
|
-
"storybook": "
|
|
123
|
+
"prepare:storybook": "mkdir -p node_modules",
|
|
124
|
+
"storybook": "yarn prepare:storybook && start-storybook -s ../site-demo/static/ -p 9000",
|
|
125
|
+
"build:storybook": "yarn prepare:storybook && build-storybook -s ../site-demo/static"
|
|
124
126
|
},
|
|
125
127
|
"sideEffects": false,
|
|
126
|
-
"version": "2.1.
|
|
127
|
-
"
|
|
128
|
-
"**/style-loader": "^1.0.0"
|
|
129
|
-
},
|
|
130
|
-
"gitHead": "a7ff97bf2f787fb0141a036f10bf269ab530a366"
|
|
128
|
+
"version": "2.1.6-alpha.0",
|
|
129
|
+
"gitHead": "e4b7721dce1f4062fc8df67dd29bf936fab00c6d"
|
|
131
130
|
}
|
|
@@ -36,6 +36,10 @@ export interface AvatarProps extends GenericProps {
|
|
|
36
36
|
ThumbnailProps,
|
|
37
37
|
'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'
|
|
38
38
|
>;
|
|
39
|
+
/** Props to pass to the link wrapping the thumbnail. */
|
|
40
|
+
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
41
|
+
/** Custom react component for the link (can be used to inject react router Link). */
|
|
42
|
+
linkAs?: 'a' | any;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
/**
|
|
@@ -75,6 +79,8 @@ export const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
75
79
|
size,
|
|
76
80
|
theme,
|
|
77
81
|
thumbnailProps,
|
|
82
|
+
linkProps,
|
|
83
|
+
linkAs,
|
|
78
84
|
...forwardedProps
|
|
79
85
|
} = props;
|
|
80
86
|
|
|
@@ -85,6 +91,8 @@ export const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
85
91
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, size, theme }))}
|
|
86
92
|
>
|
|
87
93
|
<Thumbnail
|
|
94
|
+
linkProps={linkProps}
|
|
95
|
+
linkAs={linkAs}
|
|
88
96
|
className={`${CLASSNAME}__thumbnail`}
|
|
89
97
|
onClick={onClick}
|
|
90
98
|
onKeyPress={onKeyPress}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mdiClose } from '@lumx/icons';
|
|
2
2
|
import {
|
|
3
|
+
AlertDialog,
|
|
3
4
|
Button,
|
|
4
5
|
Checkbox,
|
|
5
6
|
DatePickerField,
|
|
@@ -32,9 +33,9 @@ const content = <div className="lumx-spacing-padding">{loremIpsum('short')}</div
|
|
|
32
33
|
const longContent = <div className="lumx-spacing-padding">{loremIpsum('long')}</div>;
|
|
33
34
|
const footer = <footer className="lumx-spacing-padding">Dialog footer</footer>;
|
|
34
35
|
|
|
35
|
-
function useOpenButton(theme: Theme) {
|
|
36
|
+
function useOpenButton(theme: Theme, defaultState = true) {
|
|
36
37
|
const buttonRef = useRef() as RefObject<HTMLButtonElement>;
|
|
37
|
-
const [isOpen, setOpen] = useState(
|
|
38
|
+
const [isOpen, setOpen] = useState(defaultState);
|
|
38
39
|
const openDialog = () => setOpen(true);
|
|
39
40
|
const closeDialog = () => setOpen(false);
|
|
40
41
|
|
|
@@ -45,6 +46,7 @@ function useOpenButton(theme: Theme) {
|
|
|
45
46
|
</Button>
|
|
46
47
|
),
|
|
47
48
|
buttonRef,
|
|
49
|
+
openDialog,
|
|
48
50
|
closeDialog,
|
|
49
51
|
isOpen,
|
|
50
52
|
};
|
|
@@ -83,6 +85,46 @@ export const PreventDialogAutoClose = ({ theme }: any) => {
|
|
|
83
85
|
);
|
|
84
86
|
};
|
|
85
87
|
|
|
88
|
+
export const DialogWithAlertDialog = ({ theme }: any) => {
|
|
89
|
+
const { button, buttonRef, closeDialog, isOpen } = useOpenButton(theme);
|
|
90
|
+
const { openDialog: openAlertDialog, closeDialog: closeAlertDialog, isOpen: isAlertDialogOpen } = useOpenButton(
|
|
91
|
+
theme,
|
|
92
|
+
false,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const handleSubmitDialog = () => {
|
|
96
|
+
closeDialog();
|
|
97
|
+
openAlertDialog();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
{button}
|
|
103
|
+
<Dialog isOpen={isOpen} onClose={closeDialog} parentElement={buttonRef}>
|
|
104
|
+
{content}
|
|
105
|
+
<footer>
|
|
106
|
+
<Toolbar
|
|
107
|
+
after={
|
|
108
|
+
<Button onClick={handleSubmitDialog} emphasis={Emphasis.low}>
|
|
109
|
+
Close
|
|
110
|
+
</Button>
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
113
|
+
</footer>
|
|
114
|
+
</Dialog>
|
|
115
|
+
<AlertDialog
|
|
116
|
+
isOpen={isAlertDialogOpen}
|
|
117
|
+
onClose={closeDialog}
|
|
118
|
+
parentElement={buttonRef}
|
|
119
|
+
title="Default (info)"
|
|
120
|
+
confirmProps={{ onClick: closeAlertDialog, label: 'Confirm' }}
|
|
121
|
+
>
|
|
122
|
+
Consequat deserunt officia aute laborum tempor anim sint est.
|
|
123
|
+
</AlertDialog>
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
86
128
|
export const Sizes = ({ theme }: any) => {
|
|
87
129
|
const { button, buttonRef, closeDialog, isOpen } = useOpenButton(theme);
|
|
88
130
|
const sizes: DialogSizes[] = [Size.tiny, Size.regular, Size.big, Size.huge];
|
|
@@ -115,18 +115,22 @@ export const Dialog: Comp<DialogProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
115
115
|
...forwardedProps
|
|
116
116
|
} = props;
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
119
|
+
const previousOpen = React.useRef(isOpen);
|
|
120
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
121
|
+
React.useEffect(() => {
|
|
122
|
+
if (isOpen !== previousOpen.current) {
|
|
123
|
+
previousOpen.current = isOpen;
|
|
124
|
+
|
|
125
|
+
// Focus the parent element on close.
|
|
126
|
+
if (!isOpen && parentElement && parentElement.current) {
|
|
127
|
+
parentElement.current.focus();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, [isOpen, parentElement]);
|
|
127
131
|
|
|
128
132
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
129
|
-
useCallbackOnEscape(
|
|
133
|
+
useCallbackOnEscape(onClose, isOpen && !preventAutoClose);
|
|
130
134
|
|
|
131
135
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
132
136
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
@@ -192,7 +196,7 @@ export const Dialog: Comp<DialogProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
192
196
|
<div className={`${CLASSNAME}__overlay`} />
|
|
193
197
|
|
|
194
198
|
<section className={`${CLASSNAME}__container`} role="dialog" aria-modal="true" {...dialogProps}>
|
|
195
|
-
<ClickAwayProvider callback={!preventAutoClose &&
|
|
199
|
+
<ClickAwayProvider callback={!preventAutoClose && onClose} refs={clickAwayRefs}>
|
|
196
200
|
<div className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
|
|
197
201
|
{(header || headerChildContent) && (
|
|
198
202
|
<header
|
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`<Dialog> Snapshots and structure should render story DialogWithAlertDialog 1`] = `
|
|
4
|
+
<Fragment>
|
|
5
|
+
<Button
|
|
6
|
+
emphasis="high"
|
|
7
|
+
onClick={[Function]}
|
|
8
|
+
size="m"
|
|
9
|
+
theme="light"
|
|
10
|
+
>
|
|
11
|
+
Open dialog
|
|
12
|
+
</Button>
|
|
13
|
+
<Dialog
|
|
14
|
+
isOpen={true}
|
|
15
|
+
onClose={[Function]}
|
|
16
|
+
parentElement={
|
|
17
|
+
Object {
|
|
18
|
+
"current": undefined,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
size="big"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
className="lumx-spacing-padding"
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
Nihil hic munitissimus habendi senatus locus, nihil horum? At nos hinc posthac, sitientis piros
|
|
28
|
+
Afros. Magna pars studiorum, prodita quaerimus. Integer legentibus erat a ante historiarum
|
|
29
|
+
dapibus. Praeterea iter est quasdam res quas ex communi. Ullamco laboris nisi ut aliquid ex ea
|
|
30
|
+
commodi consequat. Inmensae subtilitatis, obscuris et malesuada fames. Me non paenitet nullum
|
|
31
|
+
festiviorem excogitasse ad hoc. Cum ceteris in veneratione tui montes, nascetur mus. Etiam
|
|
32
|
+
habebis sem dicantur magna mollis euismod. Quis aute iure reprehenderit in voluptate velit esse.
|
|
33
|
+
Phasellus laoreet lorem vel dolor tempus vehicula. Ambitioni dedisse scripsisse iudicaretur.
|
|
34
|
+
Paullum deliquit, ponderibus modulisque suis ratio utitur. Ab illo tempore, ab est sed
|
|
35
|
+
immemorabili. Nec dubitamus multa iter quae et nos invenerat. Tu quoque, Brute, fili mi, nihil
|
|
36
|
+
timor populi, nihil! Morbi fringilla convallis sapien, id pulvinar odio volutpat. Cras mattis
|
|
37
|
+
iudicium purus sit amet fermentum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus.
|
|
38
|
+
Quisque ut dolor gravida, placerat libero vel, euismod. Unam incolunt Belgae, aliam Aquitani,
|
|
39
|
+
tertiam. Cras mattis iudicium purus sit amet fermentum
|
|
40
|
+
</div>
|
|
41
|
+
<footer>
|
|
42
|
+
<Toolbar
|
|
43
|
+
after={
|
|
44
|
+
<Button
|
|
45
|
+
emphasis="low"
|
|
46
|
+
onClick={[Function]}
|
|
47
|
+
size="m"
|
|
48
|
+
theme="light"
|
|
49
|
+
>
|
|
50
|
+
Close
|
|
51
|
+
</Button>
|
|
52
|
+
}
|
|
53
|
+
/>
|
|
54
|
+
</footer>
|
|
55
|
+
</Dialog>
|
|
56
|
+
<AlertDialog
|
|
57
|
+
confirmProps={
|
|
58
|
+
Object {
|
|
59
|
+
"label": "Confirm",
|
|
60
|
+
"onClick": [Function],
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
isOpen={false}
|
|
64
|
+
kind="info"
|
|
65
|
+
onClose={[Function]}
|
|
66
|
+
parentElement={
|
|
67
|
+
Object {
|
|
68
|
+
"current": undefined,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
size="tiny"
|
|
72
|
+
title="Default (info)"
|
|
73
|
+
>
|
|
74
|
+
Consequat deserunt officia aute laborum tempor anim sint est.
|
|
75
|
+
</AlertDialog>
|
|
76
|
+
</Fragment>
|
|
77
|
+
`;
|
|
78
|
+
|
|
3
79
|
exports[`<Dialog> Snapshots and structure should render story DialogWithFocusableElements 1`] = `
|
|
4
80
|
<Fragment>
|
|
5
81
|
<Button
|
|
@@ -40,7 +40,11 @@ export const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((pro
|
|
|
40
40
|
{...forwardedProps}
|
|
41
41
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}
|
|
42
42
|
>
|
|
43
|
-
<Icon
|
|
43
|
+
<Icon
|
|
44
|
+
icon={mdiDragVertical}
|
|
45
|
+
color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}
|
|
46
|
+
size={Size.xs}
|
|
47
|
+
/>
|
|
44
48
|
</div>
|
|
45
49
|
);
|
|
46
50
|
});
|
|
@@ -69,9 +69,8 @@ describe(`<${Flag.displayName} />`, () => {
|
|
|
69
69
|
|
|
70
70
|
it('should use the color', () => {
|
|
71
71
|
const color = ColorPalette.green;
|
|
72
|
-
const { wrapper
|
|
72
|
+
const { wrapper } = setup({ icon: mdiAbTesting, color });
|
|
73
73
|
|
|
74
|
-
expect(iconEl.prop('color')).toEqual(color);
|
|
75
74
|
expect(wrapper).toHaveClassName(
|
|
76
75
|
getBasicClass({
|
|
77
76
|
prefix: CLASSNAME,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
|
-
import { ColorPalette,
|
|
4
|
+
import { ColorPalette, Icon, Size, Theme } from '@lumx/react';
|
|
5
5
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
6
6
|
|
|
7
7
|
export interface FlagProps extends GenericProps {
|
|
@@ -38,15 +38,7 @@ export const Flag: Comp<FlagProps, HTMLDivElement> = forwardRef((props, ref) =>
|
|
|
38
38
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color: flagColor }))}
|
|
39
39
|
ref={ref}
|
|
40
40
|
>
|
|
41
|
-
{icon &&
|
|
42
|
-
<Icon
|
|
43
|
-
icon={icon}
|
|
44
|
-
color={color}
|
|
45
|
-
colorVariant={ColorVariant.D2}
|
|
46
|
-
size={Size.xxs}
|
|
47
|
-
className={`${CLASSNAME}__icon`}
|
|
48
|
-
/>
|
|
49
|
-
)}
|
|
41
|
+
{icon && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}
|
|
50
42
|
<span className={`${CLASSNAME}__label`}>{label}</span>
|
|
51
43
|
</div>
|
|
52
44
|
);
|
|
@@ -19,8 +19,6 @@ Array [
|
|
|
19
19
|
>
|
|
20
20
|
<Icon
|
|
21
21
|
className="lumx-flag__icon"
|
|
22
|
-
color="blue"
|
|
23
|
-
colorVariant="D2"
|
|
24
22
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
25
23
|
size="xxs"
|
|
26
24
|
/>
|
|
@@ -35,8 +33,6 @@ Array [
|
|
|
35
33
|
>
|
|
36
34
|
<Icon
|
|
37
35
|
className="lumx-flag__icon"
|
|
38
|
-
color="dark"
|
|
39
|
-
colorVariant="D2"
|
|
40
36
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
41
37
|
size="xxs"
|
|
42
38
|
/>
|
|
@@ -51,8 +47,6 @@ Array [
|
|
|
51
47
|
>
|
|
52
48
|
<Icon
|
|
53
49
|
className="lumx-flag__icon"
|
|
54
|
-
color="green"
|
|
55
|
-
colorVariant="D2"
|
|
56
50
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
57
51
|
size="xxs"
|
|
58
52
|
/>
|
|
@@ -67,8 +61,6 @@ Array [
|
|
|
67
61
|
>
|
|
68
62
|
<Icon
|
|
69
63
|
className="lumx-flag__icon"
|
|
70
|
-
color="primary"
|
|
71
|
-
colorVariant="D2"
|
|
72
64
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
73
65
|
size="xxs"
|
|
74
66
|
/>
|
|
@@ -83,8 +75,6 @@ Array [
|
|
|
83
75
|
>
|
|
84
76
|
<Icon
|
|
85
77
|
className="lumx-flag__icon"
|
|
86
|
-
color="red"
|
|
87
|
-
colorVariant="D2"
|
|
88
78
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
89
79
|
size="xxs"
|
|
90
80
|
/>
|
|
@@ -99,8 +89,6 @@ Array [
|
|
|
99
89
|
>
|
|
100
90
|
<Icon
|
|
101
91
|
className="lumx-flag__icon"
|
|
102
|
-
color="secondary"
|
|
103
|
-
colorVariant="D2"
|
|
104
92
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
105
93
|
size="xxs"
|
|
106
94
|
/>
|
|
@@ -115,8 +103,6 @@ Array [
|
|
|
115
103
|
>
|
|
116
104
|
<Icon
|
|
117
105
|
className="lumx-flag__icon"
|
|
118
|
-
color="yellow"
|
|
119
|
-
colorVariant="D2"
|
|
120
106
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
121
107
|
size="xxs"
|
|
122
108
|
/>
|
|
@@ -135,7 +121,6 @@ exports[`<Flag /> Snapshots and structure should render story 'withIcon' 1`] = `
|
|
|
135
121
|
>
|
|
136
122
|
<Icon
|
|
137
123
|
className="lumx-flag__icon"
|
|
138
|
-
colorVariant="D2"
|
|
139
124
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
140
125
|
size="xxs"
|
|
141
126
|
/>
|
|
@@ -46,10 +46,16 @@ export const KeyboardNavigation = () => {
|
|
|
46
46
|
<ListItem linkProps={{ href: '#' }}>Link item 2</ListItem>
|
|
47
47
|
<ListSubheader>Header</ListSubheader>
|
|
48
48
|
</>
|
|
49
|
+
<ListItem linkProps={{ href: '#' }} isDisabled>
|
|
50
|
+
Disabled link item
|
|
51
|
+
</ListItem>
|
|
52
|
+
<ListItem onItemSelected={action('onItemSelected')} isDisabled>
|
|
53
|
+
Disabled button item
|
|
54
|
+
</ListItem>
|
|
49
55
|
<CustomListItem />
|
|
50
56
|
{[
|
|
51
57
|
<ListItem key="1" linkProps={{ href: '#' }}>
|
|
52
|
-
Link item
|
|
58
|
+
Link item 4
|
|
53
59
|
</ListItem>,
|
|
54
60
|
]}
|
|
55
61
|
</List>
|