@spaced-out/ui-design-system 0.5.0 → 0.5.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 (72) hide show
  1. package/.cspell/custom-words.txt +9 -7
  2. package/.storybook/{SenseTheme.js → SenseTheme.ts} +4 -2
  3. package/.storybook/{main.js → main.ts} +24 -24
  4. package/.storybook/manager-head.html +4 -0
  5. package/.storybook/{manager.js → manager.ts} +0 -3
  6. package/.storybook/paths-macro.d.ts +6 -0
  7. package/.storybook/preview.ts +67 -0
  8. package/.storybook/tsconfig.json +14 -0
  9. package/CHANGELOG.md +21 -0
  10. package/lib/components/Charts/ChartTooltip/index.d.ts +2 -2
  11. package/lib/components/Charts/ChartTooltip/index.d.ts.map +1 -1
  12. package/lib/components/Charts/ColumnChart/ColumnChart.d.ts +2 -1
  13. package/lib/components/Charts/ColumnChart/ColumnChart.d.ts.map +1 -1
  14. package/lib/components/Charts/DonutChart/DonutChart.d.ts +3 -2
  15. package/lib/components/Charts/DonutChart/DonutChart.d.ts.map +1 -1
  16. package/lib/components/Charts/FunnelChart/FunnelChart.d.ts +2 -1
  17. package/lib/components/Charts/FunnelChart/FunnelChart.d.ts.map +1 -1
  18. package/lib/components/Charts/LineChart/LineChart.d.ts +2 -1
  19. package/lib/components/Charts/LineChart/LineChart.d.ts.map +1 -1
  20. package/lib/components/Charts/SpiderChart/SpiderChart.d.ts +2 -1
  21. package/lib/components/Charts/SpiderChart/SpiderChart.d.ts.map +1 -1
  22. package/lib/components/Charts/index.d.ts.map +1 -1
  23. package/lib/components/ChatBubble/ChatBubble.d.ts +2 -1
  24. package/lib/components/ChatBubble/ChatBubble.d.ts.map +1 -1
  25. package/lib/components/FileUpload/FileBlock/FileBlock.d.ts +1 -0
  26. package/lib/components/FileUpload/FileBlock/FileBlock.d.ts.map +1 -1
  27. package/lib/components/FileUpload/FileBlock/FileBlock.js +3 -2
  28. package/lib/components/FileUpload/FileBlock/FileBlock.stories.d.ts +14 -0
  29. package/lib/components/FileUpload/FileBlock/FileBlock.stories.d.ts.map +1 -1
  30. package/lib/components/OptionButton/SimpleOptionButton.d.ts +0 -1
  31. package/lib/components/OptionButton/SimpleOptionButton.d.ts.map +1 -1
  32. package/lib/components/ScoreBar/ScoreBar.d.ts +2 -1
  33. package/lib/components/ScoreBar/ScoreBar.d.ts.map +1 -1
  34. package/lib/components/Table/StaticTable.d.ts.map +1 -1
  35. package/lib/components/Table/Table.d.ts +2 -2
  36. package/lib/components/Table/Table.d.ts.map +1 -1
  37. package/lib/components/index.d.ts.map +1 -1
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/types/charts.d.ts +19 -10
  40. package/lib/types/charts.d.ts.map +1 -1
  41. package/lib/utils/charts/charts.d.ts.map +1 -1
  42. package/lib/utils/charts/charts.js +0 -4
  43. package/lib/utils/charts/columnChart.d.ts.map +1 -1
  44. package/lib/utils/charts/columnChart.js +0 -1
  45. package/lib/utils/charts/donutChart.d.ts.map +1 -1
  46. package/lib/utils/charts/donutChart.js +1 -7
  47. package/lib/utils/charts/funnelChart.d.ts.map +1 -1
  48. package/lib/utils/charts/funnelChart.js +0 -3
  49. package/lib/utils/charts/lineChart.d.ts.map +1 -1
  50. package/lib/utils/charts/lineChart.js +0 -1
  51. package/lib/utils/classify/index.d.ts.map +1 -1
  52. package/lib/utils/classify/index.js +4 -2
  53. package/lib/utils/click-away/click-away.d.ts +9 -13
  54. package/lib/utils/click-away/click-away.d.ts.map +1 -1
  55. package/lib/utils/click-away/click-away.js +6 -18
  56. package/lib/utils/date-range-picker/date-range-picker.d.ts +12 -11
  57. package/lib/utils/date-range-picker/date-range-picker.d.ts.map +1 -1
  58. package/lib/utils/date-range-picker/date-range-picker.js +12 -34
  59. package/lib/utils/date-range-picker/timezones.d.ts +1 -254
  60. package/lib/utils/date-range-picker/timezones.d.ts.map +1 -1
  61. package/lib/utils/dom/dom.d.ts +5 -13
  62. package/lib/utils/dom/dom.d.ts.map +1 -1
  63. package/lib/utils/dom/dom.js +21 -20
  64. package/lib/utils/makeClassNameComponent/makeClassNameComponent.d.ts +17 -5
  65. package/lib/utils/makeClassNameComponent/makeClassNameComponent.d.ts.map +1 -1
  66. package/lib/utils/makeClassNameComponent/makeClassNameComponent.js +28 -47
  67. package/lib/utils/merge-refs/merge-refs.d.ts +1 -1
  68. package/lib/utils/merge-refs/merge-refs.d.ts.map +1 -1
  69. package/lib/utils/merge-refs/merge-refs.js +0 -1
  70. package/package.json +32 -26
  71. package/tsconfig.json +3 -5
  72. package/.storybook/preview.js +0 -124
