@aquera/nile-elements 0.1.14 → 0.1.16
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 +8 -0
- package/demo/index.html +4 -72
- package/demo/variables.css +19 -58
- package/demo/variables_v2.css +0 -2
- package/dist/nile-button/nile-button.css.cjs.js +1 -1
- package/dist/nile-button/nile-button.css.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.css.esm.js +77 -83
- package/dist/nile-checkbox/nile-checkbox.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.cjs.js.map +1 -1
- package/dist/nile-checkbox/nile-checkbox.esm.js +11 -18
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js.map +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.esm.js +2 -2
- package/dist/nile-form-group/nile-form-group.css.cjs.js +1 -1
- package/dist/nile-form-group/nile-form-group.css.cjs.js.map +1 -1
- package/dist/nile-form-group/nile-form-group.css.esm.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.cjs.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.cjs.js.map +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.esm.js +0 -1
- package/dist/nile-toast/nile-toast.cjs.js +1 -1
- package/dist/nile-toast/nile-toast.cjs.js.map +1 -1
- package/dist/nile-toast/nile-toast.esm.js +3 -3
- package/dist/src/nile-button/nile-button.css.js +77 -83
- package/dist/src/nile-button/nile-button.css.js.map +1 -1
- package/dist/src/nile-checkbox/nile-checkbox.js +5 -12
- package/dist/src/nile-checkbox/nile-checkbox.js.map +1 -1
- package/dist/src/nile-checkbox/nile-checkbox.test.js +5 -17
- package/dist/src/nile-checkbox/nile-checkbox.test.js.map +1 -1
- package/dist/src/nile-form-group/nile-form-group.css.js +1 -1
- package/dist/src/nile-form-group/nile-form-group.css.js.map +1 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.css.js +0 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.css.js.map +1 -1
- package/dist/src/nile-toast/nile-toast.d.ts +1 -0
- package/dist/src/nile-toast/nile-toast.js +5 -1
- package/dist/src/nile-toast/nile-toast.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-button/nile-button.css.ts +77 -83
- package/src/nile-checkbox/nile-checkbox.test.ts +6 -21
- package/src/nile-checkbox/nile-checkbox.ts +5 -12
- package/src/nile-form-group/nile-form-group.css.ts +1 -1
- package/src/nile-stepper-item/nile-stepper-item.css.ts +0 -1
- package/src/nile-toast/nile-toast.ts +3 -1
- package/vscode-html-custom-data.json +5 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-button.css.js","sourceRoot":"","sources":["../../../src/nile-button/nile-button.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8rBxB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Button CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n position: relative;\n width: auto;\n cursor: pointer;\n }\n\n .button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-style: solid;\n border-width: 1px;\n font-style: normal;\n font-family: var(--nile-font-family-serif);\n text-align: center;\n letter-spacing: 0.2px;\n text-decoration: none;\n user-select: none;\n white-space: nowrap;\n vertical-align: middle;\n transition: var(--nile-transition-duration-default) background-color,\n var(--nile-transition-duration-default) color,\n var(--nile-transition-duration-default) border,\n var(--nile-transition-duration-default) box-shadow;\n cursor: inherit;\n font-size: 14px;\n font-weight: 500;\n border-radius: var(--nile-radius-base-standard);\n padding: 10px 14px;\n gap: 5px;\n line-height: 20px;\n box-sizing: border-box;\n height: 40px;\n }\n\n .button::-moz-focus-inner {\n border: 0;\n }\n\n .button:focus {\n outline: none;\n }\n\n .button:focus-visible {\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: 2px;\n }\n\n .button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .button--disabled * {\n pointer-events: none;\n }\n\n /* Primary */\n .button--standard.button--primary {\n background-color: var(--nile-colors-button-primary);\n border-color: var(--nile-colors-button-primary-border);\n color: var(--nile-colors-button-primary-text);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--primary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-button-primary-hover);\n border-color: var(--nile-colors-button-primary-hover);\n color: var(--nile-colors-button-primary-text);\n }\n\n .button--standard.button--primary:active:not(.button--disabled) {\n background-color: var(--nile-colors-button-primary-pressed);\n border-color: var(--nile-colors-button-primary-pressed-border);\n color: var(--nile-colors-button-primary-text);\n box-shadow: 0px 1px 2px 0px rgba(0, 82, 145, 0.1),\n 0px 0px 0px 4px rgba(0, 94, 166, 0.15);\n }\n\n .button--standard.button--primary.button--disabled {\n background-color: var(--nile-colors-button-primary-disabled);\n border-color: var(--nile-colors-button-primary-disabled);\n color: var(--nile-colors-button-primary-disabled-text);\n cursor: not-allowed;\n }\n\n .button--standard.button--primary.button--disabled:hover,\n .button--standard.button--primary.button--disabled:active {\n background-color: var(--nile-colors-button-primary-disabled);\n border-color: var(--nile-colors-button-primary-disabled);\n color: var(--nile-colors-button-primary-disabled-text);\n cursor: not-allowed;\n }\n\n /* Secondary */\n .button--standard.button--secondary {\n background-color: var(--nile-colors-button-secondary);\n border-color: var(--nile-colors-button-secondary-border);\n color: var(--nile-colors-button-secondary-text);\n }\n\n .button--standard.button--secondary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-button-secondary-hover);\n border-color: var(--nile-colors-button-secondary-border);\n color: var(--nile-colors-button-secondary-text);\n }\n\n .button--standard.button--secondary:active:not(.button--disabled) {\n background-color: var(--nile-colors-button-secondary-pressed);\n border-color: var(--nile-colors-button-secondary-pressed-border);\n color: var(--nile-colors-button-secondary-text);\n }\n\n .button--standard.button--secondary.button--disabled {\n background-color: var(--nile-colors-button-secondary-disabled);\n border-color: var(--nile-colors-button-secondary-disabled-border);\n color: var(--nile-colors-button-secondary-disabled-text);\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary.button--disabled:hover,\n .button--standard.button--secondary.button--disabled:active {\n background-color: var(--nile-colors-button-secondary-disabled);\n border-color: var(--nile-colors-button-secondary-disabled-border);\n color: var(--nile-colors-button-secondary-disabled-text);\n cursor: not-allowed;\n }\n\n /* Tertiary */\n .button--standard.button--tertiary {\n background-color: var(--nile-colors-button-tertiary);\n border-color: var(--nile-colors-button-tertiary-border);\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--tertiary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-button-tertiary-hover);\n border-color: var(--nile-colors-neutral-500);\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--tertiary:active:not(.button--disabled) {\n background-color: var(--nile-colors-button-tertiary-pressed);\n border-color: var(--nile-colors-button-tertiary-pressed-border);\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--tertiary.button--disabled,\n .button--standard.button--tertiary.button--disabled:hover,\n .button--standard.button--tertiary.button--disabled:active {\n border-color: var(--nile-colors-neutral-500);\n background-color: var(--nile-colors-button-tertiary-disabled);\n color: var(--nile-colors-button-tertiary-disabled-text);\n cursor: not-allowed;\n box-shadow: none;\n }\n\n /* ghost */\n .button--standard.button--ghost {\n background-color: var(--nile-colors-button-tertiary);\n border-color: transparent;\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--ghost:hover:not(.button--disabled) {\n background-color: var(--nile-colors-button-tertiary-hover);\n border-color: transparent;\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--ghost:active:not(.button--disabled) {\n background-color: var(--nile-colors-button-tertiary-pressed);\n border-color: transparent;\n color: var(--nile-colors-button-tertiary-text);\n }\n\n .button--standard.button--ghost.button--disabled,\n .button--standard.button--ghost.button--disabled:hover,\n .button--standard.button--ghost.button--disabled:active {\n border-color: transparent;\n background-color: var(--nile-colors-button-tertiary-disabled);\n color: var(--nile-colors-button-tertiary-disabled-text);\n cursor: not-allowed;\n box-shadow: none;\n }\n\n /* caution */\n .button--standard.button--caution {\n background-color: var(--nile-colors-button-caution);\n border-color: var(--nile-colors-button-caution);\n color: var(--nile-colors-button-caution-text);\n }\n\n .button--standard.button--caution:hover:not(.button--disabled) {\n background-color: var(--nile-colors-button-caution-hover);\n border-color: var(--nile-colors-button-caution-hover);\n color: var(--nile-colors-button-caution-text);\n }\n\n .button--standard.button--caution:active:not(.button--disabled) {\n background-color: var(--nile-colors-button-caution-pressed);\n border-color: var(--nile-colors-button-caution-pressed-border);\n color: var(--nile-colors-button-caution-text);\n }\n\n .button--standard.button--caution.button--disabled,\n .button--standard.button--caution.button--disabled:hover,\n .button--standard.button--caution.button--disabled:active {\n background-color: var(--nile-colors-button-caution-disabled);\n border-color: var(--nile-colors-button-caution-disabled);\n color: var(--nile-colors-button-caution-disabled-text);\n }\n\n /* destructive */\n .button--standard.button--destructive {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--destructive:hover:not(.button--disabled) {\n background-color: #b42318;\n border-color: #b42318;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--destructive:active:not(.button--disabled) {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n .button--standard.button--destructive:focus-visible:not(.button--disabled) {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n .button--standard.button--destructive.button--disabled {\n background-color: #f2f4f7;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--destructive.button--disabled:hover,\n .button--standard.button--destructive.button--disabled:active {\n background-color: #f2f4f7;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* secondary-Grey */\n .button--standard.button--secondary-grey {\n background-color: #fff;\n border-color: #d0d5dd;\n color: #344054;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-grey:hover:not(.button--disabled) {\n background-color: #f9fafb;\n border-color: #d0d5dd;\n color: #182230;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-grey:active:not(.button--disabled) {\n background-color: #fff;\n border-color: #d0d5dd;\n color: #344054;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(152, 162, 179, 0.14);\n }\n\n .button--standard.button--secondary-grey.button--disabled {\n background-color: #eaecf0;\n border-color: var(--nile-colors-button-primary-disabled);\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary-grey.button--disabled:hover,\n .button--standard.button--secondary-grey.button--disabled:active {\n background-color: #eaecf0;\n border-color: var(--nile-colors-button-primary-disabled);\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* secondary-blue */\n .button--standard.button--secondary-blue {\n background-color: #fff;\n border-color: #85aad1;\n color: #005291;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-blue:hover:not(.button--disabled) {\n background-color: #eaf0f8;\n border-color: #85aad1;\n color: #004678;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-blue:active:not(.button--disabled) {\n background-color: #fff;\n border-color: #85aad1;\n color: #005291;\n box-shadow: 0px 1px 2px 0px rgba(0, 82, 145, 0.1),\n 0px 0px 0px 4px rgba(0, 94, 166, 0.15);\n }\n\n .button--standard.button--secondary-blue.button--disabled {\n background-color: #fff;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary-blue.button--disabled:hover,\n .button--standard.button--secondary-blue.button--disabled:active {\n background-color: #fff;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* Primary Variant - Nile Icon Fill */\n .button--standard.button--primary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--primary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-primary-disabled-text) !important;\n }\n\n /* Secondary Variant */\n .button--standard.button--secondary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--secondary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(\n --nile-colors-button-secondary-disabled-text\n ) !important;\n }\n\n /* Tertiary Variant */\n .button--standard.button--tertiary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--tertiary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(\n --nile-colors-button-tertiary-disabled-text\n ) !important;\n }\n\n /* Ghost Variant */\n .button--standard.button--ghost ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--ghost:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--ghost:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--ghost ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(\n --nile-colors-button-tertiary-disabled-text\n ) !important;\n }\n\n /* Caution Variant */\n .button--standard.button--caution ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--caution:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-button-caution-disabled-text) !important;\n }\n\n /* destructive */\n .button--standard.button--destructive ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n .button--standard.button--destructive:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--caution:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n .button--standard.button--destructive.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n\n /*\n * Outline buttons\n */\n\n .button--outline {\n background: none;\n border: solid 2px;\n }\n\n /* Default */\n .button--outline.button--secondary {\n border-color: var(--nile-colors-neutral-300);\n color: var(--nile-colors-neutral-700);\n }\n\n .button--outline.button--secondary:hover:not(.button--disabled),\n .button--outline.button--secondary.button--checked:not(.button--disabled) {\n border-color: var(--nile-colors-primary-600);\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--secondary:active:not(.button--disabled) {\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Primary */\n .button--outline.button--primary {\n border-color: var(--nile-colors-primary-600);\n color: var(--nile-colors-primary-600);\n }\n\n .button--outline.button--primary:hover:not(.button--disabled),\n .button--outline.button--primary.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--primary:active:not(.button--disabled) {\n border-color: var(--nile-colors-primary-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Success */\n .button--outline.button--success {\n border-color: var(--nile-colors-green-600);\n color: var(--nile-colors-green-600);\n }\n\n .button--outline.button--success:hover:not(.button--disabled),\n .button--outline.button--success.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--success:active:not(.button--disabled) {\n border-color: var(--nile-colors-green-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Neutral */\n .button--outline.button--neutral {\n border-color: var(--nile-colors-neutral-600);\n color: var(--nile-colors-neutral-600);\n }\n\n .button--outline.button--neutral:hover:not(.button--disabled),\n .button--outline.button--neutral.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--neutral:active:not(.button--disabled) {\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Warning */\n .button--outline.button--warning {\n border-color: var(--nile-colors-orange-600);\n color: var(--nile-colors-orange-600);\n }\n\n .button--outline.button--warning:hover:not(.button--disabled),\n .button--outline.button--warning.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--warning:active:not(.button--disabled) {\n border-color: var(--nile-colors-orange-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Danger */\n .button--outline.button--danger {\n border-color: var(--nile-colors-red-600);\n color: var(--nile-colors-red-600);\n }\n\n .button--outline.button--danger:hover:not(.button--disabled),\n .button--outline.button--danger.button--checked:not(.button--disabled) {\n background-color: var(--nile-colors-red-600);\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--danger:active:not(.button--disabled) {\n border-color: var(--nile-colors-red-700);\n background-color: var(--nile-colors-red-700);\n color: var(--nile-colors-white-base);\n }\n\n /* destructive */\n .button--outline.button--destructive {\n border-color: #fda29b;\n color: #b42318;\n box-shadow: 0px;\n }\n\n .button--outline.button--destructive:hover:not(.button--disabled),\n .button--outline.button--destructive.button--checked:not(.button--disabled) {\n border-color: #fda29b;\n color: #912018;\n background-color: #fef3f2;\n }\n\n .button--outline.button--destructive:active:not(.button--disabled) {\n border-color: #fda29b;\n color: #b42318;\n background-color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n /* destructive - focus-visible */\n .button--outline.button--destructive:focus-visible:not(.button--disabled) {\n border-color: #fda29b;\n color: #b42318;\n background-color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n /* secondary-grey */\n .button--outline.button--secondary-grey {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-grey:hover:not(.button--disabled),\n .button--outline.button--secondary-grey.button--checked:not(\n .button--disabled\n ) {\n color: #344054;\n background-color: #f9fafb;\n }\n\n .button--outline.button--secondary-grey:active:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-grey:focus-visible:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n /* secondary-blue */\n .button--outline.button--secondary-blue {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-blue:hover:not(.button--disabled),\n .button--outline.button--secondary-blue.button--checked:not(\n .button--disabled\n ) {\n color: #004678;\n background-color: #eaf0f8;\n }\n\n .button--outline.button--secondary-blue:active:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-blue:focus-visible:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n @media (forced-colors: active) {\n .button.button--outline.button--checked:not(.button--disabled) {\n outline: solid 2px transparent;\n }\n }\n\n /*\n * Pill modifier\n */\n\n .button--pill.button--small {\n border-radius: 24px;\n }\n\n .button--pill.button--medium {\n border-radius: 32px;\n }\n\n /*\n * Circle modifier\n */\n\n .button--circle {\n padding-left: 0;\n padding-right: 0;\n }\n\n .button--circle.button--small {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n }\n\n .button--circle.button--medium {\n width: 38px;\n height: 38px;\n border-radius: 50%;\n }\n\n .button--circle .button__prefix,\n .button--circle .button__suffix,\n .button--circle .button__caret {\n display: none;\n }\n\n /* Caret modifier */\n\n .button--caret .button__suffix {\n display: none;\n }\n\n .button--caret .button__caret {\n height: auto;\n }\n\n /*\n * Loading modifier\n */\n\n .button--loading {\n position: relative;\n cursor: wait;\n }\n\n .button--loading .button__prefix,\n .button--loading .button__label,\n .button--loading .button__suffix,\n .button--loading .button__caret {\n visibility: hidden;\n }\n\n .button--loading nile-spinner {\n --indicator-color: currentColor;\n position: absolute;\n font-size: 1em;\n height: 1em;\n width: 1em;\n top: calc(50% - 0.5em);\n left: calc(50% - 0.5em);\n }\n /*\n * Badges\n */\n\n .button ::slotted(nile-badge) {\n position: absolute;\n top: 0;\n right: 0;\n translate: 50% -50%;\n pointer-events: none;\n }\n\n /* outline with no border */\n .button--outline.button--hideborder {\n border: 0px;\n }\n`;\n"]}
|
1
|
+
{"version":3,"file":"nile-button.css.js","sourceRoot":"","sources":["../../../src/nile-button/nile-button.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwrBxB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Button CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n position: relative;\n width: auto;\n cursor: pointer;\n }\n\n .button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-style: solid;\n border-width: 1px;\n font-style: normal;\n font-family: var(--nile-font-family-serif);\n text-align: center;\n letter-spacing: 0.2px;\n text-decoration: none;\n user-select: none;\n white-space: nowrap;\n vertical-align: middle;\n transition: var(--nile-transition-duration-default) background-color,\n var(--nile-transition-duration-default) color,\n var(--nile-transition-duration-default) border,\n var(--nile-transition-duration-default) box-shadow;\n cursor: inherit;\n font-size: 14px;\n font-weight: 500;\n border-radius: var(--nile-radius-base-standard);\n padding: 10px 14px;\n gap: 5px;\n line-height: 20px;\n box-sizing: border-box;\n height: 40px;\n }\n\n .button::-moz-focus-inner {\n border: 0;\n }\n\n .button:focus {\n outline: none;\n }\n\n .button:focus-visible {\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: 2px;\n }\n\n .button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .button--disabled * {\n pointer-events: none;\n }\n\n /* Primary */\n .button--standard.button--primary {\n background-color: var(--nile-colors-primary-600);\n border-color: var(--nile-colors-primary-600);\n color: var(--nile-colors-white-base);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--primary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-primary-700);\n border-color: var(--nile-colors-primary-700);\n color: var(--nile-colors-white-base);\n }\n\n .button--standard.button--primary:active:not(.button--disabled) {\n background-color: var(--nile-colors-primary-700);\n border-color: var(--nile-colors-primary-900);\n color: var(--nile-colors-white-base);\n box-shadow: 0px 1px 2px 0px rgba(0, 82, 145, 0.1),\n 0px 0px 0px 4px rgba(0, 94, 166, 0.15);\n }\n\n .button--standard.button--primary.button--disabled {\n background-color: var(--nile-colors-neutral-700);\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-neutral-500);\n cursor: not-allowed;\n }\n\n .button--standard.button--primary.button--disabled:hover,\n .button--standard.button--primary.button--disabled:active {\n background-color: var(--nile-colors-neutral-700);\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-neutral-500);\n cursor: not-allowed;\n }\n\n /* Secondary */\n .button--standard.button--secondary {\n background-color: var(--nile-colors-neutral-400);\n border-color: var(--nile-colors-neutral-400);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--secondary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-neutral-500);\n border-color: var(--nile-colors-neutral-400);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--secondary:active:not(.button--disabled) {\n background-color: var(--nile-colors-neutral-500);\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--secondary.button--disabled {\n background-color: var(--nile-colors-neutral-400);\n border-color: var(--nile-colors-neutral-400);\n color: var(--nile-colors-dark-500);\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary.button--disabled:hover,\n .button--standard.button--secondary.button--disabled:active {\n background-color: var(--nile-colors-neutral-400);\n border-color: var(--nile-colors-neutral-400);\n color: var(--nile-colors-dark-500);\n cursor: not-allowed;\n }\n\n /* Tertiary */\n .button--standard.button--tertiary {\n background-color: var(--nile-colors-white-base);\n border-color: var(--nile-colors-neutral-500);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--tertiary:hover:not(.button--disabled) {\n background-color: var(--nile-colors-dark-200);\n border-color: var(--nile-colors-neutral-500);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--tertiary:active:not(.button--disabled) {\n background-color: var(--nile-colors-neutral-400);\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--tertiary.button--disabled,\n .button--standard.button--tertiary.button--disabled:hover,\n .button--standard.button--tertiary.button--disabled:active {\n border-color: var(--nile-colors-neutral-500);\n background-color: var(--nile-colors-white-base);\n color: var(--nile-colors-neutral-500);\n cursor: not-allowed;\n box-shadow: none;\n }\n\n /* ghost */\n .button--standard.button--ghost {\n background-color: var(--nile-colors-white-base);\n border-color: transparent;\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--ghost:hover:not(.button--disabled) {\n background-color: var(--nile-colors-dark-200);\n border-color: transparent;\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--ghost:active:not(.button--disabled) {\n background-color: var(--nile-colors-neutral-400);\n border-color: transparent;\n color: var(--nile-colors-dark-900);\n }\n\n .button--standard.button--ghost.button--disabled,\n .button--standard.button--ghost.button--disabled:hover,\n .button--standard.button--ghost.button--disabled:active {\n border-color: transparent;\n background-color: var(--nile-colors-white-base);\n color: var(--nile-colors-neutral-500);\n cursor: not-allowed;\n box-shadow: none;\n }\n\n /* caution */\n .button--standard.button--caution {\n background-color: var(--nile-colors-red-500);\n border-color: var(--nile-colors-red-500);\n color: var(--nile-colors-white-base);\n }\n\n .button--standard.button--caution:hover:not(.button--disabled) {\n background-color: var(--nile-colors-red-700);\n border-color: var(--nile-colors-red-700);\n color: var(--nile-colors-white-base);\n }\n\n .button--standard.button--caution:active:not(.button--disabled) {\n background-color: var(--nile-colors-red-700);\n border-color: #820B0B;\n color: var(--nile-colors-white-base);\n }\n\n .button--standard.button--caution.button--disabled,\n .button--standard.button--caution.button--disabled:hover,\n .button--standard.button--caution.button--disabled:active {\n background-color: var(--nile-colors-neutral-500);\n border-color: var(--nile-colors-neutral-500);\n color: var(--nile-colors-neutral-400);\n }\n\n /* destructive */\n .button--standard.button--destructive {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--destructive:hover:not(.button--disabled) {\n background-color: #b42318;\n border-color: #b42318;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--destructive:active:not(.button--disabled) {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n .button--standard.button--destructive:focus-visible:not(.button--disabled) {\n background-color: #d92d20;\n border-color: #d92d20;\n color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n .button--standard.button--destructive.button--disabled {\n background-color: #f2f4f7;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--destructive.button--disabled:hover,\n .button--standard.button--destructive.button--disabled:active {\n background-color: #f2f4f7;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* secondary-Grey */\n .button--standard.button--secondary-grey {\n background-color: #fff;\n border-color: #d0d5dd;\n color: #344054;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-grey:hover:not(.button--disabled) {\n background-color: #f9fafb;\n border-color: #d0d5dd;\n color: #182230;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-grey:active:not(.button--disabled) {\n background-color: #fff;\n border-color: #d0d5dd;\n color: #344054;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(152, 162, 179, 0.14);\n }\n\n .button--standard.button--secondary-grey.button--disabled {\n background-color: #eaecf0;\n border-color: var(--nile-colors-neutral-700);\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary-grey.button--disabled:hover,\n .button--standard.button--secondary-grey.button--disabled:active {\n background-color: #eaecf0;\n border-color: var(--nile-colors-neutral-700);\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* secondary-blue */\n .button--standard.button--secondary-blue {\n background-color: #fff;\n border-color: #85aad1;\n color: #005291;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-blue:hover:not(.button--disabled) {\n background-color: #eaf0f8;\n border-color: #85aad1;\n color: #004678;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n\n .button--standard.button--secondary-blue:active:not(.button--disabled) {\n background-color: #fff;\n border-color: #85aad1;\n color: #005291;\n box-shadow: 0px 1px 2px 0px rgba(0, 82, 145, 0.1),\n 0px 0px 0px 4px rgba(0, 94, 166, 0.15);\n }\n\n .button--standard.button--secondary-blue.button--disabled {\n background-color: #fff;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n .button--standard.button--secondary-blue.button--disabled:hover,\n .button--standard.button--secondary-blue.button--disabled:active {\n background-color: #fff;\n border-color: #eaecf0;\n color: #98a2b3;\n cursor: not-allowed;\n }\n\n /* Primary Variant - Nile Icon Fill */\n .button--standard.button--primary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-white-base) !important;\n }\n .button--standard.button--primary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--primary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-white-base) !important;\n }\n .button--standard.button--primary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-neutral-500) !important;\n }\n\n /* Secondary Variant */\n .button--standard.button--secondary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--secondary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--secondary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--secondary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-500) !important;\n }\n\n /* Tertiary Variant */\n .button--standard.button--tertiary ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--tertiary:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--tertiary:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--tertiary.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-neutral-500) !important;\n }\n\n /* Ghost Variant */\n .button--standard.button--ghost ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--ghost:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--ghost:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-dark-900) !important;\n }\n .button--standard.button--ghost ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-neutral-500) !important;\n }\n\n /* Caution Variant */\n .button--standard.button--caution ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-white-base) !important;\n }\n .button--standard.button--caution:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--caution:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-white-base) !important;\n }\n .button--standard.button--caution.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: var(--nile-colors-neutral-400) !important;\n }\n\n /* destructive */\n .button--standard.button--destructive ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n .button--standard.button--destructive:hover:not(.button--disabled)\n ::slotted(nile-icon:not([color])),\n .button--standard.button--caution:active:not(.button--disabled)\n ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n .button--standard.button--destructive.button--disabled ::slotted(nile-icon:not([color])) {\n --nile-svg-fill: #fff !important;\n }\n\n /*\n * Outline buttons\n */\n\n .button--outline {\n background: none;\n border: solid 2px;\n }\n\n /* Default */\n .button--outline.button--secondary {\n border-color: var(--nile-colors-neutral-300);\n color: var(--nile-colors-neutral-700);\n }\n\n .button--outline.button--secondary:hover:not(.button--disabled),\n .button--outline.button--secondary.button--checked:not(.button--disabled) {\n border-color: var(--nile-colors-primary-600);\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--secondary:active:not(.button--disabled) {\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Primary */\n .button--outline.button--primary {\n border-color: var(--nile-colors-primary-600);\n color: var(--nile-colors-primary-600);\n }\n\n .button--outline.button--primary:hover:not(.button--disabled),\n .button--outline.button--primary.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--primary:active:not(.button--disabled) {\n border-color: var(--nile-colors-primary-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Success */\n .button--outline.button--success {\n border-color: var(--nile-colors-green-600);\n color: var(--nile-colors-green-600);\n }\n\n .button--outline.button--success:hover:not(.button--disabled),\n .button--outline.button--success.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--success:active:not(.button--disabled) {\n border-color: var(--nile-colors-green-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Neutral */\n .button--outline.button--neutral {\n border-color: var(--nile-colors-neutral-600);\n color: var(--nile-colors-neutral-600);\n }\n\n .button--outline.button--neutral:hover:not(.button--disabled),\n .button--outline.button--neutral.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--neutral:active:not(.button--disabled) {\n border-color: var(--nile-colors-neutral-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Warning */\n .button--outline.button--warning {\n border-color: var(--nile-colors-orange-600);\n color: var(--nile-colors-orange-600);\n }\n\n .button--outline.button--warning:hover:not(.button--disabled),\n .button--outline.button--warning.button--checked:not(.button--disabled) {\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--warning:active:not(.button--disabled) {\n border-color: var(--nile-colors-orange-700);\n color: var(--nile-colors-white-base);\n }\n\n /* Danger */\n .button--outline.button--danger {\n border-color: var(--nile-colors-red-600);\n color: var(--nile-colors-red-600);\n }\n\n .button--outline.button--danger:hover:not(.button--disabled),\n .button--outline.button--danger.button--checked:not(.button--disabled) {\n background-color: var(--nile-colors-red-600);\n color: var(--nile-colors-white-base);\n }\n\n .button--outline.button--danger:active:not(.button--disabled) {\n border-color: var(--nile-colors-red-700);\n background-color: var(--nile-colors-red-700);\n color: var(--nile-colors-white-base);\n }\n\n /* destructive */\n .button--outline.button--destructive {\n border-color: #fda29b;\n color: #b42318;\n box-shadow: 0px;\n }\n\n .button--outline.button--destructive:hover:not(.button--disabled),\n .button--outline.button--destructive.button--checked:not(.button--disabled) {\n border-color: #fda29b;\n color: #912018;\n background-color: #fef3f2;\n }\n\n .button--outline.button--destructive:active:not(.button--disabled) {\n border-color: #fda29b;\n color: #b42318;\n background-color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n /* destructive - focus-visible */\n .button--outline.button--destructive:focus-visible:not(.button--disabled) {\n border-color: #fda29b;\n color: #b42318;\n background-color: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05),\n 0px 0px 0px 4px rgba(240, 68, 56, 0.24);\n }\n\n /* secondary-grey */\n .button--outline.button--secondary-grey {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-grey:hover:not(.button--disabled),\n .button--outline.button--secondary-grey.button--checked:not(\n .button--disabled\n ) {\n color: #344054;\n background-color: #f9fafb;\n }\n\n .button--outline.button--secondary-grey:active:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-grey:focus-visible:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n /* secondary-blue */\n .button--outline.button--secondary-blue {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-blue:hover:not(.button--disabled),\n .button--outline.button--secondary-blue.button--checked:not(\n .button--disabled\n ) {\n color: #004678;\n background-color: #eaf0f8;\n }\n\n .button--outline.button--secondary-blue:active:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n .button--outline.button--secondary-blue:focus-visible:not(.button--disabled) {\n box-shadow: 0px;\n }\n\n @media (forced-colors: active) {\n .button.button--outline.button--checked:not(.button--disabled) {\n outline: solid 2px transparent;\n }\n }\n\n /*\n * Pill modifier\n */\n\n .button--pill.button--small {\n border-radius: 24px;\n }\n\n .button--pill.button--medium {\n border-radius: 32px;\n }\n\n /*\n * Circle modifier\n */\n\n .button--circle {\n padding-left: 0;\n padding-right: 0;\n }\n\n .button--circle.button--small {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n }\n\n .button--circle.button--medium {\n width: 38px;\n height: 38px;\n border-radius: 50%;\n }\n\n .button--circle .button__prefix,\n .button--circle .button__suffix,\n .button--circle .button__caret {\n display: none;\n }\n\n /* Caret modifier */\n\n .button--caret .button__suffix {\n display: none;\n }\n\n .button--caret .button__caret {\n height: auto;\n }\n\n /*\n * Loading modifier\n */\n\n .button--loading {\n position: relative;\n cursor: wait;\n }\n\n .button--loading .button__prefix,\n .button--loading .button__label,\n .button--loading .button__suffix,\n .button--loading .button__caret {\n visibility: hidden;\n }\n\n .button--loading nile-spinner {\n --indicator-color: currentColor;\n position: absolute;\n font-size: 1em;\n height: 1em;\n width: 1em;\n top: calc(50% - 0.5em);\n left: calc(50% - 0.5em);\n }\n /*\n * Badges\n */\n\n .button ::slotted(nile-badge) {\n position: absolute;\n top: 0;\n right: 0;\n translate: 50% -50%;\n pointer-events: none;\n }\n\n /* outline with no border */\n .button--outline.button--hideborder {\n border: 0px;\n }\n`;\n"]}
|
@@ -167,7 +167,7 @@ let NileCheckbox = class NileCheckbox extends NileElement {
|
|
167
167
|
@blur=${this.handleBlur}
|
168
168
|
@focus=${this.handleFocus}
|
169
169
|
/>
|
170
|
-
|
170
|
+
|
171
171
|
<span
|
172
172
|
part="control${this.checked ? ' control--checked' : ''}${this
|
173
173
|
.indeterminate
|
@@ -200,24 +200,17 @@ let NileCheckbox = class NileCheckbox extends NileElement {
|
|
200
200
|
`
|
201
201
|
: ''}
|
202
202
|
</span>
|
203
|
-
|
203
|
+
|
204
204
|
<div part="label" class="checkbox__label">
|
205
205
|
${typeof this.label === 'boolean' ? '' : this.label}
|
206
206
|
<slot></slot>
|
207
207
|
</div>
|
208
208
|
</label>
|
209
|
-
|
209
|
+
|
210
210
|
${hasHelpText
|
211
|
-
? html `
|
212
|
-
<nile-tooltip content="${this.helpText}" placement="bottom">
|
213
|
-
<nile-icon
|
214
|
-
name="question"
|
215
|
-
class="checkbox__helptext-icon"
|
216
|
-
></nile-icon>
|
217
|
-
</nile-tooltip>
|
218
|
-
`
|
211
|
+
? html ` <nile-form-help-text>${this.helpText}</nile-form-help-text> `
|
219
212
|
: ``}
|
220
|
-
|
213
|
+
|
221
214
|
${hasErrorMessage
|
222
215
|
? html `
|
223
216
|
<nile-form-error-message
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-checkbox.js","sourceRoot":"","sources":["../../../src/nile-checkbox/nile-checkbox.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EA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AX,QAAQ,EAAE;2CAAgB;AAGE;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA+C;AAG/B;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAkB;AAGjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAiB;AAGjB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAY;AAMV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAAuB;AAGzC;IAAxB,YAAY,CAAC,SAAS,CAAC;oDAAwB;AAEK;IAApD,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAe;AAEV;IAAxD,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAmB;AAE9C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAsB;AAQrB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAW;AAGK;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAkB;AA4B7D;IADC,KAAK,CAAC,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;qDAInE;AAtFU,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAgOxB;;AAED,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n \nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './nile-checkbox.css';\n \nimport { classMap } from 'lit/directives/class-map.js';\nimport { query, state } from 'lit/decorators.js';\nimport { defaultValue } from '../internal/default-value';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n \n/**\n * @summary Checkboxes allow the user to toggle an option on or off.\n *\n * @dependency nile-icon\n *\n * @slot - The checkbox's label.\n *\n * @event nile-blur - Emitted when the checkbox loses focus.\n * @event nile-change - Emitted when the checked state changes.\n * @event nile-focus - Emitted when the checkbox gains focus.\n * @event nile-input - Emitted when the checkbox receives input.\n * @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @csspart base - The component's base wrapper.\n * @csspart control - The square container that wraps the checkbox's checked state.\n * @csspart control--checked - Matches the control part when the checkbox is checked.\n * @csspart control--indeterminate - Matches the control part when the checkbox is indeterminate.\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart indeterminate-icon - The indeterminate icon, an `<nile-icon>` element.\n * @csspart label - The container that wraps the checkbox's label.\n */\n \n/**\n * Nile icon component.\n *\n * @tag nile-checkbox\n *\n */\n@customElement('nile-checkbox')\nexport class NileCheckbox extends NileElement {\n constructor() {\n super();\n }\n \n static styles: CSSResultGroup = styles;\n \n @query('input[type=\"checkbox\"]') input: HTMLInputElement;\n \n @state() private hasFocus = false;\n \n @property() title = ''; // make reactive to pass through\n \n /** The name of the checkbox, submitted as a name/value pair with form data. */\n @property() name = '';\n \n /** The current value of the checkbox, submitted as a name/value pair with form data. */\n @property() value: boolean;\n \n /** The checkbox's size. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n \n /** Disables the checkbox. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n \n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true }) checked = false;\n \n /** Label, declared this property for backward compatibility of old component */\n @property({ type: String, reflect: true }) label = '';\n \n /**\n * Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\n * all/none\" behavior when associated checkboxes have a mix of checked and unchecked states.\n */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n \n /** The default value of the form control. Primarily used for resetting the form control. */\n @defaultValue('checked') defaultChecked = false;\n \n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n \n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n \n @property({ type: Boolean }) showHelpText = false;\n \n \n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n \n /** Makes the checkbox a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n \n private toggleHelpText() {\n this.showHelpText = !this.showHelpText;\n }\n \n private handleClick() {\n this.checked = !this.checked;\n this.indeterminate = false;\n this.emit('nile-change',{checked: this.checked})\n this.emit('valueChange',{checked: this.checked})\n }\n \n private handleBlur() {\n this.hasFocus = false;\n this.emit('blur');\n }\n \n private handleInput() {\n this.emit('input');\n }\n \n private handleFocus() {\n this.hasFocus = true;\n this.emit('focus');\n }\n \n @watch(['checked', 'indeterminate'], { waitUntilFirstUpdate: true })\n handleStateChange() {\n this.input.checked = this.checked; // force a sync update\n this.input.indeterminate = this.indeterminate; // force a sync update\n }\n \n /** Simulates a click on the checkbox. */\n click() {\n this.input.click();\n }\n \n /** Sets focus on the checkbox. */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n \n /** Removes focus from the checkbox. */\n blur() {\n this.input.blur();\n }\n \n connectedCallback() {\n super.connectedCallback();\n this.updateHostClass();\n this.emit('nile-init');\n }\n \n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n \n updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated(changedProperties);\n if (changedProperties.has('helpText')) {\n this.updateHostClass();\n }\n }\n \n private updateHostClass() {\n if (this.helpText) {\n this.classList.add('full-width');\n } else {\n this.classList.remove('full-width');\n }\n }\n \n render() {\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n \n return html`\n <label\n part=\"base\"\n class=${classMap({\n checkbox: true,\n 'checkbox--checked': this.checked,\n 'checkbox--disabled': this.disabled,\n 'checkbox--focused': this.hasFocus,\n 'checkbox--indeterminate': this.indeterminate,\n 'checkbox--medium': this.size === 'medium',\n })}\n >\n <input\n class=\"checkbox__input\"\n type=\"checkbox\"\n title=${\n this\n .title /* An empty title prevents browser validation tooltips from appearing on hover */\n }\n name=${this.name}\n value=${ifDefined(this.value)}\n .indeterminate=${live(this.indeterminate)}\n .checked=${live(this.checked)}\n .disabled=${this.disabled}\n .required=${this.required}\n aria-checked=${this.checked ? 'true' : 'false'}\n @click=${this.handleClick}\n @input=${this.handleInput}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n />\n \n <span\n part=\"control${this.checked ? ' control--checked' : ''}${this\n .indeterminate\n ? ' control--indeterminate'\n : ''}\"\n class=\"checkbox__control\"\n >\n ${this.checked\n ? html`\n <nile-icon\n part=\"checked-icon\"\n class=\"checkbox__checked-icon\"\n color=\"white\"\n library=\"system\"\n name=\"tick\"\n size=\"12\"\n ></nile-icon>\n `\n : ''}\n ${!this.checked && this.indeterminate\n ? html`\n <nile-icon\n part=\"indeterminate-icon\"\n class=\"checkbox__indeterminate-icon\"\n library=\"system\"\n color=\"white\"\n name=\"minus\"\n size=\"12\"\n ></nile-icon>\n `\n : ''}\n </span>\n \n <div part=\"label\" class=\"checkbox__label\">\n ${typeof this.label === 'boolean' ? '' : this.label}\n <slot></slot>\n </div>\n </label>\n \n ${hasHelpText\n ? html`\n <nile-tooltip content=\"${this.helpText}\" placement=\"bottom\">\n <nile-icon\n name=\"question\"\n class=\"checkbox__helptext-icon\"\n ></nile-icon>\n </nile-tooltip>\n `\n : ``}\n \n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n `;\n }\n}\n \nexport default NileCheckbox;\n \ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-checkbox': NileCheckbox;\n }\n}"]}
|
1
|
+
{"version":3,"file":"nile-checkbox.js","sourceRoot":"","sources":["../../../src/nile-checkbox/nile-checkbox.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAGL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;GAKG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAW;IAC3C;QACE,KAAK,EAAE,CAAC;QAOO,aAAQ,GAAG,KAAK,CAAC;QAEtB,UAAK,GAAG,EAAE,CAAC,CAAC,gCAAgC;QAExD,+EAA+E;QACnE,SAAI,GAAG,EAAE,CAAC;QAKtB,2BAA2B;QACE,SAAI,GAAiC,QAAQ,CAAC;QAE3E,6BAA6B;QACe,aAAQ,GAAG,KAAK,CAAC;QAE7D,6CAA6C;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Q,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAkB;AA4B7D;IADC,KAAK,CAAC,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;qDAInE;AAtFU,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAyNxB;;AAED,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n \nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './nile-checkbox.css';\n \nimport { classMap } from 'lit/directives/class-map.js';\nimport { query, state } from 'lit/decorators.js';\nimport { defaultValue } from '../internal/default-value';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n \n/**\n * @summary Checkboxes allow the user to toggle an option on or off.\n *\n * @dependency nile-icon\n *\n * @slot - The checkbox's label.\n *\n * @event nile-blur - Emitted when the checkbox loses focus.\n * @event nile-change - Emitted when the checked state changes.\n * @event nile-focus - Emitted when the checkbox gains focus.\n * @event nile-input - Emitted when the checkbox receives input.\n * @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @csspart base - The component's base wrapper.\n * @csspart control - The square container that wraps the checkbox's checked state.\n * @csspart control--checked - Matches the control part when the checkbox is checked.\n * @csspart control--indeterminate - Matches the control part when the checkbox is indeterminate.\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart indeterminate-icon - The indeterminate icon, an `<nile-icon>` element.\n * @csspart label - The container that wraps the checkbox's label.\n */\n \n/**\n * Nile icon component.\n *\n * @tag nile-checkbox\n *\n */\n@customElement('nile-checkbox')\nexport class NileCheckbox extends NileElement {\n constructor() {\n super();\n }\n \n static styles: CSSResultGroup = styles;\n \n @query('input[type=\"checkbox\"]') input: HTMLInputElement;\n \n @state() private hasFocus = false;\n \n @property() title = ''; // make reactive to pass through\n \n /** The name of the checkbox, submitted as a name/value pair with form data. */\n @property() name = '';\n \n /** The current value of the checkbox, submitted as a name/value pair with form data. */\n @property() value: boolean;\n \n /** The checkbox's size. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n \n /** Disables the checkbox. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n \n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true }) checked = false;\n \n /** Label, declared this property for backward compatibility of old component */\n @property({ type: String, reflect: true }) label = '';\n \n /**\n * Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\n * all/none\" behavior when associated checkboxes have a mix of checked and unchecked states.\n */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n \n /** The default value of the form control. Primarily used for resetting the form control. */\n @defaultValue('checked') defaultChecked = false;\n \n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n \n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n \n @property({ type: Boolean }) showHelpText = false;\n \n \n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n \n /** Makes the checkbox a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n \n private toggleHelpText() {\n this.showHelpText = !this.showHelpText;\n }\n \n private handleClick() {\n this.checked = !this.checked;\n this.indeterminate = false;\n this.emit('nile-change',{checked: this.checked})\n this.emit('valueChange',{checked: this.checked})\n }\n \n private handleBlur() {\n this.hasFocus = false;\n this.emit('blur');\n }\n \n private handleInput() {\n this.emit('input');\n }\n \n private handleFocus() {\n this.hasFocus = true;\n this.emit('focus');\n }\n \n @watch(['checked', 'indeterminate'], { waitUntilFirstUpdate: true })\n handleStateChange() {\n this.input.checked = this.checked; // force a sync update\n this.input.indeterminate = this.indeterminate; // force a sync update\n }\n \n /** Simulates a click on the checkbox. */\n click() {\n this.input.click();\n }\n \n /** Sets focus on the checkbox. */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n \n /** Removes focus from the checkbox. */\n blur() {\n this.input.blur();\n }\n \n connectedCallback() {\n super.connectedCallback();\n this.updateHostClass();\n this.emit('nile-init');\n }\n \n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n \n updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated(changedProperties);\n if (changedProperties.has('helpText')) {\n this.updateHostClass();\n }\n }\n \n private updateHostClass() {\n if (this.helpText) {\n this.classList.add('full-width');\n } else {\n this.classList.remove('full-width');\n }\n }\n \n render() {\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n \n return html`\n <label\n part=\"base\"\n class=${classMap({\n checkbox: true,\n 'checkbox--checked': this.checked,\n 'checkbox--disabled': this.disabled,\n 'checkbox--focused': this.hasFocus,\n 'checkbox--indeterminate': this.indeterminate,\n 'checkbox--medium': this.size === 'medium',\n })}\n >\n <input\n class=\"checkbox__input\"\n type=\"checkbox\"\n title=${\n this\n .title /* An empty title prevents browser validation tooltips from appearing on hover */\n }\n name=${this.name}\n value=${ifDefined(this.value)}\n .indeterminate=${live(this.indeterminate)}\n .checked=${live(this.checked)}\n .disabled=${this.disabled}\n .required=${this.required}\n aria-checked=${this.checked ? 'true' : 'false'}\n @click=${this.handleClick}\n @input=${this.handleInput}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n />\n\n <span\n part=\"control${this.checked ? ' control--checked' : ''}${this\n .indeterminate\n ? ' control--indeterminate'\n : ''}\"\n class=\"checkbox__control\"\n >\n ${this.checked\n ? html`\n <nile-icon\n part=\"checked-icon\"\n class=\"checkbox__checked-icon\"\n color=\"white\"\n library=\"system\"\n name=\"tick\"\n size=\"12\"\n ></nile-icon>\n `\n : ''}\n ${!this.checked && this.indeterminate\n ? html`\n <nile-icon\n part=\"indeterminate-icon\"\n class=\"checkbox__indeterminate-icon\"\n library=\"system\"\n color=\"white\"\n name=\"minus\"\n size=\"12\"\n ></nile-icon>\n `\n : ''}\n </span>\n\n <div part=\"label\" class=\"checkbox__label\">\n ${typeof this.label === 'boolean' ? '' : this.label}\n <slot></slot>\n </div>\n </label>\n\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n \n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n `;\n }\n}\n \nexport default NileCheckbox;\n \ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-checkbox': NileCheckbox;\n }\n}"]}
|
@@ -1,5 +1,8 @@
|
|
1
1
|
import { fixture, html, expect, oneEvent } from '@open-wc/testing';
|
2
2
|
import './nile-checkbox';
|
3
|
+
function wait(ms = 50000) {
|
4
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
5
|
+
}
|
3
6
|
describe('NileCheckbox', () => {
|
4
7
|
it('renders correctly with default properties', async () => {
|
5
8
|
const el = await fixture(html `<nile-checkbox></nile-checkbox>`);
|
@@ -68,8 +71,8 @@ describe('NileCheckbox', () => {
|
|
68
71
|
const el = await fixture(html `<nile-checkbox help-text="test-help"></nile-checkbox>`);
|
69
72
|
el.showHelpText = true;
|
70
73
|
await el.updateComplete;
|
71
|
-
const
|
72
|
-
expect(
|
74
|
+
const helpText = el.shadowRoot?.querySelector("nile-form-help-text")?.textContent?.trim();
|
75
|
+
expect(helpText).to.equal('test-help');
|
73
76
|
});
|
74
77
|
it('updates host class based on helpText', async () => {
|
75
78
|
const el = await fixture(html `<nile-checkbox></nile-checkbox>`);
|
@@ -133,20 +136,5 @@ describe('NileCheckbox', () => {
|
|
133
136
|
expect(checkbox).to.not.be.null;
|
134
137
|
expect(checkbox.getAttribute('form')).to.equal('test-form');
|
135
138
|
});
|
136
|
-
it('displays and hides help text correctly', async () => {
|
137
|
-
const el = await fixture(html `<nile-checkbox help-text="test-help"></nile-checkbox>`);
|
138
|
-
// Initially, help text should not be shown
|
139
|
-
expect(el.showHelpText).to.be.false;
|
140
|
-
// Show the help text
|
141
|
-
el.showHelpText = true;
|
142
|
-
await el.updateComplete;
|
143
|
-
let helpTextIcon = el.shadowRoot.querySelector('.checkbox__helptext-icon');
|
144
|
-
expect(helpTextIcon).to.exist;
|
145
|
-
// Hide the help text
|
146
|
-
el.showHelpText = false;
|
147
|
-
await el.updateComplete;
|
148
|
-
helpTextIcon = el.shadowRoot.querySelector('.checkbox__helptext-icon');
|
149
|
-
expect(helpTextIcon).to.be.exist;
|
150
|
-
});
|
151
139
|
});
|
152
140
|
//# sourceMappingURL=nile-checkbox.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-checkbox.test.js","sourceRoot":"","sources":["../../../src/nile-checkbox/nile-checkbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,iBAAiB,CAAC;AAGzB,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAe,IAAI,CAAA,iCAAiC,CAAC,CAAC;QAC9E,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAe,IAAI,CAAA,iCAAiC,CAAC,CAAC;QAC9E,MAAM,KAAK,GAAG,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,wBAAwB,C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E,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, html, expect, oneEvent } from '@open-wc/testing';\nimport './nile-checkbox';\nimport { NileCheckbox } from './nile-checkbox';\n\ndescribe('NileCheckbox', () => {\n it('renders correctly with default properties', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n expect(el).shadowDom.to.equalSnapshot();\n });\n\n it('toggles checked state on click', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n input.click();\n expect(el.checked).to.be.true;\n input.click();\n expect(el.checked).to.be.false;\n });\n\n it('emits nile-change event on click', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n setTimeout(() => input.click());\n const event = await oneEvent(el, 'valueChange');\n expect(event.detail.checked).to.be.true;\n });\n\n it('handles focus and blur events', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n // Focus the input and wait for the focus event\n setTimeout(() => input.focus());\n const focusEvent = await oneEvent(el, 'focus');\n expect(focusEvent).to.exist;\n\n // Blur the input and wait for the blur event\n setTimeout(() => input.blur());\n const blurEvent = await oneEvent(el, 'blur');\n expect(blurEvent).to.exist;\n });\n\n it('handles indeterminate state', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox indeterminate></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n expect(input.indeterminate).to.be.true;\n\n el.checked = true;\n el.indeterminate = false;\n await el.updateComplete;\n expect(input.indeterminate).to.be.false;\n expect(input.checked).to.be.true;\n });\n\n it('reflects properties to attributes', async () => {\n const el = await fixture<NileCheckbox>(html`\n <nile-checkbox\n name=\"test-name\"\n title=\"test-title\"\n disabled\n required\n label=\"test-label\"\n sub-label=\"test-sublabel\"\n help-text=\"test-help\"\n error-message=\"test-error\"\n ></nile-checkbox>\n `);\n\n expect(el.getAttribute('name')).to.equal('test-name');\n expect(el.getAttribute('title')).to.equal('test-title');\n expect(el.getAttribute('disabled')).to.equal('');\n expect(el.getAttribute('required')).to.equal('');\n expect(el.getAttribute('label')).to.equal('test-label');\n expect(el.getAttribute('sub-label')).to.equal('test-sublabel');\n expect(el.getAttribute('help-text')).to.equal('test-help');\n expect(el.getAttribute('error-message')).to.equal('test-error');\n });\n\n it('displays help text when showHelpText is true', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox help-text=\"test-help\"></nile-checkbox>`);\n el.showHelpText = true;\n await el.updateComplete;\n\n const helpTextIcon = el.shadowRoot!.querySelector('.checkbox__helptext-icon');\n expect(helpTextIcon).to.exist;\n });\n\n it('updates host class based on helpText', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n el.helpText = 'test-help';\n await el.updateComplete;\n\n expect(el.classList.contains('full-width')).to.be.true;\n\n el.helpText = '';\n await el.updateComplete;\n\n expect(el.classList.contains('full-width')).to.be.false;\n });\n\n it('emits custom events on connected and disconnected', async () => {\n const el = document.createElement('nile-checkbox');\n\n // Wait for the connected event\n const initEventPromise = oneEvent(el, 'nile-init');\n document.body.appendChild(el);\n const initEvent = await initEventPromise;\n expect(initEvent).to.exist;\n\n // Wait for the disconnected event\n const destroyEventPromise = oneEvent(el, 'nile-destroy');\n document.body.removeChild(el);\n const destroyEvent = await destroyEventPromise;\n expect(destroyEvent).to.exist;\n });\n\n it('handles required attribute', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox required></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n expect(input.required).to.be.true;\n });\n\n it('simulates click using click method', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n el.click();\n expect(el.checked).to.be.true;\n });\n\n it('sets and removes focus using focus and blur methods', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n\n // Call the focus method and wait for the focus event\n setTimeout(() => el.focus());\n const focusEvent = await oneEvent(el, 'focus');\n expect(focusEvent).to.exist;\n\n // Call the blur method and wait for the blur event\n setTimeout(() => el.blur());\n const blurEvent = await oneEvent(el, 'blur');\n expect(blurEvent).to.exist;\n });\n\n it('reflects checked attribute to property', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox checked></nile-checkbox>`);\n expect(el.checked).to.be.true;\n });\n\n it('reflects indeterminate attribute to property', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox indeterminate></nile-checkbox>`);\n expect(el.indeterminate).to.be.true;\n });\n\n it('associates form using form attribute', async () => {\n const el = await fixture(html`\n <div>\n <form id=\"test-form\"></form>\n <nile-checkbox form=\"test-form\"></nile-checkbox>\n </div>\n `);\n const checkbox = el.querySelector('nile-checkbox') as NileCheckbox;\n expect(checkbox).to.not.be.null;\n expect(checkbox.getAttribute('form')).to.equal('test-form');\n });\n\n it('displays and hides help text correctly', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox help-text=\"test-help\"></nile-checkbox>`);\n\n // Initially, help text should not be shown\n expect(el.showHelpText).to.be.false;\n\n // Show the help text\n el.showHelpText = true;\n await el.updateComplete;\n let helpTextIcon = el.shadowRoot!.querySelector('.checkbox__helptext-icon');\n expect(helpTextIcon).to.exist;\n\n // Hide the help text\n el.showHelpText = false;\n await el.updateComplete;\n helpTextIcon = el.shadowRoot!.querySelector('.checkbox__helptext-icon');\n expect(helpTextIcon).to.be.exist;\n });\n});\n\n"]}
|
1
|
+
{"version":3,"file":"nile-checkbox.test.js","sourceRoot":"","sources":["../../../src/nile-checkbox/nile-checkbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,O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CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, html, expect, oneEvent } from '@open-wc/testing';\nimport './nile-checkbox';\nimport { NileCheckbox } from './nile-checkbox';\n\nfunction wait(ms:number=50000) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\ndescribe('NileCheckbox', () => {\n it('renders correctly with default properties', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n expect(el).shadowDom.to.equalSnapshot();\n });\n\n it('toggles checked state on click', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n input.click();\n expect(el.checked).to.be.true;\n input.click();\n expect(el.checked).to.be.false;\n });\n\n it('emits nile-change event on click', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n setTimeout(() => input.click());\n const event = await oneEvent(el, 'valueChange');\n expect(event.detail.checked).to.be.true;\n });\n\n it('handles focus and blur events', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n // Focus the input and wait for the focus event\n setTimeout(() => input.focus());\n const focusEvent = await oneEvent(el, 'focus');\n expect(focusEvent).to.exist;\n\n // Blur the input and wait for the blur event\n setTimeout(() => input.blur());\n const blurEvent = await oneEvent(el, 'blur');\n expect(blurEvent).to.exist;\n });\n\n it('handles indeterminate state', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox indeterminate></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n expect(input.indeterminate).to.be.true;\n\n el.checked = true;\n el.indeterminate = false;\n await el.updateComplete;\n expect(input.indeterminate).to.be.false;\n expect(input.checked).to.be.true;\n });\n\n it('reflects properties to attributes', async () => {\n const el = await fixture<NileCheckbox>(html`\n <nile-checkbox\n name=\"test-name\"\n title=\"test-title\"\n disabled\n required\n label=\"test-label\"\n sub-label=\"test-sublabel\"\n help-text=\"test-help\"\n error-message=\"test-error\"\n ></nile-checkbox>\n `);\n\n expect(el.getAttribute('name')).to.equal('test-name');\n expect(el.getAttribute('title')).to.equal('test-title');\n expect(el.getAttribute('disabled')).to.equal('');\n expect(el.getAttribute('required')).to.equal('');\n expect(el.getAttribute('label')).to.equal('test-label');\n expect(el.getAttribute('sub-label')).to.equal('test-sublabel');\n expect(el.getAttribute('help-text')).to.equal('test-help');\n expect(el.getAttribute('error-message')).to.equal('test-error');\n });\n\n it('displays help text when showHelpText is true', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox help-text=\"test-help\"></nile-checkbox>`);\n el.showHelpText = true;\n await el.updateComplete;\n const helpText=el.shadowRoot?.querySelector(\"nile-form-help-text\")?.textContent?.trim()\n expect(helpText).to.equal('test-help')\n });\n\n it('updates host class based on helpText', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n el.helpText = 'test-help';\n await el.updateComplete;\n\n expect(el.classList.contains('full-width')).to.be.true;\n\n el.helpText = '';\n await el.updateComplete;\n\n expect(el.classList.contains('full-width')).to.be.false;\n });\n\n it('emits custom events on connected and disconnected', async () => {\n const el = document.createElement('nile-checkbox');\n\n // Wait for the connected event\n const initEventPromise = oneEvent(el, 'nile-init');\n document.body.appendChild(el);\n const initEvent = await initEventPromise;\n expect(initEvent).to.exist;\n\n // Wait for the disconnected event\n const destroyEventPromise = oneEvent(el, 'nile-destroy');\n document.body.removeChild(el);\n const destroyEvent = await destroyEventPromise;\n expect(destroyEvent).to.exist;\n });\n\n it('handles required attribute', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox required></nile-checkbox>`);\n const input = el.shadowRoot!.querySelector('input[type=\"checkbox\"]')! as HTMLInputElement;\n\n expect(input.required).to.be.true;\n });\n\n it('simulates click using click method', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n el.click();\n expect(el.checked).to.be.true;\n });\n\n it('sets and removes focus using focus and blur methods', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox></nile-checkbox>`);\n\n // Call the focus method and wait for the focus event\n setTimeout(() => el.focus());\n const focusEvent = await oneEvent(el, 'focus');\n expect(focusEvent).to.exist;\n\n // Call the blur method and wait for the blur event\n setTimeout(() => el.blur());\n const blurEvent = await oneEvent(el, 'blur');\n expect(blurEvent).to.exist;\n });\n\n it('reflects checked attribute to property', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox checked></nile-checkbox>`);\n expect(el.checked).to.be.true;\n });\n\n it('reflects indeterminate attribute to property', async () => {\n const el = await fixture<NileCheckbox>(html`<nile-checkbox indeterminate></nile-checkbox>`);\n expect(el.indeterminate).to.be.true;\n });\n\n it('associates form using form attribute', async () => {\n const el = await fixture(html`\n <div>\n <form id=\"test-form\"></form>\n <nile-checkbox form=\"test-form\"></nile-checkbox>\n </div>\n `);\n const checkbox = el.querySelector('nile-checkbox') as NileCheckbox;\n expect(checkbox).to.not.be.null;\n expect(checkbox.getAttribute('form')).to.equal('test-form');\n });\n\n});\n\n"]}
|
@@ -20,7 +20,7 @@ export const styles = css `
|
|
20
20
|
width: max-content;
|
21
21
|
box-shadow: 0px 2px 4px 0px rgba(119, 125, 130, 0.15);
|
22
22
|
border-radius: var(--nile-radius-base-standard);
|
23
|
-
border: 1px solid var(--nile-colors-
|
23
|
+
border: 1px solid var(--nile-colors-neutral-400);
|
24
24
|
background: var(--nile-colors-white-base);
|
25
25
|
font-family: var(--nile-font-family-serif);
|
26
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-form-group.css.js","sourceRoot":"","sources":["../../../src/nile-form-group/nile-form-group.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwExB,CAAC;AACF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * FormGroup CSS\n */\nexport const styles = css`\n :host {\n --min-width: 288px;\n }\n\n .form__base {\n display: flex;\n flex-direction: column;\n min-width: var(--min-width);\n width: max-content;\n box-shadow: 0px 2px 4px 0px rgba(119, 125, 130, 0.15);\n border-radius: var(--nile-radius-base-standard);\n border: 1px solid var(--nile-colors-
|
1
|
+
{"version":3,"file":"nile-form-group.css.js","sourceRoot":"","sources":["../../../src/nile-form-group/nile-form-group.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwExB,CAAC;AACF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * FormGroup CSS\n */\nexport const styles = css`\n :host {\n --min-width: 288px;\n }\n\n .form__base {\n display: flex;\n flex-direction: column;\n min-width: var(--min-width);\n width: max-content;\n box-shadow: 0px 2px 4px 0px rgba(119, 125, 130, 0.15);\n border-radius: var(--nile-radius-base-standard);\n border: 1px solid var(--nile-colors-neutral-400);\n background: var(--nile-colors-white-base);\n font-family: var(--nile-font-family-serif);\n }\n\n .form__header {\n width: 100%;\n height: 82px;\n box-sizing: border-box;\n padding: var(--nile-spacing-3-x);\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--nile-spacing-1-x);\n border-radius: var(--nile-radius-base-standard)\n var(--nile-radius-base-standard) 0 0;\n background: var(--nile-colors-neutral-100);\n }\n\n .form__title-content {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--nile-spacing-1-x);\n justify-content:centre;\n }\n\n\n\n .form__title {\n display: block;\n color: var(--nile-colors-dark-900);\n font-feature-settings: 'clig' off, 'liga' off;\n font-size: var(--nile-type-scale-4);\n font-style: normal;\n font-weight: 500;\n line-height: var(--nile-type-scale-4);\n letter-spacing: 0.2px;\n }\n\n .form__subtitle {\n display: block;\n color: var(--nile-colors-dark-500);\n font-feature-settings: 'clig' off, 'liga' off;\n font-size: var(--nile-type-scale-2);\n font-style: normal;\n font-weight: var(--nile-font-weight-regular);\n line-height: var(--nile-type-scale-2);\n letter-spacing: 0.2px;\n }\n\n .form__body {\n width: 100%;\n box-sizing: border-box;\n padding: var(--nile-spacing-3-x);\n display: flex;\n flex-direction: column;\n gap: var(--nile-spacing-3-x);\n }\n`;\nexport default [styles];\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-stepper-item.css.js","sourceRoot":"","sources":["../../../src/nile-stepper-item/nile-stepper-item.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-stepper-item.css.js","sourceRoot":"","sources":["../../../src/nile-stepper-item/nile-stepper-item.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIxB,CAAC;AACF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport { css } from 'lit';\n\n/**\n * StepperItem CSS\n */\nexport const styles = css`\n\t:host {\n\t\t--stepper-flex-val:1;\n\t\t--bulletin--dot--seperation:30%;\n\t\t\n\t\tdisplay:inline-block;\n\t\tflex-grow:var(--stepper-flex-val);\n\t\tmin-width:var(--nile-stepper-min-width);\n\t}\n\t\n\t.stepper__item {\n\t\tmargin: 0 -1px;\n\t}\n\n\t.stepper__item--sm {\n\t\t--item-spacing: var(--nile-spacing-spacing-lg,12px);\n\t\t--stepper-item-title-size:14px;\n\t\t--stepper-item-subtitle-size:14px;\n\t\t--stepper-item-text-line-height:20px;\n\t\t--circle-height:16px;\n\t}\n\n\t.stepper__item--md {\n\t\t--item-spacing: var(--nile-spacing-spacing-xl, 16px);\n\t\t--stepper-item-title-size:16px;\n\t\t--stepper-item-subtitle-size:16px;\n\t\t--stepper-item-text-line-heightt:24px;\n\t\t--circle-height:20px;\n\t}\n\n\t.stepper__item--lg {\n\t\t--item-spacing: var(--nile-spacing-spacing-xl, 16px);\n\t\t--stepper-item-title-size:16px;\n\t\t--stepper-item-subtitle-size:16px;\n\t\t--stepper-item-text-line-height:24px;\n\t\t--circle-height:28px;\n\t}\n\n\t.stepper__line__content {\n\t\tdisplay:flex;\n\t\twidth:100%;\n\t\talign-items:center;\n\t}\n\n\t.stepper__line__container {\n\t\tflex-grow:1;\n\t\tpadding:0 1px;\n\t}\n\n\t.stepper__line--hastitle {\n\t\tdisplay:flex;\n\t\talign-items:center;\n\t}\n\n\t.stepper__line {\n\t\tdisplay: block;\n\t\tborder: 0;\n\t\tborder-top: 2px solid var(--nile-colors-gray-light-mode-200, #eaecf0);\n\t}\n\n\t.stepper__line--active {\n\t\tborder-top: 2px solid var(--nile-colors-primary-600,#005EA6);\n\t}\n\n\t.stepper__item__content--below {\n\t\tmargin-top: var(--item-spacing);\n\t\tdisplay:flex;\n\t\tflex-direction:column;\n\t\talign-items:center;\n\t}\n\t\n\t.stepper__item__bulletin {\n\t\tdisplay:grid;\n\t\tplace-content:center;\n\t\tmargin:0 -1px;\n\t}\n\n\t.stepper__content__title {\n\t\tcolor:var(--nile-colors-gray-light-mode-700, #344054);\n\t\tfont-size: var(--stepper-item-title-size);\n\t\tline-height: var(--stepper-item-text-line-height);\n\t\tfont-family: var(--nile-font-family-medium);\n\t\tfont-weight: 600;\n\t}\n\n\t.stepper__content__title--inline{\n\t\tpadding: 0 8px;\n\t\tcolor:var(--nile-colors-gray-light-mode-500, #667085);\n\t}\n\n\t.stepper__content__title--active{\n\t\tcolor:var(--nile-colors-primary-700, #005291);\n\t}\n\n\t.stepper__content__subtitle {\n\t\tcolor:var(--nile-colors-gray-light-mode-600, #475467);\n\t\tfont-size: var(--stepper-item-subtitle-size);\n\t\tline-height: var(--stepper-item-text-line-height);\n\t\tfont-family: var(--nile-font-family-sans-serif);\n\t\tfont-weight: 400;\n\t}\n\n\t.stepper__content__subtitle--active{\n\t\tcolor:var(--nile-colors-primary-600, #005EA6);\n\t}\n\n\t.stepper__bulletin--dot {\n\t\twidth: var(--circle-height);\n\t\taspect-ratio: 1 / 1;\n\t\tborder-radius: 50%;\n\t\tbackground: radial-gradient(var(--nile-colors-gray-light-mode-300, #d0d5dd) var(--bulletin--dot--seperation), var(--nile-colors-gray-neutral-50, #f9fafb) var(--bulletin--dot--seperation));\n\t\tborder: 2px solid var(--nile-colors-gray-light-mode-200, #eaecf0);\n\t}\n\n\t.stepper__bulletin__dot--active{\n\t\tbackground: radial-gradient(#fff var(--bulletin--dot--seperation), var(--nile-colors-primary-600, #005EA6) var(--bulletin--dot--seperation));\n\t\tborder: 2px solid #85AAD18A;\n\t}\n\n\t.stepper__bulletin--icon {\n\t\tdisplay:grid;\n\t\tplace-content:center;\n\t\twidth: var(--circle-height);\n\t\tborder: 2px solid var(--nile-colors-primary-600, #005EA6);\n\t\taspect-ratio: 1 / 1;\n\t\tborder-radius: 50%;\n\t\tbackground-color:var(--nile-colors-primary-600, #005EA6);\n\t\toverflow:hidden;\n\t}\n`;\nexport default [styles];"]}
|
@@ -48,6 +48,7 @@ export declare class NileToast extends NileElement {
|
|
48
48
|
hasSlottedContent: boolean;
|
49
49
|
hasSlottedIcon: boolean;
|
50
50
|
prefixImageUrl: string;
|
51
|
+
closeIconName: string;
|
51
52
|
/** The alert's theme variant. */
|
52
53
|
variant: 'success' | 'info' | 'warning' | 'error' | 'gray' | 'black';
|
53
54
|
/**
|
@@ -58,6 +58,7 @@ let NileToast = class NileToast extends NileElement {
|
|
58
58
|
this.hasSlottedContent = false;
|
59
59
|
this.hasSlottedIcon = false;
|
60
60
|
this.prefixImageUrl = '';
|
61
|
+
this.closeIconName = 'close';
|
61
62
|
/** The alert's theme variant. */
|
62
63
|
this.variant = 'success';
|
63
64
|
/**
|
@@ -294,7 +295,7 @@ let NileToast = class NileToast extends NileElement {
|
|
294
295
|
part="close-button"
|
295
296
|
exportparts="base:close-button__base"
|
296
297
|
class="alert__close-button"
|
297
|
-
name="
|
298
|
+
name="${this.closeIconName}"
|
298
299
|
label="close"
|
299
300
|
size="20"
|
300
301
|
color="#98A2B3"
|
@@ -328,6 +329,9 @@ __decorate([
|
|
328
329
|
__decorate([
|
329
330
|
property({ type: String, reflect: true })
|
330
331
|
], NileToast.prototype, "prefixImageUrl", void 0);
|
332
|
+
__decorate([
|
333
|
+
property({ type: String, reflect: true })
|
334
|
+
], NileToast.prototype, "closeIconName", void 0);
|
331
335
|
__decorate([
|
332
336
|
property({ reflect: true })
|
333
337
|
], NileToast.prototype, "variant", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-toast.js","sourceRoot":"","sources":["../../../src/nile-toast/nile-toast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAIH,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;IAC9D,SAAS,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,WAAW;IAAnC;;QAIY,sBAAiB,GAAG,IAAI,iBAAiB,CACxD,IAAI,EACJ,MAAM,EACN,QAAQ,CACT,CAAC;QAIF;;;WAGG;QACyC,SAAI,GAAG,KAAK,CAAC;QAEb,WAAM,GAAG,KAAK,CAAC;QAE3D,wEAAwE;QAE5B,aAAQ,GAA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AQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAc;AAEC;IAAzC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAkB;AAyBrD;IADL,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;iDAiC7C;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;qDAGjB;AAhHU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoUrB;;AAED,mBAAmB,CAAC,YAAY,EAAE;IAChC,SAAS,EAAE;QACT,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE;QAC1B,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;KACzB;IACD,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;CAC3C,CAAC,CAAC;AAEH,mBAAmB,CAAC,YAAY,EAAE;IAChC,SAAS,EAAE;QACT,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;QACxB,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE;KAC3B;IACD,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;CAC3C,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, CSSResultArray, TemplateResult } from 'lit';\n\nimport '../nile-icon-button/nile-icon-button';\nimport { animateTo, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n getAnimation,\n setDefaultAnimation,\n} from '../utilities/animation-registry';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport { styles } from './nile-toast.css';\nimport type { CSSResultGroup } from 'lit';\n\nconst toastStack = Object.assign(document.createElement('div'), {\n className: 'nile-toast-stack',\n});\n\n/**\n * Nile icon component.\n *\n * @tag nile-toast\n *\n * @dependency nile-icon-button\n *\n * @slot - The alert's main content.\n * @slot icon - An icon to show in the alert. Works best with `<nile-icon>`.\n *\n * @event nile-show - Emitted when the alert opens.\n * @event nile-after-show - Emitted after the alert opens and all animations are complete.\n * @event nile-hide - Emitted when the alert closes.\n * @event nile-after-hide - Emitted after the alert closes and all animations are complete.\n *\n * @csspart base - The component's base wrapper.\n * @csspart icon - The container that wraps the optional icon.\n * @csspart message - The container that wraps the alert's main content.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n *\n * @animation alert.show - The animation to use when showing the alert.\n * @animation alert.hide - The animation to use when hiding the alert.\n */\n\n@customElement('nile-toast')\nexport class NileToast extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private autoHideTimeout: number;\n private readonly hasSlotController = new HasSlotController(\n this,\n 'icon',\n 'suffix'\n );\n\n @query('[part~=\"base\"]') base: HTMLElement;\n\n /**\n * Indicates whether or not the alert is open. You can toggle this attribute to show and hide the alert, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the alert's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, reflect: true }) noIcon = false;\n\n /** Enables a close button that allows the user to dismiss the alert. */\n\n @property({ type: Boolean, reflect: true }) closable = false;\n\n @property({ type: Boolean, reflect: true }) hasSlottedContent = false;\n\n @property({ type: Boolean, reflect: true }) hasSlottedIcon = false;\n\n @property({ type: String, reflect: true }) prefixImageUrl = '';\n\n /** The alert's theme variant. */\n @property({ reflect: true }) variant:\n | 'success'\n | 'info'\n | 'warning'\n | 'error'\n | 'gray'\n | 'black' = 'success';\n\n /**\n * The length of time, in milliseconds, the alert will show before closing itself. If the user interacts with\n * the alert before it closes (e.g. moves the mouse over it), the timer will restart. Defaults to `Infinity`, meaning\n * the alert will not close on its own.\n */\n @property({ type: Number }) duration = Infinity;\n\n @property({ type: String }) title = '';\n\n @property({ type: String }) content = '';\n\n @property({ type: Array, reflect: true }) tags: any[] = [];\n\n firstUpdated() {\n this.base.hidden = !this.open;\n }\n\n private restartAutoHide() {\n clearTimeout(this.autoHideTimeout);\n if (this.open && this.duration < Infinity) {\n this.autoHideTimeout = window.setTimeout(\n () => this.hide(),\n this.duration\n );\n }\n }\n\n private handleCloseClick() {\n this.hide();\n }\n\n private handleMouseMove() {\n this.restartAutoHide();\n }\n\n @watch('open', { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit('nile-show');\n\n if (this.duration < Infinity) {\n this.restartAutoHide();\n }\n\n await stopAnimations(this.base);\n this.base.hidden = false;\n const { keyframes, options } = getAnimation(this, 'alert.show', {\n dir: 'ltr',\n });\n await animateTo(this.base, keyframes, options);\n\n this.emit('nile-after-show');\n } else {\n // Hide\n this.emit('nile-hide');\n\n clearTimeout(this.autoHideTimeout);\n\n await stopAnimations(this.base);\n const { keyframes, options } = getAnimation(this, 'alert.hide', {\n dir: 'ltr',\n });\n await animateTo(this.base, keyframes, options);\n this.base.hidden = true;\n\n this.emit('nile-after-hide');\n }\n }\n\n @watch('duration')\n handleDurationChange() {\n this.restartAutoHide();\n }\n\n /** Shows the alert. */\n async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, 'nile-after-show');\n }\n\n /** Hides the alert */\n async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, 'nile-after-hide');\n }\n\n getIconNameByVariant() {\n switch (this.variant) {\n case 'success':\n return 'check-circle';\n case 'info':\n return 'info-circle';\n case 'warning':\n return 'alert-circle';\n case 'error':\n return 'alert-circle';\n case 'gray':\n return 'info-circle';\n case 'black':\n return 'info-circle';\n }\n }\n\n getIconColorByVariant() {\n switch (this.variant) {\n case 'success':\n return 'var(--nile-toast-color-icon-color-success)';\n case 'info':\n return 'var(--nile-toast-color-icon-color-info)';\n case 'warning':\n return 'var(--nile-toast-color-icon-color-warning)';\n case 'error':\n return 'var(--nile-toast-color-icon-color-error)';\n case 'gray':\n return 'var(--nile-toast-color-icon-color-gray)';\n case 'black':\n return 'var(--nile-toast-color-icon-color-black)';\n }\n }\n\n handleSlotChange(e: any) {\n const slot = e.target;\n const nodes = slot.assignedNodes({ flatten: true });\n if (slot.name === 'message') {\n const nodes = slot.assignedNodes({ flatten: true });\n this.hasSlottedContent = nodes.length > 0;\n }\n\n if (slot.name === 'icon') {\n const nodes = slot.assignedNodes({ flatten: true });\n this.hasSlottedIcon = nodes.length > 0;\n }\n }\n\n /**\n * Displays the alert as a toast notification. This will move the alert out of its position in the DOM and, when\n * dismissed, it will be removed from the DOM completely. By storing a reference to the alert, you can reuse it by\n * calling this method again. The returned promise will resolve after the alert is hidden.\n */\n async toast() {\n return new Promise<void>(resolve => {\n if (toastStack.parentElement === null) {\n document.body.append(toastStack);\n }\n\n toastStack.appendChild(this);\n\n // Wait for the toast stack to render\n requestAnimationFrame(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- force a reflow for the initial transition\n this.clientWidth;\n this.show();\n });\n\n this.addEventListener(\n 'nile-after-hide',\n () => {\n toastStack.removeChild(this);\n resolve();\n\n // Remove the toast stack from the DOM when there are no more alerts\n if (toastStack.querySelector('nile-alert') === null) {\n toastStack.remove();\n }\n },\n { once: true }\n );\n });\n }\n\n private toastTags(content: string, imageUrl: string) {\n return html`\n <div class=\"alert__tag\">\n <img class=\"alert__tag-image\" src=\"${imageUrl}\" />\n <span class=\"alert__tag-content\"> ${content} </span>\n </div>\n `;\n }\n\n render() {\n return html`\n <div\n part=\"base\"\n class=${classMap({\n alert: true,\n 'alert--open': this.open,\n 'alert--closable': this.closable,\n 'alert--has-icon': this.hasSlotController.test('icon'),\n 'alert--success': this.variant === 'success',\n 'alert--info': this.variant === 'info',\n 'alert--warning': this.variant === 'warning',\n 'alert--error': this.variant === 'error',\n 'alert--gray': this.variant === 'gray',\n 'alert--black': this.variant === 'black',\n 'alert--no-content': this.content === '',\n })}\n role=\"alert\"\n aria-hidden=${this.open ? 'false' : 'true'}\n @mousemove=${this.handleMouseMove}\n >\n <slot name=\"icon\" part=\"icon\" ?hidden=\"${this.noIcon === true}\">\n ${!this.prefixImageUrl\n ? html`\n <div\n class=\"alert__prefix-icon-container\"\n ?hidden=\"${this.hasSlottedIcon ||\n this.prefixImageUrl.length > 0}\"\n >\n <nile-icon\n name=\"${this.getIconNameByVariant()}\"\n size=\"20\"\n color=\"${this.getIconColorByVariant()}\"\n method=\"stroke\"\n ></nile-icon>\n </div>\n `\n : html`\n <img src=\"${this.prefixImageUrl}\" class=\"alert__prefix-img\" />\n `}\n </slot>\n\n <slot\n name=\"message\"\n part=\"message\"\n class=\"alert__message\"\n aria-live=\"polite\"\n @slotchange=\"${this.handleSlotChange}\"\n >\n <span\n ?hidden=\"${this.hasSlottedContent && this.title === ''}\"\n class=\"alert__message--title\"\n >\n ${this.title}\n </span>\n ${this.title\n ? html` <span\n ?hidden=\"${this.content === ''}\"\n class=${classMap({\n 'alert__message--content': true,\n 'alert__message--content-only': !!this.title,\n })}\n >\n ${this.content}\n </span>`\n : null}\n ${this.tags?.length > 0\n ? html`\n <div class=\"alert__tags\">\n ${this.tags.map(\n tag =>\n html`<span\n >${this.toastTags(tag.content, tag.imageUrl)}</span\n >`\n )}\n </div>\n `\n : ``}\n </slot>\n\n ${this.closable\n ? html`\n <nile-icon-button\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n class=\"alert__close-button\"\n name=\"close\"\n label=\"close\"\n size=\"20\"\n color=\"#98A2B3\"\n @click=${this.handleCloseClick}\n ></nile-icon-button>\n `\n : null}\n </div>\n `;\n }\n}\n\nsetDefaultAnimation('alert.show', {\n keyframes: [\n { opacity: 0, scale: 0.8 },\n { opacity: 1, scale: 1 },\n ],\n options: { duration: 250, easing: 'ease' },\n});\n\nsetDefaultAnimation('alert.hide', {\n keyframes: [\n { opacity: 1, scale: 1 },\n { opacity: 0, scale: 0.8 },\n ],\n options: { duration: 250, easing: 'ease' },\n});\n\nexport default NileToast;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-toast': NileToast;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"nile-toast.js","sourceRoot":"","sources":["../../../src/nile-toast/nile-toast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAIH,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;IAC9D,SAAS,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,WAAW;IAAnC;;QAIY,sBAAiB,GAAG,IAAI,iBAAiB,CACxD,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inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, CSSResultArray, TemplateResult } from 'lit';\n\nimport '../nile-icon-button/nile-icon-button';\nimport { animateTo, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n getAnimation,\n setDefaultAnimation,\n} from '../utilities/animation-registry';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport { styles } from './nile-toast.css';\nimport type { CSSResultGroup } from 'lit';\n\nconst toastStack = Object.assign(document.createElement('div'), {\n className: 'nile-toast-stack',\n});\n\n/**\n * Nile icon component.\n *\n * @tag nile-toast\n *\n * @dependency nile-icon-button\n *\n * @slot - The alert's main content.\n * @slot icon - An icon to show in the alert. Works best with `<nile-icon>`.\n *\n * @event nile-show - Emitted when the alert opens.\n * @event nile-after-show - Emitted after the alert opens and all animations are complete.\n * @event nile-hide - Emitted when the alert closes.\n * @event nile-after-hide - Emitted after the alert closes and all animations are complete.\n *\n * @csspart base - The component's base wrapper.\n * @csspart icon - The container that wraps the optional icon.\n * @csspart message - The container that wraps the alert's main content.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n *\n * @animation alert.show - The animation to use when showing the alert.\n * @animation alert.hide - The animation to use when hiding the alert.\n */\n\n@customElement('nile-toast')\nexport class NileToast extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private autoHideTimeout: number;\n private readonly hasSlotController = new HasSlotController(\n this,\n 'icon',\n 'suffix'\n );\n\n @query('[part~=\"base\"]') base: HTMLElement;\n\n /**\n * Indicates whether or not the alert is open. You can toggle this attribute to show and hide the alert, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the alert's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, reflect: true }) noIcon = false;\n\n /** Enables a close button that allows the user to dismiss the alert. */\n\n @property({ type: Boolean, reflect: true }) closable = false;\n\n @property({ type: Boolean, reflect: true }) hasSlottedContent = false;\n\n @property({ type: Boolean, reflect: true }) hasSlottedIcon = false;\n\n @property({ type: String, reflect: true }) prefixImageUrl = '';\n \n @property({ type: String, reflect: true }) closeIconName = 'close';\n\n /** The alert's theme variant. */\n @property({ reflect: true }) variant:\n | 'success'\n | 'info'\n | 'warning'\n | 'error'\n | 'gray'\n | 'black' = 'success';\n\n /**\n * The length of time, in milliseconds, the alert will show before closing itself. If the user interacts with\n * the alert before it closes (e.g. moves the mouse over it), the timer will restart. Defaults to `Infinity`, meaning\n * the alert will not close on its own.\n */\n @property({ type: Number }) duration = Infinity;\n\n @property({ type: String }) title = '';\n\n @property({ type: String }) content = '';\n\n @property({ type: Array, reflect: true }) tags: any[] = [];\n\n firstUpdated() {\n this.base.hidden = !this.open;\n }\n\n private restartAutoHide() {\n clearTimeout(this.autoHideTimeout);\n if (this.open && this.duration < Infinity) {\n this.autoHideTimeout = window.setTimeout(\n () => this.hide(),\n this.duration\n );\n }\n }\n\n private handleCloseClick() {\n this.hide();\n }\n\n private handleMouseMove() {\n this.restartAutoHide();\n }\n\n @watch('open', { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit('nile-show');\n\n if (this.duration < Infinity) {\n this.restartAutoHide();\n }\n\n await stopAnimations(this.base);\n this.base.hidden = false;\n const { keyframes, options } = getAnimation(this, 'alert.show', {\n dir: 'ltr',\n });\n await animateTo(this.base, keyframes, options);\n\n this.emit('nile-after-show');\n } else {\n // Hide\n this.emit('nile-hide');\n\n clearTimeout(this.autoHideTimeout);\n\n await stopAnimations(this.base);\n const { keyframes, options } = getAnimation(this, 'alert.hide', {\n dir: 'ltr',\n });\n await animateTo(this.base, keyframes, options);\n this.base.hidden = true;\n\n this.emit('nile-after-hide');\n }\n }\n\n @watch('duration')\n handleDurationChange() {\n this.restartAutoHide();\n }\n\n /** Shows the alert. */\n async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, 'nile-after-show');\n }\n\n /** Hides the alert */\n async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, 'nile-after-hide');\n }\n\n getIconNameByVariant() {\n switch (this.variant) {\n case 'success':\n return 'check-circle';\n case 'info':\n return 'info-circle';\n case 'warning':\n return 'alert-circle';\n case 'error':\n return 'alert-circle';\n case 'gray':\n return 'info-circle';\n case 'black':\n return 'info-circle';\n }\n }\n\n getIconColorByVariant() {\n switch (this.variant) {\n case 'success':\n return 'var(--nile-toast-color-icon-color-success)';\n case 'info':\n return 'var(--nile-toast-color-icon-color-info)';\n case 'warning':\n return 'var(--nile-toast-color-icon-color-warning)';\n case 'error':\n return 'var(--nile-toast-color-icon-color-error)';\n case 'gray':\n return 'var(--nile-toast-color-icon-color-gray)';\n case 'black':\n return 'var(--nile-toast-color-icon-color-black)';\n }\n }\n\n handleSlotChange(e: any) {\n const slot = e.target;\n const nodes = slot.assignedNodes({ flatten: true });\n if (slot.name === 'message') {\n const nodes = slot.assignedNodes({ flatten: true });\n this.hasSlottedContent = nodes.length > 0;\n }\n\n if (slot.name === 'icon') {\n const nodes = slot.assignedNodes({ flatten: true });\n this.hasSlottedIcon = nodes.length > 0;\n }\n }\n\n /**\n * Displays the alert as a toast notification. This will move the alert out of its position in the DOM and, when\n * dismissed, it will be removed from the DOM completely. By storing a reference to the alert, you can reuse it by\n * calling this method again. The returned promise will resolve after the alert is hidden.\n */\n async toast() {\n return new Promise<void>(resolve => {\n if (toastStack.parentElement === null) {\n document.body.append(toastStack);\n }\n\n toastStack.appendChild(this);\n\n // Wait for the toast stack to render\n requestAnimationFrame(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- force a reflow for the initial transition\n this.clientWidth;\n this.show();\n });\n\n this.addEventListener(\n 'nile-after-hide',\n () => {\n toastStack.removeChild(this);\n resolve();\n\n // Remove the toast stack from the DOM when there are no more alerts\n if (toastStack.querySelector('nile-alert') === null) {\n toastStack.remove();\n }\n },\n { once: true }\n );\n });\n }\n\n private toastTags(content: string, imageUrl: string) {\n return html`\n <div class=\"alert__tag\">\n <img class=\"alert__tag-image\" src=\"${imageUrl}\" />\n <span class=\"alert__tag-content\"> ${content} </span>\n </div>\n `;\n }\n\n render() {\n return html`\n <div\n part=\"base\"\n class=${classMap({\n alert: true,\n 'alert--open': this.open,\n 'alert--closable': this.closable,\n 'alert--has-icon': this.hasSlotController.test('icon'),\n 'alert--success': this.variant === 'success',\n 'alert--info': this.variant === 'info',\n 'alert--warning': this.variant === 'warning',\n 'alert--error': this.variant === 'error',\n 'alert--gray': this.variant === 'gray',\n 'alert--black': this.variant === 'black',\n 'alert--no-content': this.content === '',\n })}\n role=\"alert\"\n aria-hidden=${this.open ? 'false' : 'true'}\n @mousemove=${this.handleMouseMove}\n >\n <slot name=\"icon\" part=\"icon\" ?hidden=\"${this.noIcon === true}\">\n ${!this.prefixImageUrl\n ? html`\n <div\n class=\"alert__prefix-icon-container\"\n ?hidden=\"${this.hasSlottedIcon ||\n this.prefixImageUrl.length > 0}\"\n >\n <nile-icon\n name=\"${this.getIconNameByVariant()}\"\n size=\"20\"\n color=\"${this.getIconColorByVariant()}\"\n method=\"stroke\"\n ></nile-icon>\n </div>\n `\n : html`\n <img src=\"${this.prefixImageUrl}\" class=\"alert__prefix-img\" />\n `}\n </slot>\n\n <slot\n name=\"message\"\n part=\"message\"\n class=\"alert__message\"\n aria-live=\"polite\"\n @slotchange=\"${this.handleSlotChange}\"\n >\n <span\n ?hidden=\"${this.hasSlottedContent && this.title === ''}\"\n class=\"alert__message--title\"\n >\n ${this.title}\n </span>\n ${this.title\n ? html` <span\n ?hidden=\"${this.content === ''}\"\n class=${classMap({\n 'alert__message--content': true,\n 'alert__message--content-only': !!this.title,\n })}\n >\n ${this.content}\n </span>`\n : null}\n ${this.tags?.length > 0\n ? html`\n <div class=\"alert__tags\">\n ${this.tags.map(\n tag =>\n html`<span\n >${this.toastTags(tag.content, tag.imageUrl)}</span\n >`\n )}\n </div>\n `\n : ``}\n </slot>\n\n ${this.closable\n ? html`\n <nile-icon-button\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n class=\"alert__close-button\"\n name=\"${this.closeIconName}\"\n label=\"close\"\n size=\"20\"\n color=\"#98A2B3\"\n @click=${this.handleCloseClick}\n ></nile-icon-button>\n `\n : null}\n </div>\n `;\n }\n}\n\nsetDefaultAnimation('alert.show', {\n keyframes: [\n { opacity: 0, scale: 0.8 },\n { opacity: 1, scale: 1 },\n ],\n options: { duration: 250, easing: 'ease' },\n});\n\nsetDefaultAnimation('alert.hide', {\n keyframes: [\n { opacity: 1, scale: 1 },\n { opacity: 0, scale: 0.8 },\n ],\n options: { duration: 250, easing: 'ease' },\n});\n\nexport default NileToast;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-toast': NileToast;\n }\n}\n"]}
|