@htmlbricks/hb-input-range
Advanced tools
+55
-13
@@ -63,20 +63,44 @@ { | ||
| }, | ||
| "FormSchemaDependency": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "id": { | ||
| "type": "string" | ||
| }, | ||
| "values": { | ||
| "items": { | ||
| "type": [ | ||
| "string", | ||
| "number", | ||
| "boolean" | ||
| ] | ||
| }, | ||
| "type": "array" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "id" | ||
| ], | ||
| "type": "object" | ||
| }, | ||
| "FormSchemaEntry": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "dependencies": { | ||
| "items": { | ||
| "$ref": "#/definitions/FormSchemaDependency" | ||
| }, | ||
| "type": "array" | ||
| }, | ||
| "disabled": { | ||
| "description": "When true, the native control is disabled and non-interactive.", | ||
| "type": "boolean" | ||
| }, | ||
| "id": { | ||
| "description": "This will be both the key of the object when submitting the form's data, and also the id in the DOM.", | ||
| "type": "string" | ||
| }, | ||
| "label": { | ||
| "description": "The descriptive label that will show alongside the form control.", | ||
| "type": "string" | ||
| }, | ||
| "params": { | ||
| "description": "Other parameters that may be specific to a certain kind of form control.", | ||
| "type": "object" | ||
| "$ref": "#/definitions/InputRangeParams" | ||
| }, | ||
@@ -90,5 +114,8 @@ "placeholder": { | ||
| "required": { | ||
| "description": "This doesn't matter if the dependencies requirements aren't met.", | ||
| "type": "boolean" | ||
| }, | ||
| "type": { | ||
| "description": "Discriminator for `hb-form` rows (`row`, `text`, `number`, …). May be omitted on a standalone `schemaentry` when implied by the host tag.", | ||
| "type": "string" | ||
| }, | ||
| "validationRegex": { | ||
@@ -98,9 +125,5 @@ "type": "string" | ||
| "validationTip": { | ||
| "description": "Shows if value is not valid.", | ||
| "type": "string" | ||
| }, | ||
| "value": { | ||
| "description": "Optional default value.", | ||
| "type": "number" | ||
| } | ||
| "value": {} | ||
| }, | ||
@@ -111,2 +134,21 @@ "required": [ | ||
| "type": "object" | ||
| }, | ||
| "InputRangeParams": { | ||
| "additionalProperties": false, | ||
| "description": "Slider bounds. Keys are read with `hasOwnProperty`; values may be numbers or numeric strings.", | ||
| "properties": { | ||
| "max": { | ||
| "type": [ | ||
| "number", | ||
| "string" | ||
| ] | ||
| }, | ||
| "min": { | ||
| "type": [ | ||
| "number", | ||
| "string" | ||
| ] | ||
| } | ||
| }, | ||
| "type": "object" | ||
| } | ||
@@ -116,3 +158,3 @@ } | ||
| }, | ||
| "description": "Range slider (`type=\"range\"`) whose bounds come from `schemaentry.params.min` and/or `max` when those keys exist. Parses stringified `schemaentry` when needed and enforces required/min/max rules for the numeric value. Dispatches `setVal` with `{ value, valid, id }` and shows `validationTip` as Bulma `help is-danger` when `show_validation` is enabled. Theme `--bulma-*` on `:host`; native range uses `accent-color` (not the Bulma text-input class).", | ||
| "description": "Range slider (`type=\"range\"`). Optional `params` as `InputRangeParams`: `min` / `max` may be numbers or numeric strings; each key is applied only if present on `params` (same `hasOwnProperty` pattern as number input). Coerces values for validation and native `min`/`max`. Dispatches `setVal` `{ value, valid, id }` (`value` may be `undefined`). `validationTip` + `show_validation` use Bulma `help is-danger`. Theme `--bulma-*` on `:host`; range track uses `accent-color`. See `InputRangeParams` in `types/webcomponent.type.d.ts`.", | ||
| "storybookArgs": { | ||
@@ -249,3 +291,3 @@ "schemaentry": { | ||
| "repoName": "@htmlbricks/hb-input-range", | ||
| "version": "0.71.32" | ||
| "version": "0.71.33" | ||
| } |
+2
-2
| { | ||
| "name": "@htmlbricks/hb-input-range", | ||
| "version": "0.71.32", | ||
| "version": "0.71.33", | ||
| "contributors": [], | ||
| "description": "Range slider (`type=\"range\"`) whose bounds come from `schemaentry.params.min` and/or `max` when those keys exist. Parses stringified `schemaentry` when needed and enforces required/min/max rules for the numeric value. Dispatches `setVal` with `{ value, valid, id }` and shows `validationTip` as Bulma `help is-danger` when `show_validation` is enabled. Theme `--bulma-*` on `:host`; native range uses `accent-color` (not the Bulma text-input class).", | ||
| "description": "Range slider (`type=\"range\"`). Optional `params` as `InputRangeParams`: `min` / `max` may be numbers or numeric strings; each key is applied only if present on `params` (same `hasOwnProperty` pattern as number input). Coerces values for validation and native `min`/`max`. Dispatches `setVal` `{ value, valid, id }` (`value` may be `undefined`). `validationTip` + `show_validation` use Bulma `help is-danger`. Theme `--bulma-*` on `:host`; range track uses `accent-color`. See `InputRangeParams` in `types/webcomponent.type.d.ts`.", | ||
| "licenses": [ | ||
@@ -7,0 +7,0 @@ { |
+14
-3
@@ -8,3 +8,3 @@ ## `hb-input-range` — input-range | ||
| Range slider (`type="range"`) whose bounds come from `schemaentry.params.min` and/or `max` when those keys exist. Parses stringified `schemaentry` when needed and enforces required / min / max on the numeric value. Dispatches `setVal` with `{ value, valid, id }` and shows `validationTip` as Bulma `help is-danger` when `show_validation` is `yes` and the field is invalid. | ||
| Range slider (`type="range"`). Optional **`InputRangeParams`**: **`min`** / **`max`** as numbers or numeric strings; each attribute is applied only if the corresponding key exists on **`params`** (same pattern as **`hb-input-number`**). Dispatches **`setVal`** `{ value, valid, id }` (numeric `value` may be **`undefined`**) and shows **`validationTip`** as Bulma **`help is-danger`** when **`show_validation`** is **`yes`** and invalid. | ||
@@ -23,8 +23,19 @@ ### Styling (Bulma) | ||
| - `style` — optional string | ||
| - `schemaentry` — required string (JSON: `id`, `label?`, `required?`, `value?` (number), `validationTip?`, `params.min` / `params.max`, …) | ||
| - `schemaentry` — required string (JSON: `id`, `label?`, `required?`, `value?` (number), `validationTip?`, optional `params` as **`InputRangeParams`**) | ||
| - `show_validation` — optional `"yes"` | `"no"` | ||
| ### `schemaentry.params` (`InputRangeParams`) | ||
| | Key | Type | Description | | ||
| | --- | --- | --- | | ||
| | `min` | `number \| string` | Native `min` + validation when the key exists. | | ||
| | `max` | `number \| string` | Native `max` + validation when the key exists. | | ||
| ### Typings | ||
| **`types/webcomponent.type.d.ts`** — `InputRangeParams`, `FormSchemaEntry`, `Component`, `Events`. | ||
| ### Events | ||
| - `setVal` — `{ value: number; valid: boolean; id: string }` | ||
| - `setVal` — `{ value: number | undefined; valid: boolean; id: string }` | ||
@@ -31,0 +42,0 @@ ### Usage notes |
@@ -27,20 +27,44 @@ { | ||
| }, | ||
| "FormSchemaDependency": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "id": { | ||
| "type": "string" | ||
| }, | ||
| "values": { | ||
| "items": { | ||
| "type": [ | ||
| "string", | ||
| "number", | ||
| "boolean" | ||
| ] | ||
| }, | ||
| "type": "array" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "id" | ||
| ], | ||
| "type": "object" | ||
| }, | ||
| "FormSchemaEntry": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "dependencies": { | ||
| "items": { | ||
| "$ref": "#/definitions/FormSchemaDependency" | ||
| }, | ||
| "type": "array" | ||
| }, | ||
| "disabled": { | ||
| "description": "When true, the native control is disabled and non-interactive.", | ||
| "type": "boolean" | ||
| }, | ||
| "id": { | ||
| "description": "This will be both the key of the object when submitting the form's data, and also the id in the DOM.", | ||
| "type": "string" | ||
| }, | ||
| "label": { | ||
| "description": "The descriptive label that will show alongside the form control.", | ||
| "type": "string" | ||
| }, | ||
| "params": { | ||
| "description": "Other parameters that may be specific to a certain kind of form control.", | ||
| "type": "object" | ||
| "$ref": "#/definitions/InputRangeParams" | ||
| }, | ||
@@ -54,5 +78,8 @@ "placeholder": { | ||
| "required": { | ||
| "description": "This doesn't matter if the dependencies requirements aren't met.", | ||
| "type": "boolean" | ||
| }, | ||
| "type": { | ||
| "description": "Discriminator for `hb-form` rows (`row`, `text`, `number`, …). May be omitted on a standalone `schemaentry` when implied by the host tag.", | ||
| "type": "string" | ||
| }, | ||
| "validationRegex": { | ||
@@ -62,9 +89,5 @@ "type": "string" | ||
| "validationTip": { | ||
| "description": "Shows if value is not valid.", | ||
| "type": "string" | ||
| }, | ||
| "value": { | ||
| "description": "Optional default value.", | ||
| "type": "number" | ||
| } | ||
| "value": {} | ||
| }, | ||
@@ -75,4 +98,23 @@ "required": [ | ||
| "type": "object" | ||
| }, | ||
| "InputRangeParams": { | ||
| "additionalProperties": false, | ||
| "description": "Slider bounds. Keys are read with `hasOwnProperty`; values may be numbers or numeric strings.", | ||
| "properties": { | ||
| "max": { | ||
| "type": [ | ||
| "number", | ||
| "string" | ||
| ] | ||
| }, | ||
| "min": { | ||
| "type": [ | ||
| "number", | ||
| "string" | ||
| ] | ||
| } | ||
| }, | ||
| "type": "object" | ||
| } | ||
| } | ||
| } |
@@ -1,13 +0,12 @@ | ||
| export type FormSchemaEntry = { | ||
| /** | ||
| * This will be both the key of the object when submitting the form's data, | ||
| * and also the id in the DOM. | ||
| */ | ||
| id: string; | ||
| import type { FormSchemaEntryShared } from "../../form/types/webcomponent.type"; | ||
| /** | ||
| * The descriptive label that will show alongside the form control. | ||
| */ | ||
| label?: string; | ||
| /** | ||
| * Slider bounds. Keys are read with `hasOwnProperty`; values may be numbers or numeric strings. | ||
| */ | ||
| export type InputRangeParams = { | ||
| min?: number | string; | ||
| max?: number | string; | ||
| }; | ||
| export type FormSchemaEntry = Omit<FormSchemaEntryShared, "params"> & { | ||
| /** | ||
@@ -17,25 +16,3 @@ * Optional default value. | ||
| value?: number; | ||
| readonly?: boolean; | ||
| /** When true, the native control is disabled and non-interactive. */ | ||
| disabled?: boolean; | ||
| /** | ||
| * This doesn't matter if the dependencies requirements aren't met. | ||
| */ | ||
| required?: boolean; | ||
| validationRegex?: string; | ||
| /** | ||
| * Shows if value is not valid. | ||
| */ | ||
| validationTip?: string; | ||
| placeholder?: string; | ||
| /** | ||
| * Other parameters that may be specific to a certain kind of form control. | ||
| */ | ||
| params?: Record<string, any>; | ||
| params?: InputRangeParams; | ||
| }; | ||
@@ -42,0 +19,0 @@ |
605365
0.27%1199
5.92%52
26.83%