@@ -4,66 +4,47 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.makeClassNameComponent = makeClassNameComponent;
7
- exports.makeClassNameComponentCustom = makeClassNameComponentCustom;
8
7
  exports.nameHoc = nameHoc;
9
8
  var React = _interopRequireWildcard(require("react"));
10
9
  var _classify = _interopRequireDefault(require("../classify"));
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
12
+ /** Extract the actual ref instance type from a JSX element/component type */
13
+
14
+ /** Public props for generated components: original props (no ref) + optional className */
15
+
16
+ /** Utility: set displayName on a component */
17
+ function nameComponent(component, name) {
18
+ component.displayName = name;
19
+ return component;
20
+ }
21
+
22
+ /** HOC display name helper: sets Wrapper.displayName = `${hocName}(WrappedName)` */
14
23
  function nameHoc(WrapperComponent, WrappedComponent, hocName) {
15
24
  const wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
16
25
  WrapperComponent.displayName = `${hocName}(${wrappedComponentName})`;
17
26
  return WrapperComponent;
18
27
  }
19
- // @ts-ignore - TS2345 - Argument of type 'C' is not assignable to parameter of type 'C'.
20
28
 
21
- // @ts-ignore - TS2345 - Argument of type 'C' is not assignable to parameter of type 'C'.
22
- function makeClassNameComponent(baseClassName) {
23
- let ComponentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'div';
24
- let name
25
- //@ts-expect-error
26
- = arguments.length > 2 ? arguments[2] : undefined;
27
- return /*#__PURE__*/React.forwardRef(
28
- // @ts-ignore - TS7031 - Binding element 'className' implicitly has an 'any' type. | TS7006 - Parameter 'ref' implicitly has an 'any' type.
29
- nameComponent((_ref, ref) => {
29
+ /** Public alias for “className-merging” components */
30
+
31
+ /**
32
+ * Factory: builds a component for a given intrinsic tag or component type
33
+ * that merges `className` with a base class and forwards its ref.
34
+ */
35
+ function makeClassNameComponent(baseClassName, ComponentType, name) {
36
+ const Comp = /*#__PURE__*/React.forwardRef((_ref, ref) => {
30
37
  let {
31
38
  className,
32
39
  ...props
33
40
  } = _ref;
34
- return (
35
- /*#__PURE__*/
36
- // @ts-ignore - TS2604 - JSX element type 'ComponentType' does not have any construct or call signatures.
37
- React.createElement(ComponentType, _extends({}, props, {
38
- ref: ref,
39
- className: (0, _classify.default)(baseClassName, className)
40
- }))
41
- );
42
- }, `CNC(${name || ComponentType})`));
43
- }
44
- function makeClassNameComponentCustom(baseClassName, ComponentType) {
45
- return /*#__PURE__*/React.forwardRef(
46
- // @ts-ignore - TS2345 - Argument of type 'ComponentType<unknown>' is not assignable to parameter of type 'ForwardRefRenderFunction<B, unknown>'.
47
- nameHoc(
48
- // @ts-ignore - TS2345 - Argument of type '({ className, ...props }: { [x: string]: any; className: any; }, ref: any) => Element' is not assignable to parameter of type 'ComponentType<unknown>'. | TS7031 - Binding element 'className' implicitly has an 'any' type. | TS7006 - Parameter 'ref' implicitly has an 'any' type.
49
- (_ref2, ref) => {
50
- let {
51
- className,
52
- ...props
53
- } = _ref2;
54
- return (
55
- /*#__PURE__*/
56
- // @ts-ignore - TS2769 - No overload matches this call.
57
- React.createElement(ComponentType, _extends({}, props, {
58
- ref: ref,
59
- className: (0, _classify.default)(baseClassName, className)
60
- }))
61
- );
62
- }, ComponentType, 'CNC'));
63
- }
64
-
65
- // @ts-ignore - TS7006 - Parameter 'component' implicitly has an 'any' type.
66
- function nameComponent(component, name) {
67
- component.displayName = name;
68
- return component;
41
+ return /*#__PURE__*/React.createElement(ComponentType ?? 'div', {
42
+ ...props,
43
+ ref,
44
+ className: (0, _classify.default)(baseClassName, className)
45
+ });
46
+ });
47
+ nameComponent(Comp, `CNC(${name || ComponentType || 'div'})`);
48
+ // Bridge Flow.AbstractComponent signature
49
+ return Comp;
69
50
  }
@@ -1,4 +1,4 @@
1
1
  export declare function mergeRefs(refs: Array<{
2
2
  current: HTMLElement | null | undefined;
3
- }>): (value?: HTMLElement | null | undefined) => void;
3
+ } | ((value?: HTMLElement | null | undefined) => void)>): (value?: HTMLElement | null | undefined) => void;
4
4
  //# sourceMappingURL=merge-refs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-refs.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-refs/merge-refs.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACvB,IAAI,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC,CAAC,GACD,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAWlD"}
