@progressive-development/pd-forms 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -2
- package/README.md +56 -62
- package/dist/base/pd-base-input-element.d.ts +10 -10
- package/dist/base/pd-base-input-element.d.ts.map +1 -1
- package/dist/base/pd-base-input-element.js +8 -1
- package/dist/base/pd-base-ui-input.d.ts +41 -16
- package/dist/base/pd-base-ui-input.d.ts.map +1 -1
- package/dist/base/pd-base-ui-input.js +25 -6
- package/dist/base/pd-base-ui.d.ts.map +1 -1
- package/dist/base/pd-base-ui.js +1 -20
- package/dist/generated/locales/be.d.ts +3 -0
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +3 -0
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +3 -0
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/locales/be.js +4 -1
- package/dist/locales/de.js +4 -1
- package/dist/locales/en.js +4 -1
- package/dist/pd-button/PdButton.d.ts +171 -37
- package/dist/pd-button/PdButton.d.ts.map +1 -1
- package/dist/pd-button/PdButton.js +502 -71
- package/dist/pd-button/pd-button.stories.d.ts +82 -10
- package/dist/pd-button/pd-button.stories.d.ts.map +1 -1
- package/dist/pd-button-group/PdButtonGroup.d.ts +25 -0
- package/dist/pd-button-group/PdButtonGroup.d.ts.map +1 -1
- package/dist/pd-button-group/PdButtonGroup.js +52 -27
- package/dist/pd-button-group/pd-button-group.stories.d.ts +42 -17
- package/dist/pd-button-group/pd-button-group.stories.d.ts.map +1 -1
- package/dist/pd-button-select-group/PdButtonSelectGroup.d.ts +17 -3
- package/dist/pd-button-select-group/PdButtonSelectGroup.d.ts.map +1 -1
- package/dist/pd-button-select-group/PdButtonSelectGroup.js +23 -19
- package/dist/pd-button-select-group/pd-button-select-group.stories.d.ts +43 -18
- package/dist/pd-button-select-group/pd-button-select-group.stories.d.ts.map +1 -1
- package/dist/pd-checkbox/PdCheckbox.d.ts +23 -2
- package/dist/pd-checkbox/PdCheckbox.d.ts.map +1 -1
- package/dist/pd-checkbox/PdCheckbox.js +85 -21
- package/dist/pd-checkbox/pd-checkbox.stories.d.ts +43 -27
- package/dist/pd-checkbox/pd-checkbox.stories.d.ts.map +1 -1
- package/dist/pd-form-container/PdFormContainer.d.ts +30 -9
- package/dist/pd-form-container/PdFormContainer.d.ts.map +1 -1
- package/dist/pd-form-container/PdFormContainer.js +59 -8
- package/dist/pd-form-container/pd-form-container.stories.d.ts +49 -0
- package/dist/pd-form-container/pd-form-container.stories.d.ts.map +1 -0
- package/dist/pd-form-field/PdFormField.d.ts +35 -0
- package/dist/pd-form-field/PdFormField.d.ts.map +1 -0
- package/dist/pd-form-field/PdFormField.js +38 -0
- package/dist/pd-form-field/pd-form-field.d.ts +3 -0
- package/dist/pd-form-field/pd-form-field.d.ts.map +1 -0
- package/dist/pd-form-field/pd-form-field.stories.d.ts +40 -0
- package/dist/pd-form-field/pd-form-field.stories.d.ts.map +1 -0
- package/dist/pd-form-field.d.ts +2 -0
- package/dist/pd-form-field.js +8 -0
- package/dist/pd-form-fieldset/PdFormFieldset.d.ts +144 -0
- package/dist/pd-form-fieldset/PdFormFieldset.d.ts.map +1 -0
- package/dist/pd-form-fieldset/PdFormFieldset.js +364 -0
- package/dist/pd-form-fieldset/index.d.ts +2 -0
- package/dist/pd-form-fieldset/index.d.ts.map +1 -0
- package/dist/pd-form-fieldset/pd-form-fieldset.d.ts +3 -0
- package/dist/pd-form-fieldset/pd-form-fieldset.d.ts.map +1 -0
- package/dist/pd-form-fieldset/pd-form-fieldset.js +8 -0
- package/dist/pd-form-fieldset/pd-form-fieldset.stories.d.ts +38 -0
- package/dist/pd-form-fieldset/pd-form-fieldset.stories.d.ts.map +1 -0
- package/dist/pd-form-row/PdFormRow.d.ts +35 -5
- package/dist/pd-form-row/PdFormRow.d.ts.map +1 -1
- package/dist/pd-form-row/PdFormRow.js +135 -69
- package/dist/pd-form-row/pd-form-row.stories.d.ts +41 -25
- package/dist/pd-form-row/pd-form-row.stories.d.ts.map +1 -1
- package/dist/pd-generic-form/PdGenericForm.d.ts +50 -0
- package/dist/pd-generic-form/PdGenericForm.d.ts.map +1 -0
- package/dist/pd-generic-form/PdGenericForm.js +334 -0
- package/dist/pd-generic-form/pd-generic-form.d.ts +3 -0
- package/dist/pd-generic-form/pd-generic-form.d.ts.map +1 -0
- package/dist/pd-generic-form/pd-generic-form.stories.d.ts +35 -0
- package/dist/pd-generic-form/pd-generic-form.stories.d.ts.map +1 -0
- package/dist/pd-generic-form/pd-generic-form.styles.d.ts +2 -0
- package/dist/pd-generic-form/pd-generic-form.styles.d.ts.map +1 -0
- package/dist/pd-generic-form/pd-generic-form.styles.js +110 -0
- package/dist/pd-generic-form/pd-generic-form.test.d.ts +1 -0
- package/dist/pd-generic-form/pd-generic-form.test.d.ts.map +1 -0
- package/dist/pd-generic-form.d.ts +2 -0
- package/dist/pd-generic-form.js +8 -0
- package/dist/pd-hover-box/PdHoverBox.d.ts +61 -11
- package/dist/pd-hover-box/PdHoverBox.d.ts.map +1 -1
- package/dist/pd-hover-box/PdHoverBox.js +130 -28
- package/dist/pd-hover-box/pd-hover-box.stories.d.ts +28 -5
- package/dist/pd-hover-box/pd-hover-box.stories.d.ts.map +1 -1
- package/dist/pd-input/PdComboboxInput.d.ts +20 -0
- package/dist/pd-input/PdComboboxInput.d.ts.map +1 -0
- package/dist/pd-input/PdComboboxInput.js +67 -0
- package/dist/pd-input/PdInput.d.ts +33 -15
- package/dist/pd-input/PdInput.d.ts.map +1 -1
- package/dist/pd-input/PdInput.js +49 -21
- package/dist/pd-input/pd-input.stories.d.ts +71 -35
- package/dist/pd-input/pd-input.stories.d.ts.map +1 -1
- package/dist/pd-input-area/PdInputArea.d.ts +19 -6
- package/dist/pd-input-area/PdInputArea.d.ts.map +1 -1
- package/dist/pd-input-area/PdInputArea.js +17 -15
- package/dist/pd-input-area/pd-input-area.stories.d.ts +65 -52
- package/dist/pd-input-area/pd-input-area.stories.d.ts.map +1 -1
- package/dist/pd-input-file/PdInputFile.d.ts +24 -0
- package/dist/pd-input-file/PdInputFile.d.ts.map +1 -1
- package/dist/pd-input-file/PdInputFile.js +53 -22
- package/dist/pd-input-file/pd-input-file.stories.d.ts +51 -47
- package/dist/pd-input-file/pd-input-file.stories.d.ts.map +1 -1
- package/dist/pd-input-time/PdInputTime.d.ts +21 -0
- package/dist/pd-input-time/PdInputTime.d.ts.map +1 -1
- package/dist/pd-input-time/PdInputTime.js +48 -22
- package/dist/pd-input-time/pd-input-time.stories.d.ts +94 -0
- package/dist/pd-input-time/pd-input-time.stories.d.ts.map +1 -0
- package/dist/pd-panel-button/PdPanelButton.d.ts +50 -34
- package/dist/pd-panel-button/PdPanelButton.d.ts.map +1 -1
- package/dist/pd-panel-button/PdPanelButton.js +149 -265
- package/dist/pd-panel-button/pd-panel-button.stories.d.ts +55 -25
- package/dist/pd-panel-button/pd-panel-button.stories.d.ts.map +1 -1
- package/dist/pd-radio-group/PdRadioGroup.d.ts +14 -0
- package/dist/pd-radio-group/PdRadioGroup.d.ts.map +1 -1
- package/dist/pd-radio-group/PdRadioGroup.js +48 -11
- package/dist/pd-radio-group/pd-radio-group.stories.d.ts +37 -7
- package/dist/pd-radio-group/pd-radio-group.stories.d.ts.map +1 -1
- package/dist/pd-range/PdRange.d.ts +22 -2
- package/dist/pd-range/PdRange.d.ts.map +1 -1
- package/dist/pd-range/PdRange.js +54 -43
- package/dist/pd-range/pd-range.stories.d.ts +49 -7
- package/dist/pd-range/pd-range.stories.d.ts.map +1 -1
- package/dist/pd-select/PdSelect.d.ts +16 -4
- package/dist/pd-select/PdSelect.d.ts.map +1 -1
- package/dist/pd-select/PdSelect.js +23 -21
- package/dist/pd-select/pd-select.stories.d.ts +56 -35
- package/dist/pd-select/pd-select.stories.d.ts.map +1 -1
- package/dist/pd-suggestion-box/PdSuggestionBox.d.ts +74 -0
- package/dist/pd-suggestion-box/PdSuggestionBox.d.ts.map +1 -0
- package/dist/pd-suggestion-box/PdSuggestionBox.js +277 -0
- package/dist/pd-suggestion-box/PdSuggestionPanel.d.ts +42 -0
- package/dist/pd-suggestion-box/PdSuggestionPanel.d.ts.map +1 -0
- package/dist/pd-suggestion-box/PdSuggestionPanel.js +227 -0
- package/dist/pd-suggestion-box/pd-suggestion-box.d.ts +3 -0
- package/dist/pd-suggestion-box/pd-suggestion-box.d.ts.map +1 -0
- package/dist/pd-suggestion-box/pd-suggestion-box.stories.d.ts +79 -0
- package/dist/pd-suggestion-box/pd-suggestion-box.stories.d.ts.map +1 -0
- package/dist/pd-suggestion-box.d.ts +2 -0
- package/dist/pd-suggestion-box.js +8 -0
- package/dist/pd-utils/dist/position-helper.js +35 -0
- package/dist/stories/pd-forms-overview.stories.d.ts +48 -0
- package/dist/stories/pd-forms-overview.stories.d.ts.map +1 -0
- package/dist/stories/story-helpers.d.ts +10 -0
- package/dist/stories/story-helpers.d.ts.map +1 -0
- package/dist/styles/shared-input-field-styles.d.ts.map +1 -1
- package/dist/styles/shared-input-field-styles.js +13 -19
- package/dist/styles/shared-input-styles.d.ts.map +1 -1
- package/dist/styles/shared-input-styles.js +18 -14
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -5
- package/dist/pd-form-container/form-container.stories.d.ts +0 -28
- package/dist/pd-form-container/form-container.stories.d.ts.map +0 -1
- package/dist/pd-form-container/form-container2.stories.d.ts +0 -8
- package/dist/pd-form-container/form-container2.stories.d.ts.map +0 -1
- package/dist/pd-form-container/form-container3.stories.d.ts +0 -11
- package/dist/pd-form-container/form-container3.stories.d.ts.map +0 -1
- package/dist/stories/01_index.stories.d.ts +0 -58
- package/dist/stories/01_index.stories.d.ts.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
interface PdFormFieldArgs {
|
|
3
|
+
span: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* ## pd-form-field
|
|
7
|
+
*
|
|
8
|
+
* Wrapper component for custom content within pd-form-row.
|
|
9
|
+
*
|
|
10
|
+
* Use this component when you need to include non-pd form elements
|
|
11
|
+
* (custom components, native HTML elements, etc.) in a pd-form-row
|
|
12
|
+
* while maintaining proper grid layout positioning.
|
|
13
|
+
*
|
|
14
|
+
* ### Features
|
|
15
|
+
* - Grid-aware positioning with span property
|
|
16
|
+
* - Works seamlessly with pd-form-row's 12-column grid
|
|
17
|
+
* - Supports all semantic and numeric span values
|
|
18
|
+
*
|
|
19
|
+
* ### When to Use
|
|
20
|
+
* - Wrapping custom web components
|
|
21
|
+
* - Including native HTML form elements
|
|
22
|
+
* - Adding non-form content to a form row
|
|
23
|
+
* - Creating complex layouts with mixed content types
|
|
24
|
+
*/
|
|
25
|
+
declare const meta: Meta<PdFormFieldArgs>;
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<PdFormFieldArgs>;
|
|
28
|
+
/** Default usage with full width. Interactive via Controls panel. */
|
|
29
|
+
export declare const Default: Story;
|
|
30
|
+
/** All semantic span values demonstration. */
|
|
31
|
+
export declare const AllSpanValues: Story;
|
|
32
|
+
/** Wrapping a native HTML input alongside a pd-input. */
|
|
33
|
+
export declare const NativeHtmlInput: Story;
|
|
34
|
+
/** Informational content alongside a form input. */
|
|
35
|
+
export declare const InfoPanel: Story;
|
|
36
|
+
/** Multiple pd-form-field elements filling a row. */
|
|
37
|
+
export declare const MultipleCustomElements: Story;
|
|
38
|
+
/** Mixed pd-input and pd-form-field elements in a realistic form layout. */
|
|
39
|
+
export declare const MixedWithInputs: Story;
|
|
40
|
+
//# sourceMappingURL=pd-form-field.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-form-field.stories.d.ts","sourceRoot":"","sources":["../../src/pd-form-field/pd-form-field.stories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,+BAA+B,CAAC;AACvC,OAAO,yBAAyB,CAAC;AAMjC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,eAAe,CAgE/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAMvC,qEAAqE;AACrE,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAMF,8CAA8C;AAC9C,eAAO,MAAM,aAAa,EAAE,KAgF3B,CAAC;AAMF,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAC;AAMF,oDAAoD;AACpD,eAAO,MAAM,SAAS,EAAE,KA0BvB,CAAC;AAMF,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,EAAE,KAyCpC,CAAC;AAMF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,KAiE7B,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { CSSResultGroup, TemplateResult } from 'lit';
|
|
2
|
+
import { PdBaseUI } from '../base/pd-base-ui.js';
|
|
3
|
+
import { PdFormElementStatus } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Groups form fields and returns their values as an object.
|
|
6
|
+
*
|
|
7
|
+
* PdFormFieldset wraps a native `<fieldset>` element and acts as a container
|
|
8
|
+
* for form fields. It aggregates all child field values into a single object
|
|
9
|
+
* and registers itself with the parent PdFormContainer as a single field.
|
|
10
|
+
*
|
|
11
|
+
* @tagname pd-form-fieldset
|
|
12
|
+
* @summary Groups form fields and returns their values as an object.
|
|
13
|
+
*
|
|
14
|
+
* @event pd-form-element-register - Fired when fieldset registers with parent container.
|
|
15
|
+
* @event pd-form-element-change - Fired when any child field changes. Detail contains aggregated object.
|
|
16
|
+
* @event pd-form-element-unregister - Fired when fieldset disconnects from parent container.
|
|
17
|
+
*
|
|
18
|
+
* @slot - Form fields to group (pd-input, pd-select, etc.).
|
|
19
|
+
*
|
|
20
|
+
* @cssprop --pd-fieldset-border - Border style. Default: `1px solid var(--pd-default-light-col)`.
|
|
21
|
+
* @cssprop --pd-fieldset-border-radius - Border radius. Default: `var(--pd-radius-md, 4px)`.
|
|
22
|
+
* @cssprop --pd-fieldset-bg-col - Background color. Default: `transparent`.
|
|
23
|
+
* @cssprop --pd-fieldset-padding - Inner padding. Default: `1rem`.
|
|
24
|
+
* @cssprop --pd-fieldset-gap - Gap between child fields. Default: `var(--pd-spacing-sm, 0.5rem)`.
|
|
25
|
+
* @cssprop --pd-fieldset-legend-col - Legend text color. Default: `var(--pd-default-dark-col)`.
|
|
26
|
+
* @cssprop --pd-fieldset-legend-font-size - Legend font size. Default: `1em`.
|
|
27
|
+
* @cssprop --pd-fieldset-legend-font-weight - Legend font weight. Default: `500`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```html
|
|
31
|
+
* <pd-form-container>
|
|
32
|
+
* <pd-form-row>
|
|
33
|
+
* <pd-form-fieldset name="address" legend="Address" span="full">
|
|
34
|
+
* <pd-form-row>
|
|
35
|
+
* <pd-input valueName="street" label="Street" span="two-thirds"></pd-input>
|
|
36
|
+
* <pd-input valueName="number" label="Nr." span="third"></pd-input>
|
|
37
|
+
* </pd-form-row>
|
|
38
|
+
* <pd-form-row>
|
|
39
|
+
* <pd-input valueName="zip" label="ZIP" span="quarter"></pd-input>
|
|
40
|
+
* <pd-input valueName="city" label="City" span="three-quarters"></pd-input>
|
|
41
|
+
* </pd-form-row>
|
|
42
|
+
* </pd-form-fieldset>
|
|
43
|
+
* </pd-form-row>
|
|
44
|
+
* </pd-form-container>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* **Note:** Fieldsets must be wrapped in a pd-form-row for proper grid layout.
|
|
48
|
+
* Nesting pd-form-fieldset inside another pd-form-fieldset is not officially supported.
|
|
49
|
+
*/
|
|
50
|
+
export declare class PdFormFieldset extends PdBaseUI {
|
|
51
|
+
/**
|
|
52
|
+
* Name of the fieldset (becomes the key in FormContainer).
|
|
53
|
+
* The aggregated object will be registered under this name.
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Label for the fieldset.
|
|
58
|
+
* Rendered as `<legend>` inside the `<fieldset>`.
|
|
59
|
+
*/
|
|
60
|
+
legend: string;
|
|
61
|
+
/**
|
|
62
|
+
* Grid span for width control within pd-form-row.
|
|
63
|
+
* Allows fieldset to participate in form-row grid layout.
|
|
64
|
+
*
|
|
65
|
+
* **Important:** pd-form-fieldset must be wrapped in a pd-form-row to use the grid system.
|
|
66
|
+
* Set to "full" to span all columns, "half" for 50%, "third" for 33%, etc.
|
|
67
|
+
*/
|
|
68
|
+
span: string;
|
|
69
|
+
/** @ignore */
|
|
70
|
+
private _fields;
|
|
71
|
+
static styles: CSSResultGroup;
|
|
72
|
+
connectedCallback(): void;
|
|
73
|
+
disconnectedCallback(): void;
|
|
74
|
+
firstUpdated(): void;
|
|
75
|
+
render(): TemplateResult;
|
|
76
|
+
private _onChildRegister;
|
|
77
|
+
private _onChildChange;
|
|
78
|
+
private _onChildBlur;
|
|
79
|
+
private _onChildFocus;
|
|
80
|
+
/** @ignore */
|
|
81
|
+
private _onChildUnRegister;
|
|
82
|
+
/** @ignore */
|
|
83
|
+
private _onChildUnRegisterBound;
|
|
84
|
+
/**
|
|
85
|
+
* Checks if any child field is dirty.
|
|
86
|
+
*/
|
|
87
|
+
private _isDirty;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if any child field is touched.
|
|
90
|
+
*/
|
|
91
|
+
private _isTouched;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if any child field is focused.
|
|
94
|
+
*/
|
|
95
|
+
private _isFocused;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if all child fields are pristine.
|
|
98
|
+
*/
|
|
99
|
+
private _isPristine;
|
|
100
|
+
/**
|
|
101
|
+
* Returns aggregated value object from all child fields.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private _getAggregatedValue;
|
|
105
|
+
/**
|
|
106
|
+
* Returns aggregated parsed value object from all child fields.
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private _getAggregatedParsedValue;
|
|
110
|
+
/**
|
|
111
|
+
* Returns overall validity based on all child fields.
|
|
112
|
+
* Fieldset is valid only if ALL children are valid.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private _getOverallValidity;
|
|
116
|
+
/**
|
|
117
|
+
* Notifies parent container with aggregated value and state.
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
private _notifyContainer;
|
|
121
|
+
/**
|
|
122
|
+
* Registers fieldset at parent container.
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
private _registerAtContainer;
|
|
126
|
+
/**
|
|
127
|
+
* Unregisters fieldset from parent container.
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
130
|
+
private _unRegisterAtContainer;
|
|
131
|
+
/** Runs all field validators and returns overall validity. */
|
|
132
|
+
runValidators(): Promise<boolean>;
|
|
133
|
+
/** Resets all child fields to their initial values. */
|
|
134
|
+
reset(): void;
|
|
135
|
+
/** Clears all child fields. */
|
|
136
|
+
clear(): void;
|
|
137
|
+
/** Returns the current status map of all registered child fields. */
|
|
138
|
+
getStatus(): Map<string, PdFormElementStatus>;
|
|
139
|
+
/** Whether all child fields are currently valid. */
|
|
140
|
+
get valid(): boolean;
|
|
141
|
+
/** Current aggregated value object from all child fields. */
|
|
142
|
+
get value(): Record<string, any>;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=PdFormFieldset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdFormFieldset.d.ts","sourceRoot":"","sources":["../../src/pd-form-fieldset/PdFormFieldset.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C;;;OAGG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,MAAM,SAAM;IAEZ;;;;;;OAMG;IAEH,IAAI,EAAE,MAAM,CAAU;IAEtB,cAAc;IAEd,OAAO,CAAC,OAAO,CAA+C;IAE9D,OAAgB,MAAM,EAAE,cAAc,CAyCpC;IAEO,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAW5B,YAAY,IAAI,IAAI;IAKpB,MAAM,IAAI,cAAc;IAcjC,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,aAAa;IAWrB,cAAc;IACd,OAAO,CAAC,kBAAkB,CAexB;IAEF,cAAc;IACd,OAAO,CAAC,uBAAuB,CAAsC;IAErE;;OAEG;IACH,OAAO,CAAC,QAAQ;IAOhB;;OAEG;IACH,OAAO,CAAC,UAAU;IAOlB;;OAEG;IACH,OAAO,CAAC,UAAU;IAOlB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAQjC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAa9B,8DAA8D;IACjD,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAwB9C,uDAAuD;IAChD,KAAK,IAAI,IAAI;IAUpB,+BAA+B;IACxB,KAAK,IAAI,IAAI;IAUpB,qEAAqE;IAC9D,SAAS,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAIpD,oDAAoD;IACpD,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,6DAA6D;IAC7D,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAE/B;CACF"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { css, nothing, html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { PdBaseUI } from '../base/pd-base-ui.js';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = void 0 ;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = (decorator(target, key, result) ) || result;
|
|
11
|
+
if (result) __defProp(target, key, result);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
class PdFormFieldset extends PdBaseUI {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.name = "";
|
|
18
|
+
this.legend = "";
|
|
19
|
+
this.span = "full";
|
|
20
|
+
this._fields = /* @__PURE__ */ new Map();
|
|
21
|
+
/** @ignore */
|
|
22
|
+
this._onChildUnRegister = (e) => {
|
|
23
|
+
const { name } = e.detail;
|
|
24
|
+
console.debug("###### PdFormFieldset._onChildUnRegister", name);
|
|
25
|
+
if (this._fields.has(name)) {
|
|
26
|
+
this._fields.delete(name);
|
|
27
|
+
this.requestUpdate();
|
|
28
|
+
this._notifyContainer();
|
|
29
|
+
}
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
};
|
|
32
|
+
/** @ignore */
|
|
33
|
+
this._onChildUnRegisterBound = this._onChildUnRegister.bind(this);
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.styles = [
|
|
37
|
+
PdBaseUI.styles,
|
|
38
|
+
css`
|
|
39
|
+
:host {
|
|
40
|
+
display: block;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* When used in pd-form-row, span only the 12 main columns, NOT the helper column */
|
|
45
|
+
:host([span="full"]) {
|
|
46
|
+
grid-column: span 12 !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fieldset {
|
|
50
|
+
/* Customizable via CSS variables */
|
|
51
|
+
border: var(
|
|
52
|
+
--pd-fieldset-border,
|
|
53
|
+
1px solid var(--pd-default-light-col)
|
|
54
|
+
);
|
|
55
|
+
border-radius: var(
|
|
56
|
+
--pd-fieldset-border-radius,
|
|
57
|
+
var(--pd-radius-md, 4px)
|
|
58
|
+
);
|
|
59
|
+
background-color: var(--pd-fieldset-bg-col, transparent);
|
|
60
|
+
padding: var(--pd-fieldset-padding, 1rem);
|
|
61
|
+
margin: 0;
|
|
62
|
+
|
|
63
|
+
/* Layout for children */
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: var(--pd-fieldset-gap, var(--pd-spacing-sm, 0.5rem));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
legend {
|
|
70
|
+
color: var(--pd-fieldset-legend-col, var(--pd-default-dark-col));
|
|
71
|
+
font-family: var(--pd-default-font-content-family);
|
|
72
|
+
font-size: var(--pd-fieldset-legend-font-size, 1em);
|
|
73
|
+
font-weight: var(--pd-fieldset-legend-font-weight, 500);
|
|
74
|
+
padding: 0 0.5em;
|
|
75
|
+
}
|
|
76
|
+
`
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
super.connectedCallback();
|
|
81
|
+
document.addEventListener(
|
|
82
|
+
"pd-form-element-unregister",
|
|
83
|
+
this._onChildUnRegisterBound
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
super.disconnectedCallback();
|
|
88
|
+
document.removeEventListener(
|
|
89
|
+
"pd-form-element-unregister",
|
|
90
|
+
this._onChildUnRegisterBound
|
|
91
|
+
);
|
|
92
|
+
this._unRegisterAtContainer();
|
|
93
|
+
}
|
|
94
|
+
firstUpdated() {
|
|
95
|
+
this._registerAtContainer();
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
return html`
|
|
99
|
+
<fieldset
|
|
100
|
+
@pd-form-element-change="${this._onChildChange}"
|
|
101
|
+
@pd-form-element-blur="${this._onChildBlur}"
|
|
102
|
+
@pd-form-element-focus="${this._onChildFocus}"
|
|
103
|
+
@pd-form-element-register="${this._onChildRegister}"
|
|
104
|
+
>
|
|
105
|
+
${this.legend ? html`<legend>${this.legend}</legend>` : nothing}
|
|
106
|
+
<slot></slot>
|
|
107
|
+
</fieldset>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
_onChildRegister(e) {
|
|
111
|
+
const { name, value, parsedValue, state: state2 } = e.detail;
|
|
112
|
+
console.debug("###### PdFormFieldset._onChildRegister", name, value, state2);
|
|
113
|
+
if (!this._fields.has(name)) {
|
|
114
|
+
this._fields.set(name, {
|
|
115
|
+
name,
|
|
116
|
+
value,
|
|
117
|
+
parsedValue,
|
|
118
|
+
valid: state2.valid,
|
|
119
|
+
invalid: state2.invalid,
|
|
120
|
+
pristine: state2.pristine,
|
|
121
|
+
dirty: state2.dirty,
|
|
122
|
+
touched: state2.touched,
|
|
123
|
+
focused: state2.focused,
|
|
124
|
+
errors: {},
|
|
125
|
+
element: e.target
|
|
126
|
+
});
|
|
127
|
+
this.requestUpdate();
|
|
128
|
+
this._notifyContainer();
|
|
129
|
+
}
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
}
|
|
132
|
+
_onChildChange(e) {
|
|
133
|
+
const { name, value, parsedValue, state: state2 } = e.detail;
|
|
134
|
+
console.debug("###### PdFormFieldset._onChildChange", name, value, state2);
|
|
135
|
+
const field = this._fields.get(name);
|
|
136
|
+
if (field) {
|
|
137
|
+
field.value = value;
|
|
138
|
+
field.parsedValue = parsedValue;
|
|
139
|
+
field.pristine = state2.pristine;
|
|
140
|
+
field.dirty = state2.dirty;
|
|
141
|
+
field.touched = state2.touched;
|
|
142
|
+
field.focused = state2.focused;
|
|
143
|
+
field.valid = state2.valid;
|
|
144
|
+
field.invalid = state2.invalid;
|
|
145
|
+
this.requestUpdate();
|
|
146
|
+
this._notifyContainer();
|
|
147
|
+
}
|
|
148
|
+
e.stopPropagation();
|
|
149
|
+
}
|
|
150
|
+
_onChildBlur(e) {
|
|
151
|
+
const { name } = e.detail;
|
|
152
|
+
const field = this._fields.get(name);
|
|
153
|
+
if (field) {
|
|
154
|
+
field.touched = true;
|
|
155
|
+
field.focused = false;
|
|
156
|
+
}
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
}
|
|
159
|
+
_onChildFocus(e) {
|
|
160
|
+
const { name } = e.detail;
|
|
161
|
+
const field = this._fields.get(name);
|
|
162
|
+
if (field) {
|
|
163
|
+
field.focused = true;
|
|
164
|
+
}
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Checks if any child field is dirty.
|
|
169
|
+
*/
|
|
170
|
+
_isDirty() {
|
|
171
|
+
for (const field of this._fields.values()) {
|
|
172
|
+
if (field.dirty) return true;
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Checks if any child field is touched.
|
|
178
|
+
*/
|
|
179
|
+
_isTouched() {
|
|
180
|
+
for (const field of this._fields.values()) {
|
|
181
|
+
if (field.touched) return true;
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Checks if any child field is focused.
|
|
187
|
+
*/
|
|
188
|
+
_isFocused() {
|
|
189
|
+
for (const field of this._fields.values()) {
|
|
190
|
+
if (field.focused) return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Checks if all child fields are pristine.
|
|
196
|
+
*/
|
|
197
|
+
_isPristine() {
|
|
198
|
+
return !this._isDirty();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns aggregated value object from all child fields.
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
_getAggregatedValue() {
|
|
205
|
+
const obj = {};
|
|
206
|
+
this._fields.forEach((field, key) => {
|
|
207
|
+
obj[key] = field.value;
|
|
208
|
+
});
|
|
209
|
+
return obj;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Returns aggregated parsed value object from all child fields.
|
|
213
|
+
* @private
|
|
214
|
+
*/
|
|
215
|
+
_getAggregatedParsedValue() {
|
|
216
|
+
const obj = {};
|
|
217
|
+
this._fields.forEach((field, key) => {
|
|
218
|
+
obj[key] = field.parsedValue;
|
|
219
|
+
});
|
|
220
|
+
return obj;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns overall validity based on all child fields.
|
|
224
|
+
* Fieldset is valid only if ALL children are valid.
|
|
225
|
+
* @private
|
|
226
|
+
*/
|
|
227
|
+
_getOverallValidity() {
|
|
228
|
+
if (this._fields.size === 0) {
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
return ![...this._fields.values()].some((field) => field.invalid);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Notifies parent container with aggregated value and state.
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
_notifyContainer() {
|
|
238
|
+
const valid = this._getOverallValidity();
|
|
239
|
+
this.dispatchEvent(
|
|
240
|
+
new CustomEvent("pd-form-element-change", {
|
|
241
|
+
detail: {
|
|
242
|
+
name: this.name || this.id || "fieldset",
|
|
243
|
+
value: this._getAggregatedValue(),
|
|
244
|
+
parsedValue: this._getAggregatedParsedValue(),
|
|
245
|
+
state: {
|
|
246
|
+
valid,
|
|
247
|
+
invalid: !valid,
|
|
248
|
+
pristine: this._isPristine(),
|
|
249
|
+
dirty: this._isDirty(),
|
|
250
|
+
touched: this._isTouched(),
|
|
251
|
+
focused: this._isFocused()
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
bubbles: true,
|
|
255
|
+
composed: true
|
|
256
|
+
})
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Registers fieldset at parent container.
|
|
261
|
+
* @private
|
|
262
|
+
*/
|
|
263
|
+
_registerAtContainer() {
|
|
264
|
+
const valid = this._getOverallValidity();
|
|
265
|
+
this.dispatchEvent(
|
|
266
|
+
new CustomEvent("pd-form-element-register", {
|
|
267
|
+
detail: {
|
|
268
|
+
name: this.name || this.id || "fieldset",
|
|
269
|
+
value: this._getAggregatedValue(),
|
|
270
|
+
parsedValue: this._getAggregatedParsedValue(),
|
|
271
|
+
state: {
|
|
272
|
+
pristine: this._isPristine(),
|
|
273
|
+
dirty: this._isDirty(),
|
|
274
|
+
touched: this._isTouched(),
|
|
275
|
+
focused: this._isFocused(),
|
|
276
|
+
valid,
|
|
277
|
+
invalid: !valid
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
bubbles: true,
|
|
281
|
+
composed: true
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Unregisters fieldset from parent container.
|
|
287
|
+
* @private
|
|
288
|
+
*/
|
|
289
|
+
_unRegisterAtContainer() {
|
|
290
|
+
document.dispatchEvent(
|
|
291
|
+
new CustomEvent("pd-form-element-unregister", {
|
|
292
|
+
detail: {
|
|
293
|
+
name: this.name || this.id || "fieldset",
|
|
294
|
+
value: this._getAggregatedValue()
|
|
295
|
+
},
|
|
296
|
+
bubbles: true,
|
|
297
|
+
composed: true
|
|
298
|
+
})
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
/** Runs all field validators and returns overall validity. */
|
|
302
|
+
async runValidators() {
|
|
303
|
+
const validations = [];
|
|
304
|
+
this._fields.forEach((field) => {
|
|
305
|
+
const result = field.element?.runValidators();
|
|
306
|
+
if (result instanceof Promise) {
|
|
307
|
+
validations.push(result);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
const results = await Promise.all(validations);
|
|
311
|
+
let index = 0;
|
|
312
|
+
this._fields.forEach((field) => {
|
|
313
|
+
const isValid = results[index];
|
|
314
|
+
field.valid = isValid;
|
|
315
|
+
field.invalid = !isValid;
|
|
316
|
+
index++;
|
|
317
|
+
});
|
|
318
|
+
return this._getOverallValidity();
|
|
319
|
+
}
|
|
320
|
+
/** Resets all child fields to their initial values. */
|
|
321
|
+
reset() {
|
|
322
|
+
this._fields.forEach((field) => {
|
|
323
|
+
const element = field.element;
|
|
324
|
+
if (typeof element?.reset === "function") {
|
|
325
|
+
element.reset();
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
/** Clears all child fields. */
|
|
330
|
+
clear() {
|
|
331
|
+
this._fields.forEach((field) => {
|
|
332
|
+
const element = field.element;
|
|
333
|
+
if (typeof element?.clear === "function") {
|
|
334
|
+
element.clear();
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/** Returns the current status map of all registered child fields. */
|
|
339
|
+
getStatus() {
|
|
340
|
+
return this._fields;
|
|
341
|
+
}
|
|
342
|
+
/** Whether all child fields are currently valid. */
|
|
343
|
+
get valid() {
|
|
344
|
+
return this._getOverallValidity();
|
|
345
|
+
}
|
|
346
|
+
/** Current aggregated value object from all child fields. */
|
|
347
|
+
get value() {
|
|
348
|
+
return this._getAggregatedValue();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
__decorateClass([
|
|
352
|
+
property({ type: String })
|
|
353
|
+
], PdFormFieldset.prototype, "name");
|
|
354
|
+
__decorateClass([
|
|
355
|
+
property({ type: String })
|
|
356
|
+
], PdFormFieldset.prototype, "legend");
|
|
357
|
+
__decorateClass([
|
|
358
|
+
property({ type: String, reflect: true })
|
|
359
|
+
], PdFormFieldset.prototype, "span");
|
|
360
|
+
__decorateClass([
|
|
361
|
+
state()
|
|
362
|
+
], PdFormFieldset.prototype, "_fields");
|
|
363
|
+
|
|
364
|
+
export { PdFormFieldset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pd-form-fieldset/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-form-fieldset.d.ts","sourceRoot":"","sources":["../../src/pd-form-fieldset/pd-form-fieldset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
interface PdFormFieldsetArgs {
|
|
3
|
+
name: string;
|
|
4
|
+
legend: string;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
span: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* ## pd-form-fieldset
|
|
10
|
+
*
|
|
11
|
+
* Groups form fields and returns their values as a single object.
|
|
12
|
+
*
|
|
13
|
+
* ### Features
|
|
14
|
+
* - Wraps native `<fieldset>` element
|
|
15
|
+
* - Aggregates child field values into an object
|
|
16
|
+
* - Registers as single field with PdFormContainer
|
|
17
|
+
* - Optional `<legend>` for labeling
|
|
18
|
+
* - Validation aggregation from all children
|
|
19
|
+
* - Supports grid layout via `span` property
|
|
20
|
+
*/
|
|
21
|
+
declare const meta: Meta<PdFormFieldsetArgs>;
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<PdFormFieldsetArgs>;
|
|
24
|
+
/** Default fieldset with legend and grouped fields. */
|
|
25
|
+
export declare const Default: Story;
|
|
26
|
+
/** Overview of all fieldset visual states. */
|
|
27
|
+
export declare const AllStates: Story;
|
|
28
|
+
/** Multiple fieldsets in one form with regular fields. */
|
|
29
|
+
export declare const MultipleFieldsets: Story;
|
|
30
|
+
/** Fieldsets using span to sit side-by-side. */
|
|
31
|
+
export declare const CustomSpan: Story;
|
|
32
|
+
/** Fieldset with pre-filled initial values. */
|
|
33
|
+
export declare const WithInitialValues: Story;
|
|
34
|
+
/** Buttons positioned in form-row using span property alongside fieldset fields. */
|
|
35
|
+
export declare const ButtonsInFormRow: Story;
|
|
36
|
+
/** CSS Custom Properties -- Branded and Redesigned variants. */
|
|
37
|
+
export declare const CustomStyling: Story;
|
|
38
|
+
//# sourceMappingURL=pd-form-fieldset.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-form-fieldset.stories.d.ts","sourceRoot":"","sources":["../../src/pd-form-fieldset/pd-form-fieldset.stories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2CAA2C,CAAC;AACnD,OAAO,+BAA+B,CAAC;AACvC,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC;AAMnC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,kBAAkB,CA8ElC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAM1C,uDAAuD;AACvD,eAAO,MAAM,OAAO,EAAE,KAsCrB,CAAC;AAMF,8CAA8C;AAC9C,eAAO,MAAM,SAAS,EAAE,KAqFvB,CAAC;AAMF,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,EAAE,KAsF/B,CAAC;AAMF,gDAAgD;AAChD,eAAO,MAAM,UAAU,EAAE,KAiCxB,CAAC;AAMF,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,EAAE,KAoC/B,CAAC;AAMF,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,EAAE,KA2E9B,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,KAyH3B,CAAC"}
|
|
@@ -1,15 +1,45 @@
|
|
|
1
|
-
import { CSSResultGroup } from 'lit';
|
|
1
|
+
import { CSSResultGroup, TemplateResult } from 'lit';
|
|
2
2
|
import { PdBaseUI } from '../base/pd-base-ui.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Responsive grid container for form elements.
|
|
5
|
+
*
|
|
6
|
+
* Uses CSS Grid with 12 columns and Container Queries for responsive behavior.
|
|
7
|
+
* Child elements use the `span` property to control their width within the grid.
|
|
8
|
+
* When the row width falls below 400px, all elements stack vertically.
|
|
5
9
|
*
|
|
6
|
-
* @slot - Standard-Slot für Formularelemente
|
|
7
10
|
* @tagname pd-form-row
|
|
11
|
+
* @summary 12-column grid row with Container Query support.
|
|
12
|
+
*
|
|
13
|
+
* @slot - Form elements to display in the row.
|
|
14
|
+
*
|
|
15
|
+
* @cssprop --pd-form-row-gap - Gap between elements. Default: `20px`.
|
|
16
|
+
* @cssprop --pd-form-row-align-items - Vertical alignment of elements. Default: `flex-start`.
|
|
17
|
+
* @cssprop --pd-form-row-helper-width - Width reserved for helper icon column. Default: `0`. Use `with-helper-space` attribute to enable.
|
|
18
|
+
* @cssprop --pd-form-row-gap-top - Top margin when `gap-top` attribute is set. Default: `1.2rem`.
|
|
19
|
+
*
|
|
20
|
+
* @attr {boolean} with-helper-space - Reserves space for helper icon column (32px). Use for consistent alignment across rows.
|
|
21
|
+
* @attr {boolean} no-stack - Disables responsive stacking. Elements keep their span values regardless of container width.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```html
|
|
25
|
+
* <pd-form-row>
|
|
26
|
+
* <pd-input span="half" label="First Name"></pd-input>
|
|
27
|
+
* <pd-input span="half" label="Last Name"></pd-input>
|
|
28
|
+
* </pd-form-row>
|
|
8
29
|
*
|
|
9
|
-
*
|
|
30
|
+
* <pd-form-row with-helper-space helper-text="Enter your full address">
|
|
31
|
+
* <pd-input span="quarter" label="ZIP"></pd-input>
|
|
32
|
+
* <pd-input span="three-quarters" label="City"></pd-input>
|
|
33
|
+
* </pd-form-row>
|
|
34
|
+
* ```
|
|
10
35
|
*/
|
|
11
36
|
export declare class PdFormRow extends PdBaseUI {
|
|
37
|
+
/**
|
|
38
|
+
* Helper text shown in a hover box at the right end of the row.
|
|
39
|
+
* Useful for providing context or instructions for a group of related fields.
|
|
40
|
+
*/
|
|
41
|
+
helperText: string;
|
|
12
42
|
static styles: CSSResultGroup;
|
|
13
|
-
render():
|
|
43
|
+
render(): TemplateResult;
|
|
14
44
|
}
|
|
15
45
|
//# sourceMappingURL=PdFormRow.d.ts.map
|