@loadsmart/loadsmart-ui 5.16.0 → 5.17.0

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 (88) hide show
  1. package/dist/DragDropFile.context-0f0ede42.js +2 -0
  2. package/dist/DragDropFile.context-0f0ede42.js.map +1 -0
  3. package/dist/common/BackButton/BackButton.d.ts +0 -1
  4. package/dist/common/CloseButton/CloseButton.d.ts +0 -1
  5. package/dist/components/Accordion/Accordion.stories.d.ts +0 -1
  6. package/dist/components/Banner/Banner.stories.d.ts +0 -1
  7. package/dist/components/Button/Button.stories.d.ts +0 -1
  8. package/dist/components/Calendar/Calendar.d.ts +0 -1
  9. package/dist/components/Calendar/Calendar.stories.d.ts +0 -1
  10. package/dist/components/Calendar/DateFormat.helper.d.ts +4 -2
  11. package/dist/components/Calendar/PickerModeToggle.d.ts +0 -1
  12. package/dist/components/Calendar/Pickers/DayPicker.d.ts +0 -1
  13. package/dist/components/Calendar/Pickers/MonthPicker.d.ts +0 -1
  14. package/dist/components/Calendar/Pickers/YearPicker.d.ts +0 -1
  15. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -1
  16. package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -1
  17. package/dist/components/DatePicker/DateRangePicker.d.ts +0 -1
  18. package/dist/components/DatePicker/DateRangePicker.stories.d.ts +0 -1
  19. package/dist/components/DatePicker/useDatePicker.d.ts +0 -2
  20. package/dist/components/DatePicker/useDateRangePicker.d.ts +0 -3
  21. package/dist/components/Dialog/Dialog.stories.d.ts +0 -1
  22. package/dist/components/DragDropFile/DragDropFile.d.ts +0 -1
  23. package/dist/components/DragDropFile/DragDropFile.stories.d.ts +0 -1
  24. package/dist/components/DragDropFile/components/Wrapper.d.ts +0 -1
  25. package/dist/components/DragDropFile/styles.d.ts +0 -1
  26. package/dist/components/EmptyState/EmptyState.stories.d.ts +0 -1
  27. package/dist/components/ErrorMessage/ErrorMessage.d.ts +0 -1
  28. package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +0 -1
  29. package/dist/components/Icon/Icon.d.ts +0 -1
  30. package/dist/components/IconFactory/IconFactory.d.ts +0 -1
  31. package/dist/components/Label/Label.stories.d.ts +0 -1
  32. package/dist/components/Layout/Layout.stories.d.ts +0 -1
  33. package/dist/components/Link/Link.stories.d.ts +0 -1
  34. package/dist/components/Loaders/LoadingDots.d.ts +0 -1
  35. package/dist/components/Loaders/Spinner.d.ts +0 -1
  36. package/dist/components/Modal/Modal.stories.d.ts +0 -1
  37. package/dist/components/Pagination/Pagination.d.ts +0 -1
  38. package/dist/components/Pagination/PaginationItem.d.ts +0 -1
  39. package/dist/components/ProgressBar/ProgressBar.stories.d.ts +0 -1
  40. package/dist/components/Radio/Radio.stories.d.ts +0 -1
  41. package/dist/components/Section/Sections.stories.d.ts +0 -1
  42. package/dist/components/Select/SelectCreatableOption.d.ts +0 -1
  43. package/dist/components/Select/SelectEmpty.d.ts +0 -1
  44. package/dist/components/Select/SelectOption.d.ts +0 -1
  45. package/dist/components/SideNavigation/Separator/Separator.d.ts +0 -1
  46. package/dist/components/SideNavigation/SideNavigation.stories.d.ts +0 -1
  47. package/dist/components/Steps/ProgressSteps/ProgressSteps.d.ts +0 -1
  48. package/dist/components/Table/Table.d.ts +0 -1
  49. package/dist/components/Table/Table.stories.d.ts +0 -1
  50. package/dist/components/Table/TableSortHandle.d.ts +0 -1
  51. package/dist/components/TablePagination/RowsPerPage.d.ts +0 -1
  52. package/dist/components/TablePagination/TablePagination.d.ts +0 -1
  53. package/dist/components/TablePagination/TablePaginationActions.d.ts +0 -1
  54. package/dist/components/Tabs/Tabs.stories.d.ts +0 -1
  55. package/dist/components/Tag/Tag.stories.d.ts +0 -1
  56. package/dist/components/TextField/TextField.stories.d.ts +0 -1
  57. package/dist/components/Textarea/Textarea.stories.d.ts +0 -1
  58. package/dist/components/Toast/Toast.stories.d.ts +0 -1
  59. package/dist/components/ToggleGroup/Toggle.d.ts +0 -1
  60. package/dist/components/ToggleGroup/ToggleGroup.d.ts +0 -1
  61. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -1
  62. package/dist/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.d.ts +0 -1
  63. package/dist/components/TopNavigation/TopNavigation.stories.d.ts +0 -1
  64. package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +0 -2
  65. package/dist/index.js +448 -448
  66. package/dist/index.js.map +1 -1
  67. package/dist/miranda-compatibility.theme-4cecc6cf.js +1 -1
  68. package/dist/miranda-compatibility.theme-4cecc6cf.js.map +1 -1
  69. package/dist/prop-a330029f.js.map +1 -1
  70. package/dist/testing/index.js +1 -1
  71. package/dist/testing/index.js.map +1 -1
  72. package/dist/testing/renderWithDragDropFileProvider/renderWithDragDropFileProvider.d.ts +2 -1
  73. package/dist/theming/index.js.map +1 -1
  74. package/dist/toArray-b56541b4.js.map +1 -1
  75. package/dist/utils/toolset/getOrdinalSuffix.d.ts +1 -0
  76. package/dist/{addons/Theme/register.d.ts → utils/toolset/getOrdinalSuffix.test.d.ts} +0 -0
  77. package/dist/utils/toolset/highlightMatch.d.ts +0 -1
  78. package/package.json +218 -207
  79. package/src/components/Calendar/DateFormat.helper.test.ts +27 -0
  80. package/src/components/Calendar/DateFormat.helper.ts +41 -9
  81. package/src/components/Dropdown/Dropdown.test.tsx +4 -2
  82. package/src/components/Table/Table.test.tsx +2 -2
  83. package/src/components/TablePagination/TablePagination.test.tsx +2 -2
  84. package/src/testing/renderWithDragDropFileProvider/renderWithDragDropFileProvider.tsx +2 -1
  85. package/src/utils/toolset/getOrdinalSuffix.test.ts +27 -0
  86. package/src/utils/toolset/getOrdinalSuffix.ts +15 -0
  87. package/dist/DragDropFile.context-cf460901.js +0 -16
  88. package/dist/DragDropFile.context-cf460901.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import type { RenderResult } from '@testing-library/react';
