@spaced-out/ui-design-system 0.0.18-beta.3 → 0.0.19

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.
@@ -12,9 +12,6 @@ on:
12
12
  - patch
13
13
  - minor
14
14
  - major
15
- - prepatch
16
- - preminor
17
- - premajor
18
15
  - prerelease
19
16
  required: true
20
17
  jobs:
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.19](https://github.com/spaced-out/ui-design-system/compare/v0.0.18...v0.0.19) (2023-02-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * design fixes for chip ([09fab02](https://github.com/spaced-out/ui-design-system/commit/09fab02562c4fd0790e97dd1fc2ce78cbb045218))
11
+
12
+ ### [0.0.18](https://github.com/spaced-out/ui-design-system/compare/v0.0.18-beta.3...v0.0.18) (2023-02-06)
13
+
14
+
15
+ ### Features
16
+
17
+ * chip component ([#57](https://github.com/spaced-out/ui-design-system/issues/57)) ([aa9dc21](https://github.com/spaced-out/ui-design-system/commit/aa9dc21de4c91f985a28f57c960d9387ac4e8175))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * updated release script to only accept prerelease ([0e94dcc](https://github.com/spaced-out/ui-design-system/commit/0e94dcc2e528dc0612eda5eeb58817b4921713d3))
23
+
5
24
  ### [0.0.18-beta.3](https://github.com/spaced-out/ui-design-system/compare/v0.0.18-beta.2...v0.0.18-beta.3) (2023-02-06)
6
25
 
7
26
  ### [0.0.18-beta.2](https://github.com/spaced-out/ui-design-system/compare/v0.0.18-beta.1...v0.0.18-beta.2) (2023-02-06)
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Chip = exports.CHIP_SEMANTIC = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _classify = require("../../utils/classify");
9
+ var _Icon = require("../Icon");
10
+ var _ChipModule = _interopRequireDefault(require("./Chip.module.css"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+
15
+ const CHIP_SEMANTIC = Object.freeze({
16
+ primary: 'primary',
17
+ information: 'information',
18
+ success: 'success',
19
+ warning: 'warning',
20
+ danger: 'danger',
21
+ secondary: 'secondary'
22
+ });
23
+ exports.CHIP_SEMANTIC = CHIP_SEMANTIC;
24
+ const Chip = _ref => {
25
+ let {
26
+ classNames,
27
+ semantic = 'primary',
28
+ size = 'medium',
29
+ children,
30
+ iconName = '',
31
+ iconType = 'regular',
32
+ dismissable = false,
33
+ onDismiss = () => null,
34
+ disabled
35
+ } = _ref;
36
+ return /*#__PURE__*/React.createElement("div", {
37
+ "data-testid": "Chip",
38
+ className: (0, _classify.classify)(_ChipModule.default.chipWrapper, {
39
+ [_ChipModule.default.primary]: semantic === CHIP_SEMANTIC.primary,
40
+ [_ChipModule.default.information]: semantic === CHIP_SEMANTIC.information,
41
+ [_ChipModule.default.success]: semantic === CHIP_SEMANTIC.success,
42
+ [_ChipModule.default.warning]: semantic === CHIP_SEMANTIC.warning,
43
+ [_ChipModule.default.danger]: semantic === CHIP_SEMANTIC.danger,
44
+ [_ChipModule.default.secondary]: semantic === CHIP_SEMANTIC.secondary,
45
+ [_ChipModule.default.medium]: size === 'medium',
46
+ [_ChipModule.default.small]: size === 'small',
47
+ [_ChipModule.default.dismissable]: dismissable,
48
+ [_ChipModule.default.withIcon]: !!iconName && size !== 'small',
49
+ [_ChipModule.default.disabled]: disabled
50
+ }, classNames?.wrapper)
51
+ }, iconName && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
52
+ className: _ChipModule.default.chipIcon,
53
+ name: iconName,
54
+ type: iconType,
55
+ size: "small"
56
+ }), children, dismissable && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
57
+ className: _ChipModule.default.dismissIcon,
58
+ name: "xmark",
59
+ type: iconType,
60
+ size: "small",
61
+ onClick: event => !disabled && onDismiss && onDismiss(event)
62
+ }));
63
+ };
64
+ exports.Chip = Chip;
@@ -0,0 +1,97 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import {classify} from '../../utils/classify';
6
+ import type {IconType} from '../Icon';
7
+ import {Icon} from '../Icon';
8
+
9
+ import css from './Chip.module.css';
10
+
11
+
12
+ type ClassNames = $ReadOnly<{wrapper?: string}>;
13
+
14
+ export const CHIP_SEMANTIC = Object.freeze({
15
+ primary: 'primary',
16
+ information: 'information',
17
+ success: 'success',
18
+ warning: 'warning',
19
+ danger: 'danger',
20
+ secondary: 'secondary',
21
+ });
22
+
23
+ export type ChipSemanticType = $Values<typeof CHIP_SEMANTIC>;
24
+
25
+ export type BaseChipProps = {
26
+ classNames?: ClassNames,
27
+ semantic?: ChipSemanticType,
28
+ children: React.Node,
29
+ disabled?: boolean,
30
+ };
31
+
32
+ export type MediumChipProps = {
33
+ ...BaseChipProps,
34
+ size?: 'medium',
35
+ iconName?: string,
36
+ iconType?: IconType,
37
+ dismissable?: boolean,
38
+ onDismiss?: ?(SyntheticEvent<HTMLElement>) => mixed,
39
+ };
40
+
41
+ export type SmallChipProps = {
42
+ ...BaseChipProps,
43
+ size?: 'small',
44
+ };
45
+
46
+ export type ChipProps = MediumChipProps | SmallChipProps;
47
+ export const Chip = ({
48
+ classNames,
49
+ semantic = 'primary',
50
+ size = 'medium',
51
+ children,
52
+ iconName = '',
53
+ iconType = 'regular',
54
+ dismissable = false,
55
+ onDismiss = () => null,
56
+ disabled,
57
+ }: ChipProps): React.Node => (
58
+ <div
59
+ data-testid="Chip"
60
+ className={classify(
61
+ css.chipWrapper,
62
+ {
63
+ [css.primary]: semantic === CHIP_SEMANTIC.primary,
64
+ [css.information]: semantic === CHIP_SEMANTIC.information,
65
+ [css.success]: semantic === CHIP_SEMANTIC.success,
66
+ [css.warning]: semantic === CHIP_SEMANTIC.warning,
67
+ [css.danger]: semantic === CHIP_SEMANTIC.danger,
68
+ [css.secondary]: semantic === CHIP_SEMANTIC.secondary,
69
+ [css.medium]: size === 'medium',
70
+ [css.small]: size === 'small',
71
+ [css.dismissable]: dismissable,
72
+ [css.withIcon]: !!iconName && size !== 'small',
73
+ [css.disabled]: disabled,
74
+ },
75
+ classNames?.wrapper,
76
+ )}
77
+ >
78
+ {iconName && size !== 'small' && (
79
+ <Icon
80
+ className={css.chipIcon}
81
+ name={iconName}
82
+ type={iconType}
83
+ size="small"
84
+ />
85
+ )}
86
+ {children}
87
+ {dismissable && size !== 'small' && (
88
+ <Icon
89
+ className={css.dismissIcon}
90
+ name="xmark"
91
+ type={iconType}
92
+ size="small"
93
+ onClick={(event) => !disabled && onDismiss && onDismiss(event)}
94
+ />
95
+ )}
96
+ </div>
97
+ );
@@ -0,0 +1,91 @@
1
+ @value (
2
+ colorNeutralLightest,
3
+ colorInformationLightest,
4
+ colorSuccessLightest,
5
+ colorWarningLightest,
6
+ colorDangerLightest,
7
+ colorBackgroundTertiary,
8
+ colorTextDisabled,
9
+ colorFillDisabled
10
+ ) from '../../styles/variables/_color.css';
11
+ @value (
12
+ spaceNone,
13
+ spaceXXSmall,
14
+ spaceXSmall,
15
+ spaceSmall
16
+ ) from '../../styles/variables/_space.css';
17
+ @value (
18
+ borderRadiusXSmall
19
+ ) from '../../styles/variables/_border.css';
20
+
21
+ .chipWrapper {
22
+ composes: formLabelSmall from '../../styles/typography.module.css';
23
+ display: flex;
24
+ background-color: colorNeutralLightest;
25
+ align-items: center;
26
+ width: fit-content;
27
+ height: fit-content;
28
+ padding: spaceXXSmall spaceSmall;
29
+ gap: spaceXXSmall;
30
+ border-radius: borderRadiusXSmall;
31
+ }
32
+
33
+ .primary {
34
+ background-color: colorNeutralLightest;
35
+ }
36
+
37
+ .information {
38
+ background-color: colorInformationLightest;
39
+ }
40
+
41
+ .success {
42
+ background-color: colorSuccessLightest;
43
+ }
44
+
45
+ .warning {
46
+ background-color: colorWarningLightest;
47
+ }
48
+
49
+ .danger {
50
+ background-color: colorDangerLightest;
51
+ }
52
+
53
+ .secondary {
54
+ composes: borderPrimary from '../../styles/border.module.css';
55
+ background-color: colorBackgroundTertiary;
56
+ }
57
+
58
+ .withIcon {
59
+ padding: spaceXXSmall spaceSmall spaceXXSmall spaceXSmall;
60
+ }
61
+
62
+ .dismissable {
63
+ padding: spaceXXSmall spaceXSmall spaceXXSmall spaceSmall;
64
+ }
65
+
66
+ .small {
67
+ padding: spaceNone spaceXSmall;
68
+ }
69
+
70
+ .dismissIcon {
71
+ margin-left: spaceXSmall;
72
+ cursor: pointer;
73
+ }
74
+
75
+ /* This should be last section for CSS Specificity */
76
+
77
+ .disabled {
78
+ color: colorTextDisabled;
79
+ background-color: colorFillDisabled;
80
+ border: initial;
81
+ pointer-events: none;
82
+ cursor: not-allowed;
83
+ }
84
+
85
+ .disabled .dismissIcon {
86
+ color: colorTextDisabled;
87
+ }
88
+
89
+ .disabled .chipIcon {
90
+ color: colorTextDisabled;
91
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CHIP_SEMANTIC", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Chip.CHIP_SEMANTIC;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Chip", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Chip.Chip;
16
+ }
17
+ });
18
+ var _Chip = require("./Chip");
@@ -0,0 +1,4 @@
1
+ // @flow strict
2
+
3
+ export type {ChipProps} from './Chip';
4
+ export {Chip, CHIP_SEMANTIC} from './Chip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.18-beta.3",
3
+ "version": "0.0.19",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {