@kobalte/core
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -52,5 +52,5 @@ /*! | ||
// To prevent this, we need to force the input `indeterminate` state to be in sync with our. | ||
createEffect(on([() => ref, () => context.checked()], ([ref]) => { | ||
createEffect(on([() => ref, () => context.indeterminate(), () => context.checked()], ([ref, indeterminate]) => { | ||
if (ref) { | ||
ref.indeterminate = context.indeterminate() || false; | ||
ref.indeterminate = !!indeterminate; | ||
} | ||
@@ -57,0 +57,0 @@ })); |
@@ -34,2 +34,3 @@ // utils | ||
export * as Separator from "./separator"; | ||
//export * as Slider from "./slider"; | ||
export * as Switch from "./switch"; | ||
@@ -36,0 +37,0 @@ export * as Tabs from "./tabs"; |
@@ -8,3 +8,3 @@ /*! | ||
*/ | ||
import { callHandler, mergeRefs } from "@kobalte/utils"; | ||
import { mergeRefs } from "@kobalte/utils"; | ||
import { splitProps } from "solid-js"; | ||
@@ -18,12 +18,5 @@ import { Polymorphic } from "../polymorphic"; | ||
let ref; | ||
const [local, others] = splitProps(props, ["ref", "type", "disabled", "onClick"]); | ||
const [local, others] = splitProps(props, ["ref", "type", "href", "disabled"]); | ||
const tagName = createTagName(() => ref, () => "a"); | ||
const onClick = e => { | ||
if (local.disabled) { | ||
e.preventDefault(); | ||
return; | ||
} | ||
callHandler(e, local.onClick); | ||
}; | ||
return (<Polymorphic as="a" ref={mergeRefs(el => (ref = el), local.ref)} role={tagName() !== "a" ? "link" : undefined} tabIndex={tagName() !== "a" && !local.disabled ? 0 : undefined} aria-disabled={local.disabled ? true : undefined} data-disabled={local.disabled ? "" : undefined} onClick={onClick} {...others}/>); | ||
return (<Polymorphic as="a" ref={mergeRefs(el => (ref = el), local.ref)} role={tagName() !== "a" || local.disabled ? "link" : undefined} tabIndex={tagName() !== "a" && !local.disabled ? 0 : undefined} href={!local.disabled ? local.href : undefined} aria-disabled={local.disabled ? true : undefined} data-disabled={local.disabled ? "" : undefined} {...others}/>); | ||
} |
@@ -9,3 +9,3 @@ /*! | ||
*/ | ||
import { mergeDefaultProps, mergeRefs } from "@kobalte/utils"; | ||
import { composeEventHandlers, mergeDefaultProps, mergeRefs, } from "@kobalte/utils"; | ||
import { createEffect, on, splitProps } from "solid-js"; | ||
@@ -23,3 +23,3 @@ import { useTextFieldContext } from "./text-field-context"; | ||
}, props); | ||
const [local, others] = splitProps(props, ["ref", "autoResize"]); | ||
const [local, others] = splitProps(props, ["ref", "autoResize", "submitOnEnter", "onKeyPress"]); | ||
createEffect(on([() => ref, () => local.autoResize, () => context.value()], ([ref, autoResize]) => { | ||
@@ -31,3 +31,11 @@ if (!ref || !autoResize) { | ||
})); | ||
return (<TextFieldInputBase as="textarea" ref={mergeRefs(el => (ref = el), local.ref)} {...others}/>); | ||
const onKeyPress = (event) => { | ||
if (ref && local.submitOnEnter && event.key === "Enter" && !event.shiftKey) { | ||
if (ref.form) { | ||
ref.form.requestSubmit(); | ||
event.preventDefault(); | ||
} | ||
} | ||
}; | ||
return (<TextFieldInputBase as="textarea" aria-multiline={local.submitOnEnter ? "false" : undefined} onKeyPress={composeEventHandlers([local.onKeyPress, onKeyPress])} ref={mergeRefs(el => (ref = el), local.ref)} {...others}/>); | ||
} | ||
@@ -34,0 +42,0 @@ /** |
@@ -9,3 +9,2 @@ /*! | ||
import { OverrideComponentProps } from "@kobalte/utils"; | ||
import { JSX } from "solid-js"; | ||
import { AsChildProp } from "../polymorphic"; | ||
@@ -21,2 +20,2 @@ export interface LinkRootOptions extends AsChildProp { | ||
*/ | ||
export declare function LinkRoot(props: LinkRootProps): JSX.Element; | ||
export declare function LinkRoot(props: LinkRootProps): import("solid-js").JSX.Element; |
@@ -14,2 +14,4 @@ /*! | ||
autoResize?: boolean; | ||
/** Whether the form should be submitted when the user presses the enter key. */ | ||
submitOnEnter?: boolean; | ||
} | ||
@@ -16,0 +18,0 @@ export interface TextFieldTextAreaProps extends OverrideComponentProps<"textarea", TextFieldTextAreaOptions> { |
{ | ||
"name": "@kobalte/core", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"private": false, | ||
@@ -53,3 +53,3 @@ "description": "Unstyled components and primitives for building accessible web apps and design systems with SolidJS.", | ||
"@internationalized/number": "^3.2.0", | ||
"@kobalte/utils": "^0.7.1" | ||
"@kobalte/utils": "^0.7.2" | ||
}, | ||
@@ -56,0 +56,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3965026
44848
Updated@kobalte/utils@^0.7.2