@leaflink/stash 51.2.0 → 51.4.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.
Files changed (51) hide show
  1. package/assets/illustrations/vignette/product-details.svg +29 -0
  2. package/dist/CurrencyInput.js +1 -0
  3. package/dist/CurrencyInput.js.map +1 -1
  4. package/dist/CurrencyInput.vue.d.ts +4 -0
  5. package/dist/DataViewFilters.js +1 -1
  6. package/dist/EmptyState.js +1 -1
  7. package/dist/EmptyState.vue.d.ts +2 -1
  8. package/dist/Field.js +1 -1
  9. package/dist/Field.vue.d.ts +7 -0
  10. package/dist/{Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js → Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js} +21 -19
  11. package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -0
  12. package/dist/FilterSelect.js +16 -15
  13. package/dist/FilterSelect.js.map +1 -1
  14. package/dist/FilterSelect.vue.d.ts +4 -0
  15. package/dist/Filters.vue.d.ts +27 -0
  16. package/dist/HttpError.js +1 -1
  17. package/dist/Illustration.js +2 -2
  18. package/dist/Illustration.vue.d.ts +1 -0
  19. package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js → Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js} +16 -16
  20. package/dist/Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js.map +1 -0
  21. package/dist/Input.js +16 -15
  22. package/dist/Input.js.map +1 -1
  23. package/dist/Input.vue.d.ts +4 -0
  24. package/dist/InputOptions.js +20 -19
  25. package/dist/InputOptions.js.map +1 -1
  26. package/dist/InputOptions.vue.d.ts +4 -0
  27. package/dist/Label.js +1 -1
  28. package/dist/Label.vue.d.ts +7 -0
  29. package/dist/{Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js → Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js} +13 -11
  30. package/dist/Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map +1 -0
  31. package/dist/ListView.vue.d.ts +48 -12
  32. package/dist/RadioGroup.js +48 -47
  33. package/dist/RadioGroup.js.map +1 -1
  34. package/dist/RadioGroup.vue.d.ts +4 -0
  35. package/dist/Select.js +2 -1
  36. package/dist/Select.js.map +1 -1
  37. package/dist/Select.vue.d.ts +4 -0
  38. package/dist/TableCell.js +1 -1
  39. package/dist/TableHeaderCell.js +1 -1
  40. package/dist/TableHeaderRow.js +1 -1
  41. package/dist/TableRow.js +1 -1
  42. package/dist/TextEditor.js +2 -1
  43. package/dist/TextEditor.js.map +1 -1
  44. package/dist/TextEditor.vue.d.ts +4 -0
  45. package/dist/Textarea.js +24 -23
  46. package/dist/Textarea.js.map +1 -1
  47. package/dist/Textarea.vue.d.ts +4 -0
  48. package/package.json +1 -1
  49. package/dist/Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js.map +0 -1
  50. package/dist/Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js.map +0 -1
  51. package/dist/Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js.map +0 -1
