@aracna/react 1.0.34 → 1.0.35

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,9 +1,11 @@
1
- import { PascalCase } from '@aracna/core';
2
1
  import type { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from 'react';
3
2
  export type ElementComponent<Element extends HTMLElement, Props extends HTMLAttributes<Element> = {}> = ForwardRefExoticComponent<Props>;
4
3
  export type ElementComponentAttributes = Record<string, any>;
5
4
  export type ElementComponentEvents = Record<string, any>;
6
5
  export type ElementComponentProps<Element extends HTMLElement, Attributes extends ElementComponentAttributes = ElementComponentAttributes, Events extends ElementComponentEvents = ElementComponentEvents> = HTMLAttributes<Element> & RefAttributes<Element> & Attributes & MapComponentEvents<Events>;
7
6
  export type MapComponentEvents<Events extends ElementComponentEvents> = {
8
- [key in keyof Events as key extends string ? `on${PascalCase<key>}` : key]?: (event: Events[key]) => any;
7
+ [key in keyof Events as key extends string ? `on${KebabToPascalCase<key>}` : key]?: (event: Events[key]) => any;
9
8
  };
9
+ type KebabToCamelCase<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamelCase<U>>}` : S;
10
+ type KebabToPascalCase<S extends string> = Capitalize<KebabToCamelCase<S>>;
11
+ export {};
package/index.d.ts CHANGED
@@ -357,7 +357,6 @@ import type { NavigationRailElementEventMap } from '@aracna/web';
357
357
  import type { NavigationRailItemElement } from '@aracna/web-components/elements/navigation/navigation-rail-element';
358
358
  import type { NavigationRailItemElementAttributes } from '@aracna/web';
359
359
  import type { NavigationRailItemElementEventMap } from '@aracna/web';
360
- import { PascalCase } from '@aracna/core';
361
360
  import type { RadioButtonElement } from '@aracna/web-components/elements/input/radio-group-element';
362
361
  import type { RadioButtonElementAttributes } from '@aracna/web';
363
362
  import type { RadioButtonElementEventMap } from '@aracna/web';
@@ -668,12 +667,16 @@ export declare type InputFileProps = ElementComponentProps<InputFileElement, Inp
668
667
 
669
668
  export declare type InputProps = ElementComponentProps<InputElement, InputElementAttributes, InputElementEventMap>;
670
669
 
670
+ declare type KebabToCamelCase<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamelCase<U>>}` : S;
671
+
672
+ declare type KebabToPascalCase<S extends string> = Capitalize<KebabToCamelCase<S>>;
673
+
671
674
  export declare type ListItemProps = ElementComponentProps<ListItemElement, ListItemElementAttributes, ListItemElementEventMap>;
672
675
 
673
676
  export declare type ListProps = ElementComponentProps<ListElement, ListElementAttributes, ListElementEventMap>;
674
677
 
675
678
  export declare type MapComponentEvents<Events extends ElementComponentEvents> = {
676
- [key in keyof Events as key extends string ? `on${PascalCase<key>}` : key]?: (event: Events[key]) => any;
679
+ [key in keyof Events as key extends string ? `on${KebabToPascalCase<key>}` : key]?: (event: Events[key]) => any;
677
680
  };
678
681
 
679
682
  export declare type MenuButtonProps = ElementComponentProps<MenuButtonElement, MenuButtonElementAttributes, MenuButtonElementEventMap>;
package/package.json CHANGED
@@ -47,7 +47,7 @@
47
47
  "sideEffects": false,
48
48
  "type": "module",
49
49
  "types": "index.d.ts",
50
- "version": "1.0.34",
50
+ "version": "1.0.35",
51
51
  "dependencies": {
52
52
  "@lit-labs/react": "^2.1.0"
53
53
  }