@nectary/components 0.29.1 → 0.31.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/accordion-item/types.d.ts +1 -2
- package/accordion-item/utils.d.ts +2 -1
- package/alert/index.js +1 -1
- package/alert/types.d.ts +1 -2
- package/alert/utils.d.ts +2 -1
- package/alert-button/index.js +1 -1
- package/avatar/types.d.ts +2 -3
- package/avatar/utils.d.ts +3 -2
- package/avatar-status/index.js +1 -3
- package/avatar-status/types.d.ts +1 -2
- package/avatar-status/utils.d.ts +1 -1
- package/button/index.js +1 -1
- package/button/types.d.ts +14 -2
- package/button/utils.d.ts +2 -1
- package/card/index.js +1 -1
- package/card-container/index.js +1 -1
- package/chat-bubble/types.d.ts +2 -3
- package/chat-bubble/utils.d.ts +3 -2
- package/checkbox/index.js +1 -1
- package/colors.json +6 -1
- package/date-picker/index.d.ts +19 -0
- package/date-picker/index.js +419 -0
- package/date-picker/types.d.ts +26 -0
- package/date-picker/utils.d.ts +32 -0
- package/date-picker/utils.js +145 -0
- package/dialog/index.js +23 -5
- package/dropdown-checkbox-option/index.js +1 -1
- package/icon-button/index.js +1 -1
- package/icons/create-icon-class.d.ts +1 -307
- package/icons/keyboard-double-arrow-left/index.d.ts +11 -0
- package/icons/keyboard-double-arrow-left/index.js +4 -0
- package/icons/keyboard-double-arrow-right/index.d.ts +11 -0
- package/icons/keyboard-double-arrow-right/index.js +4 -0
- package/icons-branded/ai/index.d.ts +11 -0
- package/icons-branded/ai/index.js +4 -0
- package/icons-branded/chat/index.d.ts +11 -0
- package/icons-branded/chat/index.js +4 -0
- package/icons-branded/create-icon-class.d.ts +1 -311
- package/icons-branded/custom-message/index.d.ts +11 -0
- package/icons-branded/custom-message/index.js +4 -0
- package/icons-branded/integration/index.d.ts +11 -0
- package/icons-branded/integration/index.js +4 -0
- package/icons-branded/line-chart-down/index.d.ts +11 -0
- package/icons-branded/line-chart-down/index.js +4 -0
- package/icons-branded/line-chart-up/index.d.ts +11 -0
- package/icons-branded/line-chart-up/index.js +4 -0
- package/icons-branded/mms/index.d.ts +11 -0
- package/icons-branded/mms/index.js +4 -0
- package/icons-branded/push/index.d.ts +11 -0
- package/icons-branded/push/index.js +4 -0
- package/icons-branded/rcs/index.d.ts +11 -0
- package/icons-branded/rcs/index.js +4 -0
- package/icons-branded/sms/index.d.ts +11 -0
- package/icons-branded/sms/index.js +4 -0
- package/icons-branded/time/index.d.ts +11 -0
- package/icons-branded/time/index.js +4 -0
- package/icons-channel/apple-business-chat-square/index.d.ts +11 -0
- package/icons-channel/apple-business-chat-square/index.js +4 -0
- package/icons-channel/create-icon-class.d.ts +1 -310
- package/icons-channel/create-icon-class.js +1 -1
- package/icons-channel/facebook-messenger-square/index.d.ts +11 -0
- package/icons-channel/facebook-messenger-square/index.js +4 -0
- package/icons-channel/instagram-square/index.d.ts +11 -0
- package/icons-channel/instagram-square/index.js +4 -0
- package/icons-channel/line-square/index.d.ts +11 -0
- package/icons-channel/line-square/index.js +4 -0
- package/icons-channel/talk-square/index.d.ts +11 -0
- package/icons-channel/talk-square/index.js +4 -0
- package/icons-channel/telegram-square/index.d.ts +11 -0
- package/icons-channel/telegram-square/index.js +4 -0
- package/icons-channel/twitter-square/index.d.ts +11 -0
- package/icons-channel/twitter-square/index.js +4 -0
- package/icons-channel/viber-square/index.d.ts +11 -0
- package/icons-channel/viber-square/index.js +4 -0
- package/icons-channel/wechat-square/index.d.ts +11 -0
- package/icons-channel/wechat-square/index.js +4 -0
- package/icons-channel/whatsapp-square/index.d.ts +11 -0
- package/icons-channel/whatsapp-square/index.js +4 -0
- package/illustrations/5g/index.d.ts +11 -0
- package/illustrations/5g/index.js +4 -0
- package/illustrations/about-page/index.d.ts +11 -0
- package/illustrations/about-page/index.js +4 -0
- package/illustrations/bank/index.d.ts +11 -0
- package/illustrations/bank/index.js +4 -0
- package/illustrations/boost/index.d.ts +11 -0
- package/illustrations/boost/index.js +4 -0
- package/illustrations/buildvoicebot/index.d.ts +11 -0
- package/illustrations/buildvoicebot/index.js +4 -0
- package/illustrations/call-center/index.d.ts +11 -0
- package/illustrations/call-center/index.js +4 -0
- package/illustrations/cat-texting/index.d.ts +11 -0
- package/illustrations/cat-texting/index.js +4 -0
- package/illustrations/chat-bot/index.d.ts +11 -0
- package/illustrations/chat-bot/index.js +4 -0
- package/illustrations/check/index.d.ts +11 -0
- package/illustrations/check/index.js +4 -0
- package/illustrations/code/index.d.ts +11 -0
- package/illustrations/code/index.js +4 -0
- package/illustrations/contact-us/index.d.ts +11 -0
- package/illustrations/contact-us/index.js +4 -0
- package/illustrations/contactus/index.d.ts +11 -0
- package/illustrations/contactus/index.js +4 -0
- package/illustrations/conversation-api/index.d.ts +11 -0
- package/illustrations/conversation-api/index.js +4 -0
- package/illustrations/cooking/index.d.ts +11 -0
- package/illustrations/cooking/index.js +4 -0
- package/illustrations/costumer-support/index.d.ts +11 -0
- package/illustrations/costumer-support/index.js +4 -0
- package/illustrations/create-illustration-class.d.ts +1 -0
- package/illustrations/create-illustration-class.js +68 -0
- package/illustrations/credit-card/index.d.ts +11 -0
- package/illustrations/credit-card/index.js +4 -0
- package/illustrations/credit-card-30-degrees/index.d.ts +11 -0
- package/illustrations/credit-card-30-degrees/index.js +4 -0
- package/illustrations/cute-bee/index.d.ts +11 -0
- package/illustrations/cute-bee/index.js +4 -0
- package/illustrations/decorative-flamingo/index.d.ts +11 -0
- package/illustrations/decorative-flamingo/index.js +4 -0
- package/illustrations/decorative-rainbow/index.d.ts +11 -0
- package/illustrations/decorative-rainbow/index.js +4 -0
- package/illustrations/delivery-service-package/index.d.ts +11 -0
- package/illustrations/delivery-service-package/index.js +4 -0
- package/illustrations/desktop/index.d.ts +11 -0
- package/illustrations/desktop/index.js +4 -0
- package/illustrations/document/index.d.ts +11 -0
- package/illustrations/document/index.js +4 -0
- package/illustrations/flower-hand/index.d.ts +11 -0
- package/illustrations/flower-hand/index.js +4 -0
- package/illustrations/football/index.d.ts +11 -0
- package/illustrations/football/index.js +4 -0
- package/illustrations/geometric-shapes-passing/index.d.ts +11 -0
- package/illustrations/geometric-shapes-passing/index.js +4 -0
- package/illustrations/girl-on-phone/index.d.ts +11 -0
- package/illustrations/girl-on-phone/index.js +4 -0
- package/illustrations/global-reach/index.d.ts +11 -0
- package/illustrations/global-reach/index.js +4 -0
- package/illustrations/hand-ok/index.d.ts +11 -0
- package/illustrations/hand-ok/index.js +4 -0
- package/illustrations/hands-laptop/index.d.ts +11 -0
- package/illustrations/hands-laptop/index.js +4 -0
- package/illustrations/handset-omnichannel-messages/index.d.ts +11 -0
- package/illustrations/handset-omnichannel-messages/index.js +4 -0
- package/illustrations/happy-text/index.d.ts +11 -0
- package/illustrations/happy-text/index.js +4 -0
- package/illustrations/headphones/index.d.ts +11 -0
- package/illustrations/headphones/index.js +4 -0
- package/illustrations/heart/index.d.ts +11 -0
- package/illustrations/heart/index.js +4 -0
- package/illustrations/hero-messages/index.d.ts +11 -0
- package/illustrations/hero-messages/index.js +4 -0
- package/illustrations/hero-page/index.d.ts +11 -0
- package/illustrations/hero-page/index.js +4 -0
- package/illustrations/jump/index.d.ts +11 -0
- package/illustrations/jump/index.js +4 -0
- package/illustrations/laptop-holding/index.d.ts +11 -0
- package/illustrations/laptop-holding/index.js +4 -0
- package/illustrations/laptop-sitting-verified/index.d.ts +11 -0
- package/illustrations/laptop-sitting-verified/index.js +4 -0
- package/illustrations/lightning/index.d.ts +11 -0
- package/illustrations/lightning/index.js +4 -0
- package/illustrations/lock/index.d.ts +11 -0
- package/illustrations/lock/index.js +4 -0
- package/illustrations/lying-and-looking-at-the-phone/index.d.ts +11 -0
- package/illustrations/lying-and-looking-at-the-phone/index.js +4 -0
- package/illustrations/magnifying-glass/index.d.ts +11 -0
- package/illustrations/magnifying-glass/index.js +4 -0
- package/illustrations/man-on-right/index.d.ts +11 -0
- package/illustrations/man-on-right/index.js +4 -0
- package/illustrations/meeting-scrum/index.d.ts +11 -0
- package/illustrations/meeting-scrum/index.js +4 -0
- package/illustrations/meeting-scrum-2/index.d.ts +11 -0
- package/illustrations/meeting-scrum-2/index.js +4 -0
- package/illustrations/megaphone/index.d.ts +11 -0
- package/illustrations/megaphone/index.js +4 -0
- package/illustrations/menu/index.d.ts +11 -0
- package/illustrations/menu/index.js +4 -0
- package/illustrations/message-passing/index.d.ts +11 -0
- package/illustrations/message-passing/index.js +4 -0
- package/illustrations/message-recieved/index.d.ts +11 -0
- package/illustrations/message-recieved/index.js +4 -0
- package/illustrations/messages/index.d.ts +11 -0
- package/illustrations/messages/index.js +4 -0
- package/illustrations/messages-on-yellow-bg/index.d.ts +11 -0
- package/illustrations/messages-on-yellow-bg/index.js +4 -0
- package/illustrations/messages-shopping/index.d.ts +11 -0
- package/illustrations/messages-shopping/index.js +4 -0
- package/illustrations/monitor/index.d.ts +11 -0
- package/illustrations/monitor/index.js +4 -0
- package/illustrations/numbers-passing/index.d.ts +11 -0
- package/illustrations/numbers-passing/index.js +4 -0
- package/illustrations/office-worker/index.d.ts +11 -0
- package/illustrations/office-worker/index.js +4 -0
- package/illustrations/old-person-on-phone/index.d.ts +11 -0
- package/illustrations/old-person-on-phone/index.js +4 -0
- package/illustrations/omnichannel-messaging/index.d.ts +11 -0
- package/illustrations/omnichannel-messaging/index.js +4 -0
- package/illustrations/on-the-phone/index.d.ts +11 -0
- package/illustrations/on-the-phone/index.js +4 -0
- package/illustrations/parcel-delivery/index.d.ts +11 -0
- package/illustrations/parcel-delivery/index.js +4 -0
- package/illustrations/passing-heart/index.d.ts +11 -0
- package/illustrations/passing-heart/index.js +4 -0
- package/illustrations/passing-heart-cool/index.d.ts +11 -0
- package/illustrations/passing-heart-cool/index.js +4 -0
- package/illustrations/person-on-phone/index.d.ts +11 -0
- package/illustrations/person-on-phone/index.js +4 -0
- package/illustrations/person-on-walk/index.d.ts +11 -0
- package/illustrations/person-on-walk/index.js +4 -0
- package/illustrations/person-with-dog/index.d.ts +11 -0
- package/illustrations/person-with-dog/index.js +4 -0
- package/illustrations/person-with-phone/index.d.ts +11 -0
- package/illustrations/person-with-phone/index.js +4 -0
- package/illustrations/phone-and-cat/index.js +4 -0
- package/illustrations/pineapple/index.d.ts +11 -0
- package/illustrations/pineapple/index.js +4 -0
- package/illustrations/pizza/index.d.ts +11 -0
- package/illustrations/pizza/index.js +4 -0
- package/illustrations/plane/index.d.ts +11 -0
- package/illustrations/plane/index.js +4 -0
- package/illustrations/presenting-charts/index.d.ts +11 -0
- package/illustrations/presenting-charts/index.js +4 -0
- package/illustrations/product-page/index.d.ts +11 -0
- package/illustrations/product-page/index.js +4 -0
- package/illustrations/product-page-2/index.d.ts +11 -0
- package/illustrations/product-page-2/index.js +4 -0
- package/illustrations/scooter/index.d.ts +11 -0
- package/illustrations/scooter/index.js +4 -0
- package/illustrations/security/index.d.ts +11 -0
- package/illustrations/security/index.js +4 -0
- package/illustrations/security-camera/index.d.ts +11 -0
- package/illustrations/security-camera/index.js +4 -0
- package/illustrations/sherlockholmes/index.d.ts +11 -0
- package/illustrations/sherlockholmes/index.js +4 -0
- package/illustrations/shoe/index.d.ts +11 -0
- package/illustrations/shoe/index.js +4 -0
- package/illustrations/shopping/index.d.ts +11 -0
- package/illustrations/shopping/index.js +4 -0
- package/illustrations/shopping-cart/index.d.ts +11 -0
- package/illustrations/shopping-cart/index.js +4 -0
- package/illustrations/sick-kid/index.d.ts +11 -0
- package/illustrations/sick-kid/index.js +4 -0
- package/illustrations/sitting-messaging/index.d.ts +11 -0
- package/illustrations/sitting-messaging/index.js +4 -0
- package/illustrations/sitting-person/index.d.ts +11 -0
- package/illustrations/sitting-person/index.js +4 -0
- package/illustrations/sitting-person-2/index.d.ts +11 -0
- package/illustrations/sitting-person-2/index.js +4 -0
- package/illustrations/sofa/index.d.ts +11 -0
- package/illustrations/sofa/index.js +4 -0
- package/illustrations/stats/index.d.ts +11 -0
- package/illustrations/stats/index.js +4 -0
- package/illustrations/support-center/index.d.ts +11 -0
- package/illustrations/support-center/index.js +4 -0
- package/illustrations/supporting-device/index.d.ts +11 -0
- package/illustrations/supporting-device/index.js +4 -0
- package/illustrations/supporting-device-2/index.d.ts +11 -0
- package/illustrations/supporting-device-2/index.js +4 -0
- package/illustrations/supporting-device-3/index.d.ts +11 -0
- package/illustrations/supporting-device-3/index.js +4 -0
- package/illustrations/supporting-device-4/index.d.ts +11 -0
- package/illustrations/supporting-device-4/index.js +4 -0
- package/illustrations/surf/index.d.ts +11 -0
- package/illustrations/surf/index.js +4 -0
- package/illustrations/taxi/index.d.ts +11 -0
- package/illustrations/taxi/index.js +4 -0
- package/illustrations/taxi-2/index.d.ts +11 -0
- package/illustrations/taxi-2/index.js +4 -0
- package/illustrations/teamwork-from-phone/index.d.ts +11 -0
- package/illustrations/teamwork-from-phone/index.js +4 -0
- package/illustrations/telemast/index.d.ts +11 -0
- package/illustrations/telemast/index.js +4 -0
- package/illustrations/texting-sitting/index.d.ts +11 -0
- package/illustrations/texting-sitting/index.js +4 -0
- package/illustrations/texting-sofa/index.d.ts +11 -0
- package/illustrations/texting-sofa/index.js +4 -0
- package/illustrations/train/index.d.ts +11 -0
- package/illustrations/train/index.js +4 -0
- package/illustrations/types.d.ts +16 -0
- package/illustrations/types.js +1 -0
- package/illustrations/utils.d.ts +3 -0
- package/illustrations/utils.js +2 -0
- package/illustrations/video-voice-call/index.d.ts +11 -0
- package/illustrations/video-voice-call/index.js +4 -0
- package/illustrations/voicebot/index.d.ts +11 -0
- package/illustrations/voicebot/index.js +4 -0
- package/illustrations/walking-on-phone/index.d.ts +11 -0
- package/illustrations/walking-on-phone/index.js +4 -0
- package/illustrations/what-tools/index.d.ts +11 -0
- package/illustrations/what-tools/index.js +4 -0
- package/illustrations/win-together/index.d.ts +11 -0
- package/illustrations/win-together/index.js +4 -0
- package/illustrations/win-together-two-people/index.d.ts +11 -0
- package/illustrations/win-together-two-people/index.js +4 -0
- package/illustrations/wizard/index.d.ts +11 -0
- package/illustrations/wizard/index.js +4 -0
- package/illustrations/woman-hand-lifted/index.d.ts +11 -0
- package/illustrations/woman-hand-lifted/index.js +4 -0
- package/illustrations/woman-on-left/index.d.ts +11 -0
- package/illustrations/woman-on-left/index.js +4 -0
- package/illustrations/woman-on-right/index.d.ts +11 -0
- package/illustrations/woman-on-right/index.js +4 -0
- package/input/index.js +1 -1
- package/input/types.d.ts +38 -12
- package/input/utils.d.ts +2 -1
- package/link/index.js +18 -4
- package/link/types.d.ts +0 -2
- package/logo/create-logo-class.d.ts +1 -311
- package/package.json +1 -1
- package/popover/index.js +76 -47
- package/popover/types.d.ts +1 -2
- package/popover/utils.d.ts +2 -1
- package/search/index.js +1 -1
- package/segment/index.d.ts +1 -0
- package/segment/index.js +109 -6
- package/segment/types.d.ts +4 -0
- package/segment/utils.d.ts +5 -0
- package/segment/utils.js +6 -0
- package/select/index.js +1 -1
- package/spinner/types.d.ts +1 -2
- package/spinner/utils.d.ts +2 -1
- package/table-cell/types.d.ts +4 -5
- package/table-cell/utils.d.ts +2 -1
- package/table-head-cell/types.d.ts +4 -4
- package/tag/index.js +1 -1
- package/tag/types.d.ts +1 -2
- package/tag/utils.d.ts +2 -1
- package/text/index.js +0 -1
- package/text/types.d.ts +1 -2
- package/text/utils.d.ts +1 -1
- package/textarea/index.js +1 -1
- package/theme.css +17 -0
- package/title/index.js +0 -2
- package/title/types.d.ts +2 -3
- package/title/utils.d.ts +4 -3
- package/title/utils.js +21 -0
- package/toggle/index.js +1 -1
- package/tooltip/index.js +1 -1
- package/tooltip/types.d.ts +1 -2
- package/tooltip/utils.d.ts +2 -1
- package/utils.d.ts +4 -0
- package/utils.js +35 -4
- package/illustration/create-illustration-class.d.ts +0 -310
- package/illustration/create-illustration-class.js +0 -51
- package/illustration/phone-and-cat/index.js +0 -4
- package/illustration/types.d.ts +0 -8
- /package/{illustration → date-picker}/types.js +0 -0
- /package/{illustration → illustrations}/phone-and-cat/index.d.ts +0 -0
package/segment/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$caption, _$collapseSlot;
|
|
4
|
+
var _$caption, _$previewSlot, _$previewWrapper, _$infoSlot, _$infoWrapper, _$collapseSlot, _$collapseWrapper, _onPreviewSlotChange, _onInfoSlotChange, _onCollapseSlotChange;
|
|
5
5
|
|
|
6
6
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
10
|
+
import '../title';
|
|
11
|
+
import { getTitleLevelFromType } from '../title/utils';
|
|
12
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
13
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;gap:16px;width:100%;height:100%;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);box-shadow:var(--sinch-elevation-level-2);padding:8px 24px 16px}#header{display:flex;flex-direction:row;align-items:center;height:48px;gap:8px;--sinch-size-icon:32px}#caption{font:var(--sinch-font-title-l);color:var(--sinch-color-text-default);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:1em}#info{display:flex;flex-direction:row;align-items:center;gap:8px;margin-left:auto;align-self:stretch}#info.empty{display:none}#preview{flex:1;flex-basis:auto;height:48px;min-width:0;overflow:hidden;margin-left:24px}#preview.empty{display:none}#info.empty+#collapse{margin-left:auto}#collapse.empty{display:none}#preview:not(.empty)+#info.empty+#collapse:not(.empty),#preview:not(.empty)+#info:not(.empty){margin-left:24px}#content-wrapper{flex:1;min-height:0;overflow-y:auto}#action{display:flex;flex-direction:row;justify-content:flex-end;gap:16px}:host([collapsed]:not([collapsed=false])) :is(#content-wrapper,#action){display:none}:host([collapsed]:not([collapsed=false])) #wrapper{padding-bottom:8px}::slotted([slot=icon]){margin-right:8px}</style><div id="wrapper"><div id="header"><slot name="icon"></slot><sinch-title id="caption" level="3" type="m"></sinch-title><div id="preview"><slot name="preview"></slot></div><div id="info"><slot name="info"></slot></div><div id="collapse"><slot name="collapse"></slot></div></div><div id="content-wrapper"><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
|
|
14
|
+
import { assertSize, sizeValues } from './utils';
|
|
12
15
|
const template = document.createElement('template');
|
|
13
16
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-segment', (_$caption = new WeakMap(), _$collapseSlot = new WeakMap(), class extends NectaryElement {
|
|
17
|
+
defineCustomElement('sinch-segment', (_$caption = new WeakMap(), _$previewSlot = new WeakMap(), _$previewWrapper = new WeakMap(), _$infoSlot = new WeakMap(), _$infoWrapper = new WeakMap(), _$collapseSlot = new WeakMap(), _$collapseWrapper = new WeakMap(), _onPreviewSlotChange = new WeakMap(), _onInfoSlotChange = new WeakMap(), _onCollapseSlotChange = new WeakMap(), class extends NectaryElement {
|
|
15
18
|
constructor() {
|
|
16
19
|
super();
|
|
17
20
|
|
|
@@ -20,28 +23,120 @@ defineCustomElement('sinch-segment', (_$caption = new WeakMap(), _$collapseSlot
|
|
|
20
23
|
value: void 0
|
|
21
24
|
});
|
|
22
25
|
|
|
26
|
+
_classPrivateFieldInitSpec(this, _$previewSlot, {
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
_classPrivateFieldInitSpec(this, _$previewWrapper, {
|
|
32
|
+
writable: true,
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
_classPrivateFieldInitSpec(this, _$infoSlot, {
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
_classPrivateFieldInitSpec(this, _$infoWrapper, {
|
|
42
|
+
writable: true,
|
|
43
|
+
value: void 0
|
|
44
|
+
});
|
|
45
|
+
|
|
23
46
|
_classPrivateFieldInitSpec(this, _$collapseSlot, {
|
|
24
47
|
writable: true,
|
|
25
48
|
value: void 0
|
|
26
49
|
});
|
|
27
50
|
|
|
51
|
+
_classPrivateFieldInitSpec(this, _$collapseWrapper, {
|
|
52
|
+
writable: true,
|
|
53
|
+
value: void 0
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
_classPrivateFieldInitSpec(this, _onPreviewSlotChange, {
|
|
57
|
+
writable: true,
|
|
58
|
+
value: () => {
|
|
59
|
+
setClass(_classPrivateFieldGet(this, _$previewWrapper), 'empty', _classPrivateFieldGet(this, _$previewSlot).assignedElements().length === 0);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
_classPrivateFieldInitSpec(this, _onInfoSlotChange, {
|
|
64
|
+
writable: true,
|
|
65
|
+
value: () => {
|
|
66
|
+
setClass(_classPrivateFieldGet(this, _$infoWrapper), 'empty', _classPrivateFieldGet(this, _$infoSlot).assignedElements().length === 0);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_classPrivateFieldInitSpec(this, _onCollapseSlotChange, {
|
|
71
|
+
writable: true,
|
|
72
|
+
value: () => {
|
|
73
|
+
setClass(_classPrivateFieldGet(this, _$collapseWrapper), 'empty', _classPrivateFieldGet(this, _$collapseSlot).assignedElements().length === 0);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
28
77
|
const shadowRoot = this.attachShadow();
|
|
29
78
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
30
79
|
|
|
31
80
|
_classPrivateFieldSet(this, _$caption, shadowRoot.querySelector('#caption'));
|
|
32
81
|
|
|
82
|
+
_classPrivateFieldSet(this, _$previewSlot, shadowRoot.querySelector('slot[name="preview"]'));
|
|
83
|
+
|
|
84
|
+
_classPrivateFieldSet(this, _$infoSlot, shadowRoot.querySelector('slot[name="info"]'));
|
|
85
|
+
|
|
33
86
|
_classPrivateFieldSet(this, _$collapseSlot, shadowRoot.querySelector('slot[name="collapse"]'));
|
|
87
|
+
|
|
88
|
+
_classPrivateFieldSet(this, _$previewWrapper, shadowRoot.querySelector('#preview'));
|
|
89
|
+
|
|
90
|
+
_classPrivateFieldSet(this, _$infoWrapper, shadowRoot.querySelector('#info'));
|
|
91
|
+
|
|
92
|
+
_classPrivateFieldSet(this, _$collapseWrapper, shadowRoot.querySelector('#collapse'));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
connectedCallback() {
|
|
96
|
+
_classPrivateFieldGet(this, _$previewSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onPreviewSlotChange));
|
|
97
|
+
|
|
98
|
+
_classPrivateFieldGet(this, _$infoSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onInfoSlotChange));
|
|
99
|
+
|
|
100
|
+
_classPrivateFieldGet(this, _$collapseSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onCollapseSlotChange));
|
|
101
|
+
|
|
102
|
+
_classPrivateFieldGet(this, _onPreviewSlotChange).call(this);
|
|
103
|
+
|
|
104
|
+
_classPrivateFieldGet(this, _onInfoSlotChange).call(this);
|
|
105
|
+
|
|
106
|
+
_classPrivateFieldGet(this, _onCollapseSlotChange).call(this);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
disconnectedCallback() {
|
|
110
|
+
_classPrivateFieldGet(this, _$previewSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onPreviewSlotChange));
|
|
111
|
+
|
|
112
|
+
_classPrivateFieldGet(this, _$infoSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onInfoSlotChange));
|
|
113
|
+
|
|
114
|
+
_classPrivateFieldGet(this, _$collapseSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onCollapseSlotChange));
|
|
34
115
|
}
|
|
35
116
|
|
|
36
117
|
static get observedAttributes() {
|
|
37
|
-
return ['caption'];
|
|
118
|
+
return ['caption', 'collapsed', 'size'];
|
|
38
119
|
}
|
|
39
120
|
|
|
40
121
|
attributeChangedCallback(name, _, newVal) {
|
|
41
122
|
switch (name) {
|
|
42
123
|
case 'caption':
|
|
43
124
|
{
|
|
44
|
-
_classPrivateFieldGet(this, _$caption)
|
|
125
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
case 'collapsed':
|
|
130
|
+
{
|
|
131
|
+
updateBooleanAttribute(this, 'collapsed', isAttrTrue(newVal));
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case 'size':
|
|
136
|
+
{
|
|
137
|
+
assertSize(newVal);
|
|
138
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'type', newVal);
|
|
139
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'level', getTitleLevelFromType(newVal));
|
|
45
140
|
break;
|
|
46
141
|
}
|
|
47
142
|
}
|
|
@@ -63,6 +158,14 @@ defineCustomElement('sinch-segment', (_$caption = new WeakMap(), _$collapseSlot
|
|
|
63
158
|
return getBooleanAttribute(this, 'collapsed');
|
|
64
159
|
}
|
|
65
160
|
|
|
161
|
+
get size() {
|
|
162
|
+
return getLiteralAttribute(this, sizeValues, 'size', 'm');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
set size(value) {
|
|
166
|
+
updateLiteralAttribute(this, sizeValues, 'size', value);
|
|
167
|
+
}
|
|
168
|
+
|
|
66
169
|
get collapseButtonRect() {
|
|
67
170
|
const $collapseButton = _classPrivateFieldGet(this, _$collapseSlot).assignedElements()[0];
|
|
68
171
|
|
package/segment/types.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
+
export declare type TSinchSegmentSize = 'l' | 'm' | 's';
|
|
2
3
|
export declare type TSinchSegmentElement = HTMLElement & {
|
|
3
4
|
caption: string;
|
|
4
5
|
collapsed: boolean;
|
|
6
|
+
size: TSinchSegmentSize;
|
|
5
7
|
readonly collapseButtonRect: TRect | null;
|
|
6
8
|
setAttribute(name: 'caption', value: string): void;
|
|
7
9
|
setAttribute(name: 'collapsed', value: ''): void;
|
|
10
|
+
setAttribute(name: 'size', value: TSinchSegmentSize): void;
|
|
8
11
|
};
|
|
9
12
|
export declare type TSinchSegmentReact = TSinchElementReact<TSinchSegmentElement> & {
|
|
10
13
|
caption: string;
|
|
11
14
|
collapsed?: boolean;
|
|
15
|
+
size?: TSinchSegmentSize;
|
|
12
16
|
};
|
package/segment/utils.js
ADDED
package/select/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
13
13
|
|
|
14
14
|
import '../dropdown';
|
|
15
15
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateIntegerAttribute } from '../utils';
|
|
16
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{position:relative;--sinch-popover-expand-width:1}sinch-dropdown{display:block}#button{all:initial;display:flex;align-items:center;gap:8px;border:1px solid var(--sinch-color-stormy-200);border-radius:
|
|
16
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{position:relative;--sinch-popover-expand-width:1}sinch-dropdown{display:block}#button{all:initial;display:flex;align-items:center;gap:8px;border:1px solid var(--sinch-color-stormy-200);border-radius:var(--sinch-shape-radius-s);box-sizing:border-box;width:100%;height:48px;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);cursor:pointer}#button:focus{border-color:var(--sinch-color-stormy-600)}#dropdown-icon{fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button[data-unselected]{color:var(--sinch-color-text-muted)}#button:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100);cursor:initial}#button:disabled #dropdown-icon{fill:var(--sinch-color-stormy-100)}:host([invalidtext]:not([invalidtext=""])) #button:not(:disabled){border-color:var(--sinch-color-text-invalid)}#content{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="dropdown"></label><slot name="tooltip"></slot><span id="optional"></span></div><sinch-dropdown id="dropdown"><button slot="target" id="button"><span id="content"></span> <svg id="dropdown-icon" width="12" height="8" aria-hidden="true"><path d="M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2 1.41.59Z"/></svg></button><slot name="option" slot="option"></slot></sinch-dropdown><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
|
|
17
17
|
const template = document.createElement('template');
|
|
18
18
|
template.innerHTML = templateHTML;
|
|
19
19
|
defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _$sh = new WeakMap(), _createElement = new WeakSet(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onLabelClick = new WeakMap(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), class extends NectaryElement {
|
package/spinner/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type TSinchSpinnerType = typeof spinnerTypes[number];
|
|
2
|
+
export declare type TSinchSpinnerType = 'large' | 'medium' | 'small';
|
|
4
3
|
export declare type TSinchSpinnerElement = HTMLElement & {
|
|
5
4
|
type: TSinchSpinnerType;
|
|
6
5
|
setAttribute(name: 'type', value: TSinchSpinnerType): void;
|
package/spinner/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TSinchSpinnerType } from './types';
|
|
2
|
+
export declare const spinnerTypes: readonly TSinchSpinnerType[];
|
package/table-cell/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type TAlignType = typeof alignValues[number];
|
|
2
|
+
export declare type TSinchTableAlignType = 'start' | 'center' | 'end';
|
|
4
3
|
export declare type TSinchTableCellElement = HTMLElement & {
|
|
5
|
-
align:
|
|
6
|
-
setAttribute(name: 'align', value:
|
|
4
|
+
align: TSinchTableAlignType;
|
|
5
|
+
setAttribute(name: 'align', value: TSinchTableAlignType): void;
|
|
7
6
|
};
|
|
8
7
|
export declare type TSinchTableCellReact = TSinchElementReact<TSinchTableCellElement> & {
|
|
9
|
-
align?:
|
|
8
|
+
align?: TSinchTableAlignType;
|
|
10
9
|
};
|
package/table-cell/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TSinchTableAlignType } from './types';
|
|
2
|
+
export declare const alignValues: readonly TSinchTableAlignType[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TSinchTableAlignType } from '../table-cell/types';
|
|
2
2
|
import type { TSinchElementReact } from '../types';
|
|
3
3
|
export declare type TSinchTableHeaderCellElement = HTMLElement & {
|
|
4
4
|
text: string | null;
|
|
5
|
-
align:
|
|
5
|
+
align: TSinchTableAlignType;
|
|
6
6
|
fit: boolean;
|
|
7
7
|
setAttribute(name: 'text', value: string): void;
|
|
8
|
-
setAttribute(name: 'align', value:
|
|
8
|
+
setAttribute(name: 'align', value: TSinchTableAlignType): void;
|
|
9
9
|
setAttribute(name: 'fit', value: ''): void;
|
|
10
10
|
};
|
|
11
11
|
export declare type TSinchTableHeaderCellReact = TSinchElementReact<TSinchTableHeaderCellElement> & {
|
|
12
12
|
text?: string;
|
|
13
13
|
fit?: boolean;
|
|
14
|
-
align?:
|
|
14
|
+
align?: TSinchTableAlignType;
|
|
15
15
|
};
|
package/tag/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
9
9
|
|
|
10
10
|
import '../icons/cancel';
|
|
11
11
|
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
12
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;
|
|
12
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;padding:2px 8px;border-radius:12px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);box-sizing:border-box;--sinch-color-icon:var(--sinch-color-stormy-400);--sinch-size-icon:16px}:host([category=candy])>#wrapper{background-color:var(--sinch-color-candy-200)}:host([category=bolt])>#wrapper{background-color:var(--sinch-color-bolt-200)}:host([category=aqua])>#wrapper{background-color:var(--sinch-color-aqua-200)}:host([category=grass])>#wrapper{background-color:var(--sinch-color-grass-200)}:host([category=berry])>#wrapper{background-color:var(--sinch-color-berry-200)}:host([category=orange])>#wrapper{background-color:var(--sinch-color-orange-200)}:host([category=night])>#wrapper{background-color:var(--sinch-color-night-200)}:host([category=mud])>#wrapper{background-color:var(--sinch-color-mud-200)}:host([category=dirt])>#wrapper{background-color:var(--sinch-color-dirt-200)}:host([inverted]:not([inverted=false]))>#wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-snow-100)}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px;--sinch-size-icon:14px}#text{text-overflow:ellipsis;white-space:nowrap;overflow:auto;flex:1}</style><div id="wrapper"><slot name="icon"></slot><span id="text"></span><slot name="close"></slot></div>';
|
|
13
13
|
import { categoryValues } from './utils';
|
|
14
14
|
const template = document.createElement('template');
|
|
15
15
|
template.innerHTML = templateHTML;
|
package/tag/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type TSinchTagCategory = typeof categoryValues[number];
|
|
2
|
+
export declare type TSinchTagCategory = 'candy' | 'bolt' | 'aqua' | 'grass' | 'berry' | 'orange' | 'night' | 'mud' | 'dirt';
|
|
4
3
|
export declare type TSinchTagElement = HTMLElement & {
|
|
5
4
|
category: TSinchTagCategory | null;
|
|
6
5
|
text: string;
|
package/tag/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TSinchTagCategory } from './types';
|
|
2
|
+
export declare const categoryValues: readonly TSinchTagCategory[];
|
package/text/index.js
CHANGED
package/text/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type TSinchTextType = typeof typeValues[number];
|
|
2
|
+
export declare type TSinchTextType = 'm' | 's' | 'xs' | 'xxs';
|
|
4
3
|
export declare type TSinchTextElement = HTMLElement & {
|
|
5
4
|
type: TSinchTextType;
|
|
6
5
|
inline: boolean;
|
package/text/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchTextType } from './types';
|
|
2
|
-
export declare const typeValues: readonly [
|
|
2
|
+
export declare const typeValues: readonly TSinchTextType[];
|
|
3
3
|
declare type TAssertType = (value: string | null) => asserts value is TSinchTextType;
|
|
4
4
|
export declare const assertType: TAssertType;
|
|
5
5
|
export {};
|
package/textarea/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:
|
|
11
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:focus{border-color:var(--sinch-color-stormy-600)}:host([resizable]:not([resizable=false])) #input{resize:vertical}:host([invalidtext]:not([invalidtext=""])) #input:not(:disabled){border-color:var(--sinch-color-text-invalid)}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><textarea id="input"></textarea><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
|
package/theme.css
CHANGED
|
@@ -72,6 +72,11 @@
|
|
|
72
72
|
--sinch-color-orange-200: #FFD4B3;
|
|
73
73
|
--sinch-color-bolt-400: #FFBE3C;
|
|
74
74
|
--sinch-color-bolt-200: #FFE6B3;
|
|
75
|
+
--sinch-color-background-grey: #FAFAFA;
|
|
76
|
+
--sinch-color-background-green: #DCEDE1;
|
|
77
|
+
--sinch-color-background-blue: #DEF2FF;
|
|
78
|
+
--sinch-color-background-yellow: #FCECCB;
|
|
79
|
+
--sinch-color-background-white: #FFFFFF;
|
|
75
80
|
--sinch-color-transparent: transparent;
|
|
76
81
|
|
|
77
82
|
/* Typography */
|
|
@@ -87,6 +92,18 @@
|
|
|
87
92
|
--sinch-font-text-xs: 400 12px/20px var(--sinch-font-family);
|
|
88
93
|
--sinch-font-text-xxs: 400 10px/16px var(--sinch-font-family);
|
|
89
94
|
|
|
95
|
+
/* Shapes */
|
|
96
|
+
--sinch-shape-radius-xs: 2px;
|
|
97
|
+
--sinch-shape-radius-s: 4px;
|
|
98
|
+
--sinch-shape-radius-m: 8px;
|
|
99
|
+
--sinch-shape-radius-l: 12px;
|
|
100
|
+
|
|
101
|
+
/* Elevation */
|
|
102
|
+
--sinch-elevation-level-0: 0 0 0 0 rgba(10, 39, 61, 0.1);
|
|
103
|
+
--sinch-elevation-level-1: 1px 2px 6px rgba(10, 39, 61, 0.1);
|
|
104
|
+
--sinch-elevation-level-2: 1px 4px 8px rgba(10, 39, 61, 0.1);
|
|
105
|
+
--sinch-elevation-level-3: 1px 6px 12px rgba(10, 39, 61, 0.15);
|
|
106
|
+
|
|
90
107
|
/* Deprecated */
|
|
91
108
|
--sinch-font-hero: 700 56px/72px var(--sinch-font-family);
|
|
92
109
|
--sinch-font-body: 400 16px/24px var(--sinch-font-family);
|
package/title/index.js
CHANGED
package/title/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type
|
|
4
|
-
export declare type TSinchTitleLevel = typeof levelValues[number];
|
|
2
|
+
export declare type TSinchTitleType = 'xl' | 'l' | 'm' | 's' | 'xs';
|
|
3
|
+
export declare type TSinchTitleLevel = '1' | '2' | '3' | '4' | '5' | '6';
|
|
5
4
|
export declare type TSinchTitleElement = HTMLElement & {
|
|
6
5
|
text: string;
|
|
7
6
|
type: TSinchTitleType;
|
package/title/utils.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { TSinchTitleLevel, TSinchTitleType } from './types';
|
|
2
|
-
export declare const typeValues: readonly [
|
|
3
|
-
export declare const levelValues: readonly [
|
|
2
|
+
export declare const typeValues: readonly TSinchTitleType[];
|
|
3
|
+
export declare const levelValues: readonly TSinchTitleLevel[];
|
|
4
4
|
declare type TAssertLevel = (value: string | null) => asserts value is TSinchTitleLevel;
|
|
5
|
-
declare type TAssertType = (value: string | null) => asserts value is TSinchTitleType;
|
|
6
5
|
export declare const assertLevel: TAssertLevel;
|
|
6
|
+
declare type TAssertType = (value: string | null) => asserts value is TSinchTitleType;
|
|
7
7
|
export declare const assertType: TAssertType;
|
|
8
|
+
export declare const getTitleLevelFromType: (type: TSinchTitleType) => TSinchTitleLevel;
|
|
8
9
|
export {};
|
package/title/utils.js
CHANGED
|
@@ -9,4 +9,25 @@ export const assertType = value => {
|
|
|
9
9
|
if (value === null || !typeValues.includes(value)) {
|
|
10
10
|
throw new Error(`sinch-title: invalid type attribute: ${value}`);
|
|
11
11
|
}
|
|
12
|
+
};
|
|
13
|
+
export const getTitleLevelFromType = type => {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case 'xl':
|
|
16
|
+
return '1';
|
|
17
|
+
|
|
18
|
+
case 'l':
|
|
19
|
+
return '2';
|
|
20
|
+
|
|
21
|
+
case 'm':
|
|
22
|
+
return '3';
|
|
23
|
+
|
|
24
|
+
case 's':
|
|
25
|
+
return '4';
|
|
26
|
+
|
|
27
|
+
case 'xs':
|
|
28
|
+
return '5';
|
|
29
|
+
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`sinch-title: invalid type value: ${type}`);
|
|
32
|
+
}
|
|
12
33
|
};
|
package/toggle/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;box-sizing:border-box;width:100%;height:32px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);text-align:initial}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-small-text)}#checkbox{all:initial;display:block;position:absolute;left:0;top:0;width:40px;height:20px;cursor:pointer;pointer-events:initial}#checkbox:disabled{cursor:initial}#knob-container{position:relative;box-sizing:border-box;align-self:center;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);overflow:hidden}:host([checked]:not([checked=false])) #knob-container{background-color:var(--sinch-color-tropical-500)}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);transform:translateX(0);transition:transform .1s ease-in-out}:host([checked]:not([checked=false])) #knob{transform:translateX(20px)}:host([small]:not([small=false])) #knob{width:12px;height:12px}:host([small]:not([small=false])[checked]:not([checked=false])) #knob{transform:translateX(16px)}#knob::after,#knob::before{color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{display:none;flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px}:host([text]:not([text=""])) #label{display:block}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}:host([disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-snow-700)}:host([checked]:not([checked=false])[disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><div id="knob-container"><div id="knob"></div><input id="checkbox" type="checkbox"></div><label for="checkbox" id="label"></label></div>';
|
|
11
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;box-sizing:border-box;width:100%;height:32px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);text-align:initial}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-small-text)}#checkbox{all:initial;display:block;position:absolute;left:0;top:0;width:40px;height:20px;cursor:pointer;pointer-events:initial}#checkbox:disabled{cursor:initial}#knob-container{position:relative;box-sizing:border-box;align-self:center;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);box-shadow:var(--sinch-elevation-level-1);overflow:hidden}:host([checked]:not([checked=false])) #knob-container{background-color:var(--sinch-color-tropical-500)}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);transform:translateX(0);transition:transform .1s ease-in-out}:host([checked]:not([checked=false])) #knob{transform:translateX(20px)}:host([small]:not([small=false])) #knob{width:12px;height:12px}:host([small]:not([small=false])[checked]:not([checked=false])) #knob{transform:translateX(16px)}#knob::after,#knob::before{color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{display:none;flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px}:host([text]:not([text=""])) #label{display:block}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}:host([disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-snow-700)}:host([checked]:not([checked=false])[disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><div id="knob-container"><div id="knob"></div><input id="checkbox" type="checkbox"></div><label for="checkbox" id="label"></label></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
|
package/tooltip/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attrValueToPixels, defineCustomElement, getBooleanAttribute, getIntegerAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, getRect, NectaryElement } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:block}#tooltip{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:0;transition:opacity .2s linear .2s}@media (prefers-reduced-motion){#tooltip{transition:none}}:host(:hover) #tooltip{opacity:1}#text{position:absolute;padding:2px 6px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);width:max-content;border-radius:
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:block}#tooltip{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:0;transition:opacity .2s linear .2s}@media (prefers-reduced-motion){#tooltip{transition:none}}:host(:hover) #tooltip{opacity:1}#text{position:absolute;padding:2px 6px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);width:max-content;border-radius:var(--sinch-shape-radius-xs);top:-8px;left:50%;transform:translateX(-50%) translateY(-100%);word-break:break-word}#arrow{position:absolute;top:-8px;left:50%;transform:translateX(-50%);fill:var(--sinch-color-snow-600)}:host([orientation=top-left]) #text{transform:translateX(-80%) translateY(-100%)}:host([orientation=top-right]) #text{transform:translateX(-20%) translateY(-100%)}:host([orientation=bottom-right]) #text{top:calc(100% + 8px);transform:translateX(-20%)}:host([orientation=bottom-left]) #text{top:calc(100% + 8px);transform:translateX(-80%)}:host([orientation=bottom]) #text{top:calc(100% + 8px);transform:translateX(-50%)}:host([orientation^=bottom]) #arrow{top:calc(100% + 4px);transform:translateX(-50%) rotate(180deg)}:host([orientation=left]) #text{left:unset;right:calc(100% + 8px);top:50%;transform:translateY(-50%)}:host([orientation=left]) #arrow{left:-11px;top:50%;transform:translateY(-50%) rotate(270deg)}:host([orientation=right]) #text{left:calc(100% + 8px);top:50%;transform:translateY(-50%)}:host([orientation=right]) #arrow{top:50%;left:calc(100% + 2px);transform:translateY(-50%) rotate(90deg)}:host([inverted]:not([inverted=false])) #text{color:var(--sinch-color-text-inverted);background-color:var(--sinch-color-stormy-500)}:host([inverted]:not([inverted=false])) #arrow{fill:var(--sinch-color-stormy-500)}::slotted(*){display:block}</style><div id="wrapper"><slot></slot><div id="tooltip"><div id="text"></div><svg id="arrow" width="9" height="4" aria-hidden="true"><path d="m4.5 4 4-4h-8l4 4Z"/></svg></div></div>';
|
|
3
3
|
import { orientationValues } from './utils';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
package/tooltip/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare type TSinchTooltipOrientation = typeof orientationValues[number];
|
|
2
|
+
export declare type TSinchTooltipOrientation = 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
4
3
|
export declare type TSinchTooltipElement = HTMLElement & {
|
|
5
4
|
text: string;
|
|
6
5
|
width: number | null;
|
package/tooltip/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TSinchTooltipOrientation } from './types';
|
|
2
|
+
export declare const orientationValues: readonly TSinchTooltipOrientation[];
|
package/utils.d.ts
CHANGED
|
@@ -41,4 +41,8 @@ export declare const getFirstCsvValue: (acc: string) => string | null;
|
|
|
41
41
|
export declare const getRect: (el: Element) => TRect;
|
|
42
42
|
export declare const setClass: (elem: Element, name: string, isSet: boolean) => void;
|
|
43
43
|
export declare const getCssVar: (element: Element, variableName: string) => string | null;
|
|
44
|
+
export declare const throttleAnimationFrame: (cb: (...args: any[]) => void) => {
|
|
45
|
+
fn: (...args: any[]) => void;
|
|
46
|
+
cancel: () => void;
|
|
47
|
+
};
|
|
44
48
|
export {};
|
package/utils.js
CHANGED
|
@@ -56,13 +56,13 @@ export const getBooleanAttribute = ($element, attrName) => {
|
|
|
56
56
|
return isAttrTrue($element.getAttribute(attrName));
|
|
57
57
|
};
|
|
58
58
|
export const updateBooleanAttribute = ($element, attrName, attrValue) => {
|
|
59
|
-
const
|
|
59
|
+
const currentAttrValue = $element.getAttribute(attrName);
|
|
60
60
|
|
|
61
61
|
if (attrValue === true) {
|
|
62
|
-
if (!
|
|
62
|
+
if (!isAttrTrue(currentAttrValue)) {
|
|
63
63
|
$element.setAttribute(attrName, '');
|
|
64
64
|
}
|
|
65
|
-
} else if (
|
|
65
|
+
} else if (currentAttrValue !== null) {
|
|
66
66
|
$element.removeAttribute(attrName);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
@@ -202,4 +202,35 @@ export const setClass = (elem, name, isSet) => {
|
|
|
202
202
|
export const getCssVar = (element, variableName) => {
|
|
203
203
|
const result = getComputedStyle(element).getPropertyValue(variableName);
|
|
204
204
|
return result === '' ? null : result;
|
|
205
|
-
};
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const throttle = (delayFn, cancelFn) => cb => {
|
|
208
|
+
let id = null;
|
|
209
|
+
let fnArgs;
|
|
210
|
+
|
|
211
|
+
const delayCallback = () => {
|
|
212
|
+
id = null;
|
|
213
|
+
cb(fnArgs);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
fn: function () {
|
|
218
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
219
|
+
args[_key] = arguments[_key];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
fnArgs = args;
|
|
223
|
+
|
|
224
|
+
if (id === null) {
|
|
225
|
+
id = delayFn(delayCallback);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
cancel: () => {
|
|
229
|
+
if (id !== null) {
|
|
230
|
+
cancelFn(id);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const throttleAnimationFrame = throttle(global.requestAnimationFrame, global.cancelAnimationFrame);
|