@@ -76,6 +76,10 @@ declare interface FieldProps {
76
76
  * Show "(optional)" to the right of the label text
77
77
  */
78
78
  showOptionalInLabel?: boolean;
79
+ /**
80
+ * Indicates whether the label should be visually hidden (screen reader only).
81
+ */
82
+ isLabelSrOnly?: boolean;
79
83
  /**
80
84
  * Indicates wheter the field is a fieldset or not
81
85
  */
@@ -528,6 +528,9 @@ type: PropType<boolean>;
528
528
  showOptionalInLabel: {
529
529
  type: PropType<boolean>;
530
530
  };
531
+ isLabelSrOnly: {
532
+ type: PropType<boolean>;
533
+ };
531
534
  placeholder: {
532
535
  type: PropType<string>;
533
536
  default: undefined;
@@ -610,6 +613,9 @@ type: PropType<boolean>;
610
613
  showOptionalInLabel: {
611
614
  type: PropType<boolean>;
612
615
  };
616
+ isLabelSrOnly: {
617
+ type: PropType<boolean>;
618
+ };
613
619
  placeholder: {
614
620
  type: PropType<string>;
615
621
  default: undefined;
@@ -684,6 +690,9 @@ type: PropType<boolean>;
684
690
  showOptionalInLabel: {
685
691
  type: PropType<boolean>;
686
692
  };
693
+ isLabelSrOnly: {
694
+ type: PropType<boolean>;
695
+ };
687
696
  placeholder: {
688
697
  type: PropType<string>;
689
698
  default: undefined;
@@ -771,6 +780,9 @@ type: PropType<boolean>;
771
780
  showOptionalInLabel: {
772
781
  type: PropType<boolean>;
773
782
  };
783
+ isLabelSrOnly: {
784
+ type: PropType<boolean>;
785
+ };
774
786
  placeholder: {
775
787
  type: PropType<string>;
776
788
  default: undefined;
@@ -886,6 +898,9 @@ type: PropType<boolean>;
886
898
  showOptionalInLabel: {
887
899
  type: PropType<boolean>;
888
900
  };
901
+ isLabelSrOnly: {
902
+ type: PropType<boolean>;
903
+ };
889
904
  placeholder: {
890
905
  type: PropType<string>;
891
906
  default: undefined;
@@ -985,6 +1000,9 @@ type: PropType<boolean>;
985
1000
  showOptionalInLabel: {
986
1001
  type: PropType<boolean>;
987
1002
  };
1003
+ isLabelSrOnly: {
1004
+ type: PropType<boolean>;
1005
+ };
988
1006
  placeholder: {
989
1007
  type: PropType<string>;
990
1008
  default: undefined;
@@ -1182,6 +1200,9 @@ type: PropType<boolean>;
1182
1200
  showOptionalInLabel: {
1183
1201
  type: PropType<boolean>;
1184
1202
  };
1203
+ isLabelSrOnly: {
1204
+ type: PropType<boolean>;
1205
+ };
1185
1206
  placeholder: {
1186
1207
  type: PropType<string>;
1187
1208
  default: string;
@@ -1391,6 +1412,9 @@ type: PropType<boolean>;
1391
1412
  showOptionalInLabel: {
1392
1413
  type: PropType<boolean>;
1393
1414
  };
1415
+ isLabelSrOnly: {
1416
+ type: PropType<boolean>;
1417
+ };
1394
1418
  placeholder: {
1395
1419
  type: PropType<string>;
1396
1420
  default: string;
@@ -1590,6 +1614,9 @@ type: PropType<boolean>;
1590
1614
  showOptionalInLabel: {
1591
1615
  type: PropType<boolean>;
1592
1616
  };
1617
+ isLabelSrOnly: {
1618
+ type: PropType<boolean>;
1619
+ };
1593
1620
  placeholder: {
1594
1621
  type: PropType<string>;
1595
1622
  default: string;
package/dist/HttpError.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as B, useCssModule as b, useSlots as z, computed as l, resolveComponent as S, createElementBlock as _, openBlock as m, normalizeClass as n, unref as s, createElementVNode as o, createVNode as p, createCommentVNode as V, withCtx as h, toDisplayString as a, createTextVNode as c, renderSlot as X } from "vue";
2
2
  import { t } from "./locale.js";
3
3
  import I from "./Button.js";
4
- import { _ as N, V as $, I as M } from "./Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js";
4
+ import { _ as N, V as $, I as M } from "./Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js";
5
5
  import { _ as T } from "./Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js";
6
6
  import { _ as D } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
7
  const H = { class: "heading-jumbo tw-m-0 tw-mb-3 !tw-text-white" }, j = { class: "tw-mb-8 tw-text-white" }, F = { class: "tw-mb-4 tw-text-white" }, R = ["href"], Y = {
@@ -1,5 +1,5 @@
1
- import { _ as s } from "./Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js";
2
- import { I as m, S as o, V as p, s as r, v as i } from "./Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js";
1
+ import { _ as s } from "./Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js";
2
+ import { I as m, S as o, V as p, s as r, v as i } from "./Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js";
3
3
  export {
4
4
  m as IllustrationType,
5
5
  o as SpotName,
@@ -234,6 +234,7 @@ export declare enum VignetteName {
234
234
  Payments = "payments",
235
235
  PieChart = "pie-chart",
236
236
  ProductCards = "product-cards",
237
+ ProductDetails = "product-details",
237
238
  ProductDisplay = "product-display",
238
239
  Search = "search",
239
240
  SearchStorefront = "search-storefront",
@@ -3,9 +3,9 @@ import v from "lodash-es/uniqueId";
3
3
  import { I as b } from "./index-D6bxWkZ1.js";
4
4
  var l = /* @__PURE__ */ ((r) => (r.Approved = "approved", r.Avatar = "avatar", r.Barcode = "barcode", r.Calendar = "calendar", r.Cartridge = "cartridge", r.Celebrate = "celebrate", r.ChatBubble = "chat-bubble", r.CheckBox = "check-box", r.CheckCircle = "check-circle", r.Click = "click", r.Cocktail = "cocktail", r.Confirmation = "confirmation", r.Connnect = "connnect", r.Cookie = "cookie", r.CreditCard = "credit-card", r.Crm = "crm", r.Cultivation = "cultivation", r.Data = "data", r.DeliveryCompleted = "delivery-completed", r.Delivery = "delivery", r.DigitalPayments = "digital-payments", r.Discover = "discover", r.Diversity = "diversity", r.Drink = "drink", r.Dolly = "dolly", r.EasyReconciliations = "easy-reconciliations", r.Efficiency = "efficiency", r.Error = "error", r.ExtendDate = "extend-date", r.FinancialGrowth = "financial-growth", r.FinancialInstitution = "financial-institution", r.Focus = "focus", r.FulfillmentIssues = "fulfillment-issues", r.Growth = "growth", r.Handshake = "handshake", r.Hierarchy = "hierarchy", r.Home = "home", r.Laptop = "laptop", r.Licenses = "licenses", r.LightBulb = "light-bulb", r.LightbulbError = "lightbulb-error", r.LineChart = "line-chart", r.Link = "link", r.LocationPin = "location-pin", r.Lock = "lock", r.Messaging = "messaging", r.Messages = "messages", r.Microchip = "microchip", r.MissingData = "missing-data", r.MoneyTransfer = "money-transfer", r.Money = "money", r.NoInventoryAccess = "no-inventory-access", r.NoInventory = "no-inventory", r.NoPromote = "no-promote", r.PackageReceived = "package-received", r.Package = "package", r.PaymentProcessing = "payment-processing", r.Phone = "phone", r.PieChart = "pie-chart", r.ProductCycle = "product-cycle", r.Puzzle = "puzzle", r.Receipt = "receipt", r.Retail = "retail", r.SearchingDocument = "searching-document", r.ShoppingBasket = "shopping-basket", r.Shopping = "shopping", r.Sign = "sign", r.Smile = "smile", r.Speed = "speed", r.Time = "time", r.Tools = "tools", r.Truck = "truck", r.User = "user", r.Warehouse = "warehouse", r.Warning = "warning", r.XCircle = "x-circle", r))(l || {});
5
5
  const C = Object.values(l);
6
- var o = /* @__PURE__ */ ((r) => (r.Api = "api", r.Bank = "bank", r.Basket = "basket", r.BrandMenu = "brand-menu", r.Calendar = "calendar", r.Dashboard = "dashboard", r.Deals = "deals", r.DocumentSearch = "document-search", r.Edit = "edit", r.EmptyTray = "empty-tray", r.Graph = "graph", r.Integrations = "integrations", r.LightBulb = "light-bulb", r.Map = "map", r.Megaphone = "megaphone", r.Messages = "messages", r.MoneyBank = "money-bank", r.Notifications = "notifications", r.OrdersEmpty = "orders-empty", r.Payments = "payments", r.PieChart = "pie-chart", r.ProductCards = "product-cards", r.ProductDisplay = "product-display", r.Search = "search", r.SearchStorefront = "search-storefront", r.Store = "store", r.Todo = "todo", r.Truck = "truck", r.Users = "users", r.Warehouse = "warehouse", r.WarehouseDelivery = "warehouse-delivery", r))(o || {});
6
+ var o = /* @__PURE__ */ ((r) => (r.Api = "api", r.Bank = "bank", r.Basket = "basket", r.BrandMenu = "brand-menu", r.Calendar = "calendar", r.Dashboard = "dashboard", r.Deals = "deals", r.DocumentSearch = "document-search", r.Edit = "edit", r.EmptyTray = "empty-tray", r.Graph = "graph", r.Integrations = "integrations", r.LightBulb = "light-bulb", r.Map = "map", r.Megaphone = "megaphone", r.Messages = "messages", r.MoneyBank = "money-bank", r.Notifications = "notifications", r.OrdersEmpty = "orders-empty", r.Payments = "payments", r.PieChart = "pie-chart", r.ProductCards = "product-cards", r.ProductDetails = "product-details", r.ProductDisplay = "product-display", r.Search = "search", r.SearchStorefront = "search-storefront", r.Store = "store", r.Todo = "todo", r.Truck = "truck", r.Users = "users", r.Warehouse = "warehouse", r.WarehouseDelivery = "warehouse-delivery", r))(o || {});
7
7
  const g = Object.values(o);
8
- var s = /* @__PURE__ */ ((r) => (r.Spot = "spot", r.Vignette = "vignette", r.Scene = "scene", r))(s || {});
8
+ var i = /* @__PURE__ */ ((r) => (r.Spot = "spot", r.Vignette = "vignette", r.Scene = "scene", r))(i || {});
9
9
  const I = /* @__PURE__ */ d({
10
10
  __name: "Illustration",
11
11
  props: {
@@ -13,44 +13,44 @@ const I = /* @__PURE__ */ d({
13
13
  name: {},
14
14
  title: { default: "" },
15
15
  size: { default: 48 },
16
- type: { default: s.Spot },
16
+ type: { default: i.Spot },
17
17
  fillColor: { default: "blue" },
18
18
  strokeColor: { default: "purple-500" },
19
19
  staticPath: { default: "" }
20
20
  },
21
21
  setup(r) {
22
- const i = r;
23
- if (i.type === s.Scene)
22
+ const s = r;
23
+ if (s.type === i.Scene)
24
24
  throw new Error(
25
25
  "Scene illustration types are not supported. Illustrations will need to be uploaded under ./assets/illustrations/scene. Illustrations to be provided by design."
26
26
  );
27
- if (i.type === s.Spot && !C.includes(i.name) || i.type === s.Vignette && !g.includes(i.name))
27
+ if (s.type === i.Spot && !C.includes(s.name) || s.type === i.Vignette && !g.includes(s.name))
28
28
  throw new Error(
29
- `${i.type} illustration name ${i.name} not found. Did you check that you are using the correct type for your illustration?`
29
+ `${s.type} illustration name ${s.name} not found. Did you check that you are using the correct type for your illustration?`
30
30
  );
31
31
  const n = u("stashOptions", {
32
32
  staticPath: "/static"
33
- }), e = c(() => i.type === s.Spot), t = c(() => e.value ? "0" : !1), a = c(() => i.staticPath || (n == null ? void 0 : n.staticPath));
33
+ }), e = c(() => s.type === i.Spot), t = c(() => e.value ? "0" : !1), a = c(() => s.staticPath || (n == null ? void 0 : n.staticPath));
34
34
  return (w, P) => (y(), h(k(b), {
35
- id: i.id,
35
+ id: s.id,
36
36
  class: f(["tw-inline-block tw-align-middle", {
37
- [`tw-text-${i.fillColor}-400 tw-stroke-${i.strokeColor}`]: e.value
37
+ [`tw-text-${s.fillColor}-400 tw-stroke-${s.strokeColor}`]: e.value
38
38
  }]),
39
- title: i.title,
40
- height: i.size,
41
- width: i.size,
39
+ title: s.title,
40
+ height: s.size,
41
+ width: s.size,
42
42
  "stroke-width": t.value,
43
43
  fill: "none",
44
- src: `${a.value}/illustrations/${i.type}/${i.name}.svg`
44
+ src: `${a.value}/illustrations/${s.type}/${s.name}.svg`
45
45
  }, null, 8, ["id", "class", "title", "height", "width", "stroke-width", "src"]));
46
46
  }
47
47
  });
48
48
  export {
49
- s as I,
49
+ i as I,
50
50
  l as S,
51
51
  o as V,
52
52
  I as _,
53
53
  C as s,
54
54
  g as v
55
55
  };
56
- //# sourceMappingURL=Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js.map
56
+ //# sourceMappingURL=Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Illustration.vue_vue_type_script_setup_true_lang-DlY0OGCe.js","sources":["../src/components/Illustration/Illustration.models.ts","../src/components/Illustration/Illustration.vue"],"sourcesContent":["/**\n * Enum to strongly map between a friendly name and file name of the illustration\n */\nexport enum SpotName {\n Approved = 'approved',\n Avatar = 'avatar',\n Barcode = 'barcode',\n Calendar = 'calendar',\n Cartridge = 'cartridge',\n Celebrate = 'celebrate',\n ChatBubble = 'chat-bubble',\n CheckBox = 'check-box',\n CheckCircle = 'check-circle',\n Click = 'click',\n Cocktail = 'cocktail',\n Confirmation = 'confirmation',\n Connnect = 'connnect',\n Cookie = 'cookie',\n CreditCard = 'credit-card',\n Crm = 'crm',\n Cultivation = 'cultivation',\n Data = 'data',\n DeliveryCompleted = 'delivery-completed',\n Delivery = 'delivery',\n DigitalPayments = 'digital-payments',\n Discover = 'discover',\n Diversity = 'diversity',\n Drink = 'drink',\n Dolly = 'dolly',\n EasyReconciliations = 'easy-reconciliations',\n Efficiency = 'efficiency',\n Error = 'error',\n ExtendDate = 'extend-date',\n FinancialGrowth = 'financial-growth',\n FinancialInstitution = 'financial-institution',\n Focus = 'focus',\n FulfillmentIssues = 'fulfillment-issues',\n Growth = 'growth',\n Handshake = 'handshake',\n Hierarchy = 'hierarchy',\n Home = 'home',\n Laptop = 'laptop',\n Licenses = 'licenses',\n LightBulb = 'light-bulb',\n LightbulbError = 'lightbulb-error',\n LineChart = 'line-chart',\n Link = 'link',\n LocationPin = 'location-pin',\n Lock = 'lock',\n Messaging = 'messaging',\n Messages = 'messages',\n Microchip = 'microchip',\n MissingData = 'missing-data',\n MoneyTransfer = 'money-transfer',\n Money = 'money',\n NoInventoryAccess = 'no-inventory-access',\n NoInventory = 'no-inventory',\n NoPromote = 'no-promote',\n PackageReceived = 'package-received',\n Package = 'package',\n PaymentProcessing = 'payment-processing',\n Phone = 'phone',\n PieChart = 'pie-chart',\n ProductCycle = 'product-cycle',\n Puzzle = 'puzzle',\n Receipt = 'receipt',\n Retail = 'retail',\n SearchingDocument = 'searching-document',\n ShoppingBasket = 'shopping-basket',\n Shopping = 'shopping',\n Sign = 'sign',\n Smile = 'smile',\n Speed = 'speed',\n Time = 'time',\n Tools = 'tools',\n Truck = 'truck',\n User = 'user',\n Warehouse = 'warehouse',\n Warning = 'warning',\n XCircle = 'x-circle',\n}\n\nexport type SpotNames = `${SpotName}`;\n\n/**\n * String array of all illustration names\n */\nexport const spotNames = Object.values(SpotName);\n\nexport enum VignetteName {\n Api = 'api',\n Bank = 'bank',\n Basket = 'basket',\n BrandMenu = 'brand-menu',\n Calendar = 'calendar',\n Dashboard = 'dashboard',\n Deals = 'deals',\n DocumentSearch = 'document-search',\n Edit = 'edit',\n EmptyTray = 'empty-tray',\n Graph = 'graph',\n Integrations = 'integrations',\n LightBulb = 'light-bulb',\n Map = 'map',\n Megaphone = 'megaphone',\n Messages = 'messages',\n MoneyBank = 'money-bank',\n Notifications = 'notifications',\n OrdersEmpty = 'orders-empty',\n Payments = 'payments',\n PieChart = 'pie-chart',\n ProductCards = 'product-cards',\n ProductDetails = 'product-details',\n ProductDisplay = 'product-display',\n Search = 'search',\n SearchStorefront = 'search-storefront',\n Store = 'store',\n Todo = 'todo',\n Truck = 'truck',\n Users = 'users',\n Warehouse = 'warehouse',\n WarehouseDelivery = 'warehouse-delivery',\n}\n\nexport type VignetteNames = `${VignetteName}`;\n\n/**\n * String array of all vignette names\n */\nexport const vignetteNames = Object.values(VignetteName);\n\n/**\n * Types of illustrations that map to the subfolder under ./assets/illustrations/<type>\n */\nexport enum IllustrationType {\n Spot = 'spot',\n Vignette = 'vignette',\n // Scene is not implemented, but adding it for future work mentioned in STASH-61.\n Scene = 'scene',\n}\n\nexport type IllustrationTypes = `${IllustrationType}`;\n","<script lang=\"ts\">\n export * from './Illustration.models';\n</script>\n\n<script lang=\"ts\" setup>\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashPrimaryColor, StashPrimaryColorGroup } from '../../../types/colors';\n import { StashProvideState } from '../../../types/misc';\n import {\n IllustrationType,\n IllustrationTypes,\n SpotName,\n SpotNames,\n spotNames,\n VignetteName,\n VignetteNames,\n vignetteNames,\n } from './Illustration.models';\n\n export interface IllustrationProps {\n id?: string;\n\n /**\n * The filename of the icon that should be displayed\n */\n name: SpotNames | VignetteNames;\n\n /**\n * Accessible, short-text description for the icon. Not rendered as part of the graphic, but\n * browsers usually display it as a tooltip and screen readers use this.\n */\n title?: string;\n\n /**\n * The size in pixels of the illustration. This number will be used for width and height\n */\n size?: number;\n\n /**\n * Type of the illustration\n */\n type?: IllustrationTypes;\n\n /**\n * The fill color for the illustration. This component will use the 400 shade of the color\n * per design's request. Defaults to teal.\n */\n fillColor?: StashPrimaryColorGroup;\n\n /**\n * The color theme for the illustration. This component will use the standard 500 shade of the color.\n * Defaults to purple\n */\n strokeColor?: StashPrimaryColor;\n\n /**\n * Illustration's custom static path. It'll default to either the staticPath defined on the library installation or '/static' if none are provided.\n */\n staticPath?: string;\n }\n\n const props = withDefaults(defineProps<IllustrationProps>(), {\n id: uniqueId('ll-illustration-'),\n title: '',\n size: 48,\n type: IllustrationType.Spot,\n fillColor: 'blue',\n strokeColor: 'purple-500',\n staticPath: '',\n });\n\n if (props.type === IllustrationType.Scene) {\n throw new Error(\n 'Scene illustration types are not supported. Illustrations will need to be uploaded under ./assets/illustrations/scene. Illustrations to be provided by design.',\n );\n }\n\n if (\n (props.type === IllustrationType.Spot && !spotNames.includes(props.name as SpotName)) ||\n (props.type === IllustrationType.Vignette && !vignetteNames.includes(props.name as VignetteName))\n ) {\n throw new Error(\n `${props.type} illustration name ${props.name} not found. Did you check that you are using the correct type for your illustration?`,\n );\n }\n\n const stashOptions = inject<Partial<StashProvideState>>('stashOptions', {\n staticPath: '/static',\n });\n\n const isSpotIllustration = computed(() => props.type === IllustrationType.Spot);\n\n /**\n * Browsers won't add the `stroke-width` attribute if it is set to false.\n * However, setting it to specific number value affects vignettes\n */\n const strokeWidth = computed<boolean | string>(() => {\n return isSpotIllustration.value ? '0' : false;\n });\n\n const computedStaticPath = computed(() => {\n return props.staticPath || stashOptions?.staticPath;\n });\n</script>\n\n<template>\n <!-- InlineSvg package (https://github.com/shrpne/vue-inline-svg) swaps external svgs and puts\n them inline so we can style them with CSS -->\n <!-- Having to override fill to be none and stroke to be zero so the exported svgs from Figma\n that do not have those attributes specified do not get a default one applied -->\n <InlineSvg\n :id=\"props.id\"\n class=\"tw-inline-block tw-align-middle\"\n :class=\"{\n [`tw-text-${props.fillColor}-400 tw-stroke-${props.strokeColor}`]: isSpotIllustration,\n }\"\n :title=\"props.title\"\n :height=\"props.size\"\n :width=\"props.size\"\n :stroke-width=\"strokeWidth\"\n fill=\"none\"\n :src=\"`${computedStaticPath}/illustrations/${props.type}/${props.name}.svg`\"\n />\n</template>\n"],"names":["SpotName","spotNames","VignetteName","vignetteNames","IllustrationType","props","__props","stashOptions","inject","isSpotIllustration","computed","strokeWidth","computedStaticPath"],"mappings":";;;AAGY,IAAAA,sBAAAA,OACVA,EAAA,WAAW,YACXA,EAAA,SAAS,UACTA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,aAAa,eACbA,EAAA,WAAW,aACXA,EAAA,cAAc,gBACdA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,e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C;AAGI,UAAAE,IAAeC,EAAmC,gBAAgB;AAAA,MACtE,YAAY;AAAA,IAAA,CACb,GAEKC,IAAqBC,EAAS,MAAML,EAAM,SAASD,EAAiB,IAAI,GAMxEO,IAAcD,EAA2B,MACtCD,EAAmB,QAAQ,MAAM,EACzC,GAEKG,IAAqBF,EAAS,MAC3BL,EAAM,eAAcE,KAAA,gBAAAA,EAAc,WAC1C;;;;;;;;;;;;;;;"}
package/dist/Input.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineComponent as P, useSlots as U, useCssModule as q, useAttrs as G, ref as y, computed as c, watchEffect as L, onMounted as W, createBlock as V, openBlock as f, mergeProps as B, unref as l, createSlots as j, withCtx as k, createElementVNode as N, withDirectives as H, createElementBlock as x, createCommentVNode as I, vModelDynamic as J, normalizeClass as v, renderSlot as b } from "vue";
1
+ import { defineComponent as L, useSlots as P, useCssModule as U, useAttrs as q, ref as y, computed as c, watchEffect as G, onMounted as W, createBlock as B, openBlock as f, mergeProps as V, unref as l, createSlots as j, withCtx as k, createElementVNode as N, withDirectives as H, createElementBlock as x, createCommentVNode as I, vModelDynamic as J, normalizeClass as v, renderSlot as b } from "vue";
2
2
  import C from "lodash-es/isNil";
3
3
  import { convertDecimal as D, sanitizeDecimal as K, decimalSeparator as h } from "./utils/i18n.js";
4
- import { _ as Q } from "./Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js";
4
+ import { _ as Q } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
5
5
  import X from "./Icon.js";
6
6
  import { _ as Y } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "placeholder", "type", "disabled", "readonly"], te = /* @__PURE__ */ P({
7
+ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "placeholder", "type", "disabled", "readonly"], te = /* @__PURE__ */ L({
8
8
  name: "ll-input",
9
9
  inheritAttrs: !1,
10
10
  __name: "Input",
@@ -23,21 +23,22 @@ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-inval
23
23
  isRequired: { type: Boolean },
24
24
  label: {},
25
25
  showOptionalInLabel: { type: Boolean },
26
+ isLabelSrOnly: { type: Boolean },
26
27
  fieldset: { type: Boolean },
27
28
  isDisabled: { type: Boolean },
28
29
  disabled: { type: Boolean }
29
30
  },
30
31
  emits: ["update:model-value", "change", "focus", "blur"],
31
- setup($, { expose: E, emit: S }) {
32
- const e = $, m = S, r = U(), s = q(), u = G(), _ = y();
33
- E({ inputEl: _ });
32
+ setup(S, { expose: $, emit: E }) {
33
+ const e = S, m = E, r = P(), s = U(), u = q(), _ = y();
34
+ $({ inputEl: _ });
34
35
  const n = y(e.modelValue);
35
36
  e.type === "number" && (e.modelValue || e.modelValue === 0) && (n.value = D(e.modelValue, h));
36
- const i = y(!1), M = c(() => e.isReadOnly || "readonly" in u && u.readonly !== !1), d = c(() => e.type === "number"), A = c(() => {
37
+ const i = y(!1), M = c(() => e.isReadOnly || "readonly" in u && u.readonly !== !1), d = c(() => e.type === "number"), O = c(() => {
37
38
  const o = { ...u };
38
39
  return delete o.class, o;
39
- }), F = c(() => d.value || e.type === "password" && i.value ? "text" : e.type);
40
- L(() => {
40
+ }), A = c(() => d.value || e.type === "password" && i.value ? "text" : e.type);
41
+ G(() => {
41
42
  n.value = w(e.modelValue);
42
43
  });
43
44
  function g(o = "", a = !1) {
@@ -60,7 +61,7 @@ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-inval
60
61
  function w(o) {
61
62
  return d.value ? K(o, h) : o;
62
63
  }
63
- function O() {
64
+ function F() {
64
65
  const o = d.value ? g(n.value) : n.value;
65
66
  m("change", o);
66
67
  }
@@ -75,13 +76,13 @@ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-inval
75
76
  throw new Error("ll-input: use :model-value or v-model instead of :value.");
76
77
  if (u.onInput)
77
78
  throw new Error("ll-input: use the @update:model-value event instead of @input");
78
- }), (o, a) => (f(), V(Q, B(e, {
79
+ }), (o, a) => (f(), B(Q, V(e, {
79
80
  class: ["stash-input", [l(s).root, l(u).class]],
80
81
  "data-test": "ll-input"
81
82
  }), j({
82
83
  default: k(({ fieldId: t, fieldErrorId: T, hasError: z }) => [
83
84
  N("div", Z, [
84
- H(N("input", B(A.value, {
85
+ H(N("input", V(O.value, {
85
86
  id: t,
86
87
  ref_key: "inputEl",
87
88
  ref: _,
@@ -95,10 +96,10 @@ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-inval
95
96
  { [l(s)["input-appended"]]: !!l(r).append || e.type === "password" },
96
97
  { [l(s)["has-error"]]: !!e.errorText }
97
98
  ],
98
- type: F.value,
99
+ type: A.value,
99
100
  disabled: e.isDisabled || e.disabled,
100
101
  readonly: M.value,
101
- onChange: O,
102
+ onChange: F,
102
103
  onInput: R,
103
104
  onBlur: a[1] || (a[1] = (p) => m("blur", p)),
104
105
  onFocus: a[2] || (a[2] = (p) => m("focus", p))
@@ -115,7 +116,7 @@ const Z = { class: "tw-relative" }, ee = ["id", "aria-errormessage", "aria-inval
115
116
  key: 1,
116
117
  class: v(["stash-input-append font-semibold", [l(s).symbol, l(s)["symbol--append"]]])
117
118
  }, [
118
- l(r).append ? b(o.$slots, "append", { key: 0 }) : (f(), V(X, {
119
+ l(r).append ? b(o.$slots, "append", { key: 0 }) : (f(), B(X, {
119
120
  key: 1,
120
121
  name: i.value ? "hide" : "show",
121
122
  class: v(["tw-cursor-pointer", { "tw-text-ice-500": e.isDisabled || e.disabled }]),
package/dist/Input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../src/components/Input/Input.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import isNil from 'lodash-es/isNil';\n import { computed, onMounted, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import { convertDecimal, decimalSeparator, sanitizeDecimal } from '../../utils/i18n';\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import Icon from '../Icon/Icon.vue';\n\n export interface InputProps extends FieldProps {\n /**\n * Autocomplete takes in a string of off or on\n */\n autocomplete?: string;\n\n /**\n * Value for the input element.\n */\n modelValue?: string | number;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: string | number | null;\n\n /**\n * Input type. Excludes certain types that have a dedicated component.\n *\n * Note: For distinguishing between text & number internally, passing `number`\n * will still render an input with a type of `text` (for localization).\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n\n /**\n * Placeholder text for the input.\n * **Note:** placeholders should be used to display examples; they should not be used as labels because they are not accessible as labels. If a real label cannot be used, use the `aria-label` attribute.\n */\n placeholder?: string;\n }\n\n defineOptions({\n name: 'll-input',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<InputProps>(), {\n autocomplete: 'off',\n type: 'text',\n modelValue: '',\n value: null,\n placeholder: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the input value changes.\n */\n (e: 'update:model-value', v: string | number): void;\n /**\n * Emitted when the input value changes.\n */\n (e: 'change', v: string | number): void;\n /**\n * Emitted when the input is focused\n */\n (e: 'focus', evt: Event): void;\n /**\n * Emitted when the input is blurred\n */\n (e: 'blur', evt: Event): void;\n }>();\n\n const slots = useSlots();\n const classes = useCssModule();\n const attrs = useAttrs();\n\n // declare a ref to hold the element reference\n // the name must match template ref value\n const inputEl = ref<HTMLInputElement>();\n\n // this exposes the input ref to any parent that renders the `Input` component\n // and gives it a template ref, giving parent components access to the DOM element.\n defineExpose({ inputEl });\n\n const internalValue = ref<string | number>(props.modelValue);\n\n if (props.type === 'number' && (props.modelValue || props.modelValue === 0)) {\n internalValue.value = convertDecimal(props.modelValue, decimalSeparator);\n }\n\n const showPassword = ref(false);\n\n const isReadOnly = computed(() => props.isReadOnly || ('readonly' in attrs && attrs.readonly !== false));\n const isNumber = computed(() => props.type === 'number');\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const inputType = computed(() => {\n // type 'number' is a special use case and requires\n // that the type be 'text' to support internationalization\n if (isNumber.value) {\n return 'text';\n }\n\n if (props.type === 'password' && showPassword.value) {\n return 'text';\n }\n\n return props.type;\n });\n\n watchEffect(() => {\n internalValue.value = format(props.modelValue);\n });\n\n /**\n * Converts the localized number to a valid number (to emit). i.e. 12,50 > 12.50\n *\n * @param {string|number} value - Number you want to parse.\n * @returns {number|string} number or empty string (for empty input)\n */\n function parseNumber(value: string | number = '', isUserTyping = false): string | number {\n // If this isn't a number input, we shouldn't be calling this function\n if (!isNumber.value) {\n return value;\n }\n\n let tempValue = value;\n\n // If blank, just stop\n if (isNil(tempValue) || `${tempValue}`.length === 0) return '';\n\n // clean out different locale decimals\n if (decimalSeparator !== '.') {\n tempValue = convertDecimal(tempValue, '.');\n }\n\n // If the user is in the middle of an input, let them finish the number\n if (isUserTyping) {\n // Prefix values with a 0 if the user starts with a decimal point\n if (tempValue === '.') tempValue = '0.';\n\n // This is to prevent the parsing from correcting 0. to 0 and causing the value to be reset\n if (tempValue.toString().startsWith('0.')) return tempValue;\n }\n\n // Empty or null values convert to 0 with NumberFormat, so return '';\n if (!isNil(tempValue) && `${tempValue}`.length) {\n tempValue = Intl.NumberFormat('en-US', {\n style: 'decimal',\n maximumFractionDigits: 7,\n useGrouping: false,\n }).format(Number(tempValue));\n } else {\n return '';\n }\n\n // Ensure valid number, otherwise clear value\n return isNaN(Number(tempValue)) ? '' : parseFloat(tempValue);\n }\n\n /**\n * Formats the input based on conditions\n *\n * @param {number|string} value - The value to format.\n */\n function format(value: string | number) {\n if (isNumber.value) {\n return sanitizeDecimal(value, decimalSeparator);\n }\n\n return value;\n }\n\n /**\n * Fire after focusing out of input, if value has changed.\n */\n function handleChange() {\n // Parse the final value on blur\n const parsedValue = isNumber.value ? parseNumber(internalValue.value) : internalValue.value;\n emit('change', parsedValue);\n }\n\n /**\n * Fired when typing on input.\n */\n function handleInput(e: Event) {\n const value = (e.target as HTMLInputElement).value;\n\n // Update the internal value with a sanitized version\n internalValue.value = format(value);\n\n const parsedValue = isNumber.value ? parseNumber(internalValue.value, true) : value;\n\n emit('update:model-value', parsedValue);\n }\n\n onMounted(() => {\n if (props.value !== null) {\n throw new Error('ll-input: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input: use the @update:model-value event instead of @input');\n }\n });\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input\" :class=\"[classes.root, attrs.class]\" data-test=\"ll-input\">\n <template #default=\"{ fieldId, fieldErrorId, hasError }\">\n <div class=\"tw-relative\">\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"internalValue\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n :autocomplete=\"autocomplete\"\n :placeholder=\"props.placeholder\"\n :class=\"[\n { [classes['input-prepended']]: !!slots.prepend },\n { [classes['input-appended']]: !!slots.append || props.type === 'password' },\n { [classes['has-error']]: !!props.errorText },\n ]\"\n :type=\"inputType\"\n :disabled=\"props.isDisabled || props.disabled\"\n :readonly=\"isReadOnly\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @blur=\"(evt) => emit('blur', evt)\"\n @focus=\"(evt) => emit('focus', evt)\"\n />\n\n <div\n v-if=\"slots.prepend\"\n class=\"stash-input-prepend font-semibold\"\n :class=\"[classes.symbol, classes['symbol--prepend']]\"\n >\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </div>\n\n <div\n v-if=\"slots.append || props.type === 'password'\"\n class=\"stash-input-append font-semibold\"\n :class=\"[classes.symbol, classes['symbol--append']]\"\n >\n <!-- @slot renders content on the right side of the input -->\n <slot v-if=\"slots.append\" name=\"append\"></slot>\n <Icon\n v-else\n :name=\"showPassword ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :class=\"{ 'tw-text-ice-500': props.isDisabled || props.disabled }\"\n :data-test=\"showPassword ? 'hide-password-icon' : 'show-password-icon'\"\n @click=\"showPassword = !showPassword\"\n />\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .root {\n position: relative;\n }\n\n .root input {\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: theme('borderRadius.DEFAULT');\n color: var(--color-ice-700);\n display: block;\n height: theme('height.input');\n font-size: theme('fontSize.sm');\n font-weight: theme('fontWeight.normal');\n outline: none;\n padding: 0 theme('spacing.3');\n width: 100%;\n }\n\n .root input:hover {\n border-color: var(--color-ice-500);\n }\n\n .root input:active,\n .root input:focus {\n border-color: var(--color-blue-500);\n }\n\n .root input::placeholder {\n color: var(--color-ice-500);\n opacity: 1;\n }\n\n .root input.has-error:not(:focus) {\n border-color: var(--color-red-500);\n }\n\n .root input.input-prepended {\n padding-left: 36px;\n }\n\n .root input.input-appended {\n padding-right: 36px;\n }\n\n .symbol {\n align-items: center;\n display: flex;\n height: theme('height.input');\n justify-content: center;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: theme('height.input');\n }\n\n .symbol--prepend {\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n border-top-left-radius: theme('borderRadius.DEFAULT');\n left: 0;\n }\n\n .symbol--append {\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n border-top-right-radius: theme('borderRadius.DEFAULT');\n right: 0;\n }\n\n .root input[disabled] {\n background-color: var(--color-ice-100) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-500) !important;\n pointer-events: none;\n outline-color: var(--color-ice-500) !important;\n\n & + .symbol--prepend,\n & + .symbol--append {\n color: var(--color-ice-500);\n }\n }\n\n .root input[readonly] {\n border-color: transparent;\n background-color: transparent;\n padding-left: 0;\n padding-right: 0;\n }\n\n .root input[disabled]:active,\n .root input[readonly]:active,\n .root input[disabled]:focus,\n .root input[readonly]:focus {\n box-shadow: none !important;\n }\n\n .root input[disabled]::placeholder {\n text-transform: none;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","convertDecimal","decimalSeparator","showPassword","isReadOnly","computed","isNumber","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CE,UAAMA,IAAQC,GAQRC,IAAOC,GAmBPC,IAAQC,EAAS,GACjBC,IAAUC,EAAa,GACvBC,IAAQC,EAAS,GAIjBC,IAAUC,EAAsB;AAIzB,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBX,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvEa,EAAc,QAAQC,EAAed,EAAM,YAAYe,CAAgB;AAGnE,UAAAC,IAAeL,EAAI,EAAK,GAExBM,IAAaC,EAAS,MAAMlB,EAAM,cAAe,cAAcQ,KAASA,EAAM,aAAa,EAAM,GACjGW,IAAWD,EAAS,MAAMlB,EAAM,SAAS,QAAQ,GAEjDoB,IAAaF,EAAS,MAAM;AAC1B,YAAAG,IAAY,EAAE,GAAGb,EAAM;AAE7B,oBAAOa,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYJ,EAAS,MAGrBC,EAAS,SAITnB,EAAM,SAAS,cAAcgB,EAAa,QACrC,SAGFhB,EAAM,IACd;AAED,IAAAuB,EAAY,MAAM;AACF,MAAAV,EAAA,QAAQW,EAAOxB,EAAM,UAAU;AAAA,IAAA,CAC9C;AAQD,aAASyB,EAAYC,IAAyB,IAAIC,IAAe,IAAwB;AAEnF,UAAA,CAACR,EAAS;AACL,eAAAO;AAGT,UAAIE,IAAYF;AAGZ,UAAAG,EAA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esContent":["<script lang=\"ts\" setup>\n import isNil from 'lodash-es/isNil';\n import { computed, onMounted, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import { convertDecimal, decimalSeparator, sanitizeDecimal } from '../../utils/i18n';\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import Icon from '../Icon/Icon.vue';\n\n export interface InputProps extends FieldProps {\n /**\n * Autocomplete takes in a string of off or on\n */\n autocomplete?: string;\n\n /**\n * Value for the input element.\n */\n modelValue?: string | number;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: string | number | null;\n\n /**\n * Input type. Excludes certain types that have a dedicated component.\n *\n * Note: For distinguishing between text & number internally, passing `number`\n * will still render an input with a type of `text` (for localization).\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n\n /**\n * Placeholder text for the input.\n * **Note:** placeholders should be used to display examples; they should not be used as labels because they are not accessible as labels. If a real label cannot be used, use the `aria-label` attribute.\n */\n placeholder?: string;\n }\n\n defineOptions({\n name: 'll-input',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<InputProps>(), {\n autocomplete: 'off',\n type: 'text',\n modelValue: '',\n value: null,\n placeholder: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the input value changes.\n */\n (e: 'update:model-value', v: string | number): void;\n /**\n * Emitted when the input value changes.\n */\n (e: 'change', v: string | number): void;\n /**\n * Emitted when the input is focused\n */\n (e: 'focus', evt: Event): void;\n /**\n * Emitted when the input is blurred\n */\n (e: 'blur', evt: Event): void;\n }>();\n\n const slots = useSlots();\n const classes = useCssModule();\n const attrs = useAttrs();\n\n // declare a ref to hold the element reference\n // the name must match template ref value\n const inputEl = ref<HTMLInputElement>();\n\n // this exposes the input ref to any parent that renders the `Input` component\n // and gives it a template ref, giving parent components access to the DOM element.\n defineExpose({ inputEl });\n\n const internalValue = ref<string | number>(props.modelValue);\n\n if (props.type === 'number' && (props.modelValue || props.modelValue === 0)) {\n internalValue.value = convertDecimal(props.modelValue, decimalSeparator);\n }\n\n const showPassword = ref(false);\n\n const isReadOnly = computed(() => props.isReadOnly || ('readonly' in attrs && attrs.readonly !== false));\n const isNumber = computed(() => props.type === 'number');\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const inputType = computed(() => {\n // type 'number' is a special use case and requires\n // that the type be 'text' to support internationalization\n if (isNumber.value) {\n return 'text';\n }\n\n if (props.type === 'password' && showPassword.value) {\n return 'text';\n }\n\n return props.type;\n });\n\n watchEffect(() => {\n internalValue.value = format(props.modelValue);\n });\n\n /**\n * Converts the localized number to a valid number (to emit). i.e. 12,50 > 12.50\n *\n * @param {string|number} value - Number you want to parse.\n * @returns {number|string} number or empty string (for empty input)\n */\n function parseNumber(value: string | number = '', isUserTyping = false): string | number {\n // If this isn't a number input, we shouldn't be calling this function\n if (!isNumber.value) {\n return value;\n }\n\n let tempValue = value;\n\n // If blank, just stop\n if (isNil(tempValue) || `${tempValue}`.length === 0) return '';\n\n // clean out different locale decimals\n if (decimalSeparator !== '.') {\n tempValue = convertDecimal(tempValue, '.');\n }\n\n // If the user is in the middle of an input, let them finish the number\n if (isUserTyping) {\n // Prefix values with a 0 if the user starts with a decimal point\n if (tempValue === '.') tempValue = '0.';\n\n // This is to prevent the parsing from correcting 0. to 0 and causing the value to be reset\n if (tempValue.toString().startsWith('0.')) return tempValue;\n }\n\n // Empty or null values convert to 0 with NumberFormat, so return '';\n if (!isNil(tempValue) && `${tempValue}`.length) {\n tempValue = Intl.NumberFormat('en-US', {\n style: 'decimal',\n maximumFractionDigits: 7,\n useGrouping: false,\n }).format(Number(tempValue));\n } else {\n return '';\n }\n\n // Ensure valid number, otherwise clear value\n return isNaN(Number(tempValue)) ? '' : parseFloat(tempValue);\n }\n\n /**\n * Formats the input based on conditions\n *\n * @param {number|string} value - The value to format.\n */\n function format(value: string | number) {\n if (isNumber.value) {\n return sanitizeDecimal(value, decimalSeparator);\n }\n\n return value;\n }\n\n /**\n * Fire after focusing out of input, if value has changed.\n */\n function handleChange() {\n // Parse the final value on blur\n const parsedValue = isNumber.value ? parseNumber(internalValue.value) : internalValue.value;\n emit('change', parsedValue);\n }\n\n /**\n * Fired when typing on input.\n */\n function handleInput(e: Event) {\n const value = (e.target as HTMLInputElement).value;\n\n // Update the internal value with a sanitized version\n internalValue.value = format(value);\n\n const parsedValue = isNumber.value ? parseNumber(internalValue.value, true) : value;\n\n emit('update:model-value', parsedValue);\n }\n\n onMounted(() => {\n if (props.value !== null) {\n throw new Error('ll-input: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input: use the @update:model-value event instead of @input');\n }\n });\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input\" :class=\"[classes.root, attrs.class]\" data-test=\"ll-input\">\n <template #default=\"{ fieldId, fieldErrorId, hasError }\">\n <div class=\"tw-relative\">\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"internalValue\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n :autocomplete=\"autocomplete\"\n :placeholder=\"props.placeholder\"\n :class=\"[\n { [classes['input-prepended']]: !!slots.prepend },\n { [classes['input-appended']]: !!slots.append || props.type === 'password' },\n { [classes['has-error']]: !!props.errorText },\n ]\"\n :type=\"inputType\"\n :disabled=\"props.isDisabled || props.disabled\"\n :readonly=\"isReadOnly\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @blur=\"(evt) => emit('blur', evt)\"\n @focus=\"(evt) => emit('focus', evt)\"\n />\n\n <div\n v-if=\"slots.prepend\"\n class=\"stash-input-prepend font-semibold\"\n :class=\"[classes.symbol, classes['symbol--prepend']]\"\n >\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </div>\n\n <div\n v-if=\"slots.append || props.type === 'password'\"\n class=\"stash-input-append font-semibold\"\n :class=\"[classes.symbol, classes['symbol--append']]\"\n >\n <!-- @slot renders content on the right side of the input -->\n <slot v-if=\"slots.append\" name=\"append\"></slot>\n <Icon\n v-else\n :name=\"showPassword ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :class=\"{ 'tw-text-ice-500': props.isDisabled || props.disabled }\"\n :data-test=\"showPassword ? 'hide-password-icon' : 'show-password-icon'\"\n @click=\"showPassword = !showPassword\"\n />\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .root {\n position: relative;\n }\n\n .root input {\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: theme('borderRadius.DEFAULT');\n color: var(--color-ice-700);\n display: block;\n height: theme('height.input');\n font-size: theme('fontSize.sm');\n font-weight: theme('fontWeight.normal');\n outline: none;\n padding: 0 theme('spacing.3');\n width: 100%;\n }\n\n .root input:hover {\n border-color: var(--color-ice-500);\n }\n\n .root input:active,\n .root input:focus {\n border-color: var(--color-blue-500);\n }\n\n .root input::placeholder {\n color: var(--color-ice-500);\n opacity: 1;\n }\n\n .root input.has-error:not(:focus) {\n border-color: var(--color-red-500);\n }\n\n .root input.input-prepended {\n padding-left: 36px;\n }\n\n .root input.input-appended {\n padding-right: 36px;\n }\n\n .symbol {\n align-items: center;\n display: flex;\n height: theme('height.input');\n justify-content: center;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: theme('height.input');\n }\n\n .symbol--prepend {\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n border-top-left-radius: theme('borderRadius.DEFAULT');\n left: 0;\n }\n\n .symbol--append {\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n border-top-right-radius: theme('borderRadius.DEFAULT');\n right: 0;\n }\n\n .root input[disabled] {\n background-color: var(--color-ice-100) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-500) !important;\n pointer-events: none;\n outline-color: var(--color-ice-500) !important;\n\n & + .symbol--prepend,\n & + .symbol--append {\n color: var(--color-ice-500);\n }\n }\n\n .root input[readonly] {\n border-color: transparent;\n background-color: transparent;\n padding-left: 0;\n padding-right: 0;\n }\n\n .root input[disabled]:active,\n .root input[readonly]:active,\n .root input[disabled]:focus,\n .root input[readonly]:focus {\n box-shadow: none !important;\n }\n\n .root input[disabled]::placeholder {\n text-transform: none;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","convertDecimal","decimalSeparator","showPassword","isReadOnly","computed","isNumber","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CE,UAAMA,IAAQC,GAQRC,IAAOC,GAmBPC,IAAQC,EAAS,GACjBC,IAAUC,EAAa,GACvBC,IAAQC,EAAS,GAIjBC,IAAUC,EAAsB;AAIzB,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBX,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvEa,EAAc,QAAQC,EAAed,EAAM,YAAYe,CAAgB;AAGnE,UAAAC,IAAeL,EAAI,EAAK,GAExBM,IAAaC,EAAS,MAAMlB,EAAM,cAAe,cAAcQ,KAASA,EAAM,aAAa,EAAM,GACjGW,IAAWD,EAAS,MAAMlB,EAAM,SAAS,QAAQ,GAEjDoB,IAAaF,EAAS,MAAM;AAC1B,YAAAG,IAAY,EAAE,GAAGb,EAAM;AAE7B,oBAAOa,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYJ,EAAS,MAGrBC,EAAS,SAITnB,EAAM,SAAS,cAAcgB,EAAa,QACrC,SAGFhB,EAAM,IACd;AAED,IAAAuB,EAAY,MAAM;AACF,MAAAV,EAAA,QAAQW,EAAOxB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AAAA,IACjF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -107,6 +107,10 @@ declare interface FieldProps {
107
107
  * Show "(optional)" to the right of the label text
108
108
  */
109
109
  showOptionalInLabel?: boolean;
110
+ /**
111
+ * Indicates whether the label should be visually hidden (screen reader only).
112
+ */
113
+ isLabelSrOnly?: boolean;
110
114
  /**
111
115
  * Indicates wheter the field is a fieldset or not
112
116
  */
@@ -1,12 +1,12 @@
1
- import { defineComponent as O, useSlots as $, useAttrs as E, useCssModule as T, ref as u, watchEffect as D, watch as v, createBlock as j, openBlock as p, mergeProps as M, createSlots as R, withCtx as h, createElementBlock as y, createElementVNode as F, toDisplayString as f, normalizeClass as _, unref as d, renderSlot as b, createVNode as w } from "vue";
2
- import N from "./Input.js";
3
- import U from "./Select.js";
4
- import { _ as q } from "./Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js";
5
- import { _ as z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
- const A = {
1
+ import { defineComponent as O, useSlots as $, useAttrs as E, useCssModule as T, ref as u, watchEffect as D, watch as v, createBlock as j, openBlock as p, mergeProps as M, createSlots as R, withCtx as y, createElementBlock as h, createElementVNode as F, toDisplayString as f, normalizeClass as _, unref as d, renderSlot as b, createVNode as w } from "vue";
2
+ import L from "./Input.js";
3
+ import N from "./Select.js";
4
+ import { _ as U } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
5
+ import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
+ const z = {
7
7
  key: 0,
8
8
  class: "tw-flex tw-h-input tw-items-center tw-text-sm"
9
- }, L = ["id", "aria-labelledby"], P = /* @__PURE__ */ O({
9
+ }, A = ["id", "aria-labelledby"], P = /* @__PURE__ */ O({
10
10
  name: "ll-input-options",
11
11
  __name: "InputOptions",
12
12
  props: {
@@ -26,6 +26,7 @@ const A = {
26
26
  isRequired: { type: Boolean },
27
27
  label: {},
28
28
  showOptionalInLabel: { type: Boolean },
29
+ isLabelSrOnly: { type: Boolean },
29
30
  fieldset: { type: Boolean },
30
31
  isDisabled: { type: Boolean },
31
32
  disabled: { type: Boolean }
@@ -49,7 +50,7 @@ const A = {
49
50
  type: "input"
50
51
  });
51
52
  }
52
- function I(l) {
53
+ function S(l) {
53
54
  t.value = l, o("change", {
54
55
  value: a.value,
55
56
  option: t.value,
@@ -80,25 +81,25 @@ const A = {
80
81
  throw new Error("ll-input-options: use :model-value or v-model instead of :value.");
81
82
  if (r.onInput)
82
83
  throw new Error("ll-input-options: use the @update:model-value event instead of @input");
83
- return (l, s) => (p(), j(q, M(e, {
84
+ return (l, s) => (p(), j(U, M(e, {
84
85
  class: "stash-input-options",
85
86
  "data-test": "stash-input-options"
86
87
  }), R({
87
- default: h(({ fieldId: i, labelId: S }) => {
88
+ default: y(({ fieldId: i, labelId: I }) => {
88
89
  var m;
89
90
  return [
90
- e.isReadOnly ? (p(), y("div", A, [
91
+ e.isReadOnly ? (p(), h("div", z, [
91
92
  F("span", {
92
93
  id: i,
93
- "aria-labelledby": S,
94
+ "aria-labelledby": I,
94
95
  class: "tw-h-min"
95
- }, f(a.value || 0) + " " + f((m = t.value) == null ? void 0 : m.name), 9, L)
96
- ])) : (p(), y("div", {
96
+ }, f(a.value || 0) + " " + f((m = t.value) == null ? void 0 : m.name), 9, A)
97
+ ])) : (p(), h("div", {
97
98
  key: 1,
98
99
  class: _(["tw-flex", [d(n)["input-wrapper"], { [d(n)["has-error"]]: !!e.errorText }]])
99
100
  }, [
100
101
  b(l.$slots, "default", { fieldId: i }, () => [
101
- w(N, {
102
+ w(L, {
102
103
  id: i,
103
104
  class: "stash-input-options__input",
104
105
  "data-test": "stash-input-options|input",
@@ -112,7 +113,7 @@ const A = {
112
113
  onFocus: s[1] || (s[1] = (x) => c.value = !0)
113
114
  }, null, 8, ["id", "type", "model-value", "disabled", "placeholder"])
114
115
  ]),
115
- w(U, {
116
+ w(N, {
116
117
  single: "",
117
118
  "hide-search": "",
118
119
  "prevent-empty": "",
@@ -124,7 +125,7 @@ const A = {
124
125
  "display-by": e.displayBy,
125
126
  "track-by": e.trackBy,
126
127
  disabled: e.isDisabled || e.disabled,
127
- "onUpdate:modelValue": I
128
+ "onUpdate:modelValue": S
128
129
  }, null, 8, ["class", "no-truncate", "options", "model-value", "display-by", "track-by", "disabled"])
129
130
  ], 2))
130
131
  ];
@@ -133,7 +134,7 @@ const A = {
133
134
  }, [
134
135
  V.hint ? {
135
136
  name: "hint",
136
- fn: h(() => [
137
+ fn: y(() => [
137
138
  b(l.$slots, "hint")
138
139
  ]),
139
140
  key: "0"
@@ -146,7 +147,7 @@ const A = {
146
147
  select: G
147
148
  }, J = {
148
149
  $style: H
149
- }, Z = /* @__PURE__ */ z(P, [["__cssModules", J]]);
150
+ }, Z = /* @__PURE__ */ q(P, [["__cssModules", J]]);
150
151
  export {
151
152
  Z as default
152
153
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InputOptions.js","sources":["../src/components/InputOptions/InputOptions.vue"],"sourcesContent":["<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type Option = any;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type SelectedOption = any;\n\n export interface InputOptionsProps extends FieldProps {\n /**\n * The current value inclusive of the input & select\n */\n modelValue?: { value: string; option?: SelectedOption };\n\n /**\n * Input type\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n\n /**\n * Prevents the Selected Option from being truncated, if true\n */\n noTruncate?: boolean;\n\n /**\n * Options for the select\n */\n options?: Option[];\n\n /**\n * Placeholder text for the input\n * **Note:** placeholders should be used to display examples; they should not be used as labels because they are not accessible as labels. If a real label cannot be used, use the `aria-label` attribute.\n */\n placeholder?: string;\n\n /**\n * If `options` are an object, this is what prop to use for display.\n */\n displayBy?: string;\n\n /**\n * Default field to track selected options by.\n */\n trackBy?: string;\n }\n</script>\n\n<script lang=\"ts\" setup>\n import { ref, useAttrs, useCssModule, watch, watchEffect } from 'vue';\n\n import Input from '../Input/Input.vue';\n import Select from '../Select/Select.vue';\n\n defineOptions({\n name: 'll-input-options',\n });\n\n const props = withDefaults(defineProps<InputOptionsProps>(), {\n modelValue: () => ({ value: '', option: undefined }),\n noTruncate: false,\n options: () => [],\n type: 'text',\n placeholder: undefined,\n displayBy: undefined,\n trackBy: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (\n e: 'update:model-value',\n v: { value?: string; option?: SelectedOption; isValueChange: boolean; type: 'input' | 'select' },\n ): void;\n /**\n * Emitted when either the input or select changes\n */\n (\n e: 'change',\n v: { value?: string; option?: SelectedOption; isValueChange: boolean; type: 'input' | 'select' },\n ): void;\n }>();\n\n const slots = defineSlots<{\n /**\n * Default slot for rendering a custom input field.\n */\n default: (props: { fieldId: string }) => void;\n /**\n * Hint slot for rendering a custom hint text.\n */\n hint: () => void;\n }>();\n\n const attrs = useAttrs();\n const classes = useCssModule();\n const internalInput = ref<string>();\n const isInputFocused = ref(false);\n const selectedOption = ref<Option | undefined>();\n\n // Input value changed\n function handleInput(val?: string | number) {\n internalInput.value = String(val);\n\n emit('update:model-value', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: true,\n type: 'input',\n });\n }\n\n // Input blurred\n function handleInputChange() {\n emit('change', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: true,\n type: 'input',\n });\n }\n\n function handleSelectChange(val?: Option) {\n selectedOption.value = val;\n\n emit('change', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: false,\n type: 'select',\n });\n emit('update:model-value', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: false,\n type: 'select',\n });\n }\n\n watchEffect(() => {\n if (!selectedOption.value) {\n selectedOption.value = props.options[0];\n }\n });\n\n watch(\n () => props.modelValue.value,\n () => {\n internalInput.value = props.modelValue.value;\n },\n { immediate: true },\n );\n\n watch(\n () => props.modelValue.option,\n () => {\n selectedOption.value = props.modelValue.option;\n },\n { immediate: true },\n );\n\n if (attrs.value) {\n throw new Error('ll-input-options: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input-options: use the @update:model-value event instead of @input');\n }\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input-options\" data-test=\"stash-input-options\">\n <template #default=\"{ fieldId, labelId }\">\n <div v-if=\"props.isReadOnly\" class=\"tw-flex tw-h-input tw-items-center tw-text-sm\">\n <span :id=\"fieldId\" :aria-labelledby=\"labelId\" class=\"tw-h-min\">\n {{ internalInput || 0 }} {{ selectedOption?.name }}\n </span>\n </div>\n <div v-else class=\"tw-flex\" :class=\"[classes['input-wrapper'], { [classes['has-error']]: !!props.errorText }]\">\n <slot :field-id=\"fieldId\">\n <Input\n :id=\"fieldId\"\n class=\"stash-input-options__input\"\n data-test=\"stash-input-options|input\"\n :type=\"props.type\"\n :model-value=\"internalInput\"\n :disabled=\"props.isDisabled || props.disabled\"\n :placeholder=\"props.placeholder\"\n @change=\"handleInputChange\"\n @update:model-value=\"handleInput\"\n @blur=\"isInputFocused = false\"\n @focus=\"isInputFocused = true\"\n />\n </slot>\n\n <Select\n single\n hide-search\n prevent-empty\n class=\"stash-input-options__select tw-min-w-20\"\n data-test=\"stash-input-options|select\"\n :class=\"classes.select\"\n :no-truncate=\"noTruncate\"\n :options=\"options\"\n :model-value=\"selectedOption\"\n :display-by=\"props.displayBy\"\n :track-by=\"props.trackBy\"\n :disabled=\"props.isDisabled || props.disabled\"\n @update:model-value=\"handleSelectChange\"\n />\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Hint slot for rendering text below the input -->\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .input-wrapper {\n & > div:has(input) {\n display: inline-block;\n flex: 1;\n margin-right: -1px;\n }\n\n & input {\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n }\n\n &.has-error input,\n &.has-error input:hover:not(:focus),\n &.has-error :global(.stash-select__content),\n &.has-error :global(.stash-select__content:hover:not(:focus)) {\n border-color: var(--color-red-500);\n }\n\n & div:has(input:focus) {\n z-index: 200 !important;\n }\n }\n\n .select :global(.stash-select__content) {\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n }\n\n .select:global(.stash-select--active .stash-select__content) {\n min-width: 0;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","_useSlots","attrs","useAttrs","classes","useCssModule","internalInput","ref","isInputFocused","selectedOption","handleInput","val","handleInputChange","handleSelectChange","watchEffect","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DE,UAAMA,IAAQC,GAURC,IAAOC,GAiBPC,IAAQC,EASV,GAEEC,IAAQC,EAAS,GACjBC,IAAUC,EAAa,GACvBC,IAAgBC,EAAY,GAC5BC,IAAiBD,EAAI,EAAK,GAC1BE,IAAiBF,EAAwB;AAG/C,aAASG,EAAYC,GAAuB;AAC5B,MAAAL,EAAA,QAAQ,OAAOK,CAAG,GAEhCb,EAAK,sBAAsB;AAAA,QACzB,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAIH,aAASG,IAAoB;AAC3B,MAAAd,EAAK,UAAU;AAAA,QACb,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAGH,aAASI,EAAmBF,GAAc;AACxC,MAAAF,EAAe,QAAQE,GAEvBb,EAAK,UAAU;AAAA,QACb,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP,GACDX,EAAK,sBAAsB;AAAA,QACzB,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAyBH,QAtBAK,EAAY,MAAM;AACZ,MAACL,EAAe,UACHA,EAAA,QAAQb,EAAM,QAAQ,CAAC;AAAA,IACxC,CACD,GAEDmB;AAAA,MACE,MAAMnB,EAAM,WAAW;AAAA,MACvB,MAAM;AACU,QAAAU,EAAA,QAAQV,EAAM,WAAW;AAAA,MACzC;AAAA,MACA,EAAE,WAAW,GAAK;AAAA,IACpB,GAEAmB;AAAA,MACE,MAAMnB,EAAM,WAAW;AAAA,MACvB,MAAM;AACW,QAAAa,EAAA,QAAQb,EAAM,WAAW;AAAA,MAC1C;AAAA,MACA,EAAE,WAAW,GAAK;AAAA,IACpB,GAEIM,EAAM;AACF,YAAA,IAAI,MAAM,kEAAkE;AAGpF,QAAIA,EAAM;AACF,YAAA,IAAI,MAAM,uEAAuE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"InputOptions.js","sources":["../src/components/InputOptions/InputOptions.vue"],"sourcesContent":["<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type Option = any;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type SelectedOption = any;\n\n export interface InputOptionsProps extends FieldProps {\n /**\n * The current value inclusive of the input & select\n */\n modelValue?: { value: string; option?: SelectedOption };\n\n /**\n * Input type\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n\n /**\n * Prevents the Selected Option from being truncated, if true\n */\n noTruncate?: boolean;\n\n /**\n * Options for the select\n */\n options?: Option[];\n\n /**\n * Placeholder text for the input\n * **Note:** placeholders should be used to display examples; they should not be used as labels because they are not accessible as labels. If a real label cannot be used, use the `aria-label` attribute.\n */\n placeholder?: string;\n\n /**\n * If `options` are an object, this is what prop to use for display.\n */\n displayBy?: string;\n\n /**\n * Default field to track selected options by.\n */\n trackBy?: string;\n }\n</script>\n\n<script lang=\"ts\" setup>\n import { ref, useAttrs, useCssModule, watch, watchEffect } from 'vue';\n\n import Input from '../Input/Input.vue';\n import Select from '../Select/Select.vue';\n\n defineOptions({\n name: 'll-input-options',\n });\n\n const props = withDefaults(defineProps<InputOptionsProps>(), {\n modelValue: () => ({ value: '', option: undefined }),\n noTruncate: false,\n options: () => [],\n type: 'text',\n placeholder: undefined,\n displayBy: undefined,\n trackBy: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (\n e: 'update:model-value',\n v: { value?: string; option?: SelectedOption; isValueChange: boolean; type: 'input' | 'select' },\n ): void;\n /**\n * Emitted when either the input or select changes\n */\n (\n e: 'change',\n v: { value?: string; option?: SelectedOption; isValueChange: boolean; type: 'input' | 'select' },\n ): void;\n }>();\n\n const slots = defineSlots<{\n /**\n * Default slot for rendering a custom input field.\n */\n default: (props: { fieldId: string }) => void;\n /**\n * Hint slot for rendering a custom hint text.\n */\n hint: () => void;\n }>();\n\n const attrs = useAttrs();\n const classes = useCssModule();\n const internalInput = ref<string>();\n const isInputFocused = ref(false);\n const selectedOption = ref<Option | undefined>();\n\n // Input value changed\n function handleInput(val?: string | number) {\n internalInput.value = String(val);\n\n emit('update:model-value', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: true,\n type: 'input',\n });\n }\n\n // Input blurred\n function handleInputChange() {\n emit('change', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: true,\n type: 'input',\n });\n }\n\n function handleSelectChange(val?: Option) {\n selectedOption.value = val;\n\n emit('change', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: false,\n type: 'select',\n });\n emit('update:model-value', {\n value: internalInput.value,\n option: selectedOption.value,\n isValueChange: false,\n type: 'select',\n });\n }\n\n watchEffect(() => {\n if (!selectedOption.value) {\n selectedOption.value = props.options[0];\n }\n });\n\n watch(\n () => props.modelValue.value,\n () => {\n internalInput.value = props.modelValue.value;\n },\n { immediate: true },\n );\n\n watch(\n () => props.modelValue.option,\n () => {\n selectedOption.value = props.modelValue.option;\n },\n { immediate: true },\n );\n\n if (attrs.value) {\n throw new Error('ll-input-options: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input-options: use the @update:model-value event instead of @input');\n }\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input-options\" data-test=\"stash-input-options\">\n <template #default=\"{ fieldId, labelId }\">\n <div v-if=\"props.isReadOnly\" class=\"tw-flex tw-h-input tw-items-center tw-text-sm\">\n <span :id=\"fieldId\" :aria-labelledby=\"labelId\" class=\"tw-h-min\">\n {{ internalInput || 0 }} {{ selectedOption?.name }}\n </span>\n </div>\n <div v-else class=\"tw-flex\" :class=\"[classes['input-wrapper'], { [classes['has-error']]: !!props.errorText }]\">\n <slot :field-id=\"fieldId\">\n <Input\n :id=\"fieldId\"\n class=\"stash-input-options__input\"\n data-test=\"stash-input-options|input\"\n :type=\"props.type\"\n :model-value=\"internalInput\"\n :disabled=\"props.isDisabled || props.disabled\"\n :placeholder=\"props.placeholder\"\n @change=\"handleInputChange\"\n @update:model-value=\"handleInput\"\n @blur=\"isInputFocused = false\"\n @focus=\"isInputFocused = true\"\n />\n </slot>\n\n <Select\n single\n hide-search\n prevent-empty\n class=\"stash-input-options__select tw-min-w-20\"\n data-test=\"stash-input-options|select\"\n :class=\"classes.select\"\n :no-truncate=\"noTruncate\"\n :options=\"options\"\n :model-value=\"selectedOption\"\n :display-by=\"props.displayBy\"\n :track-by=\"props.trackBy\"\n :disabled=\"props.isDisabled || props.disabled\"\n @update:model-value=\"handleSelectChange\"\n />\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Hint slot for rendering text below the input -->\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .input-wrapper {\n & > div:has(input) {\n display: inline-block;\n flex: 1;\n margin-right: -1px;\n }\n\n & input {\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n }\n\n &.has-error input,\n &.has-error input:hover:not(:focus),\n &.has-error :global(.stash-select__content),\n &.has-error :global(.stash-select__content:hover:not(:focus)) {\n border-color: var(--color-red-500);\n }\n\n & div:has(input:focus) {\n z-index: 200 !important;\n }\n }\n\n .select :global(.stash-select__content) {\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n }\n\n .select:global(.stash-select--active .stash-select__content) {\n min-width: 0;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","_useSlots","attrs","useAttrs","classes","useCssModule","internalInput","ref","isInputFocused","selectedOption","handleInput","val","handleInputChange","handleSelectChange","watchEffect","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DE,UAAMA,IAAQC,GAURC,IAAOC,GAiBPC,IAAQC,EASV,GAEEC,IAAQC,EAAS,GACjBC,IAAUC,EAAa,GACvBC,IAAgBC,EAAY,GAC5BC,IAAiBD,EAAI,EAAK,GAC1BE,IAAiBF,EAAwB;AAG/C,aAASG,EAAYC,GAAuB;AAC5B,MAAAL,EAAA,QAAQ,OAAOK,CAAG,GAEhCb,EAAK,sBAAsB;AAAA,QACzB,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAIH,aAASG,IAAoB;AAC3B,MAAAd,EAAK,UAAU;AAAA,QACb,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAGH,aAASI,EAAmBF,GAAc;AACxC,MAAAF,EAAe,QAAQE,GAEvBb,EAAK,UAAU;AAAA,QACb,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP,GACDX,EAAK,sBAAsB;AAAA,QACzB,OAAOQ,EAAc;AAAA,QACrB,QAAQG,EAAe;AAAA,QACvB,eAAe;AAAA,QACf,MAAM;AAAA,MAAA,CACP;AAAA,IAAA;AAyBH,QAtBAK,EAAY,MAAM;AACZ,MAACL,EAAe,UACHA,EAAA,QAAQb,EAAM,QAAQ,CAAC;AAAA,IACxC,CACD,GAEDmB;AAAA,MACE,MAAMnB,EAAM,WAAW;AAAA,MACvB,MAAM;AACU,QAAAU,EAAA,QAAQV,EAAM,WAAW;AAAA,MACzC;AAAA,MACA,EAAE,WAAW,GAAK;AAAA,IACpB,GAEAmB;AAAA,MACE,MAAMnB,EAAM,WAAW;AAAA,MACvB,MAAM;AACW,QAAAa,EAAA,QAAQb,EAAM,WAAW;AAAA,MAC1C;AAAA,MACA,EAAE,WAAW,GAAK;AAAA,IACpB,GAEIM,EAAM;AACF,YAAA,IAAI,MAAM,kEAAkE;AAGpF,QAAIA,EAAM;AACF,YAAA,IAAI,MAAM,uEAAuE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -153,6 +153,10 @@ declare interface FieldProps {
153
153
  * Show "(optional)" to the right of the label text
154
154
  */
155
155
  showOptionalInLabel?: boolean;
156
+ /**
157
+ * Indicates whether the label should be visually hidden (screen reader only).
158
+ */
159
+ isLabelSrOnly?: boolean;
156
160
  /**
157
161
  * Indicates wheter the field is a fieldset or not
158
162
  */
package/dist/Label.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js";
1
+ import { _ as f } from "./Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -39,6 +39,7 @@ isRequired: boolean;
39
39
  showOptional: boolean;
40
40
  legend: boolean;
41
41
  isDisabled: boolean;
42
+ isSrOnly: boolean;
42
43
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<LabelProps>, {
43
44
  for: undefined;
44
45
  hasError: boolean;
@@ -46,12 +47,14 @@ isRequired: boolean;
46
47
  showOptional: boolean;
47
48
  legend: boolean;
48
49
  isDisabled: boolean;
50
+ isSrOnly: boolean;
49
51
  }>>> & Readonly<{}>, {
50
52
  legend: boolean;
51
53
  for: string;
52
54
  hasError: boolean;
53
55
  isRequired: boolean;
54
56
  showOptional: boolean;
57
+ isSrOnly: boolean;
55
58
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
56
59
  default?(_: {}): any;
57
60
  }>;
@@ -82,6 +85,10 @@ export declare interface LabelProps {
82
85
  * Indicates whether the label is disabled.
83
86
  */
84
87
  disabled?: boolean;
88
+ /**
89
+ * Indicates whether the label should be visually hidden (screen reader only).
90
+ */
91
+ isSrOnly?: boolean;
85
92
  }
86
93
 
87
94
  export { }