@spaced-out/ui-design-system 0.1.76 → 0.1.78

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/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.1.78](https://github.com/spaced-out/ui-design-system/compare/v0.1.77...v0.1.78) (2024-01-23)
6
+
7
+
8
+ ### Features
9
+
10
+ * ⛹️ icon badge and fullscreen modal ([ac2bd03](https://github.com/spaced-out/ui-design-system/commit/ac2bd03367fc5801cd86a60c70b0ace9c32fac4c))
11
+
12
+ ### [0.1.77](https://github.com/spaced-out/ui-design-system/compare/v0.1.76...v0.1.77) (2024-01-23)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * icon badge ([#160](https://github.com/spaced-out/ui-design-system/issues/160)) ([787e97a](https://github.com/spaced-out/ui-design-system/commit/787e97a781f56a1c44d4f384cd5a9a727c2239b8))
18
+
5
19
  ### [0.1.76](https://github.com/spaced-out/ui-design-system/compare/v0.1.75...v0.1.76) (2024-01-19)
6
20
 
7
21
 
@@ -3,11 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Badge = exports.BADGE_COLOR = void 0;
6
+ exports.IconBadge = exports.Badge = exports.BADGE_COLOR = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _color = require("../../styles/variables/_color");
9
9
  var _classify = _interopRequireDefault(require("../../utils/classify"));
10
- var _Text = require("../Text/Text");
10
+ var _Icon = require("../Icon");
11
+ var _Text = require("../Text");
11
12
  var _BadgeModule = _interopRequireDefault(require("./Badge.module.css"));
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  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); }
@@ -33,6 +34,7 @@ const Badge = /*#__PURE__*/React.forwardRef((_ref, ref) => {
33
34
  text,
34
35
  fill = 'gray'
35
36
  } = _ref;
37
+ const isDark = fill.includes('Dark');
36
38
  return /*#__PURE__*/React.createElement("div", {
37
39
  "data-testid": "Badge",
38
40
  style: {
@@ -43,7 +45,41 @@ const Badge = /*#__PURE__*/React.forwardRef((_ref, ref) => {
43
45
  }, classNames?.wrapper),
44
46
  ref: ref
45
47
  }, /*#__PURE__*/React.createElement(_Text.ButtonTextSmall, {
46
- className: classNames?.text
48
+ className: (0, _classify.default)({
49
+ [_BadgeModule.default.dark]: isDark,
50
+ [_BadgeModule.default.light]: !isDark
51
+ }, classNames?.text)
47
52
  }, text));
48
53
  });
49
- exports.Badge = Badge;
54
+ exports.Badge = Badge;
55
+ const IconBadge = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
56
+ let {
57
+ classNames,
58
+ fill = 'gray',
59
+ iconName,
60
+ iconSize = 'small',
61
+ iconType = 'solid',
62
+ ariaLabel,
63
+ onClick
64
+ } = _ref2;
65
+ const isDark = fill.includes('Dark');
66
+ return /*#__PURE__*/React.createElement("div", {
67
+ "data-testid": "Badge",
68
+ style: {
69
+ '--wrapperBgColor': BADGE_COLOR[fill]
70
+ },
71
+ className: (0, _classify.default)(_BadgeModule.default.badgeWrapper, _BadgeModule.default.iconContainer, classNames?.wrapper),
72
+ ref: ref
73
+ }, /*#__PURE__*/React.createElement(_Icon.Icon, {
74
+ name: iconName,
75
+ type: iconType,
76
+ size: iconSize,
77
+ ariaLabel: ariaLabel,
78
+ onClick: onClick,
79
+ className: (0, _classify.default)({
80
+ [_BadgeModule.default.dark]: isDark,
81
+ [_BadgeModule.default.light]: !isDark
82
+ }, classNames?.icon)
83
+ }));
84
+ });
85
+ exports.IconBadge = IconBadge;
@@ -16,12 +16,14 @@ import {
16
16
  colorWarningLightest,
17
17
  } from '../../styles/variables/_color';
18
18
  import classify from '../../utils/classify';
19
- import {ButtonTextSmall} from '../Text/Text';
19
+ import type {IconSize, IconType} from '../Icon';
20
+ import {Icon} from '../Icon';
21
+ import {ButtonTextSmall} from '../Text';
20
22
 
