@uibit/sentiment-selector 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/custom-elements.json +472 -1
- package/dist/frameworks/angular/index.ts +83 -68
- package/dist/frameworks/astro/index.d.ts +8 -1
- package/dist/frameworks/preact/index.d.ts +5 -0
- package/dist/frameworks/react/index.ts +127 -0
- package/dist/frameworks/solid/index.d.ts +3 -2
- package/dist/frameworks/stencil/index.d.ts +5 -0
- package/dist/frameworks/svelte/index.svelte +54 -17
- package/dist/frameworks/vue/index.ts +104 -25
- package/dist/sentiment-selector.d.ts +7 -1
- package/dist/sentiment-selector.d.ts.map +1 -1
- package/dist/sentiment-selector.js +4 -1
- package/dist/sentiment-selector.js.map +1 -1
- package/package.json +7 -7
- package/dist/frameworks/react/index.d.ts +0 -21
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Sentiment Bar
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[](https://www.npmjs.com/package/@uibit/sentiment-selector)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[Interactive Demonstration](https://rawlings.github.io/uibit/components/sentiment-selector)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @uibit/sentiment-selector
|
|
12
|
+
```
|
|
13
|
+
|
|
4
14
|
|
|
5
15
|
Sentiment Bar is an interactive feedback collector component that makes user ratings engaging. By utilizing smooth spring scale animations, visual focus shifts, and double-tap confirmations, it lowers user friction and increases response rates.
|
|
6
16
|
|
package/custom-elements.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"declarations": [
|
|
48
48
|
{
|
|
49
49
|
"kind": "class",
|
|
50
|
-
"description": "Micro-feedback widget displaying a horizontal row of expressive face icons
|
|
50
|
+
"description": "Micro-feedback widget displaying a horizontal row of expressive face icons.",
|
|
51
51
|
"name": "SentimentSelector",
|
|
52
52
|
"cssProperties": [
|
|
53
53
|
{
|
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
"type": {
|
|
143
143
|
"text": "string"
|
|
144
144
|
},
|
|
145
|
+
"description": "The selected rating value.",
|
|
145
146
|
"attribute": "value",
|
|
146
147
|
"reflects": true
|
|
147
148
|
},
|
|
@@ -218,6 +219,211 @@
|
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"kind": "field",
|
|
225
|
+
"name": "locale",
|
|
226
|
+
"type": {
|
|
227
|
+
"text": "string"
|
|
228
|
+
},
|
|
229
|
+
"default": "''",
|
|
230
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
231
|
+
"attribute": "locale",
|
|
232
|
+
"inheritedFrom": {
|
|
233
|
+
"name": "UIBitElement",
|
|
234
|
+
"module": "../../platform/core/src/element.ts"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"kind": "field",
|
|
239
|
+
"name": "resolvedLocale",
|
|
240
|
+
"type": {
|
|
241
|
+
"text": "string | undefined"
|
|
242
|
+
},
|
|
243
|
+
"description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
|
|
244
|
+
"readonly": true,
|
|
245
|
+
"inheritedFrom": {
|
|
246
|
+
"name": "UIBitElement",
|
|
247
|
+
"module": "../../platform/core/src/element.ts"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"kind": "field",
|
|
252
|
+
"name": "_disposables",
|
|
253
|
+
"type": {
|
|
254
|
+
"text": "Set<() => void>"
|
|
255
|
+
},
|
|
256
|
+
"privacy": "private",
|
|
257
|
+
"default": "new Set()",
|
|
258
|
+
"inheritedFrom": {
|
|
259
|
+
"name": "UIBitElement",
|
|
260
|
+
"module": "../../platform/core/src/element.ts"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"kind": "method",
|
|
265
|
+
"name": "createProperty",
|
|
266
|
+
"static": true,
|
|
267
|
+
"parameters": [
|
|
268
|
+
{
|
|
269
|
+
"name": "name",
|
|
270
|
+
"type": {
|
|
271
|
+
"text": "PropertyKey"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "options",
|
|
276
|
+
"optional": true,
|
|
277
|
+
"type": {
|
|
278
|
+
"text": "PropertyDeclaration"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
"description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default.",
|
|
283
|
+
"inheritedFrom": {
|
|
284
|
+
"name": "UIBitElement",
|
|
285
|
+
"module": "../../platform/core/src/element.ts"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"kind": "method",
|
|
290
|
+
"name": "finalizeStyles",
|
|
291
|
+
"static": true,
|
|
292
|
+
"return": {
|
|
293
|
+
"type": {
|
|
294
|
+
"text": "Array<any>"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"parameters": [
|
|
298
|
+
{
|
|
299
|
+
"name": "styles",
|
|
300
|
+
"optional": true,
|
|
301
|
+
"type": {
|
|
302
|
+
"text": "CSSResultGroup"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles.",
|
|
307
|
+
"inheritedFrom": {
|
|
308
|
+
"name": "UIBitElement",
|
|
309
|
+
"module": "../../platform/core/src/element.ts"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"kind": "method",
|
|
314
|
+
"name": "dispatchCustomEvent",
|
|
315
|
+
"return": {
|
|
316
|
+
"type": {
|
|
317
|
+
"text": "boolean"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"parameters": [
|
|
321
|
+
{
|
|
322
|
+
"name": "name",
|
|
323
|
+
"type": {
|
|
324
|
+
"text": "string"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "detail",
|
|
329
|
+
"optional": true,
|
|
330
|
+
"type": {
|
|
331
|
+
"text": "T"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "options",
|
|
336
|
+
"optional": true,
|
|
337
|
+
"type": {
|
|
338
|
+
"text": "Omit<CustomEventInit<T>, 'detail'>"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
"description": "Helper to dispatch a custom event with standard bubbles and composed options.",
|
|
343
|
+
"inheritedFrom": {
|
|
344
|
+
"name": "UIBitElement",
|
|
345
|
+
"module": "../../platform/core/src/element.ts"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"kind": "method",
|
|
350
|
+
"name": "getCssPropertyValue",
|
|
351
|
+
"return": {
|
|
352
|
+
"type": {
|
|
353
|
+
"text": "string"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"parameters": [
|
|
357
|
+
{
|
|
358
|
+
"name": "propertyName",
|
|
359
|
+
"type": {
|
|
360
|
+
"text": "string"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"description": "Helper to retrieve a computed CSS custom property value from the element.",
|
|
365
|
+
"inheritedFrom": {
|
|
366
|
+
"name": "UIBitElement",
|
|
367
|
+
"module": "../../platform/core/src/element.ts"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"kind": "method",
|
|
372
|
+
"name": "registerDisposable",
|
|
373
|
+
"parameters": [
|
|
374
|
+
{
|
|
375
|
+
"name": "cleanup",
|
|
376
|
+
"type": {
|
|
377
|
+
"text": "() => void"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
"description": "Register a cleanup function to be executed when the element is disconnected from the DOM.",
|
|
382
|
+
"inheritedFrom": {
|
|
383
|
+
"name": "UIBitElement",
|
|
384
|
+
"module": "../../platform/core/src/element.ts"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"kind": "method",
|
|
389
|
+
"name": "listen",
|
|
390
|
+
"return": {
|
|
391
|
+
"type": {
|
|
392
|
+
"text": "() => void"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"parameters": [
|
|
396
|
+
{
|
|
397
|
+
"name": "target",
|
|
398
|
+
"type": {
|
|
399
|
+
"text": "EventTarget"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"name": "type",
|
|
404
|
+
"type": {
|
|
405
|
+
"text": "K"
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "listener",
|
|
410
|
+
"type": {
|
|
411
|
+
"text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "options",
|
|
416
|
+
"optional": true,
|
|
417
|
+
"type": {
|
|
418
|
+
"text": "boolean | AddEventListenerOptions"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected.",
|
|
423
|
+
"inheritedFrom": {
|
|
424
|
+
"name": "UIBitElement",
|
|
425
|
+
"module": "../../platform/core/src/element.ts"
|
|
426
|
+
}
|
|
221
427
|
}
|
|
222
428
|
],
|
|
223
429
|
"events": [
|
|
@@ -242,6 +448,7 @@
|
|
|
242
448
|
"type": {
|
|
243
449
|
"text": "string"
|
|
244
450
|
},
|
|
451
|
+
"description": "The selected rating value.",
|
|
245
452
|
"fieldName": "value"
|
|
246
453
|
},
|
|
247
454
|
{
|
|
@@ -252,6 +459,25 @@
|
|
|
252
459
|
"default": "true",
|
|
253
460
|
"description": "Show the label text for the selected option below the track.",
|
|
254
461
|
"fieldName": "showLabel"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"name": "locale",
|
|
465
|
+
"type": {
|
|
466
|
+
"text": "string"
|
|
467
|
+
},
|
|
468
|
+
"default": "''",
|
|
469
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
470
|
+
"fieldName": "locale",
|
|
471
|
+
"inheritedFrom": {
|
|
472
|
+
"name": "UIBitElement",
|
|
473
|
+
"module": "../../platform/core/src/element.ts"
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"cssStates": [
|
|
478
|
+
{
|
|
479
|
+
"name": "selected",
|
|
480
|
+
"description": "Active when a rating value has been selected."
|
|
255
481
|
}
|
|
256
482
|
],
|
|
257
483
|
"mixins": [
|
|
@@ -264,6 +490,7 @@
|
|
|
264
490
|
"name": "UIBitElement",
|
|
265
491
|
"package": "@uibit/core"
|
|
266
492
|
},
|
|
493
|
+
"summary": "A modern, accessible user rating and sentiment scale selector component.\nTapping or clicking an option scales it up with a spring animation and fires\na scored event. Unselected options are dimmed to focus attention on the\ncurrent selection.\n\nCustomize the option set by setting the `options` property programmatically\nor by passing a JSON array string on the `options` attribute. Each option\nreferences an icon name from the UIBit icon registry.",
|
|
267
494
|
"tagName": "uibit-sentiment-selector",
|
|
268
495
|
"customElement": true
|
|
269
496
|
}
|
|
@@ -321,6 +548,250 @@
|
|
|
321
548
|
"path": "src/types.ts",
|
|
322
549
|
"declarations": [],
|
|
323
550
|
"exports": []
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"kind": "javascript-module",
|
|
554
|
+
"path": "../../platform/core/src/element.ts",
|
|
555
|
+
"declarations": [
|
|
556
|
+
{
|
|
557
|
+
"kind": "class",
|
|
558
|
+
"description": "A foundational base class for all UIBit web components.\nProvides custom event helpers, default kebab-case attribute mapping,\nautomatic cleanup/disposable tracking, and auto-injected reset styles.",
|
|
559
|
+
"name": "UIBitElement",
|
|
560
|
+
"members": [
|
|
561
|
+
{
|
|
562
|
+
"kind": "field",
|
|
563
|
+
"name": "locale",
|
|
564
|
+
"type": {
|
|
565
|
+
"text": "string"
|
|
566
|
+
},
|
|
567
|
+
"default": "''",
|
|
568
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
569
|
+
"attribute": "locale"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"kind": "field",
|
|
573
|
+
"name": "resolvedLocale",
|
|
574
|
+
"type": {
|
|
575
|
+
"text": "string | undefined"
|
|
576
|
+
},
|
|
577
|
+
"description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
|
|
578
|
+
"readonly": true
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"kind": "field",
|
|
582
|
+
"name": "_disposables",
|
|
583
|
+
"type": {
|
|
584
|
+
"text": "Set<() => void>"
|
|
585
|
+
},
|
|
586
|
+
"privacy": "private",
|
|
587
|
+
"default": "new Set()"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"kind": "method",
|
|
591
|
+
"name": "createProperty",
|
|
592
|
+
"static": true,
|
|
593
|
+
"parameters": [
|
|
594
|
+
{
|
|
595
|
+
"name": "name",
|
|
596
|
+
"type": {
|
|
597
|
+
"text": "PropertyKey"
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"name": "options",
|
|
602
|
+
"optional": true,
|
|
603
|
+
"type": {
|
|
604
|
+
"text": "PropertyDeclaration"
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
"description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default."
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"kind": "method",
|
|
612
|
+
"name": "finalizeStyles",
|
|
613
|
+
"static": true,
|
|
614
|
+
"return": {
|
|
615
|
+
"type": {
|
|
616
|
+
"text": "Array<any>"
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"parameters": [
|
|
620
|
+
{
|
|
621
|
+
"name": "styles",
|
|
622
|
+
"optional": true,
|
|
623
|
+
"type": {
|
|
624
|
+
"text": "CSSResultGroup"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
],
|
|
628
|
+
"description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles."
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"kind": "method",
|
|
632
|
+
"name": "dispatchCustomEvent",
|
|
633
|
+
"return": {
|
|
634
|
+
"type": {
|
|
635
|
+
"text": "boolean"
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
"parameters": [
|
|
639
|
+
{
|
|
640
|
+
"name": "name",
|
|
641
|
+
"type": {
|
|
642
|
+
"text": "string"
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
"name": "detail",
|
|
647
|
+
"optional": true,
|
|
648
|
+
"type": {
|
|
649
|
+
"text": "T"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"name": "options",
|
|
654
|
+
"optional": true,
|
|
655
|
+
"type": {
|
|
656
|
+
"text": "Omit<CustomEventInit<T>, 'detail'>"
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
],
|
|
660
|
+
"description": "Helper to dispatch a custom event with standard bubbles and composed options."
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"kind": "method",
|
|
664
|
+
"name": "getCssPropertyValue",
|
|
665
|
+
"return": {
|
|
666
|
+
"type": {
|
|
667
|
+
"text": "string"
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
"parameters": [
|
|
671
|
+
{
|
|
672
|
+
"name": "propertyName",
|
|
673
|
+
"type": {
|
|
674
|
+
"text": "string"
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
],
|
|
678
|
+
"description": "Helper to retrieve a computed CSS custom property value from the element."
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"kind": "method",
|
|
682
|
+
"name": "registerDisposable",
|
|
683
|
+
"parameters": [
|
|
684
|
+
{
|
|
685
|
+
"name": "cleanup",
|
|
686
|
+
"type": {
|
|
687
|
+
"text": "() => void"
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"description": "Register a cleanup function to be executed when the element is disconnected from the DOM."
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"kind": "method",
|
|
695
|
+
"name": "listen",
|
|
696
|
+
"return": {
|
|
697
|
+
"type": {
|
|
698
|
+
"text": "() => void"
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
"parameters": [
|
|
702
|
+
{
|
|
703
|
+
"name": "target",
|
|
704
|
+
"type": {
|
|
705
|
+
"text": "EventTarget"
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "type",
|
|
710
|
+
"type": {
|
|
711
|
+
"text": "K"
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "listener",
|
|
716
|
+
"type": {
|
|
717
|
+
"text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"name": "options",
|
|
722
|
+
"optional": true,
|
|
723
|
+
"type": {
|
|
724
|
+
"text": "boolean | AddEventListenerOptions"
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
],
|
|
728
|
+
"description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected."
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"kind": "method",
|
|
732
|
+
"name": "listen",
|
|
733
|
+
"return": {
|
|
734
|
+
"type": {
|
|
735
|
+
"text": "() => void"
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
"parameters": [
|
|
739
|
+
{
|
|
740
|
+
"name": "target",
|
|
741
|
+
"type": {
|
|
742
|
+
"text": "EventTarget"
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "type",
|
|
747
|
+
"type": {
|
|
748
|
+
"text": "string"
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "listener",
|
|
753
|
+
"type": {
|
|
754
|
+
"text": "EventListenerOrEventListenerObject"
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "options",
|
|
759
|
+
"optional": true,
|
|
760
|
+
"type": {
|
|
761
|
+
"text": "boolean | AddEventListenerOptions"
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
"attributes": [
|
|
768
|
+
{
|
|
769
|
+
"name": "locale",
|
|
770
|
+
"type": {
|
|
771
|
+
"text": "string"
|
|
772
|
+
},
|
|
773
|
+
"default": "''",
|
|
774
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
775
|
+
"fieldName": "locale"
|
|
776
|
+
}
|
|
777
|
+
],
|
|
778
|
+
"superclass": {
|
|
779
|
+
"name": "LitElement",
|
|
780
|
+
"package": "lit"
|
|
781
|
+
},
|
|
782
|
+
"customElement": true
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
"exports": [
|
|
786
|
+
{
|
|
787
|
+
"kind": "js",
|
|
788
|
+
"name": "UIBitElement",
|
|
789
|
+
"declaration": {
|
|
790
|
+
"name": "UIBitElement",
|
|
791
|
+
"module": "../../platform/core/src/element.ts"
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
]
|
|
324
795
|
}
|
|
325
796
|
]
|
|
326
797
|
}
|
|
@@ -1,78 +1,93 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output, booleanAttribute, numberAttribute, forwardRef } from '@angular/core';
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ElementRef, model, input, effect, output, booleanAttribute, numberAttribute, forwardRef } from '@angular/core';
|
|
2
2
|
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
|
|
3
3
|
import '@uibit/sentiment-selector';
|
|
4
4
|
import type { SentimentSelector as HTMLElementClass } from '@uibit/sentiment-selector';
|
|
5
|
-
|
|
6
5
|
@Component({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
selector: 'uibit-sentiment-selector',
|
|
7
|
+
template: '<ng-content></ng-content>',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
standalone: true,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(()=>NgxSentimentSelector),
|
|
14
|
+
multi: true
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
host: {
|
|
18
|
+
'(sentiment-change)': 'sentimentChange.emit($event); value.set($event.detail?.value !== undefined ? $event.detail.value : $event.target.value); handleInput($event)',
|
|
19
|
+
'(sentiment-submit)': 'sentimentSubmit.emit($event); value.set($event.detail?.value !== undefined ? $event.detail.value : $event.target.value); handleInput($event)'
|
|
16
20
|
}
|
|
17
|
-
],
|
|
18
|
-
host: {
|
|
19
|
-
'(sentiment-change)': 'sentimentChange.emit($event); handleInput()',
|
|
20
|
-
'(sentiment-submit)': 'sentimentSubmit.emit($event); handleInput()',
|
|
21
|
-
'(blur)': 'handleBlur()',
|
|
22
|
-
'(change)': 'handleInput()',
|
|
23
|
-
'(input)': 'handleInput()'
|
|
24
|
-
}
|
|
25
21
|
})
|
|
26
22
|
export class NgxSentimentSelector implements ControlValueAccessor {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
constructor(private el: ElementRef<HTMLElementClass>){
|
|
24
|
+
effect(()=>{
|
|
25
|
+
if (this.el.nativeElement) {
|
|
26
|
+
this.el.nativeElement.value = this.value();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
effect(()=>{
|
|
30
|
+
if (this.el.nativeElement) {
|
|
31
|
+
this.el.nativeElement.showLabel = this.showLabel();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
effect(()=>{
|
|
35
|
+
if (this.el.nativeElement) {
|
|
36
|
+
this.el.nativeElement.valueAsNumber = this.valueAsNumber();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
effect(()=>{
|
|
40
|
+
if (this.el.nativeElement) {
|
|
41
|
+
this.el.nativeElement.locale = this.locale();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
readonly value = model<string>(undefined);
|
|
46
|
+
readonly showLabel = input<boolean, any>(true, {
|
|
47
|
+
transform: booleanAttribute
|
|
37
48
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.el.nativeElement.valueAsNumber = this.valueAsNumber();
|
|
41
|
-
}
|
|
49
|
+
readonly valueAsNumber = input<number | undefined, any>(undefined, {
|
|
50
|
+
transform: numberAttribute
|
|
42
51
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
readonly locale = input<string>('');
|
|
53
|
+
readonly sentimentChange = output<CustomEvent<{
|
|
54
|
+
value: number;
|
|
55
|
+
label: string;
|
|
56
|
+
}>>();
|
|
57
|
+
readonly sentimentSubmit = output<CustomEvent<{
|
|
58
|
+
value: number;
|
|
59
|
+
label: string;
|
|
60
|
+
}>>();
|
|
61
|
+
private _onChange: (value: any) => void = ()=>{};
|
|
62
|
+
private _onTouched: () => void = ()=>{};
|
|
63
|
+
writeValue(value: any): void {
|
|
64
|
+
if (value !== undefined) {
|
|
65
|
+
this.value.set(value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
registerOnChange(fn: any): void {
|
|
69
|
+
this._onChange = fn;
|
|
70
|
+
}
|
|
71
|
+
registerOnTouched(fn: any): void {
|
|
72
|
+
this._onTouched = fn;
|
|
73
|
+
}
|
|
74
|
+
setDisabledState(isDisabled: boolean): void {
|
|
75
|
+
const el = this.el.nativeElement;
|
|
76
|
+
if ('disabled' in el) {
|
|
77
|
+
(el as any).disabled = isDisabled;
|
|
78
|
+
}
|
|
79
|
+
if (isDisabled) {
|
|
80
|
+
el.setAttribute('disabled', '');
|
|
81
|
+
} else {
|
|
82
|
+
el.removeAttribute('disabled');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
handleInput(event: any) {
|
|
86
|
+
const val = event.target.value;
|
|
87
|
+
this.value.set(val);
|
|
88
|
+
this._onChange(val);
|
|
89
|
+
}
|
|
90
|
+
handleBlur() {
|
|
91
|
+
this._onTouched();
|
|
92
|
+
}
|
|
78
93
|
}
|
|
@@ -4,7 +4,14 @@ import '@uibit/sentiment-selector';
|
|
|
4
4
|
declare global {
|
|
5
5
|
namespace astroHTML.JSX {
|
|
6
6
|
interface IntrinsicElements {
|
|
7
|
-
'uibit-sentiment-selector': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes
|
|
7
|
+
'uibit-sentiment-selector': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes & {
|
|
8
|
+
value?: string;
|
|
9
|
+
showLabel?: boolean;
|
|
10
|
+
valueAsNumber?: number | undefined;
|
|
11
|
+
locale?: string;
|
|
12
|
+
"on:sentiment-change"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
13
|
+
"on:sentiment-submit"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
14
|
+
};
|
|
8
15
|
}
|
|
9
16
|
}
|
|
10
17
|
}
|
|
@@ -9,6 +9,11 @@ declare module 'preact' {
|
|
|
9
9
|
value?: string;
|
|
10
10
|
showLabel?: boolean;
|
|
11
11
|
valueAsNumber?: number | undefined;
|
|
12
|
+
locale?: string;
|
|
13
|
+
onSentimentChange?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
14
|
+
"on:sentiment-change"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
15
|
+
onSentimentSubmit?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
16
|
+
"on:sentiment-submit"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
19
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import type { SentimentSelector as HTMLElementClass } from '@uibit/sentiment-selector';
|
|
3
|
+
import '@uibit/sentiment-selector';
|
|
4
|
+
const useTypeOfLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
5
|
+
export interface SentimentSelectorProps extends Omit<React.HTMLAttributes<HTMLElementClass>, 'value' | 'showLabel' | 'valueAsNumber' | 'locale' | 'onSentimentChange' | 'onSentimentSubmit'> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
value?: string;
|
|
8
|
+
showLabel?: boolean;
|
|
9
|
+
valueAsNumber?: number | undefined;
|
|
10
|
+
locale?: string;
|
|
11
|
+
onSentimentChange?: (event: CustomEvent<{
|
|
12
|
+
value: number;
|
|
13
|
+
label: string;
|
|
14
|
+
}>) => void;
|
|
15
|
+
onSentimentSubmit?: (event: CustomEvent<{
|
|
16
|
+
value: number;
|
|
17
|
+
label: string;
|
|
18
|
+
}>) => void;
|
|
19
|
+
}
|
|
20
|
+
export const SentimentSelector = ({ ref, children, ...props }: SentimentSelectorProps & {
|
|
21
|
+
ref?: React.Ref<HTMLElementClass>;
|
|
22
|
+
})=>{
|
|
23
|
+
const innerRef = useRef<HTMLElementClass>(null);
|
|
24
|
+
const propsRef = useRef(props);
|
|
25
|
+
propsRef.current = props;
|
|
26
|
+
useImperativeHandle(ref, ()=>innerRef.current!);
|
|
27
|
+
useTypeOfLayoutEffect(()=>{
|
|
28
|
+
const element = innerRef.current;
|
|
29
|
+
if (element && props.value !== undefined) {
|
|
30
|
+
(element as any).value = props.value;
|
|
31
|
+
}
|
|
32
|
+
}, [
|
|
33
|
+
props.value
|
|
34
|
+
]);
|
|
35
|
+
useTypeOfLayoutEffect(()=>{
|
|
36
|
+
const element = innerRef.current;
|
|
37
|
+
if (element && props.showLabel !== undefined) {
|
|
38
|
+
(element as any).showLabel = props.showLabel;
|
|
39
|
+
}
|
|
40
|
+
}, [
|
|
41
|
+
props.showLabel
|
|
42
|
+
]);
|
|
43
|
+
useTypeOfLayoutEffect(()=>{
|
|
44
|
+
const element = innerRef.current;
|
|
45
|
+
if (element && props.valueAsNumber !== undefined) {
|
|
46
|
+
(element as any).valueAsNumber = props.valueAsNumber;
|
|
47
|
+
}
|
|
48
|
+
}, [
|
|
49
|
+
props.valueAsNumber
|
|
50
|
+
]);
|
|
51
|
+
useTypeOfLayoutEffect(()=>{
|
|
52
|
+
const element = innerRef.current;
|
|
53
|
+
if (element && props.locale !== undefined) {
|
|
54
|
+
(element as any).locale = props.locale;
|
|
55
|
+
}
|
|
56
|
+
}, [
|
|
57
|
+
props.locale
|
|
58
|
+
]);
|
|
59
|
+
useTypeOfLayoutEffect(()=>{
|
|
60
|
+
const element = innerRef.current;
|
|
61
|
+
if (!element) return;
|
|
62
|
+
const handleEvent = (event: Event)=>{
|
|
63
|
+
if (propsRef.current.onSentimentChange) {
|
|
64
|
+
propsRef.current.onSentimentChange(event as any);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
element.addEventListener('sentiment-change', handleEvent);
|
|
68
|
+
return ()=>{
|
|
69
|
+
element.removeEventListener('sentiment-change', handleEvent);
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
useTypeOfLayoutEffect(()=>{
|
|
73
|
+
const element = innerRef.current;
|
|
74
|
+
if (!element) return;
|
|
75
|
+
const handleEvent = (event: Event)=>{
|
|
76
|
+
if (propsRef.current.onSentimentSubmit) {
|
|
77
|
+
propsRef.current.onSentimentSubmit(event as any);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
element.addEventListener('sentiment-submit', handleEvent);
|
|
81
|
+
return ()=>{
|
|
82
|
+
element.removeEventListener('sentiment-submit', handleEvent);
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
const domProps = {
|
|
86
|
+
...props
|
|
87
|
+
};
|
|
88
|
+
const customPropNames = [
|
|
89
|
+
'value',
|
|
90
|
+
'showLabel',
|
|
91
|
+
'valueAsNumber',
|
|
92
|
+
'locale',
|
|
93
|
+
'onSentimentChange',
|
|
94
|
+
'onSentimentSubmit'
|
|
95
|
+
];
|
|
96
|
+
for (const key of customPropNames){
|
|
97
|
+
delete (domProps as any)[key];
|
|
98
|
+
}
|
|
99
|
+
return React.createElement('uibit-sentiment-selector', {
|
|
100
|
+
ref: innerRef,
|
|
101
|
+
...domProps
|
|
102
|
+
}, children);
|
|
103
|
+
};
|
|
104
|
+
declare global {
|
|
105
|
+
namespace React {
|
|
106
|
+
namespace JSX {
|
|
107
|
+
interface IntrinsicElements {
|
|
108
|
+
'uibit-sentiment-selector': React.ClassAttributes<HTMLElementClass> & React.HTMLAttributes<HTMLElementClass> & {
|
|
109
|
+
children?: React.ReactNode;
|
|
110
|
+
class?: string;
|
|
111
|
+
value?: string;
|
|
112
|
+
showLabel?: boolean;
|
|
113
|
+
valueAsNumber?: number | undefined;
|
|
114
|
+
locale?: string;
|
|
115
|
+
onSentimentChange?: (event: CustomEvent<{
|
|
116
|
+
value: number;
|
|
117
|
+
label: string;
|
|
118
|
+
}>) => void;
|
|
119
|
+
onSentimentSubmit?: (event: CustomEvent<{
|
|
120
|
+
value: number;
|
|
121
|
+
label: string;
|
|
122
|
+
}>) => void;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -9,8 +9,9 @@ declare module 'solid-js' {
|
|
|
9
9
|
value?: string;
|
|
10
10
|
showLabel?: boolean;
|
|
11
11
|
valueAsNumber?: number | undefined;
|
|
12
|
-
|
|
13
|
-
"on:sentiment-
|
|
12
|
+
locale?: string;
|
|
13
|
+
"on:sentiment-change"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
14
|
+
"on:sentiment-submit"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -8,6 +8,11 @@ declare module '@stencil/core' {
|
|
|
8
8
|
value?: string;
|
|
9
9
|
showLabel?: boolean;
|
|
10
10
|
valueAsNumber?: number | undefined;
|
|
11
|
+
locale?: string;
|
|
12
|
+
onSentimentChange?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
13
|
+
"on:sentiment-change"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
14
|
+
onSentimentSubmit?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
15
|
+
"on:sentiment-submit"?: (event: CustomEvent<{ value: number, label: string }>) => void;
|
|
11
16
|
};
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -1,37 +1,74 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '@uibit/sentiment-selector';
|
|
3
3
|
import type { SentimentSelector as HTMLElementClass } from '@uibit/sentiment-selector';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable(),
|
|
7
|
+
showLabel = $bindable(),
|
|
8
|
+
valueAsNumber = $bindable(),
|
|
9
|
+
locale = $bindable(),
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
10
12
|
} = $props<{
|
|
11
|
-
children?:
|
|
13
|
+
children?: import('svelte').Snippet;
|
|
12
14
|
value?: string;
|
|
13
15
|
showLabel?: boolean;
|
|
14
16
|
valueAsNumber?: number | undefined;
|
|
15
|
-
|
|
17
|
+
locale?: string;
|
|
18
|
+
|
|
19
|
+
[key: string]: any;
|
|
16
20
|
}>();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (elementRef && value !== undefined) {
|
|
21
|
+
|
|
22
|
+
let elementRef: HTMLElementClass | null = $state(null);
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
if (elementRef && value !== undefined && elementRef.value !== value) {
|
|
22
26
|
elementRef.value = value;
|
|
23
27
|
}
|
|
24
|
-
if (elementRef && showLabel !== undefined) {
|
|
28
|
+
if (elementRef && showLabel !== undefined && elementRef.showLabel !== showLabel) {
|
|
25
29
|
elementRef.showLabel = showLabel;
|
|
26
30
|
}
|
|
27
|
-
if (elementRef && valueAsNumber !== undefined) {
|
|
31
|
+
if (elementRef && valueAsNumber !== undefined && elementRef.valueAsNumber !== valueAsNumber) {
|
|
28
32
|
elementRef.valueAsNumber = valueAsNumber;
|
|
29
33
|
}
|
|
34
|
+
if (elementRef && locale !== undefined && elementRef.locale !== locale) {
|
|
35
|
+
elementRef.locale = locale;
|
|
36
|
+
}
|
|
30
37
|
});
|
|
31
|
-
|
|
38
|
+
|
|
39
|
+
$effect(() => {
|
|
40
|
+
const element = elementRef;
|
|
41
|
+
if (!element) return;
|
|
42
|
+
|
|
43
|
+
const handleEvent = () => {
|
|
44
|
+
if (value !== element.value) {
|
|
45
|
+
value = element.value as any;
|
|
46
|
+
}
|
|
47
|
+
if (showLabel !== element.showLabel) {
|
|
48
|
+
showLabel = element.showLabel as any;
|
|
49
|
+
}
|
|
50
|
+
if (valueAsNumber !== element.valueAsNumber) {
|
|
51
|
+
valueAsNumber = element.valueAsNumber as any;
|
|
52
|
+
}
|
|
53
|
+
if (locale !== element.locale) {
|
|
54
|
+
locale = element.locale as any;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const events = ['change', 'input', 'sentiment-change', 'sentiment-submit'];
|
|
59
|
+
for (const event of events) {
|
|
60
|
+
element.addEventListener(event, handleEvent);
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
for (const event of events) {
|
|
64
|
+
element.removeEventListener(event, handleEvent);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
32
69
|
</script>
|
|
33
70
|
|
|
34
|
-
<uibit-sentiment-selector bind:this={elementRef} {
|
|
71
|
+
<uibit-sentiment-selector bind:this={elementRef} {...restProps}>
|
|
35
72
|
|
|
36
73
|
{#if children}
|
|
37
74
|
{@render children()}
|
|
@@ -1,29 +1,108 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
1
|
+
import { defineComponent, h, ref, watch } from 'vue';
|
|
2
2
|
import type { SentimentSelector as HTMLElementClass } from '@uibit/sentiment-selector';
|
|
3
3
|
import '@uibit/sentiment-selector';
|
|
4
|
-
|
|
5
4
|
export const SentimentSelector = defineComponent({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
name: 'SentimentSelector',
|
|
6
|
+
props: {
|
|
7
|
+
value: {
|
|
8
|
+
type: [
|
|
9
|
+
String,
|
|
10
|
+
Number,
|
|
11
|
+
Boolean,
|
|
12
|
+
Array,
|
|
13
|
+
Object
|
|
14
|
+
] as any
|
|
15
|
+
},
|
|
16
|
+
showLabel: {
|
|
17
|
+
type: [
|
|
18
|
+
String,
|
|
19
|
+
Number,
|
|
20
|
+
Boolean,
|
|
21
|
+
Array,
|
|
22
|
+
Object
|
|
23
|
+
] as any
|
|
24
|
+
},
|
|
25
|
+
valueAsNumber: {
|
|
26
|
+
type: [
|
|
27
|
+
String,
|
|
28
|
+
Number,
|
|
29
|
+
Boolean,
|
|
30
|
+
Array,
|
|
31
|
+
Object
|
|
32
|
+
] as any
|
|
33
|
+
},
|
|
34
|
+
locale: {
|
|
35
|
+
type: [
|
|
36
|
+
String,
|
|
37
|
+
Number,
|
|
38
|
+
Boolean,
|
|
39
|
+
Array,
|
|
40
|
+
Object
|
|
41
|
+
] as any
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: [
|
|
45
|
+
String,
|
|
46
|
+
Number,
|
|
47
|
+
Boolean,
|
|
48
|
+
Array,
|
|
49
|
+
Object
|
|
50
|
+
] as any
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: [
|
|
54
|
+
'sentiment-change',
|
|
55
|
+
'sentiment-submit',
|
|
56
|
+
'update:modelValue'
|
|
57
|
+
],
|
|
58
|
+
setup (props, { slots, emit }) {
|
|
59
|
+
const elementRef = ref<HTMLElementClass | null>(null);
|
|
60
|
+
if (true) {
|
|
61
|
+
watch(()=>props.modelValue, (newVal)=>{
|
|
62
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
63
|
+
elementRef.value.value = newVal;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
watch(()=>props.value, (newVal)=>{
|
|
67
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
68
|
+
elementRef.value.value = newVal;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
watch(()=>props.showLabel, (newVal)=>{
|
|
73
|
+
if (elementRef.value && newVal !== undefined) {
|
|
74
|
+
(elementRef.value as any).showLabel = newVal;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
watch(()=>props.valueAsNumber, (newVal)=>{
|
|
78
|
+
if (elementRef.value && newVal !== undefined) {
|
|
79
|
+
(elementRef.value as any).valueAsNumber = newVal;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
watch(()=>props.locale, (newVal)=>{
|
|
83
|
+
if (elementRef.value && newVal !== undefined) {
|
|
84
|
+
(elementRef.value as any).locale = newVal;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return ()=>{
|
|
88
|
+
const eventListeners: Record<string, any> = {};
|
|
89
|
+
eventListeners['onSentiment-change'] = (event: Event)=>{
|
|
90
|
+
emit('sentiment-change', event);
|
|
91
|
+
emit('update:modelValue', (event.target as any).value);
|
|
92
|
+
};
|
|
93
|
+
eventListeners['onSentiment-submit'] = (event: Event)=>{
|
|
94
|
+
emit('sentiment-submit', event);
|
|
95
|
+
emit('update:modelValue', (event.target as any).value);
|
|
96
|
+
};
|
|
97
|
+
const mergedProps = {
|
|
98
|
+
...props,
|
|
99
|
+
...eventListeners,
|
|
100
|
+
ref: elementRef
|
|
101
|
+
};
|
|
102
|
+
if (true && props.modelValue !== undefined) {
|
|
103
|
+
(mergedProps as any).value = props.modelValue;
|
|
104
|
+
}
|
|
105
|
+
return h('uibit-sentiment-selector', mergedProps, slots.default?.());
|
|
106
|
+
};
|
|
107
|
+
}
|
|
29
108
|
});
|
|
@@ -7,6 +7,8 @@ export interface SentimentOption {
|
|
|
7
7
|
declare const SentimentSelector_base: import("@uibit/form-internals").Constructor<import("@uibit/form-internals").FormAssociatedInterface> & typeof UIBitElement;
|
|
8
8
|
/**
|
|
9
9
|
* Micro-feedback widget displaying a horizontal row of expressive face icons.
|
|
10
|
+
|
|
11
|
+
* @summary A modern, accessible user rating and sentiment scale selector component.
|
|
10
12
|
* Tapping or clicking an option scales it up with a spring animation and fires
|
|
11
13
|
* a scored event. Unselected options are dimmed to focus attention on the
|
|
12
14
|
* current selection.
|
|
@@ -33,10 +35,14 @@ declare const SentimentSelector_base: import("@uibit/form-internals").Constructo
|
|
|
33
35
|
* @cssprop [--uibit-sentiment-selector-label-font-weight=500] - Label font weight
|
|
34
36
|
* @cssprop [--uibit-sentiment-selector-label-color=#6b7280] - Label color
|
|
35
37
|
* @cssprop [--uibit-sentiment-selector-gap=0.625rem] - Gap between track and label
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
* @cssstate selected - Active when a rating value has been selected.*/
|
|
37
40
|
export declare class SentimentSelector extends SentimentSelector_base {
|
|
38
41
|
static styles: import("lit").CSSResult;
|
|
39
42
|
private options;
|
|
43
|
+
/**
|
|
44
|
+
* The selected rating value.
|
|
45
|
+
*/
|
|
40
46
|
value: string;
|
|
41
47
|
/** Show the label text for the selected option below the track. */
|
|
42
48
|
showLabel: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment-selector.d.ts","sourceRoot":"","sources":["../src/sentiment-selector.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,YAAY,EAAuB,MAAM,aAAa,CAAC;AAczG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;;AAUD
|
|
1
|
+
{"version":3,"file":"sentiment-selector.d.ts","sourceRoot":"","sources":["../src/sentiment-selector.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,YAAY,EAAuB,MAAM,aAAa,CAAC;AAczG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEA+BuE;AACvE,qBACa,iBAAkB,SAAQ,sBAAiC;IACtE,MAAM,CAAC,MAAM,0BAAU;IAEd,OAAO,CAAC,OAAO,CAAsC;IAE9D;;OAEG;IACgD,KAAK,EAAE,MAAM,CAAC;IAEjE,mEAAmE;IACb,SAAS,UAAQ;IAE9D,OAAO,CAAC,WAAW,CAAC,CAAS;IAEtC,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAED,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAE7C;IAED,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;IAYrB,YAAY,SAEX;IAED,OAAO,CAAC,UAAU;IAmBlB,MAAM,oCA0BL;CACF;eAEc,iBAAiB"}
|
|
@@ -26,6 +26,8 @@ const DEFAULT_OPTIONS = [
|
|
|
26
26
|
];
|
|
27
27
|
/**
|
|
28
28
|
* Micro-feedback widget displaying a horizontal row of expressive face icons.
|
|
29
|
+
|
|
30
|
+
* @summary A modern, accessible user rating and sentiment scale selector component.
|
|
29
31
|
* Tapping or clicking an option scales it up with a spring animation and fires
|
|
30
32
|
* a scored event. Unselected options are dimmed to focus attention on the
|
|
31
33
|
* current selection.
|
|
@@ -52,7 +54,8 @@ const DEFAULT_OPTIONS = [
|
|
|
52
54
|
* @cssprop [--uibit-sentiment-selector-label-font-weight=500] - Label font weight
|
|
53
55
|
* @cssprop [--uibit-sentiment-selector-label-color=#6b7280] - Label color
|
|
54
56
|
* @cssprop [--uibit-sentiment-selector-gap=0.625rem] - Gap between track and label
|
|
55
|
-
|
|
57
|
+
|
|
58
|
+
* @cssstate selected - Active when a rating value has been selected.*/
|
|
56
59
|
let SentimentSelector = class SentimentSelector extends FormAssociatedMixin(UIBitElement) {
|
|
57
60
|
constructor() {
|
|
58
61
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment-selector.js","sourceRoot":"","sources":["../src/sentiment-selector.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AACzG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,cAAc,GAAmC;IACrD,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;IACxB,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;CACzB,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,MAAM,eAAe,GAAsB;IACzC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"sentiment-selector.js","sourceRoot":"","sources":["../src/sentiment-selector.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AACzG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,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AC,aAAa,KAAK,MAAM,CAAC,KAAK;qBAC3C,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;0BACrB,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;0BAC1C,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC;;gEAED,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;SAEhH,CAAC;;QAEF,IAAI,CAAC,SAAS;YACd,CAAC,CAAC,IAAI,CAAA,qBAAqB,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,qCAAqC,WAAW,IAAI,QAAQ,QAAQ;YAC3H,CAAC,CAAC,EAAE;KACP,CAAC;IACJ,CAAC;CACF,CAAA;AAvGkB;IAAhB,KAAK,EAAE;kDAAsD;AAKX;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAuB;AAGX;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;oDAAkB;AAEtD;IAAhB,KAAK,EAAE;sDAA8B;AAb3B,iBAAiB;IAD7B,aAAa,CAAC,0BAA0B,CAAC;GAC7B,iBAAiB,CA0G7B;;AAED,eAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uibit/sentiment-selector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Micro-feedback widget with a sliding row of expressive emoji options. Selecting an option triggers a spring-curve scale animation, grays out alternatives, and fires scored events instantly on release.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./custom-elements.json": "./custom-elements.json",
|
|
14
|
-
"./react": "./dist/frameworks/react/index.
|
|
14
|
+
"./react": "./dist/frameworks/react/index.ts",
|
|
15
15
|
"./vue": "./dist/frameworks/vue/index.ts",
|
|
16
16
|
"./svelte": "./dist/frameworks/svelte/index.svelte",
|
|
17
17
|
"./angular": "./dist/frameworks/angular/index.ts",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"lucide": "^1.24.0",
|
|
50
|
-
"@uibit/core": "0.
|
|
50
|
+
"@uibit/core": "0.2.0",
|
|
51
51
|
"@uibit/form-internals": "0.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^20.19.43",
|
|
55
55
|
"lit": "^3.3.3",
|
|
56
56
|
"typescript": "7.0.2",
|
|
57
|
-
"@uibit/codegen": "0.
|
|
57
|
+
"@uibit/codegen": "0.2.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"lit": "^3.0.0",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"tagName": "uibit-sentiment-selector"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
|
-
"build": "cem analyze --
|
|
89
|
-
"dev": "concurrently \"cem analyze --
|
|
90
|
-
"analyze": "cem analyze --
|
|
88
|
+
"build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
|
|
89
|
+
"dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
|
|
90
|
+
"analyze": "cem analyze --config ../custom-elements-manifest.config.js",
|
|
91
91
|
"typecheck": "tsc --noEmit",
|
|
92
92
|
"test": "vitest run -c ../../../vitest.config.ts --passWithNoTests"
|
|
93
93
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ClassAttributes } from 'react';
|
|
2
|
-
import type { SentimentSelector as HTMLElementClass } from '@uibit/sentiment-selector';
|
|
3
|
-
import '@uibit/sentiment-selector';
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
namespace React {
|
|
7
|
-
namespace JSX {
|
|
8
|
-
interface IntrinsicElements {
|
|
9
|
-
'uibit-sentiment-selector': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
class?: string;
|
|
12
|
-
value?: string;
|
|
13
|
-
showLabel?: boolean;
|
|
14
|
-
valueAsNumber?: number | undefined;
|
|
15
|
-
onSentimentChange?: (event: any) => void;
|
|
16
|
-
onSentimentSubmit?: (event: any) => void;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|