@aquera/nile-elements 0.0.45 → 0.0.47
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.css.js +41 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.d.ts +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js +10 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.d.ts +9 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js +114 -25
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.d.ts +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js +25 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-boolean.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-boolean.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-boolean.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-integer.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-integer.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-integer.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-string.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-string.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-of-string.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.d.ts +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.d.ts +6 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.js +21 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/demo/filenames.txt +1 -1
- package/demo/variables.css +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +176 -106
- package/dist/nile-badge/index.cjs.js +1 -1
- package/dist/nile-badge/index.esm.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
- package/dist/nile-badge/nile-badge.esm.js +1 -1
- package/dist/nile-button/index.cjs.js +1 -1
- package/dist/nile-button/index.esm.js +1 -1
- package/dist/nile-button/nile-button.cjs.js +1 -1
- package/dist/nile-button/nile-button.cjs.js.map +1 -1
- 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 +43 -2
- package/dist/nile-button/nile-button.esm.js +2 -2
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +10 -2
- package/dist/nile-calendar/nile-calendar.esm.js +44 -28
- package/dist/nile-date-picker/nile-date-picker.cjs.js +1 -1
- package/dist/nile-date-picker/nile-date-picker.cjs.js.map +1 -1
- package/dist/nile-date-picker/nile-date-picker.esm.js +12 -8
- package/dist/nile-dialog/index.cjs.js +1 -1
- package/dist/nile-dialog/index.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-icon/icons/svg/array-of-boolean.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/array-of-boolean.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/array-of-boolean.esm.js +1 -0
- package/dist/nile-icon/icons/svg/array-of-integer.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/array-of-integer.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/array-of-integer.esm.js +1 -0
- package/dist/nile-icon/icons/svg/array-of-string.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/array-of-string.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/array-of-string.esm.js +1 -0
- package/dist/nile-icon/icons/svg/index.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/index.esm.js +1 -1
- package/dist/nile-icon/index.cjs.js +1 -1
- package/dist/nile-icon/index.cjs.js.map +1 -1
- package/dist/nile-icon/index.esm.js +2 -2
- package/dist/nile-icon-button/index.cjs.js +1 -1
- package/dist/nile-icon-button/index.esm.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
- package/dist/nile-icon-button/nile-icon-button.esm.js +1 -1
- package/dist/nile-input/index.cjs.js +1 -1
- package/dist/nile-input/index.esm.js +1 -1
- package/dist/nile-input/nile-input.cjs.js +1 -1
- package/dist/nile-input/nile-input.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.esm.js +1 -1
- package/dist/nile-menu-item/index.cjs.js +1 -1
- package/dist/nile-menu-item/index.esm.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -1
- package/dist/nile-menu-item/nile-menu-item.esm.js +1 -1
- package/dist/nile-option/index.cjs.js +1 -1
- package/dist/nile-option/index.esm.js +1 -1
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.esm.js +5 -4
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/index.esm.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +1 -1
- package/dist/nile-tab/index.cjs.js +1 -1
- package/dist/nile-tab/index.esm.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js.map +1 -1
- package/dist/nile-tab/nile-tab.esm.js +1 -1
- package/dist/nile-tab-group/index.cjs.js +1 -1
- package/dist/nile-tab-group/index.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.esm.js +1 -1
- package/dist/nile-tag/index.cjs.js +1 -1
- package/dist/nile-tag/index.esm.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.esm.js +1 -1
- package/dist/nile-toast/index.cjs.js +1 -1
- package/dist/nile-toast/index.esm.js +1 -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 +1 -1
- package/dist/src/nile-button/nile-button.css.js +41 -0
- package/dist/src/nile-button/nile-button.css.js.map +1 -1
- package/dist/src/nile-button/nile-button.d.ts +1 -1
- package/dist/src/nile-button/nile-button.js +1 -0
- package/dist/src/nile-button/nile-button.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +10 -2
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.d.ts +9 -1
- package/dist/src/nile-calendar/nile-calendar.js +114 -25
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-date-picker/nile-date-picker.d.ts +4 -0
- package/dist/src/nile-date-picker/nile-date-picker.js +25 -6
- package/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/array-of-boolean.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-boolean.js +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-boolean.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/array-of-integer.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-integer.js +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-integer.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/array-of-string.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-string.js +5 -0
- package/dist/src/nile-icon/icons/svg/array-of-string.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/index.d.ts +3 -0
- package/dist/src/nile-icon/icons/svg/index.js +3 -0
- package/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.d.ts +6 -0
- package/dist/src/nile-popover/nile-popover.js +21 -2
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/nile-button/nile-button.css.ts +41 -0
- package/src/nile-button/nile-button.ts +2 -1
- package/src/nile-calendar/nile-calendar.css.ts +10 -2
- package/src/nile-calendar/nile-calendar.ts +206 -80
- package/src/nile-date-picker/nile-date-picker.ts +21 -7
- package/src/nile-icon/icons/svg/array-of-boolean.ts +5 -0
- package/src/nile-icon/icons/svg/array-of-integer.ts +5 -0
- package/src/nile-icon/icons/svg/array-of-string.ts +5 -0
- package/src/nile-icon/icons/svg/index.ts +3 -0
- package/src/nile-popover/nile-popover.ts +20 -2
@@ -167,6 +167,35 @@ export const styles = css `
|
|
167
167
|
box-shadow: none;
|
168
168
|
}
|
169
169
|
|
170
|
+
/* ghost */
|
171
|
+
.button--standard.button--ghost{
|
172
|
+
background-color: var(--nile-colors-button-tertiary);
|
173
|
+
border-color: transparent;
|
174
|
+
color: var(--nile-colors-button-tertiary-text);
|
175
|
+
}
|
176
|
+
|
177
|
+
.button--standard.button--ghost:hover:not(.button--disabled) {
|
178
|
+
background-color: var(--nile-colors-button-tertiary-hover);
|
179
|
+
border-color: transparent;
|
180
|
+
color: var(--nile-colors-button-tertiary-text);
|
181
|
+
}
|
182
|
+
|
183
|
+
.button--standard.button--ghost:active:not(.button--disabled) {
|
184
|
+
background-color: var(--nile-colors-button-tertiary-pressed);
|
185
|
+
border-color:transparent;
|
186
|
+
color: var(--nile-colors-button-tertiary-text);
|
187
|
+
}
|
188
|
+
|
189
|
+
.button--standard.button--ghost.button--disabled,
|
190
|
+
.button--standard.button--ghost.button--disabled:hover,
|
191
|
+
.button--standard.button--ghost.button--disabled:active {
|
192
|
+
border-color:transparent;
|
193
|
+
background-color: var(--nile-colors-button-tertiary-disabled);
|
194
|
+
color: var(--nile-colors-button-tertiary-disabled-text);
|
195
|
+
cursor: not-allowed;
|
196
|
+
box-shadow: none;
|
197
|
+
}
|
198
|
+
|
170
199
|
/* caution */
|
171
200
|
.button--standard.button--caution {
|
172
201
|
background-color: var(--nile-colors-button-caution);
|
@@ -231,6 +260,18 @@ export const styles = css `
|
|
231
260
|
--nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;
|
232
261
|
}
|
233
262
|
|
263
|
+
/* Ghost Variant */
|
264
|
+
.button--standard.button--ghost ::slotted(nile-icon) {
|
265
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;
|
266
|
+
}
|
267
|
+
.button--standard.button--ghost:hover:not(.button--disabled) ::slotted(nile-icon),
|
268
|
+
.button--standard.button--ghost:active:not(.button--disabled) ::slotted(nile-icon) {
|
269
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;
|
270
|
+
}
|
271
|
+
.button--standard.button--ghost ::slotted(nile-icon) {
|
272
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;
|
273
|
+
}
|
274
|
+
|
234
275
|
/* Caution Variant */
|
235
276
|
.button--standard.button--caution ::slotted(nile-icon) {
|
236
277
|
--nile-svg-fill: var(--nile-colors-button-caution-text) !important;
|
@@ -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,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmbxB,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-element';\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-weight: var(--nile-font-weight-regular);\n font-family: var(--nile-font-family-serif);\n font-size: var(--nile-type-scale-3);\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 padding: var(--nile-spacing-2-x);\n gap: var(--nile-spacing-2-x);\n border-radius: var(--nile-radius-base-standard);\n line-height: var(--nile-type-scale-3);\n box-sizing: border-box;\n height: 38px;\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 .button__label::slotted(nile-icon) {\n /* vertical-align: -2px; */\n }\n\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 /* 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 }\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 }\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 /* 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 /* 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\n /* Primary Variant - Nile Icon Fill */\n .button--standard.button--primary ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--primary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary.button--disabled ::slotted(nile-icon) {\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) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--secondary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-secondary-disabled-text) !important;\n }\n\n /* Tertiary Variant */\n .button--standard.button--tertiary ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--tertiary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;\n }\n\n /* Caution Variant */\n .button--standard.button--caution ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--caution:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-disabled-text) !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 @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`;\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,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4dxB,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-element';\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-weight: var(--nile-font-weight-regular);\n font-family: var(--nile-font-family-serif);\n font-size: var(--nile-type-scale-3);\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 padding: var(--nile-spacing-2-x);\n gap: var(--nile-spacing-2-x);\n border-radius: var(--nile-radius-base-standard);\n line-height: var(--nile-type-scale-3);\n box-sizing: border-box;\n height: 38px;\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 .button__label::slotted(nile-icon) {\n /* vertical-align: -2px; */\n }\n\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 /* 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 }\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 }\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 /* 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\n /* Primary Variant - Nile Icon Fill */\n .button--standard.button--primary ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--primary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-primary-text) !important;\n }\n .button--standard.button--primary.button--disabled ::slotted(nile-icon) {\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) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--secondary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-secondary-text) !important;\n }\n .button--standard.button--secondary.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-secondary-disabled-text) !important;\n }\n\n /* Tertiary Variant */\n .button--standard.button--tertiary ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--tertiary:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--tertiary.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;\n }\n\n /* Ghost Variant */\n .button--standard.button--ghost ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--ghost:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--ghost:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;\n }\n .button--standard.button--ghost ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;\n }\n\n /* Caution Variant */\n .button--standard.button--caution ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution:hover:not(.button--disabled) ::slotted(nile-icon),\n .button--standard.button--caution:active:not(.button--disabled) ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-text) !important;\n }\n .button--standard.button--caution.button--disabled ::slotted(nile-icon) {\n --nile-svg-fill: var(--nile-colors-button-caution-disabled-text) !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 @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`;\n"]}
|
@@ -33,7 +33,7 @@ export declare class NileButton extends NileElement implements NileFormControl {
|
|
33
33
|
invalid: boolean;
|
34
34
|
title: string;
|
35
35
|
/** The button's theme variant. */
|
36
|
-
variant: 'primary' | 'secondary' | 'tertiary' | 'caution';
|
36
|
+
variant: 'primary' | 'secondary' | 'tertiary' | 'caution' | 'ghost';
|
37
37
|
/** The button's size. */
|
38
38
|
size: 'medium';
|
39
39
|
/** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */
|
@@ -216,6 +216,7 @@ let NileButton = class NileButton extends NileElement {
|
|
216
216
|
'button--secondary': this.variant === 'secondary',
|
217
217
|
'button--tertiary': this.variant === 'tertiary',
|
218
218
|
'button--caution': this.variant === 'caution',
|
219
|
+
'button--ghost': this.variant === 'ghost',
|
219
220
|
'button--medium': this.size === 'medium',
|
220
221
|
'button--caret': this.caret,
|
221
222
|
'button--circle': this.circle,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-button.js","sourceRoot":"","sources":["../../../src/nile-button/nile-button.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,OAAO,E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,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAG3C;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAA8D;AAiFpG;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;sDAMjD;AAlMU,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAyStB;SAzSY,UAAU;AA2SvB,eAAe,UAAU,CAAC","sourcesContent":["import '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { FormControlController, validValidityState } from '../internal/form';\nimport { HasSlotController } from '../internal/slot';\nimport { html, literal } from 'lit/static-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { watch } from '../internal/watch';\nimport { styles } from './nile-button.css';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\nimport type { NileFormControl } from '../internal/nile-element';\nimport NileElement from '../internal/nile-element';\n\n/**\n * @summary Buttons represent actions that are available to the user.\n * @status stable\n * @since 2.0\n *\n * @dependency nile-icon\n * @dependency nile-spinner\n *\n * @event nile-blur - Emitted when the button loses focus.\n * @event nile-focus - Emitted when the button gains focus.\n * @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @slot - The button's label.\n * @slot prefix - A presentational prefix icon or similar element.\n * @slot suffix - A presentational suffix icon or similar element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart label - The button's label.\n * @csspart suffix - The container that wraps the suffix.\n * @csspart caret - The button's caret icon, an `<nile-icon>` element.\n */\n\n@customElement('nile-button')\nexport class NileButton extends NileElement implements NileFormControl {\n static styles: CSSResultGroup = styles;\n\n private readonly formControlController = new FormControlController(this, {\n form: input => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute is set we need to query\n // the form from the same root using its id\n if (input.hasAttribute('form')) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute('form')!;\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest('form');\n },\n assumeInteractionOn: ['click']\n });\n private readonly hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');\n\n @query('.button') button: HTMLButtonElement | HTMLLinkElement;\n\n @state() private hasFocus = false;\n @state() invalid = false;\n @property() title = ''; // make reactive to pass through\n\n /** The button's theme variant. */\n @property({ reflect: true }) variant: 'primary' | 'secondary' | 'tertiary' | 'caution' = 'primary';\n\n /** The button's size. */\n @property({ reflect: true }) size: 'medium' = 'medium';\n\n /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */\n @property({ type: Boolean, reflect: true }) caret = false;\n\n /** Disables the button. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Draws the button in a loading state. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Draws an outlined button. */\n @property({ type: Boolean, reflect: true }) outline = false;\n\n /** Draws a pill-style button with rounded edges. */\n @property({ type: Boolean, reflect: true }) pill = false;\n\n /**\n * Draws a circular icon button. When this attribute is present, the button expects a single `<nile-icon>` in the\n * default slot.\n */\n @property({ type: Boolean, reflect: true }) circle = false;\n\n /**\n * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native\n * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.\n */\n @property() type: 'button' | 'submit' | 'reset' = 'button';\n\n /**\n * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.\n * This attribute is ignored when `href` is present.\n */\n @property() name = '';\n\n /**\n * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this\n * button is the submitter. This attribute is ignored when `href` is present.\n */\n @property() value = '';\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */\n @property() href = '';\n\n /** Tells the browser where to open the link. Only used when `href` is present. */\n @property() target: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the\n * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a\n * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by\n * setting the attribute to an empty string or a value of your choice, respectively.\n */\n @property() rel = 'noreferrer noopener';\n\n /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */\n @property() download?: string;\n\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property() form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ attribute: 'formaction' }) formAction: string;\n\n /** Used to override the form owner's `enctype` attribute. */\n @property({ attribute: 'formenctype' })\n formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';\n\n /** Used to override the form owner's `method` attribute. */\n @property({ attribute: 'formmethod' }) formMethod: 'post' | 'get';\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: 'formnovalidate', type: Boolean }) formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ attribute: 'formtarget' }) formTarget: '_self' | '_blank' | '_parent' | '_top' | string;\n\n /** Gets the validity state object */\n get validity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validity;\n }\n\n return validValidityState;\n }\n\n /** Gets the validation message */\n get validationMessage() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validationMessage;\n }\n\n return '';\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.handleHostClick = this.handleHostClick.bind(this);\n this.addEventListener('click', this.handleHostClick);\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.handleHostClick);\n this.emit('nile-destroy');\n }\n\n firstUpdated() {\n if (this.isButton()) {\n this.formControlController.updateValidity();\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur');\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus');\n }\n\n private handleClick() {\n if (this.type === 'submit') {\n this.formControlController.submit(this);\n }\n\n if (this.type === 'reset') {\n this.formControlController.reset(this);\n }\n }\n\n private handleHostClick(event: MouseEvent) {\n // Prevent the click event from being emitted when the button is disabled or loading\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n private handleInvalid(event: Event) {\n this.formControlController.setValidity(false);\n this.formControlController.emitInvalidEvent(event);\n }\n\n private isButton() {\n return this.href ? false : true;\n }\n\n private isLink() {\n return this.href ? true : false;\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n if (this.isButton()) {\n // Disabled form controls are always valid\n this.formControlController.setValidity(this.disabled);\n }\n }\n\n /** Simulates a click on the button. */\n click() {\n this.button.click();\n }\n\n /** Sets focus on the button. */\n focus(options?: FocusOptions) {\n this.button.focus(options);\n }\n\n /** Removes focus from the button. */\n blur() {\n this.button.blur();\n }\n\n /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */\n checkValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).checkValidity();\n }\n\n return true;\n }\n\n /** Gets the associated form, if one exists. */\n getForm(): HTMLFormElement | null {\n return this.formControlController.getForm();\n }\n\n /** Checks for validity and shows the browser's validation message if the control is invalid. */\n reportValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).reportValidity();\n }\n\n return true;\n }\n\n /** Sets a custom validation message. Pass an empty string to restore validity. */\n setCustomValidity(message: string) {\n if (this.isButton()) {\n (this.button as HTMLButtonElement).setCustomValidity(message);\n this.formControlController.updateValidity();\n }\n }\n\n render(): TemplateResult {\n const isLink = this.isLink();\n const tag = isLink ? literal`a` : literal`button`;\n\n /* eslint-disable lit/no-invalid-html */\n /* eslint-disable lit/binding-positions */\n return html`\n <${tag}\n part=\"base\"\n class=${classMap({\n button: true,\n 'button--primary': this.variant === 'primary',\n 'button--secondary': this.variant === 'secondary',\n 'button--tertiary': this.variant === 'tertiary',\n 'button--caution': this.variant === 'caution',\n 'button--medium': this.size === 'medium',\n 'button--caret': this.caret,\n 'button--circle': this.circle,\n 'button--disabled': this.disabled,\n 'button--focused': this.hasFocus,\n 'button--loading': this.loading,\n 'button--standard': !this.outline,\n 'button--outline': this.outline,\n 'button--pill': this.pill,\n 'button--has-label': this.hasSlotController.test('[default]'),\n 'button--has-prefix': this.hasSlotController.test('prefix'),\n 'button--has-suffix': this.hasSlotController.test('suffix')\n })}\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n title=${this.title /* An empty title prevents browser validation tooltips from appearing on hover */}\n name=${ifDefined(isLink ? undefined : this.name)}\n value=${ifDefined(isLink ? undefined : this.value)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink ? this.rel : undefined)}\n role=${ifDefined(isLink ? undefined : 'button')}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n tabindex=${this.disabled ? '-1' : '0'}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @invalid=${this.isButton() ? this.handleInvalid : null}\n @click=${this.handleClick}\n >\n <slot name=\"prefix\" part=\"prefix\" class=\"button__prefix\"></slot>\n <slot part=\"label\" class=\"button__label\"></slot>\n <slot name=\"suffix\" part=\"suffix\" class=\"button__suffix\"></slot>\n ${\n this.caret ? html` <nile-icon part=\"caret\" class=\"button__caret\" color=\"white\" name=\"arrowdown\"></nile-icon> ` : ''\n }\n ${this.loading ? html`<nile-spinner></nile-spinner>` : ''}\n </${tag}>\n `;\n }\n}\n\nexport default NileButton;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-button': NileButton;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"nile-button.js","sourceRoot":"","sources":["../../../src/nile-button/nile-button.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD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,EAAE;wCAAc;AAGc;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAAoB;AAI1D;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CACiD;AAGjD;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAA4B;AAGR;IAAzD,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAG3C;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAA8D;AAiFpG;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;sDAMjD;AAlMU,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA0StB;SA1SY,UAAU;AA4SvB,eAAe,UAAU,CAAC","sourcesContent":["import '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { FormControlController, validValidityState } from '../internal/form';\nimport { HasSlotController } from '../internal/slot';\nimport { html, literal } from 'lit/static-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { watch } from '../internal/watch';\nimport { styles } from './nile-button.css';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\nimport type { NileFormControl } from '../internal/nile-element';\nimport NileElement from '../internal/nile-element';\n\n/**\n * @summary Buttons represent actions that are available to the user.\n * @status stable\n * @since 2.0\n *\n * @dependency nile-icon\n * @dependency nile-spinner\n *\n * @event nile-blur - Emitted when the button loses focus.\n * @event nile-focus - Emitted when the button gains focus.\n * @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @slot - The button's label.\n * @slot prefix - A presentational prefix icon or similar element.\n * @slot suffix - A presentational suffix icon or similar element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart label - The button's label.\n * @csspart suffix - The container that wraps the suffix.\n * @csspart caret - The button's caret icon, an `<nile-icon>` element.\n */\n\n@customElement('nile-button')\nexport class NileButton extends NileElement implements NileFormControl {\n static styles: CSSResultGroup = styles;\n\n private readonly formControlController = new FormControlController(this, {\n form: input => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute is set we need to query\n // the form from the same root using its id\n if (input.hasAttribute('form')) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute('form')!;\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest('form');\n },\n assumeInteractionOn: ['click']\n });\n private readonly hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');\n\n @query('.button') button: HTMLButtonElement | HTMLLinkElement;\n\n @state() private hasFocus = false;\n @state() invalid = false;\n @property() title = ''; // make reactive to pass through\n\n /** The button's theme variant. */\n @property({ reflect: true }) variant: 'primary' | 'secondary' | 'tertiary' | 'caution'|'ghost' = 'primary';\n\n /** The button's size. */\n @property({ reflect: true }) size: 'medium' = 'medium';\n\n /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */\n @property({ type: Boolean, reflect: true }) caret = false;\n\n /** Disables the button. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Draws the button in a loading state. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Draws an outlined button. */\n @property({ type: Boolean, reflect: true }) outline = false;\n\n /** Draws a pill-style button with rounded edges. */\n @property({ type: Boolean, reflect: true }) pill = false;\n\n /**\n * Draws a circular icon button. When this attribute is present, the button expects a single `<nile-icon>` in the\n * default slot.\n */\n @property({ type: Boolean, reflect: true }) circle = false;\n\n /**\n * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native\n * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.\n */\n @property() type: 'button' | 'submit' | 'reset' = 'button';\n\n /**\n * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.\n * This attribute is ignored when `href` is present.\n */\n @property() name = '';\n\n /**\n * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this\n * button is the submitter. This attribute is ignored when `href` is present.\n */\n @property() value = '';\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */\n @property() href = '';\n\n /** Tells the browser where to open the link. Only used when `href` is present. */\n @property() target: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the\n * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a\n * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by\n * setting the attribute to an empty string or a value of your choice, respectively.\n */\n @property() rel = 'noreferrer noopener';\n\n /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */\n @property() download?: string;\n\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property() form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ attribute: 'formaction' }) formAction: string;\n\n /** Used to override the form owner's `enctype` attribute. */\n @property({ attribute: 'formenctype' })\n formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';\n\n /** Used to override the form owner's `method` attribute. */\n @property({ attribute: 'formmethod' }) formMethod: 'post' | 'get';\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: 'formnovalidate', type: Boolean }) formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ attribute: 'formtarget' }) formTarget: '_self' | '_blank' | '_parent' | '_top' | string;\n\n /** Gets the validity state object */\n get validity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validity;\n }\n\n return validValidityState;\n }\n\n /** Gets the validation message */\n get validationMessage() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validationMessage;\n }\n\n return '';\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.handleHostClick = this.handleHostClick.bind(this);\n this.addEventListener('click', this.handleHostClick);\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.handleHostClick);\n this.emit('nile-destroy');\n }\n\n firstUpdated() {\n if (this.isButton()) {\n this.formControlController.updateValidity();\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur');\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus');\n }\n\n private handleClick() {\n if (this.type === 'submit') {\n this.formControlController.submit(this);\n }\n\n if (this.type === 'reset') {\n this.formControlController.reset(this);\n }\n }\n\n private handleHostClick(event: MouseEvent) {\n // Prevent the click event from being emitted when the button is disabled or loading\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n private handleInvalid(event: Event) {\n this.formControlController.setValidity(false);\n this.formControlController.emitInvalidEvent(event);\n }\n\n private isButton() {\n return this.href ? false : true;\n }\n\n private isLink() {\n return this.href ? true : false;\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n if (this.isButton()) {\n // Disabled form controls are always valid\n this.formControlController.setValidity(this.disabled);\n }\n }\n\n /** Simulates a click on the button. */\n click() {\n this.button.click();\n }\n\n /** Sets focus on the button. */\n focus(options?: FocusOptions) {\n this.button.focus(options);\n }\n\n /** Removes focus from the button. */\n blur() {\n this.button.blur();\n }\n\n /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */\n checkValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).checkValidity();\n }\n\n return true;\n }\n\n /** Gets the associated form, if one exists. */\n getForm(): HTMLFormElement | null {\n return this.formControlController.getForm();\n }\n\n /** Checks for validity and shows the browser's validation message if the control is invalid. */\n reportValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).reportValidity();\n }\n\n return true;\n }\n\n /** Sets a custom validation message. Pass an empty string to restore validity. */\n setCustomValidity(message: string) {\n if (this.isButton()) {\n (this.button as HTMLButtonElement).setCustomValidity(message);\n this.formControlController.updateValidity();\n }\n }\n\n render(): TemplateResult {\n const isLink = this.isLink();\n const tag = isLink ? literal`a` : literal`button`;\n\n /* eslint-disable lit/no-invalid-html */\n /* eslint-disable lit/binding-positions */\n return html`\n <${tag}\n part=\"base\"\n class=${classMap({\n button: true,\n 'button--primary': this.variant === 'primary',\n 'button--secondary': this.variant === 'secondary',\n 'button--tertiary': this.variant === 'tertiary',\n 'button--caution': this.variant === 'caution',\n 'button--ghost': this.variant === 'ghost',\n 'button--medium': this.size === 'medium',\n 'button--caret': this.caret,\n 'button--circle': this.circle,\n 'button--disabled': this.disabled,\n 'button--focused': this.hasFocus,\n 'button--loading': this.loading,\n 'button--standard': !this.outline,\n 'button--outline': this.outline,\n 'button--pill': this.pill,\n 'button--has-label': this.hasSlotController.test('[default]'),\n 'button--has-prefix': this.hasSlotController.test('prefix'),\n 'button--has-suffix': this.hasSlotController.test('suffix')\n })}\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n title=${this.title /* An empty title prevents browser validation tooltips from appearing on hover */}\n name=${ifDefined(isLink ? undefined : this.name)}\n value=${ifDefined(isLink ? undefined : this.value)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink ? this.rel : undefined)}\n role=${ifDefined(isLink ? undefined : 'button')}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n tabindex=${this.disabled ? '-1' : '0'}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @invalid=${this.isButton() ? this.handleInvalid : null}\n @click=${this.handleClick}\n >\n <slot name=\"prefix\" part=\"prefix\" class=\"button__prefix\"></slot>\n <slot part=\"label\" class=\"button__label\"></slot>\n <slot name=\"suffix\" part=\"suffix\" class=\"button__suffix\"></slot>\n ${\n this.caret ? html` <nile-icon part=\"caret\" class=\"button__caret\" color=\"white\" name=\"arrowdown\"></nile-icon> ` : ''\n }\n ${this.loading ? html`<nile-spinner></nile-spinner>` : ''}\n </${tag}>\n `;\n }\n}\n\nexport default NileButton;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-button': NileButton;\n }\n}\n"]}
|
@@ -172,6 +172,9 @@ export const styles = css `
|
|
172
172
|
margin-top: 6px;
|
173
173
|
padding: 0 16px;
|
174
174
|
width: 290px;
|
175
|
+
display:flex;
|
176
|
+
flex-wrap:wrap;
|
177
|
+
gap:8px;
|
175
178
|
}
|
176
179
|
|
177
180
|
.calender-input--relative {
|
@@ -184,11 +187,11 @@ export const styles = css `
|
|
184
187
|
justify-content: space-between;
|
185
188
|
gap: 8px;
|
186
189
|
margin-top: 12px;
|
187
|
-
width:
|
190
|
+
width:auto;
|
188
191
|
}
|
189
192
|
|
190
193
|
.manual-input {
|
191
|
-
width:
|
194
|
+
width:125px;
|
192
195
|
}
|
193
196
|
|
194
197
|
.manual-input-label {
|
@@ -339,6 +342,11 @@ export const styles = css `
|
|
339
342
|
.months-values {
|
340
343
|
gap: 16px;
|
341
344
|
}
|
345
|
+
|
346
|
+
.not-allowed {
|
347
|
+
pointer-events: none;
|
348
|
+
color:var(--nile-colors-dark-500);
|
349
|
+
}
|
342
350
|
`;
|
343
351
|
export default [styles];
|
344
352
|
//# sourceMappingURL=nile-calendar.css.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-calendar.css.js","sourceRoot":"","sources":["../../../src/nile-calendar/nile-calendar.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-calendar.css.js","sourceRoot":"","sources":["../../../src/nile-calendar/nile-calendar.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmVxB,CAAC;AAEF,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-element';\n\n/**\n * DatePicker CSS\n */\nexport const styles = css`\n :host {\n }\n\n .calendar-container {\n font-family:var(--nile-font-family-serif);\n width: 290px;\n height: auto;\n text-align: center;\n background: white;\n border-radius: 8px;\n }\n\n .calendar-header {\n display: flex;\n justify-content: space-between;\n padding: 10px;\n padding: 22px 20px;\n font-size: 14px;\n font-weight: 600;\n line-height: 14px;\n letter-spacing: 0.2px;\n }\n\n .header-divider {\n background: #c7ced4;\n height: 1px;\n width: 100%;\n }\n\n .calendar-header__month-navigation {\n cursor: pointer;\n }\n\n .divider {\n width: 100%;\n height: 1px;\n background: #c7ced4;\n }\n\n .day-names {\n font-size: 14px;\n font-weight: 600;\n line-height: 14px;\n letter-spacing: 0.2px;\n height: 50px;\n padding: 0 12px 0 12px;\n }\n\n .day-names,\n .days {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-start;\n align-items: center;\n gap: 4px 7px;\n }\n\n .days {\n height: auto;\n padding: 0 12px 12px 12px;\n }\n\n .day {\n flex-basis: auto;\n min-width: 32px;\n min-height: 32px;\n flex-grow: 0;\n flex-shrink: 0;\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .current-date {\n border: 1px solid #1978b8;\n }\n\n .day:hover {\n background-color: #e5e9eb;\n }\n\n .filler {\n color: #7f7f7f;\n pointer-events: none;\n }\n\n .selected-date {\n color: white;\n border-radius: 4px;\n background: #a5d3f3;\n }\n\n .selected-date:hover {\n background: #a5d3f3;\n }\n\n .calendar-wrapper {\n background: white;\n display: flex;\n justify-content: space-between;\n width: 290px;\n border-radius: 8px;\n }\n\n .selected-date,\n .range-start,\n .range-end {\n border-radius: 4px;\n background: #a5d3f3;\n color: white;\n }\n\n .range-start {\n background: #a5d3f3;\n border-radius: 4px 0 0 4px;\n color: white;\n }\n\n .range-end {\n background: #a5d3f3;\n border-radius: 0 4px 4px 0;\n color: white;\n }\n\n .range-middle {\n background: #a5d3f3;\n color: white;\n border-radius: 0;\n }\n\n .day.selected {\n background: #a5d3f3;\n color: white;\n border-radius: 4px;\n }\n\n .day.in-range {\n background: #a5d3f3;\n color: white;\n }\n\n .selected-date {\n color: white;\n border-radius: 4px;\n background: #a5d3f3;\n }\n\n .base {\n background-color: white;\n border-radius: 8px;\n width: 290px;\n }\n\n .base__relative {\n width: 352px;\n }\n\n .calender-input {\n margin-top: 6px;\n padding: 0 16px;\n width: 290px;\n display:flex;\n flex-wrap:wrap;\n gap:8px;\n }\n\n .calender-input--relative {\n width: 352px;\n padding: 0;\n }\n\n .from {\n display: flex;\n justify-content: space-between;\n gap: 8px;\n margin-top: 12px;\n width:auto;\n }\n\n .manual-input {\n width:125px;\n }\n\n .manual-input-label {\n color: #7f7f7f;\n font-family: Colfax-regular;\n font-size: 12px;\n font-weight: 500;\n line-height: 12px;\n letter-spacing: 0.2px;\n }\n\n .button-container {\n width: 100%;\n text-align: right;\n padding: 12px 16px 16px 16px;\n box-sizing: border-box;\n }\n\n .calendar-config {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 12px;\n }\n\n .calendar-switcher {\n width: 100%;\n margin-right: 24px;\n margin-top: 16px;\n }\n\n .calendar-switch {\n padding-bottom: 12px;\n cursor: pointer;\n }\n\n .calendar-switch__active {\n padding-bottom: 12px;\n border-bottom: 4px solid #005ea6;\n }\n\n .unit-container {\n display: flex;\n flex-direction: column;\n width: 352px;\n gap:10px;\n padding: 24px 24px 0 24px;\n }\n\n .time-unit-group {\n display: flex;\n flex-direction: column;\n align-items: start;\n justify-content:center;\n gap: 12px;\n }\n\n .time-unit-name {\n width: 54px;\n }\n\n .time-unit-name span {\n margin-right: 24px;\n color: var(--color-text-default, #000);\n font-family: Colfax-regular;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n letter-spacing: 0.2px;\n }\n\n .time-unit-value {\n display: flex;\n gap: 3px;\n }\n\n .time-value {\n display: inline-flex;\n width: 48px;\n height: 32px;\n box-sizing: border-box;\n padding: 5px;\n border: 1px solid #ddd;\n cursor: pointer;\n justify-content: center;\n align-items: center;\n /* margin-right: 16px; */\n border-radius: 4px;\n border: 1px solid #c7ced4;\n background: rgba(255, 255, 255, 0.2);\n }\n\n .time-value--selected {\n background: #a5d3f3;\n }\n\n .time-value:last-child {\n margin-right: 0;\n }\n\n .time-value:hover {\n background: #e5e9eb;\n }\n\n .time-value--selected:hover {\n background-color: #a5d3f3;\n }\n\n .hidden {\n display: none !important;\n }\n\n .calendar-timezone {\n padding: 0 16px;\n }\n\n .unit-input-container {\n display: flex;\n justify-content: space-between;\n gap: 8px;\n padding: 0px 24px;\n }\n\n .button-container--relative {\n width: 100%;\n text-align: right;\n padding: 24px;\n box-sizing: border-box;\n }\n\n .duration-input {\n width: 140px;\n }\n\n .time-input {\n width: 140px;\n }\n\n .minute-values {\n gap: 16px;\n }\n\n .weeks-values {\n gap: 16px;\n }\n\n .months-values {\n gap: 16px;\n }\n\n .not-allowed {\n pointer-events: none;\n color:var(--nile-colors-dark-500);\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -17,7 +17,7 @@ import { NileDropdown } from '../nile-dropdown';
|
|
17
17
|
*/
|
18
18
|
export declare class NileCalendar extends NileElement {
|
19
19
|
/**
|
20
|
-
|
20
|
+
* The styles for NileCalendar
|
21
21
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
22
22
|
*/
|
23
23
|
static get styles(): CSSResultArray;
|
@@ -26,6 +26,7 @@ export declare class NileCalendar extends NileElement {
|
|
26
26
|
dropdown: NileDropdown;
|
27
27
|
dropDownOpened: boolean;
|
28
28
|
value: any;
|
29
|
+
allowedDates: any;
|
29
30
|
rangeValue: any;
|
30
31
|
valueAttribute: string | null;
|
31
32
|
formattedDate: string | null;
|
@@ -37,6 +38,12 @@ export declare class NileCalendar extends NileElement {
|
|
37
38
|
selectedUnit: string;
|
38
39
|
selectedValue: number;
|
39
40
|
selectedTimeZone: string;
|
41
|
+
validAllowedDates: boolean;
|
42
|
+
firstUpdated(): void;
|
43
|
+
checkValidAllowedDate(): void;
|
44
|
+
hideTimeInput: Boolean;
|
45
|
+
hideDurationFields: String[];
|
46
|
+
hideTimeZone: Boolean;
|
40
47
|
valueChanged(): void;
|
41
48
|
updated(changedProperties: PropertyValues): void;
|
42
49
|
static get observedAttributes(): string[];
|
@@ -51,6 +58,7 @@ export declare class NileCalendar extends NileElement {
|
|
51
58
|
private confimRange;
|
52
59
|
convertTZ(date: Date, tzString: any): Date;
|
53
60
|
isCurrentDate(day: number, month: number, year: number): boolean;
|
61
|
+
isAllowedDate(day: number, month: number, year: number): boolean;
|
54
62
|
private renderMonth;
|
55
63
|
private formatDate;
|
56
64
|
private formatDateRange;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
import { __decorate } from "tslib";
|
8
8
|
import { html, property, } from 'lit-element';
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
9
|
+
import { customElement, state } from 'lit/decorators.js';
|
10
10
|
import { styles } from './nile-calendar.css';
|
11
11
|
import { query } from 'lit/decorators.js';
|
12
12
|
import { watch } from '../internal/watch';
|
@@ -25,6 +25,7 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
25
25
|
this.currentMonth = new Date().getMonth();
|
26
26
|
this.currentYear = new Date().getFullYear();
|
27
27
|
this.dropDownOpened = false;
|
28
|
+
this.allowedDates = {};
|
28
29
|
this.valueAttribute = null;
|
29
30
|
this.formattedDate = null;
|
30
31
|
this.startDate = null;
|
@@ -33,14 +34,47 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
33
34
|
this.range = false;
|
34
35
|
this.type = 'absolute';
|
35
36
|
this.selectedTimeZone = 'local';
|
37
|
+
this.validAllowedDates = true;
|
38
|
+
this.hideTimeInput = false;
|
39
|
+
this.hideDurationFields = [];
|
40
|
+
this.hideTimeZone = false;
|
36
41
|
}
|
37
42
|
/**
|
38
|
-
|
43
|
+
* The styles for NileCalendar
|
39
44
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
40
45
|
*/
|
41
46
|
static get styles() {
|
42
47
|
return [styles];
|
43
48
|
}
|
49
|
+
firstUpdated() {
|
50
|
+
const allowedDatesAttribute = this.getAttribute('allowed-dates');
|
51
|
+
if (allowedDatesAttribute !== null) {
|
52
|
+
try {
|
53
|
+
this.allowedDates = JSON.parse(allowedDatesAttribute);
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
console.error('Error parsing allowed-dates attribute:', error);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
this.validAllowedDates = false;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
checkValidAllowedDate() {
|
64
|
+
if (Object.keys(this.allowedDates).length == 0) {
|
65
|
+
this.validAllowedDates = false;
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
const startDate = new Date(Date.UTC(this.allowedDates?.startDate?.slice(0, 4), this.allowedDates?.startDate?.slice(5, 7) - 1, this.allowedDates?.startDate?.slice(8, 10)));
|
69
|
+
const endDate = new Date(Date.UTC(this.allowedDates?.endDate?.slice(0, 4), this.allowedDates?.endDate?.slice(5, 7) - 1, this.allowedDates?.endDate?.slice(8, 10)));
|
70
|
+
if (startDate > endDate) {
|
71
|
+
console.error('StartDate must be greater than endDate');
|
72
|
+
this.validAllowedDates = false;
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
this.validAllowedDates = true;
|
76
|
+
}
|
77
|
+
}
|
44
78
|
valueChanged() {
|
45
79
|
if (this.range && this.value) {
|
46
80
|
this.rangeValue = this.value;
|
@@ -220,6 +254,17 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
220
254
|
month + 1 === today.getMonth() + 1 &&
|
221
255
|
year === today.getFullYear());
|
222
256
|
}
|
257
|
+
isAllowedDate(day, month, year) {
|
258
|
+
if (!this.validAllowedDates) {
|
259
|
+
return true;
|
260
|
+
}
|
261
|
+
const dateToCheck = new Date(Date.UTC(year, month, day));
|
262
|
+
const startDate = new Date(Date.UTC(this.allowedDates?.startDate?.slice(0, 4), this.allowedDates?.startDate?.slice(5, 7) - 1, this.allowedDates?.startDate?.slice(8, 10)));
|
263
|
+
const endDate = new Date(Date.UTC(this.allowedDates?.endDate?.slice(0, 4), this.allowedDates?.endDate?.slice(5, 7) - 1, this.allowedDates?.endDate?.slice(8, 10)));
|
264
|
+
endDate.setUTCHours(23, 59, 59, 999);
|
265
|
+
const isWithinRange = dateToCheck >= startDate && dateToCheck <= endDate;
|
266
|
+
return isWithinRange;
|
267
|
+
}
|
223
268
|
renderMonth(year, month, daysArray) {
|
224
269
|
const firstDay = new Date(year, month, 1).getDay();
|
225
270
|
const lastDay = new Date(year, month + 1, 0).getDay();
|
@@ -296,7 +341,9 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
296
341
|
const isCurrentMonth = index >= fillerDaysBefore.length &&
|
297
342
|
index < fillerDaysBefore.length + daysArray.length;
|
298
343
|
return html ` <div
|
299
|
-
class="day
|
344
|
+
class="day
|
345
|
+
${this.isAllowedDate(day, month, year) ? '' : 'not-allowed'}
|
346
|
+
${isSelectedDate(day, month, year, isCurrentMonth)} ${isInRange(day, month, year, isCurrentMonth)} ${isInRange(day, month, year, isCurrentMonth)
|
300
347
|
? 'in-range'
|
301
348
|
: ''} ${!isCurrentMonth ? 'filler' : ''}
|
302
349
|
${this.isCurrentDate(day, month, year) && isCurrentMonth
|
@@ -513,7 +560,7 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
513
560
|
</div>
|
514
561
|
</div>
|
515
562
|
|
516
|
-
<div class="calendar-timezone ${!this.range ? 'hidden' : ''}">
|
563
|
+
<div class="calendar-timezone ${!this.range || this.hideTimeZone ? 'hidden' : ''}">
|
517
564
|
<nile-select
|
518
565
|
hoist
|
519
566
|
value=${this.selectedTimeZone}
|
@@ -533,35 +580,55 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
533
580
|
</div>
|
534
581
|
|
535
582
|
<div class="unit-container ${this.type !== 'relative' ? 'hidden' : ''}">
|
536
|
-
<div
|
583
|
+
<div
|
584
|
+
class="time-unit-group ${this.hideDurationFields?.includes('minutes')
|
585
|
+
? 'hidden'
|
586
|
+
: ''} "
|
587
|
+
>
|
537
588
|
<div class="time-unit-name"><span>Minutes</span></div>
|
538
589
|
<div class="time-unit-value minute-values">
|
539
590
|
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
540
591
|
</div>
|
541
592
|
</div>
|
542
593
|
|
543
|
-
<div
|
594
|
+
<div
|
595
|
+
class="time-unit-group ${this.hideDurationFields?.includes('hours')
|
596
|
+
? 'hidden'
|
597
|
+
: ''}"
|
598
|
+
>
|
544
599
|
<div class="time-unit-name"><span>Hours</span></div>
|
545
600
|
<div class="time-unit-value hours-values">
|
546
601
|
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
547
602
|
</div>
|
548
603
|
</div>
|
549
604
|
|
550
|
-
<div
|
605
|
+
<div
|
606
|
+
class="time-unit-group ${this.hideDurationFields?.includes('days')
|
607
|
+
? 'hidden'
|
608
|
+
: ''}"
|
609
|
+
>
|
551
610
|
<div class="time-unit-name"><span>Days</span></div>
|
552
611
|
<div class="time-unit-value">
|
553
612
|
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
554
613
|
</div>
|
555
614
|
</div>
|
556
615
|
|
557
|
-
<div
|
616
|
+
<div
|
617
|
+
class="time-unit-group ${this.hideDurationFields?.includes('weeks')
|
618
|
+
? 'hidden'
|
619
|
+
: ''}"
|
620
|
+
>
|
558
621
|
<div class="time-unit-name"><span>Weeks</span></div>
|
559
622
|
<div class="time-unit-value weeks-values ">
|
560
623
|
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
561
624
|
</div>
|
562
625
|
</div>
|
563
626
|
|
564
|
-
<div
|
627
|
+
<div
|
628
|
+
class="time-unit-group ${this.hideDurationFields?.includes('months')
|
629
|
+
? 'hidden'
|
630
|
+
: ''}"
|
631
|
+
>
|
565
632
|
<div class="time-unit-name"><span>Months:</span></div>
|
566
633
|
<div class="time-unit-value months-values ">
|
567
634
|
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
@@ -579,11 +646,11 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
579
646
|
<nile-select class="manual-input time-input" label="Unit of time" style="margin-top:3px" value="${this.selectedUnit}"
|
580
647
|
@nile-change="${this.handleUnitChange}"
|
581
648
|
>
|
582
|
-
<nile-option value="minutes"> Minutes </nile-option>
|
583
|
-
<nile-option value="hours"> Hours </nile-option>
|
584
|
-
<nile-option value="days"> Days </nile-option>
|
585
|
-
<nile-option value="weeks"> Weeks </nile-option>
|
586
|
-
<nile-option value="months"> Months </nile-option>
|
649
|
+
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}"> Minutes </nile-option>
|
650
|
+
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}"> Hours </nile-option>
|
651
|
+
<nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}"> Days </nile-option>
|
652
|
+
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}"> Weeks </nile-option>
|
653
|
+
<nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}"> Months </nile-option>
|
587
654
|
</nile-select>
|
588
655
|
|
589
656
|
</div>
|
@@ -600,18 +667,22 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
600
667
|
${this.range && this.type === 'absolute'
|
601
668
|
? html `
|
602
669
|
<div class="calender-input">
|
603
|
-
<
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
670
|
+
<div>
|
671
|
+
<span class="manual-input-label">From </span>
|
672
|
+
<div class="from">
|
673
|
+
<nile-input class="manual-input" value="${this.formatDate(this.startDate)}" placeholder="DD/MM/YYYY" @nile-change="${this.handleStartDateInput}"></nile-input>
|
674
|
+
<nile-input class="manual-input ${this.hideTimeInput ? 'hidden' : ''}" value="${this.formatTime(this.startDate)}" placeholder="HH:MM:SS" @nile-change="${this.handleStartTimeInput}"> </nile-input>
|
675
|
+
</div>
|
608
676
|
</div>
|
609
|
-
|
610
|
-
<
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
677
|
+
|
678
|
+
<div>
|
679
|
+
<span class="manual-input-label">To </span>
|
680
|
+
<div class="from">
|
681
|
+
<nile-input class="manual-input" value="${this.formatDate(this.endDate)}" placeholder="DD/MM/YYYY" @nile-change="${this.handleEndDateInput}"></nile-input>
|
682
|
+
<nile-input class="manual-input ${this.hideTimeInput ? 'hidden' : ''} " value="${this.formatTime(this.endDate)}" placeholder="HH:MM:SS" @nile-change="${this.handleEndTimeInput}"> </nile-input>
|
683
|
+
</div>
|
684
|
+
</div>
|
685
|
+
|
615
686
|
</div>
|
616
687
|
<div class="button-container">
|
617
688
|
<nile-button class="apply-button" ?disabled="${!this.startDate || !this.endDate}" @click="${this.confimRange}"> Apply</nile-button>
|
@@ -632,6 +703,9 @@ __decorate([
|
|
632
703
|
__decorate([
|
633
704
|
property({ type: Object })
|
634
705
|
], NileCalendar.prototype, "value", void 0);
|
706
|
+
__decorate([
|
707
|
+
property({ type: Object, attribute: 'allowed-dates' })
|
708
|
+
], NileCalendar.prototype, "allowedDates", void 0);
|
635
709
|
__decorate([
|
636
710
|
property({ type: Object })
|
637
711
|
], NileCalendar.prototype, "rangeValue", void 0);
|
@@ -665,6 +739,21 @@ __decorate([
|
|
665
739
|
__decorate([
|
666
740
|
property({ type: String })
|
667
741
|
], NileCalendar.prototype, "selectedTimeZone", void 0);
|
742
|
+
__decorate([
|
743
|
+
state()
|
744
|
+
], NileCalendar.prototype, "validAllowedDates", void 0);
|
745
|
+
__decorate([
|
746
|
+
watch('allowedDates')
|
747
|
+
], NileCalendar.prototype, "checkValidAllowedDate", null);
|
748
|
+
__decorate([
|
749
|
+
property({ type: Boolean, attribute: 'hide-time-input' })
|
750
|
+
], NileCalendar.prototype, "hideTimeInput", void 0);
|
751
|
+
__decorate([
|
752
|
+
property({ type: Array, attribute: 'hide-duration-fields' })
|
753
|
+
], NileCalendar.prototype, "hideDurationFields", void 0);
|
754
|
+
__decorate([
|
755
|
+
property({ type: Boolean, attribute: 'hide-time-zone' })
|
756
|
+
], NileCalendar.prototype, "hideTimeZone", void 0);
|
668
757
|
__decorate([
|
669
758
|
watch('value')
|
670
759
|
], NileCalendar.prototype, "valueChanged", null);
|