@openwebf/react-cupertino-ui 0.2.10 → 0.2.11
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/dist/index.d.mts +17 -85
- package/dist/index.d.ts +17 -85
- package/dist/index.js +2 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -35,7 +35,7 @@ interface FlutterCupertinoTimerPickerProps {
|
|
|
35
35
|
/**
|
|
36
36
|
* change event handler
|
|
37
37
|
*/
|
|
38
|
-
onChange?: (event: CustomEvent) => void;
|
|
38
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
39
39
|
/**
|
|
40
40
|
* HTML id attribute
|
|
41
41
|
*/
|
|
@@ -123,7 +123,7 @@ interface FlutterCupertinoTextareaProps {
|
|
|
123
123
|
/**
|
|
124
124
|
* input event handler
|
|
125
125
|
*/
|
|
126
|
-
onInput?: (event: CustomEvent) => void;
|
|
126
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
127
127
|
/**
|
|
128
128
|
* complete event handler
|
|
129
129
|
*/
|
|
@@ -219,7 +219,7 @@ interface FlutterCupertinoTabBarProps {
|
|
|
219
219
|
/**
|
|
220
220
|
* tabchange event handler
|
|
221
221
|
*/
|
|
222
|
-
onTabchange?: (event: CustomEvent) => void;
|
|
222
|
+
onTabchange?: (event: CustomEvent<number>) => void;
|
|
223
223
|
/**
|
|
224
224
|
* HTML id attribute
|
|
225
225
|
*/
|
|
@@ -331,7 +331,7 @@ interface FlutterCupertinoTabProps {
|
|
|
331
331
|
/**
|
|
332
332
|
* change event handler
|
|
333
333
|
*/
|
|
334
|
-
onChange?: (event: CustomEvent) => void;
|
|
334
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
335
335
|
/**
|
|
336
336
|
* HTML id attribute
|
|
337
337
|
*/
|
|
@@ -437,7 +437,7 @@ interface FlutterCupertinoSwitchProps {
|
|
|
437
437
|
/**
|
|
438
438
|
* change event handler
|
|
439
439
|
*/
|
|
440
|
-
onChange?: (event: CustomEvent) => void;
|
|
440
|
+
onChange?: (event: CustomEvent<boolean>) => void;
|
|
441
441
|
/**
|
|
442
442
|
* HTML id attribute
|
|
443
443
|
*/
|
|
@@ -505,15 +505,15 @@ interface FlutterCupertinoSliderProps {
|
|
|
505
505
|
/**
|
|
506
506
|
* change event handler
|
|
507
507
|
*/
|
|
508
|
-
onChange?: (event: CustomEvent) => void;
|
|
508
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
509
509
|
/**
|
|
510
510
|
* changestart event handler
|
|
511
511
|
*/
|
|
512
|
-
onChangestart?: (event: CustomEvent) => void;
|
|
512
|
+
onChangestart?: (event: CustomEvent<number>) => void;
|
|
513
513
|
/**
|
|
514
514
|
* changeend event handler
|
|
515
515
|
*/
|
|
516
|
-
onChangeend?: (event: CustomEvent) => void;
|
|
516
|
+
onChangeend?: (event: CustomEvent<number>) => void;
|
|
517
517
|
/**
|
|
518
518
|
* HTML id attribute
|
|
519
519
|
*/
|
|
@@ -622,11 +622,11 @@ interface FlutterCupertinoSearchInputProps {
|
|
|
622
622
|
/**
|
|
623
623
|
* input event handler
|
|
624
624
|
*/
|
|
625
|
-
onInput?: (event: CustomEvent) => void;
|
|
625
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
626
626
|
/**
|
|
627
627
|
* search event handler
|
|
628
628
|
*/
|
|
629
|
-
onSearch?: (event: CustomEvent) => void;
|
|
629
|
+
onSearch?: (event: CustomEvent<string>) => void;
|
|
630
630
|
/**
|
|
631
631
|
* clear event handler
|
|
632
632
|
*/
|
|
@@ -723,7 +723,7 @@ interface FlutterCupertinoRadioProps {
|
|
|
723
723
|
/**
|
|
724
724
|
* change event handler
|
|
725
725
|
*/
|
|
726
|
-
onChange?: (event: CustomEvent) => void;
|
|
726
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
727
727
|
/**
|
|
728
728
|
* HTML id attribute
|
|
729
729
|
*/
|
|
@@ -776,7 +776,7 @@ interface FlutterCupertinoPickerProps {
|
|
|
776
776
|
/**
|
|
777
777
|
* change event handler
|
|
778
778
|
*/
|
|
779
|
-
onChange?: (event: CustomEvent) => void;
|
|
779
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
780
780
|
/**
|
|
781
781
|
* HTML id attribute
|
|
782
782
|
*/
|
|
@@ -943,11 +943,11 @@ interface FlutterCupertinoInputProps {
|
|
|
943
943
|
/**
|
|
944
944
|
* input event handler
|
|
945
945
|
*/
|
|
946
|
-
onInput?: (event: CustomEvent) => void;
|
|
946
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
947
947
|
/**
|
|
948
948
|
* submit event handler
|
|
949
949
|
*/
|
|
950
|
-
onSubmit?: (event: CustomEvent) => void;
|
|
950
|
+
onSubmit?: (event: CustomEvent<string>) => void;
|
|
951
951
|
/**
|
|
952
952
|
* HTML id attribute
|
|
953
953
|
*/
|
|
@@ -1113,7 +1113,7 @@ interface FlutterCupertinoDatePickerProps {
|
|
|
1113
1113
|
/**
|
|
1114
1114
|
* change event handler
|
|
1115
1115
|
*/
|
|
1116
|
-
onChange?: (event: CustomEvent) => void;
|
|
1116
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* HTML id attribute
|
|
1119
1119
|
*/
|
|
@@ -1258,7 +1258,7 @@ interface FlutterCupertinoCheckboxProps {
|
|
|
1258
1258
|
/**
|
|
1259
1259
|
* change event handler
|
|
1260
1260
|
*/
|
|
1261
|
-
onChange?: (event: CustomEvent) => void;
|
|
1261
|
+
onChange?: (event: CustomEvent<boolean>) => void;
|
|
1262
1262
|
/**
|
|
1263
1263
|
* HTML id attribute
|
|
1264
1264
|
*/
|
|
@@ -1360,72 +1360,4 @@ declare const FlutterCupertinoButton: React.ForwardRefExoticComponent<FlutterCup
|
|
|
1360
1360
|
children?: React.ReactNode;
|
|
1361
1361
|
} & React.RefAttributes<FlutterCupertinoButtonElement>>;
|
|
1362
1362
|
|
|
1363
|
-
|
|
1364
|
-
* @license
|
|
1365
|
-
* Copyright 2018 Google LLC
|
|
1366
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1367
|
-
*/
|
|
1368
|
-
|
|
1369
|
-
type DistributiveOmit<T, K extends string | number | symbol> = T extends any ? (K extends keyof T ? Omit<T, K> : T) : T;
|
|
1370
|
-
type PropsWithoutRef<T> = DistributiveOmit<T, 'ref'>;
|
|
1371
|
-
/**
|
|
1372
|
-
* Type of the React component wrapping the web component. This is the return
|
|
1373
|
-
* type of `createComponent`.
|
|
1374
|
-
*/
|
|
1375
|
-
type ReactWebComponent<I extends HTMLElement, E extends EventNames = {}> = React.ForwardRefExoticComponent<PropsWithoutRef<ComponentProps<I, E>> & React.RefAttributes<I>>;
|
|
1376
|
-
type ElementProps<I> = Partial<Omit<I, keyof HTMLElement>>;
|
|
1377
|
-
type ComponentProps<I, E extends EventNames = {}> = Omit<React.HTMLAttributes<I>, keyof E | keyof ElementProps<I>> & ElementProps<I>;
|
|
1378
|
-
/**
|
|
1379
|
-
* Type used to cast an event name with an event type when providing the
|
|
1380
|
-
* `events` option to `createComponent` for better typing of the event handler
|
|
1381
|
-
* prop.
|
|
1382
|
-
*
|
|
1383
|
-
* Example:
|
|
1384
|
-
*
|
|
1385
|
-
* ```ts
|
|
1386
|
-
* const FooComponent = createComponent({
|
|
1387
|
-
* ...
|
|
1388
|
-
* events: {
|
|
1389
|
-
* onfoo: 'foo' as EventName<FooEvent>,
|
|
1390
|
-
* }
|
|
1391
|
-
* });
|
|
1392
|
-
* ```
|
|
1393
|
-
*
|
|
1394
|
-
* `onfoo` prop will have the type `(e: FooEvent) => void`.
|
|
1395
|
-
*/
|
|
1396
|
-
type EventName<T extends Event = Event> = string & {
|
|
1397
|
-
__eventType: T;
|
|
1398
|
-
};
|
|
1399
|
-
type EventNames = Record<string, EventName | string>;
|
|
1400
|
-
interface Options<E extends EventNames = {}> {
|
|
1401
|
-
tagName: string;
|
|
1402
|
-
events?: E;
|
|
1403
|
-
displayName?: string;
|
|
1404
|
-
}
|
|
1405
|
-
/**
|
|
1406
|
-
* Creates a React component for a custom element. Properties are distinguished
|
|
1407
|
-
* from attributes automatically, and events can be configured so they are added
|
|
1408
|
-
* to the custom element as event listeners.
|
|
1409
|
-
*
|
|
1410
|
-
* @param options An options bag containing the parameters needed to generate a
|
|
1411
|
-
* wrapped web component.
|
|
1412
|
-
*
|
|
1413
|
-
* @param options.react The React module, typically imported from the `react`
|
|
1414
|
-
* npm package.
|
|
1415
|
-
* @param options.tagName The custom element tag name registered via
|
|
1416
|
-
* `customElements.define`.
|
|
1417
|
-
* @param options.elementClass The custom element class registered via
|
|
1418
|
-
* `customElements.define`.
|
|
1419
|
-
* @param options.events An object listing events to which the component can
|
|
1420
|
-
* listen. The object keys are the event property names passed in via React
|
|
1421
|
-
* props and the object values are the names of the corresponding events
|
|
1422
|
-
* generated by the custom element. For example, given `{onactivate:
|
|
1423
|
-
* 'activate'}` an event function may be passed via the component's `onactivate`
|
|
1424
|
-
* prop and will be called when the custom element fires its `activate` event.
|
|
1425
|
-
* @param options.displayName A React component display name, used in debugging
|
|
1426
|
-
* messages. Default value is inferred from the name of custom element class
|
|
1427
|
-
* registered via `customElements.define`.
|
|
1428
|
-
*/
|
|
1429
|
-
declare const createComponent: <E extends any, I extends any>({ tagName, events, displayName }: Options) => ReactWebComponent<E, I>;
|
|
1430
|
-
|
|
1431
|
-
export { FlutterCupertinoButton, type FlutterCupertinoButtonElement, FlutterCupertinoCheckbox, type FlutterCupertinoCheckboxElement, FlutterCupertinoContextMenu, type FlutterCupertinoContextMenuElement, FlutterCupertinoDatePicker, type FlutterCupertinoDatePickerElement, FlutterCupertinoIcon, type FlutterCupertinoIconElement, FlutterCupertinoInput, type FlutterCupertinoInputElement, FlutterCupertinoModalPopup, type FlutterCupertinoModalPopupElement, FlutterCupertinoPicker, type FlutterCupertinoPickerElement, FlutterCupertinoRadio, type FlutterCupertinoRadioElement, FlutterCupertinoSearchInput, type FlutterCupertinoSearchInputElement, FlutterCupertinoSlider, type FlutterCupertinoSliderElement, FlutterCupertinoSwitch, type FlutterCupertinoSwitchElement, FlutterCupertinoTab, FlutterCupertinoTabBar, type FlutterCupertinoTabBarElement, FlutterCupertinoTabBarItem, type FlutterCupertinoTabBarItemElement, type FlutterCupertinoTabElement, FlutterCupertinoTabItem, type FlutterCupertinoTabItemElement, FlutterCupertinoTextarea, type FlutterCupertinoTextareaElement, FlutterCupertinoTimerPicker, type FlutterCupertinoTimerPickerElement, createComponent };
|
|
1363
|
+
export { FlutterCupertinoButton, type FlutterCupertinoButtonElement, FlutterCupertinoCheckbox, type FlutterCupertinoCheckboxElement, FlutterCupertinoContextMenu, type FlutterCupertinoContextMenuElement, FlutterCupertinoDatePicker, type FlutterCupertinoDatePickerElement, FlutterCupertinoIcon, type FlutterCupertinoIconElement, FlutterCupertinoInput, type FlutterCupertinoInputElement, FlutterCupertinoModalPopup, type FlutterCupertinoModalPopupElement, FlutterCupertinoPicker, type FlutterCupertinoPickerElement, FlutterCupertinoRadio, type FlutterCupertinoRadioElement, FlutterCupertinoSearchInput, type FlutterCupertinoSearchInputElement, FlutterCupertinoSlider, type FlutterCupertinoSliderElement, FlutterCupertinoSwitch, type FlutterCupertinoSwitchElement, FlutterCupertinoTab, FlutterCupertinoTabBar, type FlutterCupertinoTabBarElement, FlutterCupertinoTabBarItem, type FlutterCupertinoTabBarItemElement, type FlutterCupertinoTabElement, FlutterCupertinoTabItem, type FlutterCupertinoTabItemElement, FlutterCupertinoTextarea, type FlutterCupertinoTextareaElement, FlutterCupertinoTimerPicker, type FlutterCupertinoTimerPickerElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface FlutterCupertinoTimerPickerProps {
|
|
|
35
35
|
/**
|
|
36
36
|
* change event handler
|
|
37
37
|
*/
|
|
38
|
-
onChange?: (event: CustomEvent) => void;
|
|
38
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
39
39
|
/**
|
|
40
40
|
* HTML id attribute
|
|
41
41
|
*/
|
|
@@ -123,7 +123,7 @@ interface FlutterCupertinoTextareaProps {
|
|
|
123
123
|
/**
|
|
124
124
|
* input event handler
|
|
125
125
|
*/
|
|
126
|
-
onInput?: (event: CustomEvent) => void;
|
|
126
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
127
127
|
/**
|
|
128
128
|
* complete event handler
|
|
129
129
|
*/
|
|
@@ -219,7 +219,7 @@ interface FlutterCupertinoTabBarProps {
|
|
|
219
219
|
/**
|
|
220
220
|
* tabchange event handler
|
|
221
221
|
*/
|
|
222
|
-
onTabchange?: (event: CustomEvent) => void;
|
|
222
|
+
onTabchange?: (event: CustomEvent<number>) => void;
|
|
223
223
|
/**
|
|
224
224
|
* HTML id attribute
|
|
225
225
|
*/
|
|
@@ -331,7 +331,7 @@ interface FlutterCupertinoTabProps {
|
|
|
331
331
|
/**
|
|
332
332
|
* change event handler
|
|
333
333
|
*/
|
|
334
|
-
onChange?: (event: CustomEvent) => void;
|
|
334
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
335
335
|
/**
|
|
336
336
|
* HTML id attribute
|
|
337
337
|
*/
|
|
@@ -437,7 +437,7 @@ interface FlutterCupertinoSwitchProps {
|
|
|
437
437
|
/**
|
|
438
438
|
* change event handler
|
|
439
439
|
*/
|
|
440
|
-
onChange?: (event: CustomEvent) => void;
|
|
440
|
+
onChange?: (event: CustomEvent<boolean>) => void;
|
|
441
441
|
/**
|
|
442
442
|
* HTML id attribute
|
|
443
443
|
*/
|
|
@@ -505,15 +505,15 @@ interface FlutterCupertinoSliderProps {
|
|
|
505
505
|
/**
|
|
506
506
|
* change event handler
|
|
507
507
|
*/
|
|
508
|
-
onChange?: (event: CustomEvent) => void;
|
|
508
|
+
onChange?: (event: CustomEvent<number>) => void;
|
|
509
509
|
/**
|
|
510
510
|
* changestart event handler
|
|
511
511
|
*/
|
|
512
|
-
onChangestart?: (event: CustomEvent) => void;
|
|
512
|
+
onChangestart?: (event: CustomEvent<number>) => void;
|
|
513
513
|
/**
|
|
514
514
|
* changeend event handler
|
|
515
515
|
*/
|
|
516
|
-
onChangeend?: (event: CustomEvent) => void;
|
|
516
|
+
onChangeend?: (event: CustomEvent<number>) => void;
|
|
517
517
|
/**
|
|
518
518
|
* HTML id attribute
|
|
519
519
|
*/
|
|
@@ -622,11 +622,11 @@ interface FlutterCupertinoSearchInputProps {
|
|
|
622
622
|
/**
|
|
623
623
|
* input event handler
|
|
624
624
|
*/
|
|
625
|
-
onInput?: (event: CustomEvent) => void;
|
|
625
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
626
626
|
/**
|
|
627
627
|
* search event handler
|
|
628
628
|
*/
|
|
629
|
-
onSearch?: (event: CustomEvent) => void;
|
|
629
|
+
onSearch?: (event: CustomEvent<string>) => void;
|
|
630
630
|
/**
|
|
631
631
|
* clear event handler
|
|
632
632
|
*/
|
|
@@ -723,7 +723,7 @@ interface FlutterCupertinoRadioProps {
|
|
|
723
723
|
/**
|
|
724
724
|
* change event handler
|
|
725
725
|
*/
|
|
726
|
-
onChange?: (event: CustomEvent) => void;
|
|
726
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
727
727
|
/**
|
|
728
728
|
* HTML id attribute
|
|
729
729
|
*/
|
|
@@ -776,7 +776,7 @@ interface FlutterCupertinoPickerProps {
|
|
|
776
776
|
/**
|
|
777
777
|
* change event handler
|
|
778
778
|
*/
|
|
779
|
-
onChange?: (event: CustomEvent) => void;
|
|
779
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
780
780
|
/**
|
|
781
781
|
* HTML id attribute
|
|
782
782
|
*/
|
|
@@ -943,11 +943,11 @@ interface FlutterCupertinoInputProps {
|
|
|
943
943
|
/**
|
|
944
944
|
* input event handler
|
|
945
945
|
*/
|
|
946
|
-
onInput?: (event: CustomEvent) => void;
|
|
946
|
+
onInput?: (event: CustomEvent<string>) => void;
|
|
947
947
|
/**
|
|
948
948
|
* submit event handler
|
|
949
949
|
*/
|
|
950
|
-
onSubmit?: (event: CustomEvent) => void;
|
|
950
|
+
onSubmit?: (event: CustomEvent<string>) => void;
|
|
951
951
|
/**
|
|
952
952
|
* HTML id attribute
|
|
953
953
|
*/
|
|
@@ -1113,7 +1113,7 @@ interface FlutterCupertinoDatePickerProps {
|
|
|
1113
1113
|
/**
|
|
1114
1114
|
* change event handler
|
|
1115
1115
|
*/
|
|
1116
|
-
onChange?: (event: CustomEvent) => void;
|
|
1116
|
+
onChange?: (event: CustomEvent<string>) => void;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* HTML id attribute
|
|
1119
1119
|
*/
|
|
@@ -1258,7 +1258,7 @@ interface FlutterCupertinoCheckboxProps {
|
|
|
1258
1258
|
/**
|
|
1259
1259
|
* change event handler
|
|
1260
1260
|
*/
|
|
1261
|
-
onChange?: (event: CustomEvent) => void;
|
|
1261
|
+
onChange?: (event: CustomEvent<boolean>) => void;
|
|
1262
1262
|
/**
|
|
1263
1263
|
* HTML id attribute
|
|
1264
1264
|
*/
|
|
@@ -1360,72 +1360,4 @@ declare const FlutterCupertinoButton: React.ForwardRefExoticComponent<FlutterCup
|
|
|
1360
1360
|
children?: React.ReactNode;
|
|
1361
1361
|
} & React.RefAttributes<FlutterCupertinoButtonElement>>;
|
|
1362
1362
|
|
|
1363
|
-
|
|
1364
|
-
* @license
|
|
1365
|
-
* Copyright 2018 Google LLC
|
|
1366
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1367
|
-
*/
|
|
1368
|
-
|
|
1369
|
-
type DistributiveOmit<T, K extends string | number | symbol> = T extends any ? (K extends keyof T ? Omit<T, K> : T) : T;
|
|
1370
|
-
type PropsWithoutRef<T> = DistributiveOmit<T, 'ref'>;
|
|
1371
|
-
/**
|
|
1372
|
-
* Type of the React component wrapping the web component. This is the return
|
|
1373
|
-
* type of `createComponent`.
|
|
1374
|
-
*/
|
|
1375
|
-
type ReactWebComponent<I extends HTMLElement, E extends EventNames = {}> = React.ForwardRefExoticComponent<PropsWithoutRef<ComponentProps<I, E>> & React.RefAttributes<I>>;
|
|
1376
|
-
type ElementProps<I> = Partial<Omit<I, keyof HTMLElement>>;
|
|
1377
|
-
type ComponentProps<I, E extends EventNames = {}> = Omit<React.HTMLAttributes<I>, keyof E | keyof ElementProps<I>> & ElementProps<I>;
|
|
1378
|
-
/**
|
|
1379
|
-
* Type used to cast an event name with an event type when providing the
|
|
1380
|
-
* `events` option to `createComponent` for better typing of the event handler
|
|
1381
|
-
* prop.
|
|
1382
|
-
*
|
|
1383
|
-
* Example:
|
|
1384
|
-
*
|
|
1385
|
-
* ```ts
|
|
1386
|
-
* const FooComponent = createComponent({
|
|
1387
|
-
* ...
|
|
1388
|
-
* events: {
|
|
1389
|
-
* onfoo: 'foo' as EventName<FooEvent>,
|
|
1390
|
-
* }
|
|
1391
|
-
* });
|
|
1392
|
-
* ```
|
|
1393
|
-
*
|
|
1394
|
-
* `onfoo` prop will have the type `(e: FooEvent) => void`.
|
|
1395
|
-
*/
|
|
1396
|
-
type EventName<T extends Event = Event> = string & {
|
|
1397
|
-
__eventType: T;
|
|
1398
|
-
};
|
|
1399
|
-
type EventNames = Record<string, EventName | string>;
|
|
1400
|
-
interface Options<E extends EventNames = {}> {
|
|
1401
|
-
tagName: string;
|
|
1402
|
-
events?: E;
|
|
1403
|
-
displayName?: string;
|
|
1404
|
-
}
|
|
1405
|
-
/**
|
|
1406
|
-
* Creates a React component for a custom element. Properties are distinguished
|
|
1407
|
-
* from attributes automatically, and events can be configured so they are added
|
|
1408
|
-
* to the custom element as event listeners.
|
|
1409
|
-
*
|
|
1410
|
-
* @param options An options bag containing the parameters needed to generate a
|
|
1411
|
-
* wrapped web component.
|
|
1412
|
-
*
|
|
1413
|
-
* @param options.react The React module, typically imported from the `react`
|
|
1414
|
-
* npm package.
|
|
1415
|
-
* @param options.tagName The custom element tag name registered via
|
|
1416
|
-
* `customElements.define`.
|
|
1417
|
-
* @param options.elementClass The custom element class registered via
|
|
1418
|
-
* `customElements.define`.
|
|
1419
|
-
* @param options.events An object listing events to which the component can
|
|
1420
|
-
* listen. The object keys are the event property names passed in via React
|
|
1421
|
-
* props and the object values are the names of the corresponding events
|
|
1422
|
-
* generated by the custom element. For example, given `{onactivate:
|
|
1423
|
-
* 'activate'}` an event function may be passed via the component's `onactivate`
|
|
1424
|
-
* prop and will be called when the custom element fires its `activate` event.
|
|
1425
|
-
* @param options.displayName A React component display name, used in debugging
|
|
1426
|
-
* messages. Default value is inferred from the name of custom element class
|
|
1427
|
-
* registered via `customElements.define`.
|
|
1428
|
-
*/
|
|
1429
|
-
declare const createComponent: <E extends any, I extends any>({ tagName, events, displayName }: Options) => ReactWebComponent<E, I>;
|
|
1430
|
-
|
|
1431
|
-
export { FlutterCupertinoButton, type FlutterCupertinoButtonElement, FlutterCupertinoCheckbox, type FlutterCupertinoCheckboxElement, FlutterCupertinoContextMenu, type FlutterCupertinoContextMenuElement, FlutterCupertinoDatePicker, type FlutterCupertinoDatePickerElement, FlutterCupertinoIcon, type FlutterCupertinoIconElement, FlutterCupertinoInput, type FlutterCupertinoInputElement, FlutterCupertinoModalPopup, type FlutterCupertinoModalPopupElement, FlutterCupertinoPicker, type FlutterCupertinoPickerElement, FlutterCupertinoRadio, type FlutterCupertinoRadioElement, FlutterCupertinoSearchInput, type FlutterCupertinoSearchInputElement, FlutterCupertinoSlider, type FlutterCupertinoSliderElement, FlutterCupertinoSwitch, type FlutterCupertinoSwitchElement, FlutterCupertinoTab, FlutterCupertinoTabBar, type FlutterCupertinoTabBarElement, FlutterCupertinoTabBarItem, type FlutterCupertinoTabBarItemElement, type FlutterCupertinoTabElement, FlutterCupertinoTabItem, type FlutterCupertinoTabItemElement, FlutterCupertinoTextarea, type FlutterCupertinoTextareaElement, FlutterCupertinoTimerPicker, type FlutterCupertinoTimerPickerElement, createComponent };
|
|
1363
|
+
export { FlutterCupertinoButton, type FlutterCupertinoButtonElement, FlutterCupertinoCheckbox, type FlutterCupertinoCheckboxElement, FlutterCupertinoContextMenu, type FlutterCupertinoContextMenuElement, FlutterCupertinoDatePicker, type FlutterCupertinoDatePickerElement, FlutterCupertinoIcon, type FlutterCupertinoIconElement, FlutterCupertinoInput, type FlutterCupertinoInputElement, FlutterCupertinoModalPopup, type FlutterCupertinoModalPopupElement, FlutterCupertinoPicker, type FlutterCupertinoPickerElement, FlutterCupertinoRadio, type FlutterCupertinoRadioElement, FlutterCupertinoSearchInput, type FlutterCupertinoSearchInputElement, FlutterCupertinoSlider, type FlutterCupertinoSliderElement, FlutterCupertinoSwitch, type FlutterCupertinoSwitchElement, FlutterCupertinoTab, FlutterCupertinoTabBar, type FlutterCupertinoTabBarElement, FlutterCupertinoTabBarItem, type FlutterCupertinoTabBarItemElement, type FlutterCupertinoTabElement, FlutterCupertinoTabItem, type FlutterCupertinoTabItemElement, FlutterCupertinoTextarea, type FlutterCupertinoTextareaElement, FlutterCupertinoTimerPicker, type FlutterCupertinoTimerPickerElement };
|
package/dist/index.js
CHANGED
|
@@ -37,8 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
FlutterCupertinoTabBarItem: () => FlutterCupertinoTabBarItem,
|
|
38
38
|
FlutterCupertinoTabItem: () => FlutterCupertinoTabItem,
|
|
39
39
|
FlutterCupertinoTextarea: () => FlutterCupertinoTextarea,
|
|
40
|
-
FlutterCupertinoTimerPicker: () => FlutterCupertinoTimerPicker
|
|
41
|
-
createComponent: () => createComponent
|
|
40
|
+
FlutterCupertinoTimerPicker: () => FlutterCupertinoTimerPicker
|
|
42
41
|
});
|
|
43
42
|
module.exports = __toCommonJS(index_exports);
|
|
44
43
|
|
|
@@ -650,108 +649,6 @@ var FlutterCupertinoButton = (0, import_react_core_ui16.createWebFComponent)({
|
|
|
650
649
|
// Add default values here
|
|
651
650
|
}
|
|
652
651
|
});
|
|
653
|
-
|
|
654
|
-
// src/utils/createComponent.ts
|
|
655
|
-
var import_react = require("react");
|
|
656
|
-
var NODE_MODE = false;
|
|
657
|
-
var reservedReactProperties = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]);
|
|
658
|
-
var listenedEvents = /* @__PURE__ */ new WeakMap();
|
|
659
|
-
var addOrUpdateEventListener = (node, event, listener) => {
|
|
660
|
-
let events = listenedEvents.get(node);
|
|
661
|
-
if (events === void 0) {
|
|
662
|
-
listenedEvents.set(node, events = /* @__PURE__ */ new Map());
|
|
663
|
-
}
|
|
664
|
-
let handler = events.get(event);
|
|
665
|
-
if (listener !== void 0) {
|
|
666
|
-
if (handler === void 0) {
|
|
667
|
-
events.set(event, handler = { handleEvent: listener });
|
|
668
|
-
node.addEventListener(event, handler);
|
|
669
|
-
} else {
|
|
670
|
-
handler.handleEvent = listener;
|
|
671
|
-
}
|
|
672
|
-
} else if (handler !== void 0) {
|
|
673
|
-
events.delete(event);
|
|
674
|
-
node.removeEventListener(event, handler);
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
var setProperty = (node, name, value, old, events) => {
|
|
678
|
-
const event = events?.[name];
|
|
679
|
-
if (event !== void 0) {
|
|
680
|
-
if (value !== old) {
|
|
681
|
-
addOrUpdateEventListener(node, event, value);
|
|
682
|
-
}
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
node[name] = value;
|
|
686
|
-
if ((value === void 0 || value === null) && name in HTMLElement.prototype) {
|
|
687
|
-
node.removeAttribute(name);
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
var createComponent = ({
|
|
691
|
-
tagName,
|
|
692
|
-
events,
|
|
693
|
-
displayName
|
|
694
|
-
}) => {
|
|
695
|
-
const eventProps = new Set(Object.keys(events ?? {}));
|
|
696
|
-
const ReactComponent = (0, import_react.forwardRef)((props, ref) => {
|
|
697
|
-
const prevElemPropsRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
698
|
-
const elementRef = (0, import_react.useRef)(null);
|
|
699
|
-
const reactProps = {};
|
|
700
|
-
const elementProps = {};
|
|
701
|
-
for (const [k, v] of Object.entries(props)) {
|
|
702
|
-
if (reservedReactProperties.has(k)) {
|
|
703
|
-
reactProps[k === "className" ? "class" : k] = v;
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
if (eventProps.has(k)) {
|
|
707
|
-
elementProps[k] = v;
|
|
708
|
-
continue;
|
|
709
|
-
}
|
|
710
|
-
reactProps[k] = v;
|
|
711
|
-
}
|
|
712
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
713
|
-
if (elementRef.current === null) {
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
const newElemProps = /* @__PURE__ */ new Map();
|
|
717
|
-
for (const key in elementProps) {
|
|
718
|
-
setProperty(elementRef.current, key, props[key], prevElemPropsRef.current.get(key), events);
|
|
719
|
-
prevElemPropsRef.current.delete(key);
|
|
720
|
-
newElemProps.set(key, props[key]);
|
|
721
|
-
}
|
|
722
|
-
for (const [key, value] of prevElemPropsRef.current) {
|
|
723
|
-
setProperty(elementRef.current, key, void 0, value, events);
|
|
724
|
-
}
|
|
725
|
-
prevElemPropsRef.current = newElemProps;
|
|
726
|
-
});
|
|
727
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
728
|
-
elementRef.current?.removeAttribute("defer-hydration");
|
|
729
|
-
}, []);
|
|
730
|
-
if (NODE_MODE) {
|
|
731
|
-
if ((import_react.createElement.name === "litPatchedCreateElement" || globalThis.litSsrReactEnabled) && Object.keys(elementProps).length) {
|
|
732
|
-
reactProps["_$litProps$"] = elementProps;
|
|
733
|
-
}
|
|
734
|
-
} else {
|
|
735
|
-
reactProps["suppressHydrationWarning"] = true;
|
|
736
|
-
}
|
|
737
|
-
return (0, import_react.createElement)(tagName, {
|
|
738
|
-
...reactProps,
|
|
739
|
-
ref: (0, import_react.useCallback)(
|
|
740
|
-
(node) => {
|
|
741
|
-
elementRef.current = node;
|
|
742
|
-
if (typeof ref === "function") {
|
|
743
|
-
ref(node);
|
|
744
|
-
} else if (ref !== null) {
|
|
745
|
-
ref.current = node;
|
|
746
|
-
}
|
|
747
|
-
},
|
|
748
|
-
[ref]
|
|
749
|
-
)
|
|
750
|
-
});
|
|
751
|
-
});
|
|
752
|
-
ReactComponent.displayName = displayName;
|
|
753
|
-
return ReactComponent;
|
|
754
|
-
};
|
|
755
652
|
// Annotate the CommonJS export names for ESM import in node:
|
|
756
653
|
0 && (module.exports = {
|
|
757
654
|
FlutterCupertinoButton,
|
|
@@ -771,12 +668,6 @@ var createComponent = ({
|
|
|
771
668
|
FlutterCupertinoTabBarItem,
|
|
772
669
|
FlutterCupertinoTabItem,
|
|
773
670
|
FlutterCupertinoTextarea,
|
|
774
|
-
FlutterCupertinoTimerPicker
|
|
775
|
-
createComponent
|
|
671
|
+
FlutterCupertinoTimerPicker
|
|
776
672
|
});
|
|
777
|
-
/**
|
|
778
|
-
* @license
|
|
779
|
-
* Copyright 2018 Google LLC
|
|
780
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
781
|
-
*/
|
|
782
673
|
//# sourceMappingURL=index.js.map
|