iglooform 2.5.18 → 2.5.21

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.
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { FormItemConfig, FormItemName } from '../../types';
3
3
  import './style/index.less';
4
4
  import { ConfirmationProps } from '../../confirmation';
@@ -8,9 +8,11 @@ export interface HStepsProps {
8
8
  [key: string]: {
9
9
  required: boolean;
10
10
  confirmation?: ConfirmationProps;
11
+ requiredMessage?: string;
11
12
  };
12
13
  };
13
14
  withReview?: boolean;
15
+ description?: ReactNode;
14
16
  };
15
17
  parentName?: FormItemName;
16
18
  name?: FormItemName;
@@ -29,7 +29,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
29
29
 
30
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
31
 
32
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
32
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
33
33
  import { useState, useContext, useEffect, useReducer, useRef } from 'react';
34
34
  import HStep from '../hstep';
35
35
  import { calcNamePath } from '../../utils/form-utils';
@@ -58,6 +58,7 @@ var HSteps = function HSteps(_ref) {
58
58
  subscribedFields = _ref$config.subscribedFields,
59
59
  onEdit = _ref$config.onEdit,
60
60
  confirmations = _ref$config.confirmations,
61
+ description = _ref$config.description,
61
62
  _ref$config$withRevie = _ref$config.withReview,
62
63
  withReview = _ref$config$withRevie === void 0 ? true : _ref$config$withRevie,
63
64
  name = _ref$config.name;
@@ -313,30 +314,32 @@ var HSteps = function HSteps(_ref) {
313
314
  }, (step === null || step === void 0 ? void 0 : step.key) || (step === null || step === void 0 ? void 0 : step.name));
