Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agnos-ui/react-headless

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agnos-ui/react-headless - npm Package Compare versions

Comparing version 0.0.1-alpha.1 to 0.0.1-alpha.3

config.d.ts

22

index.d.ts
export * from '@agnos-ui/core';
export * from './Portal';
export * from './Slot';
export * from './WidgetsDefaultConfig';
export * from './slotTypes';
export * from './utils';
import type { WidgetProps, WidgetState } from '@agnos-ui/core';
import type { AdaptSlotContentProps, AdaptWidgetSlots } from './utils';
export type { SlotContent, WidgetsConfig } from './utils';
export * from './config';
import type { PropsConfig, WidgetFactory, WidgetProps, WidgetState } from '@agnos-ui/core';
import type { AdaptSlotContentProps, AdaptWidgetSlots } from './slotTypes';
export type { SlotContent } from './slotTypes';
export type { WidgetsConfig } from './config';
export type AccordionWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionWidget>;
export type AccordionProps = WidgetProps<AccordionWidget>;
export type AccordionState = WidgetState<AccordionWidget>;
export type AccordionApi = AccordionWidget['api'];
export type AccordionItemWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionItemWidget>;

@@ -16,2 +19,3 @@ export type AccordionItemProps = WidgetProps<AccordionItemWidget>;

export type AccordionItemContext = AdaptSlotContentProps<import('@agnos-ui/core').AccordionItemContext>;
export declare const createAccordion: WidgetFactory<AccordionWidget>;
export type AlertWidget = AdaptWidgetSlots<import('@agnos-ui/core').AlertWidget>;

@@ -21,2 +25,3 @@ export type AlertProps = WidgetProps<AlertWidget>;

export type AlertContext = AdaptSlotContentProps<import('@agnos-ui/core').AlertContext>;
export declare const createAlert: WidgetFactory<AlertWidget>;
export type ModalWidget = AdaptWidgetSlots<import('@agnos-ui/core').ModalWidget>;

@@ -26,2 +31,3 @@ export type ModalProps = WidgetProps<ModalWidget>;

export type ModalContext = AdaptSlotContentProps<import('@agnos-ui/core').ModalContext>;
export declare const createModal: WidgetFactory<ModalWidget>;
export type PaginationWidget = AdaptWidgetSlots<import('@agnos-ui/core').PaginationWidget>;

@@ -32,7 +38,15 @@ export type PaginationProps = WidgetProps<PaginationWidget>;

export type PaginationNumberContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationNumberContext>;
export declare const createPagination: WidgetFactory<PaginationWidget>;
export type RatingWidget = AdaptWidgetSlots<import('@agnos-ui/core').RatingWidget>;
export type RatingProps = WidgetProps<RatingWidget>;
export type RatingState = WidgetState<RatingWidget>;
export declare const createRating: WidgetFactory<RatingWidget>;
export type SelectWidget<Item> = AdaptWidgetSlots<import('@agnos-ui/core').SelectWidget<Item>>;
export type SelectProps<Item> = WidgetProps<SelectWidget<Item>>;
export type SelectState<Item> = WidgetState<SelectWidget<Item>>;
export declare const createSelect: <Item>(propsConfig?: PropsConfig<SelectProps<Item>>) => SelectWidget<Item>;
export type ProgressbarWidget = AdaptWidgetSlots<import('@agnos-ui/core').ProgressbarWidget>;
export type ProgressbarProps = WidgetProps<ProgressbarWidget>;
export type ProgressbarState = WidgetState<ProgressbarWidget>;
export type ProgressbarContext = AdaptSlotContentProps<import('@agnos-ui/core').ProgressbarContext>;
export declare const createProgressbar: WidgetFactory<ProgressbarWidget>;
export * from '@agnos-ui/core';
export * from './Portal';
export * from './Slot';
export * from './WidgetsDefaultConfig';
export * from './slotTypes';
export * from './utils';
export * from './config';
import { createAccordion as coreCreateAccordion } from '@agnos-ui/core';
export const createAccordion = coreCreateAccordion;
import { createAlert as coreCreateAlert } from '@agnos-ui/core';
export const createAlert = coreCreateAlert;
import { createModal as coreCreateModal } from '@agnos-ui/core';
export const createModal = coreCreateModal;
import { createPagination as coreCreatePagination } from '@agnos-ui/core';
export const createPagination = coreCreatePagination;
import { createRating as coreCreateRating } from '@agnos-ui/core';
export const createRating = coreCreateRating;
import { createSelect as coreCreateSelect } from '@agnos-ui/core';
export const createSelect = coreCreateSelect;
import { createProgressbar as coreCreateProgressbar } from '@agnos-ui/core';
export const createProgressbar = coreCreateProgressbar;

6

package.json

