@ark-ui/solid
Advanced tools
Comparing version 0.0.0-rc-20221115142453 to 0.0.0-rc-20221115160435
@@ -43,2 +43,6 @@ "use strict"; | ||
// src/factory.tsx | ||
var import_solid = require("@polymorphic-factory/solid"); | ||
var ark = (0, import_solid.polymorphicFactory)(); | ||
// src/createContext.ts | ||
@@ -78,6 +82,6 @@ var import_solid_js = require("solid-js"); | ||
var accordion = __toESM(require("@zag-js/accordion")); | ||
var import_solid = require("@zag-js/solid"); | ||
var import_solid2 = require("@zag-js/solid"); | ||
var import_solid_js2 = require("solid-js"); | ||
var useAccordion = (props) => { | ||
const [state, send] = (0, import_solid.useMachine)( | ||
const [state, send] = (0, import_solid2.useMachine)( | ||
accordion.machine({ | ||
@@ -89,3 +93,3 @@ id: (0, import_solid_js2.createUniqueId)(), | ||
); | ||
return (0, import_solid_js2.createMemo)(() => accordion.connect(state, send, import_solid.normalizeProps)); | ||
return (0, import_solid_js2.createMemo)(() => accordion.connect(state, send, import_solid2.normalizeProps)); | ||
}; | ||
@@ -106,3 +110,3 @@ | ||
const accordion2 = useAccordion(accordionProps); | ||
return <AccordionProvider value={accordion2}><div {...accordion2?.().rootProps} {...htmlProps} /></AccordionProvider>; | ||
return <AccordionProvider value={accordion2}><ark.div {...accordion2?.().rootProps} {...htmlProps} /></AccordionProvider>; | ||
} | ||
@@ -122,3 +126,3 @@ | ||
const { value, disabled } = useAccordionItemContext(); | ||
return <button {...api?.().getTriggerProps?.({ | ||
return <ark.button {...api?.().getTriggerProps?.({ | ||
value, | ||
@@ -134,3 +138,3 @@ disabled | ||
const api = useAccordionContext(); | ||
return <AccordionItemProvider value={itemProps}><div {...api?.().getItemProps({ value: itemProps.value })} {...htmlProps} /></AccordionItemProvider>; | ||
return <AccordionItemProvider value={itemProps}><ark.div {...api?.().getItemProps({ value: itemProps.value })} {...htmlProps} /></AccordionItemProvider>; | ||
} | ||
@@ -142,3 +146,3 @@ | ||
const { value, disabled } = useAccordionItemContext(); | ||
return <div {...api?.().getContentProps({ | ||
return <ark.div {...api?.().getContentProps({ | ||
value, | ||
@@ -160,6 +164,6 @@ disabled | ||
var pinInput = __toESM(require("@zag-js/pin-input")); | ||
var import_solid2 = require("@zag-js/solid"); | ||
var import_solid3 = require("@zag-js/solid"); | ||
var import_solid_js5 = require("solid-js"); | ||
var usePinInput = (props) => { | ||
const [state, send] = (0, import_solid2.useMachine)( | ||
const [state, send] = (0, import_solid3.useMachine)( | ||
pinInput.machine({ | ||
@@ -171,3 +175,3 @@ id: (0, import_solid_js5.createUniqueId)(), | ||
); | ||
return (0, import_solid_js5.createMemo)(() => pinInput.connect(state, send, import_solid2.normalizeProps)); | ||
return (0, import_solid_js5.createMemo)(() => pinInput.connect(state, send, import_solid3.normalizeProps)); | ||
}; | ||
@@ -199,3 +203,3 @@ | ||
const pinInput2 = usePinInput(pinInputProps); | ||
return <PinInputProvider value={pinInput2}><div {...pinInput2?.().rootProps} {...htmlProps} /></PinInputProvider>; | ||
return <PinInputProvider value={pinInput2}><ark.div {...pinInput2?.().rootProps} {...htmlProps} /></PinInputProvider>; | ||
}; | ||
@@ -207,3 +211,3 @@ | ||
const pinInput2 = usePinInputContext(); | ||
return <input {...pinInput2().getInputProps({ | ||
return <ark.input {...pinInput2().getInputProps({ | ||
index | ||
@@ -210,0 +214,0 @@ })} {...htmlProps} />; |
import * as solid_js from 'solid-js'; | ||
import { JSX } from 'solid-js'; | ||
import { HTMLPolymorphicProps, Assign } from '@polymorphic-factory/solid'; | ||
import * as accordion from '@zag-js/accordion'; | ||
import * as pinInput from '@zag-js/pin-input'; | ||
declare type HTMLArkProps<T extends keyof JSX.IntrinsicElements> = HTMLPolymorphicProps<T>; | ||
declare type UseAccordionProps = Omit<accordion.Context, 'id'> & { | ||
@@ -36,19 +39,17 @@ defaultValue?: accordion.Context['value']; | ||
declare type AccordionProps = UseAccordionProps & JSX.HTMLAttributes<HTMLDivElement>; | ||
declare function Accordion(props: AccordionProps): JSX.Element; | ||
declare type AccordionProps = Assign<HTMLArkProps<'div'>, UseAccordionProps>; | ||
declare function Accordion(props: AccordionProps): solid_js.JSX.Element; | ||
declare type AccordionButtonProps = JSX.HTMLAttributes<HTMLButtonElement>; | ||
declare function AccordionButton(props: AccordionButtonProps): JSX.Element; | ||
declare type AccordionButtonProps = HTMLArkProps<'button'>; | ||
declare function AccordionButton(props: AccordionButtonProps): solid_js.JSX.Element; | ||
declare type AccordionItemProps = JSX.HTMLAttributes<HTMLDivElement> & { | ||
declare type AccordionItemProps = Assign<HTMLArkProps<'div'>, { | ||
value: string; | ||
disabled?: boolean; | ||
}; | ||
declare function AccordionItem(props: AccordionItemProps): JSX.Element; | ||
}>; | ||
declare function AccordionItem(props: AccordionItemProps): solid_js.JSX.Element; | ||
declare type AccordionPanelProps = JSX.HTMLAttributes<HTMLDivElement>; | ||
declare function AccordionPanel(props: AccordionPanelProps): JSX.Element; | ||
declare type AccordionPanelProps = HTMLArkProps<'div'>; | ||
declare function AccordionPanel(props: AccordionPanelProps): solid_js.JSX.Element; | ||
declare type Assign<Target, Source> = Omit<Target, keyof Source> & Source; | ||
declare type UsePinInputProps = Omit<pinInput.Context, 'id'> & { | ||
@@ -74,10 +75,10 @@ defaultValue?: pinInput.Context['value']; | ||
declare type PinInputProps = Assign<JSX.HTMLAttributes<HTMLDivElement>, UsePinInputProps>; | ||
declare const PinInput: (props: PinInputProps) => JSX.Element; | ||
declare type PinInputProps = Assign<HTMLArkProps<'div'>, UsePinInputProps>; | ||
declare const PinInput: (props: PinInputProps) => solid_js.JSX.Element; | ||
declare type PinInputFieldProps = { | ||
declare type PinInputFieldProps = Assign<HTMLArkProps<'input'>, { | ||
index: number; | ||
} & JSX.HTMLAttributes<HTMLInputElement>; | ||
declare const PinInputField: (props: PinInputFieldProps) => JSX.Element; | ||
}>; | ||
declare const PinInputField: (props: PinInputFieldProps) => solid_js.JSX.Element; | ||
export { Accordion, AccordionButton, AccordionButtonProps, AccordionItem, AccordionItemProps, AccordionPanel, AccordionPanelProps, AccordionProps, PinInput, PinInputField, PinInputFieldProps, PinInputProps, UseAccordionProps, UseAccordionReturn, UsePinInputProps, UsePinInputReturn, useAccordion, usePinInput }; |
// src/accordion/accordion.tsx | ||
import { splitProps } from "solid-js"; | ||
// src/factory.tsx | ||
import { | ||
polymorphicFactory | ||
} from "@polymorphic-factory/solid"; | ||
var ark = polymorphicFactory(); | ||
// src/createContext.ts | ||
@@ -67,3 +73,3 @@ import { | ||
const accordion2 = useAccordion(accordionProps); | ||
return <AccordionProvider value={accordion2}><div {...accordion2?.().rootProps} {...htmlProps} /></AccordionProvider>; | ||
return <AccordionProvider value={accordion2}><ark.div {...accordion2?.().rootProps} {...htmlProps} /></AccordionProvider>; | ||
} | ||
@@ -83,3 +89,3 @@ | ||
const { value, disabled } = useAccordionItemContext(); | ||
return <button {...api?.().getTriggerProps?.({ | ||
return <ark.button {...api?.().getTriggerProps?.({ | ||
value, | ||
@@ -95,3 +101,3 @@ disabled | ||
const api = useAccordionContext(); | ||
return <AccordionItemProvider value={itemProps}><div {...api?.().getItemProps({ value: itemProps.value })} {...htmlProps} /></AccordionItemProvider>; | ||
return <AccordionItemProvider value={itemProps}><ark.div {...api?.().getItemProps({ value: itemProps.value })} {...htmlProps} /></AccordionItemProvider>; | ||
} | ||
@@ -103,3 +109,3 @@ | ||
const { value, disabled } = useAccordionItemContext(); | ||
return <div {...api?.().getContentProps({ | ||
return <ark.div {...api?.().getContentProps({ | ||
value, | ||
@@ -158,3 +164,3 @@ disabled | ||
const pinInput2 = usePinInput(pinInputProps); | ||
return <PinInputProvider value={pinInput2}><div {...pinInput2?.().rootProps} {...htmlProps} /></PinInputProvider>; | ||
return <PinInputProvider value={pinInput2}><ark.div {...pinInput2?.().rootProps} {...htmlProps} /></PinInputProvider>; | ||
}; | ||
@@ -166,3 +172,3 @@ | ||
const pinInput2 = usePinInputContext(); | ||
return <input {...pinInput2().getInputProps({ | ||
return <ark.input {...pinInput2().getInputProps({ | ||
index | ||
@@ -169,0 +175,0 @@ })} {...htmlProps} />; |
{ | ||
"name": "@ark-ui/solid", | ||
"version": "0.0.0-rc-20221115142453", | ||
"version": "0.0.0-rc-20221115160435", | ||
"description": "", | ||
@@ -34,2 +34,3 @@ "keywords": [], | ||
"dependencies": { | ||
"@polymorphic-factory/solid": "0.1.1", | ||
"@zag-js/accordion": "0.2.1", | ||
@@ -36,0 +37,0 @@ "@zag-js/checkbox": "0.2.1", |
17350
438
21
+ Added@polymorphic-factory/solid@0.1.1(transitive)