agnosticui-core 2.0.0-alpha.2 → 2.0.0-alpha.21
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/README.md +67 -33
- package/dist/{VueButton.vue_vue_type_script_setup_true_lang-Bq8IPXqd.js → VueButton.vue_vue_type_script_setup_true_lang-D1jGatE9.js} +17 -15
- package/dist/{VueButtonFx.vue_vue_type_script_setup_true_lang-BUudF-lg.js → VueButtonFx.vue_vue_type_script_setup_true_lang-BRrt6Nxs.js} +1 -0
- package/dist/{VueCheckbox.vue_vue_type_script_setup_true_lang-DERDRO2P.js → VueCheckbox.vue_vue_type_script_setup_true_lang-VtQfJ-6f.js} +9 -10
- package/dist/{VueCombobox.vue_vue_type_script_setup_true_lang-C7gDMrYJ.js → VueCombobox.vue_vue_type_script_setup_true_lang-BSTZGX2X.js} +15 -13
- package/dist/VueIcon.vue_vue_type_script_setup_true_lang-C2Sky3bU.js +22 -0
- package/dist/{VueImage.vue_vue_type_script_setup_true_lang-CUwbK3NF.js → VueImage.vue_vue_type_script_setup_true_lang-SddK93SB.js} +23 -17
- package/dist/{VueInput.vue_vue_type_script_setup_true_lang-Dsxo7DuX.js → VueInput.vue_vue_type_script_setup_true_lang-wYdAqg-i.js} +19 -19
- package/dist/{VueMenu.vue_vue_type_script_setup_true_lang-bnn7ochj.js → VueMenu.vue_vue_type_script_setup_true_lang-BXc7397e.js} +5 -4
- package/dist/{VueRadio.vue_vue_type_script_setup_true_lang-DxNhH12d.js → VueRadio.vue_vue_type_script_setup_true_lang-C7Z-sWpa.js} +10 -12
- package/dist/{VueRating.vue_vue_type_script_setup_true_lang-CICncp71.js → VueRating.vue_vue_type_script_setup_true_lang-Bm2nRrqr.js} +11 -9
- package/dist/VueSelectionButton.vue_vue_type_script_setup_true_lang-DJN-Uk6n.js +24 -0
- package/dist/VueSelectionButtonGroup.vue_vue_type_script_setup_true_lang-DwYrIMVO.js +46 -0
- package/dist/VueSelectionCard.vue_vue_type_script_setup_true_lang-DJiyPsXH.js +24 -0
- package/dist/VueSelectionCardGroup.vue_vue_type_script_setup_true_lang-D5CycLY5.js +40 -0
- package/dist/{VueToggle.vue_vue_type_script_setup_true_lang-BxrvAsse.js → VueToggle.vue_vue_type_script_setup_true_lang-DLPCBOqZ.js} +18 -16
- package/dist/components/Alert/core/_Alert.d.ts.map +1 -1
- package/dist/components/Alert/core/_Alert.js +38 -19
- package/dist/components/Button/core/_Button.d.ts +5 -0
- package/dist/components/Button/core/_Button.d.ts.map +1 -1
- package/dist/components/Button/core/_Button.js +147 -65
- package/dist/components/Button/vue/VueButton.js +1 -1
- package/dist/components/Button/vue/VueButton.vue.d.ts +3 -0
- package/dist/components/Button/vue/VueButton.vue.d.ts.map +1 -1
- package/dist/components/Button/vue/index.js +1 -1
- package/dist/components/ButtonFx/vue/VueButtonFx.js +1 -1
- package/dist/components/ButtonFx/vue/index.js +1 -1
- package/dist/components/Card/core/_Card.d.ts +9 -1
- package/dist/components/Card/core/_Card.d.ts.map +1 -1
- package/dist/components/Card/core/_Card.js +83 -29
- package/dist/components/Card/vue/VueCard.js +29 -16
- package/dist/components/Card/vue/VueCard.vue.d.ts +25 -5
- package/dist/components/Card/vue/VueCard.vue.d.ts.map +1 -1
- package/dist/components/Checkbox/core/_Checkbox.d.ts +37 -11
- package/dist/components/Checkbox/core/_Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/core/_Checkbox.js +73 -42
- package/dist/components/Checkbox/vue/VueCheckbox.js +1 -1
- package/dist/components/Checkbox/vue/VueCheckbox.vue.d.ts +3 -3
- package/dist/components/Checkbox/vue/VueCheckbox.vue.d.ts.map +1 -1
- package/dist/components/Checkbox/vue/index.js +1 -1
- package/dist/components/Combobox/core/_Combobox.d.ts +24 -1
- package/dist/components/Combobox/core/_Combobox.d.ts.map +1 -1
- package/dist/components/Combobox/core/_Combobox.js +141 -92
- package/dist/components/Combobox/vue/VueCombobox.js +1 -1
- package/dist/components/Combobox/vue/index.js +1 -1
- package/dist/components/Fieldset/vue/VueFieldset.vue.d.ts +1 -1
- package/dist/components/Icon/vue/VueIcon.js +1 -1
- package/dist/components/Icon/vue/VueIcon.vue.d.ts.map +1 -1
- package/dist/components/Icon/vue/index.js +1 -1
- package/dist/components/Image/vue/VueImage.js +1 -1
- package/dist/components/Image/vue/VueImage.vue.d.ts.map +1 -1
- package/dist/components/Image/vue/index.js +1 -1
- package/dist/components/Input/core/_Input.d.ts +21 -2
- package/dist/components/Input/core/_Input.d.ts.map +1 -1
- package/dist/components/Input/core/_Input.js +71 -35
- package/dist/components/Input/vue/VueInput.js +1 -1
- package/dist/components/Input/vue/VueInput.vue.d.ts.map +1 -1
- package/dist/components/Input/vue/index.js +1 -1
- package/dist/components/Link/core/_Link.d.ts.map +1 -1
- package/dist/components/Link/core/_Link.js +1 -0
- package/dist/components/Link/vue/VueLink.js +6 -5
- package/dist/components/Link/vue/VueLink.vue.d.ts.map +1 -1
- package/dist/components/Menu/vue/VueMenu.js +1 -1
- package/dist/components/Menu/vue/index.js +1 -1
- package/dist/components/Pagination/core/_Pagination.d.ts +0 -1
- package/dist/components/Pagination/core/_Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/core/_Pagination.js +6 -9
- package/dist/components/Radio/core/_Radio.d.ts +55 -10
- package/dist/components/Radio/core/_Radio.d.ts.map +1 -1
- package/dist/components/Radio/core/_Radio.js +165 -116
- package/dist/components/Radio/vue/VueRadio.js +1 -1
- package/dist/components/Radio/vue/VueRadio.vue.d.ts.map +1 -1
- package/dist/components/Radio/vue/index.js +1 -1
- package/dist/components/Rating/core/_Rating.d.ts +23 -2
- package/dist/components/Rating/core/_Rating.d.ts.map +1 -1
- package/dist/components/Rating/core/_Rating.js +97 -64
- package/dist/components/Rating/vue/VueRating.js +1 -1
- package/dist/components/Rating/vue/VueRating.vue.d.ts +2 -0
- package/dist/components/Rating/vue/VueRating.vue.d.ts.map +1 -1
- package/dist/components/Rating/vue/index.js +1 -1
- package/dist/components/Select/core/_Select.d.ts +20 -2
- package/dist/components/Select/core/_Select.d.ts.map +1 -1
- package/dist/components/Select/core/_Select.js +99 -69
- package/dist/components/SelectionButton/core/SelectionButton.d.ts +9 -0
- package/dist/components/SelectionButton/core/SelectionButton.d.ts.map +1 -0
- package/dist/components/SelectionButton/core/SelectionButton.js +5 -0
- package/dist/components/SelectionButton/core/_SelectionButton.d.ts +47 -0
- package/dist/components/SelectionButton/core/_SelectionButton.d.ts.map +1 -0
- package/dist/components/SelectionButton/core/_SelectionButton.js +474 -0
- package/dist/components/SelectionButton/react/ReactSelectionButton.d.ts +9 -0
- package/dist/components/SelectionButton/react/ReactSelectionButton.d.ts.map +1 -0
- package/dist/components/SelectionButton/react/ReactSelectionButton.js +12 -0
- package/dist/components/SelectionButton/react/index.d.ts +3 -0
- package/dist/components/SelectionButton/react/index.d.ts.map +1 -0
- package/dist/components/SelectionButton/react/index.js +4 -0
- package/dist/components/SelectionButton/vue/VueSelectionButton.js +4 -0
- package/dist/components/SelectionButton/vue/VueSelectionButton.vue.d.ts +55 -0
- package/dist/components/SelectionButton/vue/VueSelectionButton.vue.d.ts.map +1 -0
- package/dist/components/SelectionButton/vue/index.d.ts +6 -0
- package/dist/components/SelectionButton/vue/index.d.ts.map +1 -0
- package/dist/components/SelectionButton/vue/index.js +4 -0
- package/dist/components/SelectionButtonGroup/core/SelectionButtonGroup.d.ts +9 -0
- package/dist/components/SelectionButtonGroup/core/SelectionButtonGroup.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/core/SelectionButtonGroup.js +5 -0
- package/dist/components/SelectionButtonGroup/core/_SelectionButtonGroup.d.ts +87 -0
- package/dist/components/SelectionButtonGroup/core/_SelectionButtonGroup.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/core/_SelectionButtonGroup.js +235 -0
- package/dist/components/SelectionButtonGroup/react/ReactSelectionButtonGroup.d.ts +13 -0
- package/dist/components/SelectionButtonGroup/react/ReactSelectionButtonGroup.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/react/ReactSelectionButtonGroup.js +15 -0
- package/dist/components/SelectionButtonGroup/react/index.d.ts +3 -0
- package/dist/components/SelectionButtonGroup/react/index.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/react/index.js +4 -0
- package/dist/components/SelectionButtonGroup/vue/VueSelectionButtonGroup.js +4 -0
- package/dist/components/SelectionButtonGroup/vue/VueSelectionButtonGroup.vue.d.ts +101 -0
- package/dist/components/SelectionButtonGroup/vue/VueSelectionButtonGroup.vue.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/vue/index.d.ts +6 -0
- package/dist/components/SelectionButtonGroup/vue/index.d.ts.map +1 -0
- package/dist/components/SelectionButtonGroup/vue/index.js +4 -0
- package/dist/components/SelectionCard/core/SelectionCard.d.ts +9 -0
- package/dist/components/SelectionCard/core/SelectionCard.d.ts.map +1 -0
- package/dist/components/SelectionCard/core/SelectionCard.js +5 -0
- package/dist/components/SelectionCard/core/_SelectionCard.d.ts +39 -0
- package/dist/components/SelectionCard/core/_SelectionCard.d.ts.map +1 -0
- package/dist/components/SelectionCard/core/_SelectionCard.js +318 -0
- package/dist/components/SelectionCard/react/ReactSelectionCard.d.ts +9 -0
- package/dist/components/SelectionCard/react/ReactSelectionCard.d.ts.map +1 -0
- package/dist/components/SelectionCard/react/ReactSelectionCard.js +12 -0
- package/dist/components/SelectionCard/react/index.d.ts +3 -0
- package/dist/components/SelectionCard/react/index.d.ts.map +1 -0
- package/dist/components/SelectionCard/react/index.js +4 -0
- package/dist/components/SelectionCard/vue/VueSelectionCard.js +4 -0
- package/dist/components/SelectionCard/vue/VueSelectionCard.vue.d.ts +55 -0
- package/dist/components/SelectionCard/vue/VueSelectionCard.vue.d.ts.map +1 -0
- package/dist/components/SelectionCard/vue/index.d.ts +6 -0
- package/dist/components/SelectionCard/vue/index.d.ts.map +1 -0
- package/dist/components/SelectionCard/vue/index.js +4 -0
- package/dist/components/SelectionCardGroup/core/SelectionCardGroup.d.ts +9 -0
- package/dist/components/SelectionCardGroup/core/SelectionCardGroup.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/core/SelectionCardGroup.js +5 -0
- package/dist/components/SelectionCardGroup/core/_SelectionCardGroup.d.ts +69 -0
- package/dist/components/SelectionCardGroup/core/_SelectionCardGroup.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/core/_SelectionCardGroup.js +220 -0
- package/dist/components/SelectionCardGroup/react/ReactSelectionCardGroup.d.ts +13 -0
- package/dist/components/SelectionCardGroup/react/ReactSelectionCardGroup.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/react/ReactSelectionCardGroup.js +15 -0
- package/dist/components/SelectionCardGroup/react/index.d.ts +3 -0
- package/dist/components/SelectionCardGroup/react/index.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/react/index.js +4 -0
- package/dist/components/SelectionCardGroup/vue/VueSelectionCardGroup.js +4 -0
- package/dist/components/SelectionCardGroup/vue/VueSelectionCardGroup.vue.d.ts +86 -0
- package/dist/components/SelectionCardGroup/vue/VueSelectionCardGroup.vue.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/vue/index.d.ts +6 -0
- package/dist/components/SelectionCardGroup/vue/index.d.ts.map +1 -0
- package/dist/components/SelectionCardGroup/vue/index.js +4 -0
- package/dist/components/Slider/core/_Slider.d.ts +10 -16
- package/dist/components/Slider/core/_Slider.d.ts.map +1 -1
- package/dist/components/Slider/core/_Slider.js +28 -39
- package/dist/components/Timeline/core/_Timeline.d.ts.map +1 -1
- package/dist/components/Timeline/core/_Timeline.js +8 -3
- package/dist/components/Timeline/react/ReactTimeline.d.ts +23 -9
- package/dist/components/Timeline/react/ReactTimeline.d.ts.map +1 -1
- package/dist/components/Timeline/react/ReactTimeline.js +18 -14
- package/dist/components/Toggle/core/_Toggle.d.ts +36 -6
- package/dist/components/Toggle/core/_Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/core/_Toggle.js +117 -77
- package/dist/components/Toggle/vue/VueToggle.js +1 -1
- package/dist/components/Toggle/vue/VueToggle.vue.d.ts.map +1 -1
- package/dist/components/Toggle/vue/index.js +1 -1
- package/dist/shared/face-mixin.d.ts +82 -0
- package/dist/shared/face-mixin.d.ts.map +1 -0
- package/dist/shared/face-mixin.js +86 -0
- package/dist/shared/form-control-styles.js +1 -1
- package/dist/styles/ag-tokens-dark.css +4 -0
- package/dist/styles/ag-tokens.css +18 -13
- package/dist/test-setup.js +340 -255
- package/package.json +51 -13
- package/src/components/Alert/core/_Alert.ts +21 -2
- package/src/components/Button/core/_Button.ts +111 -21
- package/src/components/Button/vue/VueButton.vue +2 -0
- package/src/components/Card/core/_Card.ts +70 -3
- package/src/components/Card/vue/VueCard.vue +19 -3
- package/src/components/Checkbox/core/_Checkbox.ts +78 -18
- package/src/components/Checkbox/vue/VueCheckbox.vue +0 -6
- package/src/components/Combobox/core/_Combobox.ts +84 -2
- package/src/components/Combobox/vue/VueCombobox.vue +1 -0
- package/src/components/Drawer/v1/dialog--drawer-bottom.hbs +48 -0
- package/src/components/Drawer/v1/dialog--drawer-end.hbs +48 -0
- package/src/components/Drawer/v1/dialog--drawer-start.hbs +48 -0
- package/src/components/Drawer/v1/dialog--drawer-top.hbs +48 -0
- package/src/components/Drawer/v1/dialog-demo.css +13 -0
- package/src/components/Drawer/v1/dialog.config.yml +5 -0
- package/src/components/Drawer/v1/dialog.css +99 -0
- package/src/components/Drawer/v1/dialog.hbs +48 -0
- package/src/components/Drawer/v1/drawer-animations.css +52 -0
- package/src/components/Drawer/v1/drawer.css +50 -0
- package/src/components/Icon/vue/VueIcon.vue +2 -5
- package/src/components/Image/vue/VueImage.vue +17 -13
- package/src/components/Input/core/_Input.ts +58 -3
- package/src/components/Input/vue/VueInput.vue +2 -6
- package/src/components/Link/core/_Link.ts +1 -0
- package/src/components/Link/vue/VueLink.vue +1 -0
- package/src/components/Pagination/core/_Pagination.ts +10 -18
- package/src/components/Radio/core/_Radio.ts +131 -41
- package/src/components/Radio/vue/VueRadio.vue +1 -5
- package/src/components/Rating/core/_Rating.ts +62 -5
- package/src/components/Rating/vue/VueRating.vue +3 -0
- package/src/components/Select/core/_Select.ts +55 -6
- package/src/components/SelectionButton/core/SelectionButton.ts +13 -0
- package/src/components/SelectionButton/core/_SelectionButton.ts +551 -0
- package/src/components/SelectionButton/react/ReactSelectionButton.tsx +16 -0
- package/src/components/SelectionButton/react/index.ts +4 -0
- package/src/components/SelectionButton/vue/VueSelectionButton.vue +33 -0
- package/src/components/SelectionButton/vue/index.ts +5 -0
- package/src/components/SelectionButtonGroup/core/SelectionButtonGroup.ts +13 -0
- package/src/components/SelectionButtonGroup/core/_SelectionButtonGroup.ts +423 -0
- package/src/components/SelectionButtonGroup/react/ReactSelectionButtonGroup.tsx +29 -0
- package/src/components/SelectionButtonGroup/react/index.ts +9 -0
- package/src/components/SelectionButtonGroup/vue/VueSelectionButtonGroup.vue +89 -0
- package/src/components/SelectionButtonGroup/vue/index.ts +5 -0
- package/src/components/SelectionCard/core/SelectionCard.ts +13 -0
- package/src/components/SelectionCard/core/_SelectionCard.ts +384 -0
- package/src/components/SelectionCard/react/ReactSelectionCard.tsx +16 -0
- package/src/components/SelectionCard/react/index.ts +4 -0
- package/src/components/SelectionCard/vue/VueSelectionCard.vue +33 -0
- package/src/components/SelectionCard/vue/index.ts +5 -0
- package/src/components/SelectionCardGroup/core/SelectionCardGroup.ts +13 -0
- package/src/components/SelectionCardGroup/core/_SelectionCardGroup.ts +396 -0
- package/src/components/SelectionCardGroup/react/ReactSelectionCardGroup.tsx +29 -0
- package/src/components/SelectionCardGroup/react/index.ts +9 -0
- package/src/components/SelectionCardGroup/vue/VueSelectionCardGroup.vue +71 -0
- package/src/components/SelectionCardGroup/vue/index.ts +5 -0
- package/src/components/Slider/core/_Slider.ts +28 -28
- package/src/components/Timeline/core/_Timeline.ts +5 -0
- package/src/components/Timeline/react/ReactTimeline.tsx +47 -24
- package/src/components/Toggle/core/_Toggle.ts +83 -9
- package/src/components/Toggle/vue/VueToggle.vue +2 -0
- package/src/shared/face-mixin.ts +233 -0
- package/src/shared/form-control-styles.ts +1 -1
- package/src/styles/ag-tokens-dark.css +4 -0
- package/src/styles/ag-tokens.css +18 -13
- package/RTL_IMPLEMENTATION_PLAN.md +0 -295
- package/dist/VueIcon.vue_vue_type_script_setup_true_lang-kC-nzMyu.js +0 -25
- package/dist/components/Input/core/_Input.BACKUP.d.ts +0 -114
- package/dist/components/Input/core/_Input.BACKUP.d.ts.map +0 -1
- package/dist/components/Input/core/_Input.BACKUP.js +0 -511
- package/dist/global.d.js +0 -1
- package/src/components/Input/core/_Input.BACKUP.ts +0 -710
- package/src/global.d.ts +0 -43
|
@@ -1,710 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgnosticUI v2 Input - Canonical Implementation (Starting Simple)
|
|
3
|
-
*
|
|
4
|
-
* ⚠️ IMMUTABLE CANONICAL VERSION ⚠️
|
|
5
|
-
*
|
|
6
|
-
* Version: 2.0.0-dev
|
|
7
|
-
* Last Updated: 2025-10-06
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { LitElement, html, css } from 'lit';
|
|
11
|
-
import { property } from 'lit/decorators.js';
|
|
12
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
13
|
-
import { generateUniqueId } from '../../../utils/unique-id';
|
|
14
|
-
import { hasSlotContent } from '../../../utils/slot';
|
|
15
|
-
|
|
16
|
-
// Props interface following INTERFACE_STANDARDS.md
|
|
17
|
-
export interface InputProps {
|
|
18
|
-
// Label properties
|
|
19
|
-
label?: string;
|
|
20
|
-
labelHidden?: boolean;
|
|
21
|
-
noLabel?: boolean;
|
|
22
|
-
ariaLabel?: string;
|
|
23
|
-
labelledBy?: string;
|
|
24
|
-
|
|
25
|
-
// Input properties
|
|
26
|
-
type?: string;
|
|
27
|
-
value?: string;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
|
|
30
|
-
// Textarea properties
|
|
31
|
-
rows?: number;
|
|
32
|
-
cols?: number;
|
|
33
|
-
|
|
34
|
-
// Size variants
|
|
35
|
-
size?: 'small' | 'default' | 'large';
|
|
36
|
-
|
|
37
|
-
// Styling variants
|
|
38
|
-
capsule?: boolean;
|
|
39
|
-
rounded?: boolean;
|
|
40
|
-
underlined?: boolean;
|
|
41
|
-
underlinedWithBackground?: boolean;
|
|
42
|
-
inline?: boolean;
|
|
43
|
-
|
|
44
|
-
// Addon support - REMOVED: hasLeftAddon and hasRightAddon props
|
|
45
|
-
// Slots are now auto-detected via slotchange events
|
|
46
|
-
|
|
47
|
-
// Validation & state
|
|
48
|
-
required?: boolean;
|
|
49
|
-
disabled?: boolean;
|
|
50
|
-
readonly?: boolean;
|
|
51
|
-
invalid?: boolean;
|
|
52
|
-
errorMessage?: string;
|
|
53
|
-
helpText?: string;
|
|
54
|
-
|
|
55
|
-
// Event callbacks (native events only - no custom events)
|
|
56
|
-
onClick?: (event: MouseEvent) => void;
|
|
57
|
-
onInput?: (event: InputEvent) => void;
|
|
58
|
-
onChange?: (event: Event) => void;
|
|
59
|
-
onFocus?: (event: FocusEvent) => void;
|
|
60
|
-
onBlur?: (event: FocusEvent) => void;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* AgInput - Foundation input component (starting minimal)
|
|
65
|
-
*
|
|
66
|
-
* Starting with basic label + input functionality, will build up incrementally
|
|
67
|
-
*/
|
|
68
|
-
export class AgInput extends LitElement implements InputProps {
|
|
69
|
-
static styles = css`
|
|
70
|
-
:host {
|
|
71
|
-
display: block;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* Label Above Input - BBC GEL Best Practice
|
|
75
|
-
*
|
|
76
|
-
* Why Label Above (BBC GEL):
|
|
77
|
-
* - Mobile-friendly: Labels above work better on small screens
|
|
78
|
-
* - Accessibility standard: Clear visual hierarchy
|
|
79
|
-
* - Cognitive accessibility: Easier to scan and understand
|
|
80
|
-
* - International: Works with various text lengths/languages
|
|
81
|
-
*
|
|
82
|
-
* Note: Labels below inputs are possible via customization:
|
|
83
|
-
* Use noLabel prop + external <ag-label> or <label> for custom positioning
|
|
84
|
-
*/
|
|
85
|
-
.ag-input__label {
|
|
86
|
-
display: block;
|
|
87
|
-
margin-block-end: var(--ag-space-2);
|
|
88
|
-
font-size: var(--ag-font-size-base);
|
|
89
|
-
color: var(--ag-text-primary);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.ag-input__label--hidden {
|
|
93
|
-
position: absolute !important;
|
|
94
|
-
width: 1px !important;
|
|
95
|
-
height: 1px !important;
|
|
96
|
-
padding: 0 !important;
|
|
97
|
-
margin: -1px !important;
|
|
98
|
-
overflow: hidden !important;
|
|
99
|
-
clip: rect(0, 0, 0, 0) !important;
|
|
100
|
-
white-space: nowrap !important;
|
|
101
|
-
border: 0 !important;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.ag-input__input,
|
|
105
|
-
.ag-input__textarea {
|
|
106
|
-
box-sizing: border-box;
|
|
107
|
-
width: 100%;
|
|
108
|
-
padding: var(--ag-space-2) var(--ag-space-3);
|
|
109
|
-
font-size: var(--ag-font-size-base);
|
|
110
|
-
line-height: var(--ag-line-height-base);
|
|
111
|
-
color: var(--ag-text-primary);
|
|
112
|
-
background-color: var(--ag-background-primary);
|
|
113
|
-
border: 1px solid var(--ag-border-subtle);
|
|
114
|
-
border-radius: 0; /* Make it rectangular by default */
|
|
115
|
-
transition: all var(--ag-motion-medium);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.ag-input__input::placeholder,
|
|
119
|
-
.ag-input__textarea::placeholder {
|
|
120
|
-
color: var(--ag-text-muted);
|
|
121
|
-
opacity: 1;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.ag-input__input:focus-visible,
|
|
125
|
-
.ag-input__textarea:focus-visible {
|
|
126
|
-
outline: var(--ag-focus-width) solid rgba(var(--ag-focus), 0.5);
|
|
127
|
-
outline-offset: var(--ag-focus-offset);
|
|
128
|
-
border-color: rgba(var(--ag-focus), 0.6);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.ag-input__textarea {
|
|
132
|
-
resize: vertical;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
:host([inline]) {
|
|
136
|
-
display: inline-block;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Sizes */
|
|
140
|
-
:host([size="small"]) .ag-input__input,
|
|
141
|
-
:host([size="small"]) .ag-input__textarea {
|
|
142
|
-
padding: var(--ag-space-1) var(--ag-space-2);
|
|
143
|
-
font-size: var(--ag-font-size-sm);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
:host([size="large"]) .ag-input__input,
|
|
147
|
-
:host([size="large"]) .ag-input__textarea {
|
|
148
|
-
padding: var(--ag-space-3) var(--ag-space-4);
|
|
149
|
-
font-size: var(--ag-font-size-lg);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/* Variants */
|
|
153
|
-
:host([capsule]) .ag-input__input,
|
|
154
|
-
:host([capsule]) .ag-input__textarea {
|
|
155
|
-
border-radius: var(--ag-radius-full);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
:host([rounded]) .ag-input__input,
|
|
159
|
-
:host([rounded]) .ag-input__textarea {
|
|
160
|
-
border-radius: var(--ag-radius-md);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
:host([underlined]) .ag-input__input,
|
|
164
|
-
:host([underlined]) .ag-input__textarea {
|
|
165
|
-
border-radius: 0;
|
|
166
|
-
border-width: 0 0 1px 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
:host([underlined-with-background]) .ag-input__input,
|
|
170
|
-
:host([underlined-with-background]) .ag-input__textarea {
|
|
171
|
-
border-radius: 0;
|
|
172
|
-
border-width: 0 0 1px 0;
|
|
173
|
-
background-color: var(--ag-background-secondary);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/* States */
|
|
177
|
-
:host([disabled]) .ag-input__input,
|
|
178
|
-
:host([disabled]) .ag-input__textarea {
|
|
179
|
-
background-color: var(--ag-background-disabled);
|
|
180
|
-
color: var(--ag-text-muted);
|
|
181
|
-
cursor: not-allowed;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
:host([invalid]) .ag-input__input,
|
|
185
|
-
:host([invalid]) .ag-input__textarea {
|
|
186
|
-
border-color: var(--ag-danger);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:host([invalid]) .ag-input__input:focus-visible,
|
|
190
|
-
:host([invalid]) .ag-input__textarea:focus-visible {
|
|
191
|
-
border-color: rgba(var(--ag-danger-rgb), 0.6);
|
|
192
|
-
outline-color: rgba(var(--ag-danger-rgb), 0.5);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/* Addons */
|
|
196
|
-
.ag-input__field {
|
|
197
|
-
display: flex;
|
|
198
|
-
align-items: stretch;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.ag-input__addon {
|
|
202
|
-
display: flex;
|
|
203
|
-
align-items: center;
|
|
204
|
-
justify-content: center;
|
|
205
|
-
padding: var(--ag-space-2) var(--ag-space-3);
|
|
206
|
-
font-size: var(--ag-font-size-base);
|
|
207
|
-
line-height: var(--ag-line-height-base);
|
|
208
|
-
color: var(--ag-text-primary);
|
|
209
|
-
/* background-color: var(--ag-background-secondary); */
|
|
210
|
-
border: 1px solid var(--ag-border-subtle);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.ag-input__addon--left {
|
|
214
|
-
border-inline-end: 0;
|
|
215
|
-
border-radius: var(--ag-radius-md) 0 0 var(--ag-radius-md);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.ag-input__addon--right {
|
|
219
|
-
border-inline-start: 0;
|
|
220
|
-
border-radius: 0 var(--ag-radius-md) var(--ag-radius-md) 0;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/* When left addon is present */
|
|
224
|
-
.ag-input__field:has(.ag-input__addon--left) .ag-input__input,
|
|
225
|
-
.ag-input__field:has(.ag-input__addon--left) .ag-input__textarea {
|
|
226
|
-
border-start-start-radius: 0;
|
|
227
|
-
border-end-start-radius: 0;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/* When right addon is present */
|
|
231
|
-
.ag-input__field:has(.ag-input__addon--right) .ag-input__input,
|
|
232
|
-
.ag-input__field:has(.ag-input__addon--right) .ag-input__textarea {
|
|
233
|
-
border-start-end-radius: 0;
|
|
234
|
-
border-end-end-radius: 0;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.ag-input__field .ag-input__input,
|
|
238
|
-
.ag-input__field .ag-input__textarea {
|
|
239
|
-
flex: 1;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/* Capsule variant with addons */
|
|
243
|
-
:host([capsule]) .ag-input__addon--left {
|
|
244
|
-
border-radius: var(--ag-radius-full) 0 0 var(--ag-radius-full);
|
|
245
|
-
padding: var(--ag-space-2) var(--ag-space-4);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
:host([capsule]) .ag-input__addon--right {
|
|
249
|
-
border-radius: 0 var(--ag-radius-full) var(--ag-radius-full) 0;
|
|
250
|
-
padding: var(--ag-space-2) var(--ag-space-4);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/* Remove border on INPUT where it meets the addon for capsule */
|
|
254
|
-
:host([capsule]) .ag-input__field:has(.ag-input__addon--left) .ag-input__input,
|
|
255
|
-
:host([capsule]) .ag-input__field:has(.ag-input__addon--left) .ag-input__textarea {
|
|
256
|
-
border-inline-start: 0;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
:host([capsule]) .ag-input__field:has(.ag-input__addon--right) .ag-input__input,
|
|
260
|
-
:host([capsule]) .ag-input__field:has(.ag-input__addon--right) .ag-input__textarea {
|
|
261
|
-
border-inline-end: 0;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* Underlined variant with addons */
|
|
265
|
-
:host([underlined]) .ag-input__addon,
|
|
266
|
-
:host([underlined-with-background]) .ag-input__addon {
|
|
267
|
-
border-top: 0;
|
|
268
|
-
border-radius: 0;
|
|
269
|
-
background: transparent;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
:host([underlined]) .ag-input__addon--left,
|
|
273
|
-
:host([underlined-with-background]) .ag-input__addon--left {
|
|
274
|
-
border-inline-start: 0;
|
|
275
|
-
border-inline-end: 0;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
:host([underlined]) .ag-input__addon--right,
|
|
279
|
-
:host([underlined-with-background]) .ag-input__addon--right {
|
|
280
|
-
border-inline-end: 0;
|
|
281
|
-
border-inline-start: 0;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* Remove border on INPUT where it meets the addon for underlined */
|
|
285
|
-
:host([underlined]) .ag-input__field:has(.ag-input__addon--left) .ag-input__input,
|
|
286
|
-
:host([underlined]) .ag-input__field:has(.ag-input__addon--left) .ag-input__textarea,
|
|
287
|
-
:host([underlined-with-background]) .ag-input__field:has(.ag-input__addon--left) .ag-input__input,
|
|
288
|
-
:host([underlined-with-background]) .ag-input__field:has(.ag-input__addon--left) .ag-input__textarea {
|
|
289
|
-
border-inline-start: 0;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
:host([underlined]) .ag-input__field:has(.ag-input__addon--right) .ag-input__input,
|
|
293
|
-
:host([underlined]) .ag-input__field:has(.ag-input__addon--right) .ag-input__textarea,
|
|
294
|
-
:host([underlined-with-background]) .ag-input__field:has(.ag-input__addon--right) .ag-input__input,
|
|
295
|
-
:host([underlined-with-background]) .ag-input__field:has(.ag-input__addon--right) .ag-input__textarea {
|
|
296
|
-
border-inline-end: 0;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* Underlined with background variant - add background to addon */
|
|
300
|
-
:host([underlined-with-background]) .ag-input__addon {
|
|
301
|
-
background-color: var(--ag-background-secondary);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/* Help & Error Text */
|
|
305
|
-
.ag-input__help,
|
|
306
|
-
.ag-input__error {
|
|
307
|
-
margin-block-start: var(--ag-space-2);
|
|
308
|
-
font-size: var(--ag-font-size-sm);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.ag-input__help {
|
|
312
|
-
color: var(--ag-text-secondary);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.ag-input__error {
|
|
316
|
-
color: var(--ag-danger);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.ag-input__error[hidden] {
|
|
320
|
-
display: none !important;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.ag-input__required {
|
|
324
|
-
color: var(--ag-danger);
|
|
325
|
-
margin-inline-start: var(--ag-space-1);
|
|
326
|
-
}
|
|
327
|
-
`;
|
|
328
|
-
|
|
329
|
-
// Core element ID for label association
|
|
330
|
-
private _inputId = generateUniqueId('ag-input');
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Label Architecture - Flexible but Accessible by Default
|
|
334
|
-
*/
|
|
335
|
-
@property({ type: String })
|
|
336
|
-
declare label: string;
|
|
337
|
-
|
|
338
|
-
@property({ type: Boolean, attribute: 'label-hidden' })
|
|
339
|
-
declare labelHidden: boolean;
|
|
340
|
-
|
|
341
|
-
@property({ type: Boolean, attribute: 'no-label' })
|
|
342
|
-
declare noLabel: boolean;
|
|
343
|
-
|
|
344
|
-
@property({ type: String, reflect: true, attribute: 'aria-label' })
|
|
345
|
-
declare ariaLabel: string;
|
|
346
|
-
|
|
347
|
-
@property({ type: String, attribute: 'labelled-by' })
|
|
348
|
-
declare labelledBy: string;
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Input properties
|
|
352
|
-
*/
|
|
353
|
-
@property({ type: String })
|
|
354
|
-
declare type: string;
|
|
355
|
-
|
|
356
|
-
@property({ type: String, reflect: true })
|
|
357
|
-
declare value: string;
|
|
358
|
-
|
|
359
|
-
@property({ type: String })
|
|
360
|
-
declare placeholder: string;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Textarea-specific properties (when type="textarea")
|
|
364
|
-
*/
|
|
365
|
-
@property({ type: Number })
|
|
366
|
-
declare rows: number;
|
|
367
|
-
|
|
368
|
-
@property({ type: Number })
|
|
369
|
-
declare cols: number;
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* v1 Parity - Size Variants
|
|
373
|
-
*/
|
|
374
|
-
@property({ type: String, reflect: true })
|
|
375
|
-
declare size: 'small' | 'default' | 'large';
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* v1 Parity - Styling Variants
|
|
379
|
-
*/
|
|
380
|
-
@property({ type: Boolean, reflect: true })
|
|
381
|
-
declare capsule: boolean;
|
|
382
|
-
|
|
383
|
-
@property({ type: Boolean, reflect: true })
|
|
384
|
-
declare rounded: boolean;
|
|
385
|
-
|
|
386
|
-
@property({ type: Boolean, reflect: true })
|
|
387
|
-
declare underlined: boolean;
|
|
388
|
-
|
|
389
|
-
@property({ type: Boolean, reflect: true, attribute: 'underlined-with-background' })
|
|
390
|
-
declare underlinedWithBackground: boolean;
|
|
391
|
-
|
|
392
|
-
@property({ type: Boolean, reflect: true })
|
|
393
|
-
declare inline: boolean;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* v1 Parity - Addon Support
|
|
397
|
-
* REMOVED: hasLeftAddon and hasRightAddon props - now auto-detected
|
|
398
|
-
*/
|
|
399
|
-
private _hasLeftAddon = false;
|
|
400
|
-
private _hasRightAddon = false;
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Validation & State
|
|
404
|
-
*/
|
|
405
|
-
@property({ type: Boolean, reflect: true })
|
|
406
|
-
declare required: boolean;
|
|
407
|
-
|
|
408
|
-
@property({ type: Boolean, reflect: true })
|
|
409
|
-
declare disabled: boolean;
|
|
410
|
-
|
|
411
|
-
@property({ type: Boolean, reflect: true })
|
|
412
|
-
declare readonly: boolean;
|
|
413
|
-
|
|
414
|
-
@property({ type: Boolean, reflect: true })
|
|
415
|
-
declare invalid: boolean;
|
|
416
|
-
|
|
417
|
-
@property({ type: String, attribute: 'error-message' })
|
|
418
|
-
declare errorMessage: string;
|
|
419
|
-
|
|
420
|
-
@property({ type: String, attribute: 'help-text' })
|
|
421
|
-
declare helpText: string;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Event callback props (not reflected as attributes)
|
|
425
|
-
* Following AgnosticUI v2 event conventions for native events
|
|
426
|
-
*/
|
|
427
|
-
@property({ attribute: false })
|
|
428
|
-
declare onClick?: (event: MouseEvent) => void;
|
|
429
|
-
|
|
430
|
-
@property({ attribute: false })
|
|
431
|
-
declare onInput?: (event: InputEvent) => void;
|
|
432
|
-
|
|
433
|
-
@property({ attribute: false })
|
|
434
|
-
declare onChange?: (event: Event) => void;
|
|
435
|
-
|
|
436
|
-
@property({ attribute: false })
|
|
437
|
-
declare onFocus?: (event: FocusEvent) => void;
|
|
438
|
-
|
|
439
|
-
@property({ attribute: false })
|
|
440
|
-
declare onBlur?: (event: FocusEvent) => void;
|
|
441
|
-
|
|
442
|
-
constructor() {
|
|
443
|
-
super();
|
|
444
|
-
this.label = '';
|
|
445
|
-
this.labelHidden = false;
|
|
446
|
-
this.noLabel = false;
|
|
447
|
-
this.ariaLabel = '';
|
|
448
|
-
this.labelledBy = '';
|
|
449
|
-
this.type = 'text';
|
|
450
|
-
this.value = '';
|
|
451
|
-
this.placeholder = '';
|
|
452
|
-
this.rows = 4;
|
|
453
|
-
this.cols = 50;
|
|
454
|
-
this.size = 'default';
|
|
455
|
-
this.capsule = false;
|
|
456
|
-
this.rounded = false;
|
|
457
|
-
this.underlined = false;
|
|
458
|
-
this.underlinedWithBackground = false;
|
|
459
|
-
this.inline = false;
|
|
460
|
-
this.required = false;
|
|
461
|
-
this.disabled = false;
|
|
462
|
-
this.readonly = false;
|
|
463
|
-
this.invalid = false;
|
|
464
|
-
this.errorMessage = '';
|
|
465
|
-
this.helpText = '';
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Event Handlers
|
|
470
|
-
* Following AgnosticUI v2 event conventions:
|
|
471
|
-
* - Native composed events (input, change, click) just invoke callbacks
|
|
472
|
-
* - Native non-bubbling events (focus, blur) re-dispatch from host + invoke callbacks
|
|
473
|
-
*/
|
|
474
|
-
private _handleClick(e: MouseEvent) {
|
|
475
|
-
// Native click is composed - just invoke callback if provided
|
|
476
|
-
if (this.onClick) {
|
|
477
|
-
this.onClick(e);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
private _handleInput(e: Event) {
|
|
482
|
-
const target = e.target as HTMLInputElement;
|
|
483
|
-
this.value = target.value;
|
|
484
|
-
|
|
485
|
-
// Native input is composed - just invoke callback if provided
|
|
486
|
-
if (this.onInput) {
|
|
487
|
-
this.onInput(e as InputEvent);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
private _handleChange(e: Event) {
|
|
492
|
-
const target = e.target as HTMLInputElement;
|
|
493
|
-
this.value = target.value;
|
|
494
|
-
|
|
495
|
-
// Native change is composed - just invoke callback if provided
|
|
496
|
-
if (this.onChange) {
|
|
497
|
-
this.onChange(e);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
private _handleFocus(e: FocusEvent) {
|
|
502
|
-
// Focus doesn't bubble - re-dispatch from host so consumers can listen
|
|
503
|
-
this.dispatchEvent(new FocusEvent('focus', {
|
|
504
|
-
bubbles: true,
|
|
505
|
-
composed: true,
|
|
506
|
-
relatedTarget: e.relatedTarget,
|
|
507
|
-
}));
|
|
508
|
-
|
|
509
|
-
// Invoke callback if provided
|
|
510
|
-
if (this.onFocus) {
|
|
511
|
-
this.onFocus(e);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
private _handleBlur(e: FocusEvent) {
|
|
516
|
-
// Blur doesn't bubble - re-dispatch from host so consumers can listen
|
|
517
|
-
this.dispatchEvent(new FocusEvent('blur', {
|
|
518
|
-
bubbles: true,
|
|
519
|
-
composed: true,
|
|
520
|
-
relatedTarget: e.relatedTarget,
|
|
521
|
-
}));
|
|
522
|
-
|
|
523
|
-
// Invoke callback if provided
|
|
524
|
-
if (this.onBlur) {
|
|
525
|
-
this.onBlur(e);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Handle slot changes to detect if addons are present
|
|
531
|
-
*/
|
|
532
|
-
private _handleSlotChange(e: Event) {
|
|
533
|
-
const slot = e.target as HTMLSlotElement;
|
|
534
|
-
const slotName = slot.name;
|
|
535
|
-
|
|
536
|
-
if (slotName === 'addon-left') {
|
|
537
|
-
this._hasLeftAddon = hasSlotContent(slot);
|
|
538
|
-
} else if (slotName === 'addon-right') {
|
|
539
|
-
this._hasRightAddon = hasSlotContent(slot);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
this.requestUpdate();
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
override firstUpdated() {
|
|
546
|
-
// Initial check for slot content
|
|
547
|
-
// We need to defer this check to avoid "change in update" warning
|
|
548
|
-
setTimeout(() => {
|
|
549
|
-
const leftAddonSlot = this.shadowRoot?.querySelector('slot[name="addon-left"]') as HTMLSlotElement;
|
|
550
|
-
const rightAddonSlot = this.shadowRoot?.querySelector('slot[name="addon-right"]') as HTMLSlotElement;
|
|
551
|
-
|
|
552
|
-
const hadLeftAddon = this._hasLeftAddon;
|
|
553
|
-
const hadRightAddon = this._hasRightAddon;
|
|
554
|
-
|
|
555
|
-
this._hasLeftAddon = hasSlotContent(leftAddonSlot);
|
|
556
|
-
this._hasRightAddon = hasSlotContent(rightAddonSlot);
|
|
557
|
-
|
|
558
|
-
// Only request update if something changed
|
|
559
|
-
if (hadLeftAddon !== this._hasLeftAddon || hadRightAddon !== this._hasRightAddon) {
|
|
560
|
-
this.requestUpdate();
|
|
561
|
-
}
|
|
562
|
-
}, 0);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
render() {
|
|
566
|
-
const isTextarea = this.type === 'textarea';
|
|
567
|
-
const hasAddons = this._hasLeftAddon || this._hasRightAddon;
|
|
568
|
-
|
|
569
|
-
// Generate IDs for help and error text
|
|
570
|
-
const helpId = `${this._inputId}-help`;
|
|
571
|
-
const errorId = `${this._inputId}-error`;
|
|
572
|
-
|
|
573
|
-
// Build aria-describedby list
|
|
574
|
-
const describedByIds: string[] = [];
|
|
575
|
-
if (this.helpText) {
|
|
576
|
-
describedByIds.push(helpId);
|
|
577
|
-
}
|
|
578
|
-
if (this.errorMessage) {
|
|
579
|
-
describedByIds.push(errorId);
|
|
580
|
-
}
|
|
581
|
-
// Include any external labelledBy reference
|
|
582
|
-
if (this.labelledBy) {
|
|
583
|
-
describedByIds.push(this.labelledBy);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// Build class list for wrapper
|
|
587
|
-
const classes = ['ag-input'];
|
|
588
|
-
|
|
589
|
-
// Size variant
|
|
590
|
-
if (this.size !== 'default') {
|
|
591
|
-
classes.push(`ag-input--${this.size}`);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// Styling variants
|
|
595
|
-
if (this.rounded) {
|
|
596
|
-
classes.push('ag-input--rounded');
|
|
597
|
-
}
|
|
598
|
-
if (this.underlined) {
|
|
599
|
-
classes.push('ag-input--underlined');
|
|
600
|
-
}
|
|
601
|
-
if (this.underlinedWithBackground) {
|
|
602
|
-
classes.push('ag-input--underlined-with-background');
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// Render the input/textarea element
|
|
606
|
-
const inputElement = isTextarea ? html`
|
|
607
|
-
<textarea
|
|
608
|
-
id="${this._inputId}"
|
|
609
|
-
part="ag-textarea"
|
|
610
|
-
class="ag-input__textarea"
|
|
611
|
-
.value="${this.value}"
|
|
612
|
-
placeholder="${ifDefined(this.placeholder || undefined)}"
|
|
613
|
-
rows="${this.rows}"
|
|
614
|
-
cols="${this.cols}"
|
|
615
|
-
?required="${this.required}"
|
|
616
|
-
?disabled="${this.disabled}"
|
|
617
|
-
?readonly="${this.readonly}"
|
|
618
|
-
aria-required="${this.required ? 'true' : 'false'}"
|
|
619
|
-
aria-invalid="${this.invalid ? 'true' : 'false'}"
|
|
620
|
-
aria-label="${ifDefined(this.ariaLabel || undefined)}"
|
|
621
|
-
aria-labelledby="${ifDefined(this.labelledBy || undefined)}"
|
|
622
|
-
aria-describedby="${describedByIds.length > 0 ? describedByIds.join(' ') : ifDefined(undefined)}"
|
|
623
|
-
@click=${this._handleClick}
|
|
624
|
-
@input=${this._handleInput}
|
|
625
|
-
@change=${this._handleChange}
|
|
626
|
-
@focus=${this._handleFocus}
|
|
627
|
-
@blur=${this._handleBlur}
|
|
628
|
-
></textarea>
|
|
629
|
-
` : html`
|
|
630
|
-
<input
|
|
631
|
-
type="${this.type}"
|
|
632
|
-
id="${this._inputId}"
|
|
633
|
-
part="ag-input"
|
|
634
|
-
class="ag-input__input"
|
|
635
|
-
.value="${this.value}"
|
|
636
|
-
placeholder="${ifDefined(this.placeholder || undefined)}"
|
|
637
|
-
?required="${this.required}"
|
|
638
|
-
?disabled="${this.disabled}"
|
|
639
|
-
?readonly="${this.readonly}"
|
|
640
|
-
aria-required="${this.required ? 'true' : 'false'}"
|
|
641
|
-
aria-invalid="${this.invalid ? 'true' : 'false'}"
|
|
642
|
-
aria-label="${ifDefined(this.ariaLabel || undefined)}"
|
|
643
|
-
aria-labelledby="${ifDefined(this.labelledBy || undefined)}"
|
|
644
|
-
aria-describedby="${describedByIds.length > 0 ? describedByIds.join(' ') : ifDefined(undefined)}"
|
|
645
|
-
@click=${this._handleClick}
|
|
646
|
-
@input=${this._handleInput}
|
|
647
|
-
@change=${this._handleChange}
|
|
648
|
-
@focus=${this._handleFocus}
|
|
649
|
-
@blur=${this._handleBlur}
|
|
650
|
-
/>
|
|
651
|
-
`;
|
|
652
|
-
|
|
653
|
-
return html`
|
|
654
|
-
<div class="${classes.join(' ')}" part="ag-input-wrapper">
|
|
655
|
-
${!this.noLabel ? html`
|
|
656
|
-
<label
|
|
657
|
-
for="${this._inputId}"
|
|
658
|
-
part="ag-input-label"
|
|
659
|
-
class="ag-input__label ${this.labelHidden ? 'ag-input__label--hidden' : ''}"
|
|
660
|
-
>
|
|
661
|
-
${this.label}
|
|
662
|
-
${this.required ? html`
|
|
663
|
-
<span class="ag-input__required" part="ag-input-required" aria-hidden="true">*</span>
|
|
664
|
-
` : ''}
|
|
665
|
-
</label>
|
|
666
|
-
` : ''}
|
|
667
|
-
|
|
668
|
-
${this.helpText ? html`
|
|
669
|
-
<div class="ag-input__help" id="${helpId}" part="ag-input-help">
|
|
670
|
-
${this.helpText}
|
|
671
|
-
</div>
|
|
672
|
-
` : ''}
|
|
673
|
-
|
|
674
|
-
${this.errorMessage ? html`
|
|
675
|
-
<div class="ag-input__error" id="${errorId}" part="ag-input-error">
|
|
676
|
-
${this.errorMessage}
|
|
677
|
-
</div>
|
|
678
|
-
` : html`
|
|
679
|
-
<div class="ag-input__error" id="${errorId}" part="ag-input-error" hidden></div>
|
|
680
|
-
`}
|
|
681
|
-
|
|
682
|
-
${hasAddons ? html`
|
|
683
|
-
<div class="ag-input__field" part="ag-input-field-wrapper">
|
|
684
|
-
${this._hasLeftAddon ? html`
|
|
685
|
-
<div class="ag-input__addon ag-input__addon--left" part="ag-input-addon-left">
|
|
686
|
-
<slot name="addon-left" @slotchange=${this._handleSlotChange}></slot>
|
|
687
|
-
</div>
|
|
688
|
-
` : html`
|
|
689
|
-
<slot name="addon-left" @slotchange=${this._handleSlotChange} style="display: none;"></slot>
|
|
690
|
-
`}
|
|
691
|
-
|
|
692
|
-
${inputElement}
|
|
693
|
-
|
|
694
|
-
${this._hasRightAddon ? html`
|
|
695
|
-
<div class="ag-input__addon ag-input__addon--right" part="ag-input-addon-right">
|
|
696
|
-
<slot name="addon-right" @slotchange=${this._handleSlotChange}></slot>
|
|
697
|
-
</div>
|
|
698
|
-
` : html`
|
|
699
|
-
<slot name="addon-right" @slotchange=${this._handleSlotChange} style="display: none;"></slot>
|
|
700
|
-
`}
|
|
701
|
-
</div>
|
|
702
|
-
` : html`
|
|
703
|
-
${inputElement}
|
|
704
|
-
<slot name="addon-left" @slotchange=${this._handleSlotChange} style="display: none;"></slot>
|
|
705
|
-
<slot name="addon-right" @slotchange=${this._handleSlotChange} style="display: none;"></slot>
|
|
706
|
-
`}
|
|
707
|
-
</div>
|
|
708
|
-
`;
|
|
709
|
-
}
|
|
710
|
-
}
|