lupine.components 1.1.51 → 1.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/component-pool/aspect-ratio/aspect-ratio.tsx +2 -2
  3. package/src/component-pool/avatar/avatar.tsx +3 -3
  4. package/src/component-pool/badge/badge.tsx +2 -2
  5. package/src/component-pool/breadcrumbs/breadcrumbs.tsx +2 -2
  6. package/src/component-pool/card/card.tsx +2 -2
  7. package/src/component-pool/carousel/carousel.tsx +2 -2
  8. package/src/component-pool/cascader/cascader.tsx +2 -2
  9. package/src/component-pool/charts/gauge-chart.tsx +3 -2
  10. package/src/component-pool/charts/pie-chart.tsx +3 -3
  11. package/src/component-pool/charts/radar-chart.tsx +11 -11
  12. package/src/component-pool/charts/scatter-chart.tsx +4 -4
  13. package/src/component-pool/copy-button/copy-button.tsx +2 -2
  14. package/src/component-pool/date-picker/date-picker.tsx +4 -4
  15. package/src/component-pool/floating-icon-menu/floating-icon-menu.tsx +3 -2
  16. package/src/component-pool/map-wrapper/map-wrapper.tsx +3 -4
  17. package/src/component-pool/radial-progress/radial-progress.tsx +2 -2
  18. package/src/component-pool/range/gauge.tsx +2 -2
  19. package/src/component-pool/range/range.tsx +320 -60
  20. package/src/component-pool/search-input/search-input.tsx +2 -2
  21. package/src/component-pool/skeleton/skeleton-card.tsx +2 -2
  22. package/src/component-pool/skeleton/skeleton.tsx +2 -2
  23. package/src/component-pool/tag-input/tag-input.tsx +3 -8
  24. package/src/component-pool/time-picker/time-picker.tsx +3 -3
  25. package/src/component-pool/timeline/timeline.tsx +2 -2
  26. package/src/component-pool/tooltip/tooltip.tsx +2 -2
  27. package/src/components/meta-data.tsx +1 -2
  28. package/src/components/meta-description.tsx +1 -2
  29. package/src/components/popup-menu.tsx +3 -3
  30. package/src/components/redirect.tsx +3 -3
  31. package/src/components/tabs.tsx +2 -2
  32. package/src/demo/demo-render-page.tsx +3 -1
  33. package/src/demo/mock/side-menu-mock.tsx +55 -58
  34. package/src/lib/button-async-lock.tsx +43 -0
  35. package/src/lib/index.ts +1 -1
  36. package/src/styles/dark-themes.ts +2 -2
  37. package/src/lib/encode-html.ts +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.components",
