grommet 2.35.0 → 2.36.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.
- package/components/Anchor/Anchor.js +1 -4
- package/components/Anchor/StyledAnchor.js +1 -1
- package/components/Box/Box.js +2 -2
- package/components/Box/StyledBox.js +18 -1
- package/components/Box/index.d.ts +1 -1
- package/components/Box/propTypes.js +4 -1
- package/components/Cards/stories/Simple.js +1 -4
- package/components/Data/stories/Cards.js +9 -19
- package/components/Data/stories/Complex.js +1 -4
- package/components/Data/stories/ComposedToolbar.js +74 -0
- package/components/Data/stories/Infinite.js +29 -64
- package/components/Data/stories/Inline.js +1 -9
- package/components/Data/stories/List.js +3 -9
- package/components/Data/stories/Properties.js +17 -22
- package/components/Data/stories/Simple.js +4 -10
- package/components/Data/stories/SpaceX.js +8 -7
- package/components/Data/stories/StarWars.js +6 -12
- package/components/Data/stories/Views.js +4 -11
- package/components/DataFilter/DataFilter.js +1 -0
- package/components/DataFilter/stories/Simple.js +2 -6
- package/components/DataFilters/stories/Drop.js +2 -6
- package/components/DataFilters/stories/Layer.js +2 -6
- package/components/DataFilters/stories/Simple.js +2 -6
- package/components/DataSearch/stories/Drop.js +6 -11
- package/components/DataSearch/stories/Responsive.js +6 -12
- package/components/DataSearch/stories/Simple.js +5 -10
- package/components/DataSearch/stories/UpdateOnSubmit.js +5 -7
- package/components/DataSort/stories/Drop.js +2 -6
- package/components/DataSort/stories/Simple.js +2 -6
- package/components/DataSummary/stories/Simple.js +2 -6
- package/components/DataTableColumns/stories/Simple.js +2 -6
- package/components/DataTableGroupBy/stories/Simple.js +5 -7
- package/components/DataView/stories/Simple.js +4 -6
- package/components/DateInput/DateInput.js +61 -17
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/DateInput/stories/ReadOnly.js +36 -0
- package/components/DateInput/utils.js +2 -2
- package/components/Form/Form.js +34 -1
- package/components/FormField/FormField.js +20 -1
- package/components/FormField/README.md +1 -644
- package/components/FormField/index.d.ts +5 -1
- package/components/FormField/propTypes.js +4 -1
- package/components/FormField/stories/ThresholdValidation.js +51 -0
- package/components/Grommet/Grommet.js +1 -1
- package/components/Grommet/index.d.ts +12 -0
- package/components/Grommet/propTypes.js +12 -0
- package/components/Layer/LayerContainer.js +1 -1
- package/components/List/List.js +33 -30
- package/components/Pagination/Pagination.js +52 -9
- package/components/Pagination/PaginationStep.js +41 -0
- package/components/Pagination/PaginationSummary.js +33 -0
- package/components/Pagination/index.d.ts +2 -0
- package/components/Pagination/propTypes.js +3 -1
- package/components/Pagination/stories/Steps.js +40 -0
- package/components/RangeInput/RangeInput.js +19 -12
- package/components/TextInput/CopyButton.js +53 -0
- package/components/TextInput/StyledTextInput.js +13 -2
- package/components/TextInput/TextInput.js +46 -12
- package/components/TextInput/index.d.ts +1 -0
- package/components/TextInput/propTypes.js +1 -0
- package/components/TextInput/stories/ReadOnly.js +43 -0
- package/components/Toolbar/stories/Simple.js +1 -4
- package/es6/components/Anchor/Anchor.js +1 -4
- package/es6/components/Anchor/StyledAnchor.js +1 -1
- package/es6/components/Box/Box.js +2 -2
- package/es6/components/Box/StyledBox.js +18 -1
- package/es6/components/Box/index.d.ts +1 -1
- package/es6/components/Box/propTypes.js +4 -1
- package/es6/components/Cards/stories/Simple.js +2 -5
- package/es6/components/Data/stories/Cards.js +10 -20
- package/es6/components/Data/stories/Complex.js +2 -5
- package/es6/components/Data/stories/ComposedToolbar.js +69 -0
- package/es6/components/Data/stories/Infinite.js +32 -66
- package/es6/components/Data/stories/Inline.js +2 -10
- package/es6/components/Data/stories/List.js +4 -10
- package/es6/components/Data/stories/Properties.js +18 -23
- package/es6/components/Data/stories/Simple.js +5 -11
- package/es6/components/Data/stories/SpaceX.js +9 -8
- package/es6/components/Data/stories/StarWars.js +7 -13
- package/es6/components/Data/stories/Views.js +5 -12
- package/es6/components/DataFilter/DataFilter.js +1 -0
- package/es6/components/DataFilter/stories/Simple.js +2 -6
- package/es6/components/DataFilters/stories/Drop.js +2 -6
- package/es6/components/DataFilters/stories/Layer.js +2 -6
- package/es6/components/DataFilters/stories/Simple.js +2 -6
- package/es6/components/DataSearch/stories/Drop.js +7 -12
- package/es6/components/DataSearch/stories/Responsive.js +7 -13
- package/es6/components/DataSearch/stories/Simple.js +6 -11
- package/es6/components/DataSearch/stories/UpdateOnSubmit.js +6 -8
- package/es6/components/DataSort/stories/Drop.js +2 -6
- package/es6/components/DataSort/stories/Simple.js +2 -6
- package/es6/components/DataSummary/stories/Simple.js +2 -6
- package/es6/components/DataTableColumns/stories/Simple.js +2 -6
- package/es6/components/DataTableGroupBy/stories/Simple.js +5 -7
- package/es6/components/DataView/stories/Simple.js +6 -8
- package/es6/components/DateInput/DateInput.js +61 -17
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/DateInput/stories/ReadOnly.js +31 -0
- package/es6/components/DateInput/utils.js +2 -2
- package/es6/components/Form/Form.js +34 -1
- package/es6/components/FormField/FormField.js +21 -2
- package/es6/components/FormField/README.md +1 -644
- package/es6/components/FormField/index.d.ts +5 -1
- package/es6/components/FormField/propTypes.js +4 -1
- package/es6/components/FormField/stories/ThresholdValidation.js +46 -0
- package/es6/components/Grommet/Grommet.js +1 -1
- package/es6/components/Grommet/index.d.ts +12 -0
- package/es6/components/Grommet/propTypes.js +12 -0
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/List/List.js +33 -30
- package/es6/components/Pagination/Pagination.js +52 -9
- package/es6/components/Pagination/PaginationStep.js +35 -0
- package/es6/components/Pagination/PaginationSummary.js +27 -0
- package/es6/components/Pagination/index.d.ts +2 -0
- package/es6/components/Pagination/propTypes.js +3 -1
- package/es6/components/Pagination/stories/Steps.js +35 -0
- package/es6/components/RangeInput/RangeInput.js +19 -12
- package/es6/components/TextInput/CopyButton.js +48 -0
- package/es6/components/TextInput/StyledTextInput.js +14 -3
- package/es6/components/TextInput/TextInput.js +46 -12
- package/es6/components/TextInput/index.d.ts +1 -0
- package/es6/components/TextInput/propTypes.js +1 -0
- package/es6/components/TextInput/stories/ReadOnly.js +38 -0
- package/es6/components/Toolbar/stories/Simple.js +2 -5
- package/es6/languages/default.json +23 -0
- package/es6/themes/base.d.ts +8 -0
- package/es6/themes/base.js +12 -1
- package/es6/utils/index.js +1 -0
- package/es6/utils/readOnly.js +10 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +23 -0
- package/package.json +31 -32
- package/themes/base.d.ts +8 -0
- package/themes/base.js +12 -1
- package/utils/index.js +6 -0
- package/utils/readOnly.js +14 -0
- package/components/Data/stories/Controlled.js +0 -92
- package/components/Data/stories/DataTable.js +0 -49
- package/components/DataFilters/stories/Inline.js +0 -53
- package/es6/components/Data/stories/Controlled.js +0 -86
- package/es6/components/Data/stories/DataTable.js +0 -44
- package/es6/components/DataFilters/stories/Inline.js +0 -48
package/languages/default.json
CHANGED
|
@@ -82,10 +82,33 @@
|
|
|
82
82
|
"invalid": "invalid",
|
|
83
83
|
"required": "required"
|
|
84
84
|
},
|
|
85
|
+
"formField": {
|
|
86
|
+
"maxCharacters": {
|
|
87
|
+
"remaining": {
|
|
88
|
+
"singular": "{number} character left",
|
|
89
|
+
"plural": "{number} characters left"
|
|
90
|
+
},
|
|
91
|
+
"overLimit": {
|
|
92
|
+
"singular": "{number} character over limit",
|
|
93
|
+
"plural": "{number} characters over limit"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"input": {
|
|
98
|
+
"readOnlyCopy": {
|
|
99
|
+
"prompt": "Copy to clipboard",
|
|
100
|
+
"validation": "Copied"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
85
103
|
"menu": {
|
|
86
104
|
"openMenu": "Open Menu",
|
|
87
105
|
"closeMenu": "Close Menu"
|
|
88
106
|
},
|
|
107
|
+
"pagination": {
|
|
108
|
+
"stepLabel": "Items per page",
|
|
109
|
+
"summary": "Showing {start}-{end} of {total}",
|
|
110
|
+
"summaryNoItems": "0 items"
|
|
111
|
+
},
|
|
89
112
|
"rangeSelector": {
|
|
90
113
|
"lower": "Lower Bounds",
|
|
91
114
|
"upper": "Upper Bounds"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grommet",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.36.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "es6/index.js",
|
|
6
6
|
"jsnext:main": "es6/index.js",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "https://github.com/grommet/grommet.git"
|
|
25
25
|
},
|
|
26
|
-
"engine-strict": true,
|
|
27
26
|
"engines": {
|
|
28
27
|
"node": ">= 16"
|
|
29
28
|
},
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"test-e2e-ci": "testcafe chrome:headless e2e/tests -r xunit:/tmp/test-results/testcafe/results.xml",
|
|
48
47
|
"build-storybook": "storybook build -c storybook -o storybook-static",
|
|
49
48
|
"prettier": "pretty-quick --staged",
|
|
50
|
-
"chromatic": "chromatic
|
|
49
|
+
"chromatic": "chromatic"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
52
|
"react": "^16.6.1 || ^17.0.0 || ^18.0.0",
|
|
@@ -61,10 +60,10 @@
|
|
|
61
60
|
"prop-types": "^15.8.1"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
|
-
"@babel/cli": "^7.23.
|
|
65
|
-
"@babel/core": "^7.23.
|
|
66
|
-
"@babel/eslint-parser": "^7.23.
|
|
67
|
-
"@babel/node": "^7.
|
|
63
|
+
"@babel/cli": "^7.23.9",
|
|
64
|
+
"@babel/core": "^7.23.9",
|
|
65
|
+
"@babel/eslint-parser": "^7.23.10",
|
|
66
|
+
"@babel/node": "^7.23.9",
|
|
68
67
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
69
68
|
"@babel/plugin-proposal-do-expressions": "^7.23.3",
|
|
70
69
|
"@babel/plugin-proposal-export-default-from": "^7.23.3",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
73
72
|
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
74
73
|
"@babel/plugin-proposal-pipeline-operator": "^7.23.3",
|
|
75
|
-
"@babel/preset-env": "^7.23.
|
|
74
|
+
"@babel/preset-env": "^7.23.9",
|
|
76
75
|
"@babel/preset-react": "^7.23.3",
|
|
77
76
|
"@storybook/addon-a11y": "7.0.20",
|
|
78
77
|
"@storybook/addon-storysource": "7.0.20",
|
|
@@ -82,15 +81,15 @@
|
|
|
82
81
|
"@storybook/react-webpack5": "7.0.20",
|
|
83
82
|
"@storybook/source-loader": "7.0.20",
|
|
84
83
|
"@testing-library/dom": "9.3.0",
|
|
85
|
-
"@testing-library/jest-dom": "^
|
|
86
|
-
"@testing-library/react": "^14.1
|
|
84
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
85
|
+
"@testing-library/react": "^14.2.1",
|
|
87
86
|
"@testing-library/testcafe": "^5.0.1",
|
|
88
|
-
"@testing-library/user-event": "^14.5.
|
|
89
|
-
"@types/jest": "^29.5.
|
|
87
|
+
"@testing-library/user-event": "^14.5.2",
|
|
88
|
+
"@types/jest": "^29.5.12",
|
|
90
89
|
"@types/jest-axe": "^3.5.9",
|
|
91
|
-
"@types/node": "^20.
|
|
92
|
-
"@types/react": "^18.2.
|
|
93
|
-
"@types/react-dom": "^18.2.
|
|
90
|
+
"@types/node": "^20.11.16",
|
|
91
|
+
"@types/react": "^18.2.55",
|
|
92
|
+
"@types/react-dom": "^18.2.19",
|
|
94
93
|
"@types/styled-components": "^5.1.34",
|
|
95
94
|
"babel-core": "^7.0.0-bridge.0",
|
|
96
95
|
"babel-jest": "^29.7.0",
|
|
@@ -98,33 +97,33 @@
|
|
|
98
97
|
"babel-plugin-styled-components": "2.0.6",
|
|
99
98
|
"babel-plugin-transform-imports": "^2.0.0",
|
|
100
99
|
"bundlesize2": "^0.0.31",
|
|
101
|
-
"chromatic": "^9.
|
|
100
|
+
"chromatic": "^10.9.0",
|
|
102
101
|
"clean-webpack-plugin": "^4.0.0",
|
|
103
|
-
"copy-webpack-plugin": "^
|
|
102
|
+
"copy-webpack-plugin": "^12.0.2",
|
|
104
103
|
"copyfiles": "^2.4.1",
|
|
105
|
-
"core-js": "^3.
|
|
104
|
+
"core-js": "^3.35.1",
|
|
106
105
|
"cross-env": "^7.0.3",
|
|
107
106
|
"del": "^6.1.1",
|
|
108
107
|
"elliptic": "^6.5.4",
|
|
109
|
-
"eslint": "^8.
|
|
108
|
+
"eslint": "^8.56.0",
|
|
110
109
|
"eslint-config-airbnb": "^19.0.4",
|
|
111
|
-
"eslint-config-prettier": "^9.
|
|
110
|
+
"eslint-config-prettier": "^9.1.0",
|
|
112
111
|
"eslint-plugin-babel": "^5.3.1",
|
|
113
|
-
"eslint-plugin-import": "^2.29.
|
|
112
|
+
"eslint-plugin-import": "^2.29.1",
|
|
114
113
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
115
|
-
"eslint-plugin-prettier": "5.
|
|
114
|
+
"eslint-plugin-prettier": "5.1.3",
|
|
116
115
|
"eslint-plugin-react": "^7.33.2",
|
|
117
116
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
118
|
-
"eslint-plugin-testing-library": "^
|
|
117
|
+
"eslint-plugin-testing-library": "^6.2.0",
|
|
119
118
|
"fs-extra": "^11.2.0",
|
|
120
|
-
"grommet-theme-hpe": "^5.
|
|
119
|
+
"grommet-theme-hpe": "^5.2.0",
|
|
121
120
|
"jest": "^29.7.0",
|
|
122
121
|
"jest-axe": "^8.0.0",
|
|
123
122
|
"jest-cli": "^29.7.0",
|
|
124
123
|
"jest-environment-jsdom": "^29.7.0",
|
|
125
124
|
"jest-styled-components": "7.0.5",
|
|
126
|
-
"jsdom": "^
|
|
127
|
-
"postcss": "^8.4.
|
|
125
|
+
"jsdom": "^24.0.0",
|
|
126
|
+
"postcss": "^8.4.35",
|
|
128
127
|
"pre-commit": "^1.2.2",
|
|
129
128
|
"prettier": "^2.8.8",
|
|
130
129
|
"pretty-quick": "^3.1.3",
|
|
@@ -133,19 +132,19 @@
|
|
|
133
132
|
"react-dom": "^18.2.0",
|
|
134
133
|
"react-is": "^18.2.0",
|
|
135
134
|
"react-shadow": "^20.4.0",
|
|
136
|
-
"regenerator-runtime": "^0.14.
|
|
135
|
+
"regenerator-runtime": "^0.14.1",
|
|
137
136
|
"require-reload": "^0.2.2",
|
|
138
|
-
"simple-git": "^3.
|
|
137
|
+
"simple-git": "^3.22.0",
|
|
139
138
|
"storybook": "7.0.20",
|
|
140
139
|
"styled-components": "5.3.9",
|
|
141
140
|
"tarball-extract": "^0.0.6",
|
|
142
141
|
"testcafe": "3.3.0",
|
|
143
142
|
"testcafe-react-selectors": "^5.0.3",
|
|
144
143
|
"testcafe-reporter-xunit": "^2.2.3",
|
|
145
|
-
"ts-jest": "^29.1.
|
|
144
|
+
"ts-jest": "^29.1.2",
|
|
146
145
|
"ts-loader": "^9.5.1",
|
|
147
|
-
"typescript": "^5.3.
|
|
148
|
-
"webpack": "^5.
|
|
146
|
+
"typescript": "^5.3.3",
|
|
147
|
+
"webpack": "^5.90.1",
|
|
149
148
|
"webpack-cli": "^5.1.4",
|
|
150
149
|
"webpack-dev-server": "^4.15.1"
|
|
151
150
|
},
|
|
@@ -206,7 +205,7 @@
|
|
|
206
205
|
"bundlesize": [
|
|
207
206
|
{
|
|
208
207
|
"path": "./dist/grommet.min.js",
|
|
209
|
-
"maxSize": "
|
|
208
|
+
"maxSize": "166 kB"
|
|
210
209
|
}
|
|
211
210
|
],
|
|
212
211
|
"keywords": [
|
package/themes/base.d.ts
CHANGED
|
@@ -438,6 +438,12 @@ export interface ThemeType {
|
|
|
438
438
|
size?: string;
|
|
439
439
|
weight?: number | string;
|
|
440
440
|
};
|
|
441
|
+
readOnly?: {
|
|
442
|
+
background?: BackgroundType;
|
|
443
|
+
border?: {
|
|
444
|
+
color?: ColorType;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
441
447
|
weight?: number | string;
|
|
442
448
|
};
|
|
443
449
|
opacity?: {
|
|
@@ -1076,6 +1082,7 @@ export interface ThemeType {
|
|
|
1076
1082
|
pad?: PadType;
|
|
1077
1083
|
extend?: ExtendType;
|
|
1078
1084
|
};
|
|
1085
|
+
primaryKey?: TextProps;
|
|
1079
1086
|
icons?: {
|
|
1080
1087
|
down?: React.ReactNode | Icon;
|
|
1081
1088
|
up?: React.ReactNode | Icon;
|
|
@@ -1415,6 +1422,7 @@ export interface ThemeType {
|
|
|
1415
1422
|
color?: ColorType;
|
|
1416
1423
|
extend?: ExtendType;
|
|
1417
1424
|
};
|
|
1425
|
+
wheel?: boolean;
|
|
1418
1426
|
extend?: ExtendType;
|
|
1419
1427
|
};
|
|
1420
1428
|
rangeSelector?: {
|
package/themes/base.js
CHANGED
|
@@ -318,9 +318,15 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
|
|
|
318
318
|
// size: undefined,
|
|
319
319
|
// height: undefined,
|
|
320
320
|
weight: 600
|
|
321
|
-
}
|
|
321
|
+
},
|
|
322
322
|
// deprecate in v3
|
|
323
323
|
// weight: undefined,
|
|
324
|
+
readOnly: {
|
|
325
|
+
// background: undefined,
|
|
326
|
+
// border: {
|
|
327
|
+
// color: undefined,
|
|
328
|
+
// },
|
|
329
|
+
}
|
|
324
330
|
},
|
|
325
331
|
opacity: {
|
|
326
332
|
strong: 0.8,
|
|
@@ -1202,6 +1208,10 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
|
|
|
1202
1208
|
}
|
|
1203
1209
|
// extend: undefined,
|
|
1204
1210
|
},
|
|
1211
|
+
primaryKey: {
|
|
1212
|
+
// any text props
|
|
1213
|
+
weight: 'bold'
|
|
1214
|
+
},
|
|
1205
1215
|
icons: {
|
|
1206
1216
|
down: _FormDown.FormDown,
|
|
1207
1217
|
up: _FormUp.FormUp,
|
|
@@ -1769,6 +1779,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
|
|
|
1769
1779
|
// color: { dark: undefined, light: undefined },
|
|
1770
1780
|
// extend: undefined
|
|
1771
1781
|
}
|
|
1782
|
+
// wheel: undefined
|
|
1772
1783
|
},
|
|
1773
1784
|
rangeSelector: {
|
|
1774
1785
|
background: {
|
package/utils/index.js
CHANGED
|
@@ -79,6 +79,12 @@ Object.keys(_PortalContext).forEach(function (key) {
|
|
|
79
79
|
if (key in exports && exports[key] === _PortalContext[key]) return;
|
|
80
80
|
exports[key] = _PortalContext[key];
|
|
81
81
|
});
|
|
82
|
+
var _readOnly = require("./readOnly");
|
|
83
|
+
Object.keys(_readOnly).forEach(function (key) {
|
|
84
|
+
if (key === "default" || key === "__esModule") return;
|
|
85
|
+
if (key in exports && exports[key] === _readOnly[key]) return;
|
|
86
|
+
exports[key] = _readOnly[key];
|
|
87
|
+
});
|
|
82
88
|
var _refs = require("./refs");
|
|
83
89
|
Object.keys(_refs).forEach(function (key) {
|
|
84
90
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.readOnlyStyle = void 0;
|
|
5
|
+
var _styledComponents = require("styled-components");
|
|
6
|
+
var _background = require("./background");
|
|
7
|
+
var _colors = require("./colors");
|
|
8
|
+
var readOnlyStyle = exports.readOnlyStyle = function readOnlyStyle(theme) {
|
|
9
|
+
var _theme$global$input$r, _theme$global$input$r2, _theme$global$input$r3;
|
|
10
|
+
var styles = [];
|
|
11
|
+
if (theme != null && (_theme$global$input$r = theme.global.input.readOnly) != null && (_theme$global$input$r = _theme$global$input$r.border) != null && _theme$global$input$r.color) styles.push((0, _styledComponents.css)(["border-color:", ";"], (0, _colors.normalizeColor)(theme.global.input.readOnly.border.color, theme)));
|
|
12
|
+
if (theme != null && (_theme$global$input$r2 = theme.global.input.readOnly) != null && _theme$global$input$r2.background) styles.push((0, _background.backgroundStyle)((_theme$global$input$r3 = theme.global.input.readOnly) == null ? void 0 : _theme$global$input$r3.background, theme));
|
|
13
|
+
return styles;
|
|
14
|
+
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Controlled = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _grommet = require("grommet");
|
|
7
|
-
var _Data = require("../Data");
|
|
8
|
-
var _data = require("../../DataTable/stories/data");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
11
|
-
var defaultView = {
|
|
12
|
-
properties: [],
|
|
13
|
-
search: '',
|
|
14
|
-
sort: {
|
|
15
|
-
property: 'name',
|
|
16
|
-
direction: 'asc'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// simulate back end filtering
|
|
21
|
-
var filter = function filter(view) {
|
|
22
|
-
var _view$search, _view$search2;
|
|
23
|
-
var searchExp = (_view$search = view.search) != null && _view$search.text || typeof view.search === 'string' && view.search ? new RegExp(view.search.text || view.search, 'i') : undefined;
|
|
24
|
-
var searchProperty = (_view$search2 = view.search) == null ? void 0 : _view$search2.property;
|
|
25
|
-
return _data.DATA.filter(function (datum) {
|
|
26
|
-
var matched = true;
|
|
27
|
-
if (searchExp) {
|
|
28
|
-
matched = Object.keys(datum).some(function (property) {
|
|
29
|
-
if (!searchProperty || searchProperty === property || Array.isArray(searchProperty) && searchProperty.includes(property)) return searchExp.test(datum[property]);
|
|
30
|
-
return false;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
var properties = view.properties;
|
|
34
|
-
if (matched && properties) {
|
|
35
|
-
matched = !Object.keys(properties).some(function (property) {
|
|
36
|
-
var value = properties[property];
|
|
37
|
-
if (Array.isArray(value)) return !value.includes(datum[property]);
|
|
38
|
-
return value !== datum[property];
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return matched;
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var Controlled = exports.Controlled = function Controlled() {
|
|
45
|
-
var _useState = (0, _react.useState)(defaultView),
|
|
46
|
-
view = _useState[0],
|
|
47
|
-
setView = _useState[1];
|
|
48
|
-
var _useState2 = (0, _react.useState)(_data.DATA),
|
|
49
|
-
data = _useState2[0],
|
|
50
|
-
setData = _useState2[1];
|
|
51
|
-
return (
|
|
52
|
-
/*#__PURE__*/
|
|
53
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
54
|
-
// <Grommet theme={...}>
|
|
55
|
-
_react["default"].createElement(_grommet.Grid, {
|
|
56
|
-
flex: false,
|
|
57
|
-
pad: "large",
|
|
58
|
-
columns: [['small', 'large']],
|
|
59
|
-
justifyContent: "center",
|
|
60
|
-
gap: "large"
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Notification, {
|
|
62
|
-
status: "info",
|
|
63
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
64
|
-
}), /*#__PURE__*/_react["default"].createElement(_Data.Data, {
|
|
65
|
-
data: data,
|
|
66
|
-
total: _data.DATA.length,
|
|
67
|
-
view: view,
|
|
68
|
-
onView: function onView(nextView) {
|
|
69
|
-
setView(nextView);
|
|
70
|
-
setData(filter(nextView));
|
|
71
|
-
}
|
|
72
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Toolbar, null, /*#__PURE__*/_react["default"].createElement(_grommet.DataSearch, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataFilters, {
|
|
73
|
-
drop: true
|
|
74
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.DataFilter, {
|
|
75
|
-
property: "location",
|
|
76
|
-
options: Array.from(new Set(_data.DATA.map(function (d) {
|
|
77
|
-
return d.location;
|
|
78
|
-
}))).filter(function (v) {
|
|
79
|
-
return v;
|
|
80
|
-
}).sort()
|
|
81
|
-
}))), /*#__PURE__*/_react["default"].createElement(_grommet.DataSummary, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
|
|
82
|
-
columns: _data.columns
|
|
83
|
-
})))
|
|
84
|
-
// </Grommet>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
Controlled.args = {
|
|
88
|
-
full: true
|
|
89
|
-
};
|
|
90
|
-
var _default = exports["default"] = {
|
|
91
|
-
title: 'Data/Data/Controlled'
|
|
92
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Table = void 0;
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
var _grommet = require("grommet");
|
|
7
|
-
var _Data = require("../Data");
|
|
8
|
-
var _data = require("../../DataTable/stories/data");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
var Table = exports.Table = function Table() {
|
|
11
|
-
return (
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
14
|
-
// <Grommet theme={...}>
|
|
15
|
-
_react["default"].createElement(_grommet.Grid, {
|
|
16
|
-
height: {
|
|
17
|
-
min: 'medium',
|
|
18
|
-
height: '100%'
|
|
19
|
-
},
|
|
20
|
-
pad: "large",
|
|
21
|
-
columns: [['small', 'large']],
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
alignContent: "start",
|
|
24
|
-
gap: "large"
|
|
25
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Notification, {
|
|
26
|
-
status: "info",
|
|
27
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
28
|
-
}), /*#__PURE__*/_react["default"].createElement(_Data.Data, {
|
|
29
|
-
data: _data.DATA
|
|
30
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Toolbar, null, /*#__PURE__*/_react["default"].createElement(_grommet.DataSearch, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataFilters, {
|
|
31
|
-
drop: true
|
|
32
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.DataFilter, {
|
|
33
|
-
property: "location"
|
|
34
|
-
}), /*#__PURE__*/_react["default"].createElement(_grommet.DataSort, null))), /*#__PURE__*/_react["default"].createElement(_grommet.DataSummary, null), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
35
|
-
flex: true,
|
|
36
|
-
overflow: "auto"
|
|
37
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
|
|
38
|
-
columns: _data.columns
|
|
39
|
-
}))))
|
|
40
|
-
// </Grommet>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
Table.storyName = 'DataTable';
|
|
44
|
-
Table.args = {
|
|
45
|
-
full: true
|
|
46
|
-
};
|
|
47
|
-
var _default = exports["default"] = {
|
|
48
|
-
title: 'Data/Data/DataTable'
|
|
49
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Inline = void 0;
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
var _grommet = require("grommet");
|
|
7
|
-
var _DataFilters = require("../DataFilters");
|
|
8
|
-
var _data = require("../../DataTable/stories/data");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
var Inline = exports.Inline = function Inline() {
|
|
11
|
-
return (
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
14
|
-
// <Grommet theme={...}>
|
|
15
|
-
_react["default"].createElement(_grommet.Box, {
|
|
16
|
-
align: "center",
|
|
17
|
-
justify: "start",
|
|
18
|
-
pad: "large",
|
|
19
|
-
gap: "medium"
|
|
20
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Notification, {
|
|
21
|
-
status: "info",
|
|
22
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
23
|
-
}), /*#__PURE__*/_react["default"].createElement(_grommet.Data, {
|
|
24
|
-
data: _data.DATA,
|
|
25
|
-
views: [{
|
|
26
|
-
name: 'latest',
|
|
27
|
-
sort: {
|
|
28
|
-
property: 'date',
|
|
29
|
-
direction: 'desc'
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
name: 'behind',
|
|
33
|
-
properties: {
|
|
34
|
-
percent: {
|
|
35
|
-
min: 0,
|
|
36
|
-
max: 30
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}]
|
|
40
|
-
}, /*#__PURE__*/_react["default"].createElement(_DataFilters.DataFilters, null, /*#__PURE__*/_react["default"].createElement(_grommet.DataView, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataSearch, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataFilter, {
|
|
41
|
-
property: "location"
|
|
42
|
-
}), /*#__PURE__*/_react["default"].createElement(_grommet.DataFilter, {
|
|
43
|
-
property: "percent"
|
|
44
|
-
}), /*#__PURE__*/_react["default"].createElement(_grommet.DataSort, null))))
|
|
45
|
-
// </Grommet>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
Inline.args = {
|
|
49
|
-
full: true
|
|
50
|
-
};
|
|
51
|
-
var _default = exports["default"] = {
|
|
52
|
-
title: 'Data/DataFilters/Inline'
|
|
53
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { DataFilters, DataFilter, DataSearch, DataSummary, DataTable, Grid, Notification, Toolbar } from 'grommet';
|
|
3
|
-
import { Data } from '../Data';
|
|
4
|
-
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
-
var defaultView = {
|
|
6
|
-
properties: [],
|
|
7
|
-
search: '',
|
|
8
|
-
sort: {
|
|
9
|
-
property: 'name',
|
|
10
|
-
direction: 'asc'
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// simulate back end filtering
|
|
15
|
-
var filter = function filter(view) {
|
|
16
|
-
var _view$search, _view$search2;
|
|
17
|
-
var searchExp = (_view$search = view.search) != null && _view$search.text || typeof view.search === 'string' && view.search ? new RegExp(view.search.text || view.search, 'i') : undefined;
|
|
18
|
-
var searchProperty = (_view$search2 = view.search) == null ? void 0 : _view$search2.property;
|
|
19
|
-
return DATA.filter(function (datum) {
|
|
20
|
-
var matched = true;
|
|
21
|
-
if (searchExp) {
|
|
22
|
-
matched = Object.keys(datum).some(function (property) {
|
|
23
|
-
if (!searchProperty || searchProperty === property || Array.isArray(searchProperty) && searchProperty.includes(property)) return searchExp.test(datum[property]);
|
|
24
|
-
return false;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
var properties = view.properties;
|
|
28
|
-
if (matched && properties) {
|
|
29
|
-
matched = !Object.keys(properties).some(function (property) {
|
|
30
|
-
var value = properties[property];
|
|
31
|
-
if (Array.isArray(value)) return !value.includes(datum[property]);
|
|
32
|
-
return value !== datum[property];
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return matched;
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
export var Controlled = function Controlled() {
|
|
39
|
-
var _useState = useState(defaultView),
|
|
40
|
-
view = _useState[0],
|
|
41
|
-
setView = _useState[1];
|
|
42
|
-
var _useState2 = useState(DATA),
|
|
43
|
-
data = _useState2[0],
|
|
44
|
-
setData = _useState2[1];
|
|
45
|
-
return (
|
|
46
|
-
/*#__PURE__*/
|
|
47
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
48
|
-
// <Grommet theme={...}>
|
|
49
|
-
React.createElement(Grid, {
|
|
50
|
-
flex: false,
|
|
51
|
-
pad: "large",
|
|
52
|
-
columns: [['small', 'large']],
|
|
53
|
-
justifyContent: "center",
|
|
54
|
-
gap: "large"
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Notification, {
|
|
56
|
-
status: "info",
|
|
57
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
58
|
-
}), /*#__PURE__*/React.createElement(Data, {
|
|
59
|
-
data: data,
|
|
60
|
-
total: DATA.length,
|
|
61
|
-
view: view,
|
|
62
|
-
onView: function onView(nextView) {
|
|
63
|
-
setView(nextView);
|
|
64
|
-
setData(filter(nextView));
|
|
65
|
-
}
|
|
66
|
-
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataSearch, null), /*#__PURE__*/React.createElement(DataFilters, {
|
|
67
|
-
drop: true
|
|
68
|
-
}, /*#__PURE__*/React.createElement(DataFilter, {
|
|
69
|
-
property: "location",
|
|
70
|
-
options: Array.from(new Set(DATA.map(function (d) {
|
|
71
|
-
return d.location;
|
|
72
|
-
}))).filter(function (v) {
|
|
73
|
-
return v;
|
|
74
|
-
}).sort()
|
|
75
|
-
}))), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
76
|
-
columns: columns
|
|
77
|
-
})))
|
|
78
|
-
// </Grommet>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
Controlled.args = {
|
|
82
|
-
full: true
|
|
83
|
-
};
|
|
84
|
-
export default {
|
|
85
|
-
title: 'Data/Data/Controlled'
|
|
86
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, DataFilters, DataFilter, DataSearch, DataSort, DataSummary, DataTable, Grid, Notification, Toolbar } from 'grommet';
|
|
3
|
-
import { Data } from '../Data';
|
|
4
|
-
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
-
export var Table = function Table() {
|
|
6
|
-
return (
|
|
7
|
-
/*#__PURE__*/
|
|
8
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
-
// <Grommet theme={...}>
|
|
10
|
-
React.createElement(Grid, {
|
|
11
|
-
height: {
|
|
12
|
-
min: 'medium',
|
|
13
|
-
height: '100%'
|
|
14
|
-
},
|
|
15
|
-
pad: "large",
|
|
16
|
-
columns: [['small', 'large']],
|
|
17
|
-
justifyContent: "center",
|
|
18
|
-
alignContent: "start",
|
|
19
|
-
gap: "large"
|
|
20
|
-
}, /*#__PURE__*/React.createElement(Notification, {
|
|
21
|
-
status: "info",
|
|
22
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
23
|
-
}), /*#__PURE__*/React.createElement(Data, {
|
|
24
|
-
data: DATA
|
|
25
|
-
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataSearch, null), /*#__PURE__*/React.createElement(DataFilters, {
|
|
26
|
-
drop: true
|
|
27
|
-
}, /*#__PURE__*/React.createElement(DataFilter, {
|
|
28
|
-
property: "location"
|
|
29
|
-
}), /*#__PURE__*/React.createElement(DataSort, null))), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(Box, {
|
|
30
|
-
flex: true,
|
|
31
|
-
overflow: "auto"
|
|
32
|
-
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
33
|
-
columns: columns
|
|
34
|
-
}))))
|
|
35
|
-
// </Grommet>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
Table.storyName = 'DataTable';
|
|
39
|
-
Table.args = {
|
|
40
|
-
full: true
|
|
41
|
-
};
|
|
42
|
-
export default {
|
|
43
|
-
title: 'Data/Data/DataTable'
|
|
44
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Data, DataFilter, DataSearch, DataSort, DataView, Notification } from 'grommet';
|
|
3
|
-
import { DataFilters } from '../DataFilters';
|
|
4
|
-
import { DATA } from '../../DataTable/stories/data';
|
|
5
|
-
export var Inline = function Inline() {
|
|
6
|
-
return (
|
|
7
|
-
/*#__PURE__*/
|
|
8
|
-
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
-
// <Grommet theme={...}>
|
|
10
|
-
React.createElement(Box, {
|
|
11
|
-
align: "center",
|
|
12
|
-
justify: "start",
|
|
13
|
-
pad: "large",
|
|
14
|
-
gap: "medium"
|
|
15
|
-
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
-
status: "info",
|
|
17
|
-
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
-
}), /*#__PURE__*/React.createElement(Data, {
|
|
19
|
-
data: DATA,
|
|
20
|
-
views: [{
|
|
21
|
-
name: 'latest',
|
|
22
|
-
sort: {
|
|
23
|
-
property: 'date',
|
|
24
|
-
direction: 'desc'
|
|
25
|
-
}
|
|
26
|
-
}, {
|
|
27
|
-
name: 'behind',
|
|
28
|
-
properties: {
|
|
29
|
-
percent: {
|
|
30
|
-
min: 0,
|
|
31
|
-
max: 30
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}]
|
|
35
|
-
}, /*#__PURE__*/React.createElement(DataFilters, null, /*#__PURE__*/React.createElement(DataView, null), /*#__PURE__*/React.createElement(DataSearch, null), /*#__PURE__*/React.createElement(DataFilter, {
|
|
36
|
-
property: "location"
|
|
37
|
-
}), /*#__PURE__*/React.createElement(DataFilter, {
|
|
38
|
-
property: "percent"
|
|
39
|
-
}), /*#__PURE__*/React.createElement(DataSort, null))))
|
|
40
|
-
// </Grommet>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
Inline.args = {
|
|
44
|
-
full: true
|
|
45
|
-
};
|
|
46
|
-
export default {
|
|
47
|
-
title: 'Data/DataFilters/Inline'
|
|
48
|
-
};
|