2
3
  import type { DragDropFileContextValue } from '../../components/DragDropFile/types';
3
- declare const renderWithDragDropFileProvider: (ui: ReactNode, customContext?: Partial<DragDropFileContextValue> | undefined) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
4
+ declare const renderWithDragDropFileProvider: (ui: ReactNode, customContext?: Partial<DragDropFileContextValue> | undefined) => RenderResult;
4
5
  export default renderWithDragDropFileProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/theming/index.ts"],"sourcesContent":["import { isFunction } from '@loadsmart/utils-function'\n\nimport type { ThemeProps } from 'styled-components'\nimport type ThemeAlice from './themes/alice.theme'\n\nexport type ThemeToken = keyof typeof ThemeAlice\nexport type ThemeTokenValue = string | number\n\nexport type CustomTheme = Record<ThemeToken, ThemeTokenValue>\nexport type ThemedProps = ThemeProps<CustomTheme>\n\ntype TokenLike<P extends ThemedProps = ThemedProps> = ThemeToken | ((props: P) => ThemeToken)\n\nfunction getTokenFromTheme<P extends ThemedProps>(token: TokenLike<P>, props: P): ThemeTokenValue {\n const tokenName = isFunction(token) ? token(props) : token\n return props.theme[tokenName]\n}\n\n/**\n * Return a design token value for the current theme.\n * @param {string} token - Token whose value should be returned.\n * @param {[ThemedStyledProps]} props - Component props.\n * @returns {ThemeTokenValue} Token value or `undefined` if the token was not found for the current theme.\n */\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>\n): (props: TProps) => ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>,\n props: TProps\n): ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(token: any, props?: any): any {\n if (props === undefined) {\n return (props: TProps) => getTokenFromTheme(token, props)\n }\n\n return getTokenFromTheme(token, props)\n}\n\nexport * as Themes from './themes'\n"],"names":["getTokenFromTheme","token","props","tokenName","isFunction","theme","undefined"],"mappings":"8QAaA,SAASA,EAAyCC,EAAqBC,GACrE,MAAMC,EAAYC,aAAWH,GAASA,EAAMC,GAASD,EACrD,OAAOC,EAAMG,MAAMF,8CAkBgCF,EAAYC,GAC/D,YAAcI,IAAVJ,EACMA,GAAkBF,EAAkBC,EAAOC,GAG9CF,EAAkBC,EAAOC"}
