@seed-design/react 2.2.1 → 2.3.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/lib/components/DatePicker/DatePicker.cjs +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.js +1 -1
- package/lib/components/TextField/useTextFieldWithGraphemes.cjs +2 -5
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts.map +1 -1
- package/lib/components/TextField/useTextFieldWithGraphemes.js +3 -6
- package/package.json +5 -5
- package/src/components/DatePicker/DatePicker.test.tsx +50 -0
- package/src/components/DatePicker/DatePicker.tsx +3 -14
- package/src/components/TextField/useTextFieldWithGraphemes.ts +3 -7
- package/lib/components/TextField/memoize.cjs +0 -13
- package/lib/components/TextField/memoize.d.ts +0 -2
- package/lib/components/TextField/memoize.d.ts.map +0 -1
- package/lib/components/TextField/memoize.js +0 -13
- package/src/components/TextField/memoize.ts +0 -14
|
@@ -229,7 +229,7 @@ var DatePickerImplementation = react.forwardRef((props, forwardedRef) => {
|
|
|
229
229
|
...variantProps,
|
|
230
230
|
visibleRange: api.visibleRange
|
|
231
231
|
});
|
|
232
|
-
const { renderDateCellContent, renderDateCellSupplement, actionsRef, selectionMode: _selectionMode, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, viewDate: _viewDate, defaultViewDate: _defaultViewDate, onViewDateChange: _onViewDateChange, today: _today, locale: _locale, weekStartsOn: _weekStartsOn, yearRange: _yearRange, constraints: _constraints, disabled: _disabled, readOnly: _readOnly, ariaLabels: _ariaLabels, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...styleAndRootProps } = otherProps;
|
|
232
|
+
const { renderDateCellContent, renderDateCellSupplement, actionsRef, selectionMode: _selectionMode, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, viewDate: _viewDate, defaultViewDate: _defaultViewDate, onViewDateChange: _onViewDateChange, today: _today, locale: _locale, weekStartsOn: _weekStartsOn, yearRange: _yearRange, constraints: _constraints, disabled: _disabled, readOnly: _readOnly, rangeStartReadOnly: _rangeStartReadOnly, ariaLabels: _ariaLabels, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...styleAndRootProps } = otherProps;
|
|
233
233
|
const { style: styleProps, restProps: rootProps } = require_styled.useStyleProps(styleAndRootProps);
|
|
234
234
|
const rootRef = react.useRef(null);
|
|
235
235
|
const hasContinuousSizeConstraint = props.height !== void 0 || props.minHeight !== void 0 || props.maxHeight !== void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EAGxB,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBpE,KAAK,mBAAmB,GAAG,cAAc,GACvC,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,GACtD,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,eAAe,CAC3D,CAAC;AAEJ,MAAM,WAAW,gCAAiC,SAAQ,mBAAmB;CAAG;AAEhF,KAAK,uBAAuB,GAAG,kBAAkB,SAAS,MAAM,KAAK,GACjE,KAAK,SAAS,kBAAkB,GAC9B,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,GAC3B,KAAK,GACP,KAAK,CAAC;AAEV,KAAK,2BAA2B,GAC5B;IACE;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,K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,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW,CAAC,CAAC,GACpF,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,GACpF,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACpD,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACxD,KAAK,0BAA0B,CAAC,KAAK,GAAG,qBAAqB,IAAI,KAAK,SAAS,qBAAqB,GAChG,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,GACjD,KAAK,CAAC;AACV,MAAM,MAAM,yBAAyB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC;AA8b9F,eAAO,MAAM,UAAU,8FAErB,CAAC;AAGH,eAAO,MAAM,kBAAkB,8FAE9B,CAAC;AAGF,eAAO,MAAM,cAAc,8FAE1B,CAAC;AAGF,eAAO,MAAM,oBAAoB,kGAEhC,CAAC;AAGF,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,GAChB,MAAM,gCAAgC,CAAC"}
|
|
@@ -226,7 +226,7 @@ var DatePickerImplementation = React$1.forwardRef((props, forwardedRef) => {
|
|
|
226
226
|
...variantProps,
|
|
227
227
|
visibleRange: api.visibleRange
|
|
228
228
|
});
|
|
229
|
-
const { renderDateCellContent, renderDateCellSupplement, actionsRef, selectionMode: _selectionMode, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, viewDate: _viewDate, defaultViewDate: _defaultViewDate, onViewDateChange: _onViewDateChange, today: _today, locale: _locale, weekStartsOn: _weekStartsOn, yearRange: _yearRange, constraints: _constraints, disabled: _disabled, readOnly: _readOnly, ariaLabels: _ariaLabels, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...styleAndRootProps } = otherProps;
|
|
229
|
+
const { renderDateCellContent, renderDateCellSupplement, actionsRef, selectionMode: _selectionMode, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, viewDate: _viewDate, defaultViewDate: _defaultViewDate, onViewDateChange: _onViewDateChange, today: _today, locale: _locale, weekStartsOn: _weekStartsOn, yearRange: _yearRange, constraints: _constraints, disabled: _disabled, readOnly: _readOnly, rangeStartReadOnly: _rangeStartReadOnly, ariaLabels: _ariaLabels, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...styleAndRootProps } = otherProps;
|
|
230
230
|
const { style: styleProps, restProps: rootProps } = useStyleProps(styleAndRootProps);
|
|
231
231
|
const rootRef = React$1.useRef(null);
|
|
232
232
|
const hasContinuousSizeConstraint = props.height !== void 0 || props.minHeight !== void 0 || props.maxHeight !== void 0;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_memoize = require("./memoize.cjs");
|
|
4
3
|
let react = require("react");
|
|
5
4
|
let unicode_segmenter_grapheme = require("unicode-segmenter/grapheme");
|
|
6
5
|
//#region src/components/TextField/useTextFieldWithGraphemes.ts
|
|
7
|
-
var getGraphemes = (string) => Array.from((0, unicode_segmenter_grapheme.splitGraphemes)(string));
|
|
8
|
-
var memoizedGetGraphemes = require_memoize.memoize(getGraphemes);
|
|
9
6
|
function useTextFieldWithGraphemes({ maxGraphemeCount, value: controlledValue, defaultValue = "", onValueChange }) {
|
|
10
7
|
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
11
8
|
const isControlled = controlledValue !== void 0;
|
|
12
9
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
13
|
-
const graphemes = (0, react.useMemo)(() =>
|
|
10
|
+
const graphemes = (0, react.useMemo)(() => (0, unicode_segmenter_grapheme.collectGraphemes)(value), [value]);
|
|
14
11
|
return {
|
|
15
12
|
textFieldRootProps: {
|
|
16
13
|
value,
|
|
17
14
|
onValueChange: (0, react.useCallback)((newValue) => {
|
|
18
|
-
const newGraphemes =
|
|
15
|
+
const newGraphemes = (0, unicode_segmenter_grapheme.collectGraphemes)(newValue);
|
|
19
16
|
const newSlicedGraphemes = maxGraphemeCount === void 0 ? newGraphemes : newGraphemes.slice(0, maxGraphemeCount);
|
|
20
17
|
const newSlicedValue = newSlicedGraphemes.join("");
|
|
21
18
|
if (!isControlled) setUncontrolledValue(newValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextFieldWithGraphemes.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/useTextFieldWithGraphemes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTextFieldWithGraphemes.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/useTextFieldWithGraphemes.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B,KAAK,IAAI,CAAC;CACZ;AAED,wBAAgB,yBAAyB,CAAC,EACxC,gBAAgB,EAChB,KAAK,EAAE,eAAe,EACtB,YAAiB,EACjB,aAAa,GACd,EAAE,+BAA+B;;;kCAQnB,MAAM;;;;;;;EAgCpB"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { memoize } from "./memoize.js";
|
|
3
2
|
import { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { collectGraphemes } from "unicode-segmenter/grapheme";
|
|
5
4
|
//#region src/components/TextField/useTextFieldWithGraphemes.ts
|
|
6
|
-
var getGraphemes = (string) => Array.from(splitGraphemes(string));
|
|
7
|
-
var memoizedGetGraphemes = memoize(getGraphemes);
|
|
8
5
|
function useTextFieldWithGraphemes({ maxGraphemeCount, value: controlledValue, defaultValue = "", onValueChange }) {
|
|
9
6
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
10
7
|
const isControlled = controlledValue !== void 0;
|
|
11
8
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
12
|
-
const graphemes = useMemo(() =>
|
|
9
|
+
const graphemes = useMemo(() => collectGraphemes(value), [value]);
|
|
13
10
|
return {
|
|
14
11
|
textFieldRootProps: {
|
|
15
12
|
value,
|
|
16
13
|
onValueChange: useCallback((newValue) => {
|
|
17
|
-
const newGraphemes =
|
|
14
|
+
const newGraphemes = collectGraphemes(newValue);
|
|
18
15
|
const newSlicedGraphemes = maxGraphemeCount === void 0 ? newGraphemes : newGraphemes.slice(0, maxGraphemeCount);
|
|
19
16
|
const newSlicedValue = newSlicedGraphemes.join("");
|
|
20
17
|
if (!isControlled) setUncontrolledValue(newValue);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@seed-design/react-checkbox": "^2.0.1",
|
|
50
50
|
"@seed-design/react-collapsible": "^1.0.1",
|
|
51
51
|
"@seed-design/react-dialog": "^2.0.3",
|
|
52
|
-
"@seed-design/react-date-picker": "^1.
|
|
53
|
-
"@seed-design/react-drawer": "^2.0.
|
|
52
|
+
"@seed-design/react-date-picker": "^1.1.0",
|
|
53
|
+
"@seed-design/react-drawer": "^2.0.6",
|
|
54
54
|
"@seed-design/react-field": "^2.0.1",
|
|
55
55
|
"@seed-design/react-field-button": "^2.0.1",
|
|
56
56
|
"@seed-design/react-fieldset": "^1.0.1",
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"@seed-design/react-tooltip": "^1.0.1",
|
|
80
80
|
"@seed-design/react-wheel-picker": "^1.0.0",
|
|
81
81
|
"clsx": "^2.1.1",
|
|
82
|
-
"unicode-segmenter": "^0.
|
|
82
|
+
"unicode-segmenter": "^0.17.3"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"@seed-design/css": "^2.
|
|
85
|
+
"@seed-design/css": "^2.5.0",
|
|
86
86
|
"react": ">=18.0.0",
|
|
87
87
|
"react-dom": ">=18.0.0"
|
|
88
88
|
},
|
|
@@ -102,6 +102,56 @@ describe("DatePicker", () => {
|
|
|
102
102
|
expect(onValueChange).not.toHaveBeenCalled();
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
it("읽기 전용 Range 시작일의 상태와 접근성 이름을 노출하고 값 변경을 막는다", () => {
|
|
106
|
+
const onValueChange = mock(() => {});
|
|
107
|
+
const { getByRole } = render(
|
|
108
|
+
<DatePicker
|
|
109
|
+
{...commonProps}
|
|
110
|
+
selectionMode="range"
|
|
111
|
+
rangeStartReadOnly
|
|
112
|
+
defaultValue={{
|
|
113
|
+
start: { year: 2026, month: 7, day: 7 },
|
|
114
|
+
end: { year: 2026, month: 7, day: 9 },
|
|
115
|
+
}}
|
|
116
|
+
onValueChange={onValueChange}
|
|
117
|
+
/>,
|
|
118
|
+
);
|
|
119
|
+
const start = getByRole("button", { name: /2026년 7월 7일.*읽기 전용 시작일/ });
|
|
120
|
+
|
|
121
|
+
expect(start).toHaveAttribute("data-range-start-readonly");
|
|
122
|
+
expect(start.closest('[role="gridcell"]')).toHaveAttribute("data-range-start-readonly");
|
|
123
|
+
expect(start).toHaveAttribute("aria-disabled", "true");
|
|
124
|
+
expect(start).not.toBeDisabled();
|
|
125
|
+
|
|
126
|
+
fireEvent.click(start);
|
|
127
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
128
|
+
|
|
129
|
+
fireEvent.click(getByRole("button", { name: /2026년 7월 12일/ }));
|
|
130
|
+
expect(onValueChange).toHaveBeenCalledWith({
|
|
131
|
+
start: { year: 2026, month: 7, day: 7 },
|
|
132
|
+
end: { year: 2026, month: 7, day: 12 },
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("날짜 셀 render prop에 읽기 전용 Range 시작일 상태를 전달한다", () => {
|
|
137
|
+
const { getByRole } = render(
|
|
138
|
+
<DatePicker
|
|
139
|
+
{...commonProps}
|
|
140
|
+
selectionMode="range"
|
|
141
|
+
rangeStartReadOnly
|
|
142
|
+
defaultValue={{ start: { year: 2026, month: 7, day: 7 } }}
|
|
143
|
+
renderDateCellSupplement={({ isRangeStartReadOnly }) => (
|
|
144
|
+
<span>{isRangeStartReadOnly ? "고정" : "변경 가능"}</span>
|
|
145
|
+
)}
|
|
146
|
+
/>,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
expect(getByRole("button", { name: /2026년 7월 7일.*읽기 전용 시작일/ })).toHaveTextContent(
|
|
150
|
+
"고정",
|
|
151
|
+
);
|
|
152
|
+
expect(getByRole("button", { name: /2026년 7월 8일/ })).toHaveTextContent("변경 가능");
|
|
153
|
+
});
|
|
154
|
+
|
|
105
155
|
it("월·연도 제목을 누르면 Wheel Picker로 전환한다", () => {
|
|
106
156
|
const { getByRole, getAllByRole, queryByRole } = render(<DatePicker {...commonProps} />);
|
|
107
157
|
|
|
@@ -100,13 +100,7 @@ const NavigationChevronIcon = React.forwardRef<SVGSVGElement, NavigationChevronI
|
|
|
100
100
|
: "M17.2069 13.0704C16.9212 13.3703 16.9328 13.8451 17.2327 14.1307L23.4125 20.0166L17.2328 25.9017C16.9328 26.1873 16.9212 26.6621 17.2069 26.962C17.4925 27.262 17.9673 27.2736 18.2672 26.9879L25.0172 20.5598C25.1659 20.4182 25.25 20.2219 25.25 20.0167C25.25 19.8114 25.1659 19.6151 25.0173 19.4736L18.2673 13.0446C17.9673 12.7589 17.4926 12.7704 17.2069 13.0704Z";
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
|
-
<svg
|
|
104
|
-
ref={ref}
|
|
105
|
-
{...props}
|
|
106
|
-
viewBox="8 8 24 24"
|
|
107
|
-
fill="none"
|
|
108
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
109
|
-
>
|
|
103
|
+
<svg ref={ref} {...props} viewBox="8 8 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
110
104
|
<path fillRule="evenodd" clipRule="evenodd" d={path} fill="currentColor" />
|
|
111
105
|
</svg>
|
|
112
106
|
);
|
|
@@ -120,13 +114,7 @@ type HeaderChevronIconProps = React.SVGProps<SVGSVGElement> & {
|
|
|
120
114
|
|
|
121
115
|
const HeaderChevronIcon = React.forwardRef<SVGSVGElement, HeaderChevronIconProps>(
|
|
122
116
|
({ expanded, ...props }, ref) => (
|
|
123
|
-
<svg
|
|
124
|
-
ref={ref}
|
|
125
|
-
{...props}
|
|
126
|
-
viewBox="0 0 20 20"
|
|
127
|
-
fill="none"
|
|
128
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
129
|
-
>
|
|
117
|
+
<svg ref={ref} {...props} viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
130
118
|
<path
|
|
131
119
|
fillRule="evenodd"
|
|
132
120
|
clipRule="evenodd"
|
|
@@ -424,6 +412,7 @@ const DatePickerImplementation = React.forwardRef<HTMLDivElement, DatePickerImpl
|
|
|
424
412
|
constraints: _constraints,
|
|
425
413
|
disabled: _disabled,
|
|
426
414
|
readOnly: _readOnly,
|
|
415
|
+
rangeStartReadOnly: _rangeStartReadOnly,
|
|
427
416
|
ariaLabels: _ariaLabels,
|
|
428
417
|
className,
|
|
429
418
|
"aria-label": ariaLabel,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState, useMemo, useCallback } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { memoize } from "./memoize";
|
|
2
|
+
import { collectGraphemes } from "unicode-segmenter/grapheme";
|
|
4
3
|
|
|
5
4
|
export interface UseTextFieldWithGraphemesParams {
|
|
6
5
|
maxGraphemeCount?: number;
|
|
@@ -14,9 +13,6 @@ export interface UseTextFieldWithGraphemesParams {
|
|
|
14
13
|
}) => void;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const getGraphemes = (string: string) => Array.from(splitGraphemes(string));
|
|
18
|
-
const memoizedGetGraphemes = memoize(getGraphemes);
|
|
19
|
-
|
|
20
16
|
export function useTextFieldWithGraphemes({
|
|
21
17
|
maxGraphemeCount,
|
|
22
18
|
value: controlledValue,
|
|
@@ -27,11 +23,11 @@ export function useTextFieldWithGraphemes({
|
|
|
27
23
|
const isControlled = controlledValue !== undefined;
|
|
28
24
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
29
25
|
|
|
30
|
-
const graphemes = useMemo(() =>
|
|
26
|
+
const graphemes = useMemo(() => collectGraphemes(value), [value]);
|
|
31
27
|
|
|
32
28
|
const handleValueChange = useCallback(
|
|
33
29
|
(newValue: string) => {
|
|
34
|
-
const newGraphemes =
|
|
30
|
+
const newGraphemes = collectGraphemes(newValue);
|
|
35
31
|
const newSlicedGraphemes =
|
|
36
32
|
maxGraphemeCount === undefined ? newGraphemes : newGraphemes.slice(0, maxGraphemeCount);
|
|
37
33
|
const newSlicedValue = newSlicedGraphemes.join("");
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
//#region src/components/TextField/memoize.ts
|
|
3
|
-
function memoize(fn) {
|
|
4
|
-
const cache = /* @__PURE__ */ new Map();
|
|
5
|
-
return (arg) => {
|
|
6
|
-
if (cache.has(arg)) return cache.get(arg);
|
|
7
|
-
const result = fn(arg);
|
|
8
|
-
cache.set(arg, result);
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.memoize = memoize;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/memoize.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAanF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
//#region src/components/TextField/memoize.ts
|
|
3
|
-
function memoize(fn) {
|
|
4
|
-
const cache = /* @__PURE__ */ new Map();
|
|
5
|
-
return (arg) => {
|
|
6
|
-
if (cache.has(arg)) return cache.get(arg);
|
|
7
|
-
const result = fn(arg);
|
|
8
|
-
cache.set(arg, result);
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { memoize };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function memoize<Arg, Result>(fn: (arg: Arg) => Result): (arg: Arg) => Result {
|
|
2
|
-
const cache = new Map<Arg, Result>();
|
|
3
|
-
|
|
4
|
-
return (arg: Arg) => {
|
|
5
|
-
if (cache.has(arg)) {
|
|
6
|
-
return cache.get(arg) as Result;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const result = fn(arg);
|
|
10
|
-
cache.set(arg, result);
|
|
11
|
-
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
14
|
-
}
|