@ornikar/kitt-universal 13.3.2 → 13.4.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.
- package/babel-plugin-csf-to-jest.js +41 -20
- package/dist/definitions/forms/DatePicker/components/InputPart.d.ts +1 -0
- package/dist/definitions/forms/DatePicker/components/InputPart.d.ts.map +1 -1
- package/dist/definitions/forms/DatePicker/components/KeyboardDatePicker.d.ts.map +1 -1
- package/dist/definitions/forms/Label/Label.d.ts +2 -1
- package/dist/definitions/forms/Label/Label.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +18 -9
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +18 -9
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +18 -9
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +16 -8
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +11 -2
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +9 -1
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +6 -5
|
@@ -6,7 +6,10 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
|
|
|
6
6
|
const storybookImportName = 'BabelPluginStorybookCSFToJest_StorybookReact';
|
|
7
7
|
const storiesOfName = 'BabelPluginStorybookCSFToJest_stories';
|
|
8
8
|
|
|
9
|
-
const isStory = (file) =>
|
|
9
|
+
const isStory = (file) =>
|
|
10
|
+
file.opts &&
|
|
11
|
+
file.opts.filename &&
|
|
12
|
+
(file.opts.filename.endsWith('.stories.tsx') || file.opts.filename.endsWith('/stories.tsx'));
|
|
10
13
|
|
|
11
14
|
return {
|
|
12
15
|
name: 'plugin-storybook-csf-to-jest',
|
|
@@ -134,6 +137,7 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
|
|
|
134
137
|
|
|
135
138
|
const binding = path.scope.getBinding(declaration.id.name);
|
|
136
139
|
let storyName = declaration.id.name;
|
|
140
|
+
let parameters;
|
|
137
141
|
|
|
138
142
|
binding.referencePaths.forEach((refPath) => {
|
|
139
143
|
if (refPath === path) return; // skip named export
|
|
@@ -154,28 +158,44 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
|
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
const prop = refPath.parent.property;
|
|
157
|
-
if (types.isIdentifier(prop)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
id: types.identifier('args'),
|
|
161
|
-
init: assignmentExpression.right,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
161
|
+
if (types.isIdentifier(prop)) {
|
|
162
|
+
if (prop.name === 'args') {
|
|
163
|
+
foundArgs = true;
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
prop.name === 'story' &&
|
|
168
|
-
types.isObjectExpression(assignmentExpression.right)
|
|
169
|
-
) {
|
|
170
|
-
const objectExpression = assignmentExpression.right;
|
|
171
|
-
objectExpression.properties.forEach((property) => {
|
|
172
|
-
if (types.isIdentifier(property.key) && property.key.name === 'name') {
|
|
173
|
-
storyName = property.value.value;
|
|
165
|
+
if (declaration.init.body.type !== 'BlockStatement') {
|
|
166
|
+
declaration.init.body = types.blockStatement([types.returnStatement(declaration.init.body)]);
|
|
174
167
|
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
168
|
|
|
178
|
-
|
|
169
|
+
declaration.init.body.body.unshift(
|
|
170
|
+
types.variableDeclaration('const', [
|
|
171
|
+
types.variableDeclarator(types.identifier('args'), assignmentExpression.right),
|
|
172
|
+
]),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (prop.name === 'storyName') {
|
|
177
|
+
if (!types.isStringLiteral(assignmentExpression.right)) {
|
|
178
|
+
throw path.buildCodeFrameError(
|
|
179
|
+
`Invalid storyName, expecting StringLiteral, got "${assignmentExpression.right.type}"`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
storyName = assignmentExpression.right.value;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (prop.name === 'story' && types.isObjectExpression(assignmentExpression.right)) {
|
|
186
|
+
throw path.buildCodeFrameError('story.name is deprecated, use storyName instead');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (prop.name === 'parameters') {
|
|
190
|
+
parameters = assignmentExpression.right;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (prop.name === 'decorators') {
|
|
194
|
+
throw path.buildCodeFrameError(
|
|
195
|
+
'Story-specific decorators are not supported, use global decorators instead (in export default).',
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
179
199
|
|
|
180
200
|
memberExpressionPath.parentPath.remove();
|
|
181
201
|
});
|
|
@@ -188,6 +208,7 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
|
|
|
188
208
|
types.callExpression(types.memberExpression(types.identifier(storiesOfName), types.identifier('add')), [
|
|
189
209
|
types.stringLiteral(storyName),
|
|
190
210
|
declaration.init,
|
|
211
|
+
...(parameters ? [parameters] : []),
|
|
191
212
|
]),
|
|
192
213
|
);
|
|
193
214
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPart.d.ts","sourceRoot":"","sources":["../../../../../src/forms/DatePicker/components/InputPart.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA4BhE,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"InputPart.d.ts","sourceRoot":"","sources":["../../../../../src/forms/DatePicker/components/InputPart.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA4BhE,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,SAAS,sGAuCrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/forms/DatePicker/components/KeyboardDatePicker.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AASrD,UAAU,uBAAwB,SAAQ,eAAe;IACvD,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"KeyboardDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/forms/DatePicker/components/KeyboardDatePicker.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AASrD,UAAU,uBAAwB,SAAQ,eAAe;IACvD,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB,iHAiJ9B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
export interface LabelProps {
|
|
3
|
+
id?: string;
|
|
3
4
|
htmlFor: string;
|
|
4
5
|
children: NonNullable<ReactNode>;
|
|
5
6
|
}
|
|
6
|
-
export declare function Label({ htmlFor, children }: LabelProps): ReactElement;
|
|
7
|
+
export declare function Label({ id, htmlFor, children }: LabelProps): ReactElement;
|
|
7
8
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/forms/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAClC;AAED,wBAAgB,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/forms/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAClC;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,YAAY,CAazE"}
|
|
@@ -4304,7 +4304,8 @@ function getCurrentInternalForcedState$1(_ref) {
|
|
|
4304
4304
|
return 'default';
|
|
4305
4305
|
}
|
|
4306
4306
|
var InputPart = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
4307
|
-
var
|
|
4307
|
+
var id = _ref2.id,
|
|
4308
|
+
value = _ref2.value,
|
|
4308
4309
|
placeholder = _ref2.placeholder,
|
|
4309
4310
|
disabled = _ref2.disabled,
|
|
4310
4311
|
isFocusedInternal = _ref2.isFocusedInternal,
|
|
@@ -4316,6 +4317,7 @@ var InputPart = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
4316
4317
|
onSubmitEditing = _ref2.onSubmitEditing;
|
|
4317
4318
|
return /*#__PURE__*/jsx(InputText, {
|
|
4318
4319
|
ref: ref,
|
|
4320
|
+
id: id,
|
|
4319
4321
|
internalForceState: getCurrentInternalForcedState$1({
|
|
4320
4322
|
isDisabled: disabled,
|
|
4321
4323
|
isHoveredInternal: isHoveredInternal,
|
|
@@ -4346,11 +4348,11 @@ function PartContainer(_ref) {
|
|
|
4346
4348
|
});
|
|
4347
4349
|
}
|
|
4348
4350
|
|
|
4349
|
-
var _excluded$q = ["
|
|
4351
|
+
var _excluded$q = ["id", "value", "testID", "stretch", "placeholder", "minDate", "maxDate", "disabled", "isFocusedInternal", "isHoveredInternal", "isPressedInternal", "returnKeyType", "onChange", "onBlur", "onFocus", "onSubmitEditing"];
|
|
4350
4352
|
var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
4351
|
-
var
|
|
4353
|
+
var id = _ref.id,
|
|
4354
|
+
value = _ref.value,
|
|
4352
4355
|
testID = _ref.testID,
|
|
4353
|
-
id = _ref.id,
|
|
4354
4356
|
stretch = _ref.stretch,
|
|
4355
4357
|
placeholder = _ref.placeholder,
|
|
4356
4358
|
minDate = _ref.minDate,
|
|
@@ -4417,7 +4419,8 @@ var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
4417
4419
|
isStretch: stretch,
|
|
4418
4420
|
width: "kitt.forms.datePicker.day.minWidth",
|
|
4419
4421
|
children: /*#__PURE__*/jsx(InputPart, _objectSpread(_objectSpread({
|
|
4420
|
-
ref: ref
|
|
4422
|
+
ref: ref,
|
|
4423
|
+
id: id ? "".concat(id, "-day") : undefined
|
|
4421
4424
|
}, sharedInputPartProps), {}, {
|
|
4422
4425
|
placeholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.day,
|
|
4423
4426
|
value: state.displayedDay,
|
|
@@ -4447,7 +4450,8 @@ var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
4447
4450
|
isStretch: stretch,
|
|
4448
4451
|
width: "kitt.forms.datePicker.month.minWidth",
|
|
4449
4452
|
children: /*#__PURE__*/jsx(InputPart, _objectSpread(_objectSpread({
|
|
4450
|
-
ref: monthRef
|
|
4453
|
+
ref: monthRef,
|
|
4454
|
+
id: id ? "".concat(id, "-month") : undefined
|
|
4451
4455
|
}, sharedInputPartProps), {}, {
|
|
4452
4456
|
placeholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.month,
|
|
4453
4457
|
value: state.displayedMonth,
|
|
@@ -4477,7 +4481,8 @@ var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
4477
4481
|
isStretch: stretch,
|
|
4478
4482
|
width: "kitt.forms.datePicker.year.minWidth",
|
|
4479
4483
|
children: /*#__PURE__*/jsx(InputPart, _objectSpread(_objectSpread({
|
|
4480
|
-
ref: yearRef
|
|
4484
|
+
ref: yearRef,
|
|
4485
|
+
id: id ? "".concat(id, "-year") : undefined
|
|
4481
4486
|
}, sharedInputPartProps), {}, {
|
|
4482
4487
|
placeholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.year,
|
|
4483
4488
|
value: state.displayedYear,
|
|
@@ -5047,11 +5052,15 @@ function InputTag(_ref) {
|
|
|
5047
5052
|
}
|
|
5048
5053
|
|
|
5049
5054
|
function Label(_ref) {
|
|
5050
|
-
var
|
|
5055
|
+
var id = _ref.id,
|
|
5056
|
+
htmlFor = _ref.htmlFor,
|
|
5051
5057
|
children = _ref.children;
|
|
5058
|
+
var isWeb = Platform.OS === 'web';
|
|
5052
5059
|
return /*#__PURE__*/jsx(Typography.Text, {
|
|
5053
5060
|
base: "body",
|
|
5054
|
-
|
|
5061
|
+
nativeID: isWeb ? undefined : id,
|
|
5062
|
+
children: isWeb ? /*#__PURE__*/jsx("label", {
|
|
5063
|
+
id: id,
|
|
5055
5064
|
htmlFor: htmlFor,
|
|
5056
5065
|
children: children
|
|
5057
5066
|
}) : children
|