1
+ {"version":3,"file":"merge-refs.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-refs/merge-refs.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACvB,IAAI,EAAE,KAAK,CACP;IAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;CAAC,GACzC,CAAC,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC,CACrD,GACA,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAUlD"}
@@ -8,7 +8,6 @@ function mergeRefs(refs) {
8
8
  return value => {
9
9
  refs.forEach(ref => {
10
10
  if (typeof ref === 'function') {
11
- // @ts-ignore - TS2349 - This expression is not callable.
12
11
  ref(value);
13
12
  } else if (ref != null) {
14
13
  ref.current = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Sense UI components library",
5
5
  "author": {
6
6
  "name": "Spaced Out"
@@ -13,7 +13,7 @@
13
13
  "build:style-variables": "rimraf src/styles/variables && style-dictionary build --config ./config.js",
14
14
  "build:types": "tsc --project tsconfig.declaration.json && cp src/types/flow-to-typescript-codemod.d.ts lib/ ",
15
15
  "prebuild": "rimraf lib",
16
- "storybook": "yarn build:style-variables && storybook dev --host genesis.proxysense.co --port 6006",
16
+ "storybook": "yarn build:style-variables && rimraf node_modules/.cache/storybook && storybook dev --host genesis.proxysense.co --port 6006",
17
17
  "storybook:export": "yarn build:style-variables && rimraf storybook-static && storybook build",
18
18
  "build-storybook": "yarn build:style-variables && rimraf storybook-static && storybook build",
19
19
  "generate": "node ./scripts/create-component",
@@ -23,6 +23,7 @@
23
23
  "build:changelog": "standard-version",
24
24
  "build:no-bump-changelog": "standard-version --skip.bump --skip.commit --skip.tag",
25
25
  "flow": "tsc --noEmit",
26
+ "flow:storybook": "tsc --project .storybook/tsconfig.json --noEmit",
26
27
  "flow:all": "tsc --noEmit --listFiles",
27
28
  "flow:json": "tsc --noEmit --pretty",
28
29
  "flow:version": "tsc --version",
@@ -71,28 +72,46 @@
71
72
  "@babel/core": "^7.18.13",
72
73
  "@babel/eslint-parser": "^7.28.0",
73
74
  "@babel/eslint-plugin": "^7.25.9",
74
- "@babel/preset-env": "^7.18.10",
75
+ "@babel/preset-env": "^7.28.3",
76
+ "@babel/preset-react": "^7.27.1",
75
77
  "@babel/preset-typescript": "^7.27.1",
76
- "@babel/preset-react": "^7.18.6",
78
+ "@chromatic-com/storybook": "^4.1.0",
77
79
  "@commitlint/cli": "^17.1.2",
78
80
  "@commitlint/config-conventional": "^17.1.0",
79
- "@storybook/addon-a11y": "^9.0.10",
80
- "@storybook/addon-docs": "^9.0.10",
81
+ "@regrapes/babel-plugin-add-react-memo-displayname": "^1.0.0",
82
+ "@storybook/addon-a11y": "^9.1.2",
83
+ "@storybook/addon-docs": "^9.1.2",
81
84
  "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
82
- "@storybook/react-webpack5": "^9.0.10",
85
+ "@storybook/react-webpack5": "^9.1.2",
83
86
  "@storybook/test-runner": "^0.23.0",
84
87
  "@testing-library/react": "^11.2.7",
88
+ "@types/babel-plugin-macros": "~3.1.3",
89
+ "@types/babel__core": "~7.20.5",
90
+ "@types/babel__preset-env": "~7.10.0",
91
+ "@types/eslint": "~9.6.1",
92
+ "@types/gulp": "~4.0.17",
93
+ "@types/gulp-babel": "~6.1.33",
94
+ "@types/gulp-rename": "~2.0.6",
95
+ "@types/invariant": "~2.2.37",
96
+ "@types/lint-staged": "~13.3.0",
97
+ "@types/lodash": "^4.17.20",
98
+ "@types/moment": "^2.13.0",
99
+ "@types/moment-timezone": "^0.5.30",
100
+ "@types/react": "~19.1.9",
101
+ "@types/react-dom": "~19.1.7",
102
+ "@types/react-window": "^1.8.8",
103
+ "@types/standard-version": "~7.1.3",
85
104
  "all-contributors-cli": "^6.20.0",
86
105
  "babel-eslint": "^10.1.0",
87
106
  "babel-jest": "^28.1.3",
88
- "babel-loader": "^8.2.5",
107
+ "babel-loader": "^10.0.0",
89
108
  "babel-plugin-macros": "^3.1.0",
109
+ "babel-plugin-react-anonymous-display-name": "^0.1.0",
90
110
  "babel-preset-react-app": "^10.0.0",
91
111
  "chalk": "^5.0.1",
92
112
  "chromatic": "^6.11.4",
93
113
  "cspell": "^9.1.2",
94
114
  "eslint": "^9.9.0",
95
- "typescript-eslint": "^8.8.0",
96
115
  "eslint-plugin-ft-flow": "^3.0.11",
97
116
  "eslint-plugin-import": "^2.32.0",
98
117
  "eslint-plugin-jest": "^29.0.1",
@@ -118,25 +137,12 @@
118
137
  "rimraf": "^3.0.2",
119
138
  "simple-git": "^3.12.0",
120
139
  "standard-version": "^9.5.0",
121
- "storybook": "^9.0.10",
140
+ "storybook": "^9.1.2",
122
141
  "storybook-css-modules": "^1.0.8",
123
142
  "storybook-vscode-component": "^1.0.9",
124
143
  "style-dictionary": "^3.7.1",
125
- "@types/babel-plugin-macros": "~3.1.3",
126
- "@types/babel__core": "~7.20.5",
127
- "@types/babel__preset-env": "~7.10.0",
128
- "@types/eslint": "~9.6.1",
129
- "@types/gulp": "~4.0.17",
130
- "@types/gulp-babel": "~6.1.33",
131
- "@types/gulp-rename": "~2.0.6",
132
- "@types/invariant": "~2.2.37",
133
- "@types/lint-staged": "~13.3.0",
134
- "@types/lodash": "~4.17.20",
135
- "@types/react": "~19.1.9",
136
- "@types/react-dom": "~19.1.7",
137
- "@types/react-window": "~1.8.8",
138
- "@types/standard-version": "~7.1.3",
139
- "typescript": "^5.9.2"
144
+ "typescript": "^5.9.2",
145
+ "typescript-eslint": "^8.8.0"
140
146
  },
141
147
  "homepage": "https://spaced-out.github.io/ui-design-system",
142
148
  "repository": {
@@ -148,7 +154,7 @@
148
154
  },
149
155
  "husky": {
150
156
  "hooks": {
151
- "pre-commit": "lint-staged && yarn flow",
157
+ "pre-commit": "lint-staged && yarn flow && yarn flow:storybook",
152
158
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
153
159
  }
154
160
  },
package/tsconfig.json CHANGED
@@ -27,11 +27,9 @@
27
27
  "noUnusedLocals": true,
28
28
  "noUnusedParameters": true,
29
29
  "skipLibCheck": true,
30
- "allowImportingTsExtensions":true,
30
+ "allowImportingTsExtensions": true,
31
31
  "typeRoots": ["./src/types/**/*", "./node_modules/@types"]
32
32
  },
33
- "include": ["src/**/*.ts", "src/**/*.tsx","src/types/**/*"],
34
- "exclude": [
35
- "**/__tests__/**",
36
- ]
33
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/types/**/*"],
34
+ "exclude": ["**/__tests__/**"]
37
35
  }
@@ -1,124 +0,0 @@
1
- /**
2
- * Read https://storybook.js.org/docs/react/configure/overview#configure-story-rendering
3
- * for more information about the purpose of this file.
4
- *
5
- * Use preview.js for global code (such as CSS imports or JavaScript mocks)
6
- * that applies to all stories. For example, `import thirdPartyCss.css`.
7
- *
8
- * This file can have three exports:
9
- * - decorators - an array of global decorators
10
- * - parameters - an object of global parameters
11
- * - globalTypes - definition of globalTypes
12
- */
13
-
14
- /**
15
- * Decorators
16
- *
17
- * A decorator is a way to wrap a story in extra “rendering” functionality.
18
- *
19
- * Example:
20
- *
21
- * import React from 'react';
22
- * export const decorators = [(Story) => <div style={{ margin: '3em' }}><Story/></div>];
23
- *
24
- * Each story throughout the library will be wrapped in a div with a margin of 3
25
- */
26
-
27
- /**
28
- * Parameters
29
- *
30
- * Most Storybook addons are configured via a parameter-based API.
31
- * You can set global parameters in this file
32
- **/
33
-
34
- import {themes} from 'storybook/theming';
35
- import {wd} from 'paths.macro';
36
-
37
- export const parameters = {
38
- // Note(Nishant): This is a workaround to disable the a11y checks for the storybook.
39
- // This is because the storybook is not a web application and does not have a viewport.
40
- a11y: {
41
- config: {
42
- rules: [
43
- {
44
- id: 'landmark-one-main',
45
- enabled: false,
46
- },
47
- {
48
- id: 'meta-viewport',
49
- enabled: false,
50
- },
51
- {
52
- id: 'page-has-heading-one',
53
- enabled: false,
54
- },
55
- ],
56
- },
57
- },
58
- controls: {
59
- disableSaveFromUI: true,
60
- },
61
- backgrounds: {
62
- values: [
63
- {name: 'Dark', value: '#000'},
64
- {name: 'Light', value: '#fff'},
65
- ],
66
- },
67
- docs: {
68
- theme: themes.light,
69
- codePanel: true,
70
- },
71
- Canvas: {
72
- theme: themes.light,
73
- },
74
- storySource: {
75
- repository: 'https://github.com/Spaced-Out/ui-design-system',
76
- workingDir: wd,
77
- branch: 'master',
78
- },
79
- options: {
80
- storySort: {
81
- method: 'alphabetical',
82
- order: [
83
- 'Introduction',
84
- 'Changelog',
85
- 'Usage',
86
- 'Contribution',
87
- 'Design Tokens',
88
- 'Tokens',
89
- 'Components',
90
- 'Form Components',
91
- '*',
92
- ],
93
- locales: 'en-US',
94
- },
95
- },
96
- };
97
- /**
98
- * With backgrounds, you configure the list of backgrounds that every story can render in.
99
- */
100
-
101
- /**
102
- * Global Types
103
- *
104
- * Global Types allow you to add your own toolbars by creating
105
- * globalTypes with a toolbar annotation:
106
- *
107
- * For example:
108
- **/
109
- export const globalTypes = {
110
- theme: {
111
- name: 'Theme',
112
- description: 'Global theme for components',
113
- defaultValue: 'dark',
114
- toolbar: {
115
- icon: 'circlehollow',
116
- // array of plain string values or MenuItem shape
117
- items: ['light', 'dark'],
118
- },
119
- },
120
- };
121
- /**
122
- *
123
- * Will add a new dropdown in your toolbar with options light and dark.
124
- **/