@@ -14,4 +14,4 @@ {

"dependencies": {
"@agnos-ui/core": "0.0.1-alpha.1",
"@amadeus-it-group/tansu": "0.0.22",
"@agnos-ui/core": "0.0.1-alpha.3",
"@amadeus-it-group/tansu": "0.0.23",
"classnames": "^2.3.2"

@@ -24,3 +24,3 @@ },

"sideEffects": false,
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.3",
"homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",

@@ -27,0 +27,0 @@ "bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",

@@ -1,2 +0,2 @@

import type { SlotContent } from './utils';
import type { SlotContent } from './slotTypes';
export declare const Slot: <Props extends object>({ slotContent, props }: {

@@ -3,0 +3,0 @@ slotContent: SlotContent<Props>;

@@ -1,14 +0,4 @@

import type { Directive, Widget, WidgetFactory, WidgetProps, WidgetState, WidgetsConfigStore } from '@agnos-ui/core';
import type { Directive, Widget, WidgetProps, WidgetState } from '@agnos-ui/core';
import type { ReadableSignal } from '@amadeus-it-group/tansu';
import type { RefCallback } from 'react';
import type { SlotContent as CoreSlotContent, WidgetsConfig as CoreWidgetsConfig, WidgetSlotContext } from '@agnos-ui/core';
export type SlotContent<Props extends object = object> = CoreSlotContent<Props> | ((props: Props) => React.ReactNode) | React.ComponentType<Props> | React.ReactNode;
export type AdaptSlotContentProps<Props extends Record<string, any>> = Props extends WidgetSlotContext<infer U> ? WidgetSlotContext<AdaptWidgetSlots<U>> & AdaptPropsSlots<Omit<Props, keyof WidgetSlotContext<any>>> : AdaptPropsSlots<Props>;
export type AdaptPropsSlots<Props> = Omit<Props, `slot${string}`> & {
[K in keyof Props & `slot${string}`]: Props[K] extends CoreSlotContent<infer U> ? SlotContent<AdaptSlotContentProps<U>> : Props[K];
};
export type WidgetsConfig = {
[WidgetName in keyof CoreWidgetsConfig]: AdaptPropsSlots<CoreWidgetsConfig[WidgetName]>;
};
export type AdaptWidgetSlots<W extends Widget> = Widget<AdaptPropsSlots<WidgetProps<W>>, AdaptPropsSlots<WidgetState<W>>, W['api'], W['actions'], W['directives']>;
export declare function useWidget<Factory extends (...arg: any[]) => Widget>(createWidget: Factory, props?: Partial<WidgetProps<ReturnType<Factory>>>, ...initProps: Parameters<Factory>): [WidgetState<ReturnType<Factory>>, ReturnType<Factory>];

@@ -18,6 +8,2 @@ export declare function useObservable<T>(store$: ReadableSignal<T>): T;

export declare function useDirective<T>(directive: Directive<T>, args: T): RefCallback<HTMLElement>;
/**
* React context which can be used to provide or consume the widgets default configuration store.
*/
export declare const widgetsConfigContext: import("react").Context<WidgetsConfigStore<WidgetsConfig> | undefined>;
export declare const useWidgetWithConfig: <W extends Widget<object, object, object, object, object>>(factory: WidgetFactory<W>, props: Partial<AdaptPropsSlots<WidgetProps<W>>> | undefined, widgetName: keyof WidgetsConfig | null, defaultProps?: Partial<AdaptPropsSlots<WidgetProps<W>>> | undefined) => [AdaptPropsSlots<WidgetState<W>>, AdaptWidgetSlots<W>];
export declare const usePropsAsStore: <T extends object>(props?: Partial<T> | undefined) => ReadableSignal<Partial<T>>;
import { findChangedProperties } from '@agnos-ui/core';
import { asReadable, computed, writable } from '@amadeus-it-group/tansu';
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { asReadable, writable } from '@amadeus-it-group/tansu';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
export function useWidget(createWidget, props = {}, ...initProps) {

@@ -47,8 +47,4 @@ const apiRef = useRef(undefined);

}
/**
* React context which can be used to provide or consume the widgets default configuration store.
*/
export const widgetsConfigContext = createContext(undefined);
const propsEqual = (a, b) => !findChangedProperties(a, b);
const usePropsAsStore = (props) => {
export const usePropsAsStore = (props) => {
const storeRef = useRef();

@@ -63,7 +59,1 @@ if (!storeRef.current) {

};
const useWidgetContext = (widgetName, defaultConfig) => {
const widgetsConfig = useContext(widgetsConfigContext);
const defaultConfig$ = usePropsAsStore(defaultConfig);
return useMemo(() => computed(() => ({ ...defaultConfig$(), ...(widgetName ? widgetsConfig?.()[widgetName] : undefined) })), [widgetsConfig]);
};
export const useWidgetWithConfig = (factory, props, widgetName, defaultProps) => useWidget(factory, props, useWidgetContext(widgetName, defaultProps));
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc