Textarea.countOf
function · packages/mixins-ui/src/textarea.ts:28
function countOf(value: string, maxLength?: number): string12 / 280, or 12 with no limit: characters as maxlength counts them, in UTF-16 units.
Mixins / foldkit-mixins-ui
namespace · packages/mixins-ui/src/textarea.ts:1
export * as Textarea from './textarea.js'Textarea.countOffunction · packages/mixins-ui/src/textarea.ts:28
function countOf(value: string, maxLength?: number): string12 / 280, or 12 with no limit: characters as maxlength counts them, in UTF-16 units.
Textarea.fieldfunction · packages/mixins-ui/src/textarea.ts:230
function field<Message>(
options: TextareaField<Message>,
h: HtmlBuilder<Message>,
): HtmlTextarea.resolvefunction · packages/mixins-ui/src/textarea.ts:49
function resolve<Input, Message>(
attributes: TextareaAttributes<Message> &
Partial<
Record<
'count' | 'frame' | 'footer' | 'meta',
ReadonlyArray<Attribute<Message>>
>
>,
mixins: MixinList<Message>,
context: ResolveContext<Input, Message>,
): ResolvedTextarea<Message>Applies mixins to the textarea's bundles: upstream's, and any of this package's own slots given.
Textarea.ResolvedTextareatype · packages/mixins-ui/src/textarea.ts:41
type ResolvedTextarea<Message> = Omit<
Resolved<TextareaAttributes<Message>, typeof TextareaSlots, Message>,
'textarea'
> & {
readonly textarea: ReadonlyArray<TextareaAttribute<Message> | ChildAttribute>
}The textarea's bundles with the attached Mixins applied. textarea is typed
for h.textarea, which refuses InnerHTML.
Textarea.TextareaFieldinterface · packages/mixins-ui/src/textarea.ts:209
interface TextareaField<Message> {
readonly id: string
readonly label: string
readonly field: FieldValidation.Field<unknown>
readonly changed: (value: string) => Message
readonly rows?: number | undefined
readonly maxRows?: number | undefined
readonly maxLength?: number | undefined
readonly count?: boolean | undefined
readonly footer?: ReadonlyArray<Html> | undefined
readonly placeholder?: string | undefined
readonly style?: NamedStyle<typeof TextareaSlots> | undefined
readonly mixins?: MixinList<Message> | undefined
readonly draw?:
((parts: TextareaParts, h: HtmlBuilder<Message>) => Html) | undefined
}A textarea field in one call: a field's state drawn through view with
its label, control, and description placed. The value is drawn with
String(), as the base field view draws any draft. draw places the
parts; the default stacks them, the description and the count sharing the
row under the field. With a footer, the control is a frame holding the
text and the footer under it, the count at the footer's end. rows,
maxRows, maxLength and placeholder ride through only where given.
Textarea.TextareaPartsinterface · packages/mixins-ui/src/textarea.ts:196
interface TextareaParts extends FieldParts {
readonly count: Html
}A textarea field's pieces, drawn: a text field's, and its count (h.empty where it is not drawn).
Textarea.TextareaSlotsconst · packages/mixins-ui/src/textarea.ts:9
const TextareaSlots: Slots.Contract<{ readonly textarea: Slot.UnnamedSlot<Capability.Capability<"TextInput", readonly [Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>]>, readonly [Event.EventToken<"input">, Event.EventToken<"focus">, Event.EventToken<"blur">], readonly [Attr.AttrToken<"aria-label">, Attr.AttrToken<"aria-invalid">, Attr.AttrToken<"disabled">, Attr.AttrToken<"value">], readonly Slot.RequirementName[], boolean>; readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly description: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly [Attr.AttrToken<"role">], readonly Slot.RequirementName[], boolean>; readonly count: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly frame: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>] …;Textarea.TextareaViewinterface · packages/mixins-ui/src/textarea.ts:76
interface TextareaView<Message> {
readonly id: string
readonly value?: string | undefined
readonly onInput?: ((value: string) => Message) | undefined
readonly disabled?: boolean | undefined
readonly readOnly?: boolean | undefined
readonly invalid?: boolean | undefined
readonly described?: boolean | undefined
readonly rows?: number | undefined
readonly maxRows?: number | undefined
readonly maxLength?: number | undefined
readonly count?: boolean | undefined
readonly name?: string | undefined
readonly required?: boolean | undefined
readonly autocomplete?: string | undefined
readonly placeholder?: string | undefined
readonly attributes?:
| ({
readonly textarea?: ReadonlyArray<TextareaAttribute<NoInfer<Message>>>
} & {
readonly [
K in Exclude<keyof typeof TextareaSlots, 'textarea'>
]?: ReadonlyArray<Attribute<NoInfer<Message>>>
})
| undefined
readonly style?: NamedStyle<typeof TextareaSlots> | undefined
readonly mixins?: MixinList<Message> | undefined
readonly input?: unknown
readonly draw: (
resolved: ResolvedTextarea<Message>,
h: HtmlBuilder<Message>,
) => Html
}A textarea in one call: its value and Messages, a style for its slots, and
the rest of @foldkit/ui's own config. draw places the resolved
bundles: textarea, label and description, and where the field has
them count (its text is countOf), frame and footer (the box around
the text and a row of controls under it), and meta (the row under the field).
Textarea.toViewfunction · packages/mixins-ui/src/textarea.ts:60
function toView<Message>(
mixins: MixinList<Message>,
context: ResolveContext<unknown, Message>,
draw: (resolved: ResolvedTextarea<Message>) => Html,
): (attributes: TextareaAttributes<Message>) => HtmlThe textarea's toView: draw receives its bundles with mixins applied.
Textarea.viewfunction · packages/mixins-ui/src/textarea.ts:125
function view<Message>(
options: TextareaView<Message>,
h: HtmlBuilder<Message>,
): Html