@junyiacademy/ui-test 0.0.12 → 1.4.1

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.
Files changed (39) hide show
  1. package/declarations/libs/ui/src/index.d.ts +1 -2
  2. package/declarations/libs/ui/src/interfaces/index.d.ts +2 -2
  3. package/declarations/libs/ui/src/lib/menu-item/SelectMenuItem.d.ts +1 -2
  4. package/declarations/libs/ui/src/lib/select/OutlinedSelect.d.ts +1 -1
  5. package/declarations/libs/ui/src/lib/select/StandardSelect.d.ts +1 -1
  6. package/dist/libs/ui/src/index.js +3 -5
  7. package/dist/libs/ui/src/lib/menu-item/SelectMenuItem.js +7 -8
  8. package/dist/libs/ui/src/lib/select/OutlinedSelect.js +13 -16
  9. package/dist/libs/ui/src/lib/select/StandardSelect.js +5 -18
  10. package/dist/libs/ui/src/lib/topic-filter/TopicFilter.js +9 -5
  11. package/package.json +1 -1
  12. package/.storybook/main.js +0 -9
  13. package/.storybook/preview.js +0 -10
  14. package/.storybook/tsconfig.json +0 -14
  15. package/.storybook/webpack.config.js +0 -84
  16. package/declarations/libs/ui/src/lib/alert/Alert.d.ts +0 -13
  17. package/declarations/libs/ui/src/lib/selection-item/SelectionItem.d.ts +0 -10
  18. package/dist/libs/ui/src/lib/alert/Alert.js +0 -72
  19. package/dist/libs/ui/src/lib/selection-item/SelectionItem.js +0 -16
  20. package/src/index.ts +0 -8
  21. package/src/interfaces/index.tsx +0 -33
  22. package/src/lib/button/Button.stories.tsx +0 -50
  23. package/src/lib/button/Button.tsx +0 -85
  24. package/src/lib/button-group/ButtonGroup.stories.tsx +0 -59
  25. package/src/lib/button-group/ButtonGroup.tsx +0 -37
  26. package/src/lib/menu-item/SelectMenuItem.stories.tsx +0 -44
  27. package/src/lib/menu-item/SelectMenuItem.tsx +0 -45
  28. package/src/lib/radio/Radio.stories.tsx +0 -154
  29. package/src/lib/radio/Radio.tsx +0 -93
  30. package/src/lib/select/OutlinedSelect.tsx +0 -216
  31. package/src/lib/select/Select.stories.tsx +0 -421
  32. package/src/lib/select/Select.tsx +0 -13
  33. package/src/lib/select/StandardSelect.tsx +0 -179
  34. package/src/lib/text-field/TextField.stories.tsx +0 -160
  35. package/src/lib/text-field/TextField.tsx +0 -93
  36. package/src/lib/topic-filter/TopicFilter.stories.tsx +0 -83
  37. package/src/lib/topic-filter/TopicFilter.tsx +0 -204
  38. package/src/styles/theme.ts +0 -60
  39. package/src/utils/topicTree.ts +0 -197
@@ -1,8 +1,7 @@
1
1
  export { default as TopicFilter } from './lib/topic-filter/TopicFilter';
2
2
  export { default as SelectMenuItem } from './lib/menu-item/SelectMenuItem';
3
- export { default as OutlinedSelect } from './lib/select/OutlinedSelect';
4
3
  export { default as Button } from './lib/button/Button';
5
4
  export { default as ButtonGroup } from './lib/button-group/ButtonGroup';
6
5
  export { default as Radio } from './lib/radio/Radio';
7
6
  export { default as TextField } from './lib/text-field/TextField';
8
- export { default as StandardSelect } from './lib/select/StandardSelect';
7
+ export { default as Select } from './lib/select/Select';
@@ -17,10 +17,10 @@ export interface SelectProps extends MuiSelectProp {
17
17
  SelectProps?: object | Partial<MuiSelectProp>;
18
18
  color?: 'primary' | 'secondary';
19
19
  size?: 'medium' | 'small';
20
- width?: number | 'auto';
21
- paperMaxHeight?: number | 'auto';
20
+ paperMaxHeight?: number | string;
22
21
  error?: boolean;
23
22
  hasLabel?: boolean;
24
23
  hasShrink?: boolean;
25
24
  disabled?: boolean;
25
+ className?: string;
26
26
  }
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { MenuItemProps } from '@material-ui/core';
3
3
  export interface SelectMenuItemProps extends MenuItemProps {
4
- width: number | 'auto';
5
4
  value?: any;
6
5
  disabled?: boolean;
7
6
  }
8
- declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "classes" | "disabled" | "value" | "onChange" | "children" | "onKeyUp" | "onKeyDown" | "onBlur" | "onFocus" | "defaultValue" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "autoFocus" | "innerRef" | "button" | "width" | "alignItems" | "dense" | "key" | "selected" | "ContainerComponent" | "ContainerProps" | "disableGutters" | "divider" | "focusVisibleClassName"> & React.RefAttributes<HTMLLIElement>>;
7
+ declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "classes" | "disabled" | "value" | "onChange" | "children" | "onKeyUp" | "onKeyDown" | "onBlur" | "onFocus" | "defaultValue" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "autoFocus" | "innerRef" | "button" | "alignItems" | "dense" | "key" | "selected" | "ContainerComponent" | "ContainerProps" | "disableGutters" | "divider" | "focusVisibleClassName"> & React.RefAttributes<HTMLLIElement>>;
9
8
  export default SelectMenuItem;
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from '../../interfaces';
2
- export declare const OutlinedSelect: ({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
2
+ export declare const OutlinedSelect: ({ placeholder, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
3
3
  export default OutlinedSelect;
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from '../../interfaces';
2
- export declare function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
2
+ export declare function StandardSelect({ placeholder, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
3
3
  export default StandardSelect;
@@ -3,13 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StandardSelect = exports.TextField = exports.Radio = exports.ButtonGroup = exports.Button = exports.OutlinedSelect = exports.SelectMenuItem = exports.TopicFilter = void 0;
6
+ exports.Select = exports.TextField = exports.Radio = exports.ButtonGroup = exports.Button = exports.SelectMenuItem = exports.TopicFilter = void 0;
7
7
  var TopicFilter_1 = require("./lib/topic-filter/TopicFilter");
8
8
  Object.defineProperty(exports, "TopicFilter", { enumerable: true, get: function () { return __importDefault(TopicFilter_1).default; } });
9
9
  var SelectMenuItem_1 = require("./lib/menu-item/SelectMenuItem");
10
10
  Object.defineProperty(exports, "SelectMenuItem", { enumerable: true, get: function () { return __importDefault(SelectMenuItem_1).default; } });
11
- var OutlinedSelect_1 = require("./lib/select/OutlinedSelect");
12
- Object.defineProperty(exports, "OutlinedSelect", { enumerable: true, get: function () { return __importDefault(OutlinedSelect_1).default; } });
13
11
  var Button_1 = require("./lib/button/Button");
14
12
  Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(Button_1).default; } });
15
13
  var ButtonGroup_1 = require("./lib/button-group/ButtonGroup");
@@ -18,5 +16,5 @@ var Radio_1 = require("./lib/radio/Radio");
18
16
  Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return __importDefault(Radio_1).default; } });
19
17
  var TextField_1 = require("./lib/text-field/TextField");
20
18
  Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return __importDefault(TextField_1).default; } });
21
- var StandardSelect_1 = require("./lib/select/StandardSelect");
22
- Object.defineProperty(exports, "StandardSelect", { enumerable: true, get: function () { return __importDefault(StandardSelect_1).default; } });
19
+ var Select_1 = require("./lib/select/Select");
20
+ Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return __importDefault(Select_1).default; } });
@@ -9,19 +9,18 @@ const PREFIX = 'JuiSelectMenuItem';
9
9
  const classes = {
10
10
  menuItemSelected: `${PREFIX}-menuItemSelected`,
11
11
  };
