@roadtrip/components 3.26.0 → 3.28.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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/road-badge_14.cjs.entry.js +30 -10
- package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
- package/dist/cjs/road-checkbox.cjs.entry.js +3 -2
- package/dist/cjs/road-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/road-navbar-item.cjs.entry.js +12 -1
- package/dist/cjs/road-navbar-item.cjs.entry.js.map +1 -1
- package/dist/cjs/road-progress-indicator-horizontal.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-indicator-horizontal.cjs.entry.js.map +1 -1
- package/dist/cjs/road-radio.cjs.entry.js +3 -2
- package/dist/cjs/road-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/road-select-filter.cjs.entry.js +5 -0
- package/dist/cjs/road-select-filter.cjs.entry.js.map +1 -1
- package/dist/cjs/road-tab-button.cjs.entry.js +6 -4
- package/dist/cjs/road-tab-button.cjs.entry.js.map +1 -1
- package/dist/cjs/road-textarea.cjs.entry.js +1 -1
- package/dist/cjs/road-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/roadtrip.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.css +7 -2
- package/dist/collection/components/checkbox/checkbox.js +19 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.stories.js +5 -0
- package/dist/collection/components/input/input.js +1 -1
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/input-group/input-group.css +58 -12
- package/dist/collection/components/input-group/input-group.js +55 -8
- package/dist/collection/components/input-group/input-group.js.map +1 -1
- package/dist/collection/components/input-group/input-group.stories.js +24 -14
- package/dist/collection/components/navbar-item/navbar-item.js +15 -1
- package/dist/collection/components/navbar-item/navbar-item.js.map +1 -1
- package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.css +24 -5
- package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js +6 -6
- package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js.map +1 -1
- package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.stories.js +3 -3
- package/dist/collection/components/radio/radio.css +5 -0
- package/dist/collection/components/radio/radio.js +19 -1
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/radio/radio.stories.js +5 -0
- package/dist/collection/components/select-filter/select-filter.js +5 -0
- package/dist/collection/components/select-filter/select-filter.js.map +1 -1
- package/dist/collection/components/tab-button/tab-button.css +16 -0
- package/dist/collection/components/tab-button/tab-button.js +23 -3
- package/dist/collection/components/tab-button/tab-button.js.map +1 -1
- package/dist/collection/components/textarea/textarea.css +2 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/road-badge_14.entry.js +30 -10
- package/dist/esm/road-badge_14.entry.js.map +1 -1
- package/dist/esm/road-checkbox.entry.js +3 -2
- package/dist/esm/road-checkbox.entry.js.map +1 -1
- package/dist/esm/road-navbar-item.entry.js +12 -1
- package/dist/esm/road-navbar-item.entry.js.map +1 -1
- package/dist/esm/road-progress-indicator-horizontal.entry.js +1 -1
- package/dist/esm/road-progress-indicator-horizontal.entry.js.map +1 -1
- package/dist/esm/road-radio.entry.js +3 -2
- package/dist/esm/road-radio.entry.js.map +1 -1
- package/dist/esm/road-select-filter.entry.js +5 -0
- package/dist/esm/road-select-filter.entry.js.map +1 -1
- package/dist/esm/road-tab-button.entry.js +6 -4
- package/dist/esm/road-tab-button.entry.js.map +1 -1
- package/dist/esm/road-textarea.entry.js +1 -1
- package/dist/esm/road-textarea.entry.js.map +1 -1
- package/dist/esm/roadtrip.js +1 -1
- package/dist/html.html-data.json +27 -1
- package/dist/roadtrip/p-40ee0f8a.entry.js +2 -0
- package/dist/roadtrip/p-40ee0f8a.entry.js.map +1 -0
- package/dist/roadtrip/{p-0dbf612d.entry.js → p-49025654.entry.js} +2 -2
- package/dist/roadtrip/p-49025654.entry.js.map +1 -0
- package/dist/roadtrip/p-708f262a.entry.js +2 -0
- package/dist/roadtrip/p-708f262a.entry.js.map +1 -0
- package/dist/roadtrip/{p-9ff79904.entry.js → p-73a21ee9.entry.js} +2 -2
- package/dist/roadtrip/p-73a21ee9.entry.js.map +1 -0
- package/dist/roadtrip/p-ac7b2425.entry.js +2 -0
- package/dist/roadtrip/p-ac7b2425.entry.js.map +1 -0
- package/dist/roadtrip/p-b2c38586.entry.js +2 -0
- package/dist/roadtrip/p-b2c38586.entry.js.map +1 -0
- package/dist/roadtrip/{p-21b1569a.entry.js → p-c09f4088.entry.js} +2 -2
- package/dist/roadtrip/{p-21b1569a.entry.js.map → p-c09f4088.entry.js.map} +1 -1
- package/dist/roadtrip/p-f09d5d41.entry.js +2 -0
- package/dist/roadtrip/p-f09d5d41.entry.js.map +1 -0
- package/dist/roadtrip/roadtrip.esm.js +1 -1
- package/dist/roadtrip/roadtrip.esm.js.map +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +4 -0
- package/dist/types/components/input-group/input-group.d.ts +7 -1
- package/dist/types/components/navbar-item/navbar-item.d.ts +4 -0
- package/dist/types/components/progress-indicator-horizontal/progress-indicator-horizontal.d.ts +3 -3
- package/dist/types/components/radio/radio.d.ts +4 -0
- package/dist/types/components/tab-button/tab-button.d.ts +4 -0
- package/dist/types/components.d.ts +38 -6
- package/hydrate/index.js +68 -23
- package/package.json +1 -1
- package/dist/roadtrip/p-0dbf612d.entry.js.map +0 -1
- package/dist/roadtrip/p-254ba3c4.entry.js +0 -2
- package/dist/roadtrip/p-254ba3c4.entry.js.map +0 -1
- package/dist/roadtrip/p-48fad2ec.entry.js +0 -2
- package/dist/roadtrip/p-48fad2ec.entry.js.map +0 -1
- package/dist/roadtrip/p-76ccfc61.entry.js +0 -2
- package/dist/roadtrip/p-76ccfc61.entry.js.map +0 -1
- package/dist/roadtrip/p-98cd42c5.entry.js +0 -2
- package/dist/roadtrip/p-98cd42c5.entry.js.map +0 -1
- package/dist/roadtrip/p-9ff79904.entry.js.map +0 -1
- package/dist/roadtrip/p-e9f24444.entry.js +0 -2
- package/dist/roadtrip/p-e9f24444.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;GAIG;AAOH,MAAM,OAAO,UAAU;;oBAIO,KAAK;;EAEjC,6EAA6E;EAE7E,oBAAoB,CAAC,QAAiB;IACpC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;EACrC,CAAC;EAED,oEAAoE;EAC5D,mBAAmB,CAAC,UAAmB;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,sCAAsC,CAAC,CAAC;IAClF,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;MACvB,IAAI,UAAU,EAAE;QACd,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;OACpC;WAAM;QACL,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;OACnC;IACH,CAAC,CAAC,CAAC;EACL,CAAC;EAED,iBAAiB;IACf,mEAAmE;IACnE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;EAC1C,CAAC;EAED,MAAM;IACJ,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,mBAAmB,CAAC;MAC1D,CAAC,CAAC,QAAS,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAA0B,CAAC,KAAK,EAAE;MAC/E,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzD,OAAO,CACL,WAAK,KAAK,EAAE,eAAe,UAAU,IAAI,aAAa,IAAI,SAAS,EAAE;MACnE,WAAK,KAAK,EAAC,qBAAqB;QAC9B,YAAM,IAAI,EAAC,SAAS,GAAG,CACnB;MACN,eAAQ;MACR,WAAK,KAAK,EAAC,oBAAoB;QAC7B,YAAM,IAAI,EAAC,QAAQ,GAAG,CAClB,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\n\n/**\n * @slot prepend - Add icon or button before the field.\n * @slot - Add the road-input or road-select here.\n * @slot append - Add icon or button after the field.\n */\n\n@Component({\n tag: 'road-input-group',\n styleUrl: 'input-group.css',\n shadow: true,\n})\nexport class InputGroup {\n @Element() el!: HTMLRoadInputGroupElement;\n\n /** Disables the entire input group and propagates the state to children. */\n @Prop() disabled: boolean = false;\n\n /** Watches for changes in the `disabled` prop and updates child elements. */\n @Watch('disabled')\n handleDisabledChange(newValue: boolean) {\n this.updateDisabledState(newValue);\n }\n\n /** Applies or removes the `disabled` attribute to/from children. */\n private updateDisabledState(isDisabled: boolean) {\n const children = this.el.querySelectorAll('road-input, road-button, road-select');\n children.forEach(child => {\n if (isDisabled) {\n child.setAttribute('disabled', '');\n } else {\n child.removeAttribute('disabled');\n }\n });\n }\n\n componentWillLoad() {\n // Ensure the initial state of `disabled` is applied before render.\n this.updateDisabledState(this.disabled);\n }\n\n render() {\n const errorClass = this.el.querySelector('road-input[error]') ? 'is-invalid' : '';\n const sizeClass = this.el.querySelector('road-input[sizes]') \n ? `size-${(this.el.querySelector('road-input') as HTMLRoadInputElement).sizes}` \n : '';\n const disabledClass = this.disabled ? 'is-disabled' : '';\n\n return (\n <div class={`input-group ${errorClass} ${disabledClass} ${sizeClass}`}>\n <div class=\"input-group-prepend\">\n <slot name=\"prepend\" />\n </div>\n <slot />\n <div class=\"input-group-append\">\n <slot name=\"append\" />\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -14,14 +14,20 @@ export default {
|
|
|
14
14
|
append: {
|
|
15
15
|
control: 'text',
|
|
16
16
|
},
|
|
17
|
+
disabled: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
args: {
|
|
22
|
+
disabled: false, // Défaut : non désactivé
|
|
17
23
|
},
|
|
18
24
|
};
|
|
19
25
|
|
|
20
26
|
const Template = (args) => html`
|
|
21
|
-
<road-input-group>
|
|
22
|
-
${unsafeHTML(args
|
|
23
|
-
${unsafeHTML(args
|
|
24
|
-
${unsafeHTML(args.append)}
|
|
27
|
+
<road-input-group ?disabled=${args.disabled}>
|
|
28
|
+
${unsafeHTML(args.prepend || '')}
|
|
29
|
+
${unsafeHTML(args[' '] || '')}
|
|
30
|
+
${unsafeHTML(args.append || '')}
|
|
25
31
|
</road-input-group>
|
|
26
32
|
`;
|
|
27
33
|
|
|
@@ -37,30 +43,34 @@ export const Button = Template.bind({});
|
|
|
37
43
|
Button.args = {
|
|
38
44
|
' ': `<road-input input-id="newsletter" sizes="xl" label="Newsletter"></road-input>`,
|
|
39
45
|
append: `<road-button slot="append" outline="true">
|
|
40
|
-
|
|
41
|
-
</road-button>`,
|
|
46
|
+
OK
|
|
47
|
+
</road-button>`,
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
export const Disabled = Template.bind({});
|
|
45
51
|
Disabled.args = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
disabled: true, // Désactive tout le groupe
|
|
53
|
+
' ': `<road-input input-id="inputGroupDisabled" sizes="xl" label="Label" disabled></road-input>`,
|
|
54
|
+
prepend: `<road-button slot="prepend" outline="true" disabled>
|
|
55
|
+
<road-icon color="secondary" name="alert-info-outline"></road-icon>
|
|
56
|
+
</road-button>`,
|
|
57
|
+
append: `<road-button slot="append" outline="true" disabled>
|
|
58
|
+
<road-icon color="secondary" name="alert-info-outline"></road-icon>
|
|
59
|
+
</road-button>`,
|
|
50
60
|
};
|
|
51
61
|
|
|
52
62
|
export const Error = Template.bind({});
|
|
53
63
|
Error.args = {
|
|
54
64
|
' ': `<road-input input-id="inputGroupError" sizes="xl" label="Label" error="error message here"></road-input>`,
|
|
55
65
|
append: `<label slot="append">
|
|
56
|
-
|
|
57
|
-
</label>`,
|
|
66
|
+
<road-icon name="payment-card" role="img"></road-icon>
|
|
67
|
+
</label>`,
|
|
58
68
|
};
|
|
59
69
|
|
|
60
70
|
export const Password = Template.bind({});
|
|
61
71
|
Password.args = {
|
|
62
72
|
' ': `<road-input input-id="password" sizes="xl" label="password" type="password"></road-input>`,
|
|
63
73
|
append: `<road-button slot="append" outline="true">
|
|
64
|
-
|
|
65
|
-
</road-button>`,
|
|
74
|
+
<road-icon name="visibility-off-outline" role="button"></road-icon>
|
|
75
|
+
</road-button>`,
|
|
66
76
|
};
|
|
@@ -25,6 +25,14 @@ export class NavbarItem {
|
|
|
25
25
|
onNavbarChanged(ev) {
|
|
26
26
|
this.selected = this.tab === ev.detail.tab;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Watch for changes to `selected` and move focus to this element if `selected` is true.
|
|
30
|
+
*/
|
|
31
|
+
handleSelectedChange(newValue) {
|
|
32
|
+
if (newValue) {
|
|
33
|
+
this.el.focus();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
selectTab(ev) {
|
|
29
37
|
if (this.tab !== undefined) {
|
|
30
38
|
if (!this.disabled) {
|
|
@@ -52,7 +60,7 @@ export class NavbarItem {
|
|
|
52
60
|
rel,
|
|
53
61
|
target,
|
|
54
62
|
};
|
|
55
|
-
return (h(Host, { onClick: this.onClick, onKeyup: this.onKeyUp, role: "
|
|
63
|
+
return (h(Host, { onClick: this.onClick, onKeyup: this.onKeyUp, role: "menuitem", tabindex: "0", "aria-selected": selected ? 'true' : null, id: tab !== undefined ? `navbar-item-${tab}` : null, disabled: disabled, class: {
|
|
56
64
|
'navbar-item': true,
|
|
57
65
|
'tab-selected': selected,
|
|
58
66
|
'tab-disabled': disabled,
|
|
@@ -235,6 +243,12 @@ export class NavbarItem {
|
|
|
235
243
|
}];
|
|
236
244
|
}
|
|
237
245
|
static get elementRef() { return "el"; }
|
|
246
|
+
static get watchers() {
|
|
247
|
+
return [{
|
|
248
|
+
"propName": "selected",
|
|
249
|
+
"methodName": "handleSelectedChange"
|
|
250
|
+
}];
|
|
251
|
+
}
|
|
238
252
|
static get listeners() {
|
|
239
253
|
return [{
|
|
240
254
|
"name": "roadNavbarChanged",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar-item.js","sourceRoot":"","sources":["../../../src/components/navbar-item/navbar-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"navbar-item.js","sourceRoot":"","sources":["../../../src/components/navbar-item/navbar-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtG;;;;GAIG;AAOH,MAAM,OAAO,UAAU;;IA2Fb,YAAO,GAAG,CAAC,EAAiB,EAAE,EAAE;M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,EAAE,GAAG,IAAI,CAAC;IAC5D,MAAM,KAAK,GAAG;MACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;MACvB,IAAI;MACJ,GAAG;MACH,MAAM;KACP,CAAC;IAEF,OAAO,CACL,EAAC,IAAI,IACH,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,UAAU,EACf,QAAQ,EAAC,GAAG,mBACG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACvC,EAAE,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EACnD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE;QACL,aAAa,EAAE,IAAI;QACnB,cAAc,EAAE,QAAQ;QACxB,cAAc,EAAE,QAAQ;OACzB;MAED,yBAAO,KAAK,IAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,QAAQ;QAC7D,YAAM,KAAK,EAAC,cAAc;UACxB,eAAO,CACF,CACL,CACC,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Element, Prop, Event, EventEmitter, Listen, Watch } from '@stencil/core';\n\n/**\n * @slot - Content of the item, it should be road-icon and road-label elements.\n *\n * @part native - The native HTML anchor element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-navbar-item',\n styleUrl: 'navbar-item.css',\n shadow: true,\n})\nexport class NavbarItem {\n\n @Element() el!: HTMLRoadNavbarItemElement;\n\n /**\n * If `true`, the user cannot interact with the tab button.\n */\n @Prop() disabled = false;\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download: string | undefined;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href: string | undefined;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel: string | undefined;\n\n /**\n * The selected tab component\n */\n @Prop({ mutable: true }) selected = false;\n\n /**\n * A tab id must be provided for each `road-tab`. It's used internally to reference\n * the selected tab.\n */\n @Prop() tab?: string;\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target: string | undefined;\n\n /**\n * Emitted when the tab bar is clicked\n * @internal\n */\n @Event() roadnavbaritemclick!: EventEmitter;\n /** @internal */\n @Event() roadNavbarItemClick!: EventEmitter;\n\n @Listen('roadNavbarChanged', { target: 'window' })\n @Listen('roadnavbarchanged', { target: 'window' })\n onNavbarChanged(ev: CustomEvent) {\n this.selected = this.tab === ev.detail.tab;\n }\n\n /**\n * Watch for changes to `selected` and move focus to this element if `selected` is true.\n */\n @Watch('selected')\n handleSelectedChange(newValue: boolean) {\n if (newValue) {\n this.el.focus();\n }\n }\n\n private selectTab(ev: Event | KeyboardEvent) {\n if (this.tab !== undefined) {\n if (!this.disabled) {\n this.roadnavbaritemclick.emit({\n tab: this.tab,\n href: this.href,\n selected: this.selected,\n });\n this.roadNavbarItemClick.emit({\n tab: this.tab,\n href: this.href,\n selected: this.selected,\n });\n }\n if(this.href === undefined) {\n ev.preventDefault();\n }\n }\n }\n\n private onKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n this.selectTab(ev);\n }\n };\n\n private onClick = (ev: Event) => {\n this.selectTab(ev);\n };\n\n render() {\n const { href, rel, target, selected, tab, disabled } = this;\n const attrs = {\n download: this.download,\n href,\n rel,\n target,\n };\n\n return (\n <Host\n onClick={this.onClick}\n onKeyup={this.onKeyUp}\n role=\"menuitem\"\n tabindex=\"0\"\n aria-selected={selected ? 'true' : null}\n id={tab !== undefined ? `navbar-item-${tab}` : null}\n disabled={disabled}\n class={{\n 'navbar-item': true,\n 'tab-selected': selected,\n 'tab-disabled': disabled,\n }}\n >\n <a {...attrs} tabIndex={-1} class=\"button-native\" part=\"native\">\n <span class=\"button-inner\">\n <slot/>\n </span>\n </a>\n </Host>\n );\n }\n\n}\n"]}
|
package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.css
CHANGED
|
@@ -171,7 +171,8 @@
|
|
|
171
171
|
background: var(--road-primary);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
.progress-indicator-horizontal-header .completed:not(:last-child)::after
|
|
174
|
+
.progress-indicator-horizontal-header .completed:not(:last-child)::after,
|
|
175
|
+
.progress-indicator-horizontal-header .in-progress:not(:last-child)::after {
|
|
175
176
|
background: var(--road-header-badge);
|
|
176
177
|
}
|
|
177
178
|
|
|
@@ -181,7 +182,8 @@
|
|
|
181
182
|
border: 0;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
.completed .progress-indicator-horizontal-icon
|
|
185
|
+
.completed .progress-indicator-horizontal-icon,
|
|
186
|
+
.in-progress .progress-indicator-horizontal-icon{
|
|
185
187
|
width: calc(1.5rem - 4px);
|
|
186
188
|
height: calc(1.5rem - 4px);
|
|
187
189
|
color: var(--road-primary);
|
|
@@ -189,7 +191,8 @@
|
|
|
189
191
|
border: 2px solid var(--road-primary);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
|
-
.progress-indicator-horizontal-header .completed .progress-indicator-horizontal-icon
|
|
194
|
+
.progress-indicator-horizontal-header .completed .progress-indicator-horizontal-icon,
|
|
195
|
+
.progress-indicator-horizontal-header .in-progress .progress-indicator-horizontal-icon {
|
|
193
196
|
color: var(--road-header-badge);
|
|
194
197
|
background: none;
|
|
195
198
|
border: 2px solid var(--road-header-badge);
|
|
@@ -204,13 +207,29 @@
|
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
.current .progress-indicator-horizontal-title,
|
|
207
|
-
.completed .progress-indicator-horizontal-title
|
|
210
|
+
.completed .progress-indicator-horizontal-title,
|
|
211
|
+
.in-progress .progress-indicator-horizontal-title {
|
|
208
212
|
font-weight: 700;
|
|
209
213
|
color: var(--road-on-surface);
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
.progress-indicator-horizontal-header .current .progress-indicator-horizontal-title,
|
|
213
|
-
.progress-indicator-horizontal-header .completed .progress-indicator-horizontal-title
|
|
217
|
+
.progress-indicator-horizontal-header .completed .progress-indicator-horizontal-title,
|
|
218
|
+
.progress-indicator-horizontal-header .in-progress .progress-indicator-horizontal-title {
|
|
214
219
|
font-weight: 700;
|
|
215
220
|
color: var(--road-on-header-surface);
|
|
216
221
|
}
|
|
222
|
+
|
|
223
|
+
/* IN PROGRESS
|
|
224
|
+
-------------------- */
|
|
225
|
+
|
|
226
|
+
.in-progress.progress-indicator-horizontal-item:not(:last-child)::before {
|
|
227
|
+
position: relative;
|
|
228
|
+
top: 0.93rem;
|
|
229
|
+
left: calc(50% + 12px);
|
|
230
|
+
order: -1;
|
|
231
|
+
width: calc(50% - 24px);
|
|
232
|
+
height: 2px;
|
|
233
|
+
content: "";
|
|
234
|
+
background: var(--road-primary);
|
|
235
|
+
}
|
package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js
CHANGED
|
@@ -85,8 +85,8 @@ export class Stepper {
|
|
|
85
85
|
"type": "string",
|
|
86
86
|
"mutable": false,
|
|
87
87
|
"complexType": {
|
|
88
|
-
"original": "'default' | 'current' | 'comleted'",
|
|
89
|
-
"resolved": "\"comleted\" | \"current\" | \"default\" | undefined",
|
|
88
|
+
"original": "'default' | 'current' | 'comleted' | 'in-progress'",
|
|
89
|
+
"resolved": "\"comleted\" | \"current\" | \"default\" | \"in-progress\" | undefined",
|
|
90
90
|
"references": {}
|
|
91
91
|
},
|
|
92
92
|
"required": false,
|
|
@@ -102,8 +102,8 @@ export class Stepper {
|
|
|
102
102
|
"type": "string",
|
|
103
103
|
"mutable": false,
|
|
104
104
|
"complexType": {
|
|
105
|
-
"original": "'default' | 'current' | 'comleted'",
|
|
106
|
-
"resolved": "\"comleted\" | \"current\" | \"default\" | undefined",
|
|
105
|
+
"original": "'default' | 'current' | 'comleted' | 'in-progress'",
|
|
106
|
+
"resolved": "\"comleted\" | \"current\" | \"default\" | \"in-progress\" | undefined",
|
|
107
107
|
"references": {}
|
|
108
108
|
},
|
|
109
109
|
"required": false,
|
|
@@ -119,8 +119,8 @@ export class Stepper {
|
|
|
119
119
|
"type": "string",
|
|
120
120
|
"mutable": false,
|
|
121
121
|
"complexType": {
|
|
122
|
-
"original": "'default' | 'current' | 'comleted'",
|
|
123
|
-
"resolved": "\"comleted\" | \"current\" | \"default\" | undefined",
|
|
122
|
+
"original": "'default' | 'current' | 'comleted' | 'in-progress'",
|
|
123
|
+
"resolved": "\"comleted\" | \"current\" | \"default\" | \"in-progress\" | undefined",
|
|
124
124
|
"references": {}
|
|
125
125
|
},
|
|
126
126
|
"required": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-indicator-horizontal.js","sourceRoot":"","sources":["../../../src/components/progress-indicator-horizontal/progress-indicator-horizontal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,OAAO;;iBAKwC,SAAS;sBAKpC,CAAC;;;;;;;;EAiC7B,MAAM;IAEJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,K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AM,IAAI,EAAC,qCAAqC,GAAE,CAC7C,CACL,CACD;UACL,UAAI,KAAK,EAAE,GAAG,oBAAoB,EAAE;YACnC,SAAG,KAAK,EAAC,oCAAoC,EAAC,IAAI,EAAE,GAAG,QAAQ,EAAE;cAC/D,YAAM,KAAK,EAAC,oCAAoC;gBAC9C,YAAM,IAAI,EAAC,qCAAqC,GAAE,CAC7C;cACP,YAAM,KAAK,EAAC,qCAAqC;gBAC/C,YAAM,IAAI,EAAC,sCAAsC,GAAE,CAC9C,CACL,CACD;UACJ,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,UAAI,KAAK,EAAE,GAAG,mBAAmB,EAAE;YAC1D,SAAG,KAAK,EAAC,oCAAoC,EAAC,IAAI,EAAE,GAAG,QAAQ,EAAE;cAC/D,YAAM,KAAK,EAAC,oCAAoC;gBAC9C,YAAM,IAAI,EAAC,qCAAqC,GAAE,CAC7C;cACP,YAAM,KAAK,EAAC,qCAAqC;gBAC/C,YAAM,IAAI,EAAC,sCAAsC,GAAE,CAC9C,CACL,CACD,CAEF,CACD,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEL","sourcesContent":["import { Component, Host, h, Prop } from '@stencil/core';\n\n/**\n * @slot progress-indicator-horizontal-icon - if the state of the step 1 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title \n * @slot progress-indicator-horizontal-icon2 - if the state of the step 2 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title2 \n * @slot progress-indicator-horizontal-icon3 - if the state of the step 3 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title3\n */\n\n@Component({\n tag: 'road-progress-indicator-horizontal',\n styleUrl: 'progress-indicator-horizontal.css',\n shadow: true,\n})\nexport class Stepper {\n\n /**\n * The color progress-indicator-horizontal.\n */\n @Prop({ reflect: true }) color?: 'default' | 'header' = 'default';\n\n /**\n * The nombre of steps.\n */\n @Prop() numberStep?: 3 | 2 = 3;\n\n /**\n * The color of the first step.\n */\n @Prop() stateFirstStep?: 'default' | 'current' | 'comleted';\n\n /**\n * The color of the second step.\n */\n @Prop() stateSecondStep?: 'default' | 'current' | 'comleted';\n\n /**\n * The color of the third step.\n */\n @Prop() stateThirdStep?: 'default' | 'current' | 'comleted';\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep1?: string;\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep2?: string;\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep3?: string;\n \n\n render() {\n\n const colorClass = this.color !== undefined ? `progress-indicator-horizontal progress-indicator-horizontal-${this.color}` : 'progress-indicator-horizontal';\n const stateClass = this.stateFirstStep !== undefined ? `progress-indicator-horizontal-item ${this.stateFirstStep}` : 'progress-indicator-horizontal-item';\n const stateSecondStepClass = this.stateSecondStep !== undefined ? `progress-indicator-horizontal-item ${this.stateSecondStep}` : 'progress-indicator-horizontal-item';\n const stateThirdStepClass = this.stateThirdStep !== undefined ? `progress-indicator-horizontal-item ${this.stateThirdStep}` : 'progress-indicator-horizontal-item';\n const urlStep1 = this.urlStep1 !== undefined ? `${this.urlStep1}` : '#';\n const urlStep2 = this.urlStep2 !== undefined ? `${this.urlStep2}` : '#';\n const urlStep3 = this.urlStep3 !== undefined ? `${this.urlStep3}` : '#';\n\n return (\n <Host>\n <nav>\n <ul class={`${colorClass}`}>\n <li class={`${stateClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep1}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title\"/>\n </span>\n </a>\n </li>\n <li class={`${stateSecondStepClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep2}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon2\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title2\"/>\n </span>\n </a>\n </li>\n {this.numberStep == 3 && <li class={`${stateThirdStepClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep3}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon3\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title3\"/>\n </span>\n </a>\n </li>}\n \n </ul>\n </nav>\n </Host>\n );\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"progress-indicator-horizontal.js","sourceRoot":"","sources":["../../../src/components/progress-indicator-horizontal/progress-indicator-horizontal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,OAAO;;iBAKwC,SAAS;sBAKpC,CAAC;;;;;;;;EAiC7B,MAAM;IAEJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,+DAA+D,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,+BAA+B,CAAC;IAC5J,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,sCAAsC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,oCAAoC,CAAC;IAC1J,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC,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AC,sCAAsC,GAAE,CAC9C,CACL,CACD;UACJ,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,UAAI,KAAK,EAAE,GAAG,mBAAmB,EAAE;YAC1D,SAAG,KAAK,EAAC,oCAAoC,EAAC,IAAI,EAAE,GAAG,QAAQ,EAAE;cAC/D,YAAM,KAAK,EAAC,oCAAoC;gBAC9C,YAAM,IAAI,EAAC,qCAAqC,GAAE,CAC7C;cACP,YAAM,KAAK,EAAC,qCAAqC;gBAC/C,YAAM,IAAI,EAAC,sCAAsC,GAAE,CAC9C,CACL,CACD,CAEF,CACD,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEL","sourcesContent":["import { Component, Host, h, Prop } from '@stencil/core';\n\n/**\n * @slot progress-indicator-horizontal-icon - if the state of the step 1 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title \n * @slot progress-indicator-horizontal-icon2 - if the state of the step 2 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title2 \n * @slot progress-indicator-horizontal-icon3 - if the state of the step 3 is completed add\n * `<road-icon name=\"check-small\" class=\"d-block\" style=\"color: currentColor;\"></road-icon>` by default.\n * @slot progress-indicator-horizontal-title3\n */\n\n@Component({\n tag: 'road-progress-indicator-horizontal',\n styleUrl: 'progress-indicator-horizontal.css',\n shadow: true,\n})\nexport class Stepper {\n\n /**\n * The color progress-indicator-horizontal.\n */\n @Prop({ reflect: true }) color?: 'default' | 'header' = 'default';\n\n /**\n * The nombre of steps.\n */\n @Prop() numberStep?: 3 | 2 = 3;\n\n /**\n * The color of the first step.\n */\n @Prop() stateFirstStep?: 'default' | 'current' | 'comleted' | 'in-progress';\n\n /**\n * The color of the second step.\n */\n @Prop() stateSecondStep?: 'default' | 'current' | 'comleted' | 'in-progress';\n\n /**\n * The color of the third step.\n */\n @Prop() stateThirdStep?: 'default' | 'current' | 'comleted' | 'in-progress';\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep1?: string;\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep2?: string;\n\n /**\n * The url of the first step.\n */\n @Prop() urlStep3?: string;\n \n\n render() {\n\n const colorClass = this.color !== undefined ? `progress-indicator-horizontal progress-indicator-horizontal-${this.color}` : 'progress-indicator-horizontal';\n const stateClass = this.stateFirstStep !== undefined ? `progress-indicator-horizontal-item ${this.stateFirstStep}` : 'progress-indicator-horizontal-item';\n const stateSecondStepClass = this.stateSecondStep !== undefined ? `progress-indicator-horizontal-item ${this.stateSecondStep}` : 'progress-indicator-horizontal-item';\n const stateThirdStepClass = this.stateThirdStep !== undefined ? `progress-indicator-horizontal-item ${this.stateThirdStep}` : 'progress-indicator-horizontal-item';\n const urlStep1 = this.urlStep1 !== undefined ? `${this.urlStep1}` : '#';\n const urlStep2 = this.urlStep2 !== undefined ? `${this.urlStep2}` : '#';\n const urlStep3 = this.urlStep3 !== undefined ? `${this.urlStep3}` : '#';\n\n return (\n <Host>\n <nav>\n <ul class={`${colorClass}`}>\n <li class={`${stateClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep1}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title\"/>\n </span>\n </a>\n </li>\n <li class={`${stateSecondStepClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep2}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon2\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title2\"/>\n </span>\n </a>\n </li>\n {this.numberStep == 3 && <li class={`${stateThirdStepClass}`}>\n <a class=\"progress-indicator-horizontal-link\" href={`${urlStep3}`}>\n <span class=\"progress-indicator-horizontal-icon\">\n <slot name=\"progress-indicator-horizontal-icon3\"/>\n </span>\n <span class=\"progress-indicator-horizontal-title\">\n <slot name=\"progress-indicator-horizontal-title3\"/>\n </span>\n </a>\n </li>}\n \n </ul>\n </nav>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -19,19 +19,19 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
'state-first-step': {
|
|
22
|
-
options: ['default', 'current', 'completed'],
|
|
22
|
+
options: ['default', 'current', 'completed', 'in-progress'],
|
|
23
23
|
control: {
|
|
24
24
|
type: 'select',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
'state-second-step': {
|
|
28
|
-
options: ['default', 'current', 'completed'],
|
|
28
|
+
options: ['default', 'current', 'completed', 'in-progress'],
|
|
29
29
|
control: {
|
|
30
30
|
type: 'select',
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
'state-third-step': {
|
|
34
|
-
options: ['default', 'current', 'completed'],
|
|
34
|
+
options: ['default', 'current', 'completed', 'in-progress'],
|
|
35
35
|
control: {
|
|
36
36
|
type: 'select',
|
|
37
37
|
},
|
|
@@ -23,6 +23,7 @@ export class Radio {
|
|
|
23
23
|
this.disabled = false;
|
|
24
24
|
this.value = undefined;
|
|
25
25
|
this.label = `${this.radioId}-label`;
|
|
26
|
+
this.secondaryLabel = undefined;
|
|
26
27
|
this.inverse = false;
|
|
27
28
|
this.error = undefined;
|
|
28
29
|
this.helper = undefined;
|
|
@@ -51,7 +52,7 @@ export class Radio {
|
|
|
51
52
|
const inverseClass = this.inverse && 'form-radio-inverse';
|
|
52
53
|
const isInvalidClass = this.error ? 'is-invalid' : '';
|
|
53
54
|
const inlineClass = this.inline ? 'form-radio-inline' : '';
|
|
54
|
-
return (h(Host, { class: `form-radio ${inlineClass}` }, h("input", { class: `form-radio-input ${isInvalidClass}`, type: "radio", id: this.radioId, name: this.name, required: this.required, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, checked: this.checked, "aria-checked": `${this.checked}`, "aria-labelledby": labelId, value: this.value, onFocus: this.onFocus, onBlur: this.onBlur }), h("label", { class: `form-radio-label ${inverseClass}`, id: labelId, htmlFor: this.radioId }, this.label)));
|
|
55
|
+
return (h(Host, { class: `form-radio ${inlineClass}` }, h("input", { class: `form-radio-input ${isInvalidClass}`, type: "radio", id: this.radioId, name: this.name, required: this.required, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, checked: this.checked, "aria-checked": `${this.checked}`, "aria-labelledby": labelId, value: this.value, onFocus: this.onFocus, onBlur: this.onBlur }), h("label", { class: `form-radio-label ${inverseClass}`, id: labelId, htmlFor: this.radioId }, this.label, " ", h("span", { class: "form-radio-label-span" }, this.secondaryLabel))));
|
|
55
56
|
}
|
|
56
57
|
static get is() { return "road-radio"; }
|
|
57
58
|
static get encapsulation() { return "scoped"; }
|
|
@@ -174,6 +175,23 @@ export class Radio {
|
|
|
174
175
|
"reflect": false,
|
|
175
176
|
"defaultValue": "`${this.radioId}-label`"
|
|
176
177
|
},
|
|
178
|
+
"secondaryLabel": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "string",
|
|
183
|
+
"resolved": "string | undefined",
|
|
184
|
+
"references": {}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": true,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": "Secondary Label for the field"
|
|
191
|
+
},
|
|
192
|
+
"attribute": "secondary-label",
|
|
193
|
+
"reflect": false
|
|
194
|
+
},
|
|
177
195
|
"inverse": {
|
|
178
196
|
"type": "boolean",
|
|
179
197
|
"mutable": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,wBAAwB,CAAC;AAOhC,MAAM,OAAO,KAAK;;IAER,eAAU,GAAqC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,wBAAwB,CAAC;AAOhC,MAAM,OAAO,KAAK;;IAER,eAAU,GAAqC,IAAI,CAAC;IAqGpD,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,UAAU,EAAE;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC;OACrD;IACH,CAAC,CAAC;IAEM,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;IAEM,WAAM,GAAG,GAAG,EAAE;MACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;MACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC;mBA5GwB,cAAc,QAAQ,EAAE,EAAE;mBAKxB,KAAK;gBAKV,IAAI,CAAC,OAAO;oBAKP,KAAK;oBAKL,KAAK;;iBAUT,GAAG,IAAI,CAAC,OAAO,QAAQ;;mBAUpB,K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O,EAAE,IAAI,CAAC,OAAO,kBACP,GAAG,IAAI,CAAC,OAAO,EAAE,qBACd,OAAO,EACxB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,GACnB;MACF,aAAO,KAAK,EAAE,oBAAoB,YAAY,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO;QAAG,IAAI,CAAC,KAAK;;QAAE,YAAM,KAAK,EAAC,uBAAuB,IAAE,IAAI,CAAC,cAAc,CAAQ,CAAQ,CACtK,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Prop, State, h, Listen } from '@stencil/core';\nimport './../../utils/polyfill';\n\n@Component({\n tag: 'road-radio',\n styleUrl: 'radio.css',\n scoped: true,\n})\nexport class Radio {\n\n private radioGroup: HTMLRoadRadioGroupElement | null = null;\n\n @Element() el!: HTMLRoadRadioElement;\n\n /**\n * The id of radio\n */\n @Prop() radioId: string = `road-radio-${radioIds++}`;\n\n /**\n * If `true`, the radio is selected.\n */\n @State() checked: boolean = false;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.radioId;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required: boolean = false;\n\n /**\n * If `true`, the user cannot interact with the radio.\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Value the form will get\n */\n @Prop() value?: any | null;\n\n /**\n * Label for the field\n */\n @Prop() label: string = `${this.radioId}-label`;\n\n /**\n * Secondary Label for the field\n */\n @Prop() secondaryLabel?: string;\n\n /**\n * If `true`, the label and the radio are inverse and spaced\n */\n @Prop() inverse: boolean = false;\n\n /**\n * Error message for the field\n */\n @Prop() error?: boolean;\n\n /**\n * Helper message for the field\n */\n @Prop() helper?: string;\n\n /**\n * Inline multiple radio\n */\n @Prop() inline: boolean = true;\n\n /**\n * Emitted when the radio button has focus.\n */\n @Event() roadfocus!: EventEmitter<void>;\n /** @internal */\n @Event() roadFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the radio button loses focus.\n */\n @Event() roadblur!: EventEmitter<void>;\n /** @internal */\n @Event() roadBlur!: EventEmitter<void>;\n\n connectedCallback() {\n if (this.value === undefined) {\n this.value = this.radioId;\n }\n const radioGroup = this.radioGroup = this.el.closest('road-radio-group');\n if (radioGroup) {\n this.updateState();\n }\n }\n\n disconnectedCallback() {\n const radioGroup = this.radioGroup;\n if (radioGroup) {\n this.radioGroup = null;\n }\n }\n\n @Listen('roadChange', {target: 'window'})\n @Listen('roadchange', {target: 'window'})\n onRoadChangedChanged() {\n this.updateState();\n }\n\n private updateState = () => {\n if (this.radioGroup) {\n this.checked = this.radioGroup.value === this.value;\n }\n };\n\n private onFocus = () => {\n this.roadfocus.emit();\n this.roadFocus.emit();\n };\n\n private onBlur = () => {\n this.roadblur.emit();\n this.roadBlur.emit();\n };\n\n render() {\n const labelId = this.radioId + '-label';\n const inverseClass = this.inverse && 'form-radio-inverse';\n const isInvalidClass = this.error ? 'is-invalid' : '';\n const inlineClass = this.inline ? 'form-radio-inline' : '';\n\n return (\n <Host class={`form-radio ${inlineClass}`}>\n <input\n class={`form-radio-input ${isInvalidClass}`}\n type=\"radio\"\n id={this.radioId}\n name={this.name}\n required={this.required}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n checked={this.checked}\n aria-checked={`${this.checked}`}\n aria-labelledby={labelId}\n value={this.value}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n />\n <label class={`form-radio-label ${inverseClass}`} id={labelId} htmlFor={this.radioId}>{this.label} <span class=\"form-radio-label-span\">{this.secondaryLabel}</span></label>\n </Host>\n );\n }\n}\n\nlet radioIds = 0;\n"]}
|
|
@@ -32,6 +32,7 @@ export const Playground = (args) => html`
|
|
|
32
32
|
disabled="${ifDefined(args.disabled)}"
|
|
33
33
|
required="${ifDefined(args.required)}"
|
|
34
34
|
label="${ifDefined(args.label)}"
|
|
35
|
+
secondary-label="${ifDefined(args['secondary-label'])}"
|
|
35
36
|
inverse="${ifDefined(args.inverse)}"
|
|
36
37
|
inline="${ifDefined(args.inline)}"
|
|
37
38
|
value="${ifDefined(args.value)}"
|
|
@@ -45,6 +46,7 @@ Playground.args = {
|
|
|
45
46
|
inverse: null,
|
|
46
47
|
inline: undefined,
|
|
47
48
|
label: 'Label',
|
|
49
|
+
'secondary-label': undefined,
|
|
48
50
|
value: 'on',
|
|
49
51
|
asterisk: null,
|
|
50
52
|
};
|
|
@@ -70,6 +72,9 @@ Playground.argTypes = {
|
|
|
70
72
|
label: {
|
|
71
73
|
control: 'text',
|
|
72
74
|
},
|
|
75
|
+
'secondary-label': {
|
|
76
|
+
control: 'text',
|
|
77
|
+
},
|
|
73
78
|
asterisk: {
|
|
74
79
|
control: 'boolean',
|
|
75
80
|
},
|
|
@@ -79,6 +79,11 @@ export class SelectFilter {
|
|
|
79
79
|
this.onClick(activeOption.item.value, activeOption.item.label);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
else if (event.key === 'Escape') {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
this.isOpen = false;
|
|
85
|
+
this.isActive = false;
|
|
86
|
+
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
89
|
get filteredOptions() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-filter.js","sourceRoot":"","sources":["../../../src/components/select-filter/select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACtG,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B;;GAEG;AAOH,MAAM,OAAO,YAAY;;
|
|
1
|
+
{"version":3,"file":"select-filter.js","sourceRoot":"","sources":["../../../src/components/select-filter/select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACtG,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B;;GAEG;AAOH,MAAM,OAAO,YAAY;;IA4Gf,YAAO,GAAG,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;MACzD,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAA0B,CAAC,KAAK,GAAG,KAAK,CAAC;MAC5E,IAAI,QAAQ,CAAC,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACxE,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,CAAyB,CAAC,IAAI,GAAG,OAAO,GAAG,KAAK,CAAC;OACpF;MACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;MACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;QACvB,KAAK,EAAE,KAAK;OACb,CAAC,CAAC;MACH,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;QACvB,KAAK,EAAE,KAAK;OACb,CAAC,CAAC;MACH,IAAI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,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,EACxG,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAClD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAC5B,QAAQ,EAAE,IAAI,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAExC,CACN,CAAC,CACC,CACF,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Listen, Prop, State, h, Event, EventEmitter } from '@stencil/core';\nimport Fuse from 'fuse.js';\n\n/**\n * @slot - Input element for the widget, it should be a road-input element.\n */\n\n@Component({\n tag: 'road-select-filter',\n styleUrl: 'select-filter.css',\n scoped: true,\n})\nexport class SelectFilter {\n\n @Element() el!: HTMLRoadSelectFilterElement;\n\n @State() isOpen: boolean = false;\n\n @State() currentValue: string = '';\n\n @State() activeIndex: number = -1;\n\n /**\n * List of options of the select\n */\n @Prop() options: Array<{\n value: string | number;\n label: string;\n }> = [];\n\n /**\n * Options to pass to the fuse.js instance.\n * See https://fusejs.io/api/options.html for valid options\n */\n @Prop() parameters: any = {\n keys: [\"value\", \"label\"],\n threshold: 0.3,\n ignoreLocation: true,\n };\n\n /**\n * If `true`, add class Active\n */\n @Prop() isActive: boolean = false;\n\n /**\n * If `false`, the user can submit custom value\n */\n @Prop() onlySelect: boolean = true;\n\n @Listen('roadFocus')\n @Listen('roadfocus')\n handleFocus() {\n this.isOpen = true;\n this.isActive = true;\n }\n\n @Listen('roadBlur')\n @Listen('roadblur')\n handleBlur() {\n this.isActive = false;\n }\n\n @Listen('roadChange')\n @Listen('roadchange')\n handleChange(event: CustomEvent) {\n this.currentValue = event.detail.value.toLowerCase();\n }\n\n @Listen('click', { target: 'document' })\n onClickOutside(event: MouseEvent) {\n if (this.isOpen && !this.el.contains(event.target as Node)) {\n this.isOpen = false;\n this.isActive = false;\n const value = (this.el.querySelector('road-input') as HTMLRoadInputElement).value;\n if (this.onlySelect && !this.options.some(option => option['label'] === value)) {\n (this.el.querySelector('road-input') as HTMLRoadInputElement).value = '';\n }\n }\n }\n\n @Listen('keydown', { target: 'window' })\n handleKeydown(event: KeyboardEvent) {\n if (this.isOpen) {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.activeIndex = (this.activeIndex + 1) % this.filteredOptions.length;\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.activeIndex = (this.activeIndex - 1 + this.filteredOptions.length) % this.filteredOptions.length;\n } else if (event.key === 'Enter') {\n event.preventDefault();\n const activeOption = this.filteredOptions[this.activeIndex];\n if (activeOption) {\n this.onClick(activeOption.item.value, activeOption.item.label);\n }\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this.isOpen = false;\n this.isActive = false;\n }\n }\n}\n\n\n get filteredOptions() {\n const fuseSearch = new Fuse(this.options, this.parameters);\n return this.currentValue === '' ? this.options.map((doc, idx) => ({ item: doc, score: 1, refIndex: idx })) : fuseSearch.search(this.currentValue);\n }\n\n @Event() roadselected!: EventEmitter<{\n value: string | undefined | null,\n label: string\n }>;\n\n @Event() roadSelected!: EventEmitter<{\n value: string | undefined | null,\n label: string\n }>;\n\n private onClick = (value: string | number, label: string) => {\n (this.el.querySelector('road-input') as HTMLRoadInputElement).value = label;\n if (document.getElementsByClassName('phone-number-label-icon').length > 0) {\n (this.el.querySelector('road-icon') as HTMLRoadIconElement).name = 'flag-' + label;\n }\n this.isOpen = false;\n this.roadselected.emit({\n value: value.toString(),\n label: label,\n });\n this.roadSelected.emit({\n value: value.toString(),\n label: label,\n });\n this.activeIndex = -1;\n };\n\n private handleOptionMouseOver = (index: number) => {\n this.activeIndex = index;\n };\n\n private handleOptionClick = (value: string | number, label: string) => {\n this.onClick(value, label);\n };\n\n private handleMouseLeave = () => {\n this.activeIndex = -1;\n };\n\n render() {\n const options = this.filteredOptions;\n const isActive = this.isActive ? 'true' : 'false';\n const notActive = this.isActive ? '' : 'not-active';\n\n return (\n <Host is-active={isActive}>\n <slot />\n {this.isOpen &&\n <ul \n class={`${notActive} select-filter-list`} \n role=\"listbox\"\n onMouseLeave={this.handleMouseLeave}\n >\n {options.map((option, idx) => (\n <li\n class={`select-filter-item ${this.activeIndex === idx ? 'active' : ''}`}\n role=\"option\"\n aria-selected={this.activeIndex === idx ? 'true' : 'false'}\n onClick={() => this.handleOptionClick(option.item.value, option.item.label.replace(/(<([^>]+)>)/gi, \"\"))}\n onMouseOver={() => this.handleOptionMouseOver(idx)}\n innerHTML={option.item.label}\n tabindex={this.activeIndex === idx ? 0 : -1}\n >\n </li>\n ))}\n </ul>}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -72,6 +72,22 @@
|
|
|
72
72
|
outline: auto;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Disabled
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
:host(.tab-disabled) {
|
|
80
|
+
background: var(--road-surface-disabled);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host(.tab-disabled) .button-native{
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host(.tab-disabled) ::slotted(road-label) {
|
|
88
|
+
color: var(--road-on-surface-disabled);
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
|
|
76
92
|
/* NATIVE
|
|
77
93
|
-------------------- */
|
|
@@ -19,6 +19,7 @@ export class TabButton {
|
|
|
19
19
|
this.rel = undefined;
|
|
20
20
|
this.layout = 'icon-start';
|
|
21
21
|
this.selected = false;
|
|
22
|
+
this.disabled = false;
|
|
22
23
|
this.tab = undefined;
|
|
23
24
|
this.target = undefined;
|
|
24
25
|
}
|
|
@@ -58,20 +59,21 @@ export class TabButton {
|
|
|
58
59
|
return 0;
|
|
59
60
|
}
|
|
60
61
|
render() {
|
|
61
|
-
const { hasIcon, hasLabel, tabIndex, href, rel, target, layout, selected, tab } = this;
|
|
62
|
+
const { hasIcon, hasLabel, tabIndex, href, rel, target, layout, selected, tab, disabled } = this;
|
|
62
63
|
const attrs = {
|
|
63
64
|
download: this.download,
|
|
64
|
-
href,
|
|
65
|
+
href: !disabled ? href : undefined,
|
|
65
66
|
rel,
|
|
66
67
|
target,
|
|
67
68
|
};
|
|
68
|
-
return (h(Host, { onClick: this.onClick, onKeyup: this.onKeyUp, role: "tab", tabindex: tabIndex, "aria-selected": selected ? 'true' : null, id: tab !== undefined ? `tab-button-${tab}` : null, class: {
|
|
69
|
+
return (h(Host, { onClick: (ev) => !disabled && this.onClick(ev), onKeyup: (ev) => !disabled && this.onKeyUp(ev), role: "tab", tabindex: disabled ? -1 : tabIndex, "aria-selected": selected ? 'true' : 'false', "aria-disabled": disabled ? 'true' : null, id: tab !== undefined ? `tab-button-${tab}` : null, class: {
|
|
69
70
|
'tab-selected': selected,
|
|
70
71
|
'tab-has-label': hasLabel,
|
|
71
72
|
'tab-has-icon': hasIcon,
|
|
72
73
|
'tab-has-label-only': hasLabel && !hasIcon,
|
|
73
74
|
'tab-has-icon-only': hasIcon && !hasLabel,
|
|
74
75
|
[`tab-layout-${layout}`]: true,
|
|
76
|
+
'tab-disabled': disabled, // Classe CSS pour les styles désactivés
|
|
75
77
|
} }, h("a", Object.assign({}, attrs, { tabIndex: -1, class: "button-native", part: "native" }), h("span", { class: "button-inner" }, h("slot", null)))));
|
|
76
78
|
}
|
|
77
79
|
static get is() { return "road-tab-button"; }
|
|
@@ -175,6 +177,24 @@ export class TabButton {
|
|
|
175
177
|
"reflect": false,
|
|
176
178
|
"defaultValue": "false"
|
|
177
179
|
},
|
|
180
|
+
"disabled": {
|
|
181
|
+
"type": "boolean",
|
|
182
|
+
"mutable": true,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "boolean",
|
|
185
|
+
"resolved": "boolean",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": false,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "The disabled tab"
|
|
193
|
+
},
|
|
194
|
+
"attribute": "disabled",
|
|
195
|
+
"reflect": false,
|
|
196
|
+
"defaultValue": "false"
|
|
197
|
+
},
|
|
178
198
|
"tab": {
|
|
179
199
|
"type": "string",
|
|
180
200
|
"mutable": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-button.js","sourceRoot":"","sources":["../../../src/components/tab-button/tab-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE/F;;;;GAIG;AAOH,MAAM,OAAO,SAAS;;
|
|
1
|
+
{"version":3,"file":"tab-button.js","sourceRoot":"","sources":["../../../src/components/tab-button/tab-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE/F;;;;GAIG;AAOH,MAAM,OAAO,SAAS;;IA0GZ,YAAO,GAAG,CAAC,EAAiB,EAAE,EAAE;MACtC,IAAI,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG,EAAE;QACxC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;OACpB;IACH,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,EAAE,QAAQ;QACxB,eAAe,EAAE,QAAQ;QACzB,cAAc,EAAE,OAAO;QACvB,oBAAoB,EAAE,QAAQ,IAAI,CAAC,OAAO;QAC1C,mBAAmB,EAAE,OAAO,IAAI,CAAC,QAAQ;QACzC,CAAC,cAAc,MAAM,EAAE,CAAC,EAAE,IAAI;QAC9B,cAAc,EAAE,QAAQ,EAAE,wCAAwC;OACnE;MAED,yBAAO,KAAK,IAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,QAAQ;QAC7D,YAAM,KAAK,EAAC,cAAc;UACxB,eAAO,CACF,CACL,CACC,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Listen, Prop, h } from '@stencil/core';\n\n/**\n * @slot - Content of the tab-button, it should be road-icon and road-label elements.\n *\n * @part native - The native HTML anchor element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-tab-button',\n styleUrl: 'tab-button.css',\n shadow: true,\n})\nexport class TabButton {\n\n @Element() el!: HTMLRoadTabButtonElement;\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download: string | undefined;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href: string | undefined;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel: string | undefined;\n\n /**\n * Set the layout of the text and icon in the tab bar.\n * It defaults to `'icon-start'`.\n */\n @Prop() layout?: 'icon-start' | 'icon-top' = 'icon-start';\n\n /**\n * The selected tab component\n */\n @Prop({ mutable: true }) selected = false;\n\n /**\n * The disabled tab \n */\n @Prop({ mutable: true }) disabled = false;\n\n /**\n * A tab id must be provided for each `road-tab`. It's used internally to reference\n */\n @Prop() tab?: string;\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target: string | undefined;\n\n /**\n * Emitted when the tab bar is clicked\n * @internal\n */\n @Event() roadtabbuttonclick!: EventEmitter;\n /** @internal */\n @Event() roadTabButtonClick!: EventEmitter;\n\n @Listen('roadTabBarChanged', { target: 'window' })\n @Listen('roadTabbarchanged', { target: 'window' })\n onTabBarChanged(ev: CustomEvent) {\n const dispatchedFrom = ev.target as HTMLElement;\n const parent = this.el.parentElement as EventTarget;\n\n if ((ev.composedPath && ev.composedPath().includes(parent)) || (dispatchedFrom && dispatchedFrom.contains(this.el))) {\n this.selected = this.tab === ev.detail.tab;\n }\n }\n\n private selectTab(ev: Event | KeyboardEvent) {\n if (this.tab !== undefined) {\n this.roadtabbuttonclick.emit({\n tab: this.tab,\n href: this.href,\n selected: this.selected,\n });\n this.roadTabButtonClick.emit({\n tab: this.tab,\n href: this.href,\n selected: this.selected,\n });\n\n ev.preventDefault();\n }\n }\n\n private get hasLabel() {\n return !!this.el.querySelector('road-label');\n }\n\n private get hasIcon() {\n return !!this.el.querySelector('road-icon');\n }\n\n private get tabIndex() {\n const hasTabIndex = this.el.hasAttribute('tabindex');\n\n if (hasTabIndex) {\n return this.el.getAttribute('tabindex');\n }\n\n return 0;\n }\n\n private onKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n this.selectTab(ev);\n }\n };\n\n private onClick = (ev: Event) => {\n this.selectTab(ev);\n };\n\n render() {\n const { hasIcon, hasLabel, tabIndex, href, rel, target, layout, selected, tab, disabled } = this;\n const attrs = {\n download: this.download,\n href: !disabled ? href : undefined, // Ne pas inclure le lien si désactivé\n rel,\n target,\n };\n \n return (\n <Host\n onClick={(ev: Event) => !disabled && this.onClick(ev)} // Bloquer les clics si désactivé\n onKeyup={(ev: KeyboardEvent) => !disabled && this.onKeyUp(ev)} // Bloquer les interactions clavier si désactivé\n role=\"tab\"\n tabindex={disabled ? -1 : tabIndex} // Désactiver le focus si désactivé\n aria-selected={selected ? 'true' : 'false'}\n aria-disabled={disabled ? 'true' : null} // Ajout pour l'accessibilité\n id={tab !== undefined ? `tab-button-${tab}` : null}\n class={{\n 'tab-selected': selected,\n 'tab-has-label': hasLabel,\n 'tab-has-icon': hasIcon,\n 'tab-has-label-only': hasLabel && !hasIcon,\n 'tab-has-icon-only': hasIcon && !hasLabel,\n [`tab-layout-${layout}`]: true,\n 'tab-disabled': disabled, // Classe CSS pour les styles désactivés\n }}\n >\n <a {...attrs} tabIndex={-1} class=\"button-native\" part=\"native\">\n <span class=\"button-inner\">\n <slot/>\n </span>\n </a>\n </Host>\n );\n }\n}\n"]}
|