314
315
  }), _jsxs("div", {
315
316
  className: "igloo-hsteps-confirmation",
316
- children: [_jsx(Typography, {
317
- level: md ? 'h3a' : 'h4',
318
- wrapElement: "div",
319
- children: formatMessage({
320
- id: 'Review and Submit'
321
- })
322
- }), _jsx(Typography, {
323
- level: md ? 'h3b' : 'body1',
324
- style: {
325
- marginTop: 24
326
- },
327
- wrapElement: "div",
328
- children: formatMessage({
329
- id: 'Please take a moment to review what you’ve told us above.'
330
- })
331
- }), _jsx(Typography, {
332
- level: md ? 'h3b' : 'body2',
333
- style: {
334
- marginTop: 24
335
- },
336
- wrapElement: "div",
337
- children: formatMessage({
338
- id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
339
- })
317
+ children: [description || _jsxs(_Fragment, {
318
+ children: [_jsx(Typography, {
319
+ level: md ? 'h3a' : 'h4',
320
+ wrapElement: "div",
321
+ children: formatMessage({
322
+ id: 'Review and Submit'
323
+ })
324
+ }), _jsx(Typography, {
325
+ level: md ? 'h3b' : 'body1',
326
+ style: {
327
+ marginTop: 24
328
+ },
329
+ wrapElement: "div",
330
+ children: formatMessage({
331
+ id: 'Please take a moment to review what you’ve told us above.'
332
+ })
333
+ }), _jsx(Typography, {
334
+ level: md ? 'h3b' : 'body2',
335
+ style: {
336
+ marginTop: 24
337
+ },
338
+ wrapElement: "div",
339
+ children: formatMessage({
340
+ id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
341
+ })
342
+ })]
340
343
  }), _jsx(_Divider, {}), !confirmations && _jsx(_Form.Item, {
341
344
  name: calcNamePath(parentName, 'confirmation'),
342
345
  rules: [{
@@ -360,14 +363,15 @@ var HSteps = function HSteps(_ref) {
360
363
  _ref7$ = _ref7[1],
361
364
  required = _ref7$.required,
362
365
  _ref7$$confirmation = _ref7$.confirmation,
363
- confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation;
366
+ confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation,
367
+ requiredMessage = _ref7$.requiredMessage;
364
368
 
365
369
  return _jsx(_Form.Item, {
366
370
  name: calcNamePath(parentName, key),
367
371
  rules: [{
368
372
  validator: function validator(_, value) {
369
373
  if (required && !value) {
370
- return Promise.reject(formatMessage({
374
+ return Promise.reject(requiredMessage || formatMessage({
371
375
  id: 'Please read and agree to Igloo Terms of Use and Privacy Policy'
372
376
  }));
373
377
  }
@@ -104,6 +104,20 @@ InputId.formItemPropsHandler = function (config) {
104
104
  });
105
105
  }
106
106
 
107
+ if (idType === 'NIK') {
108
+ rules.push({
109
+ validator: function validator(rule, value) {
110
+ if (!/^((1[1-9])|(21)|([37][1-6])|(5[1-4])|(6[1-5])|([8-9][1-2]))[0-9]{4}(([0-6][0-9])|(7[0-1]))((0[1-9])|(1[0-2]))[0-9]{6}$/.test(value)) {
111
+ return Promise.reject(formatMessage({
112
+ id: 'Invalid NIK Number.'
113
+ }));
114
+ }
115
+
116
+ return Promise.resolve();
117
+ }
118
+ });
119
+ }
120
+
107
121
  return {
108
122
  rules: rules
109
123
  };
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.",
34
34
  "Import": "Import",
35
35
  "Invalid KTP Number.": "Invalid KTP Number.",
36
+ "Invalid NIK Number.": "Invalid NIK Number.",
36
37
  "Invalid password.": "Invalid password.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.",
38
39
  "Last 7 Days": "Last 7 Days",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Saya menyatakan bahwa pernyataan yang saya jelaskan di atas adalah benar. Selanjutnya saya nyatakan bahwa kerugian yang terjadi merupakan ketidaksengajaan, dan terjadi tanpa perencanaan atau hasil musyawarah dengan pihak lain.",
34
34
  "Import": "Impor",
35
35
  "Invalid KTP Number.": "Nomor KTP Tidak Valid",
36
+ "Invalid NIK Number.": "Nomor NIK Tidak Valid",
36
37
  "Invalid password.": "Kata sandi salah.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Direkomendasikan untuk memilih tidak lebih dari {colMax} metrik untuk memastikan sudut pandang default dari setiap isi kolom.",
38
39
  "Last 7 Days": "7 hari terakhir",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
34
34
  "Import": "นำเข้า",
35
35
  "Invalid KTP Number.": "หมายเลข KTP ไม่ถูกต้อง",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "รหัสผ่านไม่ถูกต้อง.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "แนะนำให้เลือกจำนวนไม่เกิน {colMax} เพื่อให้แน่ใจว่ามองเห็นค่าเริ่มต้นของข้อมูลแต่ละคอลัมน์",
38
39
  "Last 7 Days": "เมื่อ 7 วันที่แล้ว",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Tôi tuyên bố rằng những điều tôi đã mô tả ở trên là đúng sự thật. Tôi tuyên bố thêm rằng tổn thất xảy ra là do ngẫu nhiên, không có kế hoạch hoặc sự đồng thuận với các bên khác.",
34
34
  "Import": "Nhập",
35
35
  "Invalid KTP Number.": "Số KTP không hợp lệ.",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "Mật khẩu không hợp lệ.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Vui lòng chọn không quá {colMax} cột.",
38
39
  "Last 7 Days": "7 ngày gần nhất",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
34
34
  "Import": "导入",
35
35
  "Invalid KTP Number.": "不合法的ID",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "无效的密码",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
38
39
  "Last 7 Days": "过去7天",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
34
34
  "Import": "導入",
35
35
  "Invalid KTP Number.": "",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
38
39
  "Last 7 Days": "過去7天",
@@ -80,7 +80,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
80
80
  return _jsxs(_Menu.Item, {
81
81
  className: "igloo-switch-platform-option",
82
82
  children: [_jsx(_Image, {
83
- src: "https://static.iglooinsure.com/partner/square/".concat(name.toLowerCase(), ".svg"),
83
+ src: "https://static.iglooinsure.com/partner/square/".concat(key.toLowerCase(), ".svg"),
84
84
  className: "igloo-switch-platform-default-logo",
85
85
  fallback: defaultIcon,
86
86
  preview: false
package/es/types.d.ts CHANGED
@@ -110,7 +110,7 @@ export interface FormItemExtraConfig extends FormItemProps {
110
110
  length?: number;
111
111
  minLength?: number;
112
112
  maxLength?: number;
113
- idType?: 'KTP';
113
+ idType?: 'KTP' | 'NIK';
114
114
  [key: string]: any;
115
115
  }
116
116
  export interface FormItemConfig extends FormItemExtraConfig {
@@ -1,5 +1,6 @@
1
1
  .word-wrap {
2
2
  word-wrap: break-word;
3
+ white-space: pre-wrap;
3
4
  }
4
5
 
5
6
  .igloo-typography {
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { FormItemConfig, FormItemName } from '../../types';
3
3
  import './style/index.less';
4
4
  import { ConfirmationProps } from '../../confirmation';
@@ -8,9 +8,11 @@ export interface HStepsProps {
8
8
  [key: string]: {
9
9
  required: boolean;
10
10
  confirmation?: ConfirmationProps;
11
+ requiredMessage?: string;
11
12
  };
12
13
  };
13
14
  withReview?: boolean;
15
+ description?: ReactNode;
14
16
  };
15
17
  parentName?: FormItemName;
16
18
  name?: FormItemName;
@@ -87,6 +87,7 @@ var HSteps = function HSteps(_ref) {
87
87
  subscribedFields = _ref$config.subscribedFields,
88
88
  onEdit = _ref$config.onEdit,
89
89
  confirmations = _ref$config.confirmations,
90
+ description = _ref$config.description,
90
91
  _ref$config$withRevie = _ref$config.withReview,
91
92
  withReview = _ref$config$withRevie === void 0 ? true : _ref$config$withRevie,
92
93
  name = _ref$config.name;
@@ -342,30 +343,32 @@ var HSteps = function HSteps(_ref) {
342
343
  }, (step === null || step === void 0 ? void 0 : step.key) || (step === null || step === void 0 ? void 0 : step.name));
343
344
  }), (0, _jsxRuntime.jsxs)("div", {
344
345
  className: "igloo-hsteps-confirmation",
345
- children: [(0, _jsxRuntime.jsx)(_typography.default, {
346
- level: md ? 'h3a' : 'h4',
347
- wrapElement: "div",
348
- children: formatMessage({
349
- id: 'Review and Submit'
350
- })
351
- }), (0, _jsxRuntime.jsx)(_typography.default, {
352
- level: md ? 'h3b' : 'body1',
353
- style: {
354
- marginTop: 24
355
- },
356
- wrapElement: "div",
357
- children: formatMessage({
358
- id: 'Please take a moment to review what you’ve told us above.'
359
- })
360
- }), (0, _jsxRuntime.jsx)(_typography.default, {
361
- level: md ? 'h3b' : 'body2',
362
- style: {
363
- marginTop: 24
364
- },
365
- wrapElement: "div",
366
- children: formatMessage({
367
- id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
368
- })
346
+ children: [description || (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
347
+ children: [(0, _jsxRuntime.jsx)(_typography.default, {
348
+ level: md ? 'h3a' : 'h4',
349
+ wrapElement: "div",
350
+ children: formatMessage({
351
+ id: 'Review and Submit'
352
+ })
353
+ }), (0, _jsxRuntime.jsx)(_typography.default, {
354
+ level: md ? 'h3b' : 'body1',
355
+ style: {
356
+ marginTop: 24
357
+ },
358
+ wrapElement: "div",
359
+ children: formatMessage({
360
+ id: 'Please take a moment to review what you’ve told us above.'
361
+ })
362
+ }), (0, _jsxRuntime.jsx)(_typography.default, {
363
+ level: md ? 'h3b' : 'body2',
364
+ style: {
365
+ marginTop: 24
366
+ },
367
+ wrapElement: "div",
368
+ children: formatMessage({
369
+ id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
370
+ })
371
+ })]
369
372
  }), (0, _jsxRuntime.jsx)(_divider.default, {}), !confirmations && (0, _jsxRuntime.jsx)(_form.default.Item, {
370
373
  name: (0, _formUtils.calcNamePath)(parentName, 'confirmation'),
371
374
  rules: [{
@@ -389,14 +392,15 @@ var HSteps = function HSteps(_ref) {
389
392
  _ref7$ = _ref7[1],
390
393
  required = _ref7$.required,
391
394
  _ref7$$confirmation = _ref7$.confirmation,
392
- confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation;
395
+ confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation,
396
+ requiredMessage = _ref7$.requiredMessage;
393
397
 
394
398
  return (0, _jsxRuntime.jsx)(_form.default.Item, {
395
399
  name: (0, _formUtils.calcNamePath)(parentName, key),
396
400
  rules: [{
397
401
  validator: function validator(_, value) {
398
402
  if (required && !value) {
399
- return Promise.reject(formatMessage({
403
+ return Promise.reject(requiredMessage || formatMessage({
400
404
  id: 'Please read and agree to Igloo Terms of Use and Privacy Policy'
401
405
  }));
402
406
  }
@@ -118,6 +118,20 @@ InputId.formItemPropsHandler = function (config) {
118
118
  });
119
119
  }
120
120
 
121
+ if (idType === 'NIK') {
122
+ rules.push({
123
+ validator: function validator(rule, value) {
124
+ if (!/^((1[1-9])|(21)|([37][1-6])|(5[1-4])|(6[1-5])|([8-9][1-2]))[0-9]{4}(([0-6][0-9])|(7[0-1]))((0[1-9])|(1[0-2]))[0-9]{6}$/.test(value)) {
125
+ return Promise.reject((0, _locale.staticFormatMessage)({
126
+ id: 'Invalid NIK Number.'
127
+ }));
128
+ }
129
+
130
+ return Promise.resolve();
131
+ }
132
+ });
133
+ }
134
+
121
135
  return {
122
136
  rules: rules
123
137
  };
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.",
34
34
  "Import": "Import",
35
35
  "Invalid KTP Number.": "Invalid KTP Number.",
36
+ "Invalid NIK Number.": "Invalid NIK Number.",
36
37
  "Invalid password.": "Invalid password.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.",
38
39
  "Last 7 Days": "Last 7 Days",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Saya menyatakan bahwa pernyataan yang saya jelaskan di atas adalah benar. Selanjutnya saya nyatakan bahwa kerugian yang terjadi merupakan ketidaksengajaan, dan terjadi tanpa perencanaan atau hasil musyawarah dengan pihak lain.",
34
34
  "Import": "Impor",
35
35
  "Invalid KTP Number.": "Nomor KTP Tidak Valid",
36
+ "Invalid NIK Number.": "Nomor NIK Tidak Valid",
36
37
  "Invalid password.": "Kata sandi salah.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Direkomendasikan untuk memilih tidak lebih dari {colMax} metrik untuk memastikan sudut pandang default dari setiap isi kolom.",
38
39
  "Last 7 Days": "7 hari terakhir",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
34
34
  "Import": "นำเข้า",
35
35
  "Invalid KTP Number.": "หมายเลข KTP ไม่ถูกต้อง",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "รหัสผ่านไม่ถูกต้อง.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "แนะนำให้เลือกจำนวนไม่เกิน {colMax} เพื่อให้แน่ใจว่ามองเห็นค่าเริ่มต้นของข้อมูลแต่ละคอลัมน์",
38
39
  "Last 7 Days": "เมื่อ 7 วันที่แล้ว",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Tôi tuyên bố rằng những điều tôi đã mô tả ở trên là đúng sự thật. Tôi tuyên bố thêm rằng tổn thất xảy ra là do ngẫu nhiên, không có kế hoạch hoặc sự đồng thuận với các bên khác.",
34
34
  "Import": "Nhập",
35
35
  "Invalid KTP Number.": "Số KTP không hợp lệ.",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "Mật khẩu không hợp lệ.",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Vui lòng chọn không quá {colMax} cột.",
38
39
  "Last 7 Days": "7 ngày gần nhất",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
34
34
  "Import": "导入",
35
35
  "Invalid KTP Number.": "不合法的ID",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "无效的密码",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
38
39
  "Last 7 Days": "过去7天",
@@ -33,6 +33,7 @@
33
33
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
34
34
  "Import": "導入",
35
35
  "Invalid KTP Number.": "",
36
+ "Invalid NIK Number.": "",
36
37
  "Invalid password.": "",
37
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
38
39
  "Last 7 Days": "過去7天",
@@ -100,7 +100,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
100
100
  return (0, _jsxRuntime.jsxs)(_menu.default.Item, {
101
101
  className: "igloo-switch-platform-option",
102
102
  children: [(0, _jsxRuntime.jsx)(_image.default, {
103
- src: "https://static.iglooinsure.com/partner/square/".concat(name.toLowerCase(), ".svg"),
103
+ src: "https://static.iglooinsure.com/partner/square/".concat(key.toLowerCase(), ".svg"),
104
104
  className: "igloo-switch-platform-default-logo",
105
105
  fallback: _default2.default,
106
106
  preview: false
package/lib/types.d.ts CHANGED
@@ -110,7 +110,7 @@ export interface FormItemExtraConfig extends FormItemProps {
110
110
  length?: number;
111
111
  minLength?: number;
112
112
  maxLength?: number;
113
- idType?: 'KTP';
113
+ idType?: 'KTP' | 'NIK';
114
114
  [key: string]: any;
115
115
  }
116
116
  export interface FormItemConfig extends FormItemExtraConfig {
@@ -1,5 +1,6 @@
1
1
  .word-wrap {
2
2
  word-wrap: break-word;
3
+ white-space: pre-wrap;
3
4
  }
4
5
 
5
6
  .igloo-typography {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.5.18",
3
+ "version": "2.5.21",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",