12
- const StyledMenuItem = styles_1.styled((_a) => {
13
- var { width: _width } = _a, props = tslib_1.__rest(_a, ["width"]);
14
- return (react_1.default.createElement(core_1.MenuItem, Object.assign({ classes: { selected: classes.menuItemSelected } }, props)));
15
- })(({ width, theme }) => ({
16
- width: width,
12
+ const StyledMenuItem = styles_1.styled((props) => (react_1.default.createElement(core_1.MenuItem, Object.assign({ classes: { selected: classes.menuItemSelected } }, props))))(({ theme }) => ({
17
13
  whiteSpace: 'unset',
18
14
  color: theme.palette.text.primary,
19
- [`& .${classes.menuItemSelected}`]: {
15
+ [`&.${classes.menuItemSelected}`]: {
20
16
  backgroundColor: theme.palette.grey[300],
17
+ '&:hover': {
18
+ backgroundColor: theme.palette.grey[200],
19
+ },
21
20
  },
22
21
  }));
23
22
  const SelectMenuItem = react_1.default.forwardRef((_a, ref) => {
24
- var { width, children, value = '' } = _a, otherProps = tslib_1.__rest(_a, ["width", "children", "value"]);
25
- return (react_1.default.createElement(StyledMenuItem, Object.assign({ width: width, innerRef: ref, value: value }, otherProps), children));
23
+ var { children, value = '' } = _a, otherProps = tslib_1.__rest(_a, ["children", "value"]);
24
+ return (react_1.default.createElement(StyledMenuItem, Object.assign({ innerRef: ref, value: value }, otherProps), children));
26
25
  });
27
26
  exports.default = SelectMenuItem;
@@ -24,20 +24,15 @@ const classes = {
24
24
  selectPaper: `${PREFIX}-menuPaper`,
25
25
  };
26
26
  const StyledFormControl = styles_1.styled((_a) => {
27
- var { color: _color, width: _width } = _a, props = tslib_1.__rest(_a, ["color", "width"]);
28
- return react_1.default.createElement(core_1.FormControl, Object.assign({}, props));
29
- })(({ color, width, theme }) => ({
30
- margin: theme.spacing(1),
31
- width: width,
27
+ var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
28
+ return (react_1.default.createElement(core_1.FormControl, Object.assign({}, props)));
29
+ })(({ color, theme }) => ({
32
30
  backgroundColor: 'white',
33
31
  '&:hover': {
34
32
  [`& :not(.${classes.outlineInputDisabled}):not(.${classes.outlineInputError}) .${classes.outlineInputNotchedOutline}`]: {
35
33
  borderColor: theme.palette[color].main,
36
34
  },
37
35
  },
38
- [`& .${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
39
- borderColor: `${theme.palette.error.main}`,
40
- },
41
36
  }));
42
37
  const StyledInputLabel = styles_1.styled((_a) => {
43
38
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
@@ -69,15 +64,20 @@ const StyledInputLabel = styles_1.styled((_a) => {
69
64
  }));
70
65
  const StyledOutlinedInput = styles_1.styled((props) => (react_1.default.createElement(core_1.OutlinedInput, Object.assign({ classes: {
71
66
  root: classes.outlineInputRoot,
72
- focused: classes.outlineInputFocused,
73
67
  input: classes.outlineInputInput,
68
+ focused: classes.outlineInputFocused,
74
69
  inputMarginDense: classes.outlineInputInputMarginDense,
75
70
  notchedOutline: classes.outlineInputNotchedOutline,
76
71
  disabled: classes.outlineInputDisabled,
77
72
  error: classes.outlineInputError,
78
73
  } }, props))))(({ theme }) => ({
79
- [`&.${classes.outlineInputRoot}.${classes.outlineInputFocused}`]: {
80
- backgroundColor: theme.palette.action.selected,
74
+ [`&.${classes.outlineInputRoot}`]: {
75
+ [`&.${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
76
+ borderColor: `${theme.palette.error.main}`,
77
+ },
78
+ [`& .${classes.outlineInputInputMarginDense}`]: {
79
+ padding: '14.5px 15px 14.5px 12px',
80
+ },
81
81
  },
82
82
  [`& .${classes.outlineInputInput}`]: {
83
83
  color: theme.palette.text.primary,
@@ -85,9 +85,6 @@ const StyledOutlinedInput = styles_1.styled((props) => (react_1.default.createEl
85
85
  background: 'rgba(0,0,0,0)',
86
86
  },
87
87
  },
88
- [`& .${classes.outlineInputInputMarginDense}`]: {
89
- padding: '14.5px 15px 14.5px 12px',
90
- },
91
88
  }));
92
89
  const StyledSelect = styles_1.styled((_a) => {
93
90
  var { paperMaxHeight: _paperMaxHeight, hasAdornment: _hasAdornment, className } = _a, props = tslib_1.__rest(_a, ["paperMaxHeight", "hasAdornment", "className"]);
@@ -112,10 +109,10 @@ const StyledSelect = styles_1.styled((_a) => {
112
109
  left: hasAdornment ? '24px !important' : '70px',
113
110
  },
114
111
  }));
115
- const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
112
+ const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
116
113
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
117
114
  const hasHelperText = !!helperText;
118
- return (react_1.default.createElement(StyledFormControl, { size: size, width: width, disabled: disabled, error: error, color: color },
115
+ return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
119
116
  hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, placeholder)),
120
117
  react_1.default.createElement(StyledSelect, Object.assign({ value: value, paperMaxHeight: paperMaxHeight, hasAdornment: hasAdornment, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? placeholder : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
121
118
  hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
@@ -11,7 +11,6 @@ const classes = {
11
11
  inputLabelFocused: `${PREFIX}-inputLabelFocused`,
12
12
  inputLabelMarginDense: `${PREFIX}-inputLabelMarginDense`,
13
13
  inputLabelError: `${PREFIX}-inputLabelError`,
14
- inputRoot: `${PREFIX}-inputRoot`,
15
14
  inputFocused: `${PREFIX}-inputFocused`,
16
15
  inputInput: `${PREFIX}-input`,
17
16
  inputUnderline: `${PREFIX}-inputUnderline`,
@@ -21,13 +20,6 @@ const classes = {
21
20
  selectPaper: `${PREFIX}-menuPaper`,
22
21
  selectDisabled: `${PREFIX}-selectDisabled`,
23
22
  };
24
- const StyledFormControl = styles_1.styled((_a) => {
25
- var { width: _width } = _a, props = tslib_1.__rest(_a, ["width"]);
26
- return (react_1.default.createElement(core_1.FormControl, Object.assign({}, props)));
27
- })(({ width, theme }) => ({
28
- width,
29
- margin: theme.spacing(0, 4, 4, 4),
30
- }));
31
23
  const StyledInputLabel = styles_1.styled((_a) => {
32
24
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
33
25
  return (react_1.default.createElement(core_1.InputLabel, Object.assign({ classes: {
@@ -63,8 +55,6 @@ const StyledSelect = styles_1.styled((_a) => {
63
55
  const StyledInput = styles_1.styled((_a) => {
64
56
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
65
57
  return (react_1.default.createElement(core_1.Input, Object.assign({ classes: {
66
- root: classes.inputRoot,
67
- focused: classes.inputFocused,
68
58
  input: classes.inputInput,
69
59
  disabled: classes.inputDisabled,
70
60
  underline: classes.inputUnderline,
@@ -72,29 +62,26 @@ const StyledInput = styles_1.styled((_a) => {
72
62
  } }, props)));
73
63
  })(({ color, theme }) => ({
74
64
  color: theme.palette.text.primary,
75
- [`&.${classes.inputRoot}.${classes.inputFocused}`]: {
76
- backgroundColor: theme.palette.action.selected,
77
- },
78
65
  [`& .${classes.inputInput}`]: {
79
- ['&:focus']: {
66
+ '&:focus': {
80
67
  background: 'rgba(0,0,0,0)',
81
68
  },
82
69
  },
83
70
  [`&.${classes.inputUnderline}:not(.${classes.inputDisabled}):not(.${classes.inputError})`]: {
84
- [`&:after,&:hover:before`]: {
71
+ '&:after,&:hover:before': {
85
72
  borderBottomColor: theme.palette[color].main,
86
73
  },
87
74
  },
88
75
  [`&.${classes.inputUnderline}.${classes.inputError}:not(.${classes.inputDisabled})`]: {
89
- [`&:after,&:hover:before`]: {
76
+ '&:after,&:hover:before': {
90
77
  borderBottomColor: theme.palette.error.main,
91
78
  },
92
79
  },
93
80
  }));
94
- function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
81
+ function StandardSelect({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
95
82
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
96
83
  const hasHelperText = !!helperText;
97
- return (react_1.default.createElement(StyledFormControl, { color: color, size: size, width: width, disabled: disabled, error: error },
84
+ return (react_1.default.createElement(core_1.FormControl, { color: color, size: size, disabled: disabled, error: error, className: className },
98
85
  react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, placeholder),
99
86
  react_1.default.createElement(StyledSelect, Object.assign({ value: value, paperMaxHeight: paperMaxHeight, hasAdornment: hasAdornment, input: react_1.default.createElement(StyledInput, Object.assign({ color: color }, InputProps)) }, SelectProps), children),
100
87
  hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const styles_1 = require("@material-ui/core/styles");
7
7
  const ArrowRightRounded_1 = tslib_1.__importDefault(require("@material-ui/icons/ArrowRightRounded"));
8
- const OutlinedSelect_1 = tslib_1.__importDefault(require("../select/OutlinedSelect"));
8
+ const Select_1 = tslib_1.__importDefault(require("../select/Select"));
9
9
  const SelectMenuItem_1 = tslib_1.__importDefault(require("../menu-item/SelectMenuItem"));
10
10
  // self-defined-configs
11
11
  const PLACEHOLDER = '請選擇';
@@ -20,6 +20,10 @@ const SelectWrapper = styles_1.styled('div')({
20
20
  display: 'flex',
21
21
  alignItems: 'center',
22
22
  });
23
+ const StyledSelect = styles_1.styled(Select_1.default)(({ theme }) => ({
24
+ width: 220,
25
+ margin: theme.spacing(1),
26
+ }));
23
27
  const StyledArrowRightRoundedIcon = styles_1.styled(ArrowRightRounded_1.default)(({ theme }) => ({
24
28
  margin: theme.spacing(-1, -1.5),
25
29
  fontSize: theme.spacing(7),
@@ -82,12 +86,12 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
82
86
  setLayeredTopicList([topicTree]);
83
87
  }, [topicTree]);
84
88
  if (layeredTopicList.length === 0) {
85
- return (react_1.default.createElement(OutlinedSelect_1.default, { size: 'small', width: 220, placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
89
+ return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
86
90
  }
87
91
  return (react_1.default.createElement(FiltersWrapper, null, layeredTopicList.map((layeredTopic, layerNumber) => {
88
92
  const hasLabel = isFocusedList[layerNumber] || !selectedTopicIds[layerNumber];
89
93
  return (react_1.default.createElement(SelectWrapper, { key: layeredTopic.id },
90
- react_1.default.createElement(OutlinedSelect_1.default, { size: 'small', width: 220, paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
94
+ react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
91
95
  'data-testid': `layered-topic-${layerNumber}`,
92
96
  }, InputProps: {
93
97
  inputProps: {
@@ -111,8 +115,8 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
111
115
  });
112
116
  },
113
117
  } },
114
- react_1.default.createElement(SelectMenuItem_1.default, { width: 220, disabled: true }, PLACEHOLDER),
115
- layeredTopic.childTopics.map((childTopic) => (react_1.default.createElement(SelectMenuItem_1.default, { width: 220, key: childTopic.id, value: childTopic.id, "data-testid": `layered-menuitem-${layerNumber}`, "data-is-content-topic": childTopic.isContentTopic }, childTopic.title)))),
118
+ react_1.default.createElement(SelectMenuItem_1.default, { disabled: true }, PLACEHOLDER),
119
+ layeredTopic.childTopics.map((childTopic) => (react_1.default.createElement(SelectMenuItem_1.default, { key: childTopic.id, value: childTopic.id, "data-testid": `layered-menuitem-${layerNumber}`, "data-is-content-topic": childTopic.isContentTopic }, childTopic.title)))),
116
120
  hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(StyledArrowRightRoundedIcon, { fontSize: 'large', "data-testid": 'topic-filter-arrow' }))));
117
121
  })));
118
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "0.0.12",
3
+ "version": "1.4.1",
4
4
  "description": "junyiacademy ui library",
5
5
  "main": "./dist/libs/ui/src/index.js",
6
6
  "typings": "./declarations/libs/ui/src/index.d.ts",
@@ -1,9 +0,0 @@
1
- const rootMain = require('../../../.storybook/main')
2
-
3
- // Use the following syntax to add addons!
4
- // rootMain.addons.push('');
5
- rootMain.stories.push(
6
- ...['../src/lib/**/*.stories.mdx', '../src/lib/**/*.stories.@(js|jsx|ts|tsx)']
7
- )
8
-
9
- module.exports = rootMain
@@ -1,10 +0,0 @@
1
- import { ThemeProvider } from '@material-ui/core/styles'
2
- import theme from '../src/styles/theme'
3
-
4
- export const decorators = [
5
- (Story) => (
6
- <ThemeProvider theme={theme}>
7
- <Story />
8
- </ThemeProvider>
9
- ),
10
- ]
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "emitDecoratorMetadata": true,
5
- "outDir": ""
6
- },
7
- "exclude": [
8
- "../**/*.spec.ts",
9
- "../**/*.spec.js",
10
- "../**/*.spec.tsx",
11
- "../**/*.spec.jsx"
12
- ],
13
- "include": ["../src/**/*", "*.js"]
14
- }
@@ -1,84 +0,0 @@
1
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
2
- const rootWebpackConfig = require('../../../.storybook/webpack.config')
3
- /**
4
- * Export a function. Accept the base config as the only param.
5
- *
6
- * @param {Parameters<typeof rootWebpackConfig>[0]} options
7
- */
8
- module.exports = async ({ config, mode }) => {
9
- config = await rootWebpackConfig({ config, mode })
10
-
11
- const tsPaths = new TsconfigPathsPlugin({
12
- configFile: './tsconfig.base.json',
13
- })
14
-
15
- config.resolve.plugins
16
- ? config.resolve.plugins.push(tsPaths)
17
- : (config.resolve.plugins = [tsPaths])
18
-
19
- // Found this here: https://github.com/nrwl/nx/issues/2859
20
- // And copied the part of the solution that made it work
21
-
22
- const svgRuleIndex = config.module.rules.findIndex((rule) => {
23
- const { test } = rule
24
-
25
- return test.toString().startsWith('/\\.(svg|ico')
26
- })
27
- config.module.rules[
28
- svgRuleIndex
29
- ].test = /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/
30
-
31
- config.module.rules.push(
32
- {
33
- test: /\.(png|jpe?g|gif|webp)$/,
34
- loader: require.resolve('url-loader'),
35
- options: {
36
- limit: 10000, // 10kB
37
- name: '[name].[hash:7].[ext]',
38
- },
39
- },
40
- {
41
- test: /\.svg$/,
42
- oneOf: [
43
- // If coming from JS/TS file, then transform into React component using SVGR.
44
- {
45
- issuer: {
46
- test: /\.[jt]sx?$/,
47
- },
48
- use: [
49
- {
50
- loader: require.resolve('@svgr/webpack'),
51
- options: {
52
- svgo: false,
53
- titleProp: true,
54
- ref: true,
55
- },
56
- },
57
- {
58
- loader: require.resolve('url-loader'),
59
- options: {
60
- limit: 10000, // 10kB
61
- name: '[name].[hash:7].[ext]',
62
- esModule: false,
63
- },
64
- },
65
- ],
66
- },
67
- // Fallback to plain URL loader.
68
- {
69
- use: [
70
- {
71
- loader: require.resolve('url-loader'),
72
- options: {
73
- limit: 10000, // 10kB
74
- name: '[name].[hash:7].[ext]',
75
- },
76
- },
77
- ],
78
- },
79
- ],
80
- }
81
- )
82
-
83
- return config
84
- }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { AlertProps as MuiAlertProps } from '@material-ui/lab';
3
- export interface AlertProps extends MuiAlertProps {
4
- severity?: 'success' | 'info' | 'warning' | 'error';
5
- action?: boolean;
6
- buttonLink?: string;
7
- isNewTab?: boolean;
8
- cross?: boolean;
9
- handleCrossClick?: () => void;
10
- children?: React.ReactNode;
11
- }
12
- export declare const JuiAlert: ({ severity, action, buttonLink, isNewTab, cross, handleCrossClick, children, ...otherProps }: AlertProps) => JSX.Element;
13
- export default JuiAlert;
@@ -1,10 +0,0 @@
1
- export interface SelectionItemProps {
2
- handleInput: () => {};
3
- label1: string;
4
- value1: string;
5
- label2: string;
6
- value2: string;
7
- isError: boolean;
8
- }
9
- export declare function SelectionItem({ handleInput, label1, value1, label2, value2, isError, }: SelectionItemProps): JSX.Element;
10
- export default SelectionItem;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JuiAlert = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const styles_1 = require("@material-ui/core/styles");
7
- const Alert_1 = tslib_1.__importDefault(require("@material-ui/lab/Alert"));
8
- const Button_1 = require("../button/Button");
9
- const CheckCircleOutline_1 = tslib_1.__importDefault(require("@material-ui/icons/CheckCircleOutline"));
10
- // self-defined-components
11
- const PREFIX = 'JuiAlert';
12
- const alertClasses = {
13
- alertRoot: `${PREFIX}-alertRoot`,
14
- alertMessage: `${PREFIX}-alertMessage`,
15
- };
16
- const buttonClasses = {
17
- buttonRoot: `${PREFIX}-buttonRoot`,
18
- };
19
- const StyledAlert = styles_1.styled((_a) => {
20
- var props = tslib_1.__rest(_a, []);
21
- return (react_1.default.createElement(Alert_1.default, Object.assign({ classes: {
22
- root: alertClasses.alertRoot,
23
- message: alertClasses.alertMessage,
24
- } }, props)));
25
- })({
26
- [`&.${alertClasses.alertRoot}`]: {
27
- height: '48px',
28
- padding: '0 16px',
29
- alignItems: 'center',
30
- },
31
- [`& .${alertClasses.alertMessage}`]: {
32
- display: 'flex',
33
- width: '100%',
34
- justifyContent: 'space-between',
35
- alignItems: 'center',
36
- },
37
- });
38
- const StyledButton = styles_1.styled((_a) => {
39
- var { severity: _severity } = _a, props = tslib_1.__rest(_a, ["severity"]);
40
- return (react_1.default.createElement(Button_1.Button, Object.assign({ classes: { root: buttonClasses.buttonRoot } }, props)));
41
- })(({ severity }) => ({
42
- [`&.${buttonClasses.buttonRoot}`]: {
43
- padding: '4px 10px',
44
- margin: '0 0 0 20px',
45
- minWidth: '74px',
46
- color: severity === 'info'
47
- ? 'rgb(13, 60, 97)'
48
- : severity === 'error'
49
- ? 'rgb(97, 26, 21)'
50
- : severity === 'success'
51
- ? 'rgb(30, 70, 32)'
52
- : 'rgb(102, 60, 0)',
53
- fontWeight: '700',
54
- },
55
- }));
56
- const JuiAlert = (_a) => {
57
- var { severity = 'info', action = false, buttonLink = '', isNewTab = true, cross = false, handleCrossClick, children } = _a, otherProps = tslib_1.__rest(_a, ["severity", "action", "buttonLink", "isNewTab", "cross", "handleCrossClick", "children"]);
58
- const handleButtonClick = () => {
59
- window.open(buttonLink, `${isNewTab ? '_blank' : '_self'}`);
60
- };
61
- const AlertChildren = () => {
62
- return (react_1.default.createElement(react_1.default.Fragment, null,
63
- children,
64
- action && (react_1.default.createElement(StyledButton, { severity: severity, size: 'small', onClick: handleButtonClick }, "ACTION"))));
65
- };
66
- if (cross) {
67
- return (react_1.default.createElement(StyledAlert, Object.assign({ severity: severity, iconMapping: { success: react_1.default.createElement(CheckCircleOutline_1.default, { fontSize: 'inherit' }) }, onClose: handleCrossClick }, otherProps), AlertChildren()));
68
- }
69
- return (react_1.default.createElement(StyledAlert, Object.assign({ severity: severity, iconMapping: { success: react_1.default.createElement(CheckCircleOutline_1.default, { fontSize: 'inherit' }) } }, otherProps), AlertChildren()));
70
- };
71
- exports.JuiAlert = JuiAlert;
72
- exports.default = exports.JuiAlert;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectionItem = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const core_1 = require("@material-ui/core");
7
- const Radio_1 = require("../radio/Radio");
8
- function SelectionItem({ handleInput, label1, value1, label2, value2, isError, }) {
9
- return (react_1.default.createElement(react_1.default.Fragment, null,
10
- react_1.default.createElement(core_1.RadioGroup, { onChange: handleInput },
11
- react_1.default.createElement(Radio_1.Radio, { label: label1, value: value1 }),
12
- react_1.default.createElement(Radio_1.Radio, { label: label2, value: value2 })),
13
- isError && react_1.default.createElement(core_1.FormHelperText, null, "\u8ACB\u9078\u64C7")));
14
- }
15
- exports.SelectionItem = SelectionItem;
16
- exports.default = SelectionItem;
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- export { default as TopicFilter } from './lib/topic-filter/TopicFilter'
2
- export { default as SelectMenuItem } from './lib/menu-item/SelectMenuItem'
3
- export { default as OutlinedSelect } from './lib/select/OutlinedSelect'
4
- export { default as Button } from './lib/button/Button'
5
- export { default as ButtonGroup } from './lib/button-group/ButtonGroup'
6
- export { default as Radio } from './lib/radio/Radio'
7
- export { default as TextField } from './lib/text-field/TextField'
8
- export { default as StandardSelect } from './lib/select/StandardSelect'
@@ -1,33 +0,0 @@
1
- import { ChangeEvent } from 'react'
2
- import {
3
- SelectProps as MuiSelectProp,
4
- InputProps as MuiInputProps,
5
- OutlinedInputProps,
6
- } from '@material-ui/core'
7
-
8
- export interface ITopicTreeNode {
9
- childTopics: ITopicTreeNode[]
10
- id: string
11
- isContentTopic: boolean
12
- key: string
13
- tags: string[]
14
- title: string
15
- }
16
- export interface SelectProps extends MuiSelectProp {
17
- placeholder: string
18
- helperText?: string
19
- InputProps?:
20
- | (Partial<OutlinedInputProps> & {
21
- onChange: (e: ChangeEvent<HTMLInputElement>) => void
22
- })
23
- | (object & Partial<MuiInputProps>)
24
- SelectProps?: object | Partial<MuiSelectProp>
25
- color?: 'primary' | 'secondary'
26
- size?: 'medium' | 'small'
27
- width?: number | 'auto'
28
- paperMaxHeight?: number | 'auto'
29
- error?: boolean
30
- hasLabel?: boolean
31
- hasShrink?: boolean
32
- disabled?: boolean
33
- }