1
+ {"version":3,"file":"index.js","sources":["../../src/theming/index.ts"],"sourcesContent":["import { isFunction } from '@loadsmart/utils-function'\n\nimport type { ThemeProps } from 'styled-components'\nimport type ThemeAlice from './themes/alice.theme'\n\nexport type ThemeToken = keyof typeof ThemeAlice\nexport type ThemeTokenValue = string | number\n\nexport type CustomTheme = Record<ThemeToken, ThemeTokenValue>\nexport type ThemedProps = ThemeProps<CustomTheme>\n\ntype TokenLike<P extends ThemedProps = ThemedProps> = ThemeToken | ((props: P) => ThemeToken)\n\nfunction getTokenFromTheme<P extends ThemedProps>(token: TokenLike<P>, props: P): ThemeTokenValue {\n const tokenName = isFunction(token) ? token(props) : token\n return props.theme[tokenName]\n}\n\n/**\n * Return a design token value for the current theme.\n * @param {string} token - Token whose value should be returned.\n * @param {[ThemedStyledProps]} props - Component props.\n * @returns {ThemeTokenValue} Token value or `undefined` if the token was not found for the current theme.\n */\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>\n): (props: TProps) => ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>,\n props: TProps\n): ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(token: any, props?: any): any {\n if (props === undefined) {\n return (props: TProps) => getTokenFromTheme(token, props)\n }\n\n return getTokenFromTheme(token, props)\n}\n\nexport * as Themes from './themes'\n"],"names":["getTokenFromTheme","token","props","tokenName","isFunction","theme","undefined"],"mappings":"8QAaA,SAASA,EAAyCC,EAAqBC,GACrE,MAAMC,EAAYC,EAAAA,WAAWH,GAASA,EAAMC,GAASD,EACrD,OAAOC,EAAMG,MAAMF,EACrB,mCAiBgB,SAAqCF,EAAYC,GAC/D,YAAcI,IAAVJ,EACMA,GAAkBF,EAAkBC,EAAOC,GAG9CF,EAAkBC,EAAOC,EAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toArray-b56541b4.js","sources":["../node_modules/@loadsmart/utils-object/lib/isNil.js","../node_modules/@loadsmart/utils-object/lib/isObject.js","../node_modules/@loadsmart/utils-object/lib/index.js","../src/utils/toolset/toArray.ts"],"sourcesContent":["'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nfunction isNil(value) {\n return value == null\n}\nexports.default = isNil\n//# sourceMappingURL=isNil.js.map\n","'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nvar isNil_1 = require('./isNil')\nfunction isObject(value) {\n var type = typeof value\n return !isNil_1.default(value) && ['object', 'function'].includes(type)\n}\nexports.default = isObject\n//# sourceMappingURL=isObject.js.map\n","'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nexports.isObject = exports.isNil = void 0\nvar isNil_1 = require('./isNil')\nexports.isNil = isNil_1.default\nvar isObject_1 = require('./isObject')\nexports.isObject = isObject_1.default\n//# sourceMappingURL=index.js.map\n","import { isNil } from '@loadsmart/utils-object'\n\n// TODO: add this helper to @loadsmart/utils\nfunction toArray<T>(value: T | T[]): T[] {\n if (isNil(value)) {\n return []\n }\n\n if (Array.isArray(value)) {\n return value\n }\n\n return [value]\n}\n\nexport default toArray\n"],"names":["Object","defineProperty","isNil_1","value","isObject_1","require$$0","type","default","includes","lib","isNil","require$$1","isObject","Array","isArray"],"mappings":"2BACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,cACtD,SAAeA,GACb,OAAgB,MAATA,YCFTH,OAAOC,eAAeG,EAAS,aAAc,CAAED,OAAO,IACtD,IAAID,EAAUG,YACd,SAAkBF,GAChB,IAAIG,SAAcH,EAClB,OAAQD,EAAQK,QAAQJ,IAAU,CAAC,SAAU,YAAYK,SAASF,ICJpEN,OAAOC,eAAeQ,EAAS,aAAc,CAAEN,OAAO,gCACnCO,2BAAgB,EACnC,IAAIR,EAAUG,wBACEH,EAAQK,QACxB,IAAIH,EAAaO,EACjBC,4BAAmBR,EAAWG,wBCH9B,SAAoBJ,GAClB,OAAIO,cAAMP,GACD,GAGLU,MAAMC,QAAQX,GACTA,EAGF,CAACA"}
1
+ {"version":3,"file":"toArray-b56541b4.js","sources":["../node_modules/@loadsmart/utils-object/lib/isNil.js","../node_modules/@loadsmart/utils-object/lib/isObject.js","../node_modules/@loadsmart/utils-object/lib/index.js","../src/utils/toolset/toArray.ts"],"sourcesContent":["'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nfunction isNil(value) {\n return value == null\n}\nexports.default = isNil\n//# sourceMappingURL=isNil.js.map\n","'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nvar isNil_1 = require('./isNil')\nfunction isObject(value) {\n var type = typeof value\n return !isNil_1.default(value) && ['object', 'function'].includes(type)\n}\nexports.default = isObject\n//# sourceMappingURL=isObject.js.map\n","'use strict'\nObject.defineProperty(exports, '__esModule', { value: true })\nexports.isObject = exports.isNil = void 0\nvar isNil_1 = require('./isNil')\nexports.isNil = isNil_1.default\nvar isObject_1 = require('./isObject')\nexports.isObject = isObject_1.default\n//# sourceMappingURL=index.js.map\n","import { isNil } from '@loadsmart/utils-object'\n\n// TODO: add this helper to @loadsmart/utils\nfunction toArray<T>(value: T | T[]): T[] {\n if (isNil(value)) {\n return []\n }\n\n if (Array.isArray(value)) {\n return value\n }\n\n return [value]\n}\n\nexport default toArray\n"],"names":["Object","defineProperty","isNil_1","value","default","isObject_1","require$$0","type","includes","lib","isObject","isNil","require$$1","Array","isArray"],"mappings":"2BACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IAItDD,EAAAE,QAHA,SAAeD,GACb,OAAgB,MAATA,CACT,WCHAH,OAAOC,eAAeI,EAAS,aAAc,CAAEF,OAAO,IACtD,IAAID,EAAUI,EAKdD,EAAAD,QAJA,SAAkBD,GAChB,IAAII,SAAcJ,EAClB,OAAQD,EAAQE,QAAQD,IAAU,CAAC,SAAU,YAAYK,SAASD,EACpE,ECLAP,OAAOC,eAAeQ,EAAS,aAAc,CAAEN,OAAO,IACtDO,QAAAA,SAAAD,EAAAC,SAAmBC,QAAAA,MAAAF,EAAAE,WAAgB,EACnC,IAAIT,EAAUI,EACDK,QAAAA,MAAAF,EAAAE,MAAGT,EAAQE,QACxB,IAAIC,EAAaO,EACjBF,QAAAA,SAAgBD,EAAAC,SAAGL,EAAWD,wBCH9B,SAAoBD,GAClB,OAAIQ,QAAAA,MAAMR,GACD,GAGLU,MAAMC,QAAQX,GACTA,EAGF,CAACA,EACV"}
@@ -0,0 +1 @@
1
+ export declare const getOrdinalSuffix: (number: number) => 'st' | 'nd' | 'rd' | 'th';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * A function that wraps a match into `mark` element to be highlighted.
4
3
  * @example
package/package.json CHANGED
@@ -1,209 +1,220 @@
1
1
  {
2
- "name": "@loadsmart/loadsmart-ui",
3
- "version": "5.16.0",
4
- "description": "Miranda UI, a React UI library",
5
- "main": "dist",
6
- "files": [
7
- "src",
8
- "dist",
9
- "README.md"
10
- ],
11
- "types": "dist/index.d.ts",
12
- "scripts": {
13
- "start": "yarn dev",
14
- "dev": "npm-run-all --parallel watch-tailwind storybook",
15
- "lint": "eslint --ext .js,.ts,.tsx src/",
16
- "test": "TZ=UTC jest --clearMocks",
17
- "test-watch": "yarn test --watch",
18
- "storybook": "start-storybook -p 6006 -s ./public --no-dll",
19
- "build": "rollup -c --environment BUILD:prod",
20
- "watch-tailwind": "postcss ./tailwind.css -o ./.storybook/globals.css --watch",
21
- "build-storybook": "rm -rf docs && build-storybook -s ./public -o ./docs --no-dll",
22
- "deploy-storybook": "yarn build-storybook && storybook-to-ghpages --existing-output-dir=docs",
23
- "release": "semantic-release",
24
- "prepare": "husky install"
25
- },
26
- "storybook-deployer": {
27
- "commitMessage": "chore(docs): deploy storybook to GitHub pages [skip ci]"
28
- },
29
- "jest": {
30
- "globals": {
31
- "window": true
32
- },
33
- "verbose": true,
34
- "coverageDirectory": "./coverage/",
35
- "collectCoverage": false,
36
- "setupFiles": [
37
- "./tests/jestsetup.tsx"
38
- ],
39
- "collectCoverageFrom": [
40
- "src/components/**/*.{js,tsx}",
41
- "!src/**/**/*.test.{js,tsx}"
42
- ],
43
- "coverageReporters": [
44
- "text",
45
- "lcov"
46
- ],
47
- "moduleDirectories": [
48
- "node_modules",
49
- "src"
50
- ],
51
- "moduleFileExtensions": [
52
- "ts",
53
- "tsx",
54
- "js",
55
- "json"
56
- ],
57
- "testMatch": [
58
- "**/__tests__/**/*.[jt]s?(x)",
59
- "**/?(*.)+(jest|test).[jt]s?(x)"
60
- ]
61
- },
62
- "lint-staged": {
63
- "src/**/*.{js,ts,jsx,tsx,json}": [
64
- "eslint --fix",
65
- "prettier --write"
66
- ],
67
- "src/{common,components,styles}/**/*.{js,ts,jsx,tsx}": [
68
- "eslint --fix",
69
- "prettier --write",
70
- "stylelint --fix"
71
- ]
72
- },
73
- "devDependencies": {
74
- "@babel/cli": "7.13.16",
75
- "@babel/core": "7.14.0",
76
- "@babel/preset-env": "7.14.1",
77
- "@babel/preset-react": "7.13.13",
78
- "@babel/preset-typescript": "7.13.0",
79
- "@commitlint/cli": "16.0.2",
80
- "@commitlint/config-conventional": "16.0.0",
81
- "@loadsmart/miranda-tokens": "1.3.0",
82
- "@loadsmart/stylelint-config": "0.0.3",
83
- "@rollup/plugin-babel": "5.3.0",
84
- "@rollup/plugin-commonjs": "19.0.0",
85
- "@rollup/plugin-json": "4.1.0",
86
- "@rollup/plugin-node-resolve": "13.0.0",
87
- "@semantic-release/git": "9.0.0",
88
- "@storybook/addon-a11y": "6.4.22",
89
- "@storybook/addon-actions": "6.4.22",
90
- "@storybook/addon-essentials": "6.4.22",
91
- "@storybook/addon-links": "6.4.22",
92
- "@storybook/cli": "6.4.22",
93
- "@storybook/react": "6.4.22",
94
- "@storybook/storybook-deployer": "2.8.11",
95
- "@storybook/testing-react": "1.2.4",
96
- "@storybook/theming": "6.4.22",
97
- "@svgr/rollup": "5.5.0",
98
- "@svgr/webpack": "5.5.0",
99
- "@tailwindcss/postcss7-compat": "2.1.2",
100
- "@testing-library/jest-dom": "5.16.5",
101
- "@testing-library/react": "^11.2.7",
102
- "@testing-library/react-hooks": "^5.1.3",
103
- "@testing-library/user-event": "^13.5.0",
104
- "@types/chance": "1.1.1",
105
- "@types/jest": "26.0.23",
106
- "@types/lodash.debounce": "4.0.6",
107
- "@types/lodash.flatten": "4.4.6",
108
- "@types/lodash.get": "4.4.6",
109
- "@types/lodash.isempty": "4.4.6",
110
- "@types/lodash.omit": "4.5.6",
111
- "@types/lodash.range": "3.2.6",
112
- "@types/mdx": "^2.0.2",
113
- "@types/react": "17.0.5",
114
- "@types/react-dom": "17.0.3",
115
- "@types/react-test-renderer": "17.0.1",
116
- "@types/styled-components": "5.1.9",
117
- "@typescript-eslint/eslint-plugin": "4.22.1",
118
- "@typescript-eslint/parser": "4.22.1",
119
- "@zerollup/ts-transform-paths": "1.7.18",
120
- "autoprefixer": "9",
121
- "babel-jest": "26.6.3",
122
- "babel-loader": "8.2.2",
123
- "babel-plugin-react-remove-properties": "0.3.0",
124
- "babel-plugin-styled-components": "1.12.0",
125
- "babel-plugin-transform-inline-environment-variables": "0.4.3",
126
- "babel-preset-react-app": "10.0.0",
127
- "chance": "1.1.8",
128
- "commitizen": "4.2.4",
129
- "cross-env": "7.0.3",
130
- "cz-conventional-changelog": "3.3.0",
131
- "eslint": "7.26.0",
132
- "eslint-config-prettier": "8.3.0",
133
- "eslint-plugin-jest-dom": "3.8.1",
134
- "eslint-plugin-jsx-a11y": "6.4.1",
135
- "eslint-plugin-prettier": "3.4.0",
136
- "eslint-plugin-react": "7.23.2",
137
- "eslint-plugin-react-hooks": "4.2.0",
138
- "eslint-plugin-storybook": "^0.5.11",
139
- "eslint-plugin-testing-library": "^5.9.1",
140
- "fork-ts-checker-webpack-plugin": "6.2.6",
141
- "husky": "7.0.4",
142
- "identity-obj-proxy": "3.0.0",
143
- "jest": "26.6.3",
144
- "jest-svg-transformer": "1.0.0",
145
- "lint-staged": "11.0.0",
146
- "npm-run-all": "4.1.5",
147
- "postcss": "7",
148
- "postcss-cli": "7",
149
- "prettier": "2.2.1",
150
- "prop-types": "15.7.2",
151
- "react": "17.0.2",
152
- "react-dom": "17.0.2",
153
- "react-is": "17.0.2",
154
- "rollup": "2.47.0",
155
- "rollup-plugin-delete": "2.0.0",
156
- "rollup-plugin-peer-deps-external": "^2.2.4",
157
- "rollup-plugin-terser": "^7.0.2",
158
- "rollup-plugin-typescript2": "0.30.0",
159
- "rollup-plugin-visualizer": "^5.5.2",
160
- "semantic-release": "17.4.2",
161
- "styled-components": "5.3.0",
162
- "stylelint": "13.13.1",
163
- "stylelint-config-prettier": "8.0.2",
164
- "stylelint-config-rational-order": "0.1.2",
165
- "stylelint-config-recommended": "5.0.0",
166
- "stylelint-no-unsupported-browser-features": "5.0.1",
167
- "stylelint-order": "4.1.0",
168
- "tailwindcss": "npm:@tailwindcss/postcss7-compat",
169
- "ts-jest": "26.5.6",
170
- "ts-toolbelt": "^9.6.0",
171
- "ttypescript": "^1.5.13",
172
- "typescript": "4.2.4",
173
- "typescript-plugin-styled-components": "1.5.0"
174
- },
175
- "peerDependencies": {
176
- "@loadsmart/miranda-tokens": "1.3.0",
177
- "@testing-library/dom": ">=5.12.0",
178
- "@testing-library/react": ">=11.2.6",
179
- "prop-types": ">=15.7.2",
180
- "react-dom": ">=16.8.0",
181
- "react": ">=16.8.0",
182
- "styled-components": ">=5.3.0"
183
- },
184
- "dependencies": {
185
- "@loadsmart/utils-function": "0.3.1",
186
- "@loadsmart/utils-object": "0.3.1",
187
- "@loadsmart/utils-string": "0.3.1",
188
- "clsx": "1.1.1",
189
- "lodash.debounce": "4.0.8",
190
- "lodash.flatten": "4.4.0",
191
- "lodash.get": "4.4.2",
192
- "lodash.isempty": "4.4.0",
193
- "lodash.omit": "4.5.0",
194
- "lodash.range": "3.2.0"
195
- },
196
- "repository": {
197
- "type": "git",
198
- "url": "https://github.com/loadsmart/miranda.git"
199
- },
200
- "license": "MIT",
201
- "publishConfig": {
202
- "access": "public"
203
- },
204
- "config": {
205
- "commitizen": {
206
- "path": "./node_modules/cz-conventional-changelog"
207
- }
208
- }
2
+ "name": "@loadsmart/loadsmart-ui",
3
+ "version": "5.17.0",
4
+ "description": "Miranda UI, a React UI library",
5
+ "main": "dist",
6
+ "files": [
7
+ "src",
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "types": "dist/index.d.ts",
12
+ "scripts": {
13
+ "start": "yarn dev",
14
+ "dev": "npm-run-all --parallel watch-tailwind storybook",
15
+ "lint": "eslint --ext .js,.ts,.tsx src/",
16
+ "test": "TZ=UTC jest --clearMocks",
17
+ "test-watch": "yarn test --watch",
18
+ "storybook": "start-storybook -p 6006 --no-dll",
19
+ "build": "rollup -c --environment BUILD:prod",
20
+ "watch-tailwind": "postcss ./tailwind.css -o ./.storybook/globals.css --watch",
21
+ "build-storybook": "rm -rf docs && build-storybook -o ./docs --no-dll",
22
+ "deploy-storybook": "yarn build-storybook && storybook-to-ghpages --existing-output-dir=docs",
23
+ "release": "semantic-release",
24
+ "prepare": "husky install"
25
+ },
26
+ "storybook-deployer": {
27
+ "commitMessage": "chore(docs): deploy storybook to GitHub pages [skip ci]"
28
+ },
29
+ "jest": {
30
+ "globals": {
31
+ "window": true
32
+ },
33
+ "verbose": true,
34
+ "coverageDirectory": "./coverage/",
35
+ "collectCoverage": false,
36
+ "setupFiles": [
37
+ "./tests/jestsetup.tsx"
38
+ ],
39
+ "collectCoverageFrom": [
40
+ "src/components/**/*.{js,tsx}",
41
+ "!src/**/**/*.test.{js,tsx}"
42
+ ],
43
+ "coverageReporters": [
44
+ "text",
45
+ "lcov"
46
+ ],
47
+ "moduleDirectories": [
48
+ "node_modules",
49
+ "src"
50
+ ],
51
+ "moduleFileExtensions": [
52
+ "ts",
53
+ "tsx",
54
+ "js",
55
+ "json"
56
+ ],
57
+ "testMatch": [
58
+ "**/__tests__/**/*.[jt]s?(x)",
59
+ "**/?(*.)+(jest|test).[jt]s?(x)"
60
+ ]
61
+ },
62
+ "lint-staged": {
63
+ "src/**/*.{js,ts,jsx,tsx,json}": [
64
+ "eslint --fix",
65
+ "prettier --write"
66
+ ],
67
+ "src/{common,components,styles}/**/*.{js,ts,jsx,tsx}": [
68
+ "eslint --fix",
69
+ "prettier --write",
70
+ "stylelint --fix"
71
+ ]
72
+ },
73
+ "devDependencies": {
74
+ "@babel/cli": "7.13.16",
75
+ "@babel/core": "7.14.0",
76
+ "@babel/preset-env": "7.14.1",
77
+ "@babel/preset-react": "7.13.13",
78
+ "@babel/preset-typescript": "7.13.0",
79
+ "@commitlint/cli": "16.0.2",
80
+ "@commitlint/config-conventional": "16.0.0",
81
+ "@loadsmart/miranda-tokens": "1.3.0",
82
+ "@loadsmart/stylelint-config": "0.0.3",
83
+ "@rollup/plugin-babel": "5.3.0",
84
+ "@rollup/plugin-commonjs": "19.0.0",
85
+ "@rollup/plugin-json": "4.1.0",
86
+ "@rollup/plugin-node-resolve": "13.0.0",
87
+ "@semantic-release/git": "9.0.0",
88
+ "@storybook/addon-a11y": "^6.5.15",
89
+ "@storybook/addon-actions": "^6.5.15",
90
+ "@storybook/addon-essentials": "^6.5.15",
91
+ "@storybook/addon-links": "^6.5.15",
92
+ "@storybook/addon-postcss": "^2.0.0",
93
+ "@storybook/addons": "^6.5.15",
94
+ "@storybook/builder-webpack5": "^6.5.15",
95
+ "@storybook/cli": "^6.5.15",
96
+ "@storybook/client-api": "^6.5.15",
97
+ "@storybook/manager-webpack5": "^6.5.15",
98
+ "@storybook/preview-web": "^6.5.15",
99
+ "@storybook/react": "^6.5.15",
100
+ "@storybook/storybook-deployer": "^2.8.16",
101
+ "@storybook/testing-react": "^1.3.0",
102
+ "@storybook/theming": "^6.5.15",
103
+ "@svgr/rollup": "^6.5.1",
104
+ "@svgr/webpack": "^6.5.1",
105
+ "@tailwindcss/postcss7-compat": "2.1.2",
106
+ "@testing-library/dom": "^8.20.0",
107
+ "@testing-library/jest-dom": "5.16.5",
108
+ "@testing-library/react": "^11.2.7",
109
+ "@testing-library/react-hooks": "^5.1.3",
110
+ "@testing-library/user-event": "^13.5.0",
111
+ "@types/chance": "1.1.1",
112
+ "@types/jest": "26.0.23",
113
+ "@types/lodash.debounce": "4.0.6",
114
+ "@types/lodash.flatten": "4.4.6",
115
+ "@types/lodash.get": "4.4.6",
116
+ "@types/lodash.isempty": "4.4.6",
117
+ "@types/lodash.omit": "4.5.6",
118
+ "@types/lodash.range": "3.2.6",
119
+ "@types/mdx": "^2.0.2",
120
+ "@types/node": "^18.11.18",
121
+ "@types/react": "17.0.5",
122
+ "@types/react-dom": "17.0.3",
123
+ "@types/react-test-renderer": "17.0.1",
124
+ "@types/styled-components": "5.1.9",
125
+ "@typescript-eslint/eslint-plugin": "4.22.1",
126
+ "@typescript-eslint/parser": "4.22.1",
127
+ "@zerollup/ts-transform-paths": "1.7.18",
128
+ "autoprefixer": "9",
129
+ "babel-jest": "26.6.3",
130
+ "babel-loader": "8.2.2",
131
+ "babel-plugin-react-remove-properties": "0.3.0",
132
+ "babel-plugin-styled-components": "1.12.0",
133
+ "babel-plugin-transform-inline-environment-variables": "0.4.3",
134
+ "babel-preset-react-app": "10.0.0",
135
+ "chance": "1.1.8",
136
+ "commitizen": "4.2.4",
137
+ "cross-env": "7.0.3",
138
+ "cz-conventional-changelog": "3.3.0",
139
+ "eslint": "7.26.0",
140
+ "eslint-config-prettier": "8.3.0",
141
+ "eslint-plugin-jest-dom": "3.8.1",
142
+ "eslint-plugin-jsx-a11y": "6.4.1",
143
+ "eslint-plugin-prettier": "3.4.0",
144
+ "eslint-plugin-react": "7.23.2",
145
+ "eslint-plugin-react-hooks": "4.2.0",
146
+ "eslint-plugin-storybook": "^0.6.10",
147
+ "eslint-plugin-testing-library": "^5.9.1",
148
+ "husky": "7.0.4",
149
+ "identity-obj-proxy": "3.0.0",
150
+ "jest": "26.6.3",
151
+ "jest-svg-transformer": "1.0.0",
152
+ "lint-staged": "11.0.0",
153
+ "npm-run-all": "4.1.5",
154
+ "postcss": "^7.0.39",
155
+ "postcss-cli": "^7.1.2",
156
+ "prettier": "2.2.1",
157
+ "prop-types": "15.7.2",
158
+ "react": "17.0.2",
159
+ "react-dom": "17.0.2",
160
+ "react-is": "17.0.2",
161
+ "react-syntax-highlighter": "^15.5.0",
162
+ "require-from-string": "^2.0.2",
163
+ "rollup": "^2.79.1",
164
+ "rollup-plugin-delete": "2.0.0",
165
+ "rollup-plugin-peer-deps-external": "^2.2.4",
166
+ "rollup-plugin-terser": "^7.0.2",
167
+ "rollup-plugin-typescript2": "^0.34.1",
168
+ "rollup-plugin-visualizer": "^5.5.2",
169
+ "semantic-release": "17.4.2",
170
+ "styled-components": "5.3.0",
171
+ "stylelint": "13.13.1",
172
+ "stylelint-config-prettier": "8.0.2",
173
+ "stylelint-config-rational-order": "0.1.2",
174
+ "stylelint-config-recommended": "5.0.0",
175
+ "stylelint-no-unsupported-browser-features": "5.0.1",
176
+ "stylelint-order": "4.1.0",
177
+ "tailwindcss": "npm:@tailwindcss/postcss7-compat",
178
+ "ts-jest": "26.5.6",
179
+ "ts-node": "^10.9.1",
180
+ "ts-toolbelt": "^9.6.0",
181
+ "ttypescript": "^1.5.13",
182
+ "typescript": "4.4.4",
183
+ "typescript-plugin-styled-components": "1.5.0",
184
+ "webpack": "^5.75.0"
185
+ },
186
+ "peerDependencies": {
187
+ "@loadsmart/miranda-tokens": "1.3.0",
188
+ "@testing-library/dom": ">=5.12.0",
189
+ "@testing-library/react": ">=11.2.6",
190
+ "prop-types": ">=15.7.2",
191
+ "react": ">=16.8.0",
192
+ "react-dom": ">=16.8.0",
193
+ "styled-components": ">=5.3.0"
194
+ },
195
+ "dependencies": {
196
+ "@loadsmart/utils-function": "0.3.1",
197
+ "@loadsmart/utils-object": "0.3.1",
198
+ "@loadsmart/utils-string": "0.3.1",
199
+ "clsx": "1.1.1",
200
+ "lodash.debounce": "4.0.8",
201
+ "lodash.flatten": "4.4.0",
202
+ "lodash.get": "4.4.2",
203
+ "lodash.isempty": "4.4.0",
204
+ "lodash.omit": "4.5.0",
205
+ "lodash.range": "3.2.0"
206
+ },
207
+ "repository": {
208
+ "type": "git",
209
+ "url": "https://github.com/loadsmart/miranda.git"
210
+ },
211
+ "license": "MIT",
212
+ "publishConfig": {
213
+ "access": "public"
214
+ },
215
+ "config": {
216
+ "commitizen": {
217
+ "path": "./node_modules/cz-conventional-changelog"
218
+ }
219
+ }
209
220
  }
@@ -134,5 +134,32 @@ describe('DateFormatHelper', () => {
134
134
  )
135
135
  ).toBe('02/01/2022 11:22:33')
136
136
  })
137
+
138
+ it('formats compound tokens', () => {
139
+ expect(
140
+ DateFormatHelper('ddd, Do, MMM').format(
141
+ DateHelper('2021-05-04T04:00:00Z', {
142
+ normalize: false,
143
+ })
144
+ )
145
+ ).toBe('Tue, 4th, May')
146
+ expect(
147
+ DateFormatHelper('ddd, DDo, MMM').format(
148
+ DateHelper('2021-05-05T04:00:00Z', {
149
+ normalize: false,
150
+ })
151
+ )
152
+ ).toBe('Wed, 05th, May')
153
+ })
154
+
155
+ it('does not formats a compound token when the previous token is invalid', () => {
156
+ expect(
157
+ DateFormatHelper('ddd, YYYYo, MMM').format(
158
+ DateHelper('2021-05-10T04:00:00Z', {
159
+ normalize: false,
160
+ })
161
+ )
162
+ ).toBe('Mon, 2021o, May')
163
+ })
137
164
  })
138
165
  })