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

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,19 +12,17 @@ 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:
21
18
  release:
22
19
  runs-on: ubuntu-latest
20
+ # Check access controls on release and tagging
23
21
  steps:
24
22
  - name: Check Permissions
25
23
  id: check-permissions
26
24
  env:
27
- ALLOWED_USERS: superrover
25
+ ALLOWED_USERS: superrover, Anant-Raj
28
26
  if: ${{ !contains(env.ALLOWED_USERS, github.actor) }}
29
27
  run: |
30
28
  echo "You don't have correct permissions to do this release"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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.18](https://github.com/spaced-out/ui-design-system/compare/v0.0.18-beta.3...v0.0.18) (2023-02-06)
6
+
7
+
8
+ ### Features
9
+
10
+ * chip component ([#57](https://github.com/spaced-out/ui-design-system/issues/57)) ([aa9dc21](https://github.com/spaced-out/ui-design-system/commit/aa9dc21de4c91f985a28f57c960d9387ac4e8175))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * updated release script to only accept prerelease ([0e94dcc](https://github.com/spaced-out/ui-design-system/commit/0e94dcc2e528dc0612eda5eeb58817b4921713d3))
16
+
17
+ ### [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)
18
+
5
19
  ### [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)
6
20
 
7
21
 
@@ -0,0 +1,63 @@
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.disabled]: disabled
49
+ }, classNames?.wrapper)
50
+ }, iconName && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
51
+ className: _ChipModule.default.chipIcon,
52
+ name: iconName,
53
+ type: iconType,
54
+ size: "small"
55
+ }), children, dismissable && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
56
+ className: _ChipModule.default.dismissIcon,
57
+ name: "xmark",
58
+ type: iconType,
59
+ size: "small",
60
+ onClick: event => !disabled && onDismiss && onDismiss(event)
61
+ }));
62
+ };
63
+ exports.Chip = Chip;
@@ -0,0 +1,96 @@
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.disabled]: disabled,
73
+ },
74
+ classNames?.wrapper,
75
+ )}
76
+ >
77
+ {iconName && size !== 'small' && (
78
+ <Icon
79
+ className={css.chipIcon}
80
+ name={iconName}
81
+ type={iconType}
82
+ size="small"
83
+ />
84
+ )}
85
+ {children}
86
+ {dismissable && size !== 'small' && (
87
+ <Icon
88
+ className={css.dismissIcon}
89
+ name="xmark"
90
+ type={iconType}
91
+ size="small"
92
+ onClick={(event) => !disabled && onDismiss && onDismiss(event)}
93
+ />
94
+ )}
95
+ </div>
96
+ );
@@ -0,0 +1,83 @@
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
+ .small {
59
+ padding: spaceNone spaceXSmall;
60
+ }
61
+
62
+ .dismissIcon {
63
+ margin-left: spaceXSmall;
64
+ cursor: pointer;
65
+ }
66
+
67
+ /* This should be last section for CSS Specificity */
68
+
69
+ .disabled {
70
+ color: colorTextDisabled;
71
+ background-color: colorFillDisabled;
72
+ border: initial;
73
+ pointer-events: none;
74
+ cursor: not-allowed;
75
+ }
76
+
77
+ .disabled .dismissIcon {
78
+ color: colorTextDisabled;
79
+ }
80
+
81
+ .disabled .chipIcon {
82
+ color: colorTextDisabled;
83
+ }
@@ -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.2",
3
+ "version": "0.0.18",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {