@joralvmel/cosmos-react 0.2.0 → 0.4.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.
Files changed (59) hide show
  1. package/README.md +47 -1
  2. package/dist/components/badge.d.ts +8 -0
  3. package/dist/components/badge.d.ts.map +1 -0
  4. package/dist/components/badge.js +14 -0
  5. package/dist/components/badge.js.map +1 -0
  6. package/dist/components/calendar.d.ts +20 -0
  7. package/dist/components/calendar.d.ts.map +1 -0
  8. package/dist/components/calendar.js +39 -0
  9. package/dist/components/calendar.js.map +1 -0
  10. package/dist/components/checkbox.d.ts +21 -0
  11. package/dist/components/checkbox.d.ts.map +1 -0
  12. package/dist/components/checkbox.js +39 -0
  13. package/dist/components/checkbox.js.map +1 -0
  14. package/dist/components/dialog.d.ts +24 -0
  15. package/dist/components/dialog.d.ts.map +1 -0
  16. package/dist/components/dialog.js +39 -0
  17. package/dist/components/dialog.js.map +1 -0
  18. package/dist/components/icon-button.d.ts +22 -0
  19. package/dist/components/icon-button.d.ts.map +1 -0
  20. package/dist/components/icon-button.js +39 -0
  21. package/dist/components/icon-button.js.map +1 -0
  22. package/dist/components/listbox.d.ts +22 -0
  23. package/dist/components/listbox.d.ts.map +1 -0
  24. package/dist/components/listbox.js +39 -0
  25. package/dist/components/listbox.js.map +1 -0
  26. package/dist/components/pagination.d.ts +21 -0
  27. package/dist/components/pagination.d.ts.map +1 -0
  28. package/dist/components/pagination.js +39 -0
  29. package/dist/components/pagination.js.map +1 -0
  30. package/dist/components/popover.d.ts +20 -0
  31. package/dist/components/popover.d.ts.map +1 -0
  32. package/dist/components/popover.js +39 -0
  33. package/dist/components/popover.js.map +1 -0
  34. package/dist/components/radio-group.d.ts +23 -0
  35. package/dist/components/radio-group.d.ts.map +1 -0
  36. package/dist/components/radio-group.js +40 -0
  37. package/dist/components/radio-group.js.map +1 -0
  38. package/dist/components/select.d.ts +23 -0
  39. package/dist/components/select.d.ts.map +1 -0
  40. package/dist/components/select.js +39 -0
  41. package/dist/components/select.js.map +1 -0
  42. package/dist/components/switch.d.ts +21 -0
  43. package/dist/components/switch.d.ts.map +1 -0
  44. package/dist/components/switch.js +39 -0
  45. package/dist/components/switch.js.map +1 -0
  46. package/dist/components/text-field.d.ts +23 -0
  47. package/dist/components/text-field.d.ts.map +1 -0
  48. package/dist/components/text-field.js +40 -0
  49. package/dist/components/text-field.js.map +1 -0
  50. package/dist/components/textarea.d.ts +20 -0
  51. package/dist/components/textarea.d.ts.map +1 -0
  52. package/dist/components/textarea.js +39 -0
  53. package/dist/components/textarea.js.map +1 -0
  54. package/dist/index.d.ts +14 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +13 -0
  57. package/dist/index.js.map +1 -1
  58. package/llms.md +477 -7
  59. package/package.json +6 -5
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  React wrappers for [Cosmos UI](../../README.md).
4
4
 
5
- React 19 wrappers of the Cosmos Web Components.
5
+ React 19 wrappers of the Cosmos Web Components. Install with React DOM 19; both are peer dependencies.
6
6
 
7
7
  ```tsx
8
8
  import '@joralvmel/cosmos-tokens/tokens.css';
@@ -17,6 +17,52 @@ export function Toolbar() {
17
17
  }
18
18
  ```
19
19
 
20
+ For controlled text entry, bind `value` and update it from the original event detail:
21
+
22
+ ```tsx
23
+ import { useState } from 'react';
24
+ import { TextField } from '@joralvmel/cosmos-react';
25
+
26
+ export function EmailField() {
27
+ const [email, setEmail] = useState('');
28
+ return (
29
+ <TextField
30
+ label="Email"
31
+ type="email"
32
+ value={email}
33
+ onChange={event => setEmail(event.detail.value)}
34
+ clearable
35
+ clearLabel="Clear email"
36
+ />
37
+ );
38
+ }
39
+ ```
40
+
41
+ `onChange` and `onSubmit` receive the original bubbling DOM `CustomEvent`; use `.detail.value`.
42
+ Passing `value`, including an empty string, makes the field controlled.
43
+ The adapter synchronizes `onChange` updates with React DOM before Lit reconciles the controlled
44
+ value, so ordinary synchronous `setState` handlers do not lose rapid keystrokes. Consumers do not
45
+ need to call `flushSync`; deferred updates still leave the previous controlled value in place
46
+ until the owner accepts the proposal.
47
+
48
+ For multiline plain text, use `Textarea`. It uses the same controlled-value event contract and
49
+ preserves native newline behavior:
50
+
51
+ ```tsx
52
+ import { Textarea } from '@joralvmel/cosmos-react';
53
+
54
+ <Textarea
55
+ label="Message"
56
+ value={message}
57
+ onChange={event => setMessage(event.detail.value)}
58
+ rows={4}
59
+ />;
60
+ ```
61
+
62
+ For independent icon colors, put the text-field CSS hooks on a `className` or `style`:
63
+ `--cosm-text-field-start-icon-color` and `--cosm-text-field-end-icon-color`. They do not recolor
64
+ affixes or action icons.
65
+
20
66
  ## License
21
67
 
22
68
  MIT
@@ -0,0 +1,8 @@
1
+ import { CosmBadge } from '@joralvmel/cosmos-elements/badge';
2
+ import * as React from 'react';
3
+ /** Badge has no events. */
4
+ export declare const badgeEvents: {};
5
+ /** React wrapper of `<cosm-badge>`. */
6
+ export declare const Badge: import("@lit/react").ReactWebComponent<CosmBadge, {}>;
7
+ export type BadgeProps = React.ComponentProps<typeof Badge>;
8
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/components/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,2BAA2B;AAC3B,eAAO,MAAM,WAAW,IAAK,CAAC;AAE9B,uCAAuC;AACvC,eAAO,MAAM,KAAK,uDAMhB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { CosmBadge } from '@joralvmel/cosmos-elements/badge';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ /** Badge has no events. */
5
+ export const badgeEvents = {};
6
+ /** React wrapper of `<cosm-badge>`. */
7
+ export const Badge = createComponent({
8
+ tagName: 'cosm-badge',
9
+ elementClass: CosmBadge,
10
+ react: React,
11
+ events: badgeEvents,
12
+ displayName: 'Badge',
13
+ });
14
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/components/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,2BAA2B;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,uCAAuC;AACvC,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;IACnC,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,SAAS;IACvB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,WAAW;IACnB,WAAW,EAAE,OAAO;CACrB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { CalendarChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmCalendar } from '@joralvmel/cosmos-elements/calendar';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `Calendar`, mapped to the original DOM `CustomEvent`. */
6
+ export declare const calendarEvents: {
7
+ onChange: EventName<CustomEvent<CalendarChangeDetail>>;
8
+ };
9
+ declare const CalendarElement: import("@lit/react").ReactWebComponent<CosmCalendar, {
10
+ onChange: EventName<CustomEvent<CalendarChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof CalendarElement>;
13
+ /** React wrapper; binding `value` marks selection as controlled. */
14
+ export declare const Calendar: React.ForwardRefExoticComponent<Omit<CalendarProps, "ref"> & React.RefAttributes<CosmCalendar>>;
15
+ export type CalendarProps = Omit<ElementProps, 'onChange'> & {
16
+ value?: string;
17
+ onChange?: (event: CustomEvent<CalendarChangeDetail>) => void;
18
+ };
19
+ export {};
20
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,iFAAiF;AACjF,eAAO,MAAM,cAAc;cACE,SAAS,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;CACxE,CAAC;AAEF,QAAA,MAAM,eAAe;cAHQ,SAAS,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;EASvE,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjE,oEAAoE;AACpE,eAAO,MAAM,QAAQ,iGAsBnB,CAAC;AAIH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CAC/D,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmCalendar } from '@joralvmel/cosmos-elements/calendar';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** React event props of `Calendar`, mapped to the original DOM `CustomEvent`. */
6
+ export const calendarEvents = {
7
+ onChange: 'cosm-change',
8
+ };
9
+ const CalendarElement = createComponent({
10
+ tagName: 'cosm-calendar',
11
+ elementClass: CosmCalendar,
12
+ react: React,
13
+ events: calendarEvents,
14
+ displayName: 'CalendarElement',
15
+ });
16
+ /** React wrapper; binding `value` marks selection as controlled. */
17
+ export const Calendar = React.forwardRef((props, forwardedRef) => {
18
+ const { value, onChange, ...elementProps } = props;
19
+ const handleChange = React.useCallback((event) => {
20
+ if (onChange)
21
+ flushSync(() => onChange(event));
22
+ }, [onChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.valueControlled = value !== undefined;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [forwardedRef, value]);
31
+ return React.createElement(CalendarElement, {
32
+ ...elementProps,
33
+ value,
34
+ onChange: handleChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Calendar.displayName = 'Calendar';
39
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/components/calendar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,aAA6D;CACxE,CAAC;AAEF,MAAM,eAAe,GAAG,eAAe,CAAC;IACtC,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAC;AAIH,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAA8B,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IAC5F,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,KAAwC,EAAE,EAAE;QAC3C,IAAI,QAAQ;YAAE,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,OAA4B,EAAE,EAAE;QAC/B,IAAI,OAAO;YAAE,OAAO,CAAC,eAAe,GAAG,KAAK,KAAK,SAAS,CAAC;QAC3D,IAAI,OAAO,YAAY,KAAK,UAAU;YAAE,YAAY,CAAC,OAAO,CAAC,CAAC;aACzD,IAAI,YAAY;YAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACxD,CAAC,EACD,CAAC,YAAY,EAAE,KAAK,CAAC,CACtB,CAAC;IACF,OAAO,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE;QAC1C,GAAG,YAAY;QACf,KAAK;QACL,QAAQ,EAAE,YAAY;QACtB,GAAG,EAAE,MAAM;KACI,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { CheckboxCheckedChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmCheckbox } from '@joralvmel/cosmos-elements/checkbox';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `Checkbox`, mapped to the original DOM `CustomEvent`. */
6
+ export declare const checkboxEvents: {
7
+ onCheckedChange: EventName<CustomEvent<CheckboxCheckedChangeDetail>>;
8
+ };
9
+ declare const CheckboxElement: import("@lit/react").ReactWebComponent<CosmCheckbox, {
10
+ onCheckedChange: EventName<CustomEvent<CheckboxCheckedChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof CheckboxElement>;
13
+ /** React wrapper; a supplied checked value, including false, is controlled. */
14
+ export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<CosmCheckbox>>;
15
+ export type CheckboxProps = Omit<ElementProps, 'onCheckedChange'> & {
16
+ label: string;
17
+ checked?: boolean;
18
+ onCheckedChange?: (event: CustomEvent<CheckboxCheckedChangeDetail>) => void;
19
+ };
20
+ export {};
21
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,iFAAiF;AACjF,eAAO,MAAM,cAAc;qBACiB,SAAS,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;CAC9F,CAAC;AAEF,QAAA,MAAM,eAAe;qBAHuB,SAAS,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;EAS7F,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjE,+EAA+E;AAC/E,eAAO,MAAM,QAAQ,iGAsBnB,CAAC;AAIH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,GAAG;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,2BAA2B,CAAC,KAAK,IAAI,CAAC;CAC7E,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmCheckbox } from '@joralvmel/cosmos-elements/checkbox';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** React event props of `Checkbox`, mapped to the original DOM `CustomEvent`. */
6
+ export const checkboxEvents = {
7
+ onCheckedChange: 'cosm-checked-change',
8
+ };
9
+ const CheckboxElement = createComponent({
10
+ tagName: 'cosm-checkbox',
11
+ elementClass: CosmCheckbox,
12
+ react: React,
13
+ events: checkboxEvents,
14
+ displayName: 'CheckboxElement',
15
+ });
16
+ /** React wrapper; a supplied checked value, including false, is controlled. */
17
+ export const Checkbox = React.forwardRef((props, forwardedRef) => {
18
+ const { checked, onCheckedChange, ...elementProps } = props;
19
+ const handleCheckedChange = React.useCallback((event) => {
20
+ if (onCheckedChange)
21
+ flushSync(() => onCheckedChange(event));
22
+ }, [onCheckedChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.checkedControlled = checked !== undefined;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [checked, forwardedRef]);
31
+ return React.createElement(CheckboxElement, {
32
+ ...elementProps,
33
+ checked,
34
+ onCheckedChange: handleCheckedChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Checkbox.displayName = 'Checkbox';
39
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/components/checkbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe,EAAE,qBAA4E;CAC9F,CAAC;AAEF,MAAM,eAAe,GAAG,eAAe,CAAC;IACtC,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAC;AAIH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAA8B,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IAC5F,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAC5D,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAC3C,CAAC,KAA+C,EAAE,EAAE;QAClD,IAAI,eAAe;YAAE,SAAS,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC,EACD,CAAC,eAAe,CAAC,CAClB,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,OAA4B,EAAE,EAAE;QAC/B,IAAI,OAAO;YAAE,OAAO,CAAC,iBAAiB,GAAG,OAAO,KAAK,SAAS,CAAC;QAC/D,IAAI,OAAO,YAAY,KAAK,UAAU;YAAE,YAAY,CAAC,OAAO,CAAC,CAAC;aACzD,IAAI,YAAY;YAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACxD,CAAC,EACD,CAAC,OAAO,EAAE,YAAY,CAAC,CACxB,CAAC;IACF,OAAO,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE;QAC1C,GAAG,YAAY;QACf,OAAO;QACP,eAAe,EAAE,mBAAmB;QACpC,GAAG,EAAE,MAAM;KACI,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { DialogOpenChangeDetail, DialogSize } from '@joralvmel/cosmos-core';
2
+ import { CosmDialog } from '@joralvmel/cosmos-elements/dialog';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `Dialog`, mapped to the original DOM event. */
6
+ export declare const dialogEvents: {
7
+ onOpenChange: EventName<CustomEvent<DialogOpenChangeDetail>>;
8
+ };
9
+ declare const DialogElement: import("@lit/react").ReactWebComponent<CosmDialog, {
10
+ onOpenChange: EventName<CustomEvent<DialogOpenChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof DialogElement>;
13
+ type DialogLayoutProps = {
14
+ size?: DialogSize;
15
+ responsiveFullscreen?: boolean;
16
+ };
17
+ /** React wrapper; a supplied `open` value, including false, is controlled. */
18
+ export declare const Dialog: React.ForwardRefExoticComponent<Omit<DialogProps, "ref"> & React.RefAttributes<CosmDialog>>;
19
+ export type DialogProps = Omit<ElementProps, 'open' | 'onOpenChange' | keyof DialogLayoutProps> & {
20
+ open?: boolean;
21
+ onOpenChange?: (event: CustomEvent<DialogOpenChangeDetail>) => void;
22
+ } & DialogLayoutProps;
23
+ export {};
24
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,uEAAuE;AACvE,eAAO,MAAM,YAAY;kBACa,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CACnF,CAAC;AAEF,QAAA,MAAM,aAAa;kBAHmB,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;EASlF,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAE/D,KAAK,iBAAiB,GAAG;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,MAAM,6FAuBjB,CAAC;AAGH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,GAAG,MAAM,iBAAiB,CAAC,GAAG;IAChG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;CACrE,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmDialog } from '@joralvmel/cosmos-elements/dialog';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** React event props of `Dialog`, mapped to the original DOM event. */
6
+ export const dialogEvents = {
7
+ onOpenChange: 'cosm-open-change',
8
+ };
9
+ const DialogElement = createComponent({
10
+ tagName: 'cosm-dialog',
11
+ elementClass: CosmDialog,
12
+ react: React,
13
+ events: dialogEvents,
14
+ displayName: 'DialogElement',
15
+ });
16
+ /** React wrapper; a supplied `open` value, including false, is controlled. */
17
+ export const Dialog = React.forwardRef((props, forwardedRef) => {
18
+ const { open, onOpenChange, ...elementProps } = props;
19
+ const handleOpenChange = React.useCallback((event) => {
20
+ if (onOpenChange)
21
+ flushSync(() => onOpenChange(event));
22
+ }, [onOpenChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.open = open;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [forwardedRef, open]);
31
+ return React.createElement(DialogElement, {
32
+ ...elementProps,
33
+ ...(open === undefined ? {} : { open }),
34
+ onOpenChange: handleOpenChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Dialog.displayName = 'Dialog';
39
+ //# sourceMappingURL=dialog.js.map
@@ -0,0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AAY,EAAE,IAAI,CAAC,CACrB,CAAC;IAEF,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE;QACxC,GAAG,YAAY;QACf,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,YAAY,EAAE,gBAAgB;QAC9B,GAAG,EAAE,MAAM;KACI,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AACH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { IconButtonPressDetail, IconButtonPressedChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmIconButton } from '@joralvmel/cosmos-elements/icon-button';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ export declare const iconButtonEvents: {
6
+ onPress: EventName<CustomEvent<IconButtonPressDetail>>;
7
+ onPressedChange: EventName<CustomEvent<IconButtonPressedChangeDetail>>;
8
+ };
9
+ declare const IconButtonElement: import("@lit/react").ReactWebComponent<CosmIconButton, {
10
+ onPress: EventName<CustomEvent<IconButtonPressDetail>>;
11
+ onPressedChange: EventName<CustomEvent<IconButtonPressedChangeDetail>>;
12
+ }>;
13
+ type ElementProps = React.ComponentProps<typeof IconButtonElement>;
14
+ /** React wrapper; a supplied pressed value, including false, is controlled. */
15
+ export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<CosmIconButton>>;
16
+ export type IconButtonProps = Omit<ElementProps, 'label' | 'onPress' | 'onPressedChange'> & {
17
+ label: string;
18
+ onPress?: (event: CustomEvent<IconButtonPressDetail>) => void;
19
+ onPressedChange?: (event: CustomEvent<IconButtonPressedChangeDetail>) => void;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=icon-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/components/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,gBAAgB;aACF,SAAS,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;qBAC5B,SAAS,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC;CAChG,CAAC;AAEF,QAAA,MAAM,iBAAiB;aAJI,SAAS,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;qBAC5B,SAAS,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC;EAS/F,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,+EAA+E;AAC/E,eAAO,MAAM,UAAU,qGAwBtB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,iBAAiB,CAAC,GAAG;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IAC9D,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,6BAA6B,CAAC,KAAK,IAAI,CAAC;CAC/E,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmIconButton } from '@joralvmel/cosmos-elements/icon-button';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ export const iconButtonEvents = {
6
+ onPress: 'cosm-press',
7
+ onPressedChange: 'cosm-pressed-change',
8
+ };
9
+ const IconButtonElement = createComponent({
10
+ tagName: 'cosm-icon-button',
11
+ elementClass: CosmIconButton,
12
+ react: React,
13
+ events: iconButtonEvents,
14
+ displayName: 'IconButtonElement',
15
+ });
16
+ /** React wrapper; a supplied pressed value, including false, is controlled. */
17
+ export const IconButton = React.forwardRef((props, forwardedRef) => {
18
+ const { pressed, onPressedChange, ...elementProps } = props;
19
+ const handleChange = React.useCallback((event) => {
20
+ if (onPressedChange)
21
+ flushSync(() => onPressedChange(event));
22
+ }, [onPressedChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.pressedControlled = pressed !== undefined;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [forwardedRef, pressed]);
31
+ return React.createElement(IconButtonElement, {
32
+ ...elementProps,
33
+ pressed,
34
+ onPressedChange: handleChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ IconButton.displayName = 'IconButton';
39
+ //# sourceMappingURL=icon-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/components/icon-button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,YAA6D;IACtE,eAAe,EAAE,qBAA8E;CAChG,CAAC;AAEF,MAAM,iBAAiB,GAAG,eAAe,CAAC;IACxC,OAAO,EAAE,kBAAkB;IAC3B,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,gBAAgB;IACxB,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAC;AAIH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACtB,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAC5D,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,KAAiD,EAAE,EAAE;QACpD,IAAI,eAAe;YAAE,SAAS,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC,EACD,CAAC,eAAe,CAAC,CAClB,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,OAA8B,EAAE,EAAE;QACjC,IAAI,OAAO;YAAE,OAAO,CAAC,iBAAiB,GAAG,OAAO,KAAK,SAAS,CAAC;QAC/D,IAAI,OAAO,YAAY,KAAK,UAAU;YAAE,YAAY,CAAC,OAAO,CAAC,CAAC;aACzD,IAAI,YAAY;YAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACxD,CAAC,EACD,CAAC,YAAY,EAAE,OAAO,CAAC,CACxB,CAAC;IACF,OAAO,KAAK,CAAC,aAAa,CAAC,iBAAiB,EAAE;QAC5C,GAAG,YAAY;QACf,OAAO;QACP,eAAe,EAAE,YAAY;QAC7B,GAAG,EAAE,MAAM;KACI,CAAC,CAAC;AACrB,CAAC,CACF,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ListboxSelectionChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmListbox } from '@joralvmel/cosmos-elements/listbox';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `Listbox`, mapped to the original DOM `CustomEvent`. */
6
+ export declare const listboxEvents: {
7
+ onSelectionChange: EventName<CustomEvent<ListboxSelectionChangeDetail>>;
8
+ };
9
+ declare const ListboxElement: import("@lit/react").ReactWebComponent<CosmListbox, {
10
+ onSelectionChange: EventName<CustomEvent<ListboxSelectionChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof ListboxElement>;
13
+ /** React wrapper of `<cosm-listbox>`; a supplied selectedValues array, including `[]`, is controlled. */
14
+ export declare const Listbox: React.ForwardRefExoticComponent<Omit<ListboxProps, "ref"> & React.RefAttributes<CosmListbox>>;
15
+ export type ListboxProps = Omit<ElementProps, 'onSelectionChange'> & {
16
+ label: string;
17
+ items: CosmListbox['items'];
18
+ selectedValues?: readonly string[];
19
+ onSelectionChange?: (event: CustomEvent<ListboxSelectionChangeDetail>) => void;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=listbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/components/listbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,gFAAgF;AAChF,eAAO,MAAM,aAAa;uBACsB,SAAS,CACrD,WAAW,CAAC,4BAA4B,CAAC,CAC1C;CACF,CAAC;AAEF,QAAA,MAAM,cAAc;uBAL4B,SAAS,CACrD,WAAW,CAAC,4BAA4B,CAAC,CAC1C;EASD,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC;AAEhE,yGAAyG;AACzG,eAAO,MAAM,OAAO,+FAsBlB,CAAC;AAIH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,GAAG;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,4BAA4B,CAAC,KAAK,IAAI,CAAC;CAChF,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmListbox } from '@joralvmel/cosmos-elements/listbox';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** React event props of `Listbox`, mapped to the original DOM `CustomEvent`. */
6
+ export const listboxEvents = {
7
+ onSelectionChange: 'cosm-selection-change',
8
+ };
9
+ const ListboxElement = createComponent({
10
+ tagName: 'cosm-listbox',
11
+ elementClass: CosmListbox,
12
+ react: React,
13
+ events: listboxEvents,
14
+ displayName: 'ListboxElement',
15
+ });
16
+ /** React wrapper of `<cosm-listbox>`; a supplied selectedValues array, including `[]`, is controlled. */
17
+ export const Listbox = React.forwardRef((props, forwardedRef) => {
18
+ const { selectedValues, onSelectionChange, ...elementProps } = props;
19
+ const handleSelectionChange = React.useCallback((event) => {
20
+ if (onSelectionChange)
21
+ flushSync(() => onSelectionChange(event));
22
+ }, [onSelectionChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.selectedValuesControlled = selectedValues !== undefined;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [forwardedRef, selectedValues]);
31
+ return React.createElement(ListboxElement, {
32
+ ...elementProps,
33
+ selectedValues,
34
+ onSelectionChange: handleSelectionChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Listbox.displayName = 'Listbox';
39
+ //# sourceMappingURL=listbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.js","sourceRoot":"","sources":["../../src/components/listbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,E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EH,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { PaginationChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmPagination } from '@joralvmel/cosmos-elements/pagination';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** Original DOM events forwarded by the React adapter. */
6
+ export declare const paginationEvents: {
7
+ onChange: EventName<CustomEvent<PaginationChangeDetail>>;
8
+ };
9
+ declare const PaginationElement: import("@lit/react").ReactWebComponent<CosmPagination, {
10
+ onChange: EventName<CustomEvent<PaginationChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof PaginationElement>;
13
+ /** Supplying page keeps state with the owner, including a page of one. */
14
+ export declare const Pagination: React.ForwardRefExoticComponent<Omit<PaginationProps, "ref"> & React.RefAttributes<CosmPagination>>;
15
+ export type PaginationProps = Omit<ElementProps, 'onChange'> & {
16
+ label: string;
17
+ totalPages: number;
18
+ onChange?: (event: CustomEvent<PaginationChangeDetail>) => void;
19
+ };
20
+ export {};
21
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB;cACA,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CAC1E,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAHM,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;EASzE,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,qGAsBrB,CAAC;AAGH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;CACjE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmPagination } from '@joralvmel/cosmos-elements/pagination';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** Original DOM events forwarded by the React adapter. */
6
+ export const paginationEvents = {
7
+ onChange: 'cosm-change',
8
+ };
9
+ const PaginationElement = createComponent({
10
+ tagName: 'cosm-pagination',
11
+ elementClass: CosmPagination,
12
+ react: React,
13
+ events: paginationEvents,
14
+ displayName: 'PaginationElement',
15
+ });
16
+ /** Supplying page keeps state with the owner, including a page of one. */
17
+ export const Pagination = React.forwardRef((props, ref) => {
18
+ const { page, onChange, ...rest } = props;
19
+ const handleChange = React.useCallback((event) => {
20
+ if (onChange)
21
+ flushSync(() => onChange(event));
22
+ }, [onChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.pageControlled = page !== undefined;
26
+ if (typeof ref === 'function')
27
+ ref(element);
28
+ else if (ref)
29
+ ref.current = element;
30
+ }, [page, ref]);
31
+ return React.createElement(PaginationElement, {
32
+ ...rest,
33
+ page,
34
+ onChange: handleChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Pagination.displayName = 'Pagination';
39
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/components/pagination.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO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IAAI;QACJ,QAAQ,EAAE,YAAY;QACtB,GAAG,EAAE,MAAM;KACZ,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AACH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { PopoverOpenChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmPopover } from '@joralvmel/cosmos-elements/popover';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `Popover`, mapped to the original DOM event. */
6
+ export declare const popoverEvents: {
7
+ onOpenChange: EventName<CustomEvent<PopoverOpenChangeDetail>>;
8
+ };
9
+ declare const PopoverElement: import("@lit/react").ReactWebComponent<CosmPopover, {
10
+ onOpenChange: EventName<CustomEvent<PopoverOpenChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof PopoverElement>;
13
+ /** React wrapper; a supplied `open` value, including false, is controlled. */
14
+ export declare const Popover: React.ForwardRefExoticComponent<Omit<PopoverProps, "ref"> & React.RefAttributes<CosmPopover>>;
15
+ export type PopoverProps = Omit<ElementProps, 'open' | 'onOpenChange'> & {
16
+ open?: boolean;
17
+ onOpenChange?: (event: CustomEvent<PopoverOpenChangeDetail>) => void;
18
+ };
19
+ export {};
20
+ //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components/popover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wEAAwE;AACxE,eAAO,MAAM,aAAa;kBACY,SAAS,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;CACpF,CAAC;AAEF,QAAA,MAAM,cAAc;kBAHkB,SAAS,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;EASnF,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC;AAEhE,8EAA8E;AAC9E,eAAO,MAAM,OAAO,+FAuBlB,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,CAAC,GAAG;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAC;CACtE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { CosmPopover } from '@joralvmel/cosmos-elements/popover';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ /** React event props of `Popover`, mapped to the original DOM event. */
6
+ export const popoverEvents = {
7
+ onOpenChange: 'cosm-open-change',
8
+ };
9
+ const PopoverElement = createComponent({
10
+ tagName: 'cosm-popover',
11
+ elementClass: CosmPopover,
12
+ react: React,
13
+ events: popoverEvents,
14
+ displayName: 'PopoverElement',
15
+ });
16
+ /** React wrapper; a supplied `open` value, including false, is controlled. */
17
+ export const Popover = React.forwardRef((props, forwardedRef) => {
18
+ const { open, onOpenChange, ...elementProps } = props;
19
+ const handleOpenChange = React.useCallback((event) => {
20
+ if (onOpenChange)
21
+ flushSync(() => onOpenChange(event));
22
+ }, [onOpenChange]);
23
+ const setRef = React.useCallback((element) => {
24
+ if (element)
25
+ element.open = open;
26
+ if (typeof forwardedRef === 'function')
27
+ forwardedRef(element);
28
+ else if (forwardedRef)
29
+ forwardedRef.current = element;
30
+ }, [forwardedRef, open]);
31
+ return React.createElement(PopoverElement, {
32
+ ...elementProps,
33
+ ...(open === undefined ? {} : { open }),
34
+ onOpenChange: handleOpenChange,
35
+ ref: setRef,
36
+ });
37
+ });
38
+ Popover.displayName = 'Popover';
39
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/components/popover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,wEAAwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE,kBAAqE;CACpF,CAAC;AAEF,MAAM,cAAc,GAAG,eAAe,CAAC;IACrC,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,WAAW;IACzB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAC;AAIH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAA4B,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACzF,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACxC,CAAC,KAA2C,EAAE,EAAE;QAC9C,IAAI,YAAY;YAAE,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,CAAC,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,OAA2B,EAAE,EAAE;QAC9B,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACjC,IAAI,OAAO,YAAY,KAAK,UAAU;YAAE,YAAY,CAAC,OAAO,CAAC,CAAC;aACzD,IAAI,YAAY;YAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACxD,CAAC,EACD,CAAC,YAAY,EAAE,IAAI,CAAC,CACrB,CAAC;IAEF,OAAO,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;QACzC,GAAG,YAAY;QACf,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,YAAY,EAAE,gBAAgB;QAC9B,GAAG,EAAE,MAAM;KACI,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { RadioGroupChangeDetail } from '@joralvmel/cosmos-core';
2
+ import { CosmRadioGroup } from '@joralvmel/cosmos-elements/radio-group';
3
+ import { type EventName } from '@lit/react';
4
+ import * as React from 'react';
5
+ /** React event props of `RadioGroup`, mapped to the original DOM `CustomEvent`. */
6
+ export declare const radioGroupEvents: {
7
+ onChange: EventName<CustomEvent<RadioGroupChangeDetail>>;
8
+ };
9
+ declare const RadioGroupElement: import("@lit/react").ReactWebComponent<CosmRadioGroup, {
10
+ onChange: EventName<CustomEvent<RadioGroupChangeDetail>>;
11
+ }>;
12
+ type ElementProps = React.ComponentProps<typeof RadioGroupElement>;
13
+ /** React wrapper; a supplied value, including null, keeps selection controlled. */
14
+ export declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupProps, "ref"> & React.RefAttributes<CosmRadioGroup>>;
15
+ export type RadioGroupProps = Omit<ElementProps, 'onChange'> & {
16
+ label: string;
17
+ options: CosmRadioGroup['options'];
18
+ value?: CosmRadioGroup['value'];
19
+ defaultValue?: CosmRadioGroup['defaultValue'];
20
+ onChange?: (event: CustomEvent<RadioGroupChangeDetail>) => void;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/components/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,mFAAmF;AACnF,eAAO,MAAM,gBAAgB;cACA,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CAC1E,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAHM,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;EASzE,CAAC;AAEH,KAAK,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,mFAAmF;AACnF,eAAO,MAAM,UAAU,qGAyBtB,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;CACjE,CAAC"}