3
- "version": "1.1.51",
3
+ "version": "1.1.53",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -25,7 +25,7 @@ export const AspectRatio = (props: AspectRatioProps) => {
25
25
  bindGlobalStyle(globalCssId, css);
26
26
 
27
27
  const ref: RefProps = {
28
- globalCssId,
28
+ referToCssId: globalCssId,
29
29
  };
30
30
 
31
31
  const ratio = props.ratio ?? 16 / 9;
@@ -34,7 +34,7 @@ export const AspectRatio = (props: AspectRatioProps) => {
34
34
  const paddingTop = `${(1 / ratio) * 100}%`;
35
35
 
36
36
  return (
37
- <div class={['&-container', props.class].join(' ').trim()} ref={ref} css={{ paddingTop, ...props.style }}>
37
+ <div class={[globalCssId, '&-container', props.class].join(' ').trim()} ref={ref} css={{ paddingTop, ...props.style }}>
38
38
  <div class='&-inner'>{props.children}</div>
39
39
  </div>
40
40
  );
@@ -125,7 +125,7 @@ export const Avatar = (props: AvatarProps) => {
125
125
  const avatarContent = new HtmlVar(renderContent());
126
126
 
127
127
  const ref: RefProps = {
128
- globalCssId,
128
+ referToCssId: globalCssId,
129
129
  };
130
130
 
131
131
  return (
@@ -149,7 +149,7 @@ export const AvatarGroup = (props: AvatarGroupProps) => {
149
149
  bindGlobalStyle(globalCssId, groupCss);
150
150
 
151
151
  const ref: RefProps = {
152
- globalCssId,
152
+ referToCssId: globalCssId,
153
153
  };
154
154
 
155
155
  const children = Array.isArray(props.children) ? props.children : [props.children];
@@ -176,7 +176,7 @@ export const AvatarGroup = (props: AvatarGroupProps) => {
176
176
  }
177
177
 
178
178
  return (
179
- <div ref={ref} class={['&-group', props.class].join(' ').trim()} css={props.style}>
179
+ <div ref={ref} class={[globalCssId, '&-group', props.class].join(' ').trim()} css={props.style}>
180
180
  {items}
181
181
  </div>
182
182
  );
@@ -64,7 +64,7 @@ export const Badge = (props: BadgeProps) => {
64
64
  bindGlobalStyle(globalCssId, badgeCss);
65
65
 
66
66
  const ref: RefProps = {
67
- globalCssId,
67
+ referToCssId: globalCssId,
68
68
  };
69
69
 
70
70
  let displayContent = props.content;
@@ -85,7 +85,7 @@ export const Badge = (props: BadgeProps) => {
85
85
  const showBubble = props.dot || isSup;
86
86
 
87
87
  return (
88
- <div class={['&-container', props.class].join(' ').trim()} ref={ref} css={props.style} onClick={props.onClick}>
88
+ <div class={[globalCssId, '&-container', props.class].join(' ').trim()} ref={ref} css={props.style} onClick={props.onClick}>
89
89
  {/* The Anchor Element */}
90
90
  {props.children}
91
91
 
@@ -91,7 +91,7 @@ export const Breadcrumbs = (props: BreadcrumbsProps) => {
91
91
  let timer: any = null;
92
92
 
93
93
  const ref: RefProps = {
94
- globalCssId,
94
+ referToCssId: globalCssId,
95
95
  onLoad: async () => {
96
96
  if (!autoCollapse) return;
97
97
  const container = ref.current as HTMLElement;
@@ -157,7 +157,7 @@ export const Breadcrumbs = (props: BreadcrumbsProps) => {
157
157
 
158
158
  return (
159
159
  <nav
160
- class={['&-container', autoCollapse ? 'is-initializing' : '', props.class].join(' ').trim()}
160
+ class={[globalCssId, '&-container', autoCollapse ? 'is-initializing' : '', props.class].join(' ').trim()}
161
161
  ref={ref}
162
162
  css={props.style}
163
163
  aria-label='Breadcrumb'
@@ -120,14 +120,14 @@ export const Card = (props: CardProps) => {
120
120
  bindGlobalStyle(globalCssId, cardCss);
121
121
 
122
122
  const ref: RefProps = {
123
- globalCssId,
123
+ referToCssId: globalCssId,
124
124
  };
125
125
 
126
126
  const isHorizontal = props.horizontal ? 'horizontal' : '';
127
127
  const isHoverable = props.hoverable ? 'hoverable' : '';
128
128
 
129
129
  return (
130
- <div class={['&-container', isHorizontal, isHoverable, props.class].join(' ').trim()} ref={ref} css={props.style}>
130
+ <div class={[globalCssId, '&-container', isHorizontal, isHoverable, props.class].join(' ').trim()} ref={ref} css={props.style}>
131
131
  {props.cover && <div class='&-cover'>{props.cover}</div>}
132
132
 
133
133
  <div class='&-body'>
@@ -179,7 +179,7 @@ export const Carousel = (props: CarouselProps) => {
179
179
  };
180
180
 
181
181
  const ref: RefProps = {
182
- globalCssId,
182
+ referToCssId: globalCssId,
183
183
  onLoad: async () => {
184
184
  updateIndicators(0);
185
185
  startAutoplay();
@@ -191,7 +191,7 @@ export const Carousel = (props: CarouselProps) => {
191
191
 
192
192
  return (
193
193
  <div
194
- class={['&-container', props.class].join(' ').trim()}
194
+ class={[globalCssId, '&-container', props.class].join(' ').trim()}
195
195
  css={props.style}
196
196
  ref={ref}
197
197
  onMouseEnter={stopAutoplay}
@@ -160,7 +160,7 @@ export const Cascader = (props: CascaderProps) => {
160
160
  };
161
161
 
162
162
  const ref: RefProps = {
163
- globalCssId,
163
+ referToCssId: globalCssId,
164
164
  };
165
165
 
166
166
  const toggleClass = showCircle ? 'circle' : '';
@@ -190,7 +190,7 @@ export const Cascader = (props: CascaderProps) => {
190
190
 
191
191
  return (
192
192
  <div
193
- class={['&-container', props.class, initialState ? 'open' : ''].join(' ').trim()}
193
+ class={[globalCssId, '&-container', props.class, initialState ? 'open' : ''].join(' ').trim()}
194
194
  ref={ref}
195
195
  css={props.style}
196
196
  data-cascader-group={props.group}
@@ -10,6 +10,7 @@ export type GaugeChartProps = {
10
10
  color?: string;
11
11
  width?: string | number;
12
12
  height?: string | number;
13
+ aspectRatio?: number;
13
14
  valueFormatter?: (value: number) => string;
14
15
  };
15
16
 
@@ -60,7 +61,7 @@ export const GaugeChart = (props: GaugeChartProps) => {
60
61
  : '';
61
62
 
62
63
  const ref: RefProps = {
63
- globalCssId,
64
+ referToCssId: globalCssId,
64
65
  };
65
66
 
66
67
  const ratio = props.aspectRatio ?? 16 / 9;
@@ -69,7 +70,7 @@ export const GaugeChart = (props: GaugeChartProps) => {
69
70
  const styleStr = `width: ${props.width || '100%'};`;
70
71
 
71
72
  return (
72
- <div ref={ref} class='&-container' style={styleStr}>
73
+ <div ref={ref} class={[globalCssId, '&-container'].join(' ')} style={styleStr}>
73
74
  {props.title && <div class='chart-title'>{props.title}</div>}
74
75
 
75
76
  <div style={{ flex: 1, position: 'relative', display: 'flex', justifyContent: 'center', minHeight: 0, paddingTop }}>
@@ -22,7 +22,7 @@ export const PieChart = (props: PieChartProps) => {
22
22
  const viewBoxSize = 200;
23
23
  const center = viewBoxSize / 2;
24
24
  const maxRadius = (viewBoxSize / 2) * 0.9; // 90% of container to leave margin for stroke/anti-aliasing
25
-
25
+
26
26
  const globalInnerRadius = maxRadius * innerRadiusRatio;
27
27
  const numSeries = seriesList.length;
28
28
  // If only 1 series and innerRadiusRatio is 0, ringThickness is maxRadius.
@@ -94,7 +94,7 @@ export const PieChart = (props: PieChartProps) => {
94
94
  });
95
95
 
96
96
  const ref: RefProps = {
97
- globalCssId,
97
+ referToCssId: globalCssId,
98
98
  };
99
99
 
100
100
  const ratio = props.aspectRatio ?? 16 / 9;
@@ -103,7 +103,7 @@ export const PieChart = (props: PieChartProps) => {
103
103
  const styleStr = `width: ${props.width || '100%'}; min-height: 200px;`;
104
104
 
105
105
  return (
106
- <div ref={ref} class='&-container' style={styleStr}>
106
+ <div ref={ref} class={[globalCssId, '&-container'].join(' ')} style={styleStr}>
107
107
  {props.title && <div class='chart-title'>{props.title}</div>}
108
108
 
109
109
  <div
@@ -109,13 +109,13 @@ export const RadarChart = (props: RadarChartProps) => {
109
109
 
110
110
  // Fill area
111
111
  seriesGroupElements.push(
112
- <polygon
112
+ <polygon
113
113
  class="radar-polygon"
114
- points={pointsStr}
115
- fill={color}
116
- fillOpacity='0.15'
117
- stroke={color}
118
- strokeWidth='2'
114
+ points={pointsStr}
115
+ fill={color}
116
+ fillOpacity='0.15'
117
+ stroke={color}
118
+ strokeWidth='2'
119
119
  style={{ transition: 'fill-opacity 0.2s ease' }}
120
120
  />
121
121
  );
@@ -171,9 +171,9 @@ export const RadarChart = (props: RadarChartProps) => {
171
171
  };
172
172
 
173
173
  dataElements.push(
174
- <g
175
- class="radar-series"
176
- onMouseEnter={handleGroupMouseEnter}
174
+ <g
175
+ class="radar-series"
176
+ onMouseEnter={handleGroupMouseEnter}
177
177
  onMouseLeave={handleGroupMouseLeave}
178
178
  >
179
179
  {seriesGroupElements}
@@ -185,7 +185,7 @@ export const RadarChart = (props: RadarChartProps) => {
185
185
  };
186
186
 
187
187
  const ref: RefProps = {
188
- globalCssId,
188
+ referToCssId: globalCssId,
189
189
  };
190
190
 
191
191
  const ratio = props.aspectRatio ?? 16 / 9;
@@ -194,7 +194,7 @@ export const RadarChart = (props: RadarChartProps) => {
194
194
  const styleStr = `width: ${props.width || '100%'};`;
195
195
 
196
196
  return (
197
- <div ref={ref} class='&-container' style={styleStr}>
197
+ <div ref={ref} class={[globalCssId, '&-container'].join(' ')} style={styleStr}>
198
198
  {props.title && <div class='chart-title'>{props.title}</div>}
199
199
 
200
200
  <div style={{ flex: 1, position: 'relative', display: 'flex', justifyContent: 'center', minHeight: 0, paddingTop }}>
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyle, getGlobalStylesId, HtmlVar } from 'lupine.components';
1
+ import { bindGlobalStyle, getGlobalStylesId, HtmlVar, RefProps } from 'lupine.components';
2
2
  import { chartCommonCss, getChartColor, BasicChartProps } from './chart-utils';
3
3
  import { Tooltip } from '../tooltip';
4
4
 
@@ -192,8 +192,8 @@ export const ScatterChart = (props: ScatterChartProps) => {
192
192
 
193
193
  const chartVar = new HtmlVar(renderChart(1000, 300));
194
194
 
195
- const ref = {
196
- globalCssId,
195
+ const ref: RefProps = {
196
+ referToCssId: globalCssId,
197
197
  onLoad: async (el: Element) => {
198
198
  const ro = new ResizeObserver((entries) => {
199
199
  const { width, height } = entries[0].contentRect;
@@ -217,7 +217,7 @@ export const ScatterChart = (props: ScatterChartProps) => {
217
217
  const styleStr = `width: ${props.width || '100%'};`;
218
218
 
219
219
  return (
220
- <div ref={ref} class='&-container' style={styleStr}>
220
+ <div ref={ref} class={[globalCssId, '&-container'].join(' ')} style={styleStr}>
221
221
  {props.title && <div class='chart-title'>{props.title}</div>}
222
222
 
223
223
  <div style={{ flex: 1, position: 'relative', minHeight: 0, paddingTop }}>{chartVar.node}</div>
@@ -114,7 +114,7 @@ export const CopyButton = (props: CopyButtonProps) => {
114
114
  };
115
115
 
116
116
  const ref: RefProps = {
117
- globalCssId,
117
+ referToCssId: globalCssId,
118
118
  };
119
119
 
120
120
  const variantClass = `variant-${props.variant || 'outline'}`;
@@ -132,7 +132,7 @@ export const CopyButton = (props: CopyButtonProps) => {
132
132
 
133
133
  return (
134
134
  <button
135
- class={['&-container', variantClass, props.class].join(' ').trim()}
135
+ class={[globalCssId, '&-container', variantClass, props.class].join(' ').trim()}
136
136
  ref={ref}
137
137
  css={props.style}
138
138
  type='button'
@@ -211,7 +211,7 @@ export const DatePicker = (props: DatePickerProps) => {
211
211
  const globalCssId = getGlobalStylesId(datePickerCss);
212
212
  bindGlobalStyle(globalCssId, datePickerCss);
213
213
 
214
- const ref: RefProps = { globalCssId };
214
+ const ref: RefProps = { referToCssId: globalCssId };
215
215
  let currentValue = props.value || '';
216
216
 
217
217
  const parseDate = (val: string) => {
@@ -241,7 +241,7 @@ export const DatePicker = (props: DatePickerProps) => {
241
241
  let isYearMenuOpen = false;
242
242
 
243
243
  const renderPanel = () => {
244
- const panelRef: RefProps = { globalCssId };
244
+ const panelRef: RefProps = { referToCssId: globalCssId };
245
245
  const gridVar = new HtmlVar('');
246
246
 
247
247
  const refreshGrid = () => {
@@ -332,7 +332,7 @@ export const DatePicker = (props: DatePickerProps) => {
332
332
  );
333
333
  }
334
334
 
335
- const ref2: RefProps = { globalCssId }; // used to replace the & in css
335
+ const ref2: RefProps = { referToCssId: globalCssId }; // used to replace the & in css
336
336
  return (
337
337
  <div class='&-grid' ref={ref2}>
338
338
  {daysNodes}
@@ -411,7 +411,7 @@ export const DatePicker = (props: DatePickerProps) => {
411
411
  };
412
412
 
413
413
  return (
414
- <div class='&-container' css={{ ...datePickerCss, ...props.style }} ref={ref}>
414
+ <div class={[globalCssId, '&-container'].join(' ')} css={{ ...datePickerCss, ...props.style }} ref={ref}>
415
415
  <input
416
416
  class={['&-input', props.className || 'input-base'].join(' ')}
417
417
  placeholder={props.placeholder || 'Select date'}
@@ -156,7 +156,7 @@ export const FloatingIconMenu = (props: FloatingIconMenuProps) => {
156
156
  bindGlobalStyle(globalCssId, css);
157
157
 
158
158
  const ref: RefProps = {
159
- globalCssId,
159
+ referToCssId: globalCssId,
160
160
  };
161
161
 
162
162
  const toggleMenu = () => {
@@ -197,7 +197,8 @@ export const FloatingIconMenu = (props: FloatingIconMenuProps) => {
197
197
  labelPos = top !== undefined ? 'bottom' : 'top';
198
198
  }
199
199
 
200
- const wrapperClass = ['floating-icon-menu', `dir-${direction}`, `label-pos-${labelPos}`, props.className]
200
+ // to avoid nest css, here need to add globalCssId as a class name
201
+ const wrapperClass = [globalCssId, 'floating-icon-menu', `dir-${direction}`, `label-pos-${labelPos}`, props.className]
201
202
  .filter(Boolean)
202
203
  .join(' ');
203
204
 
@@ -45,12 +45,11 @@ export const MapWrapper = (props: MapWrapperProps) => {
45
45
  const zoom = props.zoom ?? 13;
46
46
 
47
47
  const buildSrc = (lat: number, lng: number, zoom: number) =>
48
- `https://www.openstreetmap.org/export/embed.html?bbox=${lng - 0.05},${lat - 0.05},${lng + 0.05},${
49
- lat + 0.05
48
+ `https://www.openstreetmap.org/export/embed.html?bbox=${lng - 0.05},${lat - 0.05},${lng + 0.05},${lat + 0.05
50
49
  }&layer=mapnik&marker=${lat},${lng}`;
51
50
 
52
51
  const ref: RefProps = {
53
- globalCssId,
52
+ referToCssId: globalCssId,
54
53
  onLoad: async () => {
55
54
  const iframe = ref.$('.&-iframe') as HTMLIFrameElement;
56
55
  if (!iframe) return;
@@ -69,7 +68,7 @@ export const MapWrapper = (props: MapWrapperProps) => {
69
68
  const height = props.height || '300px';
70
69
 
71
70
  return (
72
- <div class={['&-container', props.class].join(' ').trim()} ref={ref} css={{ width, height, ...props.style }}>
71
+ <div class={[globalCssId, '&-container', props.class].join(' ').trim()} ref={ref} css={{ width, height, ...props.style }}>
73
72
  <iframe
74
73
  class='&-iframe'
75
74
  src={buildSrc(lat, lng, zoom)}
@@ -86,7 +86,7 @@ export const RadialProgress = (props: RadialProgressProps) => {
86
86
  }
87
87
 
88
88
  const containerRef: RefProps = {
89
- globalCssId,
89
+ referToCssId: globalCssId,
90
90
  };
91
91
 
92
92
  const progressColor = props.color || 'var(--primary-accent-color, #0a74c9)';
@@ -94,7 +94,7 @@ export const RadialProgress = (props: RadialProgressProps) => {
94
94
  const sizeClass = props.size || ButtonSize.Medium;
95
95
 
96
96
  return (
97
- <div class={['&-container', sizeClass, props.class].join(' ').trim()} ref={containerRef} css={props.style}>
97
+ <div class={[globalCssId, '&-container', sizeClass, props.class].join(' ').trim()} ref={containerRef} css={props.style}>
98
98
  <SvgSvg class='&-svg' viewBox='0 0 100 100'>
99
99
  <SvgCircle class='&-track' cx='50' cy='50' r='45' style={{ stroke: trackColor }} />
100
100
  <SvgCircle
@@ -291,7 +291,7 @@ export const Gauge = (props: GaugeProps) => {
291
291
  }
292
292
 
293
293
  const ref: RefProps & { onUnload?: (el: Element) => Promise<void> } = {
294
- globalCssId,
294
+ referToCssId: globalCssId,
295
295
  onLoad: async () => {
296
296
  updateVisuals();
297
297
  },
@@ -341,7 +341,7 @@ export const Gauge = (props: GaugeProps) => {
341
341
 
342
342
  return (
343
343
  <div
344
- class={['&-container', props.class, props.disabled ? 'disabled' : '', isReadonly ? 'readonly' : '']
344
+ class={[globalCssId, '&-container', props.class, props.disabled ? 'disabled' : '', isReadonly ? 'readonly' : '']
345
345
  .join(' ')
346
346
  .trim()}
347
347
  ref={ref}