chili-ui 0.10.1 → 0.11.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/chili/components/NumericTextBox/handlers.ts +2 -2
- package/chili/form/index.ts +2 -0
- package/chili/form/setPersistedForm.test.ts +43 -0
- package/chili/form/setPersistedForm.ts +43 -0
- package/chili/index.ts +2 -1
- package/dist/form/index.d.ts +2 -1
- package/dist/form/index.js +2 -1
- package/dist/form/index.js.map +1 -1
- package/dist/form/setPersistedForm.d.ts +9 -0
- package/dist/form/setPersistedForm.js +21 -0
- package/dist/form/setPersistedForm.js.map +1 -0
- package/dist/form/setPersistedForm.test.d.ts +1 -0
- package/dist/form/setPersistedForm.test.js +36 -0
- package/dist/form/setPersistedForm.test.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/docs/src/app/form-helpers/get-persisted-form/page.tsx +148 -0
- package/docs/src/app/form-helpers/set-persisted-form/page.tsx +161 -0
- package/docs/src/components/nav/index.tsx +2 -0
- package/package.json +1 -1
|
@@ -313,8 +313,8 @@ export const createSetValueHandler = ({
|
|
|
313
313
|
}) => (value: unknown) => {
|
|
314
314
|
const newValue = value as number | null;
|
|
315
315
|
const formattedValue = formatValue({ value: newValue, format, thousandsSeparator });
|
|
316
|
-
const newInputValue = formatInputValue(formattedValue, format);
|
|
317
|
-
|
|
316
|
+
const newInputValue = formatInputValue(formattedValue, format);
|
|
317
|
+
|
|
318
318
|
setUncontrolledValue(newValue);
|
|
319
319
|
setInputValue(newInputValue);
|
|
320
320
|
|
package/chili/form/index.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { setPersistedForm } from './setPersistedForm';
|
|
2
|
+
import { Persistence } from '../components/Validation/types';
|
|
3
|
+
import { FORM_STORAGE_PREFIX } from '../constants';
|
|
4
|
+
|
|
5
|
+
describe('setPersistedForm', () => {
|
|
6
|
+
const formName = 'test-form';
|
|
7
|
+
const fieldName = 'field';
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
window.localStorage.clear();
|
|
11
|
+
window.sessionStorage.clear();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('updates persisted field value', () => {
|
|
15
|
+
const key = `${FORM_STORAGE_PREFIX}${formName}`;
|
|
16
|
+
window.localStorage.setItem(key, JSON.stringify({ [fieldName]: 'old', another: 1 }));
|
|
17
|
+
|
|
18
|
+
setPersistedForm({ form: formName, persistence: Persistence.localStorage, field: fieldName, value: 'new' });
|
|
19
|
+
|
|
20
|
+
expect(JSON.parse(window.localStorage.getItem(key) as string)).toEqual({ [fieldName]: 'new', another: 1 });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('throws when persisted data does not exist', () => {
|
|
24
|
+
expect(() => setPersistedForm({
|
|
25
|
+
form: formName,
|
|
26
|
+
persistence: Persistence.sessionStorage,
|
|
27
|
+
field: fieldName,
|
|
28
|
+
value: 'value',
|
|
29
|
+
})).toThrowError(`No data found for key: ${FORM_STORAGE_PREFIX}${formName}`);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('throws when persisted data is not valid JSON', () => {
|
|
33
|
+
const key = `${FORM_STORAGE_PREFIX}${formName}`;
|
|
34
|
+
window.sessionStorage.setItem(key, 'invalid json');
|
|
35
|
+
|
|
36
|
+
expect(() => setPersistedForm({
|
|
37
|
+
form: formName,
|
|
38
|
+
persistence: Persistence.sessionStorage,
|
|
39
|
+
field: fieldName,
|
|
40
|
+
value: 'value',
|
|
41
|
+
})).toThrowError(`Error parsing JSON for key: ${key}`);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Persistence } from '../components/Validation/types';
|
|
2
|
+
import { FORM_STORAGE_PREFIX } from '../constants';
|
|
3
|
+
|
|
4
|
+
interface SetPersistedFormParams {
|
|
5
|
+
form: string,
|
|
6
|
+
persistence: Persistence,
|
|
7
|
+
field: string,
|
|
8
|
+
value: unknown,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const getStorage = (persistence: Persistence) => (
|
|
12
|
+
persistence === Persistence.localStorage ? window.localStorage : window.sessionStorage
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const setPersistedForm = ({
|
|
16
|
+
form,
|
|
17
|
+
persistence,
|
|
18
|
+
field,
|
|
19
|
+
value,
|
|
20
|
+
}: SetPersistedFormParams): void => {
|
|
21
|
+
const storage = getStorage(persistence);
|
|
22
|
+
const key = `${FORM_STORAGE_PREFIX}${form}`;
|
|
23
|
+
const storedValue = storage.getItem(key);
|
|
24
|
+
|
|
25
|
+
if (!storedValue) {
|
|
26
|
+
throw new Error(`No data found for key: ${key}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let parsed: Record<string, unknown>;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(storedValue);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
throw new Error(`Error parsing JSON for key: ${key}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const updated = {
|
|
38
|
+
...parsed,
|
|
39
|
+
[field]: value,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
storage.setItem(key, JSON.stringify(updated));
|
|
43
|
+
};
|
package/chili/index.ts
CHANGED
|
@@ -115,7 +115,7 @@ import * as TooltipTypes from './components/Tooltip/types';
|
|
|
115
115
|
import * as ValidationTypes from './components/Validation/types';
|
|
116
116
|
import * as commonTypes from './commonTypes';
|
|
117
117
|
|
|
118
|
-
import { form, getPersistedForm } from './form';
|
|
118
|
+
import { form, getPersistedForm, setPersistedForm } from './form';
|
|
119
119
|
import { Persistence } from './components/Validation/types';
|
|
120
120
|
|
|
121
121
|
const utils = {
|
|
@@ -232,6 +232,7 @@ export {
|
|
|
232
232
|
validate,
|
|
233
233
|
form,
|
|
234
234
|
getPersistedForm,
|
|
235
|
+
setPersistedForm,
|
|
235
236
|
utils,
|
|
236
237
|
Validation,
|
|
237
238
|
Persistence,
|
package/dist/form/index.d.ts
CHANGED
package/dist/form/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { form, } from './form';
|
|
2
2
|
import { getPersistedForm } from './getPersistedForm';
|
|
3
|
-
|
|
3
|
+
import { setPersistedForm } from './setPersistedForm';
|
|
4
|
+
export { form, getPersistedForm, setPersistedForm, };
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../chili/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GACL,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,IAAI,EACJ,gBAAgB,GACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../chili/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GACL,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,gBAAgB,GACjB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Persistence } from '../components/Validation/types';
|
|
2
|
+
interface SetPersistedFormParams {
|
|
3
|
+
form: string;
|
|
4
|
+
persistence: Persistence;
|
|
5
|
+
field: string;
|
|
6
|
+
value: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare const setPersistedForm: ({ form, persistence, field, value, }: SetPersistedFormParams) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Persistence } from '../components/Validation/types';
|
|
2
|
+
import { FORM_STORAGE_PREFIX } from '../constants';
|
|
3
|
+
const getStorage = (persistence) => (persistence === Persistence.localStorage ? window.localStorage : window.sessionStorage);
|
|
4
|
+
export const setPersistedForm = ({ form, persistence, field, value, }) => {
|
|
5
|
+
const storage = getStorage(persistence);
|
|
6
|
+
const key = `${FORM_STORAGE_PREFIX}${form}`;
|
|
7
|
+
const storedValue = storage.getItem(key);
|
|
8
|
+
if (!storedValue) {
|
|
9
|
+
throw new Error(`No data found for key: ${key}`);
|
|
10
|
+
}
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = JSON.parse(storedValue);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
throw new Error(`Error parsing JSON for key: ${key}`);
|
|
17
|
+
}
|
|
18
|
+
const updated = Object.assign(Object.assign({}, parsed), { [field]: value });
|
|
19
|
+
storage.setItem(key, JSON.stringify(updated));
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=setPersistedForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setPersistedForm.js","sourceRoot":"","sources":["../../chili/form/setPersistedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AASnD,MAAM,UAAU,GAAG,CAAC,WAAwB,EAAE,EAAE,CAAC,CAC/C,WAAW,KAAK,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CACvF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EACJ,WAAW,EACX,KAAK,EACL,KAAK,GACkB,EAAQ,EAAE;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,GAAG,mBAAmB,GAAG,IAAI,EAAE,CAAC;IAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEzC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,MAA+B,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,OAAO,mCACR,MAAM,KACT,CAAC,KAAK,CAAC,EAAE,KAAK,GACf,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { setPersistedForm } from './setPersistedForm';
|
|
2
|
+
import { Persistence } from '../components/Validation/types';
|
|
3
|
+
import { FORM_STORAGE_PREFIX } from '../constants';
|
|
4
|
+
describe('setPersistedForm', () => {
|
|
5
|
+
const formName = 'test-form';
|
|
6
|
+
const fieldName = 'field';
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
window.localStorage.clear();
|
|
9
|
+
window.sessionStorage.clear();
|
|
10
|
+
});
|
|
11
|
+
test('updates persisted field value', () => {
|
|
12
|
+
const key = `${FORM_STORAGE_PREFIX}${formName}`;
|
|
13
|
+
window.localStorage.setItem(key, JSON.stringify({ [fieldName]: 'old', another: 1 }));
|
|
14
|
+
setPersistedForm({ form: formName, persistence: Persistence.localStorage, field: fieldName, value: 'new' });
|
|
15
|
+
expect(JSON.parse(window.localStorage.getItem(key))).toEqual({ [fieldName]: 'new', another: 1 });
|
|
16
|
+
});
|
|
17
|
+
test('throws when persisted data does not exist', () => {
|
|
18
|
+
expect(() => setPersistedForm({
|
|
19
|
+
form: formName,
|
|
20
|
+
persistence: Persistence.sessionStorage,
|
|
21
|
+
field: fieldName,
|
|
22
|
+
value: 'value',
|
|
23
|
+
})).toThrowError(`No data found for key: ${FORM_STORAGE_PREFIX}${formName}`);
|
|
24
|
+
});
|
|
25
|
+
test('throws when persisted data is not valid JSON', () => {
|
|
26
|
+
const key = `${FORM_STORAGE_PREFIX}${formName}`;
|
|
27
|
+
window.sessionStorage.setItem(key, 'invalid json');
|
|
28
|
+
expect(() => setPersistedForm({
|
|
29
|
+
form: formName,
|
|
30
|
+
persistence: Persistence.sessionStorage,
|
|
31
|
+
field: fieldName,
|
|
32
|
+
value: 'value',
|
|
33
|
+
})).toThrowError(`Error parsing JSON for key: ${key}`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=setPersistedForm.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setPersistedForm.test.js","sourceRoot":"","sources":["../../chili/form/setPersistedForm.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,QAAQ,GAAG,WAAW,CAAC;IAC7B,MAAM,SAAS,GAAG,OAAO,CAAC;IAE1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACzC,MAAM,GAAG,GAAG,GAAG,mBAAmB,GAAG,QAAQ,EAAE,CAAC;QAChD,MAAM,CAAC,YAAY,CAAC,O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CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ import * as TextareaTypes from './components/Textarea/types';
|
|
|
90
90
|
import * as TooltipTypes from './components/Tooltip/types';
|
|
91
91
|
import * as ValidationTypes from './components/Validation/types';
|
|
92
92
|
import * as commonTypes from './commonTypes';
|
|
93
|
-
import { form, getPersistedForm } from './form';
|
|
93
|
+
import { form, getPersistedForm, setPersistedForm } from './form';
|
|
94
94
|
import { Persistence } from './components/Validation/types';
|
|
95
95
|
declare const utils: {
|
|
96
96
|
bytesSizeToUnitsSize: (size: number, unit: "byte" | "kB" | "MB" | "GB" | "TB") => number;
|
|
@@ -110,4 +110,4 @@ declare const utils: {
|
|
|
110
110
|
useValue: <V>(valueProp: V | undefined, defaultValue: V) => [V, commonTypes.SetState<V>];
|
|
111
111
|
usePersistence: <V_1>({ form, name, valueProp, value, persistence, setValue, }: import("./utils/usePersistence").UsePersistenceParams<V_1>) => void;
|
|
112
112
|
};
|
|
113
|
-
export { AutoCompleteTypes, ButtonTypes, ButtonGroupTypes, CalendarTypes, CheckBoxTypes, CollapseTypes, DateTimeInputRangeTypes, DateTimeInputTypes, DropDownSelectTypes, DivTypes, IconTypes, InputTypes, MaskedInputTypes, ModalTypes, MultiSelectTypes, NotificationsTypes, NumericRangeTypes, NumericTextBoxTypes, PaginationTypes, PasswordTypes, RadioTypes, SwitcherTypes, TabsTypes, TableTypes, TagsTypes, TourTypes, TextareaTypes, TooltipTypes, ValidationTypes, commonTypes, A, Article, AutoComplete, Aside, B, Blockquote, Button, ButtonGroup, Calendar, CheckBox, Collapse, DatePicker, DateRange, DateTimePicker, DateTimeRange, Div, Dl, Dd, Dt, DropDownSelect, Figcaption, Figure, Footer, Header, H1, H2, H3, H4, H5, H6, I, Icon, Img, Input, Label, Li, Loader, Main, Mark, MaskedInput, Modal, ModalHeader, ModalBody, ModalFooter, MultiSelect, Nav, Notifications, NumericRange, NumericTextBox, Ol, P, Pagination, Password, ProgressBar, RadioGroup, RadioButton, Rating, Section, Small, Span, Svg, Switcher, Tab, Tabs, Table, ColGroup, Col, THead, TBody, Th, Tr, Td, TFoot, Tags, Tag, Tour, Textarea, TimePicker, TimeRange, Tooltip, Ul, Chili, ChiliContext, validate, form, getPersistedForm, utils, Validation, Persistence, };
|
|
113
|
+
export { AutoCompleteTypes, ButtonTypes, ButtonGroupTypes, CalendarTypes, CheckBoxTypes, CollapseTypes, DateTimeInputRangeTypes, DateTimeInputTypes, DropDownSelectTypes, DivTypes, IconTypes, InputTypes, MaskedInputTypes, ModalTypes, MultiSelectTypes, NotificationsTypes, NumericRangeTypes, NumericTextBoxTypes, PaginationTypes, PasswordTypes, RadioTypes, SwitcherTypes, TabsTypes, TableTypes, TagsTypes, TourTypes, TextareaTypes, TooltipTypes, ValidationTypes, commonTypes, A, Article, AutoComplete, Aside, B, Blockquote, Button, ButtonGroup, Calendar, CheckBox, Collapse, DatePicker, DateRange, DateTimePicker, DateTimeRange, Div, Dl, Dd, Dt, DropDownSelect, Figcaption, Figure, Footer, Header, H1, H2, H3, H4, H5, H6, I, Icon, Img, Input, Label, Li, Loader, Main, Mark, MaskedInput, Modal, ModalHeader, ModalBody, ModalFooter, MultiSelect, Nav, Notifications, NumericRange, NumericTextBox, Ol, P, Pagination, Password, ProgressBar, RadioGroup, RadioButton, Rating, Section, Small, Span, Svg, Switcher, Tab, Tabs, Table, ColGroup, Col, THead, TBody, Th, Tr, Td, TFoot, Tags, Tag, Tour, Textarea, TimePicker, TimeRange, Tooltip, Ul, Chili, ChiliContext, validate, form, getPersistedForm, setPersistedForm, utils, Validation, Persistence, };
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,7 @@ import * as TextareaTypes from './components/Textarea/types';
|
|
|
93
93
|
import * as TooltipTypes from './components/Tooltip/types';
|
|
94
94
|
import * as ValidationTypes from './components/Validation/types';
|
|
95
95
|
import * as commonTypes from './commonTypes';
|
|
96
|
-
import { form, getPersistedForm } from './form';
|
|
96
|
+
import { form, getPersistedForm, setPersistedForm } from './form';
|
|
97
97
|
import { Persistence } from './components/Validation/types';
|
|
98
98
|
const utils = {
|
|
99
99
|
bytesSizeToUnitsSize,
|
|
@@ -111,5 +111,5 @@ const utils = {
|
|
|
111
111
|
useValue,
|
|
112
112
|
usePersistence,
|
|
113
113
|
};
|
|
114
|
-
export { AutoCompleteTypes, ButtonTypes, ButtonGroupTypes, CalendarTypes, CheckBoxTypes, CollapseTypes, DateTimeInputRangeTypes, DateTimeInputTypes, DropDownSelectTypes, DivTypes, IconTypes, InputTypes, MaskedInputTypes, ModalTypes, MultiSelectTypes, NotificationsTypes, NumericRangeTypes, NumericTextBoxTypes, PaginationTypes, PasswordTypes, RadioTypes, SwitcherTypes, TabsTypes, TableTypes, TagsTypes, TourTypes, TextareaTypes, TooltipTypes, ValidationTypes, commonTypes, A, Article, AutoComplete, Aside, B, Blockquote, Button, ButtonGroup, Calendar, CheckBox, Collapse, DatePicker, DateRange, DateTimePicker, DateTimeRange, Div, Dl, Dd, Dt, DropDownSelect, Figcaption, Figure, Footer, Header, H1, H2, H3, H4, H5, H6, I, Icon, Img, Input, Label, Li, Loader, Main, Mark, MaskedInput, Modal, ModalHeader, ModalBody, ModalFooter, MultiSelect, Nav, Notifications, NumericRange, NumericTextBox, Ol, P, Pagination, Password, ProgressBar, RadioGroup, RadioButton, Rating, Section, Small, Span, Svg, Switcher, Tab, Tabs, Table, ColGroup, Col, THead, TBody, Th, Tr, Td, TFoot, Tags, Tag, Tour, Textarea, TimePicker, TimeRange, Tooltip, Ul, Chili, ChiliContext, validate, form, getPersistedForm, utils, Validation, Persistence, };
|
|
114
|
+
export { AutoCompleteTypes, ButtonTypes, ButtonGroupTypes, CalendarTypes, CheckBoxTypes, CollapseTypes, DateTimeInputRangeTypes, DateTimeInputTypes, DropDownSelectTypes, DivTypes, IconTypes, InputTypes, MaskedInputTypes, ModalTypes, MultiSelectTypes, NotificationsTypes, NumericRangeTypes, NumericTextBoxTypes, PaginationTypes, PasswordTypes, RadioTypes, SwitcherTypes, TabsTypes, TableTypes, TagsTypes, TourTypes, TextareaTypes, TooltipTypes, ValidationTypes, commonTypes, A, Article, AutoComplete, Aside, B, Blockquote, Button, ButtonGroup, Calendar, CheckBox, Collapse, DatePicker, DateRange, DateTimePicker, DateTimeRange, Div, Dl, Dd, Dt, DropDownSelect, Figcaption, Figure, Footer, Header, H1, H2, H3, H4, H5, H6, I, Icon, Img, Input, Label, Li, Loader, Main, Mark, MaskedInput, Modal, ModalHeader, ModalBody, ModalFooter, MultiSelect, Nav, Notifications, NumericRange, NumericTextBox, Ol, P, Pagination, Password, ProgressBar, RadioGroup, RadioButton, Rating, Section, Small, Span, Svg, Switcher, Tab, Tabs, Table, ColGroup, Col, THead, TBody, Th, Tr, Td, TFoot, Tags, Tag, Tour, Textarea, TimePicker, TimeRange, Tooltip, Ul, Chili, ChiliContext, validate, form, getPersistedForm, setPersistedForm, utils, Validation, Persistence, };
|
|
115
115
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../chili/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,CAAC,EAAE,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,C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AQ,EACR,WAAW,EACX,UAAU,EAAE,WAAW,EACvB,MAAM,EACN,OAAO,EACP,KAAK,EACL,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EACrD,IAAI,EAAE,GAAG,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACP,EAAE,EACF,KAAK,EAAE,YAAY,EACnB,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as L from '@chili';
|
|
4
|
+
import { Live } from '@/components/live';
|
|
5
|
+
import {
|
|
6
|
+
Code,
|
|
7
|
+
CodeBlock,
|
|
8
|
+
H1,
|
|
9
|
+
H2,
|
|
10
|
+
P,
|
|
11
|
+
Section,
|
|
12
|
+
Table,
|
|
13
|
+
Td,
|
|
14
|
+
THead,
|
|
15
|
+
} from '@/components/typography';
|
|
16
|
+
|
|
17
|
+
const GetPersistedFormPage = () => (
|
|
18
|
+
<article>
|
|
19
|
+
<H1>getPersistedForm</H1>
|
|
20
|
+
|
|
21
|
+
<P>
|
|
22
|
+
<b>getPersistedForm</b> reads persisted values for a form from <Code>localStorage</Code>{' '}
|
|
23
|
+
or{' '}
|
|
24
|
+
<Code>sessionStorage</Code> without mounting the original form components.
|
|
25
|
+
</P>
|
|
26
|
+
|
|
27
|
+
<Section>
|
|
28
|
+
<H2>Import</H2>
|
|
29
|
+
<P>
|
|
30
|
+
<Code>{"import { getPersistedForm } from '@chili'"}</Code>
|
|
31
|
+
</P>
|
|
32
|
+
<P>
|
|
33
|
+
or, when using the namespace pattern shown across the docs,
|
|
34
|
+
call <Code>L.getPersistedForm</Code>.
|
|
35
|
+
</P>
|
|
36
|
+
<CodeBlock>
|
|
37
|
+
{`getPersistedForm({
|
|
38
|
+
form: string,
|
|
39
|
+
persistence: Persistence,
|
|
40
|
+
field?: string,
|
|
41
|
+
}): Record<string, unknown> | unknown | null`}
|
|
42
|
+
</CodeBlock>
|
|
43
|
+
</Section>
|
|
44
|
+
|
|
45
|
+
<Section>
|
|
46
|
+
<H2>Parameters</H2>
|
|
47
|
+
<Table>
|
|
48
|
+
<THead headers={['Parameter', 'Type', 'Description']} />
|
|
49
|
+
<tbody>
|
|
50
|
+
<tr>
|
|
51
|
+
<Td>form</Td>
|
|
52
|
+
<Td>
|
|
53
|
+
<Code>string</Code>
|
|
54
|
+
</Td>
|
|
55
|
+
<Td>Name of the form whose values were persisted.</Td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<Td>persistence</Td>
|
|
59
|
+
<Td>
|
|
60
|
+
<Code>Persistence</Code>
|
|
61
|
+
</Td>
|
|
62
|
+
<Td>
|
|
63
|
+
Storage driver that was originally used to persist the form (for example{' '}
|
|
64
|
+
<Code>L.Persistence.localStorage</Code> or{' '}
|
|
65
|
+
<Code>L.Persistence.sessionStorage</Code>).
|
|
66
|
+
</Td>
|
|
67
|
+
</tr>
|
|
68
|
+
<tr>
|
|
69
|
+
<Td>field</Td>
|
|
70
|
+
<Td>
|
|
71
|
+
<Code>string</Code>
|
|
72
|
+
</Td>
|
|
73
|
+
<Td>Optional field name. When provided, only that field value is returned.</Td>
|
|
74
|
+
</tr>
|
|
75
|
+
</tbody>
|
|
76
|
+
</Table>
|
|
77
|
+
<P>
|
|
78
|
+
The helper returns either the full form object, a field value, or <Code>null</Code> when nothing
|
|
79
|
+
is stored for the supplied key.
|
|
80
|
+
</P>
|
|
81
|
+
</Section>
|
|
82
|
+
|
|
83
|
+
<Section>
|
|
84
|
+
<H2>Example</H2>
|
|
85
|
+
<P>
|
|
86
|
+
The snippet below persists a small form into <Code>localStorage</Code> and uses{' '}
|
|
87
|
+
<Code>getPersistedForm</Code> to inspect the stored values.
|
|
88
|
+
</P>
|
|
89
|
+
|
|
90
|
+
<Live scope={{ L }}>
|
|
91
|
+
{`() => {
|
|
92
|
+
const formName = 'persisted-form-helper';
|
|
93
|
+
const persistence = L.Persistence.localStorage;
|
|
94
|
+
|
|
95
|
+
const showEntireForm = () => {
|
|
96
|
+
const data = L.getPersistedForm({ form: formName, persistence });
|
|
97
|
+
alert(data ? JSON.stringify(data, null, 2) : 'No data saved yet');
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const showEmail = () => {
|
|
101
|
+
const email = L.getPersistedForm({ form: formName, persistence, field: 'email' });
|
|
102
|
+
alert(email != null ? email : 'Field "email" has not been stored yet');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<>
|
|
107
|
+
<L.Input
|
|
108
|
+
form={formName}
|
|
109
|
+
name='email'
|
|
110
|
+
placeholder='Email'
|
|
111
|
+
persistence={persistence}
|
|
112
|
+
_w-52
|
|
113
|
+
_mb-4
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<L.Switcher
|
|
117
|
+
form={formName}
|
|
118
|
+
name='newsletter'
|
|
119
|
+
persistence={persistence}
|
|
120
|
+
_mb-4
|
|
121
|
+
>
|
|
122
|
+
Subscribe to updates
|
|
123
|
+
</L.Switcher>
|
|
124
|
+
|
|
125
|
+
<div className='flex gap-4 flex-wrap'>
|
|
126
|
+
<L.Button onClick={showEntireForm}>
|
|
127
|
+
Show persisted form
|
|
128
|
+
</L.Button>
|
|
129
|
+
|
|
130
|
+
<L.Button onClick={showEmail}>
|
|
131
|
+
Show only email field
|
|
132
|
+
</L.Button>
|
|
133
|
+
</div>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
}`}
|
|
137
|
+
</Live>
|
|
138
|
+
|
|
139
|
+
<P className="mt-4">
|
|
140
|
+
Switch the <Code>persistence</Code> value to{' '}
|
|
141
|
+
<Code>L.Persistence.sessionStorage</Code> if the form was stored in{' '}
|
|
142
|
+
session storage instead.
|
|
143
|
+
</P>
|
|
144
|
+
</Section>
|
|
145
|
+
</article>
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
export default GetPersistedFormPage;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as L from '@chili';
|
|
4
|
+
import { Live } from '@/components/live';
|
|
5
|
+
import {
|
|
6
|
+
Code,
|
|
7
|
+
CodeBlock,
|
|
8
|
+
H1,
|
|
9
|
+
H2,
|
|
10
|
+
P,
|
|
11
|
+
Section,
|
|
12
|
+
Table,
|
|
13
|
+
Td,
|
|
14
|
+
THead,
|
|
15
|
+
} from '@/components/typography';
|
|
16
|
+
|
|
17
|
+
const SetPersistedFormPage = () => (
|
|
18
|
+
<article>
|
|
19
|
+
<H1>setPersistedForm</H1>
|
|
20
|
+
|
|
21
|
+
<P>
|
|
22
|
+
<b>setPersistedForm</b> updates a single persisted field value for a form stored in{' '}
|
|
23
|
+
<Code>localStorage</Code> or <Code>sessionStorage</Code> without mounting the original
|
|
24
|
+
form component.
|
|
25
|
+
</P>
|
|
26
|
+
|
|
27
|
+
<Section>
|
|
28
|
+
<H2>Import</H2>
|
|
29
|
+
<P>
|
|
30
|
+
<Code>{"import { setPersistedForm } from '@chili'"}</Code>
|
|
31
|
+
</P>
|
|
32
|
+
<P>
|
|
33
|
+
Or, when using the namespace pattern shown across the docs, call{' '}
|
|
34
|
+
<Code>L.setPersistedForm</Code>.
|
|
35
|
+
</P>
|
|
36
|
+
<CodeBlock>
|
|
37
|
+
{`setPersistedForm({
|
|
38
|
+
form: string,
|
|
39
|
+
persistence: Persistence,
|
|
40
|
+
field: string,
|
|
41
|
+
value: unknown,
|
|
42
|
+
}): void`}
|
|
43
|
+
</CodeBlock>
|
|
44
|
+
</Section>
|
|
45
|
+
|
|
46
|
+
<Section>
|
|
47
|
+
<H2>Parameters</H2>
|
|
48
|
+
<Table>
|
|
49
|
+
<THead headers={['Parameter', 'Type', 'Description']} />
|
|
50
|
+
<tbody>
|
|
51
|
+
<tr>
|
|
52
|
+
<Td>form</Td>
|
|
53
|
+
<Td>
|
|
54
|
+
<Code>string</Code>
|
|
55
|
+
</Td>
|
|
56
|
+
<Td>Name of the form whose values were persisted.</Td>
|
|
57
|
+
</tr>
|
|
58
|
+
<tr>
|
|
59
|
+
<Td>persistence</Td>
|
|
60
|
+
<Td>
|
|
61
|
+
<Code>Persistence</Code>
|
|
62
|
+
</Td>
|
|
63
|
+
<Td>
|
|
64
|
+
Storage driver that was originally used to persist the form (for example{' '}
|
|
65
|
+
<Code>L.Persistence.localStorage</Code> or{' '}
|
|
66
|
+
<Code>L.Persistence.sessionStorage</Code>).
|
|
67
|
+
</Td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<Td>field</Td>
|
|
71
|
+
<Td>
|
|
72
|
+
<Code>string</Code>
|
|
73
|
+
</Td>
|
|
74
|
+
<Td>Field name whose value should be updated.</Td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<Td>value</Td>
|
|
78
|
+
<Td>
|
|
79
|
+
<Code>unknown</Code>
|
|
80
|
+
</Td>
|
|
81
|
+
<Td>New value that will be stored for the provided field.</Td>
|
|
82
|
+
</tr>
|
|
83
|
+
</tbody>
|
|
84
|
+
</Table>
|
|
85
|
+
<P>
|
|
86
|
+
The helper throws an error when no persisted form exists for the supplied key or when
|
|
87
|
+
the stored value cannot be parsed as JSON, so make sure the form was persisted before
|
|
88
|
+
calling it.
|
|
89
|
+
</P>
|
|
90
|
+
</Section>
|
|
91
|
+
|
|
92
|
+
<Section>
|
|
93
|
+
<H2>Example</H2>
|
|
94
|
+
<P>
|
|
95
|
+
The example below persists a form into <Code>localStorage</Code> and provides a
|
|
96
|
+
button that updates the stored email without touching the underlying input.
|
|
97
|
+
</P>
|
|
98
|
+
|
|
99
|
+
<Live scope={{ L }}>
|
|
100
|
+
{`() => {
|
|
101
|
+
const formName = 'set-persisted-form-helper';
|
|
102
|
+
const persistence = L.Persistence.localStorage;
|
|
103
|
+
|
|
104
|
+
const updateEmail = () => {
|
|
105
|
+
try {
|
|
106
|
+
L.setPersistedForm({ form: formName, persistence, field: 'email', value: 'persisted@example.com' });
|
|
107
|
+
alert('Persisted email updated to "persisted@example.com"');
|
|
108
|
+
} catch (error) {
|
|
109
|
+
alert('Persisted form not found yet. Type something in the form first.');
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const showPersistedData = () => {
|
|
114
|
+
const data = L.getPersistedForm({ form: formName, persistence });
|
|
115
|
+
alert(data ? JSON.stringify(data, null, 2) : 'No data saved yet');
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
<L.Input
|
|
121
|
+
form={formName}
|
|
122
|
+
name='email'
|
|
123
|
+
placeholder='Email'
|
|
124
|
+
persistence={persistence}
|
|
125
|
+
_w-52
|
|
126
|
+
_mb-4
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<L.Switcher
|
|
130
|
+
form={formName}
|
|
131
|
+
name='newsletter'
|
|
132
|
+
persistence={persistence}
|
|
133
|
+
_mb-4
|
|
134
|
+
>
|
|
135
|
+
Subscribe to updates
|
|
136
|
+
</L.Switcher>
|
|
137
|
+
|
|
138
|
+
<div className='flex gap-4 flex-wrap'>
|
|
139
|
+
<L.Button onClick={updateEmail}>
|
|
140
|
+
Persist demo email
|
|
141
|
+
</L.Button>
|
|
142
|
+
|
|
143
|
+
<L.Button onClick={showPersistedData}>
|
|
144
|
+
Show persisted data
|
|
145
|
+
</L.Button>
|
|
146
|
+
</div>
|
|
147
|
+
</>
|
|
148
|
+
);
|
|
149
|
+
}`}
|
|
150
|
+
</Live>
|
|
151
|
+
|
|
152
|
+
<P className="mt-4">
|
|
153
|
+
Swap the <Code>persistence</Code> value to{' '}
|
|
154
|
+
<Code>L.Persistence.sessionStorage</Code> if the form was stored in
|
|
155
|
+
session storage instead.
|
|
156
|
+
</P>
|
|
157
|
+
</Section>
|
|
158
|
+
</article>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
export default SetPersistedFormPage;
|
|
@@ -45,6 +45,8 @@ export const MainNav = () => (
|
|
|
45
45
|
<ul>
|
|
46
46
|
<NavLi to="/form-helpers/form">form</NavLi>
|
|
47
47
|
<NavLi to="/form-helpers/validate">validate</NavLi>
|
|
48
|
+
<NavLi to="/form-helpers/get-persisted-form">getPersistedForm</NavLi>
|
|
49
|
+
<NavLi to="/form-helpers/set-persisted-form">setPersistedForm</NavLi>
|
|
48
50
|
</ul>
|
|
49
51
|
|
|
50
52
|
<div className="py-4 font-bold">
|