21
23
  import css from './Badge.module.css';
22
24
 
23
25
 
24
- type ClassNames = $ReadOnly<{wrapper?: string, text?: string}>;
26
+ type ClassNames = $ReadOnly<{wrapper?: string, text?: string, icon?: string}>;
25
27
 
26
28
  export const BADGE_COLOR = Object.freeze({
27
29
  gray: colorGrayLightest,
@@ -39,15 +41,80 @@ export const BADGE_COLOR = Object.freeze({
39
41
 
40
42
  export type BadgeColorType = $Keys<typeof BADGE_COLOR>;
41
43
 
42
- export type BadgeProps = {
44
+ export type BaseBadgeProps = {
43
45
  classNames?: ClassNames,
44
- text: string,
45
46
  fill?: BadgeColorType,
46
47
  };
47
48
 
49
+ export type BadgeProps = {
50
+ ...BaseBadgeProps,
51
+ text: string,
52
+ };
53
+
54
+ export type IconBadgeProps = {
55
+ ...BaseBadgeProps,
56
+ iconName: string,
57
+ iconType?: IconType,
58
+ iconSize?: IconSize,
59
+ onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
60
+ ariaLabel?: string,
61
+ };
62
+
48
63
  export const Badge: React$AbstractComponent<BadgeProps, HTMLDivElement> =
49
64
  React.forwardRef<BadgeProps, HTMLDivElement>(
50
- ({classNames, text, fill = 'gray'}: BadgeProps, ref): React.Node => (
65
+ ({classNames, text, fill = 'gray'}: BadgeProps, ref): React.Node => {
66
+ const isDark = fill.includes('Dark');
67
+
68
+ return (
69
+ <div
70
+ data-testid="Badge"
71
+ style={{
72
+ '--wrapperBgColor': BADGE_COLOR[fill],
73
+ }}
74
+ className={classify(
75
+ css.badgeWrapper,
76
+ {
77
+ [css.fixedWidth]: text.length <= 2,
78
+ },
79
+ classNames?.wrapper,
80
+ )}
81
+ ref={ref}
82
+ >
83
+ <ButtonTextSmall
84
+ className={classify(
85
+ {
86
+ [css.dark]: isDark,
87
+ [css.light]: !isDark,
88
+ },
89
+ classNames?.text,
90
+ )}
91
+ >
92
+ {text}
93
+ </ButtonTextSmall>
94
+ </div>
95
+ );
96
+ },
97
+ );
98
+
99
+ export const IconBadge: React$AbstractComponent<
100
+ IconBadgeProps,
101
+ HTMLDivElement,
102
+ > = React.forwardRef<IconBadgeProps, HTMLDivElement>(
103
+ (
104
+ {
105
+ classNames,
106
+ fill = 'gray',
107
+ iconName,
108
+ iconSize = 'small',
109
+ iconType = 'solid',
110
+ ariaLabel,
111
+ onClick,
112
+ }: IconBadgeProps,
113
+ ref,
114
+ ): React.Node => {
115
+ const isDark = fill.includes('Dark');
116
+
117
+ return (
51
118
  <div
52
119
  data-testid="Badge"
53
120
  style={{
@@ -55,14 +122,26 @@ export const Badge: React$AbstractComponent<BadgeProps, HTMLDivElement> =
55
122
  }}
56
123
  className={classify(
57
124
  css.badgeWrapper,
58
- {
59
- [css.fixedWidth]: text.length <= 2,
60
- },
125
+ css.iconContainer,
61
126
  classNames?.wrapper,
62
127
  )}
63
128
  ref={ref}
64
129
  >
65
- <ButtonTextSmall className={classNames?.text}>{text}</ButtonTextSmall>
130
+ <Icon
131
+ name={iconName}
132
+ type={iconType}
133
+ size={iconSize}
134
+ ariaLabel={ariaLabel}
135
+ onClick={onClick}
136
+ className={classify(
137
+ {
138
+ [css.dark]: isDark,
139
+ [css.light]: !isDark,
140
+ },
141
+ classNames?.icon,
142
+ )}
143
+ />
66
144
  </div>
67
- ),
68
- );
145
+ );
146
+ },
147
+ );
@@ -1,6 +1,6 @@
1
- @value (size22, size100) from '../../styles/variables/_size.css';
1
+ @value (size12, size22, size100) from '../../styles/variables/_size.css';
2
2
  @value (spaceXSmall, spaceNone) from '../../styles/variables/_space.css';
3
- @value (colorGrayLightest) from '../../styles/variables/_color.css';
3
+ @value (colorGrayLightest, colorTextInversePrimary, colorTextPrimary) from '../../styles/variables/_color.css';
4
4
 
5
5
  .badgeWrapper {
6
6
  --wrapperBgColor: colorGrayLightest;
@@ -13,6 +13,20 @@
13
13
  min-width: fit-content;
14
14
  width: fit-content;
15
15
  background-color: var(--wrapperBgColor);
16
+ color: colorTextInversePrimary;
17
+ }
18
+
19
+ .iconContainer {
20
+ height: initial;
21
+ padding: calc(size12 / 4);
22
+ }
23
+
24
+ .dark {
25
+ color: colorTextInversePrimary;
26
+ }
27
+
28
+ .light {
29
+ color: colorTextPrimary;
16
30
  }
17
31
 
18
32
  .fixedWidth {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ModalHeader = exports.ModalFooter = exports.ModalBody = exports.Modal = void 0;
6
+ exports.ModalHeader = exports.ModalFooter = exports.ModalBody = exports.Modal = exports.FullScreenModal = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _reactDom = require("react-dom");
9
9
  var _react2 = require("@floating-ui/react");
@@ -18,9 +18,7 @@ var _ModalModule = _interopRequireDefault(require("./Modal.module.css"));
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  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); }
20
20
  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; }
21
-
22
- // $FlowFixMe[untyped-import]
23
-
21
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
24
22
  const DEFAULT_MODAL_ANIMATION = {
25
23
  duration: {
26
24
  open: parseInt(_motion.motionDurationSlow),
@@ -228,4 +226,19 @@ const Modal = _ref4 => {
228
226
  }
229
227
  }, children))), portalRootRef.current);
