@qtoggle/qui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.json +492 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/ISSUE_TEMPLATE/improvement_proposal.md +20 -0
- package/.github/workflows/main.yml +74 -0
- package/.pre-commit-config.yaml +8 -0
- package/LICENSE.txt +177 -0
- package/README.md +4 -0
- package/font/dejavusans-bold.woff +0 -0
- package/font/dejavusans-bolditalic.woff +0 -0
- package/font/dejavusans-italic.woff +0 -0
- package/font/dejavusans-regular.woff +0 -0
- package/img/qui-icons.svg +1937 -0
- package/js/base/base.js +47 -0
- package/js/base/condition-variable.js +92 -0
- package/js/base/errors.js +36 -0
- package/js/base/i18n.js +20 -0
- package/js/base/mixwith.js +135 -0
- package/js/base/require-js-compat.js +78 -0
- package/js/base/signal.js +91 -0
- package/js/base/singleton.js +66 -0
- package/js/base/timer.js +126 -0
- package/js/config.js +184 -0
- package/js/forms/common-fields/check-field.js +42 -0
- package/js/forms/common-fields/choice-buttons-field.js +30 -0
- package/js/forms/common-fields/color-combo-field.js +37 -0
- package/js/forms/common-fields/combo-field.js +108 -0
- package/js/forms/common-fields/common-fields.js +23 -0
- package/js/forms/common-fields/composite-field.js +132 -0
- package/js/forms/common-fields/custom-html-field.js +51 -0
- package/js/forms/common-fields/email-field.js +30 -0
- package/js/forms/common-fields/file-picker-field.js +46 -0
- package/js/forms/common-fields/jquery-ui-field.js +111 -0
- package/js/forms/common-fields/labels-field.js +69 -0
- package/js/forms/common-fields/numeric-field.js +39 -0
- package/js/forms/common-fields/password-field.js +28 -0
- package/js/forms/common-fields/phone-field.js +26 -0
- package/js/forms/common-fields/progress-disk-field.js +69 -0
- package/js/forms/common-fields/push-button-field.js +138 -0
- package/js/forms/common-fields/slider-field.js +51 -0
- package/js/forms/common-fields/text-area-field.js +34 -0
- package/js/forms/common-fields/text-field.js +89 -0
- package/js/forms/common-fields/up-down-field.js +85 -0
- package/js/forms/common-forms/common-forms.js +16 -0
- package/js/forms/common-forms/options-form.js +77 -0
- package/js/forms/common-forms/page-form.js +115 -0
- package/js/forms/form-button.js +202 -0
- package/js/forms/form-field.js +1183 -0
- package/js/forms/form.js +1181 -0
- package/js/forms/forms.js +68 -0
- package/js/global-glass.js +100 -0
- package/js/icons/default-stock.js +173 -0
- package/js/icons/icon.js +64 -0
- package/js/icons/icons.js +16 -0
- package/js/icons/multi-state-sprites-icon.js +362 -0
- package/js/icons/stock-icon.js +219 -0
- package/js/icons/stock.js +98 -0
- package/js/icons/stocks.js +57 -0
- package/js/index.js +232 -0
- package/js/lib/jquery.longpress.js +79 -0
- package/js/lib/jquery.module.js +4 -0
- package/js/lib/logger.module.js +4 -0
- package/js/lib/pep.module.js +4 -0
- package/js/lists/common-items/common-items.js +5 -0
- package/js/lists/common-items/icon-label-list-item.js +86 -0
- package/js/lists/common-lists/common-lists.js +5 -0
- package/js/lists/common-lists/page-list.js +53 -0
- package/js/lists/list-item.js +147 -0
- package/js/lists/list.js +636 -0
- package/js/lists/lists.js +26 -0
- package/js/main-ui/main-ui.js +64 -0
- package/js/main-ui/menu-bar.js +144 -0
- package/js/main-ui/options-bar.js +181 -0
- package/js/main-ui/status.js +185 -0
- package/js/main-ui/top-bar.js +59 -0
- package/js/messages/common-message-forms/common-message-forms.js +7 -0
- package/js/messages/common-message-forms/confirm-message-form.js +81 -0
- package/js/messages/common-message-forms/simple-message-form.js +67 -0
- package/js/messages/common-message-forms/sticky-simple-message-form.js +27 -0
- package/js/messages/message-form.js +107 -0
- package/js/messages/messages.js +21 -0
- package/js/messages/sticky-modal-page.js +98 -0
- package/js/messages/sticky-modal-progress-message.js +27 -0
- package/js/messages/toast.js +164 -0
- package/js/navigation.js +654 -0
- package/js/pages/breadcrumbs.js +124 -0
- package/js/pages/common-pages/common-pages.js +6 -0
- package/js/pages/common-pages/modal-progress-page.js +83 -0
- package/js/pages/common-pages/structured-page.js +46 -0
- package/js/pages/page.js +1018 -0
- package/js/pages/pages-context.js +154 -0
- package/js/pages/pages.js +252 -0
- package/js/pwa.js +337 -0
- package/js/sections/section.js +612 -0
- package/js/sections/sections.js +300 -0
- package/js/tables/common-cells/common-cells.js +7 -0
- package/js/tables/common-cells/icon-label-table-cell.js +68 -0
- package/js/tables/common-cells/push-button-table-cell.js +133 -0
- package/js/tables/common-cells/simple-table-cell.js +37 -0
- package/js/tables/common-tables/common-tables.js +5 -0
- package/js/tables/common-tables/page-table.js +55 -0
- package/js/tables/table-cell.js +198 -0
- package/js/tables/table-row.js +126 -0
- package/js/tables/table.js +492 -0
- package/js/tables/tables.js +36 -0
- package/js/theme.js +304 -0
- package/js/utils/ajax.js +126 -0
- package/js/utils/array.js +194 -0
- package/js/utils/colors.js +445 -0
- package/js/utils/cookies.js +65 -0
- package/js/utils/crypto.js +439 -0
- package/js/utils/css.js +234 -0
- package/js/utils/date.js +300 -0
- package/js/utils/files.js +27 -0
- package/js/utils/gestures.js +165 -0
- package/js/utils/html.js +76 -0
- package/js/utils/misc.js +81 -0
- package/js/utils/object.js +324 -0
- package/js/utils/promise.js +49 -0
- package/js/utils/string.js +192 -0
- package/js/utils/url.js +187 -0
- package/js/utils/utils.js +3 -0
- package/js/utils/visibility-manager.js +211 -0
- package/js/views/common-views/common-views.js +7 -0
- package/js/views/common-views/icon-label-view.js +210 -0
- package/js/views/common-views/progress-view.js +89 -0
- package/js/views/common-views/structured-view.js +368 -0
- package/js/views/view.js +467 -0
- package/js/views/views.js +3 -0
- package/js/widgets/base-widget.js +23 -0
- package/js/widgets/common-widgets/check-button.js +109 -0
- package/js/widgets/common-widgets/choice-buttons.js +322 -0
- package/js/widgets/common-widgets/color-combo.js +104 -0
- package/js/widgets/common-widgets/combo.js +645 -0
- package/js/widgets/common-widgets/common-widgets.js +17 -0
- package/js/widgets/common-widgets/email-input.js +7 -0
- package/js/widgets/common-widgets/file-picker.js +133 -0
- package/js/widgets/common-widgets/labels.js +132 -0
- package/js/widgets/common-widgets/numeric-input.js +49 -0
- package/js/widgets/common-widgets/password-input.js +91 -0
- package/js/widgets/common-widgets/phone-input.js +7 -0
- package/js/widgets/common-widgets/progress-disk.js +174 -0
- package/js/widgets/common-widgets/push-button.js +155 -0
- package/js/widgets/common-widgets/slider.js +455 -0
- package/js/widgets/common-widgets/text-area.js +52 -0
- package/js/widgets/common-widgets/text-input.js +174 -0
- package/js/widgets/common-widgets/up-down.js +351 -0
- package/js/widgets/widgets.js +57 -0
- package/js/window.js +557 -0
- package/jsdoc.conf.json +20 -0
- package/less/base.less +123 -0
- package/less/forms/common-fields.less +101 -0
- package/less/forms/common-forms.less +5 -0
- package/less/forms/form-button.less +21 -0
- package/less/forms/form-field.less +266 -0
- package/less/forms/form.less +131 -0
- package/less/global-glass.less +64 -0
- package/less/icon-label-view.less +82 -0
- package/less/icons.less +144 -0
- package/less/lists.less +105 -0
- package/less/main-ui.less +328 -0
- package/less/messages.less +189 -0
- package/less/no-effects.less +24 -0
- package/less/pages/breadcrumbs.less +98 -0
- package/less/pages/common-pages.less +36 -0
- package/less/pages/page.less +70 -0
- package/less/progress-view.less +51 -0
- package/less/stock-icons.less +43 -0
- package/less/structured-view.less +245 -0
- package/less/tables.less +84 -0
- package/less/theme-dark.less +133 -0
- package/less/theme-light.less +132 -0
- package/less/theme.less +419 -0
- package/less/visibility-manager.less +11 -0
- package/less/widgets/check-button.less +96 -0
- package/less/widgets/choice-buttons.less +160 -0
- package/less/widgets/color-combo.less +33 -0
- package/less/widgets/combo.less +230 -0
- package/less/widgets/common-buttons.less +120 -0
- package/less/widgets/common.less +24 -0
- package/less/widgets/input.less +258 -0
- package/less/widgets/labels.less +81 -0
- package/less/widgets/progress-disk.less +70 -0
- package/less/widgets/slider.less +199 -0
- package/less/widgets/updown.less +115 -0
- package/less/widgets/various.less +36 -0
- package/package.json +47 -0
- package/pyproject.toml +45 -0
- package/qui/__init__.py +110 -0
- package/qui/constants.py +1 -0
- package/qui/exceptions.py +2 -0
- package/qui/j2template.py +71 -0
- package/qui/settings.py +60 -0
- package/qui/templates/manifest.json +25 -0
- package/qui/templates/qui.html +126 -0
- package/qui/templates/service-worker.js +188 -0
- package/qui/web/__init__.py +0 -0
- package/qui/web/tornado.py +220 -0
- package/scripts/postinstall.sh +10 -0
- package/webpack/webpack-adjust-css-urls-loader.js +36 -0
- package/webpack/webpack-common.js +384 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @namespace qui.forms
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as CommonForms from './common-forms/common-forms.js'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Form *applied* state.
|
|
10
|
+
* @alias qui.forms.STATE_APPLIED
|
|
11
|
+
*/
|
|
12
|
+
export const STATE_APPLIED = 'applied'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A form (or form field) validation error.
|
|
17
|
+
* @alias qui.forms.ValidationError
|
|
18
|
+
* @extends Error
|
|
19
|
+
*/
|
|
20
|
+
export class ValidationError extends Error {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @constructs
|
|
24
|
+
* @param {String} [message] the error message to be displayed to the user
|
|
25
|
+
*/
|
|
26
|
+
constructor(message = null) {
|
|
27
|
+
super(message || '')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
toString() {
|
|
31
|
+
return this.message
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A mapping of form errors associated to their corresponding field names.
|
|
38
|
+
* @alias qui.forms.ErrorMapping
|
|
39
|
+
* @extends Error
|
|
40
|
+
*/
|
|
41
|
+
export class ErrorMapping extends Error {
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @constructs
|
|
45
|
+
* @param {Error|Object<String,Error>|qui.forms.ErrorMapping} errors one of:
|
|
46
|
+
* * a single error that will be associated to the form itself
|
|
47
|
+
* * a dictionary with errors mapped to field names which will be used as is
|
|
48
|
+
* * another error mapping object from which errors will be copied
|
|
49
|
+
*/
|
|
50
|
+
constructor(errors) {
|
|
51
|
+
super('Form errors')
|
|
52
|
+
|
|
53
|
+
if (errors instanceof ErrorMapping) {
|
|
54
|
+
this.errors = errors.errors
|
|
55
|
+
}
|
|
56
|
+
else if (errors instanceof Error) {
|
|
57
|
+
this.errors = {'': errors}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.errors = errors
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function init() {
|
|
67
|
+
CommonForms.init()
|
|
68
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @namespace qui.globalglass
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import $ from '$qui/lib/jquery.module.js'
|
|
6
|
+
|
|
7
|
+
import * as Theme from '$qui/theme.js'
|
|
8
|
+
import {asap} from '$qui/utils/misc.js'
|
|
9
|
+
import * as Window from '$qui/window.js'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
let mainContainer
|
|
13
|
+
let globalGlass
|
|
14
|
+
let glassContainer
|
|
15
|
+
|
|
16
|
+
let globalGlassTimeoutHandle = null
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
function show() {
|
|
20
|
+
if (globalGlassTimeoutHandle) {
|
|
21
|
+
clearTimeout(globalGlassTimeoutHandle)
|
|
22
|
+
globalGlassTimeoutHandle = null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Glass itself */
|
|
26
|
+
globalGlass.removeClass('hidden')
|
|
27
|
+
globalGlassTimeoutHandle = asap(function () {
|
|
28
|
+
globalGlassTimeoutHandle = null
|
|
29
|
+
Window.$body.addClass('global-glass-visible')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
glassContainer.addClass('visible').removeClass('hidden')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hide() {
|
|
36
|
+
if (globalGlassTimeoutHandle) {
|
|
37
|
+
clearTimeout(globalGlassTimeoutHandle)
|
|
38
|
+
globalGlassTimeoutHandle = null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
glassContainer.removeClass('visible')
|
|
42
|
+
Window.$body.removeClass('global-glass-visible')
|
|
43
|
+
globalGlassTimeoutHandle = Theme.afterTransition(function () {
|
|
44
|
+
|
|
45
|
+
globalGlassTimeoutHandle = null
|
|
46
|
+
globalGlass.addClass('hidden')
|
|
47
|
+
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Automatically show or hide the global glass, depending on its current content.
|
|
53
|
+
* @alias qui.globalglass.updateVisibility
|
|
54
|
+
*/
|
|
55
|
+
export function updateVisibility() {
|
|
56
|
+
let hasVisiblePages = glassContainer.children('div.qui-page.visible').length > 0
|
|
57
|
+
let hasOtherContent = glassContainer.children().not('div.qui-page').length > 0
|
|
58
|
+
|
|
59
|
+
let isVisible = glassContainer.hasClass('visible')
|
|
60
|
+
let shouldBeVisible = hasVisiblePages || hasOtherContent
|
|
61
|
+
|
|
62
|
+
if (isVisible && !shouldBeVisible) {
|
|
63
|
+
hide()
|
|
64
|
+
}
|
|
65
|
+
else if (!isVisible && shouldBeVisible) {
|
|
66
|
+
show()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Add HTML content to the glass container.
|
|
72
|
+
* @alias qui.globalglass.addContent
|
|
73
|
+
* @param {jQuery} content
|
|
74
|
+
*/
|
|
75
|
+
export function addContent(content) {
|
|
76
|
+
glassContainer.append(content)
|
|
77
|
+
|
|
78
|
+
/* Ensure sticky pages are at the end */
|
|
79
|
+
let children = glassContainer.children('.sticky')
|
|
80
|
+
glassContainer.append(children)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Configure glass modal state. A modal glass will prevent any access to top/menu/option bars.
|
|
85
|
+
* @alias qui.globalglass.setModal
|
|
86
|
+
* @param {Boolean} modal
|
|
87
|
+
*/
|
|
88
|
+
export function setModal(modal) {
|
|
89
|
+
globalGlass.toggleClass('modal', modal)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function init() {
|
|
93
|
+
globalGlass = $('<div></div>', {class: 'qui-global-glass hidden modal'})
|
|
94
|
+
globalGlass.append($('<div></div>', {class: 'qui-global-glass-container'}))
|
|
95
|
+
|
|
96
|
+
Window.$body.append(globalGlass)
|
|
97
|
+
|
|
98
|
+
mainContainer = $('div.qui-main-container')
|
|
99
|
+
glassContainer = globalGlass.children('div.qui-global-glass-container')
|
|
100
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A default icon stock.
|
|
3
|
+
*
|
|
4
|
+
* Defined names are:
|
|
5
|
+
* * `"plus"`
|
|
6
|
+
* * `"minus"`
|
|
7
|
+
* * `"close"`
|
|
8
|
+
* * `"fat-arrow"`
|
|
9
|
+
* * `"slim-arrow"`
|
|
10
|
+
* * `"info"`
|
|
11
|
+
* * `"qmark"`
|
|
12
|
+
* * `"exclam"`
|
|
13
|
+
* * `"check"`
|
|
14
|
+
* * `"wrench"`
|
|
15
|
+
* * `"sliders"`
|
|
16
|
+
* * `"key"`
|
|
17
|
+
* * `"user"`
|
|
18
|
+
* * `"sync"`
|
|
19
|
+
* * `"magnifier"`
|
|
20
|
+
* * `"full-screen"`
|
|
21
|
+
* * `"duplicate"`
|
|
22
|
+
* * `"envelope"`
|
|
23
|
+
* * `"gear"`
|
|
24
|
+
* * `"download"`
|
|
25
|
+
* * `"upload"`
|
|
26
|
+
* * `"file"`
|
|
27
|
+
* * `"menu"`
|
|
28
|
+
* * `"options"`
|
|
29
|
+
*
|
|
30
|
+
* Defined variants are:
|
|
31
|
+
* * `"darkgray"`
|
|
32
|
+
* * `"gray"`
|
|
33
|
+
* * `"lightgray"`
|
|
34
|
+
* * `"white"`
|
|
35
|
+
* * `"blue"`
|
|
36
|
+
* * `"magenta"`
|
|
37
|
+
* * `"red"`
|
|
38
|
+
* * `"orange"`
|
|
39
|
+
* * `"yellow"`
|
|
40
|
+
* * `"green"`
|
|
41
|
+
* * `"cyan"`
|
|
42
|
+
* * `"background"`
|
|
43
|
+
* * `"foreground"`
|
|
44
|
+
* * `"disabled"`
|
|
45
|
+
* * `"interactive"`
|
|
46
|
+
* * `"highlight"`
|
|
47
|
+
* * `"danger"`
|
|
48
|
+
* * `"info"`
|
|
49
|
+
* * `"warning"`
|
|
50
|
+
* * `"error"`
|
|
51
|
+
*
|
|
52
|
+
* Defined variant aliases are:
|
|
53
|
+
* * `"interactive-active" = "interactive brightness(80%)"`
|
|
54
|
+
* * `"highlight-active" = "highlight brightness(80%)"`
|
|
55
|
+
* * `"danger-active" = "danger brightness(80%)"`
|
|
56
|
+
* * `"warning-active" = "warning brightness(80%)"`
|
|
57
|
+
* * `"error-active" = "error brightness(80%)"`
|
|
58
|
+
*
|
|
59
|
+
* @namespace qui.icons.defaultstock
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/* eslint-disable quote-props */
|
|
63
|
+
|
|
64
|
+
import Config from '$qui/config.js'
|
|
65
|
+
import * as Theme from '$qui/theme.js'
|
|
66
|
+
|
|
67
|
+
import Stock from './stock.js'
|
|
68
|
+
import * as Stocks from './stocks.js'
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default stock name, `"qui"`.
|
|
73
|
+
* @alias qui.icons.defaultstock.NAME
|
|
74
|
+
*/
|
|
75
|
+
export const NAME = 'qui'
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
function getQUIStockNameXOffset(name) {
|
|
79
|
+
let xOffset = Theme.getVar(`${name}-icon-x-offset`)
|
|
80
|
+
if (xOffset) {
|
|
81
|
+
return Math.abs(parseFloat(xOffset) / 2)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getQUIStockVariantYOffset(variant) {
|
|
88
|
+
let yOffset = Theme.getVar(`${variant}-icon-y-offset`)
|
|
89
|
+
if (yOffset) {
|
|
90
|
+
return Math.abs(parseFloat(yOffset) / 2)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Return the default icon stock.
|
|
99
|
+
* @alias qui.icons.defaultstock.get
|
|
100
|
+
* @returns {qui.icons.Stock}
|
|
101
|
+
*/
|
|
102
|
+
export function get() {
|
|
103
|
+
return Stocks.get(NAME)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Stocks.register(NAME, function () {
|
|
108
|
+
return new Stock({
|
|
109
|
+
src: `${Config.quiStaticURL}/img/qui-icons.svg`,
|
|
110
|
+
unit: 'rem',
|
|
111
|
+
size: 2,
|
|
112
|
+
width: 80,
|
|
113
|
+
height: 32,
|
|
114
|
+
names: {
|
|
115
|
+
'plus': getQUIStockNameXOffset('plus'),
|
|
116
|
+
'minus': getQUIStockNameXOffset('minus'),
|
|
117
|
+
'close': getQUIStockNameXOffset('close'),
|
|
118
|
+
'fat-arrow': getQUIStockNameXOffset('fat-arrow'),
|
|
119
|
+
'slim-arrow': getQUIStockNameXOffset('slim-arrow'),
|
|
120
|
+
'info': getQUIStockNameXOffset('info'),
|
|
121
|
+
'qmark': getQUIStockNameXOffset('qmark'),
|
|
122
|
+
'exclam': getQUIStockNameXOffset('exclam'),
|
|
123
|
+
'check': getQUIStockNameXOffset('check'),
|
|
124
|
+
'wrench': getQUIStockNameXOffset('wrench'),
|
|
125
|
+
'sliders': getQUIStockNameXOffset('sliders'),
|
|
126
|
+
'key': getQUIStockNameXOffset('key'),
|
|
127
|
+
'user': getQUIStockNameXOffset('user'),
|
|
128
|
+
'sync': getQUIStockNameXOffset('sync'),
|
|
129
|
+
'magnifier': getQUIStockNameXOffset('magnifier'),
|
|
130
|
+
'full-screen': getQUIStockNameXOffset('full-screen'),
|
|
131
|
+
'duplicate': getQUIStockNameXOffset('duplicate'),
|
|
132
|
+
'envelope': getQUIStockNameXOffset('envelope'),
|
|
133
|
+
'gear': getQUIStockNameXOffset('gear'),
|
|
134
|
+
'download': getQUIStockNameXOffset('download'),
|
|
135
|
+
'upload': getQUIStockNameXOffset('upload'),
|
|
136
|
+
'file': getQUIStockNameXOffset('file'),
|
|
137
|
+
'reset': getQUIStockNameXOffset('reset'),
|
|
138
|
+
'menu': getQUIStockNameXOffset('menu'),
|
|
139
|
+
'options': getQUIStockNameXOffset('options')
|
|
140
|
+
},
|
|
141
|
+
variants: {
|
|
142
|
+
'darkgray': getQUIStockVariantYOffset('darkgray'),
|
|
143
|
+
'gray': getQUIStockVariantYOffset('gray'),
|
|
144
|
+
'lightgray': getQUIStockVariantYOffset('lightgray'),
|
|
145
|
+
'white': getQUIStockVariantYOffset('white'),
|
|
146
|
+
'blue': getQUIStockVariantYOffset('blue'),
|
|
147
|
+
'magenta': getQUIStockVariantYOffset('magenta'),
|
|
148
|
+
'red': getQUIStockVariantYOffset('red'),
|
|
149
|
+
'orange': getQUIStockVariantYOffset('orange'),
|
|
150
|
+
'yellow': getQUIStockVariantYOffset('yellow'),
|
|
151
|
+
'green': getQUIStockVariantYOffset('green'),
|
|
152
|
+
'cyan': getQUIStockVariantYOffset('cyan'),
|
|
153
|
+
|
|
154
|
+
'background': getQUIStockVariantYOffset('background'),
|
|
155
|
+
'foreground': getQUIStockVariantYOffset('foreground'),
|
|
156
|
+
'foreground-interactive': getQUIStockVariantYOffset('foreground-interactive'),
|
|
157
|
+
'disabled': getQUIStockVariantYOffset('disabled'),
|
|
158
|
+
'interactive': getQUIStockVariantYOffset('interactive'),
|
|
159
|
+
'highlight': getQUIStockVariantYOffset('highlight'),
|
|
160
|
+
'danger': getQUIStockVariantYOffset('danger'),
|
|
161
|
+
'info': getQUIStockVariantYOffset('info'),
|
|
162
|
+
'warning': getQUIStockVariantYOffset('warning'),
|
|
163
|
+
'error': getQUIStockVariantYOffset('error')
|
|
164
|
+
},
|
|
165
|
+
variantAliases: {
|
|
166
|
+
'interactive-active': 'interactive brightness(80%)',
|
|
167
|
+
'highlight-active': 'highlight brightness(80%)',
|
|
168
|
+
'danger-active': 'danger brightness(80%)',
|
|
169
|
+
'warning-active': 'warning brightness(80%)',
|
|
170
|
+
'error-active': 'error brightness(80%)'
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
})
|
package/js/icons/icon.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
const ICON_DATA_ATTR = '_icon'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A base class for icons.
|
|
7
|
+
* @alias qui.icons.Icon
|
|
8
|
+
*/
|
|
9
|
+
class Icon {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @constructs
|
|
13
|
+
* @param {String} [animation] optional icon CSS animation
|
|
14
|
+
*/
|
|
15
|
+
constructor({animation = null}) {
|
|
16
|
+
this._animation = animation
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Apply the icon to an HTML element.
|
|
21
|
+
* @param {jQuery} element the element to which the icon will be applied
|
|
22
|
+
*/
|
|
23
|
+
applyTo(element) {
|
|
24
|
+
this.renderTo(element)
|
|
25
|
+
element.data(ICON_DATA_ATTR, this)
|
|
26
|
+
|
|
27
|
+
if (this._animation) {
|
|
28
|
+
element.css('animation', this._animation)
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
element.css('animation', '')
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Effectively render the icon onto the HTML element.
|
|
37
|
+
* @param {jQuery} element the element onto which the icon will be rendered
|
|
38
|
+
*/
|
|
39
|
+
renderTo(element) {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Return a dictionary of icon attributes that can be passed to constructor.
|
|
44
|
+
* @returns {Object}
|
|
45
|
+
*/
|
|
46
|
+
toAttributes() {
|
|
47
|
+
return {
|
|
48
|
+
animation: this._animation
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Return the icon that has been previously applied to an element.
|
|
54
|
+
* @param {jQuery} element
|
|
55
|
+
* @returns {?qui.icons.Icon} the icon or `null` if no icon has been applied to element
|
|
56
|
+
*/
|
|
57
|
+
static getFromElement(element) {
|
|
58
|
+
return element.data(ICON_DATA_ATTR) || null
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export default Icon
|