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
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgnosticUI v2 SelectionCard - Core Implementation
|
|
3
|
+
*
|
|
4
|
+
* A card-based selection control that can function as either a radio or checkbox.
|
|
5
|
+
* Must be used within an ag-selection-card-group.
|
|
6
|
+
*
|
|
7
|
+
* @element ag-selection-card
|
|
8
|
+
* @slot - Default slot for visual content (icons, text, etc.)
|
|
9
|
+
* @csspart container - The outer clickable label
|
|
10
|
+
* @csspart control - The hidden input element
|
|
11
|
+
* @csspart indicator - The selection indicator (top-right corner)
|
|
12
|
+
* @csspart content - The slotted content wrapper
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
16
|
+
import { property } from 'lit/decorators.js';
|
|
17
|
+
|
|
18
|
+
export type SelectionCardTheme = 'success' | 'info' | 'error' | 'warning' | 'monochrome' | '';
|
|
19
|
+
|
|
20
|
+
export interface SelectionCardProps {
|
|
21
|
+
/** Unique value for this card (required) */
|
|
22
|
+
value: string;
|
|
23
|
+
/** Accessible label for this card (required) */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Whether this card is selected */
|
|
26
|
+
checked?: boolean;
|
|
27
|
+
/** Whether this card is disabled */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Internal props set by parent group
|
|
32
|
+
interface SelectionCardInternalProps {
|
|
33
|
+
/** Input type (set by parent group) */
|
|
34
|
+
_type?: 'radio' | 'checkbox';
|
|
35
|
+
/** Input name (set by parent group) */
|
|
36
|
+
_name?: string;
|
|
37
|
+
/** Theme (set by parent group) */
|
|
38
|
+
_theme?: SelectionCardTheme;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class AgSelectionCard extends LitElement implements SelectionCardProps, SelectionCardInternalProps {
|
|
42
|
+
static override styles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
--_selection-card-padding: var(--ag-selection-card-padding, var(--ag-space-4));
|
|
46
|
+
--_selection-card-gap: var(--ag-selection-card-gap, var(--ag-space-3));
|
|
47
|
+
--_selection-card-border-radius: var(--ag-selection-card-border-radius, var(--ag-radius-md));
|
|
48
|
+
--_selection-card-indicator-size: var(--ag-selection-card-indicator-size, var(--ag-space-5));
|
|
49
|
+
--_selection-card-background: var(--ag-selection-card-background, var(--ag-background-primary));
|
|
50
|
+
--_selection-card-border-color: var(--ag-selection-card-border-color, var(--ag-border));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.selection-card {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: block;
|
|
56
|
+
padding: var(--_selection-card-padding);
|
|
57
|
+
background: var(--_selection-card-background);
|
|
58
|
+
/* Always use border-width-2 to prevent CLS when selected */
|
|
59
|
+
border: var(--ag-border-width-2) solid var(--_selection-card-border-color);
|
|
60
|
+
border-radius: var(--_selection-card-border-radius);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
transition:
|
|
63
|
+
border-color var(--ag-motion-fast) var(--ag-fx-ease-ease-out),
|
|
64
|
+
background-color var(--ag-motion-fast) var(--ag-fx-ease-ease-out),
|
|
65
|
+
box-shadow var(--ag-motion-fast) var(--ag-fx-ease-ease-out),
|
|
66
|
+
transform var(--ag-motion-fast) var(--ag-fx-ease-ease-out);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Subtle hover effect for all cards */
|
|
70
|
+
.selection-card:hover:not(.selection-card--disabled) {
|
|
71
|
+
transform: scale(1.02);
|
|
72
|
+
box-shadow: var(--ag-shadow-sm);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Theme: default/empty (primary blue) */
|
|
76
|
+
.selection-card--default:hover:not(.selection-card--disabled) {
|
|
77
|
+
border-color: var(--ag-primary);
|
|
78
|
+
}
|
|
79
|
+
.selection-card--default.selection-card--checked {
|
|
80
|
+
background: var(--ag-primary-background);
|
|
81
|
+
border-color: var(--ag-primary);
|
|
82
|
+
}
|
|
83
|
+
.selection-card--default .selection-card__indicator {
|
|
84
|
+
background: var(--ag-primary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Theme: success (green) */
|
|
88
|
+
.selection-card--success:hover:not(.selection-card--disabled) {
|
|
89
|
+
border-color: var(--ag-success);
|
|
90
|
+
}
|
|
91
|
+
.selection-card--success.selection-card--checked {
|
|
92
|
+
background: var(--ag-success-background);
|
|
93
|
+
border-color: var(--ag-success);
|
|
94
|
+
color: var(--ag-success-text);
|
|
95
|
+
}
|
|
96
|
+
.selection-card--success .selection-card__indicator {
|
|
97
|
+
background: var(--ag-success);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Theme: info (blue/cyan) */
|
|
101
|
+
.selection-card--info:hover:not(.selection-card--disabled) {
|
|
102
|
+
border-color: var(--ag-info);
|
|
103
|
+
}
|
|
104
|
+
.selection-card--info.selection-card--checked {
|
|
105
|
+
background: var(--ag-info-background);
|
|
106
|
+
border-color: var(--ag-info);
|
|
107
|
+
color: var(--ag-info-text);
|
|
108
|
+
}
|
|
109
|
+
.selection-card--info .selection-card__indicator {
|
|
110
|
+
background: var(--ag-info);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Theme: warning (yellow/orange) */
|
|
114
|
+
.selection-card--warning:hover:not(.selection-card--disabled) {
|
|
115
|
+
border-color: var(--ag-warning);
|
|
116
|
+
}
|
|
117
|
+
.selection-card--warning.selection-card--checked {
|
|
118
|
+
background: var(--ag-warning-background);
|
|
119
|
+
border-color: var(--ag-warning);
|
|
120
|
+
color: var(--ag-warning-text);
|
|
121
|
+
}
|
|
122
|
+
.selection-card--warning .selection-card__indicator {
|
|
123
|
+
background: var(--ag-warning);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Theme: error (red) */
|
|
127
|
+
.selection-card--error:hover:not(.selection-card--disabled) {
|
|
128
|
+
border-color: var(--ag-danger);
|
|
129
|
+
}
|
|
130
|
+
.selection-card--error.selection-card--checked {
|
|
131
|
+
background: var(--ag-danger-background);
|
|
132
|
+
border-color: var(--ag-danger);
|
|
133
|
+
color: var(--ag-danger-text);
|
|
134
|
+
}
|
|
135
|
+
.selection-card--error .selection-card__indicator {
|
|
136
|
+
background: var(--ag-danger);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Theme: monochrome (black/white) */
|
|
140
|
+
.selection-card--monochrome:hover:not(.selection-card--disabled) {
|
|
141
|
+
border-color: var(--ag-black);
|
|
142
|
+
}
|
|
143
|
+
.selection-card--monochrome.selection-card--checked {
|
|
144
|
+
background: var(--ag-background-primary-inverted);
|
|
145
|
+
border-color: var(--ag-black);
|
|
146
|
+
color: var(--ag-text-primary-inverted);
|
|
147
|
+
}
|
|
148
|
+
.selection-card--monochrome .selection-card__indicator {
|
|
149
|
+
background: var(--ag-black);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Focus state */
|
|
153
|
+
.selection-card:focus-within:not(.selection-card--disabled) {
|
|
154
|
+
outline: var(--ag-focus-width) solid var(--ag-focus-ring-color, rgba(var(--ag-focus), 0.5));
|
|
155
|
+
outline-offset: var(--ag-focus-offset);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Disabled state */
|
|
159
|
+
.selection-card--disabled {
|
|
160
|
+
cursor: not-allowed;
|
|
161
|
+
opacity: 0.6;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Hidden input */
|
|
165
|
+
.selection-card__input {
|
|
166
|
+
position: absolute;
|
|
167
|
+
width: 1px;
|
|
168
|
+
height: 1px;
|
|
169
|
+
padding: 0;
|
|
170
|
+
margin: -1px;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
clip: rect(0, 0, 0, 0);
|
|
173
|
+
white-space: nowrap;
|
|
174
|
+
border: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Indicator (badge in top-right corner) */
|
|
178
|
+
.selection-card__indicator {
|
|
179
|
+
position: absolute;
|
|
180
|
+
top: var(--ag-space-2);
|
|
181
|
+
right: var(--ag-space-2);
|
|
182
|
+
width: var(--_selection-card-indicator-size);
|
|
183
|
+
height: var(--_selection-card-indicator-size);
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
justify-content: center;
|
|
187
|
+
border-radius: var(--ag-radius-full);
|
|
188
|
+
opacity: 0;
|
|
189
|
+
transform: scale(0.8);
|
|
190
|
+
transition:
|
|
191
|
+
opacity var(--ag-motion-fast) ease-in-out,
|
|
192
|
+
transform var(--ag-motion-fast) ease-in-out;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.selection-card--checked .selection-card__indicator {
|
|
196
|
+
opacity: 1;
|
|
197
|
+
transform: scale(1);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Radio indicator - filled circle */
|
|
201
|
+
.selection-card__radio-dot {
|
|
202
|
+
width: 40%;
|
|
203
|
+
height: 40%;
|
|
204
|
+
background: var(--ag-white);
|
|
205
|
+
border-radius: var(--ag-radius-full);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Checkbox indicator - checkmark */
|
|
209
|
+
.selection-card__checkmark {
|
|
210
|
+
width: 60%;
|
|
211
|
+
height: 60%;
|
|
212
|
+
fill: none;
|
|
213
|
+
stroke: var(--ag-white);
|
|
214
|
+
stroke-width: 3;
|
|
215
|
+
stroke-linecap: round;
|
|
216
|
+
stroke-linejoin: round;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Content wrapper */
|
|
220
|
+
.selection-card__content {
|
|
221
|
+
display: block;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* Visually hidden label for screen readers */
|
|
225
|
+
.selection-card__label-sr {
|
|
226
|
+
position: absolute !important;
|
|
227
|
+
width: 1px !important;
|
|
228
|
+
height: 1px !important;
|
|
229
|
+
padding: 0 !important;
|
|
230
|
+
margin: -1px !important;
|
|
231
|
+
overflow: hidden !important;
|
|
232
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
233
|
+
white-space: nowrap !important;
|
|
234
|
+
border: 0 !important;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Respect reduced motion preferences */
|
|
238
|
+
@media (prefers-reduced-motion: reduce) {
|
|
239
|
+
.selection-card,
|
|
240
|
+
.selection-card__indicator {
|
|
241
|
+
transition: none;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* High contrast mode support */
|
|
246
|
+
@media (forced-colors: active) {
|
|
247
|
+
.selection-card--checked {
|
|
248
|
+
outline: 2px solid CanvasText;
|
|
249
|
+
}
|
|
250
|
+
.selection-card__indicator {
|
|
251
|
+
background: CanvasText;
|
|
252
|
+
}
|
|
253
|
+
.selection-card__checkmark {
|
|
254
|
+
stroke: Canvas;
|
|
255
|
+
}
|
|
256
|
+
.selection-card__radio-dot {
|
|
257
|
+
background: Canvas;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
261
|
+
|
|
262
|
+
@property({ type: String, reflect: true })
|
|
263
|
+
declare value: string;
|
|
264
|
+
|
|
265
|
+
@property({ type: String })
|
|
266
|
+
declare label: string;
|
|
267
|
+
|
|
268
|
+
@property({ type: Boolean, reflect: true })
|
|
269
|
+
declare checked: boolean;
|
|
270
|
+
|
|
271
|
+
@property({ type: Boolean, reflect: true })
|
|
272
|
+
declare disabled: boolean;
|
|
273
|
+
|
|
274
|
+
// Internal props set by parent group
|
|
275
|
+
@property({ type: String, attribute: false })
|
|
276
|
+
declare _type: 'radio' | 'checkbox';
|
|
277
|
+
|
|
278
|
+
@property({ type: String, attribute: false })
|
|
279
|
+
declare _name: string;
|
|
280
|
+
|
|
281
|
+
@property({ type: String, attribute: false })
|
|
282
|
+
declare _theme: SelectionCardTheme;
|
|
283
|
+
|
|
284
|
+
constructor() {
|
|
285
|
+
super();
|
|
286
|
+
this.value = '';
|
|
287
|
+
this.label = '';
|
|
288
|
+
this.checked = false;
|
|
289
|
+
this.disabled = false;
|
|
290
|
+
this._type = 'radio';
|
|
291
|
+
this._name = '';
|
|
292
|
+
this._theme = '';
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
override focus() {
|
|
296
|
+
const label = this.shadowRoot?.querySelector('.selection-card') as HTMLElement | null;
|
|
297
|
+
label?.focus();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private _handleClick(e: Event) {
|
|
301
|
+
// Prevent label from forwarding click to input (we handle selection ourselves)
|
|
302
|
+
e.preventDefault();
|
|
303
|
+
|
|
304
|
+
if (this.disabled) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// For radio, always select; for checkbox, toggle
|
|
309
|
+
const newChecked = this._type === 'radio' ? true : !this.checked;
|
|
310
|
+
|
|
311
|
+
// Dispatch event to parent group
|
|
312
|
+
this.dispatchEvent(new CustomEvent('selection-card-change', {
|
|
313
|
+
detail: {
|
|
314
|
+
value: this.value,
|
|
315
|
+
checked: newChecked,
|
|
316
|
+
},
|
|
317
|
+
bubbles: true,
|
|
318
|
+
composed: true,
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private _handleKeyDown(e: KeyboardEvent) {
|
|
323
|
+
if (this.disabled) return;
|
|
324
|
+
|
|
325
|
+
// Space or Enter to select/toggle
|
|
326
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
327
|
+
e.preventDefault();
|
|
328
|
+
this._handleClick(e);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
private _renderIndicator() {
|
|
333
|
+
if (this._type === 'checkbox') {
|
|
334
|
+
// Checkmark for checkbox
|
|
335
|
+
return html`
|
|
336
|
+
<svg class="selection-card__checkmark" viewBox="0 0 24 24">
|
|
337
|
+
<polyline points="4 12 10 18 20 6"></polyline>
|
|
338
|
+
</svg>
|
|
339
|
+
`;
|
|
340
|
+
}
|
|
341
|
+
// Filled circle for radio
|
|
342
|
+
return html`<div class="selection-card__radio-dot"></div>`;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
override render() {
|
|
346
|
+
// Map empty theme to 'default' for CSS class
|
|
347
|
+
const themeClass = this._theme || 'default';
|
|
348
|
+
const containerClasses = [
|
|
349
|
+
'selection-card',
|
|
350
|
+
`selection-card--${themeClass}`,
|
|
351
|
+
this.checked ? 'selection-card--checked' : '',
|
|
352
|
+
this.disabled ? 'selection-card--disabled' : '',
|
|
353
|
+
].filter(Boolean).join(' ');
|
|
354
|
+
|
|
355
|
+
return html`
|
|
356
|
+
<label
|
|
357
|
+
class="${containerClasses}"
|
|
358
|
+
part="ag-selection-card-container"
|
|
359
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
360
|
+
@click="${this._handleClick}"
|
|
361
|
+
@keydown="${this._handleKeyDown}"
|
|
362
|
+
>
|
|
363
|
+
<input
|
|
364
|
+
type="${this._type}"
|
|
365
|
+
class="selection-card__input"
|
|
366
|
+
part="ag-selection-card-control"
|
|
367
|
+
name="${this._name || nothing}"
|
|
368
|
+
value="${this.value}"
|
|
369
|
+
.checked="${this.checked}"
|
|
370
|
+
?disabled="${this.disabled}"
|
|
371
|
+
aria-checked="${this.checked ? 'true' : 'false'}"
|
|
372
|
+
tabindex="-1"
|
|
373
|
+
/>
|
|
374
|
+
<span class="selection-card__label-sr">${this.label}</span>
|
|
375
|
+
<div class="selection-card__indicator" part="ag-selection-card-indicator" aria-hidden="true">
|
|
376
|
+
${this._renderIndicator()}
|
|
377
|
+
</div>
|
|
378
|
+
<div class="selection-card__content" part="ag-selection-card-content">
|
|
379
|
+
<slot></slot>
|
|
380
|
+
</div>
|
|
381
|
+
</label>
|
|
382
|
+
`;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { AgSelectionCard, type SelectionCardProps } from '../core/SelectionCard';
|
|
4
|
+
|
|
5
|
+
export interface ReactSelectionCardProps extends SelectionCardProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ReactSelectionCard = createComponent({
|
|
11
|
+
tagName: 'ag-selection-card',
|
|
12
|
+
elementClass: AgSelectionCard,
|
|
13
|
+
react: React,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type { SelectionCardProps } from '../core/SelectionCard';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ag-selection-card
|
|
3
|
+
:value="value"
|
|
4
|
+
:label="label"
|
|
5
|
+
.checked="checked"
|
|
6
|
+
.disabled="disabled"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</ag-selection-card>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import '../core/SelectionCard';
|
|
15
|
+
|
|
16
|
+
export interface VueSelectionCardProps {
|
|
17
|
+
/** Unique value for this card (required) */
|
|
18
|
+
value: string;
|
|
19
|
+
/** Accessible label for this card (required) */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Whether this card is selected */
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
/** Whether this card is disabled */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
withDefaults(defineProps<VueSelectionCardProps>(), {
|
|
28
|
+
value: '',
|
|
29
|
+
label: '',
|
|
30
|
+
checked: false,
|
|
31
|
+
disabled: false,
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AgSelectionCardGroup } from './_SelectionCardGroup.js';
|
|
2
|
+
|
|
3
|
+
if (!customElements.get('ag-selection-card-group')) {
|
|
4
|
+
customElements.define('ag-selection-card-group', AgSelectionCardGroup);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'ag-selection-card-group': AgSelectionCardGroup;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export * from './_SelectionCardGroup.js';
|