code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function O(e) {
var t = (function () {
if ('undefined' === typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' === typeof Proxy) return !0;
try {
return (
Date.prototype.toString.call(
Reflect.construct(Date, [], function () {})
),
!0
);
} catch (e) {
return !1;
}
})();
return function () {
var n,
r = L(e);
if (t) {
var i = L(this).constructor;
n = Reflect.construct(r, arguments, i);
} else n = r.apply(this, arguments);
return (function (e, t) {
if (t && ('object' === A(t) || 'function' === typeof t)) return t;
return (function (e) {
if (void 0 === e)
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
return e;
})(e);
})(this, n);
};
}
|
Any additional items will be passed to the\\n child ListItem as props
|
O
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function L(e) {
return (
(L = Object.setPrototypeOf
? Object.getPrototypeOf
: function (e) {
return e.__proto__ || Object.getPrototypeOf(e);
}),
L(e)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
L
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function a() {
return (
(function (e, t) {
if (!(e instanceof t))
throw new TypeError('Cannot call a class as a function');
})(this, a),
i.apply(this, arguments)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
a
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function j(e, t, n) {
return n ? e[0] === t[0] : e[0] === t[0] && e[1] === t[1];
}
|
Any additional items will be passed to the\\n child ListItem as props
|
j
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function D(e, t) {
this[e] = t;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
D
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function B(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t &&
(r = r.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})),
n.push.apply(n, r);
}
return n;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
B
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function U(e) {
for (var t = 1; t < arguments.length; t++) {
var n = null != arguments[t] ? arguments[t] : {};
t % 2
? B(Object(n), !0).forEach(function (t) {
H(e, t, n[t]);
})
: Object.getOwnPropertyDescriptors
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n))
: B(Object(n)).forEach(function (t) {
Object.defineProperty(
e,
t,
Object.getOwnPropertyDescriptor(n, t)
);
});
}
return e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
U
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function z(e) {
return (
(z =
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
'function' == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? 'symbol'
: typeof e;
}),
z(e)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
z
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function H(e, t, n) {
return (
t in e
? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
})
: (e[t] = n),
e
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
H
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function W() {
if (void 0 !== M) return M;
M = '';
var e = document.createElement('p').style;
for (var t in Z) t + 'Transform' in e && (M = t);
return M;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
W
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function V() {
return W()
? ''.concat(W(), 'TransitionProperty')
: 'transitionProperty';
}
|
Any additional items will be passed to the\\n child ListItem as props
|
V
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function q() {
return W() ? ''.concat(W(), 'Transform') : 'transform';
}
|
Any additional items will be passed to the\\n child ListItem as props
|
q
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function G(e, t) {
var n = V();
n &&
((e.style[n] = t),
'transitionProperty' !== n && (e.style.transitionProperty = t));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
G
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function K(e, t) {
var n = q();
n && ((e.style[n] = t), 'transform' !== n && (e.style.transform = t));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
K
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function J(e) {
var t = e.style.display;
(e.style.display = 'none'), e.offsetHeight, (e.style.display = t);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
J
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Q(e, t, n) {
var r = n;
if ('object' !== z(t))
return 'undefined' !== typeof r
? ('number' === typeof r && (r = ''.concat(r, 'px')),
void (e.style[t] = r))
: Y(e, t);
for (var i in t) t.hasOwnProperty(i) && Q(e, i, t[i]);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Q
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ee(e, t) {
var n = e['page'.concat(t ? 'Y' : 'X', 'Offset')],
r = 'scroll'.concat(t ? 'Top' : 'Left');
if ('number' !== typeof n) {
var i = e.document;
'number' !== typeof (n = i.documentElement[r]) && (n = i.body[r]);
}
return n;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ee
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function te(e) {
return ee(e);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
te
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ne(e) {
return ee(e, !0);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ne
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function re(e) {
var t = (function (e) {
var t,
n,
r,
i = e.ownerDocument,
a = i.body,
o = i && i.documentElement;
return (
(t = e.getBoundingClientRect()),
(n = Math.floor(t.left)),
(r = Math.floor(t.top)),
{
left: (n -= o.clientLeft || a.clientLeft || 0),
top: (r -= o.clientTop || a.clientTop || 0)
}
);
})(e),
n = e.ownerDocument,
r = n.defaultView || n.parentWindow;
return (t.left += te(r)), (t.top += ne(r)), t;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
re
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ie(e) {
return null !== e && void 0 !== e && e == e.window;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ie
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ae(e) {
return ie(e) ? e.document : 9 === e.nodeType ? e : e.ownerDocument;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ae
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function de(e, t) {
return 'left' === e
? t.useCssRight
? 'right'
: e
: t.useCssBottom
? 'bottom'
: e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
de
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function pe(e) {
return 'left' === e
? 'right'
: 'right' === e
? 'left'
: 'top' === e
? 'bottom'
: 'bottom' === e
? 'top'
: void 0;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
pe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function fe(e, t, n) {
'static' === Q(e, 'position') && (e.style.position = 'relative');
var r = -999,
i = -999,
a = de('left', n),
o = de('top', n),
s = pe(a),
l = pe(o);
'left' !== a && (r = 999), 'top' !== o && (i = 999);
var c,
u = '',
d = re(e);
('left' in t || 'top' in t) &&
((u = (c = e).style.transitionProperty || c.style[V()] || ''),
G(e, 'none')),
'left' in t &&
((e.style[s] = ''), (e.style[a] = ''.concat(r, 'px'))),
'top' in t &&
((e.style[l] = ''), (e.style[o] = ''.concat(i, 'px'))),
J(e);
var p = re(e),
f = {};
for (var m in t)
if (t.hasOwnProperty(m)) {
var h = de(m, n),
g = 'left' === m ? r : i,
b = d[m] - p[m];
f[h] = h === m ? g + b : g - b;
}
Q(e, f), J(e), ('left' in t || 'top' in t) && G(e, u);
var v = {};
for (var x in t)
if (t.hasOwnProperty(x)) {
var y = de(x, n),
k = t[x] - d[x];
v[y] = x === y ? f[y] + k : f[y] - k;
}
Q(e, v);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
fe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function me(e, t) {
var n = re(e),
r = (function (e) {
var t = window.getComputedStyle(e, null),
n = t.getPropertyValue('transform') || t.getPropertyValue(q());
if (n && 'none' !== n) {
var r = n.replace(/[^0-9\-.,]/g, '').split(',');
return {
x: parseFloat(r[12] || r[4], 0),
y: parseFloat(r[13] || r[5], 0)
};
}
return { x: 0, y: 0 };
})(e),
i = { x: r.x, y: r.y };
'left' in t && (i.x = r.x + t.left - n.left),
'top' in t && (i.y = r.y + t.top - n.top),
(function (e, t) {
var n = window.getComputedStyle(e, null),
r = n.getPropertyValue('transform') || n.getPropertyValue(q());
if (r && 'none' !== r) {
var i,
a = r.match(X);
a
? (((i = (a = a[1]).split(',').map(function (e) {
return parseFloat(e, 10);
}))[4] = t.x),
(i[5] = t.y),
K(e, 'matrix('.concat(i.join(','), ')')))
: (((i = r
.match($)[1]
.split(',')
.map(function (e) {
return parseFloat(e, 10);
}))[12] = t.x),
(i[13] = t.y),
K(e, 'matrix3d('.concat(i.join(','), ')')));
} else
K(
e,
'translateX('
.concat(t.x, 'px) translateY(')
.concat(t.y, 'px) translateZ(0)')
);
})(e, i);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
me
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function he(e, t) {
for (var n = 0; n < e.length; n++) t(e[n]);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
he
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ge(e) {
return 'border-box' === Y(e, 'boxSizing');
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ge
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ke(e, t, n) {
var r,
i,
a,
o = 0;
for (i = 0; i < t.length; i++)
if ((r = t[i]))
for (a = 0; a < n.length; a++) {
var s = void 0;
(s =
'border' === r
? ''.concat(r).concat(n[a], 'Width')
: r + n[a]),
(o += parseFloat(Y(e, s)) || 0);
}
return o;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ke
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ee(e, t, n) {
var r = n;
if (ie(e))
return 'width' === t ? we.viewportWidth(e) : we.viewportHeight(e);
if (9 === e.nodeType)
return 'width' === t ? we.docWidth(e) : we.docHeight(e);
var i = 'width' === t ? ['Left', 'Right'] : ['Top', 'Bottom'],
a =
'width' === t
? Math.floor(e.getBoundingClientRect().width)
: Math.floor(e.getBoundingClientRect().height),
o = ge(e),
s = 0;
(null === a || void 0 === a || a <= 0) &&
((a = void 0),
(null === (s = Y(e, t)) || void 0 === s || Number(s) < 0) &&
(s = e.style[t] || 0),
(s = Math.floor(parseFloat(s)) || 0)),
void 0 === r && (r = o ? ye : ve);
var l = void 0 !== a || o,
c = a || s;
return r === ve
? l
? c - ke(e, ['border', 'padding'], i)
: s
: l
? r === ye
? c
: c + (r === xe ? -ke(e, ['border'], i) : ke(e, ['margin'], i))
: s + ke(e, be.slice(r), i);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ee
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ce() {
for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
t[n] = arguments[n];
var r,
i = t[0];
return (
0 !== i.offsetWidth
? (r = Ee.apply(void 0, t))
: (function (e, t, n) {
var r,
i = {},
a = e.style;
for (r in t)
t.hasOwnProperty(r) && ((i[r] = a[r]), (a[r] = t[r]));
for (r in (n.call(e), t))
t.hasOwnProperty(r) && (a[r] = i[r]);
})(i, Te, function () {
r = Ee.apply(void 0, t);
}),
r
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ce
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Se(e, t) {
for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
return e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Se
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ae(e) {
if (_e.isWindow(e) || 9 === e.nodeType) return null;
var t,
n = _e.getDocument(e).body,
r = _e.css(e, 'position');
if (!('fixed' === r || 'absolute' === r))
return 'html' === e.nodeName.toLowerCase() ? null : Pe(e);
for (t = Pe(e); t && t !== n && 9 !== t.nodeType; t = Pe(t))
if ('static' !== (r = _e.css(t, 'position'))) return t;
return null;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ae
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Re(e, t) {
for (
var n = { left: 0, right: 1 / 0, top: 0, bottom: 1 / 0 },
r = Ae(e),
i = _e.getDocument(e),
a = i.defaultView || i.parentWindow,
o = i.body,
s = i.documentElement;
r;
) {
if (
(-1 !== navigator.userAgent.indexOf('MSIE') &&
0 === r.clientWidth) ||
r === o ||
r === s ||
'visible' === _e.css(r, 'overflow')
) {
if (r === o || r === s) break;
} else {
var l = _e.offset(r);
(l.left += r.clientLeft),
(l.top += r.clientTop),
(n.top = Math.max(n.top, l.top)),
(n.right = Math.min(n.right, l.left + r.clientWidth)),
(n.bottom = Math.min(n.bottom, l.top + r.clientHeight)),
(n.left = Math.max(n.left, l.left));
}
r = Ae(r);
}
var c = null;
_e.isWindow(e) ||
9 === e.nodeType ||
((c = e.style.position),
'absolute' === _e.css(e, 'position') &&
(e.style.position = 'fixed'));
var u = _e.getWindowScrollLeft(a),
d = _e.getWindowScrollTop(a),
p = _e.viewportWidth(a),
f = _e.viewportHeight(a),
m = s.scrollWidth,
h = s.scrollHeight,
g = window.getComputedStyle(o);
if (
('hidden' === g.overflowX && (m = a.innerWidth),
'hidden' === g.overflowY && (h = a.innerHeight),
e.style && (e.style.position = c),
t ||
(function (e) {
if (_e.isWindow(e) || 9 === e.nodeType) return !1;
var t = _e.getDocument(e),
n = t.body,
r = null;
for (r = Ie(e); r && r !== n && r !== t; r = Ie(r))
if ('fixed' === _e.css(r, 'position')) return !0;
return !1;
})(e))
)
(n.left = Math.max(n.left, u)),
(n.top = Math.max(n.top, d)),
(n.right = Math.min(n.right, u + p)),
(n.bottom = Math.min(n.bottom, d + f));
else {
var b = Math.max(m, u + p);
n.right = Math.min(n.right, b);
var v = Math.max(h, d + f);
n.bottom = Math.min(n.bottom, v);
}
return n.top >= 0 &&
n.left >= 0 &&
n.bottom > n.top &&
n.right > n.left
? n
: null;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Re
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Oe(e) {
var t, n, r;
if (_e.isWindow(e) || 9 === e.nodeType) {
var i = _e.getWindow(e);
(t = {
left: _e.getWindowScrollLeft(i),
top: _e.getWindowScrollTop(i)
}),
(n = _e.viewportWidth(i)),
(r = _e.viewportHeight(i));
} else
(t = _e.offset(e)), (n = _e.outerWidth(e)), (r = _e.outerHeight(e));
return (t.width = n), (t.height = r), t;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Oe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Le(e, t) {
var n = t.charAt(0),
r = t.charAt(1),
i = e.width,
a = e.height,
o = e.left,
s = e.top;
return (
'c' === n ? (s += a / 2) : 'b' === n && (s += a),
'c' === r ? (o += i / 2) : 'r' === r && (o += i),
{ left: o, top: s }
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Le
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ne(e, t, n, r, i) {
var a = Le(t, n[1]),
o = Le(e, n[0]),
s = [o.left - a.left, o.top - a.top];
return {
left: Math.round(e.left - s[0] + r[0] - i[0]),
top: Math.round(e.top - s[1] + r[1] - i[1])
};
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ne
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function je(e, t, n) {
return e.left < n.left || e.left + t.width > n.right;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
je
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function De(e, t, n) {
return e.top < n.top || e.top + t.height > n.bottom;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
De
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Me(e, t, n) {
var r = [];
return (
_e.each(e, function (e) {
r.push(
e.replace(t, function (e) {
return n[e];
})
);
}),
r
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Me
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Fe(e, t) {
return (e[t] = -e[t]), e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Fe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Be(e, t) {
return (
(/%$/.test(e)
? (parseInt(e.substring(0, e.length - 1), 10) / 100) * t
: parseInt(e, 10)) || 0
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Be
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ue(e, t) {
(e[0] = Be(e[0], t.width)), (e[1] = Be(e[1], t.height));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ue
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ze(e, t, n, r) {
var i = n.points,
a = n.offset || [0, 0],
o = n.targetOffset || [0, 0],
s = n.overflow,
l = n.source || e;
(a = [].concat(a)), (o = [].concat(o));
var c = {},
u = 0,
d = Re(l, !(!(s = s || {}) || !s.alwaysByViewport)),
p = Oe(l);
Ue(a, p), Ue(o, t);
var f = Ne(p, t, i, a, o),
m = _e.merge(p, f);
if (d && (s.adjustX || s.adjustY) && r) {
if (s.adjustX && je(f, p, d)) {
var h = Me(i, /[lr]/gi, { l: 'r', r: 'l' }),
g = Fe(a, 0),
b = Fe(o, 0);
(function (e, t, n) {
return e.left > n.right || e.left + t.width < n.left;
})(Ne(p, t, h, g, b), p, d) ||
((u = 1), (i = h), (a = g), (o = b));
}
if (s.adjustY && De(f, p, d)) {
var v = Me(i, /[tb]/gi, { t: 'b', b: 't' }),
x = Fe(a, 1),
y = Fe(o, 1);
(function (e, t, n) {
return e.top > n.bottom || e.top + t.height < n.top;
})(Ne(p, t, v, x, y), p, d) ||
((u = 1), (i = v), (a = x), (o = y));
}
u && ((f = Ne(p, t, i, a, o)), _e.mix(m, f));
var k = je(f, p, d),
w = De(f, p, d);
if (k || w) {
var E = i;
k && (E = Me(i, /[lr]/gi, { l: 'r', r: 'l' })),
w && (E = Me(i, /[tb]/gi, { t: 'b', b: 't' })),
(i = E),
(a = n.offset || [0, 0]),
(o = n.targetOffset || [0, 0]);
}
(c.adjustX = s.adjustX && k),
(c.adjustY = s.adjustY && w),
(c.adjustX || c.adjustY) &&
(m = (function (e, t, n, r) {
var i = _e.clone(e),
a = { width: t.width, height: t.height };
return (
r.adjustX && i.left < n.left && (i.left = n.left),
r.resizeWidth &&
i.left >= n.left &&
i.left + a.width > n.right &&
(a.width -= i.left + a.width - n.right),
r.adjustX &&
i.left + a.width > n.right &&
(i.left = Math.max(n.right - a.width, n.left)),
r.adjustY && i.top < n.top && (i.top = n.top),
r.resizeHeight &&
i.top >= n.top &&
i.top + a.height > n.bottom &&
(a.height -= i.top + a.height - n.bottom),
r.adjustY &&
i.top + a.height > n.bottom &&
(i.top = Math.max(n.bottom - a.height, n.top)),
_e.mix(i, a)
);
})(f, p, d, c));
}
return (
m.width !== p.width &&
_e.css(l, 'width', _e.width(l) + m.width - p.width),
m.height !== p.height &&
_e.css(l, 'height', _e.height(l) + m.height - p.height),
_e.offset(
l,
{ left: m.left, top: m.top },
{
useCssRight: n.useCssRight,
useCssBottom: n.useCssBottom,
useCssTransform: n.useCssTransform,
ignoreShake: n.ignoreShake
}
),
{ points: i, offset: a, targetOffset: o, overflow: c }
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ze
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function He(e, t, n) {
var r = n.target || t,
i = Oe(r),
a = !(function (e, t) {
var n = Re(e, t),
r = Oe(e);
return (
!n ||
r.left + r.width <= n.left ||
r.top + r.height <= n.top ||
r.left >= n.right ||
r.top >= n.bottom
);
})(r, n.overflow && n.overflow.alwaysByViewport);
return ze(e, i, n, a);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
He
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ze(e) {
return e && 'object' === typeof e && e.window === e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ze
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function We(e, t) {
var n = Math.floor(e),
r = Math.floor(t);
return Math.abs(n - r) <= 1;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
We
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Ve(e) {
return 'function' === typeof e && e ? e() : null;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ve
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function qe(e) {
return 'object' === typeof e && e ? e : null;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
qe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
var e, n, r, i;
(0, u.Z)(this, t);
for (var a = arguments.length, o = Array(a), s = 0; s < a; s++)
o[s] = arguments[s];
return (
(n = r =
(0, d.Z)(
this,
(e = t.__proto__ || Object.getPrototypeOf(t)).call.apply(
e,
[this].concat(o)
)
)),
(r.forceAlign = function () {
var e = r.props,
t = e.disabled,
n = e.target,
i = e.align,
a = e.onAlign;
if (!t && n) {
var o = h.findDOMNode(r),
s = void 0,
l = Ve(n),
c = qe(n),
u = document.activeElement;
l
? (s = He(o, l, i))
: c &&
(s = (function (e, t, n) {
var r,
i,
a = _e.getDocument(e),
o = a.defaultView || a.parentWindow,
s = _e.getWindowScrollLeft(o),
l = _e.getWindowScrollTop(o),
c = _e.viewportWidth(o),
u = _e.viewportHeight(o),
d = {
left: (r = 'pageX' in t ? t.pageX : s + t.clientX),
top: (i = 'pageY' in t ? t.pageY : l + t.clientY),
width: 0,
height: 0
},
p = r >= 0 && r <= s + c && i >= 0 && i <= l + u,
f = [n.points[0], 'cc'];
return ze(e, d, U(U({}, n), {}, { points: f }), p);
})(o, c, i)),
(function (e, t) {
e !== document.activeElement && x(t, e) && e.focus();
})(u, o),
a && a(o, s);
}
}),
(i = n),
(0, d.Z)(r, i)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function r() {
n && (clearTimeout(n), (n = null));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
r
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function i() {
r(), (n = setTimeout(e, t));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
i
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
Xe = function (e) {
var t = e.prototype;
if (!t || !t.isReactComponent)
throw new Error('Can only polyfill class components');
return 'function' !== typeof t.componentWillReceiveProps
? e
: a.Profiler
? ((t.UNSAFE_componentWillReceiveProps =
t.componentWillReceiveProps),
delete t.componentWillReceiveProps,
e)
: e;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Xe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function $e(e) {
var t = [];
return (
a.Children.forEach(e, function (e) {
t.push(e);
}),
t
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
$e
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Je(e, t) {
var n = null;
return (
e &&
e.forEach(function (e) {
n || (e && e.key === t && (n = e));
}),
n
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Je
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Qe(e, t, n) {
var r = null;
return (
e &&
e.forEach(function (e) {
if (e && e.key === t && e.props[n]) {
if (r)
throw new Error(
'two child with same key for <rc-animate> children'
);
r = e;
}
}),
r
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Qe
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function at(e, t, n) {
e.addEventListener(t, n, !1);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
at
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ot(e, t, n) {
e.removeEventListener(t, n, !1);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ot
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(t, n) {
for (var r in t)
if (t.hasOwnProperty(r)) {
var i = t[r];
for (var a in i)
if (a in e) {
n.push(i[a]);
break;
}
}
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ft(e, t) {
for (
var n = window.getComputedStyle(e, null), r = '', i = 0;
i < pt.length && !(r = n.getPropertyValue(pt[i] + t));
i++
);
return r;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ft
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function mt(e) {
if (ut) {
var t = parseFloat(ft(e, 'transition-delay')) || 0,
n = parseFloat(ft(e, 'transition-duration')) || 0,
r = parseFloat(ft(e, 'animation-delay')) || 0,
i = parseFloat(ft(e, 'animation-duration')) || 0,
a = Math.max(n + t, i + r);
e.rcEndAnimTimeout = setTimeout(function () {
(e.rcEndAnimTimeout = null), e.rcEndListener && e.rcEndListener();
}, 1e3 * a + 200);
}
}
|
Any additional items will be passed to the\\n child ListItem as props
|
mt
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function ht(e) {
e.rcEndAnimTimeout &&
(clearTimeout(e.rcEndAnimTimeout), (e.rcEndAnimTimeout = null));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
ht
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
gt = function (e, t, n) {
var r =
'object' ===
('undefined' === typeof t ? 'undefined' : (0, et.default)(t)),
i = r ? t.name : t,
a = r ? t.active : t + '-active',
o = n,
s = void 0,
l = void 0,
c = ct()(e);
return (
n &&
'[object Object]' === Object.prototype.toString.call(n) &&
((o = n.end), (s = n.start), (l = n.active)),
e.rcEndListener && e.rcEndListener(),
(e.rcEndListener = function (t) {
(t && t.target !== e) ||
(e.rcAnimTimeout &&
(clearTimeout(e.rcAnimTimeout), (e.rcAnimTimeout = null)),
ht(e),
c.remove(i),
c.remove(a),
st.removeEndEventListener(e, e.rcEndListener),
(e.rcEndListener = null),
o && o());
}),
st.addEndEventListener(e, e.rcEndListener),
s && s(),
c.add(i),
(e.rcAnimTimeout = setTimeout(function () {
(e.rcAnimTimeout = null), c.add(a), l && setTimeout(l, 0), mt(e);
}, 30)),
{
stop: function () {
e.rcEndListener && e.rcEndListener();
}
}
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
gt
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
return (
(0, u.Z)(this, t),
(0, d.Z)(
this,
(t.__proto__ || Object.getPrototypeOf(t)).apply(
this,
arguments
)
)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
s = function () {
(n.stopper = null), t();
}
|
Any additional items will be passed to the\\n child ListItem as props
|
s
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function Et(e) {
var t = e.children;
return a.isValidElement(t) && !t.key
? a.cloneElement(t, { key: wt })
: t;
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Et
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(e) {
(0, u.Z)(this, t);
var n = (0, d.Z)(
this,
(t.__proto__ || Object.getPrototypeOf(t)).call(this, e)
);
return (
St.call(n),
(n.currentlyAnimatingKeys = {}),
(n.keysToEnter = []),
(n.keysToLeave = []),
(n.state = { children: $e(Et(e)) }),
(n.childrenRefs = {}),
n
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
St = function () {
var e = this;
(this.performEnter = function (t) {
e.childrenRefs[t] &&
((e.currentlyAnimatingKeys[t] = !0),
e.childrenRefs[t].componentWillEnter(
e.handleDoneAdding.bind(e, t, 'enter')
));
}),
(this.performAppear = function (t) {
e.childrenRefs[t] &&
((e.currentlyAnimatingKeys[t] = !0),
e.childrenRefs[t].componentWillAppear(
e.handleDoneAdding.bind(e, t, 'appear')
));
}),
(this.handleDoneAdding = function (t, n) {
var r = e.props;
if (
(delete e.currentlyAnimatingKeys[t],
!r.exclusive || r === e.nextProps)
) {
var i = $e(Et(r));
e.isValidChildByKey(i, t)
? 'appear' === n
? vt.allowAppearCallback(r) &&
(r.onAppear(t), r.onEnd(t, !0))
: vt.allowEnterCallback(r) &&
(r.onEnter(t), r.onEnd(t, !0))
: e.performLeave(t);
}
}),
(this.performLeave = function (t) {
e.childrenRefs[t] &&
((e.currentlyAnimatingKeys[t] = !0),
e.childrenRefs[t].componentWillLeave(
e.handleDoneLeaving.bind(e, t)
));
}),
(this.handleDoneLeaving = function (t) {
var n = e.props;
if (
(delete e.currentlyAnimatingKeys[t],
!n.exclusive || n === e.nextProps)
) {
var r = $e(Et(n));
if (e.isValidChildByKey(r, t)) e.performEnter(t);
else {
var i = function () {
vt.allowLeaveCallback(n) &&
(n.onLeave(t), n.onEnd(t, !1));
};
!(function (e, t, n) {
var r = e.length === t.length;
return (
r &&
e.forEach(function (e, i) {
var a = t[i];
e &&
a &&
((e && !a) ||
(!e && a) ||
e.key !== a.key ||
(n && e.props[n] !== a.props[n])) &&
(r = !1);
}),
r
);
})(e.state.children, r, n.showProp)
? e.setState({ children: r }, i)
: i();
}
}
});
}
|
Any additional items will be passed to the\\n child ListItem as props
|
St
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
i = function () {
vt.allowLeaveCallback(n) &&
(n.onLeave(t), n.onEnd(t, !1));
}
|
Any additional items will be passed to the\\n child ListItem as props
|
i
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
return (
(0, u.Z)(this, t), (0, d.Z)(this, e.apply(this, arguments))
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
return (
(0, u.Z)(this, t), (0, d.Z)(this, e.apply(this, arguments))
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(n) {
(0, u.Z)(this, t);
var r = (0, d.Z)(this, e.call(this, n));
return (
Lt.call(r),
(r.state = {
stretchChecked: !1,
targetWidth: void 0,
targetHeight: void 0
}),
(r.savePopupRef = D.bind(r, 'popupInstance')),
(r.saveAlignRef = D.bind(r, 'alignInstance')),
r
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
Lt = function () {
var e = this;
(this.onAlign = function (t, n) {
var r = e.props,
i = r.getClassNameFromAlign(n);
e.currentAlignClassName !== i &&
((e.currentAlignClassName = i),
(t.className = e.getClassName(i))),
r.onAlign(t, n);
}),
(this.setStretchSize = function () {
var t = e.props,
n = t.stretch,
r = t.getRootDomNode,
i = t.visible,
a = e.state,
o = a.stretchChecked,
s = a.targetHeight,
l = a.targetWidth;
if (n && i) {
var c = r();
if (c) {
var u = c.offsetHeight,
d = c.offsetWidth;
(s === u && l === d && o) ||
e.setState({
stretchChecked: !0,
targetHeight: u,
targetWidth: d
});
}
} else o && e.setState({ stretchChecked: !1 });
}),
(this.getTargetElement = function () {
return e.props.getRootDomNode();
}),
(this.getAlignTarget = function () {
var t = e.props.point;
return t || e.getTargetElement;
});
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Lt
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(n) {
(0, u.Z)(this, t);
var r = (0, d.Z)(this, e.call(this, n));
Ut.call(r);
var i = void 0;
return (
(i =
'popupVisible' in n
? !!n.popupVisible
: !!n.defaultPopupVisible),
(r.state = { prevPopupVisible: i, popupVisible: i }),
Dt.forEach(function (e) {
r['fire' + e] = function (t) {
r.fireEvents(e, t);
};
}),
r
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
Ut = function () {
var e = this;
(this.onMouseEnter = function (t) {
var n = e.props.mouseEnterDelay;
e.fireEvents('onMouseEnter', t),
e.delaySetPopupVisible(!0, n, n ? null : t);
}),
(this.onMouseMove = function (t) {
e.fireEvents('onMouseMove', t), e.setPoint(t);
}),
(this.onMouseLeave = function (t) {
e.fireEvents('onMouseLeave', t),
e.delaySetPopupVisible(!1, e.props.mouseLeaveDelay);
}),
(this.onPopupMouseEnter = function () {
e.clearDelayTimer();
}),
(this.onPopupMouseLeave = function (t) {
(t.relatedTarget &&
!t.relatedTarget.setTimeout &&
e._component &&
e._component.getPopupDomNode &&
x(e._component.getPopupDomNode(), t.relatedTarget)) ||
e.delaySetPopupVisible(!1, e.props.mouseLeaveDelay);
}),
(this.onFocus = function (t) {
e.fireEvents('onFocus', t),
e.clearDelayTimer(),
e.isFocusToShow() &&
((e.focusTime = Date.now()),
e.delaySetPopupVisible(!0, e.props.focusDelay));
}),
(this.onMouseDown = function (t) {
e.fireEvents('onMouseDown', t), (e.preClickTime = Date.now());
}),
(this.onTouchStart = function (t) {
e.fireEvents('onTouchStart', t), (e.preTouchTime = Date.now());
}),
(this.onBlur = function (t) {
e.fireEvents('onBlur', t),
e.clearDelayTimer(),
e.isBlurToHide() &&
e.delaySetPopupVisible(!1, e.props.blurDelay);
}),
(this.onContextMenu = function (t) {
t.preventDefault(),
e.fireEvents('onContextMenu', t),
e.setPopupVisible(!0, t);
}),
(this.onContextMenuClose = function () {
e.isContextMenuToShow() && e.close();
}),
(this.onClick = function (t) {
if ((e.fireEvents('onClick', t), e.focusTime)) {
var n = void 0;
if (
(e.preClickTime && e.preTouchTime
? (n = Math.min(e.preClickTime, e.preTouchTime))
: e.preClickTime
? (n = e.preClickTime)
: e.preTouchTime && (n = e.preTouchTime),
Math.abs(n - e.focusTime) < 20)
)
return;
e.focusTime = 0;
}
(e.preClickTime = 0),
(e.preTouchTime = 0),
e.isClickToShow() &&
(e.isClickToHide() || e.isBlurToHide()) &&
t &&
t.preventDefault &&
t.preventDefault();
var r = !e.state.popupVisible;
((e.isClickToHide() && !r) || (r && e.isClickToShow())) &&
e.setPopupVisible(!e.state.popupVisible, t);
}),
(this.onPopupMouseDown = function () {
var t = e.context.rcTrigger,
n = void 0 === t ? {} : t;
(e.hasPopupMouseDown = !0),
clearTimeout(e.mouseDownTimeout),
(e.mouseDownTimeout = setTimeout(function () {
e.hasPopupMouseDown = !1;
}, 0)),
n.onPopupMouseDown && n.onPopupMouseDown.apply(n, arguments);
}),
(this.onDocumentClick = function (t) {
if (!e.props.mask || e.props.maskClosable) {
var n = t.target;
x((0, h.findDOMNode)(e), n) || e.hasPopupMouseDown || e.close();
}
}),
(this.getRootDomNode = function () {
return (0, h.findDOMNode)(e);
}),
(this.getPopupClassNameFromAlign = function (t) {
var n = [],
r = e.props,
i = r.popupPlacement,
a = r.builtinPlacements,
o = r.prefixCls,
s = r.alignPoint,
l = r.getPopupClassNameFromAlign;
return (
i &&
a &&
n.push(
(function (e, t, n, r) {
var i = n.points;
for (var a in e)
if (e.hasOwnProperty(a) && j(e[a].points, i, r))
return t + '-placement-' + a;
return '';
})(a, o, t, s)
),
l && n.push(l(t)),
n.join(' ')
);
}),
(this.getComponent = function () {
var t = e.props,
n = t.prefixCls,
r = t.destroyPopupOnHide,
i = t.popupClassName,
o = t.action,
s = t.onPopupAlign,
c = t.popupAnimation,
u = t.popupTransitionName,
d = t.popupStyle,
p = t.mask,
f = t.maskAnimation,
m = t.maskTransitionName,
h = t.zIndex,
g = t.popup,
b = t.stretch,
v = t.alignPoint,
x = e.state,
y = x.popupVisible,
k = x.point,
w = e.getPopupAlign(),
E = {};
return (
e.isMouseEnterToShow() &&
(E.onMouseEnter = e.onPopupMouseEnter),
e.isMouseLeaveToHide() &&
(E.onMouseLeave = e.onPopupMouseLeave),
(E.onMouseDown = e.onPopupMouseDown),
(E.onTouchStart = e.onPopupMouseDown),
a.createElement(
Nt,
(0, l.Z)(
{
prefixCls: n,
destroyPopupOnHide: r,
visible: y,
point: v && k,
className: i,
action: o,
align: w,
onAlign: s,
animation: c,
getClassNameFromAlign: e.getPopupClassNameFromAlign
},
E,
{
stretch: b,
getRootDomNode: e.getRootDomNode,
style: d,
mask: p,
zIndex: h,
transitionName: u,
maskAnimation: f,
maskTransitionName: m,
ref: e.savePopup
}
),
'function' === typeof g ? g() : g
)
);
}),
(this.getContainer = function () {
var t = e.props,
n = document.createElement('div');
return (
(n.style.position = 'absolute'),
(n.style.top = '0'),
(n.style.left = '0'),
(n.style.width = '100%'),
(t.getPopupContainer
? t.getPopupContainer((0, h.findDOMNode)(e))
: t.getDocument().body
).appendChild(n),
n
);
}),
(this.setPoint = function (t) {
e.props.alignPoint &&
t &&
e.setState({ point: { pageX: t.pageX, pageY: t.pageY } });
}),
(this.handlePortalUpdate = function () {
e.state.prevPopupVisible !== e.state.popupVisible &&
e.props.afterPopupVisibleChange(e.state.popupVisible);
}),
(this.savePopup = function (t) {
e._component = t;
});
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Ut
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
return (
(0, u.Z)(this, t), (0, d.Z)(this, e.apply(this, arguments))
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
var n, r, i;
(0, u.Z)(this, t);
for (var o = arguments.length, s = Array(o), l = 0; l < o; l++)
s[l] = arguments[l];
return (
(n = r = (0, d.Z)(this, e.call.apply(e, [this].concat(s)))),
(r.getPopupElement = function () {
var e = r.props,
t = e.arrowContent,
n = e.overlay,
i = e.prefixCls,
o = e.id;
return [
a.createElement(
'div',
{ className: i + '-arrow', key: 'arrow' },
t
),
a.createElement(qt, {
key: 'content',
trigger: r.trigger,
prefixCls: i,
id: o,
overlay: n
})
];
}),
(r.saveTrigger = function (e) {
r.trigger = e;
}),
(i = n),
(0, d.Z)(r, i)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
Jt = function (e) {
var t = e.children,
n = e.content,
a = e.className,
o = e.open,
l = (0, i.Z)(e, $t),
c = (0, Yt.wv)(),
u = (0, r.Z)((0, r.Z)({}, c.tooltip), l),
d = u.showArrow,
p = void 0 !== d && d,
f = u.enterDelay,
m = void 0 === f ? 0 : f,
h = u.leaveDelay,
g = void 0 === h ? 0 : h,
b = u.align,
v = void 0 === b ? 'top' : b,
x = u.activateOn,
y = void 0 === x ? ['hover', 'focus'] : x;
return (0, Xt.jsx)(
Kt,
(0, r.Z)(
(0, r.Z)({}, void 0 !== o ? { visible: o } : {}),
{},
{
trigger: Array.isArray(y) ? y : [y],
prefixCls: 'rmwc-tooltip',
placement: v,
transitionName: 'rmwc-tooltip-zoom',
mouseEnterDelay: m / 1e3,
mouseLeaveDelay: g / 1e3,
overlay: n,
overlayClassName: s()(a, { 'rmwc-tooltip--show-arrow': p }),
destroyTooltipOnHide: !0,
children: t
}
)
);
}
|
Any additional items will be passed to the\\n child ListItem as props
|
Jt
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function p() {
return (0, d.jsxs)(r.WI, {
title: 'Tooltips',
lead: 'Tooltips display informative text when users hover over, focus on, or tap an element.',
module: '@rmwc/tooltip',
styles: ['@rmwc/tooltip/tooltip.css'],
examples: a,
addon: !0,
children: [
(0, d.jsx)(r.sb, { children: 'Basic Usage' }),
(0, d.jsx)(r.PJ, {
children:
'Wrap any component in a `Tooltip` and provide the content attribute. The only requirement is that is has a single React child, and that the child can accept `onMouseEnter`, `onMouseLeave`, `onFocus`, and `onClick` props.'
}),
(0, d.jsx)(r.q3, {
label: 'Default',
children: (0, d.jsxs)(d.Fragment, {
children: [
(0, d.jsx)(o.u, {
content: 'Cookies',
children: (0, d.jsx)(s.h, { icon: 'star_border' })
}),
(0, d.jsx)(o.u, {
content: 'Pizza',
children: (0, d.jsx)(s.h, { icon: 'favorite_border' })
}),
(0, d.jsx)(o.u, {
content: 'Icecream',
children: (0, d.jsx)(s.h, { icon: 'mood' })
})
]
})
}),
(0, d.jsx)(r.sb, { children: 'Variants' }),
(0, d.jsx)(r.q3, {
label: 'With Arrow',
children: (0, d.jsx)(o.u, {
content: 'Cake',
showArrow: !0,
children: (0, d.jsx)(s.h, { icon: 'cake' })
})
}),
(0, d.jsx)(r.q3, {
label: 'Controlled / Always open',
children: (0, d.jsx)(o.u, {
content: 'Hello',
align: 'right',
open: !0,
children: (0, d.jsx)(s.h, { icon: 'mood' })
})
}),
(0, d.jsx)(r.q3, {
label: 'Rich Content',
children: (0, d.jsx)(o.u, {
content: (0, d.jsxs)('div', {
style: { display: 'flex' },
children: [
(0, d.jsx)(c.qE, {
src: 'images/avatars/captainamerica.png',
size: 'large',
name: 'Steve Rogers'
}),
(0, d.jsxs)('div', {
style: { marginLeft: '0.5rem' },
children: [
(0, d.jsx)('b', { children: 'Captain America' }),
(0, d.jsx)('div', { children: 'Steve Rogers' })
]
})
]
}),
children: (0, d.jsx)('span', {
role: 'button',
children: 'S. Rogers'
})
})
}),
(0, d.jsx)(r.q3, {
label: 'Styled content',
children: (0, d.jsx)(o.u, {
content: (0, d.jsx)('div', {
style: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: 'white',
width: '20rem',
height: '8rem',
color: 'black',
borderRadius: '3px',
margin: '0 -3px'
},
children: 'Hello World!'
}),
children: (0, d.jsx)('span', {
role: 'button',
children: 'Popover Window'
})
})
}),
(0, d.jsx)(r.q3, {
label: 'Delay',
children: (0, d.jsxs)(d.Fragment, {
children: [
(0, d.jsx)(o.u, {
content: 'Cookies',
enterDelay: 1e3,
children: (0, d.jsx)(l.z, { label: 'Enter Delay' })
}),
(0, d.jsx)(o.u, {
content: 'Pizza',
leaveDelay: 1e3,
children: (0, d.jsx)(l.z, { label: 'Leave Delay' })
}),
(0, d.jsx)(o.u, {
content: 'Icecream',
enterDelay: 1e3,
leaveDelay: 1e3,
children: (0, d.jsx)(l.z, { label: 'Both' })
})
]
})
}),
(0, d.jsx)(r.q3, {
label: 'Alignment',
children: function () {
return [
'left',
'right',
'top',
'bottom',
'topLeft',
'topRight',
'bottomLeft',
'bottomRight'
].map(function (e) {
return (0,
d.jsx)(o.u, { content: 'Align: '.concat(e), align: e, children: (0, d.jsx)(s.h, { icon: 'trip_origin' }) }, e);
});
}
}),
(0, d.jsx)(r.sb, { children: 'Activation' }),
(0, d.jsx)(r.PJ, {
children:
'By default, tooltips will activate on hover and focus. You can change this behavior by passing one or more options to the `activateOn` prop.'
}),
(0, d.jsx)(r.q3, {
label: 'Default',
children: (0, d.jsxs)(d.Fragment, {
children: [
(0, d.jsx)(o.u, {
content: 'Cookies',
activateOn: 'hover',
children: (0, d.jsx)(l.z, { label: 'Hover' })
}),
"''",
(0, d.jsx)(o.u, {
content: 'Pizza',
activateOn: 'click',
children: (0, d.jsx)(l.z, { label: 'Click' })
}),
(0, d.jsx)(o.u, {
content: 'Icecream',
activateOn: 'focus',
children: (0, d.jsx)(l.z, { label: 'Focus' })
}),
(0, d.jsx)(o.u, {
content: 'Cake',
activateOn: ['hover', 'focus'],
children: (0, d.jsx)(l.z, { label: 'Multiple' })
})
]
})
}),
(0, d.jsx)(r.sb, { children: 'Usage with RMWCProvider' }),
(0, d.jsx)(r.PJ, {
children:
'The RMWCProvider allows you to specify global defaults for your tooltips.'
}),
(0, d.jsx)(r.q3, {
label: 'Using Provider',
children: (0, d.jsx)(u.pK, {
tooltip: {
align: 'right',
activateOn: 'hover',
showArrow: !0,
leaveDelay: 500,
enterDelay: 0
},
children: (0, d.jsx)(o.u, {
content: 'Hello World!',
children: (0, d.jsx)(l.z, { label: 'With Provider' })
})
})
}),
(0, d.jsx)(r.PQ, {
src: i,
components: [{ displayName: 'Tooltip', component: o.u }]
})
]
});
}
|
You make something like a popover window by just styling your inner content.
|
p
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
c = function (e, t) {
return (
(c =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
}),
c(e, t)
);
}
|
You make something like a popover window by just styling your inner content.
|
c
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function u(e, t) {
function n() {
this.constructor = e;
}
c(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}
|
You make something like a popover window by just styling your inner content.
|
u
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function n() {
this.constructor = e;
}
|
You make something like a popover window by just styling your inner content.
|
n
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
d = function () {
return (
(d =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
return e;
}),
d.apply(this, arguments)
);
}
|
You make something like a popover window by just styling your inner content.
|
d
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(n) {
return e.call(this, d(d({}, t.defaultAdapter), n)) || this;
}
|
You make something like a popover window by just styling your inner content.
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(t) {
var n = e.call(this, t) || this;
return (
(n.wasDocked_ = !0),
(n.isDockedShowing_ = !0),
(n.currentAppBarOffsetTop_ = 0),
(n.isCurrentlyBeingResized_ = !1),
(n.resizeThrottleId_ = 0),
(n.resizeDebounceId_ = 0),
(n.lastScrollPosition_ = n.adapter.getViewportScrollY()),
(n.topAppBarHeight_ = n.adapter.getTopAppBarHeight()),
n
);
}
|
You make something like a popover window by just styling your inner content.
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t(t) {
var n = e.call(this, t) || this;
return (n.isCollapsed_ = !1), (n.isAlwaysCollapsed_ = !1), n;
}
|
You make something like a popover window by just styling your inner content.
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function t() {
var t = (null !== e && e.apply(this, arguments)) || this;
return (t.wasScrolled_ = !1), t;
}
|
You make something like a popover window by just styling your inner content.
|
t
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function l() {
return (0, s.jsxs)(r.WI, {
title: 'Top App Bar',
lead: 'Top App Bar acts as a container for items such as application title, navigation icon, and action items.',
module: '@rmwc/top-app-bar',
styles: [
'@material/top-app-bar/dist/mdc.top-app-bar.css',
'@material/icon-button/dist/mdc.icon-button.css',
'@material/ripple/dist/mdc.ripple.css',
'@rmwc/icon/icon.css'
],
docsLink: 'https://material.io/develop/web/components/top-app-bar/',
examples: a,
children: [
(0, s.jsx)(r.PJ, {
children:
'Whats the difference between the TopAppBar and Toolbar? Toolbar is technically deprecated (although it still works just fine). TopAppBar functionality continues to be worked on by the `material-components-web` team.'
}),
(0, s.jsx)(r.sb, { children: 'Basic Usage' }),
(0, s.jsx)(r.q3, {
label: 'Default',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.PY, {
children: (0, s.jsx)(o.Xv, {
children: (0, s.jsx)(o.rO, {
children: (0, s.jsx)(o.Lw, { children: 'Default' })
})
})
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.q3, {
label: 'Fully Featured',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsxs)(o.PY, {
children: [
(0, s.jsxs)(o.Xv, {
children: [
(0, s.jsxs)(o.rO, {
alignStart: !0,
children: [
(0, s.jsx)(o.Uj, { icon: 'menu' }),
(0, s.jsx)(o.Lw, { children: 'All Features' })
]
}),
(0, s.jsxs)(o.rO, {
alignEnd: !0,
children: [
(0, s.jsx)(o.xc, { icon: 'favorite' }),
(0, s.jsx)(o.xc, { icon: 'star' }),
(0, s.jsx)(o.xc, { icon: 'mood' })
]
})
]
}),
(0, s.jsx)(o.Xv, {
children: (0, s.jsx)(o.rO, {
alignStart: !0,
children: (0, s.jsx)(o.Lw, {
children: 'Another Row'
})
})
})
]
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.sb, { children: 'Simplified Usage' }),
(0, s.jsx)(r.PJ, {
children:
'You can use the `SimpleTopAppBar` component which contains a default template already laid out for you. Specify any actions you want as an array of props'
}),
(0, s.jsx)(r.q3, {
label: 'Simple',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.p9, {
title: 'test',
navigationIcon: !0,
onNav: function () {
return console.log('Navigate');
},
actionItems: [
{
icon: 'file_download',
onClick: function () {
return console.log('Do Something');
}
},
{
icon: 'print',
onClick: function () {
return console.log('Do Something');
}
},
{
icon: 'bookmark',
onClick: function () {
return console.log('Do Something');
}
}
]
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.sb, { children: 'Variants' }),
(0, s.jsx)(r.q3, {
label: 'Fixed',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.PY, {
fixed: !0,
children: (0, s.jsx)(o.Xv, {
children: (0, s.jsx)(o.rO, {
children: (0, s.jsx)(o.Lw, { children: 'Fixed' })
})
})
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.q3, {
label: 'Dense',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.PY, {
dense: !0,
children: (0, s.jsx)(o.Xv, {
children: (0, s.jsx)(o.rO, {
children: (0, s.jsx)(o.Lw, { children: 'Dense' })
})
})
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.q3, {
label: 'Short',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.PY, {
short: !0,
children: (0, s.jsxs)(o.Xv, {
children: [
(0, s.jsxs)(o.rO, {
children: [
(0, s.jsx)(o.Uj, { icon: 'menu' }),
(0, s.jsx)(o.Lw, { children: 'Short' })
]
}),
(0, s.jsx)(o.rO, {
alignEnd: !0,
children: (0, s.jsx)(o.xc, { icon: 'favorite' })
})
]
})
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.q3, {
label: 'Prominent',
iframe: !0,
children: (0, s.jsxs)(s.Fragment, {
children: [
(0, s.jsx)(o.PY, {
prominent: !0,
children: (0, s.jsx)(o.Xv, {
children: (0, s.jsx)(o.rO, {
children: (0, s.jsx)(o.Lw, { children: 'Prominent' })
})
})
}),
(0, s.jsx)(o.Jl, {}),
(0, s.jsx)('div', {
style: { height: '100rem', padding: '1rem' },
children: 'Scroll Me'
})
]
})
}),
(0, s.jsx)(r.PQ, {
src: i,
components: [
{ displayName: 'TopAppBar', component: o.PY },
{ displayName: 'TopAppBarRow', component: o.Xv },
{ displayName: 'TopAppBarSection', component: o.rO },
{ displayName: 'TopAppBarTitle', component: o.Lw },
{ displayName: 'TopAppBarNavigationIcon', component: o.Uj },
{ displayName: 'TopAppBarActionItem', component: o.xc },
{ displayName: 'TopAppBarFixedAdjust', component: o.Jl },
{ displayName: 'SimpleTopAppBar', component: o.p9 }
]
})
]
});
}
|
Additionally you can specify shortCollapsed to have it always minimized
|
l
|
javascript
|
rmwc/rmwc
|
apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
https://github.com/rmwc/rmwc/blob/master/apps/docs/public/version/8.0.8/static/js/main.6c3f4ae5.js
|
MIT
|
function HZ(){return r.jsxs(et,{title:"Dialogs",lead:"Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.",module:"@rmwc/dialog",styles:["@material/dialog/dist/mdc.dialog.css","@material/button/dist/mdc.button.css","@material/ripple/dist/mdc.ripple.css"],docsLink:"https://material.io/develop/web/components/dialogs/",examples:FZ,children:[r.jsx(fe,{children:"Standard Usage"}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(vm,{open:t,onClose:a=>{console.log(a.detail.action),n(!1)},onClosed:a=>console.log(a.detail.action),children:[r.jsx(xm,{children:"Dialog Title"}),r.jsx(km,{children:"This is a standard dialog."}),r.jsxs(wm,{children:[r.jsx(pc,{action:"close",children:"Cancel"}),r.jsx(pc,{action:"accept",isDefaultAction:!0,children:"Sweet!"})]})]}),r.jsx(ye,{raised:!0,onClick:()=>n(!0),children:"Open standard Dialog"})]})}}),r.jsx(fe,{children:"Simplified Usage"}),r.jsx(ce,{children:"Material Dialogs are a complex component. RMWC contains an additional `SimpleDialog` component for ease of use that internally contains the default structure already built out. Illustrated below is both the standard and simple dialog usage."}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(Mu,{title:"This is a simple dialog",body:"You can pass the body prop or children.",open:t,onClose:a=>{console.log(a.detail.action),n(!1)}}),r.jsx(ye,{raised:!0,onClick:()=>n(!0),children:"Open Simple Dialog"})]})}}),r.jsx(fe,{children:"Usage with DialogQueue"}),r.jsx(ce,{children:"Some dialog interactions are complex, but a lot of the time you just need a simple alert or confirm dialog. `DialogQueue` allows you to open dialogs from anywhere in your app and emulates the browsers built in `alert`, `confirm` and `prompt` dialogs. If you've used the `SnackbarQueue`, the `DialogQueue` is very similar."}),r.jsx(ce,{children:"Setup is nice and easy, create a queue object you can pass around in your code base, pass the queues `dialogs` to the `DialogQueue`component, and then use the `alert`, `prompt` or `confirm` api to open dialogs."}),r.jsx(j,{codeOnly:!0,children:`
// Create a file that exports your queue
// myQueue.js
import { createDialogQueue } from '@rmwc/dialog';
export const queue = createDialogQueue();
`}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the DialogQueue
import React from 'react';
import { queue } from './myQueue';
export default function App() {
return (
<div>
...
<DialogQueue
dialogs={queue.dialogs}
// You can also pass default options to pass to your dialogs
// ie, prevent all dialogs from dismissing from a click on the background scrim
preventOutsideDismiss
/>
</div>
)
}
`}),r.jsx(ce,{children:"The `alert`, `confirm`, and `prompt` functions were designed to mimic the the built-in browser methods with a couple of small difference. First, they all return a promise. The promise will always resolve successfully with the response indicating the appropriate action. `alert` the response will be `accept` for clicking the ok button, or `close`. `confirm` will resolve `true` or `false`, and `prompt` will resolve with the value entered into the input, or `null` if the closed the dialog. Second, all methods the methods accept any valid prop for `SimpleDialog`."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere else in your app
// Could be a view, your redux store, anywhere you want...
import { queue } from './myQueue';
queue.alert({
title: 'Hi there',
body: 'Whats going on?'
});
queue.confirm({
title: <b>Are you positive?</b>,
body: 'You have selected pizza instead icecream!',
acceptLabel: 'CONFIRM'
});
queue.prompt({
title: 'Whats your name?',
body: 'Anything will do',
acceptLabel: 'Submit',
cancelLabel: 'Skip',
// For prompts only, you can pass props to the input
inputProps: {
outlined: true
}
});
`}),r.jsx(j,{label:"Inline Example",children:()=>{const{dialogs:e,alert:t,confirm:n,prompt:a}=JL();function s(){const[i,o]=q.useState("____________"),l=()=>t({title:"Hello!"}).then(d=>o(d)),u=()=>n({}).then(d=>o(d)),p=()=>a({inputProps:{outlined:!0}}).then(d=>o(d));return r.jsxs("div",{children:[r.jsx(ye,{label:"Alert",onClick:l}),r.jsx(ye,{label:"Confirm",onClick:u}),r.jsx(ye,{label:"Prompt",onClick:p}),r.jsx(ye,{label:"In Sequence",onClick:()=>{l(),u(),p()}}),r.jsxs("p",{children:["Response: ",r.jsx("b",{children:String(i)})]}),r.jsx(ZL,{dialogs:e})]})}return r.jsx(s,{})}}),r.jsx(fe,{children:"Rendering through Portals"}),r.jsx(ce,{children:"Occasionally, you may find your dialog being cut off from being inside a container that is styled to be `overflow:hidden`. RMWC provides a `renderToPortal` prop that lets you use React's portal functionality to render the menu dropdown in a different container."}),r.jsx(ce,{children:"You can specify any element or selector you want, but the simplest method is to pass `true` and use RMWC's built in `Portal` component."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the RMWC Portal
// You only have to do this once
import React from 'react';
import { Portal } from '@rmwc/base';
export default function App() {
return (
<div>
...
<Portal />
</div>
)
}
`}),r.jsx(ce,{children:"Now you can use the `renderToPortal` prop. Below is a contrived example of a dialog being cut off due to `overflow: hidden`."}),r.jsx(j,{children:function(){const[t,n]=q.useState(!0),[a,s]=q.useState(!1);return r.jsxs("div",{id:"dialog-portal-example",style:{transform:"translateZ(0)",height:"20rem",overflow:"hidden"},children:[r.jsx(Mu,{title:`This is a ${t?"working!":"broken :/"}`,renderToPortal:t,body:"Use `renderToPortal` to get around `overflow:hidden` and layout issues.",open:a,onClose:i=>{console.log(i.detail.action),s(!1)}}),r.jsx(ye,{raised:!0,onClick:()=>{n(!1),s(!0)},children:"Open Broken :/"}),r.jsx(ye,{raised:!0,onClick:()=>{n(!0),s(!0)},children:"Open in Portal"})]})}}),r.jsx(nt,{src:UZ,components:[{displayName:"Dialog",component:vm},{displayName:"DialogTitle",component:xm},{displayName:"DialogContent",component:km},{displayName:"DialogActions",component:wm},{displayName:"DialogButton",component:pc},{displayName:"SimpleDialog",component:Mu}]})]})}
|
Wrapping a button in TouchTargetWrapper will automatically set its \`touch\` prop to true.
|
HZ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-0Agoflvm.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-0Agoflvm.js
|
MIT
|
function kJ(){return r.jsxs(et,{title:"Icons",lead:"Material icons use geometric shapes to visually represent core ideas, capabilities, or topics.",module:"@rmwc/icon",styles:["@rmwc/icon/icon.css"],docsLink:"https://material.io/icons",examples:yJ,children:[r.jsx(fe,{children:"Setup"}),r.jsx(ce,{children:"Icons are not part of the official material-components-web spec, but they are referenced many times in the documentation. RMWC provides a declarative way to use icons. Note that RMWC does not ship with any icons of its own. Make sure you include an icon set! You can use any one you want, but Google's Material Icons are available through open source. Follow Google's developer guide to get them setup with your app. https://google.github.io/material-design-icons/"}),r.jsx(ce,{children:"There are lots of different strategies for implementing icons on the web, and the Icon component is flexible for most of them. Use ligatures, classNames, inline SVGs, HTML, or URLs to get icons into your app. The default strategy is 'ligature' which works with the material.io font icon set."}),r.jsx(fe,{children:"Basic Usage"}),r.jsx(ce,{children:"The Icon component, (really the icon prop itself) can accept a variety of formats. Anywhere you see a component prop like `icon` or `trailingIcon` will inherit the same behavior."}),r.jsx(j,{label:"String",children:r.jsx(qe,{icon:"favorite"})}),r.jsx(j,{label:"Child Component",children:r.jsx(qe,{icon:r.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})})}),r.jsx(j,{label:"Passing Options",children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"star",strategy:"ligature"}}),r.jsx(ye,{label:"Hello!",icon:{icon:"add",onMouseOver:()=>console.log("OVER")}})]})}),r.jsx(fe,{children:"Icon Sizing"}),r.jsx(ce,{children:"The Material spec details multiple sizes for icons. The Icon component doesn't assign a size by default, but these are available to you to force a size. Please note, this will only work if you've included the RMWC icon css file."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"favorite",size:"xsmall"}}),r.jsx(qe,{icon:{icon:"favorite",size:"small"}}),r.jsx(qe,{icon:{icon:"favorite",size:"medium"}}),r.jsx(qe,{icon:{icon:"favorite",size:"large"}}),r.jsx(qe,{icon:{icon:"favorite",size:"xlarge"}})]})}),r.jsx(fe,{children:"Ligatures"}),r.jsx(ce,{children:"This is for icon fonts that support ligatures like material-icons. This is the default strategy if nothing is set and doesn't require any additional setup if you are using material-icons."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:"favorite"}),r.jsx(qe,{icon:"favorite_outline"}),r.jsx(qe,{icon:{icon:"star",strategy:"ligature"}})]})}),r.jsx(fe,{children:"URLs"}),r.jsx(ce,{children:"This is for icons that are accessible via HTTP(S) and will be loaded directly into an `img` tag. This can be auto-detected for things that look like urls. The image will be set as a backgroundImage of the icon. Make sure you impor the RMWC icon css file for this to work properly."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:"images/icons/twitter.png"}),r.jsx(qe,{icon:{icon:"images/icons/twitter.png",strategy:"url"}})]})}),r.jsx(fe,{children:"Components / Inline SVGs"}),r.jsx(ce,{children:"This will render a child component inside of the icon. This is useful for all sorts of customization and for rendering inline SVGs. The following example shows rendering an SVG, as well as an arbitrary `div`."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:r.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})}),r.jsx(qe,{icon:{strategy:"component",icon:r.jsx("svg",{style:{width:"24px",height:"24px"},viewBox:"0 0 24 24",children:r.jsx("path",{fill:"#4285F4",d:"M21.35,11.1H12.18V13.83H18.69C18.36,17.64 15.19,19.27 12.19,19.27C8.36,19.27 5,16.25 5,12C5,7.9 8.2,4.73 12.2,4.73C15.29,4.73 17.1,6.7 17.1,6.7L19,4.72C19,4.72 16.56,2 12.1,2C6.42,2 2.03,6.8 2.03,12C2.03,17.05 6.16,22 12.25,22C17.6,22 21.5,18.33 21.5,12.91C21.5,11.76 21.35,11.1 21.35,11.1V11.1Z"})})}})]})}),r.jsx(fe,{children:"Classnames"}),r.jsx(ce,{children:"Some font icon sets like Ion Icons and Glyph Icons render based on a className that is set. RMWC docs doesn't include extra icon fonts so there is no example to render, but the below code should give you an approximation."}),r.jsx(ce,{children:"**THIS CANNOT BE AUTO DETECTED**. You'll have to explicitly set the strategy directly on the Icon or specify it globally via the RMWCProvider."}),r.jsx(j,{codeOnly:!0,children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"star",strategy:"className",basename:"icon",prefix:"ion-"}}),r.jsx(ui,{icon:{strategy:"className",basename:"glyphicons",prefix:"glyphicons-"},children:r.jsx(qe,{icon:"heart"})})]})}),r.jsx(fe,{children:"Custom Rendering"}),r.jsx(ce,{children:"Sometimes, you just need to do your own thing. Maybe you have a legacy project that already has icons and you want to incorporate them with RMWC. If none of the other strategies are what you need, then you can hijack the whole thing and delegate it to your own render function."}),r.jsx(j,{label:"Simple Example",children:r.jsx(qe,{icon:{icon:"favorite",strategy:"custom",render:({content:e})=>r.jsxs("div",{children:["Hello + ",e]})}})}),r.jsx(ce,{children:"A more relevant example involves an app that has a custom / existing icon component. There are a litany of reasons why your app might need one, but if you've found this section of the docs you likely know what problem you need to solve."}),r.jsx(j,{codeOnly:!0,children:`
// 1) Your app has an icon component you use
import { MyIconComponent } from '@rmwc/icon';
<MyIconComponent name="search" />
// 2) Now you are using RMWC, lots of components are instances of Icons
// You need to be able to delegate the handling of an icon prop to your own component
import { TextField } from '@rmwc/textField';
import { Chip } from '@rmwc/chip';
<TextField icon="favorite" />
<Chip icon="favorite" />
// 3) Instead, you should set the custom strategy to be your default
// and add your own handling with RMWCProvider
import React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App'; // your main app component
import { RMWCProvider } from '@rmwc/provider';
import { MyIconComponent } from '@rmwc/icon';
const iconRenderHandler = ({ content, className, ...rest }) => {
// content is whatever was passed to the icon prop
// className is the fully processed className taking into account the basename and prefix defaults
// it's important to include this because MDC often has classes like text-field-icon directly
// on the component for alignment
// rest is just any other props
return <MyIconComponent className={className} name={content} {...rest} />
};
ReactDOM.render(
<RMWCProvider icon={{strategy: 'custom', render: iconRenderHandler}}>
<App />
</RMWCProvider>,
document.getElementById('root')
);
// 4) Now anywhere in your app that an Icon instance is used, it will be
// delegated to your handler and render your custom component
import { TextFieldIcon } from '@rmwc/textfield';
<TextFieldIcon icon="search" />
`}),r.jsx(nt,{src:xJ,components:[{displayName:"Icon",component:qe}]})]})}
|
Set the option globally throug RMWCProvider
Glyphicons <span class="glyphicons glyphicons-heart"></span>
|
kJ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-0Agoflvm.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-0Agoflvm.js
|
MIT
|
function YJ(){return r.jsxs(et,{title:"Menus",lead:"Menus display a list of choices on a transient sheet of material.",module:"@rmwc/menu",styles:["@material/menu/dist/mdc.menu.css","@material/menu-surface/dist/mdc.menu-surface.css","@material/ripple/dist/mdc.ripple.css","@material/list/dist/mdc.list.css","@rmwc/icon/icon.css"],docsLink:"https://material.io/develop/web/components/menus/",examples:VJ,children:[r.jsx(fe,{children:"Basic Usage"}),r.jsx(ce,{children:"You can compose a menu with the given components, and manually manage the open state. `Menu` expects MenuItems as children while `MenuSurface` is a generic container which can have anything as a child."}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(ts,{children:[r.jsxs(Ir,{open:t,onSelect:a=>console.log(a.detail.index),onClose:()=>n(!1),children:[r.jsx(Wn,{children:"Cookies"}),r.jsx(Wn,{children:"Pizza"}),r.jsx(oi,{}),r.jsx(Wn,{children:"Icecream"})]}),r.jsx(ye,{raised:!0,onClick:()=>n(!t),children:"Menu"})]})}}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(ts,{children:[r.jsx(Ar,{open:t,onClose:a=>n(!1),children:r.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Make the content whatever you want."})}),r.jsx(ye,{raised:!0,onClick:a=>n(!t),children:"Menu Surface"})]})}}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(ts,{children:[r.jsx(Ar,{open:t,onClose:()=>n(!1),children:r.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Menu"})}),r.jsx(pt,{icon:"menu",onClick:()=>n(!t)})]})}}),r.jsx(j,{children:function(){const[t,n]=q.useState(!1);return r.jsxs(ts,{children:[r.jsxs(Ir,{open:t,onSelect:a=>console.log(a.detail.index),onClose:()=>n(!1),children:[r.jsx(Wn,{children:"Item One"}),r.jsx(Wn,{disabled:!0,children:"Item Two (disabled)"}),r.jsx(Wn,{children:"Item Three"})]}),r.jsx(ye,{raised:!0,onClick:()=>n(!t),children:"Menu"})]})}}),r.jsx(fe,{children:"Simplified usage"}),r.jsx(ce,{children:"RMWC provides a convenience `SimpleMenu` component that takes a handle as a prop, and manages the open state for you."}),r.jsx(j,{children:r.jsxs(tm,{handle:r.jsx(ye,{children:"Simple Menu"}),children:[r.jsx(Wn,{children:"Cookies"}),r.jsx(Wn,{children:"Pizza"}),r.jsx(Wn,{children:"Icecream"})]})}),r.jsx(j,{children:r.jsx(D1,{handle:r.jsx(ye,{children:"Simple Menu Surface"}),children:r.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Make the content whatever you want."})})}),r.jsx(fe,{children:"Anchoring"}),r.jsx(ce,{children:"By default, Menus will attempt to automatically position themselves, but this behavior can be overridden by setting the `anchorCorner` prop."}),r.jsx(j,{children:function(){const[t,n]=q.useState("topLeft");return r.jsxs(r.Fragment,{children:[r.jsxs(ts,{children:[r.jsx(Ar,{anchorCorner:t,open:!0,children:r.jsxs("div",{style:{padding:"1rem",width:"8rem"},children:["anchorCorner: ",t]})}),r.jsx(ye,{raised:!0,label:"Anchored Menu"})]}),r.jsx(Ut,{value:t,label:"anchorCorner",onChange:a=>n(a.currentTarget.value),options:["topLeft","topRight","bottomLeft","bottomRight","topStart","topEnd","bottomStart","bottomEnd"]})]})}}),r.jsx(fe,{children:"Rendering through Portals"}),r.jsx(ce,{children:"Occasionally, you may find your menu being cut off from being inside a container that is styled to be `overflow:hidden`. RMWC provides a `renderToPortal` prop that lets you use React's portal functionality to render the menu dropdown in a different container."}),r.jsx(ce,{children:"You can specify any element or selector you want, but the simplest method is to pass `true` and use RMWC's built in `Portal` component."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the RMWC Portal
// You only have to do this once
import React from 'react';
import { Portal } from '@rmwc/base';
export default function App() {
return (
<div>
...
<Portal />
</div>
)
}
`}),r.jsx(ce,{children:"Now you can use the `renderToPortal` prop. Below is a contrived example of a menu being cut off due to `overflow: hidden`."}),r.jsx(j,{children:function(){const[t,n]=q.useState(!0),[a,s]=q.useState(!1),i=["Cookies","Pizza","Icecream"];return r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{marginBottom:"10rem",height:"3.5rem",overflow:"hidden"},children:r.jsxs(ts,{children:[r.jsx(ye,{raised:!0,onClick:()=>s(!a),children:"Open Menu"}),r.jsx(Ir,{open:a,onClose:()=>s(!1),renderToPortal:t,children:i.map(o=>r.jsx(Wn,{children:o},o))})]})}),r.jsx(Dn,{checked:t,onChange:o=>n(o.currentTarget.checked),label:"renderToPortal"})]})}}),r.jsx(nt,{src:KJ,components:[{displayName:"Menu",component:Ir},{displayName:"MenuItem",component:Wn},{displayName:"MenuSurface",component:Ar},{displayName:"MenuSurfaceAnchor",component:ts},{displayName:"SimpleMenu",component:tm},{displayName:"SimpleMenuSurface",component:D1}]})]})}
|
The handle can be any component you want
|
YJ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-0Agoflvm.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-0Agoflvm.js
|
MIT
|
function eee(){return r.jsxs(et,{title:"Provider",lead:"A component that provides global configuration for RMWC.",module:"@rmwc/provider",styles:[],examples:QJ,children:[r.jsx(ce,{children:"You can wrap your top level App component with RMWC provider to set global configuration options. Just pass the options in as props."}),r.jsx(j,{codeOnly:!0,children:`
import React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App'; // your main app component
import { RMWCProvider } from '@rmwc/provider';
// This example disables ripples globally by default
ReactDOM.render(
<RMWCProvider
// Globally disable ripples
ripple={false}
// Global options for icons
// Takes the same options as the icon component
icon={{
basename: 'material-icons'
}}
// Global options for typography
// allows mapping of a defaultTag or specific classes
// See the Typography docs for more info
typography={{
defaultTag: 'div',
headline1: 'h1'
}}
// Global options for tooltips
// Takes most of the options for tooltips
// See the Tooltip docs for more info
tooltip={{
align: 'right'
}}
>
<App />
</RMWCProvider>,
document.getElementById('root'),
);
`}),r.jsx(j,{label:"With ripple false",children:r.jsx(ui,{ripple:!1,children:r.jsx(ye,{children:"Click me"})})}),r.jsx(j,{label:"With ripple true",children:r.jsx(ui,{ripple:!0,children:r.jsx(ye,{children:"Click me"})})}),r.jsx(nt,{src:JJ,components:[{displayName:"RMWCProvider",component:ui}]})]})}
|
The handle can be any component you want
|
eee
|
javascript
|
rmwc/rmwc
|
docs/assets/index-0Agoflvm.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-0Agoflvm.js
|
MIT
|
function Aee(){return r.jsxs(et,{title:"Snackbars",lead:"Snackbars provide brief feedback about an operation through a message at the bottom of the screen.",module:"@rmwc/snackbar",styles:["@material/snackbar/dist/mdc.snackbar.css","@material/button/dist/mdc.button.css","@material/ripple/dist/mdc.ripple.css"],docsLink:"https://material.io/develop/web/components/snackbars/",examples:Eee,children:[r.jsx(fe,{children:"Basic Usage"}),r.jsx(ce,{children:"You can render a snackbar in your UI and control its open state."}),r.jsx(j,{label:"Default",children:function(){const[t,n]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(Fo,{open:t,onClose:a=>n(!1),message:"This is a new message",dismissesOnAction:!0,action:r.jsx(Bo,{label:"Dismiss",onClick:()=>console.log("Click Me")})}),r.jsx(ye,{raised:!0,label:"Show snackbar",onClick:a=>n(!t)})]})}}),r.jsx(j,{label:"Start Aligned",children:function(){const[t,n]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(Fo,{open:t,onClose:a=>n(!1),message:"Start aligned, open until dismissed",stacked:!0,dismissesOnAction:!0,action:[r.jsx(Bo,{label:"Yeah!"}),r.jsx(Bo,{label:"No..."})],leading:!0,timeout:-1}),r.jsx(ye,{raised:!0,label:"Show start-aligned",onClick:a=>n(!t)})]})}}),r.jsx(j,{label:"With dismiss icon",children:function(){const[t,n]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(Fo,{open:t,onClose:a=>n(!1),message:"This is a new message",dismissesOnAction:!0,dismissIcon:"close",timeout:-1}),r.jsx(ye,{raised:!0,label:"Show snackbar",onClick:a=>n(!t)})]})}}),r.jsx(fe,{children:"Usage with SnackbarQueue"}),r.jsx(ce,{children:"While rendering the Snackbar inline works for simple cases, you'll likely have a notification system, or want to send notifications from anywhere in your app. The `SnackbarQueue` exists as a convenient interface for handling these cases and rendering the snackbar messages for you. If you've used the `DialogQueue`, the `SnackbarQueue` is very similar."}),r.jsx(ce,{children:"Setup is nice and easy, create a queue object you can pass around in your code base, pass the queues `messages` to the `SnackbarQueue` component, and then use the `notify` function to send notifications."}),r.jsx(j,{codeOnly:!0,children:`
// Create a file that exports your queue
// myQueue.js
import { createSnackbarQueue } from '@rmwc/snackbar';
export const queue = createSnackbarQueue();
`}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the SnackbarQueue
import React from 'react';
import { queue } from './myQueue';
export default function App() {
return (
<div>
...
<SnackbarQueue
messages={queue.messages}
// You can also pass default options to pass to your notifications
// ie, make them all leading, stacked, etc
leading
stacked
/>
</div>
)
}
`}),r.jsx(ce,{children:"The `notify` function was designed to mimic the the built-in browser Notifications api and can accept most of the relevant options (icon, image, title, body, actions, ,etc). It also can accept any of the Snackbar props. Just import your queue, and call the notify method."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere else in your app
// Could be a view, your redux store, anywhere you want...
import { queue } from './myQueue';
// Simple example
queue.notify({
title: 'Hi there'
});
// With some features
queue.notify({
title: <b>Warning</b>,
body: 'You have selected pizza instead icecream!',
icon: 'warning',
actions: [
{
// NotificationAction api format
title: 'Fix It!',
icon: 'close',
action: 'fixit' // action will be available as evt.detail.reason in the onClose event
},
{
// OR SnackbarActionProps format
label: 'Continue...',
icon: 'check',
onClick: () => {}
},
]
});
`}),r.jsx(j,{label:"Inline Example",children:()=>{const{messages:e,notify:t}=rD();function n(){return r.jsxs("div",{children:[r.jsx(ye,{label:"Notify",onClick:()=>t({title:r.jsx("b",{children:"Success"}),body:"You have selected pizza!",dismissesOnAction:!0,icon:"check",actions:[{title:"Dismiss"}]})}),r.jsx(iD,{messages:e})]})}return r.jsx(n,{})}}),r.jsx(nt,{src:Ree,components:[{displayName:"Snackbar",component:Fo},{displayName:"SnackbarAction",component:Bo}]})]})}
|
Any additional items will be passed to the
child ListItem as props
|
Aee
|
javascript
|
rmwc/rmwc
|
docs/assets/index-0Agoflvm.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-0Agoflvm.js
|
MIT
|
function tJ(){return o.jsxs(lt,{title:"Dialogs",lead:"Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.",module:"@rmwc/dialog",styles:["@material/dialog/dist/mdc.dialog.css","@material/button/dist/mdc.button.css","@material/ripple/dist/mdc.ripple.css"],docsLink:"https://material.io/develop/web/components/dialogs/",examples:ZZ,children:[o.jsx(he,{children:"Standard Usage"}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs(km,{open:t,onClose:a=>{console.log(a.detail.action),n(!1)},onClosed:a=>console.log(a.detail.action),children:[o.jsx(wm,{children:"Dialog Title"}),o.jsx(Pm,{children:"This is a standard dialog."}),o.jsxs(Em,{children:[o.jsx(fc,{action:"close",children:"Cancel"}),o.jsx(fc,{action:"accept",isDefaultAction:!0,children:"Sweet!"})]})]}),o.jsx(ke,{raised:!0,onClick:()=>n(!0),children:"Open standard Dialog"})]})}}),o.jsx(he,{children:"Simplified Usage"}),o.jsx(ue,{children:"Material Dialogs are a complex component. RMWC contains an additional `SimpleDialog` component for ease of use that internally contains the default structure already built out. Illustrated below is both the standard and simple dialog usage."}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Fu,{title:"This is a simple dialog",body:"You can pass the body prop or children.",open:t,onClose:a=>{console.log(a.detail.action),n(!1)}}),o.jsx(ke,{raised:!0,onClick:()=>n(!0),children:"Open Simple Dialog"})]})}}),o.jsx(he,{children:"Usage with DialogQueue"}),o.jsx(ue,{children:"Some dialog interactions are complex, but a lot of the time you just need a simple alert or confirm dialog. `DialogQueue` allows you to open dialogs from anywhere in your app and emulates the browsers built in `alert`, `confirm` and `prompt` dialogs. If you've used the `SnackbarQueue`, the `DialogQueue` is very similar."}),o.jsx(ue,{children:"Setup is nice and easy, create a queue object you can pass around in your code base, pass the queues `dialogs` to the `DialogQueue`component, and then use the `alert`, `prompt` or `confirm` api to open dialogs."}),o.jsx(M,{codeOnly:!0,children:`
// Create a file that exports your queue
// myQueue.js
import { createDialogQueue } from '@rmwc/dialog';
export const queue = createDialogQueue();
`}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the DialogQueue
import React from 'react';
import { queue } from './myQueue';
export default function App() {
return (
<div>
...
<DialogQueue
dialogs={queue.dialogs}
// You can also pass default options to pass to your dialogs
// ie, prevent all dialogs from dismissing from a click on the background scrim
preventOutsideDismiss
/>
</div>
)
}
`}),o.jsx(ue,{children:"The `alert`, `confirm`, and `prompt` functions were designed to mimic the the built-in browser methods with a couple of small difference. First, they all return a promise. The promise will always resolve successfully with the response indicating the appropriate action. `alert` the response will be `accept` for clicking the ok button, or `close`. `confirm` will resolve `true` or `false`, and `prompt` will resolve with the value entered into the input, or `null` if the closed the dialog. Second, all methods the methods accept any valid prop for `SimpleDialog`."}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere else in your app
// Could be a view, your redux store, anywhere you want...
import { queue } from './myQueue';
queue.alert({
title: 'Hi there',
body: 'Whats going on?'
});
queue.confirm({
title: <b>Are you positive?</b>,
body: 'You have selected pizza instead icecream!',
acceptLabel: 'CONFIRM'
});
queue.prompt({
title: 'Whats your name?',
body: 'Anything will do',
acceptLabel: 'Submit',
cancelLabel: 'Skip',
// For prompts only, you can pass props to the input
inputProps: {
outlined: true
}
});
`}),o.jsx(M,{label:"Inline Example",children:()=>{const{dialogs:e,alert:t,confirm:n,prompt:a}=nD();function s(){const[i,r]=G.useState("____________"),l=()=>t({title:"Hello!"}).then(d=>r(d)),c=()=>n({}).then(d=>r(d)),p=()=>a({inputProps:{outlined:!0}}).then(d=>r(d));return o.jsxs("div",{children:[o.jsx(ke,{label:"Alert",onClick:l}),o.jsx(ke,{label:"Confirm",onClick:c}),o.jsx(ke,{label:"Prompt",onClick:p}),o.jsx(ke,{label:"In Sequence",onClick:()=>{l(),c(),p()}}),o.jsxs("p",{children:["Response: ",o.jsx("b",{children:String(i)})]}),o.jsx(tD,{dialogs:e})]})}return o.jsx(s,{})}}),o.jsx(he,{children:"Rendering through Portals"}),o.jsx(ue,{children:"Occasionally, you may find your dialog being cut off from being inside a container that is styled to be `overflow:hidden`. RMWC provides a `renderToPortal` prop that lets you use React's portal functionality to render the menu dropdown in a different container."}),o.jsx(ue,{children:"You can specify any element or selector you want, but the simplest method is to pass `true` and use RMWC's built in `Portal` component."}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the RMWC Portal
// You only have to do this once
import React from 'react';
import { Portal } from '@rmwc/base';
export default function App() {
return (
<div>
...
<Portal />
</div>
)
}
`}),o.jsx(ue,{children:"Now you can use the `renderToPortal` prop. Below is a contrived example of a dialog being cut off due to `overflow: hidden`."}),o.jsx(M,{children:function(){const[t,n]=G.useState(!0),[a,s]=G.useState(!1);return o.jsxs("div",{id:"dialog-portal-example",style:{transform:"translateZ(0)",height:"20rem",overflow:"hidden"},children:[o.jsx(Fu,{title:`This is a ${t?"working!":"broken :/"}`,renderToPortal:t,body:"Use `renderToPortal` to get around `overflow:hidden` and layout issues.",open:a,onClose:i=>{console.log(i.detail.action),s(!1)}}),o.jsx(ke,{raised:!0,onClick:()=>{n(!1),s(!0)},children:"Open Broken :/"}),o.jsx(ke,{raised:!0,onClick:()=>{n(!0),s(!0)},children:"Open in Portal"})]})}}),o.jsx(ct,{src:eJ,components:[{displayName:"Dialog",component:km},{displayName:"DialogTitle",component:wm},{displayName:"DialogContent",component:Pm},{displayName:"DialogActions",component:Em},{displayName:"DialogButton",component:fc},{displayName:"SimpleDialog",component:Fu}]})]})}
|
Wrapping a button in TouchTargetWrapper will automatically set its \`touch\` prop to true.
|
tJ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-1Of8Dzgh.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-1Of8Dzgh.js
|
MIT
|
function NJ(){return o.jsxs(lt,{title:"Icons",lead:"Material icons use geometric shapes to visually represent core ideas, capabilities, or topics.",module:"@rmwc/icon",styles:["@rmwc/icon/icon.css"],docsLink:"https://material.io/icons",examples:DJ,children:[o.jsx(he,{children:"Setup"}),o.jsx(ue,{children:"Icons are not part of the official material-components-web spec, but they are referenced many times in the documentation. RMWC provides a declarative way to use icons. Note that RMWC does not ship with any icons of its own. Make sure you include an icon set! You can use any one you want, but Google's Material Icons are available through open source. Follow Google's developer guide to get them setup with your app. https://google.github.io/material-design-icons/"}),o.jsx(ue,{children:"There are lots of different strategies for implementing icons on the web, and the Icon component is flexible for most of them. Use ligatures, classNames, inline SVGs, HTML, or URLs to get icons into your app. The default strategy is 'ligature' which works with the material.io font icon set."}),o.jsx(he,{children:"Basic Usage"}),o.jsx(ue,{children:"The Icon component, (really the icon prop itself) can accept a variety of formats. Anywhere you see a component prop like `icon` or `trailingIcon` will inherit the same behavior."}),o.jsx(M,{label:"String",children:o.jsx(qe,{icon:"favorite"})}),o.jsx(M,{label:"Child Component",children:o.jsx(qe,{icon:o.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})})}),o.jsx(M,{label:"Passing Options",children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:{icon:"star",strategy:"ligature"}}),o.jsx(ke,{label:"Hello!",icon:{icon:"add",onMouseOver:()=>console.log("OVER")}})]})}),o.jsx(he,{children:"Icon Sizing"}),o.jsx(ue,{children:"The Material spec details multiple sizes for icons. The Icon component doesn't assign a size by default, but these are available to you to force a size. Please note, this will only work if you've included the RMWC icon css file."}),o.jsx(M,{children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:{icon:"favorite",size:"xsmall"}}),o.jsx(qe,{icon:{icon:"favorite",size:"small"}}),o.jsx(qe,{icon:{icon:"favorite",size:"medium"}}),o.jsx(qe,{icon:{icon:"favorite",size:"large"}}),o.jsx(qe,{icon:{icon:"favorite",size:"xlarge"}})]})}),o.jsx(he,{children:"Ligatures"}),o.jsx(ue,{children:"This is for icon fonts that support ligatures like material-icons. This is the default strategy if nothing is set and doesn't require any additional setup if you are using material-icons."}),o.jsx(M,{children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:"favorite"}),o.jsx(qe,{icon:"favorite_outline"}),o.jsx(qe,{icon:{icon:"star",strategy:"ligature"}})]})}),o.jsx(he,{children:"URLs"}),o.jsx(ue,{children:"This is for icons that are accessible via HTTP(S) and will be loaded directly into an `img` tag. This can be auto-detected for things that look like urls. The image will be set as a backgroundImage of the icon. Make sure you impor the RMWC icon css file for this to work properly."}),o.jsx(M,{children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:"images/icons/twitter.png"}),o.jsx(qe,{icon:{icon:"images/icons/twitter.png",strategy:"url"}})]})}),o.jsx(he,{children:"Components / Inline SVGs"}),o.jsx(ue,{children:"This will render a child component inside of the icon. This is useful for all sorts of customization and for rendering inline SVGs. The following example shows rendering an SVG, as well as an arbitrary `div`."}),o.jsx(M,{children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:o.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})}),o.jsx(qe,{icon:{strategy:"component",icon:o.jsx("svg",{style:{width:"24px",height:"24px"},viewBox:"0 0 24 24",children:o.jsx("path",{fill:"#4285F4",d:"M21.35,11.1H12.18V13.83H18.69C18.36,17.64 15.19,19.27 12.19,19.27C8.36,19.27 5,16.25 5,12C5,7.9 8.2,4.73 12.2,4.73C15.29,4.73 17.1,6.7 17.1,6.7L19,4.72C19,4.72 16.56,2 12.1,2C6.42,2 2.03,6.8 2.03,12C2.03,17.05 6.16,22 12.25,22C17.6,22 21.5,18.33 21.5,12.91C21.5,11.76 21.35,11.1 21.35,11.1V11.1Z"})})}})]})}),o.jsx(he,{children:"Classnames"}),o.jsx(ue,{children:"Some font icon sets like Ion Icons and Glyph Icons render based on a className that is set. RMWC docs doesn't include extra icon fonts so there is no example to render, but the below code should give you an approximation."}),o.jsx(ue,{children:"**THIS CANNOT BE AUTO DETECTED**. You'll have to explicitly set the strategy directly on the Icon or specify it globally via the RMWCProvider."}),o.jsx(M,{codeOnly:!0,children:o.jsxs(o.Fragment,{children:[o.jsx(qe,{icon:{icon:"star",strategy:"className",basename:"icon",prefix:"ion-"}}),o.jsx(hi,{icon:{strategy:"className",basename:"glyphicons",prefix:"glyphicons-"},children:o.jsx(qe,{icon:"heart"})})]})}),o.jsx(he,{children:"Custom Rendering"}),o.jsx(ue,{children:"Sometimes, you just need to do your own thing. Maybe you have a legacy project that already has icons and you want to incorporate them with RMWC. If none of the other strategies are what you need, then you can hijack the whole thing and delegate it to your own render function."}),o.jsx(M,{label:"Simple Example",children:o.jsx(qe,{icon:{icon:"favorite",strategy:"custom",render:({content:e})=>o.jsxs("div",{children:["Hello + ",e]})}})}),o.jsx(ue,{children:"A more relevant example involves an app that has a custom / existing icon component. There are a litany of reasons why your app might need one, but if you've found this section of the docs you likely know what problem you need to solve."}),o.jsx(M,{codeOnly:!0,children:`
// 1) Your app has an icon component you use
import { MyIconComponent } from '@rmwc/icon';
<MyIconComponent name="search" />
// 2) Now you are using RMWC, lots of components are instances of Icons
// You need to be able to delegate the handling of an icon prop to your own component
import { TextField } from '@rmwc/textField';
import { Chip } from '@rmwc/chip';
<TextField icon="favorite" />
<Chip icon="favorite" />
// 3) Instead, you should set the custom strategy to be your default
// and add your own handling with RMWCProvider
import React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App'; // your main app component
import { RMWCProvider } from '@rmwc/provider';
import { MyIconComponent } from '@rmwc/icon';
const iconRenderHandler = ({ content, className, ...rest }) => {
// content is whatever was passed to the icon prop
// className is the fully processed className taking into account the basename and prefix defaults
// it's important to include this because MDC often has classes like text-field-icon directly
// on the component for alignment
// rest is just any other props
return <MyIconComponent className={className} name={content} {...rest} />
};
ReactDOM.render(
<RMWCProvider icon={{strategy: 'custom', render: iconRenderHandler}}>
<App />
</RMWCProvider>,
document.getElementById('root')
);
// 4) Now anywhere in your app that an Icon instance is used, it will be
// delegated to your handler and render your custom component
import { TextFieldIcon } from '@rmwc/textfield';
<TextFieldIcon icon="search" />
`}),o.jsx(ct,{src:_J,components:[{displayName:"Icon",component:qe}]})]})}
|
Set the option globally throug RMWCProvider
Glyphicons <span class="glyphicons glyphicons-heart"></span>
|
NJ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-1Of8Dzgh.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-1Of8Dzgh.js
|
MIT
|
function cee(){return o.jsxs(lt,{title:"Menus",lead:"Menus display a list of choices on a transient sheet of material.",module:"@rmwc/menu",styles:["@material/menu/dist/mdc.menu.css","@material/menu-surface/dist/mdc.menu-surface.css","@material/ripple/dist/mdc.ripple.css","@material/list/dist/mdc.list.css","@rmwc/icon/icon.css"],docsLink:"https://material.io/develop/web/components/menus/",examples:ree,children:[o.jsx(he,{children:"Basic Usage"}),o.jsx(ue,{children:"You can compose a menu with the given components, and manually manage the open state. `Menu` expects MenuItems as children while `MenuSurface` is a generic container which can have anything as a child."}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(cs,{children:[o.jsxs(Or,{open:t,onSelect:a=>console.log(a.detail.index),onClose:()=>n(!1),children:[o.jsx(ea,{children:"Cookies"}),o.jsx(ea,{children:"Pizza"}),o.jsx(di,{}),o.jsx(ea,{children:"Icecream"})]}),o.jsx(ke,{raised:!0,onClick:()=>n(!t),children:"Menu"})]})}}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(cs,{children:[o.jsx(Dr,{open:t,onClose:a=>n(!1),children:o.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Make the content whatever you want."})}),o.jsx(ke,{raised:!0,onClick:a=>n(!t),children:"Menu Surface"})]})}}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(cs,{children:[o.jsx(Dr,{open:t,onClose:()=>n(!1),children:o.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Menu"})}),o.jsx(xt,{icon:"menu",onClick:()=>n(!t)})]})}}),o.jsx(M,{children:function(){const[t,n]=G.useState(!1);return o.jsxs(cs,{children:[o.jsxs(Or,{open:t,onSelect:a=>console.log(a.detail.index),onClose:()=>n(!1),children:[o.jsx(ea,{children:"Item One"}),o.jsx(ea,{disabled:!0,children:"Item Two (disabled)"}),o.jsx(ea,{children:"Item Three"})]}),o.jsx(ke,{raised:!0,onClick:()=>n(!t),children:"Menu"})]})}}),o.jsx(he,{children:"Simplified usage"}),o.jsx(ue,{children:"RMWC provides a convenience `SimpleMenu` component that takes a handle as a prop, and manages the open state for you."}),o.jsx(M,{children:o.jsxs(am,{handle:o.jsx(ke,{children:"Simple Menu"}),children:[o.jsx(ea,{children:"Cookies"}),o.jsx(ea,{children:"Pizza"}),o.jsx(ea,{children:"Icecream"})]})}),o.jsx(M,{children:o.jsx(_1,{handle:o.jsx(ke,{children:"Simple Menu Surface"}),children:o.jsx("div",{style:{padding:"1rem",width:"8rem"},children:"Make the content whatever you want."})})}),o.jsx(he,{children:"Anchoring"}),o.jsx(ue,{children:"By default, Menus will attempt to automatically position themselves, but this behavior can be overridden by setting the `anchorCorner` prop."}),o.jsx(M,{children:function(){const[t,n]=G.useState("topLeft");return o.jsxs(o.Fragment,{children:[o.jsxs(cs,{children:[o.jsx(Dr,{anchorCorner:t,open:!0,children:o.jsxs("div",{style:{padding:"1rem",width:"8rem"},children:["anchorCorner: ",t]})}),o.jsx(ke,{raised:!0,label:"Anchored Menu"})]}),o.jsx(qt,{value:t,label:"anchorCorner",onChange:a=>n(a.currentTarget.value),options:["topLeft","topRight","bottomLeft","bottomRight","topStart","topEnd","bottomStart","bottomEnd"]})]})}}),o.jsx(he,{children:"Rendering through Portals"}),o.jsx(ue,{children:"Occasionally, you may find your menu being cut off from being inside a container that is styled to be `overflow:hidden`. RMWC provides a `renderToPortal` prop that lets you use React's portal functionality to render the menu dropdown in a different container."}),o.jsx(ue,{children:"You can specify any element or selector you want, but the simplest method is to pass `true` and use RMWC's built in `Portal` component."}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the RMWC Portal
// You only have to do this once
import React from 'react';
import { Portal } from '@rmwc/base';
export default function App() {
return (
<div>
...
<Portal />
</div>
)
}
`}),o.jsx(ue,{children:"Now you can use the `renderToPortal` prop. Below is a contrived example of a menu being cut off due to `overflow: hidden`."}),o.jsx(M,{children:function(){const[t,n]=G.useState(!0),[a,s]=G.useState(!1),i=["Cookies","Pizza","Icecream"];return o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{marginBottom:"10rem",height:"3.5rem",overflow:"hidden"},children:o.jsxs(cs,{children:[o.jsx(ke,{raised:!0,onClick:()=>s(!a),children:"Open Menu"}),o.jsx(Or,{open:a,onClose:()=>s(!1),renderToPortal:t,children:i.map(r=>o.jsx(ea,{children:r},r))})]})}),o.jsx(Fn,{checked:t,onChange:r=>n(r.currentTarget.checked),label:"renderToPortal"})]})}}),o.jsx(ct,{src:lee,components:[{displayName:"Menu",component:Or},{displayName:"MenuItem",component:ea},{displayName:"MenuSurface",component:Dr},{displayName:"MenuSurfaceAnchor",component:cs},{displayName:"SimpleMenu",component:am},{displayName:"SimpleMenuSurface",component:_1}]})]})}
|
The handle can be any component you want
|
cee
|
javascript
|
rmwc/rmwc
|
docs/assets/index-1Of8Dzgh.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-1Of8Dzgh.js
|
MIT
|
function mee(){return o.jsxs(lt,{title:"Provider",lead:"A component that provides global configuration for RMWC.",module:"@rmwc/provider",styles:[],examples:pee,children:[o.jsx(ue,{children:"You can wrap your top level App component with RMWC provider to set global configuration options. Just pass the options in as props."}),o.jsx(M,{codeOnly:!0,children:`
import React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App'; // your main app component
import { RMWCProvider } from '@rmwc/provider';
// This example disables ripples globally by default
ReactDOM.render(
<RMWCProvider
// Globally disable ripples
ripple={false}
// Global options for icons
// Takes the same options as the icon component
icon={{
basename: 'material-icons'
}}
// Global options for typography
// allows mapping of a defaultTag or specific classes
// See the Typography docs for more info
typography={{
defaultTag: 'div',
headline1: 'h1'
}}
// Global options for tooltips
// Takes most of the options for tooltips
// See the Tooltip docs for more info
tooltip={{
align: 'right'
}}
>
<App />
</RMWCProvider>,
document.getElementById('root'),
);
`}),o.jsx(M,{label:"With ripple false",children:o.jsx(hi,{ripple:!1,children:o.jsx(ke,{children:"Click me"})})}),o.jsx(M,{label:"With ripple true",children:o.jsx(hi,{ripple:!0,children:o.jsx(ke,{children:"Click me"})})}),o.jsx(ct,{src:fee,components:[{displayName:"RMWCProvider",component:hi}]})]})}
|
The handle can be any component you want
|
mee
|
javascript
|
rmwc/rmwc
|
docs/assets/index-1Of8Dzgh.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-1Of8Dzgh.js
|
MIT
|
function $ee(){return o.jsxs(lt,{title:"Snackbars",lead:"Snackbars provide brief feedback about an operation through a message at the bottom of the screen.",module:"@rmwc/snackbar",styles:["@material/snackbar/dist/mdc.snackbar.css","@material/button/dist/mdc.button.css","@material/ripple/dist/mdc.ripple.css"],docsLink:"https://material.io/develop/web/components/snackbars/",examples:Uee,children:[o.jsx(he,{children:"Basic Usage"}),o.jsx(ue,{children:"You can render a snackbar in your UI and control its open state."}),o.jsx(M,{label:"Default",children:function(){const[t,n]=G.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Uo,{open:t,onClose:a=>n(!1),message:"This is a new message",dismissesOnAction:!0,action:o.jsx(Ho,{label:"Dismiss",onClick:()=>console.log("Click Me")})}),o.jsx(ke,{raised:!0,label:"Show snackbar",onClick:a=>n(!t)})]})}}),o.jsx(M,{label:"Start Aligned",children:function(){const[t,n]=G.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Uo,{open:t,onClose:a=>n(!1),message:"Start aligned, open until dismissed",stacked:!0,dismissesOnAction:!0,action:[o.jsx(Ho,{label:"Yeah!"}),o.jsx(Ho,{label:"No..."})],leading:!0,timeout:-1}),o.jsx(ke,{raised:!0,label:"Show start-aligned",onClick:a=>n(!t)})]})}}),o.jsx(M,{label:"With dismiss icon",children:function(){const[t,n]=G.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Uo,{open:t,onClose:a=>n(!1),message:"This is a new message",dismissesOnAction:!0,dismissIcon:"close",timeout:-1}),o.jsx(ke,{raised:!0,label:"Show snackbar",onClick:a=>n(!t)})]})}}),o.jsx(he,{children:"Usage with SnackbarQueue"}),o.jsx(ue,{children:"While rendering the Snackbar inline works for simple cases, you'll likely have a notification system, or want to send notifications from anywhere in your app. The `SnackbarQueue` exists as a convenient interface for handling these cases and rendering the snackbar messages for you. If you've used the `DialogQueue`, the `SnackbarQueue` is very similar."}),o.jsx(ue,{children:"Setup is nice and easy, create a queue object you can pass around in your code base, pass the queues `messages` to the `SnackbarQueue` component, and then use the `notify` function to send notifications."}),o.jsx(M,{codeOnly:!0,children:`
// Create a file that exports your queue
// myQueue.js
import { createSnackbarQueue } from '@rmwc/snackbar';
export const queue = createSnackbarQueue();
`}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the SnackbarQueue
import React from 'react';
import { queue } from './myQueue';
export default function App() {
return (
<div>
...
<SnackbarQueue
messages={queue.messages}
// You can also pass default options to pass to your notifications
// ie, make them all leading, stacked, etc
leading
stacked
/>
</div>
)
}
`}),o.jsx(ue,{children:"The `notify` function was designed to mimic the the built-in browser Notifications api and can accept most of the relevant options (icon, image, title, body, actions, ,etc). It also can accept any of the Snackbar props. Just import your queue, and call the notify method."}),o.jsx(M,{codeOnly:!0,children:`
// Somewhere else in your app
// Could be a view, your redux store, anywhere you want...
import { queue } from './myQueue';
// Simple example
queue.notify({
title: 'Hi there'
});
// With some features
queue.notify({
title: <b>Warning</b>,
body: 'You have selected pizza instead icecream!',
icon: 'warning',
actions: [
{
// NotificationAction api format
title: 'Fix It!',
icon: 'close',
action: 'fixit' // action will be available as evt.detail.reason in the onClose event
},
{
// OR SnackbarActionProps format
label: 'Continue...',
icon: 'check',
onClick: () => {}
},
]
});
`}),o.jsx(M,{label:"Inline Example",children:()=>{const{messages:e,notify:t}=cD();function n(){return o.jsxs("div",{children:[o.jsx(ke,{label:"Notify",onClick:()=>t({title:o.jsx("b",{children:"Success"}),body:"You have selected pizza!",dismissesOnAction:!0,icon:"check",actions:[{title:"Dismiss"}]})}),o.jsx(lD,{messages:e})]})}return o.jsx(n,{})}}),o.jsx(ct,{src:zee,components:[{displayName:"Snackbar",component:Uo},{displayName:"SnackbarAction",component:Ho}]})]})}
|
Any additional items will be passed to the
child ListItem as props
|
$ee
|
javascript
|
rmwc/rmwc
|
docs/assets/index-1Of8Dzgh.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-1Of8Dzgh.js
|
MIT
|
function HZ(){return r.jsxs(et,{title:"Dialogs",lead:"Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.",module:"@rmwc/dialog",styles:["@material/dialog/dist/mdc.dialog.css","@material/button/dist/mdc.button.css","@material/ripple/dist/mdc.ripple.css"],docsLink:"https://material.io/develop/web/components/dialogs/",examples:FZ,children:[r.jsx(fe,{children:"Standard Usage"}),r.jsx(j,{children:function(){const[t,a]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(vm,{open:t,onClose:n=>{console.log(n.detail.action),a(!1)},onClosed:n=>console.log(n.detail.action),children:[r.jsx(xm,{children:"Dialog Title"}),r.jsx(km,{children:"This is a standard dialog."}),r.jsxs(wm,{children:[r.jsx(pc,{action:"close",children:"Cancel"}),r.jsx(pc,{action:"accept",isDefaultAction:!0,children:"Sweet!"})]})]}),r.jsx(ye,{raised:!0,onClick:()=>a(!0),children:"Open standard Dialog"})]})}}),r.jsx(fe,{children:"Simplified Usage"}),r.jsx(ce,{children:"Material Dialogs are a complex component. RMWC contains an additional `SimpleDialog` component for ease of use that internally contains the default structure already built out. Illustrated below is both the standard and simple dialog usage."}),r.jsx(j,{children:function(){const[t,a]=q.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(Mu,{title:"This is a simple dialog",body:"You can pass the body prop or children.",open:t,onClose:n=>{console.log(n.detail.action),a(!1)}}),r.jsx(ye,{raised:!0,onClick:()=>a(!0),children:"Open Simple Dialog"})]})}}),r.jsx(fe,{children:"Usage with DialogQueue"}),r.jsx(ce,{children:"Some dialog interactions are complex, but a lot of the time you just need a simple alert or confirm dialog. `DialogQueue` allows you to open dialogs from anywhere in your app and emulates the browsers built in `alert`, `confirm` and `prompt` dialogs. If you've used the `SnackbarQueue`, the `DialogQueue` is very similar."}),r.jsx(ce,{children:"Setup is nice and easy, create a queue object you can pass around in your code base, pass the queues `dialogs` to the `DialogQueue`component, and then use the `alert`, `prompt` or `confirm` api to open dialogs."}),r.jsx(j,{codeOnly:!0,children:`
// Create a file that exports your queue
// myQueue.js
import { createDialogQueue } from '@rmwc/dialog';
export const queue = createDialogQueue();
`}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the DialogQueue
import React from 'react';
import { queue } from './myQueue';
export default function App() {
return (
<div>
...
<DialogQueue
dialogs={queue.dialogs}
// You can also pass default options to pass to your dialogs
// ie, prevent all dialogs from dismissing from a click on the background scrim
preventOutsideDismiss
/>
</div>
)
}
`}),r.jsx(ce,{children:"The `alert`, `confirm`, and `prompt` functions were designed to mimic the the built-in browser methods with a couple of small difference. First, they all return a promise. The promise will always resolve successfully with the response indicating the appropriate action. `alert` the response will be `accept` for clicking the ok button, or `close`. `confirm` will resolve `true` or `false`, and `prompt` will resolve with the value entered into the input, or `null` if the closed the dialog. Second, all methods the methods accept any valid prop for `SimpleDialog`."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere else in your app
// Could be a view, your redux store, anywhere you want...
import { queue } from './myQueue';
queue.alert({
title: 'Hi there',
body: 'Whats going on?'
});
queue.confirm({
title: <b>Are you positive?</b>,
body: 'You have selected pizza instead icecream!',
acceptLabel: 'CONFIRM'
});
queue.prompt({
title: 'Whats your name?',
body: 'Anything will do',
acceptLabel: 'Submit',
cancelLabel: 'Skip',
// For prompts only, you can pass props to the input
inputProps: {
outlined: true
}
});
`}),r.jsx(j,{label:"Inline Example",children:()=>{const{dialogs:e,alert:t,confirm:a,prompt:n}=JL();function s(){const[i,o]=q.useState("____________"),l=()=>t({title:"Hello!"}).then(d=>o(d)),u=()=>a({}).then(d=>o(d)),p=()=>n({inputProps:{outlined:!0}}).then(d=>o(d));return r.jsxs("div",{children:[r.jsx(ye,{label:"Alert",onClick:l}),r.jsx(ye,{label:"Confirm",onClick:u}),r.jsx(ye,{label:"Prompt",onClick:p}),r.jsx(ye,{label:"In Sequence",onClick:()=>{l(),u(),p()}}),r.jsxs("p",{children:["Response: ",r.jsx("b",{children:String(i)})]}),r.jsx(ZL,{dialogs:e})]})}return r.jsx(s,{})}}),r.jsx(fe,{children:"Rendering through Portals"}),r.jsx(ce,{children:"Occasionally, you may find your dialog being cut off from being inside a container that is styled to be `overflow:hidden`. RMWC provides a `renderToPortal` prop that lets you use React's portal functionality to render the menu dropdown in a different container."}),r.jsx(ce,{children:"You can specify any element or selector you want, but the simplest method is to pass `true` and use RMWC's built in `Portal` component."}),r.jsx(j,{codeOnly:!0,children:`
// Somewhere at the top level of your app
// Render the RMWC Portal
// You only have to do this once
import React from 'react';
import { Portal } from '@rmwc/base';
export default function App() {
return (
<div>
...
<Portal />
</div>
)
}
`}),r.jsx(ce,{children:"Now you can use the `renderToPortal` prop. Below is a contrived example of a dialog being cut off due to `overflow: hidden`."}),r.jsx(j,{children:function(){const[t,a]=q.useState(!0),[n,s]=q.useState(!1);return r.jsxs("div",{id:"dialog-portal-example",style:{transform:"translateZ(0)",height:"20rem",overflow:"hidden"},children:[r.jsx(Mu,{title:`This is a ${t?"working!":"broken :/"}`,renderToPortal:t,body:"Use `renderToPortal` to get around `overflow:hidden` and layout issues.",open:n,onClose:i=>{console.log(i.detail.action),s(!1)}}),r.jsx(ye,{raised:!0,onClick:()=>{a(!1),s(!0)},children:"Open Broken :/"}),r.jsx(ye,{raised:!0,onClick:()=>{a(!0),s(!0)},children:"Open in Portal"})]})}}),r.jsx(at,{src:UZ,components:[{displayName:"Dialog",component:vm},{displayName:"DialogTitle",component:xm},{displayName:"DialogContent",component:km},{displayName:"DialogActions",component:wm},{displayName:"DialogButton",component:pc},{displayName:"SimpleDialog",component:Mu}]})]})}
|
Wrapping a button in TouchTargetWrapper will automatically set its \`touch\` prop to true.
|
HZ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-3yBRj1_X.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-3yBRj1_X.js
|
MIT
|
function kJ(){return r.jsxs(et,{title:"Icons",lead:"Material icons use geometric shapes to visually represent core ideas, capabilities, or topics.",module:"@rmwc/icon",styles:["@rmwc/icon/icon.css"],docsLink:"https://material.io/icons",examples:yJ,children:[r.jsx(fe,{children:"Setup"}),r.jsx(ce,{children:"Icons are not part of the official material-components-web spec, but they are referenced many times in the documentation. RMWC provides a declarative way to use icons. Note that RMWC does not ship with any icons of its own. Make sure you include an icon set! You can use any one you want, but Google's Material Icons are available through open source. Follow Google's developer guide to get them setup with your app. https://google.github.io/material-design-icons/"}),r.jsx(ce,{children:"There are lots of different strategies for implementing icons on the web, and the Icon component is flexible for most of them. Use ligatures, classNames, inline SVGs, HTML, or URLs to get icons into your app. The default strategy is 'ligature' which works with the material.io font icon set."}),r.jsx(fe,{children:"Basic Usage"}),r.jsx(ce,{children:"The Icon component, (really the icon prop itself) can accept a variety of formats. Anywhere you see a component prop like `icon` or `trailingIcon` will inherit the same behavior."}),r.jsx(j,{label:"String",children:r.jsx(qe,{icon:"favorite"})}),r.jsx(j,{label:"Child Component",children:r.jsx(qe,{icon:r.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})})}),r.jsx(j,{label:"Passing Options",children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"star",strategy:"ligature"}}),r.jsx(ye,{label:"Hello!",icon:{icon:"add",onMouseOver:()=>console.log("OVER")}})]})}),r.jsx(fe,{children:"Icon Sizing"}),r.jsx(ce,{children:"The Material spec details multiple sizes for icons. The Icon component doesn't assign a size by default, but these are available to you to force a size. Please note, this will only work if you've included the RMWC icon css file."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"favorite",size:"xsmall"}}),r.jsx(qe,{icon:{icon:"favorite",size:"small"}}),r.jsx(qe,{icon:{icon:"favorite",size:"medium"}}),r.jsx(qe,{icon:{icon:"favorite",size:"large"}}),r.jsx(qe,{icon:{icon:"favorite",size:"xlarge"}})]})}),r.jsx(fe,{children:"Ligatures"}),r.jsx(ce,{children:"This is for icon fonts that support ligatures like material-icons. This is the default strategy if nothing is set and doesn't require any additional setup if you are using material-icons."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:"favorite"}),r.jsx(qe,{icon:"favorite_outline"}),r.jsx(qe,{icon:{icon:"star",strategy:"ligature"}})]})}),r.jsx(fe,{children:"URLs"}),r.jsx(ce,{children:"This is for icons that are accessible via HTTP(S) and will be loaded directly into an `img` tag. This can be auto-detected for things that look like urls. The image will be set as a backgroundImage of the icon. Make sure you impor the RMWC icon css file for this to work properly."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:"images/icons/twitter.png"}),r.jsx(qe,{icon:{icon:"images/icons/twitter.png",strategy:"url"}})]})}),r.jsx(fe,{children:"Components / Inline SVGs"}),r.jsx(ce,{children:"This will render a child component inside of the icon. This is useful for all sorts of customization and for rendering inline SVGs. The following example shows rendering an SVG, as well as an arbitrary `div`."}),r.jsx(j,{children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:r.jsx("div",{style:{background:"green",width:"24px",height:"24px",borderRadius:"100px"}})}),r.jsx(qe,{icon:{strategy:"component",icon:r.jsx("svg",{style:{width:"24px",height:"24px"},viewBox:"0 0 24 24",children:r.jsx("path",{fill:"#4285F4",d:"M21.35,11.1H12.18V13.83H18.69C18.36,17.64 15.19,19.27 12.19,19.27C8.36,19.27 5,16.25 5,12C5,7.9 8.2,4.73 12.2,4.73C15.29,4.73 17.1,6.7 17.1,6.7L19,4.72C19,4.72 16.56,2 12.1,2C6.42,2 2.03,6.8 2.03,12C2.03,17.05 6.16,22 12.25,22C17.6,22 21.5,18.33 21.5,12.91C21.5,11.76 21.35,11.1 21.35,11.1V11.1Z"})})}})]})}),r.jsx(fe,{children:"Classnames"}),r.jsx(ce,{children:"Some font icon sets like Ion Icons and Glyph Icons render based on a className that is set. RMWC docs doesn't include extra icon fonts so there is no example to render, but the below code should give you an approximation."}),r.jsx(ce,{children:"**THIS CANNOT BE AUTO DETECTED**. You'll have to explicitly set the strategy directly on the Icon or specify it globally via the RMWCProvider."}),r.jsx(j,{codeOnly:!0,children:r.jsxs(r.Fragment,{children:[r.jsx(qe,{icon:{icon:"star",strategy:"className",basename:"icon",prefix:"ion-"}}),r.jsx(ui,{icon:{strategy:"className",basename:"glyphicons",prefix:"glyphicons-"},children:r.jsx(qe,{icon:"heart"})})]})}),r.jsx(fe,{children:"Custom Rendering"}),r.jsx(ce,{children:"Sometimes, you just need to do your own thing. Maybe you have a legacy project that already has icons and you want to incorporate them with RMWC. If none of the other strategies are what you need, then you can hijack the whole thing and delegate it to your own render function."}),r.jsx(j,{label:"Simple Example",children:r.jsx(qe,{icon:{icon:"favorite",strategy:"custom",render:({content:e})=>r.jsxs("div",{children:["Hello + ",e]})}})}),r.jsx(ce,{children:"A more relevant example involves an app that has a custom / existing icon component. There are a litany of reasons why your app might need one, but if you've found this section of the docs you likely know what problem you need to solve."}),r.jsx(j,{codeOnly:!0,children:`
// 1) Your app has an icon component you use
import { MyIconComponent } from '@rmwc/icon';
<MyIconComponent name="search" />
// 2) Now you are using RMWC, lots of components are instances of Icons
// You need to be able to delegate the handling of an icon prop to your own component
import { TextField } from '@rmwc/textField';
import { Chip } from '@rmwc/chip';
<TextField icon="favorite" />
<Chip icon="favorite" />
// 3) Instead, you should set the custom strategy to be your default
// and add your own handling with RMWCProvider
import React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App'; // your main app component
import { RMWCProvider } from '@rmwc/provider';
import { MyIconComponent } from '@rmwc/icon';
const iconRenderHandler = ({ content, className, ...rest }) => {
// content is whatever was passed to the icon prop
// className is the fully processed className taking into account the basename and prefix defaults
// it's important to include this because MDC often has classes like text-field-icon directly
// on the component for alignment
// rest is just any other props
return <MyIconComponent className={className} name={content} {...rest} />
};
ReactDOM.render(
<RMWCProvider icon={{strategy: 'custom', render: iconRenderHandler}}>
<App />
</RMWCProvider>,
document.getElementById('root')
);
// 4) Now anywhere in your app that an Icon instance is used, it will be
// delegated to your handler and render your custom component
import { TextFieldIcon } from '@rmwc/textfield';
<TextFieldIcon icon="search" />
`}),r.jsx(at,{src:xJ,components:[{displayName:"Icon",component:qe}]})]})}
|
Set the option globally throug RMWCProvider
Glyphicons <span class="glyphicons glyphicons-heart"></span>
|
kJ
|
javascript
|
rmwc/rmwc
|
docs/assets/index-3yBRj1_X.js
|
https://github.com/rmwc/rmwc/blob/master/docs/assets/index-3yBRj1_X.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.