230
228
  };
231
- exports.Modal = Modal;
229
+
230
+ // FullScreen modal that just calls the Modal component with a wrapper className set which sets the width and height to sizeFluid
231
+ exports.Modal = Modal;
232
+ const FullScreenModal = _ref5 => {
233
+ let {
234
+ classNames,
235
+ ...props
236
+ } = _ref5;
237
+ return /*#__PURE__*/React.createElement(Modal, _extends({
238
+ classNames: {
239
+ ...classNames,
240
+ content: (0, _classify.default)(_ModalModule.default.fullscreenModalContainer, classNames?.content)
241
+ }
242
+ }, props));
243
+ };
244
+ exports.FullScreenModal = FullScreenModal;
@@ -336,3 +336,17 @@ export const Modal = ({
336
336
  portalRootRef.current,
337
337
  );
338
338
  };
339
+
340
+ // FullScreen modal that just calls the Modal component with a wrapper className set which sets the width and height to sizeFluid
341
+ export const FullScreenModal = ({
342
+ classNames,
343
+ ...props
344
+ }: ModalProps): React.Node => (
345
+ <Modal
346
+ classNames={{
347
+ ...classNames,
348
+ content: classify(css.fullscreenModalContainer, classNames?.content),
349
+ }}
350
+ {...props}
351
+ />
352
+ );
@@ -39,6 +39,12 @@
39
39
  width: size640;
40
40
  }
41
41
 
42
+ .fullscreenModalContainer {
43
+ width: sizeFluid;
44
+ height: sizeFluid;
45
+ border-radius: initial;
46
+ }
47
+
42
48
  .modalContainer.open.in .modal {
43
49
  opacity: opacity100;
44
50
  transform: translate(spaceNegHalfFluid, spaceNegHalfFluid) scale(1);
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "FullScreenModal", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Modal.FullScreenModal;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "Modal", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -6,4 +6,10 @@ export type {
6
6
  ModalHeaderProps,
7
7
  ModalProps,
8
8
  } from './Modal';
9
- export {Modal, ModalBody, ModalFooter, ModalHeader} from './Modal';
9
+ export {
10
+ FullScreenModal,
11
+ Modal,
12
+ ModalBody,
13
+ ModalFooter,
14
+ ModalHeader,
15
+ } from './Modal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {